diff options
Diffstat (limited to 'examples/common.js')
-rw-r--r-- | examples/common.js | 35026 |
1 files changed, 18787 insertions, 16239 deletions
diff --git a/examples/common.js b/examples/common.js index 9fddb37..1076b21 100644 --- a/examples/common.js +++ b/examples/common.js | |||
@@ -112,8 +112,8 @@ | |||
112 | /* 4 */ | 112 | /* 4 */ |
113 | /***/ function(module, exports, __webpack_require__) { | 113 | /***/ function(module, exports, __webpack_require__) { |
114 | 114 | ||
115 | /** | 115 | /* WEBPACK VAR INJECTION */(function(process) {/** |
116 | * Copyright 2013-2015, Facebook, Inc. | 116 | * Copyright 2013-present, Facebook, Inc. |
117 | * All rights reserved. | 117 | * All rights reserved. |
118 | * | 118 | * |
119 | * This source code is licensed under the BSD-style license found in the | 119 | * This source code is licensed under the BSD-style license found in the |
@@ -125,145 +125,138 @@ | |||
125 | 125 | ||
126 | 'use strict'; | 126 | 'use strict'; |
127 | 127 | ||
128 | var ReactDOM = __webpack_require__(5); | 128 | var _assign = __webpack_require__(6); |
129 | var ReactDOMServer = __webpack_require__(150); | ||
130 | var ReactIsomorphic = __webpack_require__(154); | ||
131 | |||
132 | var assign = __webpack_require__(41); | ||
133 | var deprecated = __webpack_require__(159); | ||
134 | |||
135 | // `version` will be added here by ReactIsomorphic. | ||
136 | var React = {}; | ||
137 | |||
138 | assign(React, ReactIsomorphic); | ||
139 | |||
140 | assign(React, { | ||
141 | // ReactDOM | ||
142 | findDOMNode: deprecated('findDOMNode', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.findDOMNode), | ||
143 | render: deprecated('render', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.render), | ||
144 | unmountComponentAtNode: deprecated('unmountComponentAtNode', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.unmountComponentAtNode), | ||
145 | |||
146 | // ReactDOMServer | ||
147 | renderToString: deprecated('renderToString', 'ReactDOMServer', 'react-dom/server', ReactDOMServer, ReactDOMServer.renderToString), | ||
148 | renderToStaticMarkup: deprecated('renderToStaticMarkup', 'ReactDOMServer', 'react-dom/server', ReactDOMServer, ReactDOMServer.renderToStaticMarkup) | ||
149 | }); | ||
150 | |||
151 | React.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOM; | ||
152 | React.__SECRET_DOM_SERVER_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOMServer; | ||
153 | |||
154 | module.exports = React; | ||
155 | |||
156 | /***/ }, | ||
157 | /* 5 */ | ||
158 | /***/ function(module, exports, __webpack_require__) { | ||
159 | |||
160 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
161 | * Copyright 2013-2015, Facebook, Inc. | ||
162 | * All rights reserved. | ||
163 | * | ||
164 | * This source code is licensed under the BSD-style license found in the | ||
165 | * LICENSE file in the root directory of this source tree. An additional grant | ||
166 | * of patent rights can be found in the PATENTS file in the same directory. | ||
167 | * | ||
168 | * @providesModule ReactDOM | ||
169 | */ | ||
170 | 129 | ||
171 | /* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/ | 130 | var ReactChildren = __webpack_require__(7); |
131 | var ReactComponent = __webpack_require__(19); | ||
132 | var ReactPureComponent = __webpack_require__(22); | ||
133 | var ReactClass = __webpack_require__(23); | ||
134 | var ReactDOMFactories = __webpack_require__(28); | ||
135 | var ReactElement = __webpack_require__(11); | ||
136 | var ReactPropTypes = __webpack_require__(34); | ||
137 | var ReactVersion = __webpack_require__(35); | ||
172 | 138 | ||
173 | 'use strict'; | 139 | var onlyChild = __webpack_require__(36); |
140 | var warning = __webpack_require__(13); | ||
174 | 141 | ||
175 | var ReactCurrentOwner = __webpack_require__(7); | 142 | var createElement = ReactElement.createElement; |
176 | var ReactDOMTextComponent = __webpack_require__(8); | 143 | var createFactory = ReactElement.createFactory; |
177 | var ReactDefaultInjection = __webpack_require__(73); | 144 | var cloneElement = ReactElement.cloneElement; |
178 | var ReactInstanceHandles = __webpack_require__(47); | ||
179 | var ReactMount = __webpack_require__(30); | ||
180 | var ReactPerf = __webpack_require__(20); | ||
181 | var ReactReconciler = __webpack_require__(52); | ||
182 | var ReactUpdates = __webpack_require__(56); | ||
183 | var ReactVersion = __webpack_require__(148); | ||
184 | 145 | ||
185 | var findDOMNode = __webpack_require__(93); | 146 | if (process.env.NODE_ENV !== 'production') { |
186 | var renderSubtreeIntoContainer = __webpack_require__(149); | 147 | var ReactElementValidator = __webpack_require__(30); |
187 | var warning = __webpack_require__(27); | 148 | createElement = ReactElementValidator.createElement; |
149 | createFactory = ReactElementValidator.createFactory; | ||
150 | cloneElement = ReactElementValidator.cloneElement; | ||
151 | } | ||
188 | 152 | ||
189 | ReactDefaultInjection.inject(); | 153 | var __spread = _assign; |
190 | 154 | ||
191 | var render = ReactPerf.measure('React', 'render', ReactMount.render); | 155 | if (process.env.NODE_ENV !== 'production') { |
156 | var warned = false; | ||
157 | __spread = function () { | ||
158 | 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; | ||
159 | warned = true; | ||
160 | return _assign.apply(null, arguments); | ||
161 | }; | ||
162 | } | ||
192 | 163 | ||
193 | var React = { | 164 | var React = { |
194 | findDOMNode: findDOMNode, | ||
195 | render: render, | ||
196 | unmountComponentAtNode: ReactMount.unmountComponentAtNode, | ||
197 | version: ReactVersion, | ||
198 | 165 | ||
199 | /* eslint-disable camelcase */ | 166 | // Modern |
200 | unstable_batchedUpdates: ReactUpdates.batchedUpdates, | ||
201 | unstable_renderSubtreeIntoContainer: renderSubtreeIntoContainer | ||
202 | }; | ||
203 | 167 | ||
204 | // Inject the runtime into a devtools global hook regardless of browser. | 168 | Children: { |
205 | // Allows for debugging when the hook is injected on the page. | 169 | map: ReactChildren.map, |
206 | /* eslint-enable camelcase */ | 170 | forEach: ReactChildren.forEach, |
207 | if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') { | 171 | count: ReactChildren.count, |
208 | __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({ | 172 | toArray: ReactChildren.toArray, |
209 | CurrentOwner: ReactCurrentOwner, | 173 | only: onlyChild |
210 | InstanceHandles: ReactInstanceHandles, | 174 | }, |
211 | Mount: ReactMount, | ||
212 | Reconciler: ReactReconciler, | ||
213 | TextComponent: ReactDOMTextComponent | ||
214 | }); | ||
215 | } | ||
216 | 175 | ||
217 | if (process.env.NODE_ENV !== 'production') { | 176 | Component: ReactComponent, |
218 | var ExecutionEnvironment = __webpack_require__(11); | 177 | PureComponent: ReactPureComponent, |
219 | if (ExecutionEnvironment.canUseDOM && window.top === window.self) { | ||
220 | 178 | ||
221 | // First check if devtools is not installed | 179 | createElement: createElement, |
222 | if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') { | 180 | cloneElement: cloneElement, |
223 | // If we're in Chrome or Firefox, provide a download link if not installed. | 181 | isValidElement: ReactElement.isValidElement, |
224 | if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) { | ||
225 | console.debug('Download the React DevTools for a better development experience: ' + 'https://fb.me/react-devtools'); | ||
226 | } | ||
227 | } | ||
228 | 182 | ||
229 | // If we're in IE8, check to see if we are in compatibility mode and provide | 183 | // Classic |
230 | // information on preventing compatibility mode | ||
231 | var ieCompatibilityMode = document.documentMode && document.documentMode < 8; | ||
232 | 184 | ||
233 | 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" />') : undefined; | 185 | PropTypes: ReactPropTypes, |
186 | createClass: ReactClass.createClass, | ||
187 | createFactory: createFactory, | ||
188 | createMixin: function (mixin) { | ||
189 | // Currently a noop. Will be used to validate and trace mixins. | ||
190 | return mixin; | ||
191 | }, | ||
234 | 192 | ||
235 | var expectedFeatures = [ | 193 | // This looks DOM specific but these are actually isomorphic helpers |
236 | // shims | 194 | // since they are just generating DOM strings. |
237 | Array.isArray, Array.prototype.every, Array.prototype.forEach, Array.prototype.indexOf, Array.prototype.map, Date.now, Function.prototype.bind, Object.keys, String.prototype.split, String.prototype.trim, | 195 | DOM: ReactDOMFactories, |
238 | 196 | ||
239 | // shams | 197 | version: ReactVersion, |
240 | Object.create, Object.freeze]; | ||
241 | 198 | ||
242 | for (var i = 0; i < expectedFeatures.length; i++) { | 199 | // Deprecated hook for JSX spread, don't use this for anything. |
243 | if (!expectedFeatures[i]) { | 200 | __spread: __spread |
244 | console.error('One or more ES5 shim/shams expected by React are not available: ' + 'https://fb.me/react-warning-polyfills'); | 201 | }; |
245 | break; | ||
246 | } | ||
247 | } | ||
248 | } | ||
249 | } | ||
250 | 202 | ||
251 | module.exports = React; | 203 | module.exports = React; |
252 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | 204 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) |
253 | 205 | ||
254 | /***/ }, | 206 | /***/ }, |
255 | /* 6 */ | 207 | /* 5 */ |
256 | /***/ function(module, exports) { | 208 | /***/ function(module, exports) { |
257 | 209 | ||
258 | // shim for using process in browser | 210 | // shim for using process in browser |
259 | |||
260 | var process = module.exports = {}; | 211 | var process = module.exports = {}; |
212 | |||
213 | // cached from whatever global is present so that test runners that stub it | ||
214 | // don't break things. But we need to wrap it in a try catch in case it is | ||
215 | // wrapped in strict mode code which doesn't define any globals. It's inside a | ||
216 | // function because try/catches deoptimize in certain engines. | ||
217 | |||
218 | var cachedSetTimeout; | ||
219 | var cachedClearTimeout; | ||
220 | |||
221 | (function () { | ||
222 | try { | ||
223 | cachedSetTimeout = setTimeout; | ||
224 | } catch (e) { | ||
225 | cachedSetTimeout = function () { | ||
226 | throw new Error('setTimeout is not defined'); | ||
227 | } | ||
228 | } | ||
229 | try { | ||
230 | cachedClearTimeout = clearTimeout; | ||
231 | } catch (e) { | ||
232 | cachedClearTimeout = function () { | ||
233 | throw new Error('clearTimeout is not defined'); | ||
234 | } | ||
235 | } | ||
236 | } ()) | ||
237 | function runTimeout(fun) { | ||
238 | if (cachedSetTimeout === setTimeout) { | ||
239 | return setTimeout(fun, 0); | ||
240 | } else { | ||
241 | return cachedSetTimeout.call(null, fun, 0); | ||
242 | } | ||
243 | } | ||
244 | function runClearTimeout(marker) { | ||
245 | if (cachedClearTimeout === clearTimeout) { | ||
246 | clearTimeout(marker); | ||
247 | } else { | ||
248 | cachedClearTimeout.call(null, marker); | ||
249 | } | ||
250 | } | ||
261 | var queue = []; | 251 | var queue = []; |
262 | var draining = false; | 252 | var draining = false; |
263 | var currentQueue; | 253 | var currentQueue; |
264 | var queueIndex = -1; | 254 | var queueIndex = -1; |
265 | 255 | ||
266 | function cleanUpNextTick() { | 256 | function cleanUpNextTick() { |
257 | if (!draining || !currentQueue) { | ||
258 | return; | ||
259 | } | ||
267 | draining = false; | 260 | draining = false; |
268 | if (currentQueue.length) { | 261 | if (currentQueue.length) { |
269 | queue = currentQueue.concat(queue); | 262 | queue = currentQueue.concat(queue); |
@@ -279,7 +272,7 @@ | |||
279 | if (draining) { | 272 | if (draining) { |
280 | return; | 273 | return; |
281 | } | 274 | } |
282 | var timeout = setTimeout(cleanUpNextTick); | 275 | var timeout = runTimeout(cleanUpNextTick); |
283 | draining = true; | 276 | draining = true; |
284 | 277 | ||
285 | var len = queue.length; | 278 | var len = queue.length; |
@@ -296,7 +289,7 @@ | |||
296 | } | 289 | } |
297 | currentQueue = null; | 290 | currentQueue = null; |
298 | draining = false; | 291 | draining = false; |
299 | clearTimeout(timeout); | 292 | runClearTimeout(timeout); |
300 | } | 293 | } |
301 | 294 | ||
302 | process.nextTick = function (fun) { | 295 | process.nextTick = function (fun) { |
@@ -308,7 +301,7 @@ | |||
308 | } | 301 | } |
309 | queue.push(new Item(fun, args)); | 302 | queue.push(new Item(fun, args)); |
310 | if (queue.length === 1 && !draining) { | 303 | if (queue.length === 1 && !draining) { |
311 | setTimeout(drainQueue, 0); | 304 | runTimeout(drainQueue); |
312 | } | 305 | } |
313 | }; | 306 | }; |
314 | 307 | ||
@@ -349,998 +342,2417 @@ | |||
349 | 342 | ||
350 | 343 | ||
351 | /***/ }, | 344 | /***/ }, |
352 | /* 7 */ | 345 | /* 6 */ |
353 | /***/ function(module, exports) { | 346 | /***/ function(module, exports) { |
354 | 347 | ||
348 | 'use strict'; | ||
349 | /* eslint-disable no-unused-vars */ | ||
350 | var hasOwnProperty = Object.prototype.hasOwnProperty; | ||
351 | var propIsEnumerable = Object.prototype.propertyIsEnumerable; | ||
352 | |||
353 | function toObject(val) { | ||
354 | if (val === null || val === undefined) { | ||
355 | throw new TypeError('Object.assign cannot be called with null or undefined'); | ||
356 | } | ||
357 | |||
358 | return Object(val); | ||
359 | } | ||
360 | |||
361 | function shouldUseNative() { | ||
362 | try { | ||
363 | if (!Object.assign) { | ||
364 | return false; | ||
365 | } | ||
366 | |||
367 | // Detect buggy property enumeration order in older V8 versions. | ||
368 | |||
369 | // https://bugs.chromium.org/p/v8/issues/detail?id=4118 | ||
370 | var test1 = new String('abc'); // eslint-disable-line | ||
371 | test1[5] = 'de'; | ||
372 | if (Object.getOwnPropertyNames(test1)[0] === '5') { | ||
373 | return false; | ||
374 | } | ||
375 | |||
376 | // https://bugs.chromium.org/p/v8/issues/detail?id=3056 | ||
377 | var test2 = {}; | ||
378 | for (var i = 0; i < 10; i++) { | ||
379 | test2['_' + String.fromCharCode(i)] = i; | ||
380 | } | ||
381 | var order2 = Object.getOwnPropertyNames(test2).map(function (n) { | ||
382 | return test2[n]; | ||
383 | }); | ||
384 | if (order2.join('') !== '0123456789') { | ||
385 | return false; | ||
386 | } | ||
387 | |||
388 | // https://bugs.chromium.org/p/v8/issues/detail?id=3056 | ||
389 | var test3 = {}; | ||
390 | 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { | ||
391 | test3[letter] = letter; | ||
392 | }); | ||
393 | if (Object.keys(Object.assign({}, test3)).join('') !== | ||
394 | 'abcdefghijklmnopqrst') { | ||
395 | return false; | ||
396 | } | ||
397 | |||
398 | return true; | ||
399 | } catch (e) { | ||
400 | // We don't expect any of the above to throw, but better to be safe. | ||
401 | return false; | ||
402 | } | ||
403 | } | ||
404 | |||
405 | module.exports = shouldUseNative() ? Object.assign : function (target, source) { | ||
406 | var from; | ||
407 | var to = toObject(target); | ||
408 | var symbols; | ||
409 | |||
410 | for (var s = 1; s < arguments.length; s++) { | ||
411 | from = Object(arguments[s]); | ||
412 | |||
413 | for (var key in from) { | ||
414 | if (hasOwnProperty.call(from, key)) { | ||
415 | to[key] = from[key]; | ||
416 | } | ||
417 | } | ||
418 | |||
419 | if (Object.getOwnPropertySymbols) { | ||
420 | symbols = Object.getOwnPropertySymbols(from); | ||
421 | for (var i = 0; i < symbols.length; i++) { | ||
422 | if (propIsEnumerable.call(from, symbols[i])) { | ||
423 | to[symbols[i]] = from[symbols[i]]; | ||
424 | } | ||
425 | } | ||
426 | } | ||
427 | } | ||
428 | |||
429 | return to; | ||
430 | }; | ||
431 | |||
432 | |||
433 | /***/ }, | ||
434 | /* 7 */ | ||
435 | /***/ function(module, exports, __webpack_require__) { | ||
436 | |||
355 | /** | 437 | /** |
356 | * Copyright 2013-2015, Facebook, Inc. | 438 | * Copyright 2013-present, Facebook, Inc. |
357 | * All rights reserved. | 439 | * All rights reserved. |
358 | * | 440 | * |
359 | * This source code is licensed under the BSD-style license found in the | 441 | * This source code is licensed under the BSD-style license found in the |
360 | * LICENSE file in the root directory of this source tree. An additional grant | 442 | * LICENSE file in the root directory of this source tree. An additional grant |
361 | * of patent rights can be found in the PATENTS file in the same directory. | 443 | * of patent rights can be found in the PATENTS file in the same directory. |
362 | * | 444 | * |
363 | * @providesModule ReactCurrentOwner | 445 | * @providesModule ReactChildren |
364 | */ | 446 | */ |
365 | 447 | ||
366 | 'use strict'; | 448 | 'use strict'; |
367 | 449 | ||
450 | var PooledClass = __webpack_require__(8); | ||
451 | var ReactElement = __webpack_require__(11); | ||
452 | |||
453 | var emptyFunction = __webpack_require__(14); | ||
454 | var traverseAllChildren = __webpack_require__(16); | ||
455 | |||
456 | var twoArgumentPooler = PooledClass.twoArgumentPooler; | ||
457 | var fourArgumentPooler = PooledClass.fourArgumentPooler; | ||
458 | |||
459 | var userProvidedKeyEscapeRegex = /\/+/g; | ||
460 | function escapeUserProvidedKey(text) { | ||
461 | return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/'); | ||
462 | } | ||
463 | |||
368 | /** | 464 | /** |
369 | * Keeps track of the current owner. | 465 | * PooledClass representing the bookkeeping associated with performing a child |
466 | * traversal. Allows avoiding binding callbacks. | ||
370 | * | 467 | * |
371 | * The current owner is the component who should own any components that are | 468 | * @constructor ForEachBookKeeping |
372 | * currently being constructed. | 469 | * @param {!function} forEachFunction Function to perform traversal with. |
470 | * @param {?*} forEachContext Context to perform context with. | ||
373 | */ | 471 | */ |
374 | var ReactCurrentOwner = { | 472 | function ForEachBookKeeping(forEachFunction, forEachContext) { |
473 | this.func = forEachFunction; | ||
474 | this.context = forEachContext; | ||
475 | this.count = 0; | ||
476 | } | ||
477 | ForEachBookKeeping.prototype.destructor = function () { | ||
478 | this.func = null; | ||
479 | this.context = null; | ||
480 | this.count = 0; | ||
481 | }; | ||
482 | PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler); | ||
375 | 483 | ||
376 | /** | 484 | function forEachSingleChild(bookKeeping, child, name) { |
377 | * @internal | 485 | var func = bookKeeping.func; |
378 | * @type {ReactComponent} | 486 | var context = bookKeeping.context; |
379 | */ | 487 | |
380 | current: null | 488 | func.call(context, child, bookKeeping.count++); |
489 | } | ||
381 | 490 | ||
491 | /** | ||
492 | * Iterates through children that are typically specified as `props.children`. | ||
493 | * | ||
494 | * See https://facebook.github.io/react/docs/top-level-api.html#react.children.foreach | ||
495 | * | ||
496 | * The provided forEachFunc(child, index) will be called for each | ||
497 | * leaf child. | ||
498 | * | ||
499 | * @param {?*} children Children tree container. | ||
500 | * @param {function(*, int)} forEachFunc | ||
501 | * @param {*} forEachContext Context for forEachContext. | ||
502 | */ | ||
503 | function forEachChildren(children, forEachFunc, forEachContext) { | ||
504 | if (children == null) { | ||
505 | return children; | ||
506 | } | ||
507 | var traverseContext = ForEachBookKeeping.getPooled(forEachFunc, forEachContext); | ||
508 | traverseAllChildren(children, forEachSingleChild, traverseContext); | ||
509 | ForEachBookKeeping.release(traverseContext); | ||
510 | } | ||
511 | |||
512 | /** | ||
513 | * PooledClass representing the bookkeeping associated with performing a child | ||
514 | * mapping. Allows avoiding binding callbacks. | ||
515 | * | ||
516 | * @constructor MapBookKeeping | ||
517 | * @param {!*} mapResult Object containing the ordered map of results. | ||
518 | * @param {!function} mapFunction Function to perform mapping with. | ||
519 | * @param {?*} mapContext Context to perform mapping with. | ||
520 | */ | ||
521 | function MapBookKeeping(mapResult, keyPrefix, mapFunction, mapContext) { | ||
522 | this.result = mapResult; | ||
523 | this.keyPrefix = keyPrefix; | ||
524 | this.func = mapFunction; | ||
525 | this.context = mapContext; | ||
526 | this.count = 0; | ||
527 | } | ||
528 | MapBookKeeping.prototype.destructor = function () { | ||
529 | this.result = null; | ||
530 | this.keyPrefix = null; | ||
531 | this.func = null; | ||
532 | this.context = null; | ||
533 | this.count = 0; | ||
382 | }; | 534 | }; |
535 | PooledClass.addPoolingTo(MapBookKeeping, fourArgumentPooler); | ||
383 | 536 | ||
384 | module.exports = ReactCurrentOwner; | 537 | function mapSingleChildIntoContext(bookKeeping, child, childKey) { |
538 | var result = bookKeeping.result; | ||
539 | var keyPrefix = bookKeeping.keyPrefix; | ||
540 | var func = bookKeeping.func; | ||
541 | var context = bookKeeping.context; | ||
542 | |||
543 | |||
544 | var mappedChild = func.call(context, child, bookKeeping.count++); | ||
545 | if (Array.isArray(mappedChild)) { | ||
546 | mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument); | ||
547 | } else if (mappedChild != null) { | ||
548 | if (ReactElement.isValidElement(mappedChild)) { | ||
549 | mappedChild = ReactElement.cloneAndReplaceKey(mappedChild, | ||
550 | // Keep both the (mapped) and old keys if they differ, just as | ||
551 | // traverseAllChildren used to do for objects as children | ||
552 | keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey); | ||
553 | } | ||
554 | result.push(mappedChild); | ||
555 | } | ||
556 | } | ||
557 | |||
558 | function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) { | ||
559 | var escapedPrefix = ''; | ||
560 | if (prefix != null) { | ||
561 | escapedPrefix = escapeUserProvidedKey(prefix) + '/'; | ||
562 | } | ||
563 | var traverseContext = MapBookKeeping.getPooled(array, escapedPrefix, func, context); | ||
564 | traverseAllChildren(children, mapSingleChildIntoContext, traverseContext); | ||
565 | MapBookKeeping.release(traverseContext); | ||
566 | } | ||
567 | |||
568 | /** | ||
569 | * Maps children that are typically specified as `props.children`. | ||
570 | * | ||
571 | * See https://facebook.github.io/react/docs/top-level-api.html#react.children.map | ||
572 | * | ||
573 | * The provided mapFunction(child, key, index) will be called for each | ||
574 | * leaf child. | ||
575 | * | ||
576 | * @param {?*} children Children tree container. | ||
577 | * @param {function(*, int)} func The map function. | ||
578 | * @param {*} context Context for mapFunction. | ||
579 | * @return {object} Object containing the ordered map of results. | ||
580 | */ | ||
581 | function mapChildren(children, func, context) { | ||
582 | if (children == null) { | ||
583 | return children; | ||
584 | } | ||
585 | var result = []; | ||
586 | mapIntoWithKeyPrefixInternal(children, result, null, func, context); | ||
587 | return result; | ||
588 | } | ||
589 | |||
590 | function forEachSingleChildDummy(traverseContext, child, name) { | ||
591 | return null; | ||
592 | } | ||
593 | |||
594 | /** | ||
595 | * Count the number of children that are typically specified as | ||
596 | * `props.children`. | ||
597 | * | ||
598 | * See https://facebook.github.io/react/docs/top-level-api.html#react.children.count | ||
599 | * | ||
600 | * @param {?*} children Children tree container. | ||
601 | * @return {number} The number of children. | ||
602 | */ | ||
603 | function countChildren(children, context) { | ||
604 | return traverseAllChildren(children, forEachSingleChildDummy, null); | ||
605 | } | ||
606 | |||
607 | /** | ||
608 | * Flatten a children object (typically specified as `props.children`) and | ||
609 | * return an array with appropriately re-keyed children. | ||
610 | * | ||
611 | * See https://facebook.github.io/react/docs/top-level-api.html#react.children.toarray | ||
612 | */ | ||
613 | function toArray(children) { | ||
614 | var result = []; | ||
615 | mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument); | ||
616 | return result; | ||
617 | } | ||
618 | |||
619 | var ReactChildren = { | ||
620 | forEach: forEachChildren, | ||
621 | map: mapChildren, | ||
622 | mapIntoWithKeyPrefixInternal: mapIntoWithKeyPrefixInternal, | ||
623 | count: countChildren, | ||
624 | toArray: toArray | ||
625 | }; | ||
626 | |||
627 | module.exports = ReactChildren; | ||
385 | 628 | ||
386 | /***/ }, | 629 | /***/ }, |
387 | /* 8 */ | 630 | /* 8 */ |
388 | /***/ function(module, exports, __webpack_require__) { | 631 | /***/ function(module, exports, __webpack_require__) { |
389 | 632 | ||
390 | /* WEBPACK VAR INJECTION */(function(process) {/** | 633 | /* WEBPACK VAR INJECTION */(function(process) {/** |
391 | * Copyright 2013-2015, Facebook, Inc. | 634 | * Copyright 2013-present, Facebook, Inc. |
392 | * All rights reserved. | 635 | * All rights reserved. |
393 | * | 636 | * |
394 | * This source code is licensed under the BSD-style license found in the | 637 | * This source code is licensed under the BSD-style license found in the |
395 | * LICENSE file in the root directory of this source tree. An additional grant | 638 | * LICENSE file in the root directory of this source tree. An additional grant |
396 | * of patent rights can be found in the PATENTS file in the same directory. | 639 | * of patent rights can be found in the PATENTS file in the same directory. |
397 | * | 640 | * |
398 | * @providesModule ReactDOMTextComponent | 641 | * @providesModule PooledClass |
399 | * @typechecks static-only | ||
400 | */ | 642 | */ |
401 | 643 | ||
402 | 'use strict'; | 644 | 'use strict'; |
403 | 645 | ||
404 | var DOMChildrenOperations = __webpack_require__(9); | 646 | var _prodInvariant = __webpack_require__(9); |
405 | var DOMPropertyOperations = __webpack_require__(24); | ||
406 | var ReactComponentBrowserEnvironment = __webpack_require__(28); | ||
407 | var ReactMount = __webpack_require__(30); | ||
408 | 647 | ||
409 | var assign = __webpack_require__(41); | 648 | var invariant = __webpack_require__(10); |
410 | var escapeTextContentForBrowser = __webpack_require__(23); | ||
411 | var setTextContent = __webpack_require__(22); | ||
412 | var validateDOMNesting = __webpack_require__(72); | ||
413 | 649 | ||
414 | /** | 650 | /** |
415 | * Text nodes violate a couple assumptions that React makes about components: | 651 | * Static poolers. Several custom versions for each potential number of |
416 | * | 652 | * arguments. A completely generic pooler is easy to implement, but would |
417 | * - When mounting text into the DOM, adjacent text nodes are merged. | 653 | * require accessing the `arguments` object. In each of these, `this` refers to |
418 | * - Text nodes cannot be assigned a React root ID. | 654 | * the Class itself, not an instance. If any others are needed, simply add them |
655 | * here, or in their own files. | ||
656 | */ | ||
657 | var oneArgumentPooler = function (copyFieldsFrom) { | ||
658 | var Klass = this; | ||
659 | if (Klass.instancePool.length) { | ||
660 | var instance = Klass.instancePool.pop(); | ||
661 | Klass.call(instance, copyFieldsFrom); | ||
662 | return instance; | ||
663 | } else { | ||
664 | return new Klass(copyFieldsFrom); | ||
665 | } | ||
666 | }; | ||
667 | |||
668 | var twoArgumentPooler = function (a1, a2) { | ||
669 | var Klass = this; | ||
670 | if (Klass.instancePool.length) { | ||
671 | var instance = Klass.instancePool.pop(); | ||
672 | Klass.call(instance, a1, a2); | ||
673 | return instance; | ||
674 | } else { | ||
675 | return new Klass(a1, a2); | ||
676 | } | ||
677 | }; | ||
678 | |||
679 | var threeArgumentPooler = function (a1, a2, a3) { | ||
680 | var Klass = this; | ||
681 | if (Klass.instancePool.length) { | ||
682 | var instance = Klass.instancePool.pop(); | ||
683 | Klass.call(instance, a1, a2, a3); | ||
684 | return instance; | ||
685 | } else { | ||
686 | return new Klass(a1, a2, a3); | ||
687 | } | ||
688 | }; | ||
689 | |||
690 | var fourArgumentPooler = function (a1, a2, a3, a4) { | ||
691 | var Klass = this; | ||
692 | if (Klass.instancePool.length) { | ||
693 | var instance = Klass.instancePool.pop(); | ||
694 | Klass.call(instance, a1, a2, a3, a4); | ||
695 | return instance; | ||
696 | } else { | ||
697 | return new Klass(a1, a2, a3, a4); | ||
698 | } | ||
699 | }; | ||
700 | |||
701 | var fiveArgumentPooler = function (a1, a2, a3, a4, a5) { | ||
702 | var Klass = this; | ||
703 | if (Klass.instancePool.length) { | ||
704 | var instance = Klass.instancePool.pop(); | ||
705 | Klass.call(instance, a1, a2, a3, a4, a5); | ||
706 | return instance; | ||
707 | } else { | ||
708 | return new Klass(a1, a2, a3, a4, a5); | ||
709 | } | ||
710 | }; | ||
711 | |||
712 | var standardReleaser = function (instance) { | ||
713 | var Klass = this; | ||
714 | !(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; | ||
715 | instance.destructor(); | ||
716 | if (Klass.instancePool.length < Klass.poolSize) { | ||
717 | Klass.instancePool.push(instance); | ||
718 | } | ||
719 | }; | ||
720 | |||
721 | var DEFAULT_POOL_SIZE = 10; | ||
722 | var DEFAULT_POOLER = oneArgumentPooler; | ||
723 | |||
724 | /** | ||
725 | * Augments `CopyConstructor` to be a poolable class, augmenting only the class | ||
726 | * itself (statically) not adding any prototypical fields. Any CopyConstructor | ||
727 | * you give this may have a `poolSize` property, and will look for a | ||
728 | * prototypical `destructor` on instances. | ||
419 | * | 729 | * |
420 | * This component is used to wrap strings in elements so that they can undergo | 730 | * @param {Function} CopyConstructor Constructor that can be used to reset. |
421 | * the same reconciliation that is applied to elements. | 731 | * @param {Function} pooler Customizable pooler. |
732 | */ | ||
733 | var addPoolingTo = function (CopyConstructor, pooler) { | ||
734 | var NewKlass = CopyConstructor; | ||
735 | NewKlass.instancePool = []; | ||
736 | NewKlass.getPooled = pooler || DEFAULT_POOLER; | ||
737 | if (!NewKlass.poolSize) { | ||
738 | NewKlass.poolSize = DEFAULT_POOL_SIZE; | ||
739 | } | ||
740 | NewKlass.release = standardReleaser; | ||
741 | return NewKlass; | ||
742 | }; | ||
743 | |||
744 | var PooledClass = { | ||
745 | addPoolingTo: addPoolingTo, | ||
746 | oneArgumentPooler: oneArgumentPooler, | ||
747 | twoArgumentPooler: twoArgumentPooler, | ||
748 | threeArgumentPooler: threeArgumentPooler, | ||
749 | fourArgumentPooler: fourArgumentPooler, | ||
750 | fiveArgumentPooler: fiveArgumentPooler | ||
751 | }; | ||
752 | |||
753 | module.exports = PooledClass; | ||
754 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
755 | |||
756 | /***/ }, | ||
757 | /* 9 */ | ||
758 | /***/ function(module, exports) { | ||
759 | |||
760 | /** | ||
761 | * Copyright (c) 2013-present, Facebook, Inc. | ||
762 | * All rights reserved. | ||
422 | * | 763 | * |
423 | * TODO: Investigate representing React components in the DOM with text nodes. | 764 | * This source code is licensed under the BSD-style license found in the |
765 | * LICENSE file in the root directory of this source tree. An additional grant | ||
766 | * of patent rights can be found in the PATENTS file in the same directory. | ||
424 | * | 767 | * |
425 | * @class ReactDOMTextComponent | 768 | * @providesModule reactProdInvariant |
426 | * @extends ReactComponent | 769 | * |
427 | * @internal | ||
428 | */ | 770 | */ |
429 | var ReactDOMTextComponent = function (props) { | 771 | 'use strict'; |
430 | // This constructor and its argument is currently used by mocks. | ||
431 | }; | ||
432 | 772 | ||
433 | assign(ReactDOMTextComponent.prototype, { | 773 | /** |
774 | * WARNING: DO NOT manually require this module. | ||
775 | * This is a replacement for `invariant(...)` used by the error code system | ||
776 | * and will _only_ be required by the corresponding babel pass. | ||
777 | * It always throws. | ||
778 | */ | ||
434 | 779 | ||
435 | /** | 780 | function reactProdInvariant(code) { |
436 | * @param {ReactText} text | 781 | var argCount = arguments.length - 1; |
437 | * @internal | ||
438 | */ | ||
439 | construct: function (text) { | ||
440 | // TODO: This is really a ReactText (ReactNode), not a ReactElement | ||
441 | this._currentElement = text; | ||
442 | this._stringText = '' + text; | ||
443 | 782 | ||
444 | // Properties | 783 | var message = 'Minified React error #' + code + '; visit ' + 'http://facebook.github.io/react/docs/error-decoder.html?invariant=' + code; |
445 | this._rootNodeID = null; | ||
446 | this._mountIndex = 0; | ||
447 | }, | ||
448 | 784 | ||
449 | /** | 785 | for (var argIdx = 0; argIdx < argCount; argIdx++) { |
450 | * Creates the markup for this text node. This node is not intended to have | 786 | message += '&args[]=' + encodeURIComponent(arguments[argIdx + 1]); |
451 | * any features besides containing text content. | 787 | } |
452 | * | ||
453 | * @param {string} rootID DOM ID of the root node. | ||
454 | * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction | ||
455 | * @return {string} Markup for this text node. | ||
456 | * @internal | ||
457 | */ | ||
458 | mountComponent: function (rootID, transaction, context) { | ||
459 | if (process.env.NODE_ENV !== 'production') { | ||
460 | if (context[validateDOMNesting.ancestorInfoContextKey]) { | ||
461 | validateDOMNesting('span', null, context[validateDOMNesting.ancestorInfoContextKey]); | ||
462 | } | ||
463 | } | ||
464 | 788 | ||
465 | this._rootNodeID = rootID; | 789 | message += ' for the full message or use the non-minified dev environment' + ' for full errors and additional helpful warnings.'; |
466 | if (transaction.useCreateElement) { | ||
467 | var ownerDocument = context[ReactMount.ownerDocumentContextKey]; | ||
468 | var el = ownerDocument.createElement('span'); | ||
469 | DOMPropertyOperations.setAttributeForID(el, rootID); | ||
470 | // Populate node cache | ||
471 | ReactMount.getID(el); | ||
472 | setTextContent(el, this._stringText); | ||
473 | return el; | ||
474 | } else { | ||
475 | var escapedText = escapeTextContentForBrowser(this._stringText); | ||
476 | 790 | ||
477 | if (transaction.renderToStaticMarkup) { | 791 | var error = new Error(message); |
478 | // Normally we'd wrap this in a `span` for the reasons stated above, but | 792 | error.name = 'Invariant Violation'; |
479 | // since this is a situation where React won't take over (static pages), | 793 | error.framesToPop = 1; // we don't care about reactProdInvariant's own frame |
480 | // we can simply return the text as it is. | 794 | |
481 | return escapedText; | 795 | throw error; |
482 | } | 796 | } |
483 | 797 | ||
484 | return '<span ' + DOMPropertyOperations.createMarkupForID(rootID) + '>' + escapedText + '</span>'; | 798 | module.exports = reactProdInvariant; |
799 | |||
800 | /***/ }, | ||
801 | /* 10 */ | ||
802 | /***/ function(module, exports, __webpack_require__) { | ||
803 | |||
804 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
805 | * Copyright (c) 2013-present, Facebook, Inc. | ||
806 | * All rights reserved. | ||
807 | * | ||
808 | * This source code is licensed under the BSD-style license found in the | ||
809 | * LICENSE file in the root directory of this source tree. An additional grant | ||
810 | * of patent rights can be found in the PATENTS file in the same directory. | ||
811 | * | ||
812 | */ | ||
813 | |||
814 | 'use strict'; | ||
815 | |||
816 | /** | ||
817 | * Use invariant() to assert state which your program assumes to be true. | ||
818 | * | ||
819 | * Provide sprintf-style format (only %s is supported) and arguments | ||
820 | * to provide information about what broke and what you were | ||
821 | * expecting. | ||
822 | * | ||
823 | * The invariant message will be stripped in production, but the invariant | ||
824 | * will remain to ensure logic does not differ in production. | ||
825 | */ | ||
826 | |||
827 | function invariant(condition, format, a, b, c, d, e, f) { | ||
828 | if (process.env.NODE_ENV !== 'production') { | ||
829 | if (format === undefined) { | ||
830 | throw new Error('invariant requires an error message argument'); | ||
485 | } | 831 | } |
486 | }, | 832 | } |
487 | 833 | ||
488 | /** | 834 | if (!condition) { |
489 | * Updates this component by updating the text content. | 835 | var error; |
490 | * | 836 | if (format === undefined) { |
491 | * @param {ReactText} nextText The next text content | 837 | error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.'); |
492 | * @param {ReactReconcileTransaction} transaction | 838 | } else { |
493 | * @internal | 839 | var args = [a, b, c, d, e, f]; |
494 | */ | 840 | var argIndex = 0; |
495 | receiveComponent: function (nextText, transaction) { | 841 | error = new Error(format.replace(/%s/g, function () { |
496 | if (nextText !== this._currentElement) { | 842 | return args[argIndex++]; |
497 | this._currentElement = nextText; | 843 | })); |
498 | var nextStringText = '' + nextText; | 844 | error.name = 'Invariant Violation'; |
499 | if (nextStringText !== this._stringText) { | ||
500 | // TODO: Save this as pending props and use performUpdateIfNecessary | ||
501 | // and/or updateComponent to do the actual update for consistency with | ||
502 | // other component types? | ||
503 | this._stringText = nextStringText; | ||
504 | var node = ReactMount.getNode(this._rootNodeID); | ||
505 | DOMChildrenOperations.updateTextContent(node, nextStringText); | ||
506 | } | ||
507 | } | 845 | } |
508 | }, | ||
509 | 846 | ||
510 | unmountComponent: function () { | 847 | error.framesToPop = 1; // we don't care about invariant's own frame |
511 | ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID); | 848 | throw error; |
512 | } | 849 | } |
850 | } | ||
513 | 851 | ||
514 | }); | 852 | module.exports = invariant; |
515 | 853 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | |
516 | module.exports = ReactDOMTextComponent; | ||
517 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
518 | 854 | ||
519 | /***/ }, | 855 | /***/ }, |
520 | /* 9 */ | 856 | /* 11 */ |
521 | /***/ function(module, exports, __webpack_require__) { | 857 | /***/ function(module, exports, __webpack_require__) { |
522 | 858 | ||
523 | /* WEBPACK VAR INJECTION */(function(process) {/** | 859 | /* WEBPACK VAR INJECTION */(function(process) {/** |
524 | * Copyright 2013-2015, Facebook, Inc. | 860 | * Copyright 2014-present, Facebook, Inc. |
525 | * All rights reserved. | 861 | * All rights reserved. |
526 | * | 862 | * |
527 | * This source code is licensed under the BSD-style license found in the | 863 | * This source code is licensed under the BSD-style license found in the |
528 | * LICENSE file in the root directory of this source tree. An additional grant | 864 | * LICENSE file in the root directory of this source tree. An additional grant |
529 | * of patent rights can be found in the PATENTS file in the same directory. | 865 | * of patent rights can be found in the PATENTS file in the same directory. |
530 | * | 866 | * |
531 | * @providesModule DOMChildrenOperations | 867 | * @providesModule ReactElement |
532 | * @typechecks static-only | ||
533 | */ | 868 | */ |
534 | 869 | ||
535 | 'use strict'; | 870 | 'use strict'; |
536 | 871 | ||
537 | var Danger = __webpack_require__(10); | 872 | var _assign = __webpack_require__(6); |
538 | var ReactMultiChildUpdateTypes = __webpack_require__(18); | 873 | |
539 | var ReactPerf = __webpack_require__(20); | 874 | var ReactCurrentOwner = __webpack_require__(12); |
875 | |||
876 | var warning = __webpack_require__(13); | ||
877 | var canDefineProperty = __webpack_require__(15); | ||
878 | var hasOwnProperty = Object.prototype.hasOwnProperty; | ||
879 | |||
880 | // The Symbol used to tag the ReactElement type. If there is no native Symbol | ||
881 | // nor polyfill, then a plain number is used for performance. | ||
882 | var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7; | ||
883 | |||
884 | var RESERVED_PROPS = { | ||
885 | key: true, | ||
886 | ref: true, | ||
887 | __self: true, | ||
888 | __source: true | ||
889 | }; | ||
890 | |||
891 | var specialPropKeyWarningShown, specialPropRefWarningShown; | ||
892 | |||
893 | function hasValidRef(config) { | ||
894 | if (process.env.NODE_ENV !== 'production') { | ||
895 | if (hasOwnProperty.call(config, 'ref')) { | ||
896 | var getter = Object.getOwnPropertyDescriptor(config, 'ref').get; | ||
897 | if (getter && getter.isReactWarning) { | ||
898 | return false; | ||
899 | } | ||
900 | } | ||
901 | } | ||
902 | return config.ref !== undefined; | ||
903 | } | ||
540 | 904 | ||
541 | var setInnerHTML = __webpack_require__(21); | 905 | function hasValidKey(config) { |
542 | var setTextContent = __webpack_require__(22); | 906 | if (process.env.NODE_ENV !== 'production') { |
543 | var invariant = __webpack_require__(15); | 907 | if (hasOwnProperty.call(config, 'key')) { |
908 | var getter = Object.getOwnPropertyDescriptor(config, 'key').get; | ||
909 | if (getter && getter.isReactWarning) { | ||
910 | return false; | ||
911 | } | ||
912 | } | ||
913 | } | ||
914 | return config.key !== undefined; | ||
915 | } | ||
544 | 916 | ||
545 | /** | 917 | /** |
546 | * Inserts `childNode` as a child of `parentNode` at the `index`. | 918 | * Factory method to create a new React element. This no longer adheres to |
919 | * the class pattern, so do not use new to call it. Also, no instanceof check | ||
920 | * will work. Instead test $$typeof field against Symbol.for('react.element') to check | ||
921 | * if something is a React Element. | ||
547 | * | 922 | * |
548 | * @param {DOMElement} parentNode Parent node in which to insert. | 923 | * @param {*} type |
549 | * @param {DOMElement} childNode Child node to insert. | 924 | * @param {*} key |
550 | * @param {number} index Index at which to insert the child. | 925 | * @param {string|object} ref |
926 | * @param {*} self A *temporary* helper to detect places where `this` is | ||
927 | * different from the `owner` when React.createElement is called, so that we | ||
928 | * can warn. We want to get rid of owner and replace string `ref`s with arrow | ||
929 | * functions, and as long as `this` and owner are the same, there will be no | ||
930 | * change in behavior. | ||
931 | * @param {*} source An annotation object (added by a transpiler or otherwise) | ||
932 | * indicating filename, line number, and/or other information. | ||
933 | * @param {*} owner | ||
934 | * @param {*} props | ||
551 | * @internal | 935 | * @internal |
552 | */ | 936 | */ |
553 | function insertChildAt(parentNode, childNode, index) { | 937 | var ReactElement = function (type, key, ref, self, source, owner, props) { |
554 | // By exploiting arrays returning `undefined` for an undefined index, we can | 938 | var element = { |
555 | // rely exclusively on `insertBefore(node, null)` instead of also using | 939 | // This tag allow us to uniquely identify this as a React Element |
556 | // `appendChild(node)`. However, using `undefined` is not allowed by all | 940 | $$typeof: REACT_ELEMENT_TYPE, |
557 | // browsers so we must replace it with `null`. | ||
558 | 941 | ||
559 | // fix render order error in safari | 942 | // Built-in properties that belong on the element |
560 | // IE8 will throw error when index out of list size. | 943 | type: type, |
561 | var beforeChild = index >= parentNode.childNodes.length ? null : parentNode.childNodes.item(index); | 944 | key: key, |
945 | ref: ref, | ||
946 | props: props, | ||
562 | 947 | ||
563 | parentNode.insertBefore(childNode, beforeChild); | 948 | // Record the component responsible for creating this element. |
564 | } | 949 | _owner: owner |
950 | }; | ||
951 | |||
952 | if (process.env.NODE_ENV !== 'production') { | ||
953 | // The validation flag is currently mutative. We put it on | ||
954 | // an external backing store so that we can freeze the whole object. | ||
955 | // This can be replaced with a WeakMap once they are implemented in | ||
956 | // commonly used development environments. | ||
957 | element._store = {}; | ||
958 | var shadowChildren = Array.isArray(props.children) ? props.children.slice(0) : props.children; | ||
959 | |||
960 | // To make comparing ReactElements easier for testing purposes, we make | ||
961 | // the validation flag non-enumerable (where possible, which should | ||
962 | // include every environment we run tests in), so the test framework | ||
963 | // ignores it. | ||
964 | if (canDefineProperty) { | ||
965 | Object.defineProperty(element._store, 'validated', { | ||
966 | configurable: false, | ||
967 | enumerable: false, | ||
968 | writable: true, | ||
969 | value: false | ||
970 | }); | ||
971 | // self and source are DEV only properties. | ||
972 | Object.defineProperty(element, '_self', { | ||
973 | configurable: false, | ||
974 | enumerable: false, | ||
975 | writable: false, | ||
976 | value: self | ||
977 | }); | ||
978 | Object.defineProperty(element, '_shadowChildren', { | ||
979 | configurable: false, | ||
980 | enumerable: false, | ||
981 | writable: false, | ||
982 | value: shadowChildren | ||
983 | }); | ||
984 | // Two elements created in two different places should be considered | ||
985 | // equal for testing purposes and therefore we hide it from enumeration. | ||
986 | Object.defineProperty(element, '_source', { | ||
987 | configurable: false, | ||
988 | enumerable: false, | ||
989 | writable: false, | ||
990 | value: source | ||
991 | }); | ||
992 | } else { | ||
993 | element._store.validated = false; | ||
994 | element._self = self; | ||
995 | element._shadowChildren = shadowChildren; | ||
996 | element._source = source; | ||
997 | } | ||
998 | if (Object.freeze) { | ||
999 | Object.freeze(element.props); | ||
1000 | Object.freeze(element); | ||
1001 | } | ||
1002 | } | ||
1003 | |||
1004 | return element; | ||
1005 | }; | ||
565 | 1006 | ||
566 | /** | 1007 | /** |
567 | * Operations for updating with DOM children. | 1008 | * Create and return a new ReactElement of the given type. |
1009 | * See https://facebook.github.io/react/docs/top-level-api.html#react.createelement | ||
568 | */ | 1010 | */ |
569 | var DOMChildrenOperations = { | 1011 | ReactElement.createElement = function (type, config, children) { |
1012 | var propName; | ||
570 | 1013 | ||
571 | dangerouslyReplaceNodeWithMarkup: Danger.dangerouslyReplaceNodeWithMarkup, | 1014 | // Reserved names are extracted |
1015 | var props = {}; | ||
572 | 1016 | ||
573 | updateTextContent: setTextContent, | 1017 | var key = null; |
1018 | var ref = null; | ||
1019 | var self = null; | ||
1020 | var source = null; | ||
574 | 1021 | ||
575 | /** | 1022 | if (config != null) { |
576 | * Updates a component's children by processing a series of updates. The | 1023 | if (process.env.NODE_ENV !== 'production') { |
577 | * update configurations are each expected to have a `parentNode` property. | 1024 | process.env.NODE_ENV !== 'production' ? warning( |
578 | * | 1025 | /* eslint-disable no-proto */ |
579 | * @param {array<object>} updates List of update configurations. | 1026 | config.__proto__ == null || config.__proto__ === Object.prototype, |
580 | * @param {array<string>} markupList List of markup strings. | 1027 | /* eslint-enable no-proto */ |
581 | * @internal | 1028 | 'React.createElement(...): Expected props argument to be a plain object. ' + 'Properties defined in its prototype chain will be ignored.') : void 0; |
582 | */ | 1029 | } |
583 | processUpdates: function (updates, markupList) { | ||
584 | var update; | ||
585 | // Mapping from parent IDs to initial child orderings. | ||
586 | var initialChildren = null; | ||
587 | // List of children that will be moved or removed. | ||
588 | var updatedChildren = null; | ||
589 | 1030 | ||
590 | for (var i = 0; i < updates.length; i++) { | 1031 | if (hasValidRef(config)) { |
591 | update = updates[i]; | 1032 | ref = config.ref; |
592 | if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING || update.type === ReactMultiChildUpdateTypes.REMOVE_NODE) { | 1033 | } |
593 | var updatedIndex = update.fromIndex; | 1034 | if (hasValidKey(config)) { |
594 | var updatedChild = update.parentNode.childNodes[updatedIndex]; | 1035 | key = '' + config.key; |
595 | var parentID = update.parentID; | 1036 | } |
596 | 1037 | ||
597 | !updatedChild ? process.env.NODE_ENV !== 'production' ? invariant(false, 'processUpdates(): Unable to find child %s of element. This ' + 'probably means the DOM was unexpectedly mutated (e.g., by the ' + 'browser), usually due to forgetting a <tbody> when using tables, ' + 'nesting tags like <form>, <p>, or <a>, or using non-SVG elements ' + 'in an <svg> parent. Try inspecting the child nodes of the element ' + 'with React ID `%s`.', updatedIndex, parentID) : invariant(false) : undefined; | 1038 | self = config.__self === undefined ? null : config.__self; |
1039 | source = config.__source === undefined ? null : config.__source; | ||
1040 | // Remaining properties are added to a new props object | ||
1041 | for (propName in config) { | ||
1042 | if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { | ||
1043 | props[propName] = config[propName]; | ||
1044 | } | ||
1045 | } | ||
1046 | } | ||
598 | 1047 | ||
599 | initialChildren = initialChildren || {}; | 1048 | // Children can be more than one argument, and those are transferred onto |
600 | initialChildren[parentID] = initialChildren[parentID] || []; | 1049 | // the newly allocated props object. |
601 | initialChildren[parentID][updatedIndex] = updatedChild; | 1050 | var childrenLength = arguments.length - 2; |
1051 | if (childrenLength === 1) { | ||
1052 | props.children = children; | ||
1053 | } else if (childrenLength > 1) { | ||
1054 | var childArray = Array(childrenLength); | ||
1055 | for (var i = 0; i < childrenLength; i++) { | ||
1056 | childArray[i] = arguments[i + 2]; | ||
1057 | } | ||
1058 | props.children = childArray; | ||
1059 | } | ||
602 | 1060 | ||
603 | updatedChildren = updatedChildren || []; | 1061 | // Resolve default props |
604 | updatedChildren.push(updatedChild); | 1062 | if (type && type.defaultProps) { |
1063 | var defaultProps = type.defaultProps; | ||
1064 | for (propName in defaultProps) { | ||
1065 | if (props[propName] === undefined) { | ||
1066 | props[propName] = defaultProps[propName]; | ||
605 | } | 1067 | } |
606 | } | 1068 | } |
1069 | } | ||
1070 | if (process.env.NODE_ENV !== 'production') { | ||
1071 | var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type; | ||
607 | 1072 | ||
608 | var renderedMarkup; | 1073 | // Create dummy `key` and `ref` property to `props` to warn users against its use |
609 | // markupList is either a list of markup or just a list of elements | 1074 | var warnAboutAccessingKey = function () { |
610 | if (markupList.length && typeof markupList[0] === 'string') { | 1075 | if (!specialPropKeyWarningShown) { |
611 | renderedMarkup = Danger.dangerouslyRenderMarkup(markupList); | 1076 | specialPropKeyWarningShown = true; |
612 | } else { | 1077 | 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; |
613 | renderedMarkup = markupList; | 1078 | } |
614 | } | 1079 | return undefined; |
1080 | }; | ||
1081 | warnAboutAccessingKey.isReactWarning = true; | ||
615 | 1082 | ||
616 | // Remove updated children first so that `toIndex` is consistent. | 1083 | var warnAboutAccessingRef = function () { |
617 | if (updatedChildren) { | 1084 | if (!specialPropRefWarningShown) { |
618 | for (var j = 0; j < updatedChildren.length; j++) { | 1085 | specialPropRefWarningShown = true; |
619 | updatedChildren[j].parentNode.removeChild(updatedChildren[j]); | 1086 | 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; |
1087 | } | ||
1088 | return undefined; | ||
1089 | }; | ||
1090 | warnAboutAccessingRef.isReactWarning = true; | ||
1091 | |||
1092 | if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE) { | ||
1093 | if (!props.hasOwnProperty('key')) { | ||
1094 | Object.defineProperty(props, 'key', { | ||
1095 | get: warnAboutAccessingKey, | ||
1096 | configurable: true | ||
1097 | }); | ||
1098 | } | ||
1099 | if (!props.hasOwnProperty('ref')) { | ||
1100 | Object.defineProperty(props, 'ref', { | ||
1101 | get: warnAboutAccessingRef, | ||
1102 | configurable: true | ||
1103 | }); | ||
620 | } | 1104 | } |
621 | } | 1105 | } |
1106 | } | ||
1107 | return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props); | ||
1108 | }; | ||
622 | 1109 | ||
623 | for (var k = 0; k < updates.length; k++) { | 1110 | /** |
624 | update = updates[k]; | 1111 | * Return a function that produces ReactElements of a given type. |
625 | switch (update.type) { | 1112 | * See https://facebook.github.io/react/docs/top-level-api.html#react.createfactory |
626 | case ReactMultiChildUpdateTypes.INSERT_MARKUP: | 1113 | */ |
627 | insertChildAt(update.parentNode, renderedMarkup[update.markupIndex], update.toIndex); | 1114 | ReactElement.createFactory = function (type) { |
628 | break; | 1115 | var factory = ReactElement.createElement.bind(null, type); |
629 | case ReactMultiChildUpdateTypes.MOVE_EXISTING: | 1116 | // Expose the type on the factory and the prototype so that it can be |
630 | insertChildAt(update.parentNode, initialChildren[update.parentID][update.fromIndex], update.toIndex); | 1117 | // easily accessed on elements. E.g. `<Foo />.type === Foo`. |
631 | break; | 1118 | // This should not be named `constructor` since this may not be the function |
632 | case ReactMultiChildUpdateTypes.SET_MARKUP: | 1119 | // that created the element, and it may not even be a constructor. |
633 | setInnerHTML(update.parentNode, update.content); | 1120 | // Legacy hook TODO: Warn if this is accessed |
634 | break; | 1121 | factory.type = type; |
635 | case ReactMultiChildUpdateTypes.TEXT_CONTENT: | 1122 | return factory; |
636 | setTextContent(update.parentNode, update.content); | 1123 | }; |
637 | break; | 1124 | |
638 | case ReactMultiChildUpdateTypes.REMOVE_NODE: | 1125 | ReactElement.cloneAndReplaceKey = function (oldElement, newKey) { |
639 | // Already removed by the for-loop above. | 1126 | var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props); |
640 | break; | 1127 | |
1128 | return newElement; | ||
1129 | }; | ||
1130 | |||
1131 | /** | ||
1132 | * Clone and return a new ReactElement using element as the starting point. | ||
1133 | * See https://facebook.github.io/react/docs/top-level-api.html#react.cloneelement | ||
1134 | */ | ||
1135 | ReactElement.cloneElement = function (element, config, children) { | ||
1136 | var propName; | ||
1137 | |||
1138 | // Original props are copied | ||
1139 | var props = _assign({}, element.props); | ||
1140 | |||
1141 | // Reserved names are extracted | ||
1142 | var key = element.key; | ||
1143 | var ref = element.ref; | ||
1144 | // Self is preserved since the owner is preserved. | ||
1145 | var self = element._self; | ||
1146 | // Source is preserved since cloneElement is unlikely to be targeted by a | ||
1147 | // transpiler, and the original source is probably a better indicator of the | ||
1148 | // true owner. | ||
1149 | var source = element._source; | ||
1150 | |||
1151 | // Owner will be preserved, unless ref is overridden | ||
1152 | var owner = element._owner; | ||
1153 | |||
1154 | if (config != null) { | ||
1155 | if (process.env.NODE_ENV !== 'production') { | ||
1156 | process.env.NODE_ENV !== 'production' ? warning( | ||
1157 | /* eslint-disable no-proto */ | ||
1158 | config.__proto__ == null || config.__proto__ === Object.prototype, | ||
1159 | /* eslint-enable no-proto */ | ||
1160 | 'React.cloneElement(...): Expected props argument to be a plain object. ' + 'Properties defined in its prototype chain will be ignored.') : void 0; | ||
1161 | } | ||
1162 | |||
1163 | if (hasValidRef(config)) { | ||
1164 | // Silently steal the ref from the parent. | ||
1165 | ref = config.ref; | ||
1166 | owner = ReactCurrentOwner.current; | ||
1167 | } | ||
1168 | if (hasValidKey(config)) { | ||
1169 | key = '' + config.key; | ||
1170 | } | ||
1171 | |||
1172 | // Remaining properties override existing props | ||
1173 | var defaultProps; | ||
1174 | if (element.type && element.type.defaultProps) { | ||
1175 | defaultProps = element.type.defaultProps; | ||
1176 | } | ||
1177 | for (propName in config) { | ||
1178 | if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { | ||
1179 | if (config[propName] === undefined && defaultProps !== undefined) { | ||
1180 | // Resolve default props | ||
1181 | props[propName] = defaultProps[propName]; | ||
1182 | } else { | ||
1183 | props[propName] = config[propName]; | ||
1184 | } | ||
641 | } | 1185 | } |
642 | } | 1186 | } |
643 | } | 1187 | } |
644 | 1188 | ||
1189 | // Children can be more than one argument, and those are transferred onto | ||
1190 | // the newly allocated props object. | ||
1191 | var childrenLength = arguments.length - 2; | ||
1192 | if (childrenLength === 1) { | ||
1193 | props.children = children; | ||
1194 | } else if (childrenLength > 1) { | ||
1195 | var childArray = Array(childrenLength); | ||
1196 | for (var i = 0; i < childrenLength; i++) { | ||
1197 | childArray[i] = arguments[i + 2]; | ||
1198 | } | ||
1199 | props.children = childArray; | ||
1200 | } | ||
1201 | |||
1202 | return ReactElement(element.type, key, ref, self, source, owner, props); | ||
645 | }; | 1203 | }; |
646 | 1204 | ||
647 | ReactPerf.measureMethods(DOMChildrenOperations, 'DOMChildrenOperations', { | 1205 | /** |
648 | updateTextContent: 'updateTextContent' | 1206 | * Verifies the object is a ReactElement. |
649 | }); | 1207 | * See https://facebook.github.io/react/docs/top-level-api.html#react.isvalidelement |
1208 | * @param {?object} object | ||
1209 | * @return {boolean} True if `object` is a valid component. | ||
1210 | * @final | ||
1211 | */ | ||
1212 | ReactElement.isValidElement = function (object) { | ||
1213 | return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; | ||
1214 | }; | ||
650 | 1215 | ||
651 | module.exports = DOMChildrenOperations; | 1216 | ReactElement.REACT_ELEMENT_TYPE = REACT_ELEMENT_TYPE; |
652 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | 1217 | |
1218 | module.exports = ReactElement; | ||
1219 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
653 | 1220 | ||
654 | /***/ }, | 1221 | /***/ }, |
655 | /* 10 */ | 1222 | /* 12 */ |
656 | /***/ function(module, exports, __webpack_require__) { | 1223 | /***/ function(module, exports) { |
657 | 1224 | ||
658 | /* WEBPACK VAR INJECTION */(function(process) {/** | 1225 | /** |
659 | * Copyright 2013-2015, Facebook, Inc. | 1226 | * Copyright 2013-present, Facebook, Inc. |
660 | * All rights reserved. | 1227 | * All rights reserved. |
661 | * | 1228 | * |
662 | * This source code is licensed under the BSD-style license found in the | 1229 | * This source code is licensed under the BSD-style license found in the |
663 | * LICENSE file in the root directory of this source tree. An additional grant | 1230 | * LICENSE file in the root directory of this source tree. An additional grant |
664 | * of patent rights can be found in the PATENTS file in the same directory. | 1231 | * of patent rights can be found in the PATENTS file in the same directory. |
665 | * | 1232 | * |
666 | * @providesModule Danger | 1233 | * @providesModule ReactCurrentOwner |
667 | * @typechecks static-only | ||
668 | */ | 1234 | */ |
669 | 1235 | ||
670 | 'use strict'; | 1236 | 'use strict'; |
671 | 1237 | ||
672 | var ExecutionEnvironment = __webpack_require__(11); | ||
673 | |||
674 | var createNodesFromMarkup = __webpack_require__(12); | ||
675 | var emptyFunction = __webpack_require__(17); | ||
676 | var getMarkupWrap = __webpack_require__(16); | ||
677 | var invariant = __webpack_require__(15); | ||
678 | |||
679 | var OPEN_TAG_NAME_EXP = /^(<[^ \/>]+)/; | ||
680 | var RESULT_INDEX_ATTR = 'data-danger-index'; | ||
681 | |||
682 | /** | 1238 | /** |
683 | * Extracts the `nodeName` from a string of markup. | 1239 | * Keeps track of the current owner. |
684 | * | ||
685 | * NOTE: Extracting the `nodeName` does not require a regular expression match | ||
686 | * because we make assumptions about React-generated markup (i.e. there are no | ||
687 | * spaces surrounding the opening tag and there is at least one attribute). | ||
688 | * | 1240 | * |
689 | * @param {string} markup String of markup. | 1241 | * The current owner is the component who should own any components that are |
690 | * @return {string} Node name of the supplied markup. | 1242 | * currently being constructed. |
691 | * @see http://jsperf.com/extract-nodename | ||
692 | */ | 1243 | */ |
693 | function getNodeName(markup) { | ||
694 | return markup.substring(1, markup.indexOf(' ')); | ||
695 | } | ||
696 | 1244 | ||
697 | var Danger = { | 1245 | var ReactCurrentOwner = { |
698 | 1246 | ||
699 | /** | 1247 | /** |
700 | * Renders markup into an array of nodes. The markup is expected to render | ||
701 | * into a list of root nodes. Also, the length of `resultList` and | ||
702 | * `markupList` should be the same. | ||
703 | * | ||
704 | * @param {array<string>} markupList List of markup strings to render. | ||
705 | * @return {array<DOMElement>} List of rendered nodes. | ||
706 | * @internal | 1248 | * @internal |
1249 | * @type {ReactComponent} | ||
707 | */ | 1250 | */ |
708 | dangerouslyRenderMarkup: function (markupList) { | 1251 | current: null |
709 | !ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyRenderMarkup(...): 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.') : invariant(false) : undefined; | ||
710 | var nodeName; | ||
711 | var markupByNodeName = {}; | ||
712 | // Group markup by `nodeName` if a wrap is necessary, else by '*'. | ||
713 | for (var i = 0; i < markupList.length; i++) { | ||
714 | !markupList[i] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyRenderMarkup(...): Missing markup.') : invariant(false) : undefined; | ||
715 | nodeName = getNodeName(markupList[i]); | ||
716 | nodeName = getMarkupWrap(nodeName) ? nodeName : '*'; | ||
717 | markupByNodeName[nodeName] = markupByNodeName[nodeName] || []; | ||
718 | markupByNodeName[nodeName][i] = markupList[i]; | ||
719 | } | ||
720 | var resultList = []; | ||
721 | var resultListAssignmentCount = 0; | ||
722 | for (nodeName in markupByNodeName) { | ||
723 | if (!markupByNodeName.hasOwnProperty(nodeName)) { | ||
724 | continue; | ||
725 | } | ||
726 | var markupListByNodeName = markupByNodeName[nodeName]; | ||
727 | |||
728 | // This for-in loop skips the holes of the sparse array. The order of | ||
729 | // iteration should follow the order of assignment, which happens to match | ||
730 | // numerical index order, but we don't rely on that. | ||
731 | var resultIndex; | ||
732 | for (resultIndex in markupListByNodeName) { | ||
733 | if (markupListByNodeName.hasOwnProperty(resultIndex)) { | ||
734 | var markup = markupListByNodeName[resultIndex]; | ||
735 | 1252 | ||
736 | // Push the requested markup with an additional RESULT_INDEX_ATTR | 1253 | }; |
737 | // attribute. If the markup does not start with a < character, it | ||
738 | // will be discarded below (with an appropriate console.error). | ||
739 | markupListByNodeName[resultIndex] = markup.replace(OPEN_TAG_NAME_EXP, | ||
740 | // This index will be parsed back out below. | ||
741 | '$1 ' + RESULT_INDEX_ATTR + '="' + resultIndex + '" '); | ||
742 | } | ||
743 | } | ||
744 | 1254 | ||
745 | // Render each group of markup with similar wrapping `nodeName`. | 1255 | module.exports = ReactCurrentOwner; |
746 | var renderNodes = createNodesFromMarkup(markupListByNodeName.join(''), emptyFunction // Do nothing special with <script> tags. | 1256 | |
747 | ); | 1257 | /***/ }, |
1258 | /* 13 */ | ||
1259 | /***/ function(module, exports, __webpack_require__) { | ||
1260 | |||
1261 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
1262 | * Copyright 2014-2015, Facebook, Inc. | ||
1263 | * All rights reserved. | ||
1264 | * | ||
1265 | * This source code is licensed under the BSD-style license found in the | ||
1266 | * LICENSE file in the root directory of this source tree. An additional grant | ||
1267 | * of patent rights can be found in the PATENTS file in the same directory. | ||
1268 | * | ||
1269 | */ | ||
748 | 1270 | ||
749 | for (var j = 0; j < renderNodes.length; ++j) { | 1271 | 'use strict'; |
750 | var renderNode = renderNodes[j]; | ||
751 | if (renderNode.hasAttribute && renderNode.hasAttribute(RESULT_INDEX_ATTR)) { | ||
752 | 1272 | ||
753 | resultIndex = +renderNode.getAttribute(RESULT_INDEX_ATTR); | 1273 | var emptyFunction = __webpack_require__(14); |
754 | renderNode.removeAttribute(RESULT_INDEX_ATTR); | ||
755 | 1274 | ||
756 | !!resultList.hasOwnProperty(resultIndex) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Danger: Assigning to an already-occupied result index.') : invariant(false) : undefined; | 1275 | /** |
1276 | * Similar to invariant but only logs a warning if the condition is not met. | ||
1277 | * This can be used to log issues in development environments in critical | ||
1278 | * paths. Removing the logging code for production environments will keep the | ||
1279 | * same logic and follow the same code paths. | ||
1280 | */ | ||
757 | 1281 | ||
758 | resultList[resultIndex] = renderNode; | 1282 | var warning = emptyFunction; |
759 | 1283 | ||
760 | // This should match resultList.length and markupList.length when | 1284 | if (process.env.NODE_ENV !== 'production') { |
761 | // we're done. | 1285 | warning = function warning(condition, format) { |
762 | resultListAssignmentCount += 1; | 1286 | for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { |
763 | } else if (process.env.NODE_ENV !== 'production') { | 1287 | args[_key - 2] = arguments[_key]; |
764 | console.error('Danger: Discarding unexpected node:', renderNode); | ||
765 | } | ||
766 | } | ||
767 | } | 1288 | } |
768 | 1289 | ||
769 | // Although resultList was populated out of order, it should now be a dense | 1290 | if (format === undefined) { |
770 | // array. | 1291 | throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument'); |
771 | !(resultListAssignmentCount === resultList.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Danger: Did not assign to every index of resultList.') : invariant(false) : undefined; | 1292 | } |
772 | |||
773 | !(resultList.length === markupList.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Danger: Expected markup to render %s nodes, but rendered %s.', markupList.length, resultList.length) : invariant(false) : undefined; | ||
774 | |||
775 | return resultList; | ||
776 | }, | ||
777 | |||
778 | /** | ||
779 | * Replaces a node with a string of markup at its current position within its | ||
780 | * parent. The markup must render into a single root node. | ||
781 | * | ||
782 | * @param {DOMElement} oldChild Child node to replace. | ||
783 | * @param {string} markup Markup to render in place of the child node. | ||
784 | * @internal | ||
785 | */ | ||
786 | dangerouslyReplaceNodeWithMarkup: function (oldChild, markup) { | ||
787 | !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.') : invariant(false) : undefined; | ||
788 | !markup ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : invariant(false) : undefined; | ||
789 | !(oldChild.tagName.toLowerCase() !== '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().') : invariant(false) : undefined; | ||
790 | 1293 | ||
791 | var newChild; | 1294 | if (format.indexOf('Failed Composite propType: ') === 0) { |
792 | if (typeof markup === 'string') { | 1295 | return; // Ignore CompositeComponent proptype check. |
793 | newChild = createNodesFromMarkup(markup, emptyFunction)[0]; | ||
794 | } else { | ||
795 | newChild = markup; | ||
796 | } | 1296 | } |
797 | oldChild.parentNode.replaceChild(newChild, oldChild); | ||
798 | } | ||
799 | 1297 | ||
800 | }; | 1298 | if (!condition) { |
1299 | var argIndex = 0; | ||
1300 | var message = 'Warning: ' + format.replace(/%s/g, function () { | ||
1301 | return args[argIndex++]; | ||
1302 | }); | ||
1303 | if (typeof console !== 'undefined') { | ||
1304 | console.error(message); | ||
1305 | } | ||
1306 | try { | ||
1307 | // --- Welcome to debugging React --- | ||
1308 | // This error was thrown as a convenience so that you can use this stack | ||
1309 | // to find the callsite that caused this warning to fire. | ||
1310 | throw new Error(message); | ||
1311 | } catch (x) {} | ||
1312 | } | ||
1313 | }; | ||
1314 | } | ||
801 | 1315 | ||
802 | module.exports = Danger; | 1316 | module.exports = warning; |
803 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | 1317 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) |
804 | 1318 | ||
805 | /***/ }, | 1319 | /***/ }, |
806 | /* 11 */ | 1320 | /* 14 */ |
807 | /***/ function(module, exports) { | 1321 | /***/ function(module, exports) { |
808 | 1322 | ||
1323 | "use strict"; | ||
1324 | |||
809 | /** | 1325 | /** |
810 | * Copyright 2013-2015, Facebook, Inc. | 1326 | * Copyright (c) 2013-present, Facebook, Inc. |
811 | * All rights reserved. | 1327 | * All rights reserved. |
812 | * | 1328 | * |
813 | * This source code is licensed under the BSD-style license found in the | 1329 | * This source code is licensed under the BSD-style license found in the |
814 | * LICENSE file in the root directory of this source tree. An additional grant | 1330 | * LICENSE file in the root directory of this source tree. An additional grant |
815 | * of patent rights can be found in the PATENTS file in the same directory. | 1331 | * of patent rights can be found in the PATENTS file in the same directory. |
816 | * | 1332 | * |
817 | * @providesModule ExecutionEnvironment | 1333 | * |
818 | */ | 1334 | */ |
819 | 1335 | ||
820 | 'use strict'; | 1336 | function makeEmptyFunction(arg) { |
821 | 1337 | return function () { | |
822 | var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement); | 1338 | return arg; |
1339 | }; | ||
1340 | } | ||
823 | 1341 | ||
824 | /** | 1342 | /** |
825 | * Simple, lightweight module assisting with the detection and context of | 1343 | * This function accepts and discards inputs; it has no side effects. This is |
826 | * Worker. Helps avoid circular dependencies and allows code to reason about | 1344 | * primarily useful idiomatically for overridable function endpoints which |
827 | * whether or not they are in a Worker, even if they never include the main | 1345 | * always need to be callable, since JS lacks a null-call idiom ala Cocoa. |
828 | * `ReactWorker` dependency. | ||
829 | */ | 1346 | */ |
830 | var ExecutionEnvironment = { | 1347 | var emptyFunction = function emptyFunction() {}; |
831 | 1348 | ||
832 | canUseDOM: canUseDOM, | 1349 | emptyFunction.thatReturns = makeEmptyFunction; |
833 | 1350 | emptyFunction.thatReturnsFalse = makeEmptyFunction(false); | |
834 | canUseWorkers: typeof Worker !== 'undefined', | 1351 | emptyFunction.thatReturnsTrue = makeEmptyFunction(true); |
835 | 1352 | emptyFunction.thatReturnsNull = makeEmptyFunction(null); | |
836 | canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent), | 1353 | emptyFunction.thatReturnsThis = function () { |
1354 | return this; | ||
1355 | }; | ||
1356 | emptyFunction.thatReturnsArgument = function (arg) { | ||
1357 | return arg; | ||
1358 | }; | ||
837 | 1359 | ||
838 | canUseViewport: canUseDOM && !!window.screen, | 1360 | module.exports = emptyFunction; |
1361 | |||
1362 | /***/ }, | ||
1363 | /* 15 */ | ||
1364 | /***/ function(module, exports, __webpack_require__) { | ||
1365 | |||
1366 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
1367 | * Copyright 2013-present, Facebook, Inc. | ||
1368 | * All rights reserved. | ||
1369 | * | ||
1370 | * This source code is licensed under the BSD-style license found in the | ||
1371 | * LICENSE file in the root directory of this source tree. An additional grant | ||
1372 | * of patent rights can be found in the PATENTS file in the same directory. | ||
1373 | * | ||
1374 | * @providesModule canDefineProperty | ||
1375 | */ | ||
839 | 1376 | ||
840 | isInWorker: !canUseDOM // For now, this is true - might change in the future. | 1377 | 'use strict'; |
841 | 1378 | ||
842 | }; | 1379 | var canDefineProperty = false; |
1380 | if (process.env.NODE_ENV !== 'production') { | ||
1381 | try { | ||
1382 | Object.defineProperty({}, 'x', { get: function () {} }); | ||
1383 | canDefineProperty = true; | ||
1384 | } catch (x) { | ||
1385 | // IE will fail on defineProperty | ||
1386 | } | ||
1387 | } | ||
843 | 1388 | ||
844 | module.exports = ExecutionEnvironment; | 1389 | module.exports = canDefineProperty; |
1390 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
845 | 1391 | ||
846 | /***/ }, | 1392 | /***/ }, |
847 | /* 12 */ | 1393 | /* 16 */ |
848 | /***/ function(module, exports, __webpack_require__) { | 1394 | /***/ function(module, exports, __webpack_require__) { |
849 | 1395 | ||
850 | /* WEBPACK VAR INJECTION */(function(process) {/** | 1396 | /* WEBPACK VAR INJECTION */(function(process) {/** |
851 | * Copyright 2013-2015, Facebook, Inc. | 1397 | * Copyright 2013-present, Facebook, Inc. |
852 | * All rights reserved. | 1398 | * All rights reserved. |
853 | * | 1399 | * |
854 | * This source code is licensed under the BSD-style license found in the | 1400 | * This source code is licensed under the BSD-style license found in the |
855 | * LICENSE file in the root directory of this source tree. An additional grant | 1401 | * LICENSE file in the root directory of this source tree. An additional grant |
856 | * of patent rights can be found in the PATENTS file in the same directory. | 1402 | * of patent rights can be found in the PATENTS file in the same directory. |
857 | * | 1403 | * |
858 | * @providesModule createNodesFromMarkup | 1404 | * @providesModule traverseAllChildren |
859 | * @typechecks | ||
860 | */ | 1405 | */ |
861 | 1406 | ||
862 | /*eslint-disable fb-www/unsafe-html*/ | ||
863 | |||
864 | 'use strict'; | 1407 | 'use strict'; |
865 | 1408 | ||
866 | var ExecutionEnvironment = __webpack_require__(11); | 1409 | var _prodInvariant = __webpack_require__(9); |
867 | 1410 | ||
868 | var createArrayFromMixed = __webpack_require__(13); | 1411 | var ReactCurrentOwner = __webpack_require__(12); |
869 | var getMarkupWrap = __webpack_require__(16); | 1412 | var ReactElement = __webpack_require__(11); |
870 | var invariant = __webpack_require__(15); | ||
871 | 1413 | ||
872 | /** | 1414 | var getIteratorFn = __webpack_require__(17); |
873 | * Dummy container used to render all markup. | 1415 | var invariant = __webpack_require__(10); |
874 | */ | 1416 | var KeyEscapeUtils = __webpack_require__(18); |
875 | var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null; | 1417 | var warning = __webpack_require__(13); |
1418 | |||
1419 | var SEPARATOR = '.'; | ||
1420 | var SUBSEPARATOR = ':'; | ||
876 | 1421 | ||
877 | /** | 1422 | /** |
878 | * Pattern used by `getNodeName`. | 1423 | * TODO: Test that a single child and an array with one item have the same key |
1424 | * pattern. | ||
879 | */ | 1425 | */ |
880 | var nodeNamePattern = /^\s*<(\w+)/; | 1426 | |
1427 | var didWarnAboutMaps = false; | ||
881 | 1428 | ||
882 | /** | 1429 | /** |
883 | * Extracts the `nodeName` of the first element in a string of markup. | 1430 | * Generate a key string that identifies a component within a set. |
884 | * | 1431 | * |
885 | * @param {string} markup String of markup. | 1432 | * @param {*} component A component that could contain a manual key. |
886 | * @return {?string} Node name of the supplied markup. | 1433 | * @param {number} index Index that is used if a manual key is not provided. |
1434 | * @return {string} | ||
887 | */ | 1435 | */ |
888 | function getNodeName(markup) { | 1436 | function getComponentKey(component, index) { |
889 | var nodeNameMatch = markup.match(nodeNamePattern); | 1437 | // Do some typechecking here since we call this blindly. We want to ensure |
890 | return nodeNameMatch && nodeNameMatch[1].toLowerCase(); | 1438 | // that we don't block potential future ES APIs. |
1439 | if (component && typeof component === 'object' && component.key != null) { | ||
1440 | // Explicit key | ||
1441 | return KeyEscapeUtils.escape(component.key); | ||
1442 | } | ||
1443 | // Implicit key determined by the index in the set | ||
1444 | return index.toString(36); | ||
891 | } | 1445 | } |
892 | 1446 | ||
893 | /** | 1447 | /** |
894 | * Creates an array containing the nodes rendered from the supplied markup. The | 1448 | * @param {?*} children Children tree container. |
895 | * optionally supplied `handleScript` function will be invoked once for each | 1449 | * @param {!string} nameSoFar Name of the key path so far. |
896 | * <script> element that is rendered. If no `handleScript` function is supplied, | 1450 | * @param {!function} callback Callback to invoke with each child found. |
897 | * an exception is thrown if any <script> elements are rendered. | 1451 | * @param {?*} traverseContext Used to pass information throughout the traversal |
898 | * | 1452 | * process. |
899 | * @param {string} markup A string of valid HTML markup. | 1453 | * @return {!number} The number of children in this subtree. |
900 | * @param {?function} handleScript Invoked once for each rendered <script>. | ||
901 | * @return {array<DOMElement|DOMTextNode>} An array of rendered nodes. | ||
902 | */ | 1454 | */ |
903 | function createNodesFromMarkup(markup, handleScript) { | 1455 | function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) { |
904 | var node = dummyNode; | 1456 | var type = typeof children; |
905 | !!!dummyNode ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createNodesFromMarkup dummy not initialized') : invariant(false) : undefined; | ||
906 | var nodeName = getNodeName(markup); | ||
907 | 1457 | ||
908 | var wrap = nodeName && getMarkupWrap(nodeName); | 1458 | if (type === 'undefined' || type === 'boolean') { |
909 | if (wrap) { | 1459 | // All of the above are perceived as null. |
910 | node.innerHTML = wrap[1] + markup + wrap[2]; | 1460 | children = null; |
1461 | } | ||
911 | 1462 | ||
912 | var wrapDepth = wrap[0]; | 1463 | if (children === null || type === 'string' || type === 'number' || ReactElement.isValidElement(children)) { |
913 | while (wrapDepth--) { | 1464 | callback(traverseContext, children, |
914 | node = node.lastChild; | 1465 | // If it's the only child, treat the name as if it was wrapped in an array |
1466 | // so that it's consistent if the number of children grows. | ||
1467 | nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar); | ||
1468 | return 1; | ||
1469 | } | ||
1470 | |||
1471 | var child; | ||
1472 | var nextName; | ||
1473 | var subtreeCount = 0; // Count of children found in the current subtree. | ||
1474 | var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR; | ||
1475 | |||
1476 | if (Array.isArray(children)) { | ||
1477 | for (var i = 0; i < children.length; i++) { | ||
1478 | child = children[i]; | ||
1479 | nextName = nextNamePrefix + getComponentKey(child, i); | ||
1480 | subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); | ||
915 | } | 1481 | } |
916 | } else { | 1482 | } else { |
917 | node.innerHTML = markup; | 1483 | var iteratorFn = getIteratorFn(children); |
1484 | if (iteratorFn) { | ||
1485 | var iterator = iteratorFn.call(children); | ||
1486 | var step; | ||
1487 | if (iteratorFn !== children.entries) { | ||
1488 | var ii = 0; | ||
1489 | while (!(step = iterator.next()).done) { | ||
1490 | child = step.value; | ||
1491 | nextName = nextNamePrefix + getComponentKey(child, ii++); | ||
1492 | subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); | ||
1493 | } | ||
1494 | } else { | ||
1495 | if (process.env.NODE_ENV !== 'production') { | ||
1496 | var mapsAsChildrenAddendum = ''; | ||
1497 | if (ReactCurrentOwner.current) { | ||
1498 | var mapsAsChildrenOwnerName = ReactCurrentOwner.current.getName(); | ||
1499 | if (mapsAsChildrenOwnerName) { | ||
1500 | mapsAsChildrenAddendum = ' Check the render method of `' + mapsAsChildrenOwnerName + '`.'; | ||
1501 | } | ||
1502 | } | ||
1503 | 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; | ||
1504 | didWarnAboutMaps = true; | ||
1505 | } | ||
1506 | // Iterator will provide entry [k,v] tuples rather than values. | ||
1507 | while (!(step = iterator.next()).done) { | ||
1508 | var entry = step.value; | ||
1509 | if (entry) { | ||
1510 | child = entry[1]; | ||
1511 | nextName = nextNamePrefix + KeyEscapeUtils.escape(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0); | ||
1512 | subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); | ||
1513 | } | ||
1514 | } | ||
1515 | } | ||
1516 | } else if (type === 'object') { | ||
1517 | var addendum = ''; | ||
1518 | if (process.env.NODE_ENV !== 'production') { | ||
1519 | 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.'; | ||
1520 | if (children._isReactElement) { | ||
1521 | 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.'; | ||
1522 | } | ||
1523 | if (ReactCurrentOwner.current) { | ||
1524 | var name = ReactCurrentOwner.current.getName(); | ||
1525 | if (name) { | ||
1526 | addendum += ' Check the render method of `' + name + '`.'; | ||
1527 | } | ||
1528 | } | ||
1529 | } | ||
1530 | var childrenString = String(children); | ||
1531 | 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; | ||
1532 | } | ||
918 | } | 1533 | } |
919 | 1534 | ||
920 | var scripts = node.getElementsByTagName('script'); | 1535 | return subtreeCount; |
921 | if (scripts.length) { | 1536 | } |
922 | !handleScript ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createNodesFromMarkup(...): Unexpected <script> element rendered.') : invariant(false) : undefined; | ||
923 | createArrayFromMixed(scripts).forEach(handleScript); | ||
924 | } | ||
925 | 1537 | ||
926 | var nodes = createArrayFromMixed(node.childNodes); | 1538 | /** |
927 | while (node.lastChild) { | 1539 | * Traverses children that are typically specified as `props.children`, but |
928 | node.removeChild(node.lastChild); | 1540 | * might also be specified through attributes: |
1541 | * | ||
1542 | * - `traverseAllChildren(this.props.children, ...)` | ||
1543 | * - `traverseAllChildren(this.props.leftPanelChildren, ...)` | ||
1544 | * | ||
1545 | * The `traverseContext` is an optional argument that is passed through the | ||
1546 | * entire traversal. It can be used to store accumulations or anything else that | ||
1547 | * the callback might find relevant. | ||
1548 | * | ||
1549 | * @param {?*} children Children tree object. | ||
1550 | * @param {!function} callback To invoke upon traversing each child. | ||
1551 | * @param {?*} traverseContext Context for traversal. | ||
1552 | * @return {!number} The number of children in this subtree. | ||
1553 | */ | ||
1554 | function traverseAllChildren(children, callback, traverseContext) { | ||
1555 | if (children == null) { | ||
1556 | return 0; | ||
929 | } | 1557 | } |
930 | return nodes; | 1558 | |
1559 | return traverseAllChildrenImpl(children, '', callback, traverseContext); | ||
931 | } | 1560 | } |
932 | 1561 | ||
933 | module.exports = createNodesFromMarkup; | 1562 | module.exports = traverseAllChildren; |
934 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | 1563 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) |
935 | 1564 | ||
936 | /***/ }, | 1565 | /***/ }, |
937 | /* 13 */ | 1566 | /* 17 */ |
938 | /***/ function(module, exports, __webpack_require__) { | 1567 | /***/ function(module, exports) { |
939 | 1568 | ||
940 | /** | 1569 | /** |
941 | * Copyright 2013-2015, Facebook, Inc. | 1570 | * Copyright 2013-present, Facebook, Inc. |
942 | * All rights reserved. | 1571 | * All rights reserved. |
943 | * | 1572 | * |
944 | * This source code is licensed under the BSD-style license found in the | 1573 | * This source code is licensed under the BSD-style license found in the |
945 | * LICENSE file in the root directory of this source tree. An additional grant | 1574 | * LICENSE file in the root directory of this source tree. An additional grant |
946 | * of patent rights can be found in the PATENTS file in the same directory. | 1575 | * of patent rights can be found in the PATENTS file in the same directory. |
947 | * | 1576 | * |
948 | * @providesModule createArrayFromMixed | 1577 | * @providesModule getIteratorFn |
949 | * @typechecks | 1578 | * |
950 | */ | 1579 | */ |
951 | 1580 | ||
952 | 'use strict'; | 1581 | 'use strict'; |
953 | 1582 | ||
954 | var toArray = __webpack_require__(14); | 1583 | /* global Symbol */ |
1584 | |||
1585 | var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; | ||
1586 | var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. | ||
955 | 1587 | ||
956 | /** | 1588 | /** |
957 | * Perform a heuristic test to determine if an object is "array-like". | 1589 | * Returns the iterator method function contained on the iterable object. |
958 | * | 1590 | * |
959 | * A monk asked Joshu, a Zen master, "Has a dog Buddha nature?" | 1591 | * Be sure to invoke the function with the iterable as context: |
960 | * Joshu replied: "Mu." | ||
961 | * | 1592 | * |
962 | * This function determines if its argument has "array nature": it returns | 1593 | * var iteratorFn = getIteratorFn(myIterable); |
963 | * true if the argument is an actual array, an `arguments' object, or an | 1594 | * if (iteratorFn) { |
964 | * HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()). | 1595 | * var iterator = iteratorFn.call(myIterable); |
1596 | * ... | ||
1597 | * } | ||
965 | * | 1598 | * |
966 | * It will return false for other array-like objects like Filelist. | 1599 | * @param {?object} maybeIterable |
1600 | * @return {?function} | ||
1601 | */ | ||
1602 | function getIteratorFn(maybeIterable) { | ||
1603 | var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); | ||
1604 | if (typeof iteratorFn === 'function') { | ||
1605 | return iteratorFn; | ||
1606 | } | ||
1607 | } | ||
1608 | |||
1609 | module.exports = getIteratorFn; | ||
1610 | |||
1611 | /***/ }, | ||
1612 | /* 18 */ | ||
1613 | /***/ function(module, exports) { | ||
1614 | |||
1615 | /** | ||
1616 | * Copyright 2013-present, Facebook, Inc. | ||
1617 | * All rights reserved. | ||
967 | * | 1618 | * |
968 | * @param {*} obj | 1619 | * This source code is licensed under the BSD-style license found in the |
969 | * @return {boolean} | 1620 | * LICENSE file in the root directory of this source tree. An additional grant |
1621 | * of patent rights can be found in the PATENTS file in the same directory. | ||
1622 | * | ||
1623 | * @providesModule KeyEscapeUtils | ||
1624 | * | ||
970 | */ | 1625 | */ |
971 | function hasArrayNature(obj) { | 1626 | |
972 | return( | 1627 | 'use strict'; |
973 | // not null/false | 1628 | |
974 | !!obj && ( | 1629 | /** |
975 | // arrays are objects, NodeLists are functions in Safari | 1630 | * Escape and wrap key so it is safe to use as a reactid |
976 | typeof obj == 'object' || typeof obj == 'function') && | 1631 | * |
977 | // quacks like an array | 1632 | * @param {string} key to be escaped. |
978 | 'length' in obj && | 1633 | * @return {string} the escaped key. |
979 | // not window | 1634 | */ |
980 | !('setInterval' in obj) && | 1635 | |
981 | // no DOM node should be considered an array-like | 1636 | function escape(key) { |
982 | // a 'select' element has 'length' and 'item' properties on IE8 | 1637 | var escapeRegex = /[=:]/g; |
983 | typeof obj.nodeType != 'number' && ( | 1638 | var escaperLookup = { |
984 | // a real array | 1639 | '=': '=0', |
985 | Array.isArray(obj) || | 1640 | ':': '=2' |
986 | // arguments | 1641 | }; |
987 | 'callee' in obj || | 1642 | var escapedString = ('' + key).replace(escapeRegex, function (match) { |
988 | // HTMLCollection/NodeList | 1643 | return escaperLookup[match]; |
989 | 'item' in obj) | 1644 | }); |
990 | ); | 1645 | |
1646 | return '$' + escapedString; | ||
991 | } | 1647 | } |
992 | 1648 | ||
993 | /** | 1649 | /** |
994 | * Ensure that the argument is an array by wrapping it in an array if it is not. | 1650 | * Unescape and unwrap key for human-readable display |
995 | * Creates a copy of the argument if it is already an array. | ||
996 | * | 1651 | * |
997 | * This is mostly useful idiomatically: | 1652 | * @param {string} key to unescape. |
1653 | * @return {string} the unescaped key. | ||
1654 | */ | ||
1655 | function unescape(key) { | ||
1656 | var unescapeRegex = /(=0|=2)/g; | ||
1657 | var unescaperLookup = { | ||
1658 | '=0': '=', | ||
1659 | '=2': ':' | ||
1660 | }; | ||
1661 | var keySubstring = key[0] === '.' && key[1] === '$' ? key.substring(2) : key.substring(1); | ||
1662 | |||
1663 | return ('' + keySubstring).replace(unescapeRegex, function (match) { | ||
1664 | return unescaperLookup[match]; | ||
1665 | }); | ||
1666 | } | ||
1667 | |||
1668 | var KeyEscapeUtils = { | ||
1669 | escape: escape, | ||
1670 | unescape: unescape | ||
1671 | }; | ||
1672 | |||
1673 | module.exports = KeyEscapeUtils; | ||
1674 | |||
1675 | /***/ }, | ||
1676 | /* 19 */ | ||
1677 | /***/ function(module, exports, __webpack_require__) { | ||
1678 | |||
1679 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
1680 | * Copyright 2013-present, Facebook, Inc. | ||
1681 | * All rights reserved. | ||
998 | * | 1682 | * |
999 | * var createArrayFromMixed = require('createArrayFromMixed'); | 1683 | * This source code is licensed under the BSD-style license found in the |
1684 | * LICENSE file in the root directory of this source tree. An additional grant | ||
1685 | * of patent rights can be found in the PATENTS file in the same directory. | ||
1000 | * | 1686 | * |
1001 | * function takesOneOrMoreThings(things) { | 1687 | * @providesModule ReactComponent |
1002 | * things = createArrayFromMixed(things); | 1688 | */ |
1003 | * ... | 1689 | |
1004 | * } | 1690 | 'use strict'; |
1691 | |||
1692 | var _prodInvariant = __webpack_require__(9); | ||
1693 | |||
1694 | var ReactNoopUpdateQueue = __webpack_require__(20); | ||
1695 | |||
1696 | var canDefineProperty = __webpack_require__(15); | ||
1697 | var emptyObject = __webpack_require__(21); | ||
1698 | var invariant = __webpack_require__(10); | ||
1699 | var warning = __webpack_require__(13); | ||
1700 | |||
1701 | /** | ||
1702 | * Base class helpers for the updating state of a component. | ||
1703 | */ | ||
1704 | function ReactComponent(props, context, updater) { | ||
1705 | this.props = props; | ||
1706 | this.context = context; | ||
1707 | this.refs = emptyObject; | ||
1708 | // We initialize the default updater but the real one gets injected by the | ||
1709 | // renderer. | ||
1710 | this.updater = updater || ReactNoopUpdateQueue; | ||
1711 | } | ||
1712 | |||
1713 | ReactComponent.prototype.isReactComponent = {}; | ||
1714 | |||
1715 | /** | ||
1716 | * Sets a subset of the state. Always use this to mutate | ||
1717 | * state. You should treat `this.state` as immutable. | ||
1005 | * | 1718 | * |
1006 | * This allows you to treat `things' as an array, but accept scalars in the API. | 1719 | * There is no guarantee that `this.state` will be immediately updated, so |
1720 | * accessing `this.state` after calling this method may return the old value. | ||
1007 | * | 1721 | * |
1008 | * If you need to convert an array-like object, like `arguments`, into an array | 1722 | * There is no guarantee that calls to `setState` will run synchronously, |
1009 | * use toArray instead. | 1723 | * as they may eventually be batched together. You can provide an optional |
1724 | * callback that will be executed when the call to setState is actually | ||
1725 | * completed. | ||
1010 | * | 1726 | * |
1011 | * @param {*} obj | 1727 | * When a function is provided to setState, it will be called at some point in |
1012 | * @return {array} | 1728 | * the future (not synchronously). It will be called with the up to date |
1729 | * component arguments (state, props, context). These values can be different | ||
1730 | * from this.* because your function may be called after receiveProps but before | ||
1731 | * shouldComponentUpdate, and this new state, props, and context will not yet be | ||
1732 | * assigned to this. | ||
1733 | * | ||
1734 | * @param {object|function} partialState Next partial state or function to | ||
1735 | * produce next partial state to be merged with current state. | ||
1736 | * @param {?function} callback Called after state is updated. | ||
1737 | * @final | ||
1738 | * @protected | ||
1013 | */ | 1739 | */ |
1014 | function createArrayFromMixed(obj) { | 1740 | ReactComponent.prototype.setState = function (partialState, callback) { |
1015 | if (!hasArrayNature(obj)) { | 1741 | !(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; |
1016 | return [obj]; | 1742 | this.updater.enqueueSetState(this, partialState); |
1017 | } else if (Array.isArray(obj)) { | 1743 | if (callback) { |
1018 | return obj.slice(); | 1744 | this.updater.enqueueCallback(this, callback, 'setState'); |
1019 | } else { | 1745 | } |
1020 | return toArray(obj); | 1746 | }; |
1747 | |||
1748 | /** | ||
1749 | * Forces an update. This should only be invoked when it is known with | ||
1750 | * certainty that we are **not** in a DOM transaction. | ||
1751 | * | ||
1752 | * You may want to call this when you know that some deeper aspect of the | ||
1753 | * component's state has changed but `setState` was not called. | ||
1754 | * | ||
1755 | * This will not invoke `shouldComponentUpdate`, but it will invoke | ||
1756 | * `componentWillUpdate` and `componentDidUpdate`. | ||
1757 | * | ||
1758 | * @param {?function} callback Called after update is complete. | ||
1759 | * @final | ||
1760 | * @protected | ||
1761 | */ | ||
1762 | ReactComponent.prototype.forceUpdate = function (callback) { | ||
1763 | this.updater.enqueueForceUpdate(this); | ||
1764 | if (callback) { | ||
1765 | this.updater.enqueueCallback(this, callback, 'forceUpdate'); | ||
1766 | } | ||
1767 | }; | ||
1768 | |||
1769 | /** | ||
1770 | * Deprecated APIs. These APIs used to exist on classic React classes but since | ||
1771 | * we would like to deprecate them, we're not going to move them over to this | ||
1772 | * modern base class. Instead, we define a getter that warns if it's accessed. | ||
1773 | */ | ||
1774 | if (process.env.NODE_ENV !== 'production') { | ||
1775 | var deprecatedAPIs = { | ||
1776 | isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'], | ||
1777 | replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).'] | ||
1778 | }; | ||
1779 | var defineDeprecationWarning = function (methodName, info) { | ||
1780 | if (canDefineProperty) { | ||
1781 | Object.defineProperty(ReactComponent.prototype, methodName, { | ||
1782 | get: function () { | ||
1783 | process.env.NODE_ENV !== 'production' ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) : void 0; | ||
1784 | return undefined; | ||
1785 | } | ||
1786 | }); | ||
1787 | } | ||
1788 | }; | ||
1789 | for (var fnName in deprecatedAPIs) { | ||
1790 | if (deprecatedAPIs.hasOwnProperty(fnName)) { | ||
1791 | defineDeprecationWarning(fnName, deprecatedAPIs[fnName]); | ||
1792 | } | ||
1021 | } | 1793 | } |
1022 | } | 1794 | } |
1023 | 1795 | ||
1024 | module.exports = createArrayFromMixed; | 1796 | module.exports = ReactComponent; |
1797 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
1025 | 1798 | ||
1026 | /***/ }, | 1799 | /***/ }, |
1027 | /* 14 */ | 1800 | /* 20 */ |
1028 | /***/ function(module, exports, __webpack_require__) { | 1801 | /***/ function(module, exports, __webpack_require__) { |
1029 | 1802 | ||
1030 | /* WEBPACK VAR INJECTION */(function(process) {/** | 1803 | /* WEBPACK VAR INJECTION */(function(process) {/** |
1031 | * Copyright 2013-2015, Facebook, Inc. | 1804 | * Copyright 2015-present, Facebook, Inc. |
1032 | * All rights reserved. | 1805 | * All rights reserved. |
1033 | * | 1806 | * |
1034 | * This source code is licensed under the BSD-style license found in the | 1807 | * This source code is licensed under the BSD-style license found in the |
1035 | * LICENSE file in the root directory of this source tree. An additional grant | 1808 | * LICENSE file in the root directory of this source tree. An additional grant |
1036 | * of patent rights can be found in the PATENTS file in the same directory. | 1809 | * of patent rights can be found in the PATENTS file in the same directory. |
1037 | * | 1810 | * |
1038 | * @providesModule toArray | 1811 | * @providesModule ReactNoopUpdateQueue |
1039 | * @typechecks | ||
1040 | */ | 1812 | */ |
1041 | 1813 | ||
1042 | 'use strict'; | 1814 | 'use strict'; |
1043 | 1815 | ||
1044 | var invariant = __webpack_require__(15); | 1816 | var warning = __webpack_require__(13); |
1817 | |||
1818 | function warnNoop(publicInstance, callerName) { | ||
1819 | if (process.env.NODE_ENV !== 'production') { | ||
1820 | var constructor = publicInstance.constructor; | ||
1821 | 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; | ||
1822 | } | ||
1823 | } | ||
1045 | 1824 | ||
1046 | /** | 1825 | /** |
1047 | * Convert array-like objects to arrays. | 1826 | * This is the abstract API for an update queue. |
1048 | * | ||
1049 | * This API assumes the caller knows the contents of the data type. For less | ||
1050 | * well defined inputs use createArrayFromMixed. | ||
1051 | * | ||
1052 | * @param {object|function|filelist} obj | ||
1053 | * @return {array} | ||
1054 | */ | 1827 | */ |
1055 | function toArray(obj) { | 1828 | var ReactNoopUpdateQueue = { |
1056 | var length = obj.length; | ||
1057 | 1829 | ||
1058 | // Some browse builtin objects can report typeof 'function' (e.g. NodeList in | 1830 | /** |
1059 | // old versions of Safari). | 1831 | * Checks whether or not this composite component is mounted. |
1060 | !(!Array.isArray(obj) && (typeof obj === 'object' || typeof obj === 'function')) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Array-like object expected') : invariant(false) : undefined; | 1832 | * @param {ReactClass} publicInstance The instance we want to test. |
1833 | * @return {boolean} True if mounted, false otherwise. | ||
1834 | * @protected | ||
1835 | * @final | ||
1836 | */ | ||
1837 | isMounted: function (publicInstance) { | ||
1838 | return false; | ||
1839 | }, | ||
1061 | 1840 | ||
1062 | !(typeof length === 'number') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object needs a length property') : invariant(false) : undefined; | 1841 | /** |
1842 | * Enqueue a callback that will be executed after all the pending updates | ||
1843 | * have processed. | ||
1844 | * | ||
1845 | * @param {ReactClass} publicInstance The instance to use as `this` context. | ||
1846 | * @param {?function} callback Called after state is updated. | ||
1847 | * @internal | ||
1848 | */ | ||
1849 | enqueueCallback: function (publicInstance, callback) {}, | ||
1063 | 1850 | ||
1064 | !(length === 0 || length - 1 in obj) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object should have keys for indices') : invariant(false) : undefined; | 1851 | /** |
1852 | * Forces an update. This should only be invoked when it is known with | ||
1853 | * certainty that we are **not** in a DOM transaction. | ||
1854 | * | ||
1855 | * You may want to call this when you know that some deeper aspect of the | ||
1856 | * component's state has changed but `setState` was not called. | ||
1857 | * | ||
1858 | * This will not invoke `shouldComponentUpdate`, but it will invoke | ||
1859 | * `componentWillUpdate` and `componentDidUpdate`. | ||
1860 | * | ||
1861 | * @param {ReactClass} publicInstance The instance that should rerender. | ||
1862 | * @internal | ||
1863 | */ | ||
1864 | enqueueForceUpdate: function (publicInstance) { | ||
1865 | warnNoop(publicInstance, 'forceUpdate'); | ||
1866 | }, | ||
1065 | 1867 | ||
1066 | // Old IE doesn't give collections access to hasOwnProperty. Assume inputs | 1868 | /** |
1067 | // without method will throw during the slice call and skip straight to the | 1869 | * Replaces all of the state. Always use this or `setState` to mutate state. |
1068 | // fallback. | 1870 | * You should treat `this.state` as immutable. |
1069 | if (obj.hasOwnProperty) { | 1871 | * |
1070 | try { | 1872 | * There is no guarantee that `this.state` will be immediately updated, so |
1071 | return Array.prototype.slice.call(obj); | 1873 | * accessing `this.state` after calling this method may return the old value. |
1072 | } catch (e) { | 1874 | * |
1073 | // IE < 9 does not support Array#slice on collections objects | 1875 | * @param {ReactClass} publicInstance The instance that should rerender. |
1074 | } | 1876 | * @param {object} completeState Next state. |
1075 | } | 1877 | * @internal |
1878 | */ | ||
1879 | enqueueReplaceState: function (publicInstance, completeState) { | ||
1880 | warnNoop(publicInstance, 'replaceState'); | ||
1881 | }, | ||
1076 | 1882 | ||
1077 | // Fall back to copying key by key. This assumes all keys have a value, | 1883 | /** |
1078 | // so will not preserve sparsely populated inputs. | 1884 | * Sets a subset of the state. This only exists because _pendingState is |
1079 | var ret = Array(length); | 1885 | * internal. This provides a merging strategy that is not available to deep |
1080 | for (var ii = 0; ii < length; ii++) { | 1886 | * properties which is confusing. TODO: Expose pendingState or don't use it |
1081 | ret[ii] = obj[ii]; | 1887 | * during the merge. |
1888 | * | ||
1889 | * @param {ReactClass} publicInstance The instance that should rerender. | ||
1890 | * @param {object} partialState Next partial state to be merged with state. | ||
1891 | * @internal | ||
1892 | */ | ||
1893 | enqueueSetState: function (publicInstance, partialState) { | ||
1894 | warnNoop(publicInstance, 'setState'); | ||
1082 | } | 1895 | } |
1083 | return ret; | 1896 | }; |
1084 | } | ||
1085 | 1897 | ||
1086 | module.exports = toArray; | 1898 | module.exports = ReactNoopUpdateQueue; |
1087 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | 1899 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) |
1088 | 1900 | ||
1089 | /***/ }, | 1901 | /***/ }, |
1090 | /* 15 */ | 1902 | /* 21 */ |
1091 | /***/ function(module, exports, __webpack_require__) { | 1903 | /***/ function(module, exports, __webpack_require__) { |
1092 | 1904 | ||
1093 | /* WEBPACK VAR INJECTION */(function(process) {/** | 1905 | /* WEBPACK VAR INJECTION */(function(process) {/** |
1094 | * Copyright 2013-2015, Facebook, Inc. | 1906 | * Copyright (c) 2013-present, Facebook, Inc. |
1095 | * All rights reserved. | 1907 | * All rights reserved. |
1096 | * | 1908 | * |
1097 | * This source code is licensed under the BSD-style license found in the | 1909 | * This source code is licensed under the BSD-style license found in the |
1098 | * LICENSE file in the root directory of this source tree. An additional grant | 1910 | * LICENSE file in the root directory of this source tree. An additional grant |
1099 | * of patent rights can be found in the PATENTS file in the same directory. | 1911 | * of patent rights can be found in the PATENTS file in the same directory. |
1100 | * | 1912 | * |
1101 | * @providesModule invariant | ||
1102 | */ | 1913 | */ |
1103 | 1914 | ||
1104 | 'use strict'; | 1915 | 'use strict'; |
1105 | 1916 | ||
1917 | var emptyObject = {}; | ||
1918 | |||
1919 | if (process.env.NODE_ENV !== 'production') { | ||
1920 | Object.freeze(emptyObject); | ||
1921 | } | ||
1922 | |||
1923 | module.exports = emptyObject; | ||
1924 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
1925 | |||
1926 | /***/ }, | ||
1927 | /* 22 */ | ||
1928 | /***/ function(module, exports, __webpack_require__) { | ||
1929 | |||
1106 | /** | 1930 | /** |
1107 | * Use invariant() to assert state which your program assumes to be true. | 1931 | * Copyright 2013-present, Facebook, Inc. |
1932 | * All rights reserved. | ||
1108 | * | 1933 | * |
1109 | * Provide sprintf-style format (only %s is supported) and arguments | 1934 | * This source code is licensed under the BSD-style license found in the |
1110 | * to provide information about what broke and what you were | 1935 | * LICENSE file in the root directory of this source tree. An additional grant |
1111 | * expecting. | 1936 | * of patent rights can be found in the PATENTS file in the same directory. |
1112 | * | 1937 | * |
1113 | * The invariant message will be stripped in production, but the invariant | 1938 | * @providesModule ReactPureComponent |
1114 | * will remain to ensure logic does not differ in production. | ||
1115 | */ | 1939 | */ |
1116 | 1940 | ||
1117 | var invariant = function (condition, format, a, b, c, d, e, f) { | 1941 | 'use strict'; |
1118 | if (process.env.NODE_ENV !== 'production') { | ||
1119 | if (format === undefined) { | ||
1120 | throw new Error('invariant requires an error message argument'); | ||
1121 | } | ||
1122 | } | ||
1123 | 1942 | ||
1124 | if (!condition) { | 1943 | var _assign = __webpack_require__(6); |
1125 | var error; | ||
1126 | if (format === undefined) { | ||
1127 | error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.'); | ||
1128 | } else { | ||
1129 | var args = [a, b, c, d, e, f]; | ||
1130 | var argIndex = 0; | ||
1131 | error = new Error('Invariant Violation: ' + format.replace(/%s/g, function () { | ||
1132 | return args[argIndex++]; | ||
1133 | })); | ||
1134 | } | ||
1135 | 1944 | ||
1136 | error.framesToPop = 1; // we don't care about invariant's own frame | 1945 | var ReactComponent = __webpack_require__(19); |
1137 | throw error; | 1946 | var ReactNoopUpdateQueue = __webpack_require__(20); |
1138 | } | ||
1139 | }; | ||
1140 | 1947 | ||
1141 | module.exports = invariant; | 1948 | var emptyObject = __webpack_require__(21); |
1142 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | 1949 | |
1950 | /** | ||
1951 | * Base class helpers for the updating state of a component. | ||
1952 | */ | ||
1953 | function ReactPureComponent(props, context, updater) { | ||
1954 | // Duplicated from ReactComponent. | ||
1955 | this.props = props; | ||
1956 | this.context = context; | ||
1957 | this.refs = emptyObject; | ||
1958 | // We initialize the default updater but the real one gets injected by the | ||
1959 | // renderer. | ||
1960 | this.updater = updater || ReactNoopUpdateQueue; | ||
1961 | } | ||
1962 | |||
1963 | function ComponentDummy() {} | ||
1964 | ComponentDummy.prototype = ReactComponent.prototype; | ||
1965 | ReactPureComponent.prototype = new ComponentDummy(); | ||
1966 | ReactPureComponent.prototype.constructor = ReactPureComponent; | ||
1967 | // Avoid an extra prototype jump for these methods. | ||
1968 | _assign(ReactPureComponent.prototype, ReactComponent.prototype); | ||
1969 | ReactPureComponent.prototype.isPureReactComponent = true; | ||
1970 | |||
1971 | module.exports = ReactPureComponent; | ||
1143 | 1972 | ||
1144 | /***/ }, | 1973 | /***/ }, |
1145 | /* 16 */ | 1974 | /* 23 */ |
1146 | /***/ function(module, exports, __webpack_require__) { | 1975 | /***/ function(module, exports, __webpack_require__) { |
1147 | 1976 | ||
1148 | /* WEBPACK VAR INJECTION */(function(process) {/** | 1977 | /* WEBPACK VAR INJECTION */(function(process) {/** |
1149 | * Copyright 2013-2015, Facebook, Inc. | 1978 | * Copyright 2013-present, Facebook, Inc. |
1150 | * All rights reserved. | 1979 | * All rights reserved. |
1151 | * | 1980 | * |
1152 | * This source code is licensed under the BSD-style license found in the | 1981 | * This source code is licensed under the BSD-style license found in the |
1153 | * LICENSE file in the root directory of this source tree. An additional grant | 1982 | * LICENSE file in the root directory of this source tree. An additional grant |
1154 | * of patent rights can be found in the PATENTS file in the same directory. | 1983 | * of patent rights can be found in the PATENTS file in the same directory. |
1155 | * | 1984 | * |
1156 | * @providesModule getMarkupWrap | 1985 | * @providesModule ReactClass |
1157 | */ | 1986 | */ |
1158 | 1987 | ||
1159 | /*eslint-disable fb-www/unsafe-html */ | ||
1160 | |||
1161 | 'use strict'; | 1988 | 'use strict'; |
1162 | 1989 | ||
1163 | var ExecutionEnvironment = __webpack_require__(11); | 1990 | var _prodInvariant = __webpack_require__(9), |
1991 | _assign = __webpack_require__(6); | ||
1992 | |||
1993 | var ReactComponent = __webpack_require__(19); | ||
1994 | var ReactElement = __webpack_require__(11); | ||
1995 | var ReactPropTypeLocations = __webpack_require__(24); | ||
1996 | var ReactPropTypeLocationNames = __webpack_require__(26); | ||
1997 | var ReactNoopUpdateQueue = __webpack_require__(20); | ||
1164 | 1998 | ||
1165 | var invariant = __webpack_require__(15); | 1999 | var emptyObject = __webpack_require__(21); |
2000 | var invariant = __webpack_require__(10); | ||
2001 | var keyMirror = __webpack_require__(25); | ||
2002 | var keyOf = __webpack_require__(27); | ||
2003 | var warning = __webpack_require__(13); | ||
2004 | |||
2005 | var MIXINS_KEY = keyOf({ mixins: null }); | ||
1166 | 2006 | ||
1167 | /** | 2007 | /** |
1168 | * Dummy container used to detect which wraps are necessary. | 2008 | * Policies that describe methods in `ReactClassInterface`. |
1169 | */ | 2009 | */ |
1170 | var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null; | 2010 | var SpecPolicy = keyMirror({ |
2011 | /** | ||
2012 | * These methods may be defined only once by the class specification or mixin. | ||
2013 | */ | ||
2014 | DEFINE_ONCE: null, | ||
2015 | /** | ||
2016 | * These methods may be defined by both the class specification and mixins. | ||
2017 | * Subsequent definitions will be chained. These methods must return void. | ||
2018 | */ | ||
2019 | DEFINE_MANY: null, | ||
2020 | /** | ||
2021 | * These methods are overriding the base class. | ||
2022 | */ | ||
2023 | OVERRIDE_BASE: null, | ||
2024 | /** | ||
2025 | * These methods are similar to DEFINE_MANY, except we assume they return | ||
2026 | * objects. We try to merge the keys of the return values of all the mixed in | ||
2027 | * functions. If there is a key conflict we throw. | ||
2028 | */ | ||
2029 | DEFINE_MANY_MERGED: null | ||
2030 | }); | ||
2031 | |||
2032 | var injectedMixins = []; | ||
1171 | 2033 | ||
1172 | /** | 2034 | /** |
1173 | * Some browsers cannot use `innerHTML` to render certain elements standalone, | 2035 | * Composite components are higher-level components that compose other composite |
1174 | * so we wrap them, render the wrapped nodes, then extract the desired node. | 2036 | * or host components. |
1175 | * | 2037 | * |
1176 | * In IE8, certain elements cannot render alone, so wrap all elements ('*'). | 2038 | * To create a new type of `ReactClass`, pass a specification of |
2039 | * your new class to `React.createClass`. The only requirement of your class | ||
2040 | * specification is that you implement a `render` method. | ||
2041 | * | ||
2042 | * var MyComponent = React.createClass({ | ||
2043 | * render: function() { | ||
2044 | * return <div>Hello World</div>; | ||
2045 | * } | ||
2046 | * }); | ||
2047 | * | ||
2048 | * The class specification supports a specific protocol of methods that have | ||
2049 | * special meaning (e.g. `render`). See `ReactClassInterface` for | ||
2050 | * more the comprehensive protocol. Any other properties and methods in the | ||
2051 | * class specification will be available on the prototype. | ||
2052 | * | ||
2053 | * @interface ReactClassInterface | ||
2054 | * @internal | ||
1177 | */ | 2055 | */ |
2056 | var ReactClassInterface = { | ||
1178 | 2057 | ||
1179 | var shouldWrap = {}; | 2058 | /** |
2059 | * An array of Mixin objects to include when defining your component. | ||
2060 | * | ||
2061 | * @type {array} | ||
2062 | * @optional | ||
2063 | */ | ||
2064 | mixins: SpecPolicy.DEFINE_MANY, | ||
1180 | 2065 | ||
1181 | var selectWrap = [1, '<select multiple="true">', '</select>']; | 2066 | /** |
1182 | var tableWrap = [1, '<table>', '</table>']; | 2067 | * An object containing properties and methods that should be defined on |
1183 | var trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>']; | 2068 | * the component's constructor instead of its prototype (static methods). |
2069 | * | ||
2070 | * @type {object} | ||
2071 | * @optional | ||
2072 | */ | ||
2073 | statics: SpecPolicy.DEFINE_MANY, | ||
1184 | 2074 | ||
1185 | var svgWrap = [1, '<svg xmlns="http://www.w3.org/2000/svg">', '</svg>']; | 2075 | /** |
2076 | * Definition of prop types for this component. | ||
2077 | * | ||
2078 | * @type {object} | ||
2079 | * @optional | ||
2080 | */ | ||
2081 | propTypes: SpecPolicy.DEFINE_MANY, | ||
1186 | 2082 | ||
1187 | var markupWrap = { | 2083 | /** |
1188 | '*': [1, '?<div>', '</div>'], | 2084 | * Definition of context types for this component. |
2085 | * | ||
2086 | * @type {object} | ||
2087 | * @optional | ||
2088 | */ | ||
2089 | contextTypes: SpecPolicy.DEFINE_MANY, | ||
1189 | 2090 | ||
1190 | 'area': [1, '<map>', '</map>'], | 2091 | /** |
1191 | 'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'], | 2092 | * Definition of context types this component sets for its children. |
1192 | 'legend': [1, '<fieldset>', '</fieldset>'], | 2093 | * |
1193 | 'param': [1, '<object>', '</object>'], | 2094 | * @type {object} |
1194 | 'tr': [2, '<table><tbody>', '</tbody></table>'], | 2095 | * @optional |
2096 | */ | ||
2097 | childContextTypes: SpecPolicy.DEFINE_MANY, | ||
1195 | 2098 | ||
1196 | 'optgroup': selectWrap, | 2099 | // ==== Definition methods ==== |
1197 | 'option': selectWrap, | ||
1198 | 2100 | ||
1199 | 'caption': tableWrap, | 2101 | /** |
1200 | 'colgroup': tableWrap, | 2102 | * Invoked when the component is mounted. Values in the mapping will be set on |
1201 | 'tbody': tableWrap, | 2103 | * `this.props` if that prop is not specified (i.e. using an `in` check). |
1202 | 'tfoot': tableWrap, | 2104 | * |
1203 | 'thead': tableWrap, | 2105 | * This method is invoked before `getInitialState` and therefore cannot rely |
2106 | * on `this.state` or use `this.setState`. | ||
2107 | * | ||
2108 | * @return {object} | ||
2109 | * @optional | ||
2110 | */ | ||
2111 | getDefaultProps: SpecPolicy.DEFINE_MANY_MERGED, | ||
1204 | 2112 | ||
1205 | 'td': trWrap, | 2113 | /** |
1206 | 'th': trWrap | 2114 | * Invoked once before the component is mounted. The return value will be used |
1207 | }; | 2115 | * as the initial value of `this.state`. |
2116 | * | ||
2117 | * getInitialState: function() { | ||
2118 | * return { | ||
2119 | * isOn: false, | ||
2120 | * fooBaz: new BazFoo() | ||
2121 | * } | ||
2122 | * } | ||
2123 | * | ||
2124 | * @return {object} | ||
2125 | * @optional | ||
2126 | */ | ||
2127 | getInitialState: SpecPolicy.DEFINE_MANY_MERGED, | ||
1208 | 2128 | ||
1209 | // Initialize the SVG elements since we know they'll always need to be wrapped | 2129 | /** |
1210 | // consistently. If they are created inside a <div> they will be initialized in | 2130 | * @return {object} |
1211 | // the wrong namespace (and will not display). | 2131 | * @optional |
1212 | var svgElements = ['circle', 'clipPath', 'defs', 'ellipse', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'text', 'tspan']; | 2132 | */ |
1213 | svgElements.forEach(function (nodeName) { | 2133 | getChildContext: SpecPolicy.DEFINE_MANY_MERGED, |
1214 | markupWrap[nodeName] = svgWrap; | 2134 | |
1215 | shouldWrap[nodeName] = true; | 2135 | /** |
1216 | }); | 2136 | * Uses props from `this.props` and state from `this.state` to render the |
2137 | * structure of the component. | ||
2138 | * | ||
2139 | * No guarantees are made about when or how often this method is invoked, so | ||
2140 | * it must not have side effects. | ||
2141 | * | ||
2142 | * render: function() { | ||
2143 | * var name = this.props.name; | ||
2144 | * return <div>Hello, {name}!</div>; | ||
2145 | * } | ||
2146 | * | ||
2147 | * @return {ReactComponent} | ||
2148 | * @nosideeffects | ||
2149 | * @required | ||
2150 | */ | ||
2151 | render: SpecPolicy.DEFINE_ONCE, | ||
2152 | |||
2153 | // ==== Delegate methods ==== | ||
2154 | |||
2155 | /** | ||
2156 | * Invoked when the component is initially created and about to be mounted. | ||
2157 | * This may have side effects, but any external subscriptions or data created | ||
2158 | * by this method must be cleaned up in `componentWillUnmount`. | ||
2159 | * | ||
2160 | * @optional | ||
2161 | */ | ||
2162 | componentWillMount: SpecPolicy.DEFINE_MANY, | ||
2163 | |||
2164 | /** | ||
2165 | * Invoked when the component has been mounted and has a DOM representation. | ||
2166 | * However, there is no guarantee that the DOM node is in the document. | ||
2167 | * | ||
2168 | * Use this as an opportunity to operate on the DOM when the component has | ||
2169 | * been mounted (initialized and rendered) for the first time. | ||
2170 | * | ||
2171 | * @param {DOMElement} rootNode DOM element representing the component. | ||
2172 | * @optional | ||
2173 | */ | ||
2174 | componentDidMount: SpecPolicy.DEFINE_MANY, | ||
2175 | |||
2176 | /** | ||
2177 | * Invoked before the component receives new props. | ||
2178 | * | ||
2179 | * Use this as an opportunity to react to a prop transition by updating the | ||
2180 | * state using `this.setState`. Current props are accessed via `this.props`. | ||
2181 | * | ||
2182 | * componentWillReceiveProps: function(nextProps, nextContext) { | ||
2183 | * this.setState({ | ||
2184 | * likesIncreasing: nextProps.likeCount > this.props.likeCount | ||
2185 | * }); | ||
2186 | * } | ||
2187 | * | ||
2188 | * NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop | ||
2189 | * transition may cause a state change, but the opposite is not true. If you | ||
2190 | * need it, you are probably looking for `componentWillUpdate`. | ||
2191 | * | ||
2192 | * @param {object} nextProps | ||
2193 | * @optional | ||
2194 | */ | ||
2195 | componentWillReceiveProps: SpecPolicy.DEFINE_MANY, | ||
2196 | |||
2197 | /** | ||
2198 | * Invoked while deciding if the component should be updated as a result of | ||
2199 | * receiving new props, state and/or context. | ||
2200 | * | ||
2201 | * Use this as an opportunity to `return false` when you're certain that the | ||
2202 | * transition to the new props/state/context will not require a component | ||
2203 | * update. | ||
2204 | * | ||
2205 | * shouldComponentUpdate: function(nextProps, nextState, nextContext) { | ||
2206 | * return !equal(nextProps, this.props) || | ||
2207 | * !equal(nextState, this.state) || | ||
2208 | * !equal(nextContext, this.context); | ||
2209 | * } | ||
2210 | * | ||
2211 | * @param {object} nextProps | ||
2212 | * @param {?object} nextState | ||
2213 | * @param {?object} nextContext | ||
2214 | * @return {boolean} True if the component should update. | ||
2215 | * @optional | ||
2216 | */ | ||
2217 | shouldComponentUpdate: SpecPolicy.DEFINE_ONCE, | ||
2218 | |||
2219 | /** | ||
2220 | * Invoked when the component is about to update due to a transition from | ||
2221 | * `this.props`, `this.state` and `this.context` to `nextProps`, `nextState` | ||
2222 | * and `nextContext`. | ||
2223 | * | ||
2224 | * Use this as an opportunity to perform preparation before an update occurs. | ||
2225 | * | ||
2226 | * NOTE: You **cannot** use `this.setState()` in this method. | ||
2227 | * | ||
2228 | * @param {object} nextProps | ||
2229 | * @param {?object} nextState | ||
2230 | * @param {?object} nextContext | ||
2231 | * @param {ReactReconcileTransaction} transaction | ||
2232 | * @optional | ||
2233 | */ | ||
2234 | componentWillUpdate: SpecPolicy.DEFINE_MANY, | ||
2235 | |||
2236 | /** | ||
2237 | * Invoked when the component's DOM representation has been updated. | ||
2238 | * | ||
2239 | * Use this as an opportunity to operate on the DOM when the component has | ||
2240 | * been updated. | ||
2241 | * | ||
2242 | * @param {object} prevProps | ||
2243 | * @param {?object} prevState | ||
2244 | * @param {?object} prevContext | ||
2245 | * @param {DOMElement} rootNode DOM element representing the component. | ||
2246 | * @optional | ||
2247 | */ | ||
2248 | componentDidUpdate: SpecPolicy.DEFINE_MANY, | ||
2249 | |||
2250 | /** | ||
2251 | * Invoked when the component is about to be removed from its parent and have | ||
2252 | * its DOM representation destroyed. | ||
2253 | * | ||
2254 | * Use this as an opportunity to deallocate any external resources. | ||
2255 | * | ||
2256 | * NOTE: There is no `componentDidUnmount` since your component will have been | ||
2257 | * destroyed by that point. | ||
2258 | * | ||
2259 | * @optional | ||
2260 | */ | ||
2261 | componentWillUnmount: SpecPolicy.DEFINE_MANY, | ||
2262 | |||
2263 | // ==== Advanced methods ==== | ||
2264 | |||
2265 | /** | ||
2266 | * Updates the component's currently mounted DOM representation. | ||
2267 | * | ||
2268 | * By default, this implements React's rendering and reconciliation algorithm. | ||
2269 | * Sophisticated clients may wish to override this. | ||
2270 | * | ||
2271 | * @param {ReactReconcileTransaction} transaction | ||
2272 | * @internal | ||
2273 | * @overridable | ||
2274 | */ | ||
2275 | updateComponent: SpecPolicy.OVERRIDE_BASE | ||
2276 | |||
2277 | }; | ||
1217 | 2278 | ||
1218 | /** | 2279 | /** |
1219 | * Gets the markup wrap configuration for the supplied `nodeName`. | 2280 | * Mapping from class specification keys to special processing functions. |
1220 | * | ||
1221 | * NOTE: This lazily detects which wraps are necessary for the current browser. | ||
1222 | * | 2281 | * |
1223 | * @param {string} nodeName Lowercase `nodeName`. | 2282 | * Although these are declared like instance properties in the specification |
1224 | * @return {?array} Markup wrap configuration, if applicable. | 2283 | * when defining classes using `React.createClass`, they are actually static |
2284 | * and are accessible on the constructor instead of the prototype. Despite | ||
2285 | * being static, they must be defined outside of the "statics" key under | ||
2286 | * which all other static methods are defined. | ||
1225 | */ | 2287 | */ |
1226 | function getMarkupWrap(nodeName) { | 2288 | var RESERVED_SPEC_KEYS = { |
1227 | !!!dummyNode ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Markup wrapping node not initialized') : invariant(false) : undefined; | 2289 | displayName: function (Constructor, displayName) { |
1228 | if (!markupWrap.hasOwnProperty(nodeName)) { | 2290 | Constructor.displayName = displayName; |
1229 | nodeName = '*'; | 2291 | }, |
2292 | mixins: function (Constructor, mixins) { | ||
2293 | if (mixins) { | ||
2294 | for (var i = 0; i < mixins.length; i++) { | ||
2295 | mixSpecIntoComponent(Constructor, mixins[i]); | ||
2296 | } | ||
2297 | } | ||
2298 | }, | ||
2299 | childContextTypes: function (Constructor, childContextTypes) { | ||
2300 | if (process.env.NODE_ENV !== 'production') { | ||
2301 | validateTypeDef(Constructor, childContextTypes, ReactPropTypeLocations.childContext); | ||
2302 | } | ||
2303 | Constructor.childContextTypes = _assign({}, Constructor.childContextTypes, childContextTypes); | ||
2304 | }, | ||
2305 | contextTypes: function (Constructor, contextTypes) { | ||
2306 | if (process.env.NODE_ENV !== 'production') { | ||
2307 | validateTypeDef(Constructor, contextTypes, ReactPropTypeLocations.context); | ||
2308 | } | ||
2309 | Constructor.contextTypes = _assign({}, Constructor.contextTypes, contextTypes); | ||
2310 | }, | ||
2311 | /** | ||
2312 | * Special case getDefaultProps which should move into statics but requires | ||
2313 | * automatic merging. | ||
2314 | */ | ||
2315 | getDefaultProps: function (Constructor, getDefaultProps) { | ||
2316 | if (Constructor.getDefaultProps) { | ||
2317 | Constructor.getDefaultProps = createMergedResultFunction(Constructor.getDefaultProps, getDefaultProps); | ||
2318 | } else { | ||
2319 | Constructor.getDefaultProps = getDefaultProps; | ||
2320 | } | ||
2321 | }, | ||
2322 | propTypes: function (Constructor, propTypes) { | ||
2323 | if (process.env.NODE_ENV !== 'production') { | ||
2324 | validateTypeDef(Constructor, propTypes, ReactPropTypeLocations.prop); | ||
2325 | } | ||
2326 | Constructor.propTypes = _assign({}, Constructor.propTypes, propTypes); | ||
2327 | }, | ||
2328 | statics: function (Constructor, statics) { | ||
2329 | mixStaticSpecIntoComponent(Constructor, statics); | ||
2330 | }, | ||
2331 | autobind: function () {} }; | ||
2332 | |||
2333 | // noop | ||
2334 | function validateTypeDef(Constructor, typeDef, location) { | ||
2335 | for (var propName in typeDef) { | ||
2336 | if (typeDef.hasOwnProperty(propName)) { | ||
2337 | // use a warning instead of an invariant so components | ||
2338 | // don't show up in prod but only in __DEV__ | ||
2339 | 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; | ||
2340 | } | ||
1230 | } | 2341 | } |
1231 | if (!shouldWrap.hasOwnProperty(nodeName)) { | 2342 | } |
1232 | if (nodeName === '*') { | 2343 | |
1233 | dummyNode.innerHTML = '<link />'; | 2344 | function validateMethodOverride(isAlreadyDefined, name) { |
2345 | var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null; | ||
2346 | |||
2347 | // Disallow overriding of base class methods unless explicitly allowed. | ||
2348 | if (ReactClassMixin.hasOwnProperty(name)) { | ||
2349 | !(specPolicy === 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; | ||
2350 | } | ||
2351 | |||
2352 | // Disallow defining methods more than once unless explicitly allowed. | ||
2353 | if (isAlreadyDefined) { | ||
2354 | !(specPolicy === SpecPolicy.DEFINE_MANY || specPolicy === 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; | ||
2355 | } | ||
2356 | } | ||
2357 | |||
2358 | /** | ||
2359 | * Mixin helper which handles policy validation and reserved | ||
2360 | * specification keys when building React classes. | ||
2361 | */ | ||
2362 | function mixSpecIntoComponent(Constructor, spec) { | ||
2363 | if (!spec) { | ||
2364 | if (process.env.NODE_ENV !== 'production') { | ||
2365 | var typeofSpec = typeof spec; | ||
2366 | var isMixinValid = typeofSpec === 'object' && spec !== null; | ||
2367 | |||
2368 | 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; | ||
2369 | } | ||
2370 | |||
2371 | return; | ||
2372 | } | ||
2373 | |||
2374 | !(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; | ||
2375 | !!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; | ||
2376 | |||
2377 | var proto = Constructor.prototype; | ||
2378 | var autoBindPairs = proto.__reactAutoBindPairs; | ||
2379 | |||
2380 | // By handling mixins before any other properties, we ensure the same | ||
2381 | // chaining order is applied to methods with DEFINE_MANY policy, whether | ||
2382 | // mixins are listed before or after these methods in the spec. | ||
2383 | if (spec.hasOwnProperty(MIXINS_KEY)) { | ||
2384 | RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins); | ||
2385 | } | ||
2386 | |||
2387 | for (var name in spec) { | ||
2388 | if (!spec.hasOwnProperty(name)) { | ||
2389 | continue; | ||
2390 | } | ||
2391 | |||
2392 | if (name === MIXINS_KEY) { | ||
2393 | // We have already handled mixins in a special case above. | ||
2394 | continue; | ||
2395 | } | ||
2396 | |||
2397 | var property = spec[name]; | ||
2398 | var isAlreadyDefined = proto.hasOwnProperty(name); | ||
2399 | validateMethodOverride(isAlreadyDefined, name); | ||
2400 | |||
2401 | if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) { | ||
2402 | RESERVED_SPEC_KEYS[name](Constructor, property); | ||
1234 | } else { | 2403 | } else { |
1235 | dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>'; | 2404 | // Setup methods on prototype: |
2405 | // The following member methods should not be automatically bound: | ||
2406 | // 1. Expected ReactClass methods (in the "interface"). | ||
2407 | // 2. Overridden methods (that were mixed in). | ||
2408 | var isReactClassMethod = ReactClassInterface.hasOwnProperty(name); | ||
2409 | var isFunction = typeof property === 'function'; | ||
2410 | var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false; | ||
2411 | |||
2412 | if (shouldAutoBind) { | ||
2413 | autoBindPairs.push(name, property); | ||
2414 | proto[name] = property; | ||
2415 | } else { | ||
2416 | if (isAlreadyDefined) { | ||
2417 | var specPolicy = ReactClassInterface[name]; | ||
2418 | |||
2419 | // These cases should already be caught by validateMethodOverride. | ||
2420 | !(isReactClassMethod && (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === 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; | ||
2421 | |||
2422 | // For methods which are defined more than once, call the existing | ||
2423 | // methods before calling the new property, merging if appropriate. | ||
2424 | if (specPolicy === SpecPolicy.DEFINE_MANY_MERGED) { | ||
2425 | proto[name] = createMergedResultFunction(proto[name], property); | ||
2426 | } else if (specPolicy === SpecPolicy.DEFINE_MANY) { | ||
2427 | proto[name] = createChainedFunction(proto[name], property); | ||
2428 | } | ||
2429 | } else { | ||
2430 | proto[name] = property; | ||
2431 | if (process.env.NODE_ENV !== 'production') { | ||
2432 | // Add verbose displayName to the function, which helps when looking | ||
2433 | // at profiling tools. | ||
2434 | if (typeof property === 'function' && spec.displayName) { | ||
2435 | proto[name].displayName = spec.displayName + '_' + name; | ||
2436 | } | ||
2437 | } | ||
2438 | } | ||
2439 | } | ||
1236 | } | 2440 | } |
1237 | shouldWrap[nodeName] = !dummyNode.firstChild; | ||
1238 | } | 2441 | } |
1239 | return shouldWrap[nodeName] ? markupWrap[nodeName] : null; | ||
1240 | } | 2442 | } |
1241 | 2443 | ||
1242 | module.exports = getMarkupWrap; | 2444 | function mixStaticSpecIntoComponent(Constructor, statics) { |
1243 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | 2445 | if (!statics) { |
1244 | 2446 | return; | |
1245 | /***/ }, | 2447 | } |
1246 | /* 17 */ | 2448 | for (var name in statics) { |
1247 | /***/ function(module, exports) { | 2449 | var property = statics[name]; |
1248 | 2450 | if (!statics.hasOwnProperty(name)) { | |
2451 | continue; | ||
2452 | } | ||
2453 | |||
2454 | var isReserved = name in RESERVED_SPEC_KEYS; | ||
2455 | !!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; | ||
2456 | |||
2457 | var isInherited = name in Constructor; | ||
2458 | !!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; | ||
2459 | Constructor[name] = property; | ||
2460 | } | ||
2461 | } | ||
2462 | |||
1249 | /** | 2463 | /** |
1250 | * Copyright 2013-2015, Facebook, Inc. | 2464 | * Merge two objects, but throw if both contain the same key. |
1251 | * All rights reserved. | ||
1252 | * | ||
1253 | * This source code is licensed under the BSD-style license found in the | ||
1254 | * LICENSE file in the root directory of this source tree. An additional grant | ||
1255 | * of patent rights can be found in the PATENTS file in the same directory. | ||
1256 | * | 2465 | * |
1257 | * @providesModule emptyFunction | 2466 | * @param {object} one The first object, which is mutated. |
2467 | * @param {object} two The second object | ||
2468 | * @return {object} one after it has been mutated to contain everything in two. | ||
1258 | */ | 2469 | */ |
2470 | function mergeIntoWithNoDuplicateKeys(one, two) { | ||
2471 | !(one && two && typeof one === 'object' && typeof two === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : _prodInvariant('80') : void 0; | ||
1259 | 2472 | ||
1260 | "use strict"; | 2473 | for (var key in two) { |
2474 | if (two.hasOwnProperty(key)) { | ||
2475 | !(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; | ||
2476 | one[key] = two[key]; | ||
2477 | } | ||
2478 | } | ||
2479 | return one; | ||
2480 | } | ||
1261 | 2481 | ||
1262 | function makeEmptyFunction(arg) { | 2482 | /** |
1263 | return function () { | 2483 | * Creates a function that invokes two functions and merges their return values. |
1264 | return arg; | 2484 | * |
2485 | * @param {function} one Function to invoke first. | ||
2486 | * @param {function} two Function to invoke second. | ||
2487 | * @return {function} Function that invokes the two argument functions. | ||
2488 | * @private | ||
2489 | */ | ||
2490 | function createMergedResultFunction(one, two) { | ||
2491 | return function mergedResult() { | ||
2492 | var a = one.apply(this, arguments); | ||
2493 | var b = two.apply(this, arguments); | ||
2494 | if (a == null) { | ||
2495 | return b; | ||
2496 | } else if (b == null) { | ||
2497 | return a; | ||
2498 | } | ||
2499 | var c = {}; | ||
2500 | mergeIntoWithNoDuplicateKeys(c, a); | ||
2501 | mergeIntoWithNoDuplicateKeys(c, b); | ||
2502 | return c; | ||
1265 | }; | 2503 | }; |
1266 | } | 2504 | } |
1267 | 2505 | ||
1268 | /** | 2506 | /** |
1269 | * This function accepts and discards inputs; it has no side effects. This is | 2507 | * Creates a function that invokes two functions and ignores their return vales. |
1270 | * primarily useful idiomatically for overridable function endpoints which | 2508 | * |
1271 | * always need to be callable, since JS lacks a null-call idiom ala Cocoa. | 2509 | * @param {function} one Function to invoke first. |
2510 | * @param {function} two Function to invoke second. | ||
2511 | * @return {function} Function that invokes the two argument functions. | ||
2512 | * @private | ||
1272 | */ | 2513 | */ |
1273 | function emptyFunction() {} | 2514 | function createChainedFunction(one, two) { |
2515 | return function chainedFunction() { | ||
2516 | one.apply(this, arguments); | ||
2517 | two.apply(this, arguments); | ||
2518 | }; | ||
2519 | } | ||
1274 | 2520 | ||
1275 | emptyFunction.thatReturns = makeEmptyFunction; | 2521 | /** |
1276 | emptyFunction.thatReturnsFalse = makeEmptyFunction(false); | 2522 | * Binds a method to the component. |
1277 | emptyFunction.thatReturnsTrue = makeEmptyFunction(true); | 2523 | * |
1278 | emptyFunction.thatReturnsNull = makeEmptyFunction(null); | 2524 | * @param {object} component Component whose method is going to be bound. |
1279 | emptyFunction.thatReturnsThis = function () { | 2525 | * @param {function} method Method to be bound. |
1280 | return this; | 2526 | * @return {function} The bound method. |
2527 | */ | ||
2528 | function bindAutoBindMethod(component, method) { | ||
2529 | var boundMethod = method.bind(component); | ||
2530 | if (process.env.NODE_ENV !== 'production') { | ||
2531 | boundMethod.__reactBoundContext = component; | ||
2532 | boundMethod.__reactBoundMethod = method; | ||
2533 | boundMethod.__reactBoundArguments = null; | ||
2534 | var componentName = component.constructor.displayName; | ||
2535 | var _bind = boundMethod.bind; | ||
2536 | boundMethod.bind = function (newThis) { | ||
2537 | for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
2538 | args[_key - 1] = arguments[_key]; | ||
2539 | } | ||
2540 | |||
2541 | // User is trying to bind() an autobound method; we effectively will | ||
2542 | // ignore the value of "this" that the user is trying to use, so | ||
2543 | // let's warn. | ||
2544 | if (newThis !== component && newThis !== null) { | ||
2545 | process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : void 0; | ||
2546 | } else if (!args.length) { | ||
2547 | 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; | ||
2548 | return boundMethod; | ||
2549 | } | ||
2550 | var reboundMethod = _bind.apply(boundMethod, arguments); | ||
2551 | reboundMethod.__reactBoundContext = component; | ||
2552 | reboundMethod.__reactBoundMethod = method; | ||
2553 | reboundMethod.__reactBoundArguments = args; | ||
2554 | return reboundMethod; | ||
2555 | }; | ||
2556 | } | ||
2557 | return boundMethod; | ||
2558 | } | ||
2559 | |||
2560 | /** | ||
2561 | * Binds all auto-bound methods in a component. | ||
2562 | * | ||
2563 | * @param {object} component Component whose method is going to be bound. | ||
2564 | */ | ||
2565 | function bindAutoBindMethods(component) { | ||
2566 | var pairs = component.__reactAutoBindPairs; | ||
2567 | for (var i = 0; i < pairs.length; i += 2) { | ||
2568 | var autoBindKey = pairs[i]; | ||
2569 | var method = pairs[i + 1]; | ||
2570 | component[autoBindKey] = bindAutoBindMethod(component, method); | ||
2571 | } | ||
2572 | } | ||
2573 | |||
2574 | /** | ||
2575 | * Add more to the ReactClass base class. These are all legacy features and | ||
2576 | * therefore not already part of the modern ReactComponent. | ||
2577 | */ | ||
2578 | var ReactClassMixin = { | ||
2579 | |||
2580 | /** | ||
2581 | * TODO: This will be deprecated because state should always keep a consistent | ||
2582 | * type signature and the only use case for this, is to avoid that. | ||
2583 | */ | ||
2584 | replaceState: function (newState, callback) { | ||
2585 | this.updater.enqueueReplaceState(this, newState); | ||
2586 | if (callback) { | ||
2587 | this.updater.enqueueCallback(this, callback, 'replaceState'); | ||
2588 | } | ||
2589 | }, | ||
2590 | |||
2591 | /** | ||
2592 | * Checks whether or not this composite component is mounted. | ||
2593 | * @return {boolean} True if mounted, false otherwise. | ||
2594 | * @protected | ||
2595 | * @final | ||
2596 | */ | ||
2597 | isMounted: function () { | ||
2598 | return this.updater.isMounted(this); | ||
2599 | } | ||
1281 | }; | 2600 | }; |
1282 | emptyFunction.thatReturnsArgument = function (arg) { | 2601 | |
1283 | return arg; | 2602 | var ReactClassComponent = function () {}; |
2603 | _assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin); | ||
2604 | |||
2605 | /** | ||
2606 | * Module for creating composite components. | ||
2607 | * | ||
2608 | * @class ReactClass | ||
2609 | */ | ||
2610 | var ReactClass = { | ||
2611 | |||
2612 | /** | ||
2613 | * Creates a composite component class given a class specification. | ||
2614 | * See https://facebook.github.io/react/docs/top-level-api.html#react.createclass | ||
2615 | * | ||
2616 | * @param {object} spec Class specification (which must define `render`). | ||
2617 | * @return {function} Component constructor function. | ||
2618 | * @public | ||
2619 | */ | ||
2620 | createClass: function (spec) { | ||
2621 | var Constructor = function (props, context, updater) { | ||
2622 | // This constructor gets overridden by mocks. The argument is used | ||
2623 | // by mocks to assert on what gets mounted. | ||
2624 | |||
2625 | if (process.env.NODE_ENV !== 'production') { | ||
2626 | 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; | ||
2627 | } | ||
2628 | |||
2629 | // Wire up auto-binding | ||
2630 | if (this.__reactAutoBindPairs.length) { | ||
2631 | bindAutoBindMethods(this); | ||
2632 | } | ||
2633 | |||
2634 | this.props = props; | ||
2635 | this.context = context; | ||
2636 | this.refs = emptyObject; | ||
2637 | this.updater = updater || ReactNoopUpdateQueue; | ||
2638 | |||
2639 | this.state = null; | ||
2640 | |||
2641 | // ReactClasses doesn't have constructors. Instead, they use the | ||
2642 | // getInitialState and componentWillMount methods for initialization. | ||
2643 | |||
2644 | var initialState = this.getInitialState ? this.getInitialState() : null; | ||
2645 | if (process.env.NODE_ENV !== 'production') { | ||
2646 | // We allow auto-mocks to proceed as if they're returning null. | ||
2647 | if (initialState === undefined && this.getInitialState._isMockFunction) { | ||
2648 | // This is probably bad practice. Consider warning here and | ||
2649 | // deprecating this convenience. | ||
2650 | initialState = null; | ||
2651 | } | ||
2652 | } | ||
2653 | !(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; | ||
2654 | |||
2655 | this.state = initialState; | ||
2656 | }; | ||
2657 | Constructor.prototype = new ReactClassComponent(); | ||
2658 | Constructor.prototype.constructor = Constructor; | ||
2659 | Constructor.prototype.__reactAutoBindPairs = []; | ||
2660 | |||
2661 | injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor)); | ||
2662 | |||
2663 | mixSpecIntoComponent(Constructor, spec); | ||
2664 | |||
2665 | // Initialize the defaultProps property after all mixins have been merged. | ||
2666 | if (Constructor.getDefaultProps) { | ||
2667 | Constructor.defaultProps = Constructor.getDefaultProps(); | ||
2668 | } | ||
2669 | |||
2670 | if (process.env.NODE_ENV !== 'production') { | ||
2671 | // This is a tag to indicate that the use of these method names is ok, | ||
2672 | // since it's used with createClass. If it's not, then it's likely a | ||
2673 | // mistake so we'll warn you to use the static property, property | ||
2674 | // initializer or constructor respectively. | ||
2675 | if (Constructor.getDefaultProps) { | ||
2676 | Constructor.getDefaultProps.isReactClassApproved = {}; | ||
2677 | } | ||
2678 | if (Constructor.prototype.getInitialState) { | ||
2679 | Constructor.prototype.getInitialState.isReactClassApproved = {}; | ||
2680 | } | ||
2681 | } | ||
2682 | |||
2683 | !Constructor.prototype.render ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : _prodInvariant('83') : void 0; | ||
2684 | |||
2685 | if (process.env.NODE_ENV !== 'production') { | ||
2686 | 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; | ||
2687 | 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; | ||
2688 | } | ||
2689 | |||
2690 | // Reduce time spent doing lookups by setting these on the prototype. | ||
2691 | for (var methodName in ReactClassInterface) { | ||
2692 | if (!Constructor.prototype[methodName]) { | ||
2693 | Constructor.prototype[methodName] = null; | ||
2694 | } | ||
2695 | } | ||
2696 | |||
2697 | return Constructor; | ||
2698 | }, | ||
2699 | |||
2700 | injection: { | ||
2701 | injectMixin: function (mixin) { | ||
2702 | injectedMixins.push(mixin); | ||
2703 | } | ||
2704 | } | ||
2705 | |||
1284 | }; | 2706 | }; |
1285 | 2707 | ||
1286 | module.exports = emptyFunction; | 2708 | module.exports = ReactClass; |
2709 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
1287 | 2710 | ||
1288 | /***/ }, | 2711 | /***/ }, |
1289 | /* 18 */ | 2712 | /* 24 */ |
1290 | /***/ function(module, exports, __webpack_require__) { | 2713 | /***/ function(module, exports, __webpack_require__) { |
1291 | 2714 | ||
1292 | /** | 2715 | /** |
1293 | * Copyright 2013-2015, Facebook, Inc. | 2716 | * Copyright 2013-present, Facebook, Inc. |
1294 | * All rights reserved. | 2717 | * All rights reserved. |
1295 | * | 2718 | * |
1296 | * This source code is licensed under the BSD-style license found in the | 2719 | * This source code is licensed under the BSD-style license found in the |
1297 | * LICENSE file in the root directory of this source tree. An additional grant | 2720 | * LICENSE file in the root directory of this source tree. An additional grant |
1298 | * of patent rights can be found in the PATENTS file in the same directory. | 2721 | * of patent rights can be found in the PATENTS file in the same directory. |
1299 | * | 2722 | * |
1300 | * @providesModule ReactMultiChildUpdateTypes | 2723 | * @providesModule ReactPropTypeLocations |
1301 | */ | 2724 | */ |
1302 | 2725 | ||
1303 | 'use strict'; | 2726 | 'use strict'; |
1304 | 2727 | ||
1305 | var keyMirror = __webpack_require__(19); | 2728 | var keyMirror = __webpack_require__(25); |
1306 | 2729 | ||
1307 | /** | 2730 | var ReactPropTypeLocations = keyMirror({ |
1308 | * When a component's children are updated, a series of update configuration | 2731 | prop: null, |
1309 | * objects are created in order to batch and serialize the required changes. | 2732 | context: null, |
1310 | * | 2733 | childContext: null |
1311 | * Enumerates all the possible types of update configurations. | ||
1312 | * | ||
1313 | * @internal | ||
1314 | */ | ||
1315 | var ReactMultiChildUpdateTypes = keyMirror({ | ||
1316 | INSERT_MARKUP: null, | ||
1317 | MOVE_EXISTING: null, | ||
1318 | REMOVE_NODE: null, | ||
1319 | SET_MARKUP: null, | ||
1320 | TEXT_CONTENT: null | ||
1321 | }); | 2734 | }); |
1322 | 2735 | ||
1323 | module.exports = ReactMultiChildUpdateTypes; | 2736 | module.exports = ReactPropTypeLocations; |
1324 | 2737 | ||
1325 | /***/ }, | 2738 | /***/ }, |
1326 | /* 19 */ | 2739 | /* 25 */ |
1327 | /***/ function(module, exports, __webpack_require__) { | 2740 | /***/ function(module, exports, __webpack_require__) { |
1328 | 2741 | ||
1329 | /* WEBPACK VAR INJECTION */(function(process) {/** | 2742 | /* WEBPACK VAR INJECTION */(function(process) {/** |
1330 | * Copyright 2013-2015, Facebook, Inc. | 2743 | * Copyright (c) 2013-present, Facebook, Inc. |
1331 | * All rights reserved. | 2744 | * All rights reserved. |
1332 | * | 2745 | * |
1333 | * This source code is licensed under the BSD-style license found in the | 2746 | * This source code is licensed under the BSD-style license found in the |
1334 | * LICENSE file in the root directory of this source tree. An additional grant | 2747 | * LICENSE file in the root directory of this source tree. An additional grant |
1335 | * of patent rights can be found in the PATENTS file in the same directory. | 2748 | * of patent rights can be found in the PATENTS file in the same directory. |
1336 | * | 2749 | * |
1337 | * @providesModule keyMirror | ||
1338 | * @typechecks static-only | 2750 | * @typechecks static-only |
1339 | */ | 2751 | */ |
1340 | 2752 | ||
1341 | 'use strict'; | 2753 | 'use strict'; |
1342 | 2754 | ||
1343 | var invariant = __webpack_require__(15); | 2755 | var invariant = __webpack_require__(10); |
1344 | 2756 | ||
1345 | /** | 2757 | /** |
1346 | * Constructs an enumeration with keys equal to their value. | 2758 | * Constructs an enumeration with keys equal to their value. |
@@ -1360,10 +2772,10 @@ | |||
1360 | * @param {object} obj | 2772 | * @param {object} obj |
1361 | * @return {object} | 2773 | * @return {object} |
1362 | */ | 2774 | */ |
1363 | var keyMirror = function (obj) { | 2775 | var keyMirror = function keyMirror(obj) { |
1364 | var ret = {}; | 2776 | var ret = {}; |
1365 | var key; | 2777 | var key; |
1366 | !(obj instanceof Object && !Array.isArray(obj)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'keyMirror(...): Argument must be an object.') : invariant(false) : undefined; | 2778 | !(obj instanceof Object && !Array.isArray(obj)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'keyMirror(...): Argument must be an object.') : invariant(false) : void 0; |
1367 | for (key in obj) { | 2779 | for (key in obj) { |
1368 | if (!obj.hasOwnProperty(key)) { | 2780 | if (!obj.hasOwnProperty(key)) { |
1369 | continue; | 2781 | continue; |
@@ -1374,530 +2786,1686 @@ | |||
1374 | }; | 2786 | }; |
1375 | 2787 | ||
1376 | module.exports = keyMirror; | 2788 | module.exports = keyMirror; |
1377 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | 2789 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) |
1378 | 2790 | ||
1379 | /***/ }, | 2791 | /***/ }, |
1380 | /* 20 */ | 2792 | /* 26 */ |
1381 | /***/ function(module, exports, __webpack_require__) { | 2793 | /***/ function(module, exports, __webpack_require__) { |
1382 | 2794 | ||
1383 | /* WEBPACK VAR INJECTION */(function(process) {/** | 2795 | /* WEBPACK VAR INJECTION */(function(process) {/** |
1384 | * Copyright 2013-2015, Facebook, Inc. | 2796 | * Copyright 2013-present, Facebook, Inc. |
1385 | * All rights reserved. | 2797 | * All rights reserved. |
1386 | * | 2798 | * |
1387 | * This source code is licensed under the BSD-style license found in the | 2799 | * This source code is licensed under the BSD-style license found in the |
1388 | * LICENSE file in the root directory of this source tree. An additional grant | 2800 | * LICENSE file in the root directory of this source tree. An additional grant |
1389 | * of patent rights can be found in the PATENTS file in the same directory. | 2801 | * of patent rights can be found in the PATENTS file in the same directory. |
1390 | * | 2802 | * |
1391 | * @providesModule ReactPerf | 2803 | * @providesModule ReactPropTypeLocationNames |
1392 | * @typechecks static-only | ||
1393 | */ | 2804 | */ |
1394 | 2805 | ||
1395 | 'use strict'; | 2806 | 'use strict'; |
1396 | 2807 | ||
2808 | var ReactPropTypeLocationNames = {}; | ||
2809 | |||
2810 | if (process.env.NODE_ENV !== 'production') { | ||
2811 | ReactPropTypeLocationNames = { | ||
2812 | prop: 'prop', | ||
2813 | context: 'context', | ||
2814 | childContext: 'child context' | ||
2815 | }; | ||
2816 | } | ||
2817 | |||
2818 | module.exports = ReactPropTypeLocationNames; | ||
2819 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
2820 | |||
2821 | /***/ }, | ||
2822 | /* 27 */ | ||
2823 | /***/ function(module, exports) { | ||
2824 | |||
2825 | "use strict"; | ||
2826 | |||
1397 | /** | 2827 | /** |
1398 | * ReactPerf is a general AOP system designed to measure performance. This | 2828 | * Copyright (c) 2013-present, Facebook, Inc. |
1399 | * module only has the hooks: see ReactDefaultPerf for the analysis tool. | 2829 | * All rights reserved. |
2830 | * | ||
2831 | * This source code is licensed under the BSD-style license found in the | ||
2832 | * LICENSE file in the root directory of this source tree. An additional grant | ||
2833 | * of patent rights can be found in the PATENTS file in the same directory. | ||
2834 | * | ||
1400 | */ | 2835 | */ |
1401 | var ReactPerf = { | ||
1402 | /** | ||
1403 | * Boolean to enable/disable measurement. Set to false by default to prevent | ||
1404 | * accidental logging and perf loss. | ||
1405 | */ | ||
1406 | enableMeasure: false, | ||
1407 | 2836 | ||
1408 | /** | 2837 | /** |
1409 | * Holds onto the measure function in use. By default, don't measure | 2838 | * Allows extraction of a minified key. Let's the build system minify keys |
1410 | * anything, but we'll override this if we inject a measure function. | 2839 | * without losing the ability to dynamically use key strings as values |
1411 | */ | 2840 | * themselves. Pass in an object with a single key/val pair and it will return |
1412 | storedMeasure: _noMeasure, | 2841 | * you the string key of that single record. Suppose you want to grab the |
2842 | * value for a key 'className' inside of an object. Key/val minification may | ||
2843 | * have aliased that key to be 'xa12'. keyOf({className: null}) will return | ||
2844 | * 'xa12' in that case. Resolve keys you want to use once at startup time, then | ||
2845 | * reuse those resolutions. | ||
2846 | */ | ||
2847 | var keyOf = function keyOf(oneKeyObj) { | ||
2848 | var key; | ||
2849 | for (key in oneKeyObj) { | ||
2850 | if (!oneKeyObj.hasOwnProperty(key)) { | ||
2851 | continue; | ||
2852 | } | ||
2853 | return key; | ||
2854 | } | ||
2855 | return null; | ||
2856 | }; | ||
1413 | 2857 | ||
1414 | /** | 2858 | module.exports = keyOf; |
1415 | * @param {object} object | 2859 | |
1416 | * @param {string} objectName | 2860 | /***/ }, |
1417 | * @param {object<string>} methodNames | 2861 | /* 28 */ |
1418 | */ | 2862 | /***/ function(module, exports, __webpack_require__) { |
1419 | measureMethods: function (object, objectName, methodNames) { | 2863 | |
1420 | if (process.env.NODE_ENV !== 'production') { | 2864 | /* WEBPACK VAR INJECTION */(function(process) {/** |
1421 | for (var key in methodNames) { | 2865 | * Copyright 2013-present, Facebook, Inc. |
1422 | if (!methodNames.hasOwnProperty(key)) { | 2866 | * All rights reserved. |
1423 | continue; | 2867 | * |
2868 | * This source code is licensed under the BSD-style license found in the | ||
2869 | * LICENSE file in the root directory of this source tree. An additional grant | ||
2870 | * of patent rights can be found in the PATENTS file in the same directory. | ||
2871 | * | ||
2872 | * @providesModule ReactDOMFactories | ||
2873 | */ | ||
2874 | |||
2875 | 'use strict'; | ||
2876 | |||
2877 | var ReactElement = __webpack_require__(11); | ||
2878 | |||
2879 | var mapObject = __webpack_require__(29); | ||
2880 | |||
2881 | /** | ||
2882 | * Create a factory that creates HTML tag elements. | ||
2883 | * | ||
2884 | * @param {string} tag Tag name (e.g. `div`). | ||
2885 | * @private | ||
2886 | */ | ||
2887 | function createDOMFactory(tag) { | ||
2888 | if (process.env.NODE_ENV !== 'production') { | ||
2889 | var ReactElementValidator = __webpack_require__(30); | ||
2890 | return ReactElementValidator.createFactory(tag); | ||
2891 | } | ||
2892 | return ReactElement.createFactory(tag); | ||
2893 | } | ||
2894 | |||
2895 | /** | ||
2896 | * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes. | ||
2897 | * This is also accessible via `React.DOM`. | ||
2898 | * | ||
2899 | * @public | ||
2900 | */ | ||
2901 | var ReactDOMFactories = mapObject({ | ||
2902 | a: 'a', | ||
2903 | abbr: 'abbr', | ||
2904 | address: 'address', | ||
2905 | area: 'area', | ||
2906 | article: 'article', | ||
2907 | aside: 'aside', | ||
2908 | audio: 'audio', | ||
2909 | b: 'b', | ||
2910 | base: 'base', | ||
2911 | bdi: 'bdi', | ||
2912 | bdo: 'bdo', | ||
2913 | big: 'big', | ||
2914 | blockquote: 'blockquote', | ||
2915 | body: 'body', | ||
2916 | br: 'br', | ||
2917 | button: 'button', | ||
2918 | canvas: 'canvas', | ||
2919 | caption: 'caption', | ||
2920 | cite: 'cite', | ||
2921 | code: 'code', | ||
2922 | col: 'col', | ||
2923 | colgroup: 'colgroup', | ||
2924 | data: 'data', | ||
2925 | datalist: 'datalist', | ||
2926 | dd: 'dd', | ||
2927 | del: 'del', | ||
2928 | details: 'details', | ||
2929 | dfn: 'dfn', | ||
2930 | dialog: 'dialog', | ||
2931 | div: 'div', | ||
2932 | dl: 'dl', | ||
2933 | dt: 'dt', | ||
2934 | em: 'em', | ||
2935 | embed: 'embed', | ||
2936 | fieldset: 'fieldset', | ||
2937 | figcaption: 'figcaption', | ||
2938 | figure: 'figure', | ||
2939 | footer: 'footer', | ||
2940 | form: 'form', | ||
2941 | h1: 'h1', | ||
2942 | h2: 'h2', | ||
2943 | h3: 'h3', | ||
2944 | h4: 'h4', | ||
2945 | h5: 'h5', | ||
2946 | h6: 'h6', | ||
2947 | head: 'head', | ||
2948 | header: 'header', | ||
2949 | hgroup: 'hgroup', | ||
2950 | hr: 'hr', | ||
2951 | html: 'html', | ||
2952 | i: 'i', | ||
2953 | iframe: 'iframe', | ||
2954 | img: 'img', | ||
2955 | input: 'input', | ||
2956 | ins: 'ins', | ||
2957 | kbd: 'kbd', | ||
2958 | keygen: 'keygen', | ||
2959 | label: 'label', | ||
2960 | legend: 'legend', | ||
2961 | li: 'li', | ||
2962 | link: 'link', | ||
2963 | main: 'main', | ||
2964 | map: 'map', | ||
2965 | mark: 'mark', | ||
2966 | menu: 'menu', | ||
2967 | menuitem: 'menuitem', | ||
2968 | meta: 'meta', | ||
2969 | meter: 'meter', | ||
2970 | nav: 'nav', | ||
2971 | noscript: 'noscript', | ||
2972 | object: 'object', | ||
2973 | ol: 'ol', | ||
2974 | optgroup: 'optgroup', | ||
2975 | option: 'option', | ||
2976 | output: 'output', | ||
2977 | p: 'p', | ||
2978 | param: 'param', | ||
2979 | picture: 'picture', | ||
2980 | pre: 'pre', | ||
2981 | progress: 'progress', | ||
2982 | q: 'q', | ||
2983 | rp: 'rp', | ||
2984 | rt: 'rt', | ||
2985 | ruby: 'ruby', | ||
2986 | s: 's', | ||
2987 | samp: 'samp', | ||
2988 | script: 'script', | ||
2989 | section: 'section', | ||
2990 | select: 'select', | ||
2991 | small: 'small', | ||
2992 | source: 'source', | ||
2993 | span: 'span', | ||
2994 | strong: 'strong', | ||
2995 | style: 'style', | ||
2996 | sub: 'sub', | ||
2997 | summary: 'summary', | ||
2998 | sup: 'sup', | ||
2999 | table: 'table', | ||
3000 | tbody: 'tbody', | ||
3001 | td: 'td', | ||
3002 | textarea: 'textarea', | ||
3003 | tfoot: 'tfoot', | ||
3004 | th: 'th', | ||
3005 | thead: 'thead', | ||
3006 | time: 'time', | ||
3007 | title: 'title', | ||
3008 | tr: 'tr', | ||
3009 | track: 'track', | ||
3010 | u: 'u', | ||
3011 | ul: 'ul', | ||
3012 | 'var': 'var', | ||
3013 | video: 'video', | ||
3014 | wbr: 'wbr', | ||
3015 | |||
3016 | // SVG | ||
3017 | circle: 'circle', | ||
3018 | clipPath: 'clipPath', | ||
3019 | defs: 'defs', | ||
3020 | ellipse: 'ellipse', | ||
3021 | g: 'g', | ||
3022 | image: 'image', | ||
3023 | line: 'line', | ||
3024 | linearGradient: 'linearGradient', | ||
3025 | mask: 'mask', | ||
3026 | path: 'path', | ||
3027 | pattern: 'pattern', | ||
3028 | polygon: 'polygon', | ||
3029 | polyline: 'polyline', | ||
3030 | radialGradient: 'radialGradient', | ||
3031 | rect: 'rect', | ||
3032 | stop: 'stop', | ||
3033 | svg: 'svg', | ||
3034 | text: 'text', | ||
3035 | tspan: 'tspan' | ||
3036 | |||
3037 | }, createDOMFactory); | ||
3038 | |||
3039 | module.exports = ReactDOMFactories; | ||
3040 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
3041 | |||
3042 | /***/ }, | ||
3043 | /* 29 */ | ||
3044 | /***/ function(module, exports) { | ||
3045 | |||
3046 | /** | ||
3047 | * Copyright (c) 2013-present, Facebook, Inc. | ||
3048 | * All rights reserved. | ||
3049 | * | ||
3050 | * This source code is licensed under the BSD-style license found in the | ||
3051 | * LICENSE file in the root directory of this source tree. An additional grant | ||
3052 | * of patent rights can be found in the PATENTS file in the same directory. | ||
3053 | * | ||
3054 | */ | ||
3055 | |||
3056 | 'use strict'; | ||
3057 | |||
3058 | var hasOwnProperty = Object.prototype.hasOwnProperty; | ||
3059 | |||
3060 | /** | ||
3061 | * Executes the provided `callback` once for each enumerable own property in the | ||
3062 | * object and constructs a new object from the results. The `callback` is | ||
3063 | * invoked with three arguments: | ||
3064 | * | ||
3065 | * - the property value | ||
3066 | * - the property name | ||
3067 | * - the object being traversed | ||
3068 | * | ||
3069 | * Properties that are added after the call to `mapObject` will not be visited | ||
3070 | * by `callback`. If the values of existing properties are changed, the value | ||
3071 | * passed to `callback` will be the value at the time `mapObject` visits them. | ||
3072 | * Properties that are deleted before being visited are not visited. | ||
3073 | * | ||
3074 | * @grep function objectMap() | ||
3075 | * @grep function objMap() | ||
3076 | * | ||
3077 | * @param {?object} object | ||
3078 | * @param {function} callback | ||
3079 | * @param {*} context | ||
3080 | * @return {?object} | ||
3081 | */ | ||
3082 | function mapObject(object, callback, context) { | ||
3083 | if (!object) { | ||
3084 | return null; | ||
3085 | } | ||
3086 | var result = {}; | ||
3087 | for (var name in object) { | ||
3088 | if (hasOwnProperty.call(object, name)) { | ||
3089 | result[name] = callback.call(context, object[name], name, object); | ||
3090 | } | ||
3091 | } | ||
3092 | return result; | ||
3093 | } | ||
3094 | |||
3095 | module.exports = mapObject; | ||
3096 | |||
3097 | /***/ }, | ||
3098 | /* 30 */ | ||
3099 | /***/ function(module, exports, __webpack_require__) { | ||
3100 | |||
3101 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
3102 | * Copyright 2014-present, Facebook, Inc. | ||
3103 | * All rights reserved. | ||
3104 | * | ||
3105 | * This source code is licensed under the BSD-style license found in the | ||
3106 | * LICENSE file in the root directory of this source tree. An additional grant | ||
3107 | * of patent rights can be found in the PATENTS file in the same directory. | ||
3108 | * | ||
3109 | * @providesModule ReactElementValidator | ||
3110 | */ | ||
3111 | |||
3112 | /** | ||
3113 | * ReactElementValidator provides a wrapper around a element factory | ||
3114 | * which validates the props passed to the element. This is intended to be | ||
3115 | * used only in DEV and could be replaced by a static type checker for languages | ||
3116 | * that support it. | ||
3117 | */ | ||
3118 | |||
3119 | 'use strict'; | ||
3120 | |||
3121 | var ReactCurrentOwner = __webpack_require__(12); | ||
3122 | var ReactComponentTreeDevtool = __webpack_require__(31); | ||
3123 | var ReactElement = __webpack_require__(11); | ||
3124 | var ReactPropTypeLocations = __webpack_require__(24); | ||
3125 | |||
3126 | var checkReactTypeSpec = __webpack_require__(32); | ||
3127 | |||
3128 | var canDefineProperty = __webpack_require__(15); | ||
3129 | var getIteratorFn = __webpack_require__(17); | ||
3130 | var warning = __webpack_require__(13); | ||
3131 | |||
3132 | function getDeclarationErrorAddendum() { | ||
3133 | if (ReactCurrentOwner.current) { | ||
3134 | var name = ReactCurrentOwner.current.getName(); | ||
3135 | if (name) { | ||
3136 | return ' Check the render method of `' + name + '`.'; | ||
3137 | } | ||
3138 | } | ||
3139 | return ''; | ||
3140 | } | ||
3141 | |||
3142 | /** | ||
3143 | * Warn if there's no key explicitly set on dynamic arrays of children or | ||
3144 | * object keys are not valid. This allows us to keep track of children between | ||
3145 | * updates. | ||
3146 | */ | ||
3147 | var ownerHasKeyUseWarning = {}; | ||
3148 | |||
3149 | function getCurrentComponentErrorInfo(parentType) { | ||
3150 | var info = getDeclarationErrorAddendum(); | ||
3151 | |||
3152 | if (!info) { | ||
3153 | var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name; | ||
3154 | if (parentName) { | ||
3155 | info = ' Check the top-level render call using <' + parentName + '>.'; | ||
3156 | } | ||
3157 | } | ||
3158 | return info; | ||
3159 | } | ||
3160 | |||
3161 | /** | ||
3162 | * Warn if the element doesn't have an explicit key assigned to it. | ||
3163 | * This element is in an array. The array could grow and shrink or be | ||
3164 | * reordered. All children that haven't already been validated are required to | ||
3165 | * have a "key" property assigned to it. Error statuses are cached so a warning | ||
3166 | * will only be shown once. | ||
3167 | * | ||
3168 | * @internal | ||
3169 | * @param {ReactElement} element Element that requires a key. | ||
3170 | * @param {*} parentType element's parent's type. | ||
3171 | */ | ||
3172 | function validateExplicitKey(element, parentType) { | ||
3173 | if (!element._store || element._store.validated || element.key != null) { | ||
3174 | return; | ||
3175 | } | ||
3176 | element._store.validated = true; | ||
3177 | |||
3178 | var memoizer = ownerHasKeyUseWarning.uniqueKey || (ownerHasKeyUseWarning.uniqueKey = {}); | ||
3179 | |||
3180 | var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType); | ||
3181 | if (memoizer[currentComponentErrorInfo]) { | ||
3182 | return; | ||
3183 | } | ||
3184 | memoizer[currentComponentErrorInfo] = true; | ||
3185 | |||
3186 | // Usually the current owner is the offender, but if it accepts children as a | ||
3187 | // property, it may be the creator of the child that's responsible for | ||
3188 | // assigning it a key. | ||
3189 | var childOwner = ''; | ||
3190 | if (element && element._owner && element._owner !== ReactCurrentOwner.current) { | ||
3191 | // Give the component that originally created this child. | ||
3192 | childOwner = ' It was passed a child from ' + element._owner.getName() + '.'; | ||
3193 | } | ||
3194 | |||
3195 | 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, ReactComponentTreeDevtool.getCurrentStackAddendum(element)) : void 0; | ||
3196 | } | ||
3197 | |||
3198 | /** | ||
3199 | * Ensure that every element either is passed in a static location, in an | ||
3200 | * array with an explicit keys property defined, or in an object literal | ||
3201 | * with valid key property. | ||
3202 | * | ||
3203 | * @internal | ||
3204 | * @param {ReactNode} node Statically passed child of any type. | ||
3205 | * @param {*} parentType node's parent's type. | ||
3206 | */ | ||
3207 | function validateChildKeys(node, parentType) { | ||
3208 | if (typeof node !== 'object') { | ||
3209 | return; | ||
3210 | } | ||
3211 | if (Array.isArray(node)) { | ||
3212 | for (var i = 0; i < node.length; i++) { | ||
3213 | var child = node[i]; | ||
3214 | if (ReactElement.isValidElement(child)) { | ||
3215 | validateExplicitKey(child, parentType); | ||
3216 | } | ||
3217 | } | ||
3218 | } else if (ReactElement.isValidElement(node)) { | ||
3219 | // This element was passed in a valid location. | ||
3220 | if (node._store) { | ||
3221 | node._store.validated = true; | ||
3222 | } | ||
3223 | } else if (node) { | ||
3224 | var iteratorFn = getIteratorFn(node); | ||
3225 | // Entry iterators provide implicit keys. | ||
3226 | if (iteratorFn) { | ||
3227 | if (iteratorFn !== node.entries) { | ||
3228 | var iterator = iteratorFn.call(node); | ||
3229 | var step; | ||
3230 | while (!(step = iterator.next()).done) { | ||
3231 | if (ReactElement.isValidElement(step.value)) { | ||
3232 | validateExplicitKey(step.value, parentType); | ||
3233 | } | ||
1424 | } | 3234 | } |
1425 | object[key] = ReactPerf.measure(objectName, methodNames[key], object[key]); | ||
1426 | } | 3235 | } |
1427 | } | 3236 | } |
3237 | } | ||
3238 | } | ||
3239 | |||
3240 | /** | ||
3241 | * Given an element, validate that its props follow the propTypes definition, | ||
3242 | * provided by the type. | ||
3243 | * | ||
3244 | * @param {ReactElement} element | ||
3245 | */ | ||
3246 | function validatePropTypes(element) { | ||
3247 | var componentClass = element.type; | ||
3248 | if (typeof componentClass !== 'function') { | ||
3249 | return; | ||
3250 | } | ||
3251 | var name = componentClass.displayName || componentClass.name; | ||
3252 | if (componentClass.propTypes) { | ||
3253 | checkReactTypeSpec(componentClass.propTypes, element.props, ReactPropTypeLocations.prop, name, element, null); | ||
3254 | } | ||
3255 | if (typeof componentClass.getDefaultProps === 'function') { | ||
3256 | 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; | ||
3257 | } | ||
3258 | } | ||
3259 | |||
3260 | var ReactElementValidator = { | ||
3261 | |||
3262 | createElement: function (type, props, children) { | ||
3263 | var validType = typeof type === 'string' || typeof type === 'function'; | ||
3264 | // We warn in this case but don't throw. We expect the element creation to | ||
3265 | // succeed and there will likely be errors in render. | ||
3266 | process.env.NODE_ENV !== 'production' ? warning(validType, 'React.createElement: type should not be null, undefined, boolean, or ' + 'number. It should be a string (for DOM elements) or a ReactClass ' + '(for composite components).%s', getDeclarationErrorAddendum()) : void 0; | ||
3267 | |||
3268 | var element = ReactElement.createElement.apply(this, arguments); | ||
3269 | |||
3270 | // The result can be nullish if a mock or a custom function is used. | ||
3271 | // TODO: Drop this when these are no longer allowed as the type argument. | ||
3272 | if (element == null) { | ||
3273 | return element; | ||
3274 | } | ||
3275 | |||
3276 | // Skip key warning if the type isn't valid since our key validation logic | ||
3277 | // doesn't expect a non-string/function type and can throw confusing errors. | ||
3278 | // We don't want exception behavior to differ between dev and prod. | ||
3279 | // (Rendering will throw with a helpful message and as soon as the type is | ||
3280 | // fixed, the key warnings will appear.) | ||
3281 | if (validType) { | ||
3282 | for (var i = 2; i < arguments.length; i++) { | ||
3283 | validateChildKeys(arguments[i], type); | ||
3284 | } | ||
3285 | } | ||
3286 | |||
3287 | validatePropTypes(element); | ||
3288 | |||
3289 | return element; | ||
1428 | }, | 3290 | }, |
1429 | 3291 | ||
1430 | /** | 3292 | createFactory: function (type) { |
1431 | * Use this to wrap methods you want to measure. Zero overhead in production. | 3293 | var validatedFactory = ReactElementValidator.createElement.bind(null, type); |
1432 | * | 3294 | // Legacy hook TODO: Warn if this is accessed |
1433 | * @param {string} objName | 3295 | validatedFactory.type = type; |
1434 | * @param {string} fnName | 3296 | |
1435 | * @param {function} func | ||
1436 | * @return {function} | ||
1437 | */ | ||
1438 | measure: function (objName, fnName, func) { | ||
1439 | if (process.env.NODE_ENV !== 'production') { | 3297 | if (process.env.NODE_ENV !== 'production') { |
1440 | var measuredFunc = null; | 3298 | if (canDefineProperty) { |
1441 | var wrapper = function () { | 3299 | Object.defineProperty(validatedFactory, 'type', { |
1442 | if (ReactPerf.enableMeasure) { | 3300 | enumerable: false, |
1443 | if (!measuredFunc) { | 3301 | get: function () { |
1444 | measuredFunc = ReactPerf.storedMeasure(objName, fnName, func); | 3302 | process.env.NODE_ENV !== 'production' ? warning(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.') : void 0; |
3303 | Object.defineProperty(this, 'type', { | ||
3304 | value: type | ||
3305 | }); | ||
3306 | return type; | ||
1445 | } | 3307 | } |
1446 | return measuredFunc.apply(this, arguments); | 3308 | }); |
1447 | } | 3309 | } |
1448 | return func.apply(this, arguments); | ||
1449 | }; | ||
1450 | wrapper.displayName = objName + '_' + fnName; | ||
1451 | return wrapper; | ||
1452 | } | 3310 | } |
1453 | return func; | 3311 | |
3312 | return validatedFactory; | ||
1454 | }, | 3313 | }, |
1455 | 3314 | ||
1456 | injection: { | 3315 | cloneElement: function (element, props, children) { |
1457 | /** | 3316 | var newElement = ReactElement.cloneElement.apply(this, arguments); |
1458 | * @param {function} measure | 3317 | for (var i = 2; i < arguments.length; i++) { |
1459 | */ | 3318 | validateChildKeys(arguments[i], newElement.type); |
1460 | injectMeasure: function (measure) { | ||
1461 | ReactPerf.storedMeasure = measure; | ||
1462 | } | 3319 | } |
3320 | validatePropTypes(newElement); | ||
3321 | return newElement; | ||
1463 | } | 3322 | } |
3323 | |||
1464 | }; | 3324 | }; |
1465 | 3325 | ||
1466 | /** | 3326 | module.exports = ReactElementValidator; |
1467 | * Simply passes through the measured function, without measuring it. | 3327 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) |
3328 | |||
3329 | /***/ }, | ||
3330 | /* 31 */ | ||
3331 | /***/ function(module, exports, __webpack_require__) { | ||
3332 | |||
3333 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
3334 | * Copyright 2016-present, Facebook, Inc. | ||
3335 | * All rights reserved. | ||
1468 | * | 3336 | * |
1469 | * @param {string} objName | 3337 | * This source code is licensed under the BSD-style license found in the |
1470 | * @param {string} fnName | 3338 | * LICENSE file in the root directory of this source tree. An additional grant |
1471 | * @param {function} func | 3339 | * of patent rights can be found in the PATENTS file in the same directory. |
1472 | * @return {function} | 3340 | * |
3341 | * @providesModule ReactComponentTreeDevtool | ||
1473 | */ | 3342 | */ |
1474 | function _noMeasure(objName, fnName, func) { | 3343 | |
1475 | return func; | 3344 | 'use strict'; |
3345 | |||
3346 | var _prodInvariant = __webpack_require__(9); | ||
3347 | |||
3348 | var ReactCurrentOwner = __webpack_require__(12); | ||
3349 | |||
3350 | var invariant = __webpack_require__(10); | ||
3351 | var warning = __webpack_require__(13); | ||
3352 | |||
3353 | var tree = {}; | ||
3354 | var unmountedIDs = {}; | ||
3355 | var rootIDs = {}; | ||
3356 | |||
3357 | function updateTree(id, update) { | ||
3358 | if (!tree[id]) { | ||
3359 | tree[id] = { | ||
3360 | element: null, | ||
3361 | parentID: null, | ||
3362 | ownerID: null, | ||
3363 | text: null, | ||
3364 | childIDs: [], | ||
3365 | displayName: 'Unknown', | ||
3366 | isMounted: false, | ||
3367 | updateCount: 0 | ||
3368 | }; | ||
3369 | } | ||
3370 | update(tree[id]); | ||
3371 | } | ||
3372 | |||
3373 | function purgeDeep(id) { | ||
3374 | var item = tree[id]; | ||
3375 | if (item) { | ||
3376 | var childIDs = item.childIDs; | ||
3377 | |||
3378 | delete tree[id]; | ||
3379 | childIDs.forEach(purgeDeep); | ||
3380 | } | ||
3381 | } | ||
3382 | |||
3383 | function describeComponentFrame(name, source, ownerName) { | ||
3384 | return '\n in ' + name + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : ''); | ||
1476 | } | 3385 | } |
1477 | 3386 | ||
1478 | module.exports = ReactPerf; | 3387 | function describeID(id) { |
1479 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | 3388 | var name = ReactComponentTreeDevtool.getDisplayName(id); |
3389 | var element = ReactComponentTreeDevtool.getElement(id); | ||
3390 | var ownerID = ReactComponentTreeDevtool.getOwnerID(id); | ||
3391 | var ownerName; | ||
3392 | if (ownerID) { | ||
3393 | ownerName = ReactComponentTreeDevtool.getDisplayName(ownerID); | ||
3394 | } | ||
3395 | process.env.NODE_ENV !== 'production' ? warning(element, 'ReactComponentTreeDevtool: Missing React element for debugID %s when ' + 'building stack', id) : void 0; | ||
3396 | return describeComponentFrame(name, element && element._source, ownerName); | ||
3397 | } | ||
3398 | |||
3399 | var ReactComponentTreeDevtool = { | ||
3400 | onSetDisplayName: function (id, displayName) { | ||
3401 | updateTree(id, function (item) { | ||
3402 | return item.displayName = displayName; | ||
3403 | }); | ||
3404 | }, | ||
3405 | onSetChildren: function (id, nextChildIDs) { | ||
3406 | updateTree(id, function (item) { | ||
3407 | item.childIDs = nextChildIDs; | ||
3408 | |||
3409 | nextChildIDs.forEach(function (nextChildID) { | ||
3410 | var nextChild = tree[nextChildID]; | ||
3411 | !nextChild ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected devtool events to fire for the child before its parent includes it in onSetChildren().') : _prodInvariant('68') : void 0; | ||
3412 | !(nextChild.displayName != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected onSetDisplayName() to fire for the child before its parent includes it in onSetChildren().') : _prodInvariant('69') : void 0; | ||
3413 | !(nextChild.childIDs != null || nextChild.text != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected onSetChildren() or onSetText() to fire for the child before its parent includes it in onSetChildren().') : _prodInvariant('70') : void 0; | ||
3414 | !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; | ||
3415 | if (nextChild.parentID == null) { | ||
3416 | nextChild.parentID = id; | ||
3417 | // TODO: This shouldn't be necessary but mounting a new root during in | ||
3418 | // componentWillMount currently causes not-yet-mounted components to | ||
3419 | // be purged from our tree data so their parent ID is missing. | ||
3420 | } | ||
3421 | !(nextChild.parentID === id) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected onSetParent() and onSetChildren() to be consistent (%s has parents %s and %s).', nextChildID, nextChild.parentID, id) : _prodInvariant('72', nextChildID, nextChild.parentID, id) : void 0; | ||
3422 | }); | ||
3423 | }); | ||
3424 | }, | ||
3425 | onSetOwner: function (id, ownerID) { | ||
3426 | updateTree(id, function (item) { | ||
3427 | return item.ownerID = ownerID; | ||
3428 | }); | ||
3429 | }, | ||
3430 | onSetParent: function (id, parentID) { | ||
3431 | updateTree(id, function (item) { | ||
3432 | return item.parentID = parentID; | ||
3433 | }); | ||
3434 | }, | ||
3435 | onSetText: function (id, text) { | ||
3436 | updateTree(id, function (item) { | ||
3437 | return item.text = text; | ||
3438 | }); | ||
3439 | }, | ||
3440 | onBeforeMountComponent: function (id, element) { | ||
3441 | updateTree(id, function (item) { | ||
3442 | return item.element = element; | ||
3443 | }); | ||
3444 | }, | ||
3445 | onBeforeUpdateComponent: function (id, element) { | ||
3446 | updateTree(id, function (item) { | ||
3447 | return item.element = element; | ||
3448 | }); | ||
3449 | }, | ||
3450 | onMountComponent: function (id) { | ||
3451 | updateTree(id, function (item) { | ||
3452 | return item.isMounted = true; | ||
3453 | }); | ||
3454 | }, | ||
3455 | onMountRootComponent: function (id) { | ||
3456 | rootIDs[id] = true; | ||
3457 | }, | ||
3458 | onUpdateComponent: function (id) { | ||
3459 | updateTree(id, function (item) { | ||
3460 | return item.updateCount++; | ||
3461 | }); | ||
3462 | }, | ||
3463 | onUnmountComponent: function (id) { | ||
3464 | updateTree(id, function (item) { | ||
3465 | return item.isMounted = false; | ||
3466 | }); | ||
3467 | unmountedIDs[id] = true; | ||
3468 | delete rootIDs[id]; | ||
3469 | }, | ||
3470 | purgeUnmountedComponents: function () { | ||
3471 | if (ReactComponentTreeDevtool._preventPurging) { | ||
3472 | // Should only be used for testing. | ||
3473 | return; | ||
3474 | } | ||
3475 | |||
3476 | for (var id in unmountedIDs) { | ||
3477 | purgeDeep(id); | ||
3478 | } | ||
3479 | unmountedIDs = {}; | ||
3480 | }, | ||
3481 | isMounted: function (id) { | ||
3482 | var item = tree[id]; | ||
3483 | return item ? item.isMounted : false; | ||
3484 | }, | ||
3485 | getCurrentStackAddendum: function (topElement) { | ||
3486 | var info = ''; | ||
3487 | if (topElement) { | ||
3488 | var type = topElement.type; | ||
3489 | var name = typeof type === 'function' ? type.displayName || type.name : type; | ||
3490 | var owner = topElement._owner; | ||
3491 | info += describeComponentFrame(name || 'Unknown', topElement._source, owner && owner.getName()); | ||
3492 | } | ||
3493 | |||
3494 | var currentOwner = ReactCurrentOwner.current; | ||
3495 | var id = currentOwner && currentOwner._debugID; | ||
3496 | |||
3497 | info += ReactComponentTreeDevtool.getStackAddendumByID(id); | ||
3498 | return info; | ||
3499 | }, | ||
3500 | getStackAddendumByID: function (id) { | ||
3501 | var info = ''; | ||
3502 | while (id) { | ||
3503 | info += describeID(id); | ||
3504 | id = ReactComponentTreeDevtool.getParentID(id); | ||
3505 | } | ||
3506 | return info; | ||
3507 | }, | ||
3508 | getChildIDs: function (id) { | ||
3509 | var item = tree[id]; | ||
3510 | return item ? item.childIDs : []; | ||
3511 | }, | ||
3512 | getDisplayName: function (id) { | ||
3513 | var item = tree[id]; | ||
3514 | return item ? item.displayName : 'Unknown'; | ||
3515 | }, | ||
3516 | getElement: function (id) { | ||
3517 | var item = tree[id]; | ||
3518 | return item ? item.element : null; | ||
3519 | }, | ||
3520 | getOwnerID: function (id) { | ||
3521 | var item = tree[id]; | ||
3522 | return item ? item.ownerID : null; | ||
3523 | }, | ||
3524 | getParentID: function (id) { | ||
3525 | var item = tree[id]; | ||
3526 | return item ? item.parentID : null; | ||
3527 | }, | ||
3528 | getSource: function (id) { | ||
3529 | var item = tree[id]; | ||
3530 | var element = item ? item.element : null; | ||
3531 | var source = element != null ? element._source : null; | ||
3532 | return source; | ||
3533 | }, | ||
3534 | getText: function (id) { | ||
3535 | var item = tree[id]; | ||
3536 | return item ? item.text : null; | ||
3537 | }, | ||
3538 | getUpdateCount: function (id) { | ||
3539 | var item = tree[id]; | ||
3540 | return item ? item.updateCount : 0; | ||
3541 | }, | ||
3542 | getRootIDs: function () { | ||
3543 | return Object.keys(rootIDs); | ||
3544 | }, | ||
3545 | getRegisteredIDs: function () { | ||
3546 | return Object.keys(tree); | ||
3547 | } | ||
3548 | }; | ||
3549 | |||
3550 | module.exports = ReactComponentTreeDevtool; | ||
3551 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
1480 | 3552 | ||
1481 | /***/ }, | 3553 | /***/ }, |
1482 | /* 21 */ | 3554 | /* 32 */ |
1483 | /***/ function(module, exports, __webpack_require__) { | 3555 | /***/ function(module, exports, __webpack_require__) { |
1484 | 3556 | ||
1485 | /** | 3557 | /* WEBPACK VAR INJECTION */(function(process) {/** |
1486 | * Copyright 2013-2015, Facebook, Inc. | 3558 | * Copyright 2013-present, Facebook, Inc. |
1487 | * All rights reserved. | 3559 | * All rights reserved. |
1488 | * | 3560 | * |
1489 | * This source code is licensed under the BSD-style license found in the | 3561 | * This source code is licensed under the BSD-style license found in the |
1490 | * LICENSE file in the root directory of this source tree. An additional grant | 3562 | * LICENSE file in the root directory of this source tree. An additional grant |
1491 | * of patent rights can be found in the PATENTS file in the same directory. | 3563 | * of patent rights can be found in the PATENTS file in the same directory. |
1492 | * | 3564 | * |
1493 | * @providesModule setInnerHTML | 3565 | * @providesModule checkReactTypeSpec |
1494 | */ | 3566 | */ |
1495 | 3567 | ||
1496 | /* globals MSApp */ | ||
1497 | |||
1498 | 'use strict'; | 3568 | 'use strict'; |
1499 | 3569 | ||
1500 | var ExecutionEnvironment = __webpack_require__(11); | 3570 | var _prodInvariant = __webpack_require__(9); |
1501 | 3571 | ||
1502 | var WHITESPACE_TEST = /^[ \r\n\t\f]/; | 3572 | var ReactPropTypeLocationNames = __webpack_require__(26); |
1503 | var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/; | 3573 | var ReactPropTypesSecret = __webpack_require__(33); |
1504 | 3574 | ||
1505 | /** | 3575 | var invariant = __webpack_require__(10); |
1506 | * Set the innerHTML property of a node, ensuring that whitespace is preserved | 3576 | var warning = __webpack_require__(13); |
1507 | * even in IE8. | ||
1508 | * | ||
1509 | * @param {DOMElement} node | ||
1510 | * @param {string} html | ||
1511 | * @internal | ||
1512 | */ | ||
1513 | var setInnerHTML = function (node, html) { | ||
1514 | node.innerHTML = html; | ||
1515 | }; | ||
1516 | 3577 | ||
1517 | // Win8 apps: Allow all html to be inserted | 3578 | var ReactComponentTreeDevtool; |
1518 | if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) { | 3579 | |
1519 | setInnerHTML = function (node, html) { | 3580 | if (typeof process !== 'undefined' && process.env && process.env.NODE_ENV === 'test') { |
1520 | MSApp.execUnsafeLocalFunction(function () { | 3581 | // Temporary hack. |
1521 | node.innerHTML = html; | 3582 | // Inline requires don't work well with Jest: |
1522 | }); | 3583 | // https://github.com/facebook/react/issues/7240 |
1523 | }; | 3584 | // Remove the inline requires when we don't need them anymore: |
3585 | // https://github.com/facebook/react/pull/7178 | ||
3586 | ReactComponentTreeDevtool = __webpack_require__(31); | ||
1524 | } | 3587 | } |
1525 | 3588 | ||
1526 | if (ExecutionEnvironment.canUseDOM) { | 3589 | var loggedTypeFailures = {}; |
1527 | // IE8: When updating a just created node with innerHTML only leading | ||
1528 | // whitespace is removed. When updating an existing node with innerHTML | ||
1529 | // whitespace in root TextNodes is also collapsed. | ||
1530 | // @see quirksmode.org/bugreports/archives/2004/11/innerhtml_and_t.html | ||
1531 | 3590 | ||
1532 | // Feature detection; only IE8 is known to behave improperly like this. | 3591 | /** |
1533 | var testElement = document.createElement('div'); | 3592 | * Assert that the values match with the type specs. |
1534 | testElement.innerHTML = ' '; | 3593 | * Error messages are memorized and will only be shown once. |
1535 | if (testElement.innerHTML === '') { | 3594 | * |
1536 | setInnerHTML = function (node, html) { | 3595 | * @param {object} typeSpecs Map of name to a ReactPropType |
1537 | // Magic theory: IE8 supposedly differentiates between added and updated | 3596 | * @param {object} values Runtime values that need to be type-checked |
1538 | // nodes when processing innerHTML, innerHTML on updated nodes suffers | 3597 | * @param {string} location e.g. "prop", "context", "child context" |
1539 | // from worse whitespace behavior. Re-adding a node like this triggers | 3598 | * @param {string} componentName Name of the component for error messages. |
1540 | // the initial and more favorable whitespace behavior. | 3599 | * @param {?object} element The React element that is being type-checked |
1541 | // TODO: What to do on a detached node? | 3600 | * @param {?number} debugID The React component instance that is being type-checked |
1542 | if (node.parentNode) { | 3601 | * @private |
1543 | node.parentNode.replaceChild(node, node); | 3602 | */ |
3603 | function checkReactTypeSpec(typeSpecs, values, location, componentName, element, debugID) { | ||
3604 | for (var typeSpecName in typeSpecs) { | ||
3605 | if (typeSpecs.hasOwnProperty(typeSpecName)) { | ||
3606 | var error; | ||
3607 | // Prop type validation may throw. In case they do, we don't want to | ||
3608 | // fail the render phase where it didn't fail before. So we log it. | ||
3609 | // After these have been cleaned up, we'll let them throw. | ||
3610 | try { | ||
3611 | // This is intentionally an invariant that gets caught. It's the same | ||
3612 | // behavior as without this statement except with a better message. | ||
3613 | !(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; | ||
3614 | error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret); | ||
3615 | } catch (ex) { | ||
3616 | error = ex; | ||
1544 | } | 3617 | } |
3618 | 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; | ||
3619 | if (error instanceof Error && !(error.message in loggedTypeFailures)) { | ||
3620 | // Only monitor this failure once because there tends to be a lot of the | ||
3621 | // same error. | ||
3622 | loggedTypeFailures[error.message] = true; | ||
1545 | 3623 | ||
1546 | // We also implement a workaround for non-visible tags disappearing into | 3624 | var componentStackInfo = ''; |
1547 | // thin air on IE8, this only happens if there is no visible text | ||
1548 | // in-front of the non-visible tags. Piggyback on the whitespace fix | ||
1549 | // and simply check if any non-visible tags appear in the source. | ||
1550 | if (WHITESPACE_TEST.test(html) || html[0] === '<' && NONVISIBLE_TEST.test(html)) { | ||
1551 | // Recover leading whitespace by temporarily prepending any character. | ||
1552 | // \uFEFF has the potential advantage of being zero-width/invisible. | ||
1553 | // UglifyJS drops U+FEFF chars when parsing, so use String.fromCharCode | ||
1554 | // in hopes that this is preserved even if "\uFEFF" is transformed to | ||
1555 | // the actual Unicode character (by Babel, for example). | ||
1556 | // https://github.com/mishoo/UglifyJS2/blob/v2.4.20/lib/parse.js#L216 | ||
1557 | node.innerHTML = String.fromCharCode(0xFEFF) + html; | ||
1558 | 3625 | ||
1559 | // deleteData leaves an empty `TextNode` which offsets the index of all | 3626 | if (process.env.NODE_ENV !== 'production') { |
1560 | // children. Definitely want to avoid this. | 3627 | if (!ReactComponentTreeDevtool) { |
1561 | var textNode = node.firstChild; | 3628 | ReactComponentTreeDevtool = __webpack_require__(31); |
1562 | if (textNode.data.length === 1) { | 3629 | } |
1563 | node.removeChild(textNode); | 3630 | if (debugID !== null) { |
1564 | } else { | 3631 | componentStackInfo = ReactComponentTreeDevtool.getStackAddendumByID(debugID); |
1565 | textNode.deleteData(0, 1); | 3632 | } else if (element !== null) { |
3633 | componentStackInfo = ReactComponentTreeDevtool.getCurrentStackAddendum(element); | ||
3634 | } | ||
1566 | } | 3635 | } |
1567 | } else { | 3636 | |
1568 | node.innerHTML = html; | 3637 | process.env.NODE_ENV !== 'production' ? warning(false, 'Failed %s type: %s%s', location, error.message, componentStackInfo) : void 0; |
1569 | } | 3638 | } |
1570 | }; | 3639 | } |
1571 | } | 3640 | } |
1572 | } | 3641 | } |
1573 | 3642 | ||
1574 | module.exports = setInnerHTML; | 3643 | module.exports = checkReactTypeSpec; |
3644 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
1575 | 3645 | ||
1576 | /***/ }, | 3646 | /***/ }, |
1577 | /* 22 */ | 3647 | /* 33 */ |
1578 | /***/ function(module, exports, __webpack_require__) { | 3648 | /***/ function(module, exports) { |
1579 | 3649 | ||
1580 | /** | 3650 | /** |
1581 | * Copyright 2013-2015, Facebook, Inc. | 3651 | * Copyright 2013-present, Facebook, Inc. |
1582 | * All rights reserved. | 3652 | * All rights reserved. |
1583 | * | 3653 | * |
1584 | * This source code is licensed under the BSD-style license found in the | 3654 | * This source code is licensed under the BSD-style license found in the |
1585 | * LICENSE file in the root directory of this source tree. An additional grant | 3655 | * LICENSE file in the root directory of this source tree. An additional grant |
1586 | * of patent rights can be found in the PATENTS file in the same directory. | 3656 | * of patent rights can be found in the PATENTS file in the same directory. |
1587 | * | 3657 | * |
1588 | * @providesModule setTextContent | 3658 | * @providesModule ReactPropTypesSecret |
1589 | */ | 3659 | */ |
1590 | 3660 | ||
1591 | 'use strict'; | 3661 | 'use strict'; |
1592 | 3662 | ||
1593 | var ExecutionEnvironment = __webpack_require__(11); | 3663 | var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; |
1594 | var escapeTextContentForBrowser = __webpack_require__(23); | 3664 | |
1595 | var setInnerHTML = __webpack_require__(21); | 3665 | module.exports = ReactPropTypesSecret; |
3666 | |||
3667 | /***/ }, | ||
3668 | /* 34 */ | ||
3669 | /***/ function(module, exports, __webpack_require__) { | ||
3670 | |||
3671 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
3672 | * Copyright 2013-present, Facebook, Inc. | ||
3673 | * All rights reserved. | ||
3674 | * | ||
3675 | * This source code is licensed under the BSD-style license found in the | ||
3676 | * LICENSE file in the root directory of this source tree. An additional grant | ||
3677 | * of patent rights can be found in the PATENTS file in the same directory. | ||
3678 | * | ||
3679 | * @providesModule ReactPropTypes | ||
3680 | */ | ||
3681 | |||
3682 | 'use strict'; | ||
3683 | |||
3684 | var ReactElement = __webpack_require__(11); | ||
3685 | var ReactPropTypeLocationNames = __webpack_require__(26); | ||
3686 | var ReactPropTypesSecret = __webpack_require__(33); | ||
3687 | |||
3688 | var emptyFunction = __webpack_require__(14); | ||
3689 | var getIteratorFn = __webpack_require__(17); | ||
3690 | var warning = __webpack_require__(13); | ||
1596 | 3691 | ||
1597 | /** | 3692 | /** |
1598 | * Set the textContent property of a node, ensuring that whitespace is preserved | 3693 | * Collection of methods that allow declaration and validation of props that are |
1599 | * even in IE8. innerText is a poor substitute for textContent and, among many | 3694 | * supplied to React components. Example usage: |
1600 | * issues, inserts <br> instead of the literal newline chars. innerHTML behaves | 3695 | * |
1601 | * as it should. | 3696 | * var Props = require('ReactPropTypes'); |
3697 | * var MyArticle = React.createClass({ | ||
3698 | * propTypes: { | ||
3699 | * // An optional string prop named "description". | ||
3700 | * description: Props.string, | ||
3701 | * | ||
3702 | * // A required enum prop named "category". | ||
3703 | * category: Props.oneOf(['News','Photos']).isRequired, | ||
3704 | * | ||
3705 | * // A prop named "dialog" that requires an instance of Dialog. | ||
3706 | * dialog: Props.instanceOf(Dialog).isRequired | ||
3707 | * }, | ||
3708 | * render: function() { ... } | ||
3709 | * }); | ||
3710 | * | ||
3711 | * A more formal specification of how these methods are used: | ||
3712 | * | ||
3713 | * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...) | ||
3714 | * decl := ReactPropTypes.{type}(.isRequired)? | ||
3715 | * | ||
3716 | * Each and every declaration produces a function with the same signature. This | ||
3717 | * allows the creation of custom validation functions. For example: | ||
3718 | * | ||
3719 | * var MyLink = React.createClass({ | ||
3720 | * propTypes: { | ||
3721 | * // An optional string or URI prop named "href". | ||
3722 | * href: function(props, propName, componentName) { | ||
3723 | * var propValue = props[propName]; | ||
3724 | * if (propValue != null && typeof propValue !== 'string' && | ||
3725 | * !(propValue instanceof URI)) { | ||
3726 | * return new Error( | ||
3727 | * 'Expected a string or an URI for ' + propName + ' in ' + | ||
3728 | * componentName | ||
3729 | * ); | ||
3730 | * } | ||
3731 | * } | ||
3732 | * }, | ||
3733 | * render: function() {...} | ||
3734 | * }); | ||
1602 | * | 3735 | * |
1603 | * @param {DOMElement} node | ||
1604 | * @param {string} text | ||
1605 | * @internal | 3736 | * @internal |
1606 | */ | 3737 | */ |
1607 | var setTextContent = function (node, text) { | 3738 | |
1608 | node.textContent = text; | 3739 | var ANONYMOUS = '<<anonymous>>'; |
3740 | |||
3741 | var ReactPropTypes = { | ||
3742 | array: createPrimitiveTypeChecker('array'), | ||
3743 | bool: createPrimitiveTypeChecker('boolean'), | ||
3744 | func: createPrimitiveTypeChecker('function'), | ||
3745 | number: createPrimitiveTypeChecker('number'), | ||
3746 | object: createPrimitiveTypeChecker('object'), | ||
3747 | string: createPrimitiveTypeChecker('string'), | ||
3748 | symbol: createPrimitiveTypeChecker('symbol'), | ||
3749 | |||
3750 | any: createAnyTypeChecker(), | ||
3751 | arrayOf: createArrayOfTypeChecker, | ||
3752 | element: createElementTypeChecker(), | ||
3753 | instanceOf: createInstanceTypeChecker, | ||
3754 | node: createNodeChecker(), | ||
3755 | objectOf: createObjectOfTypeChecker, | ||
3756 | oneOf: createEnumTypeChecker, | ||
3757 | oneOfType: createUnionTypeChecker, | ||
3758 | shape: createShapeTypeChecker | ||
1609 | }; | 3759 | }; |
1610 | 3760 | ||
1611 | if (ExecutionEnvironment.canUseDOM) { | 3761 | /** |
1612 | if (!('textContent' in document.documentElement)) { | 3762 | * inlined Object.is polyfill to avoid requiring consumers ship their own |
1613 | setTextContent = function (node, text) { | 3763 | * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is |
1614 | setInnerHTML(node, escapeTextContentForBrowser(text)); | 3764 | */ |
1615 | }; | 3765 | /*eslint-disable no-self-compare*/ |
3766 | function is(x, y) { | ||
3767 | // SameValue algorithm | ||
3768 | if (x === y) { | ||
3769 | // Steps 1-5, 7-10 | ||
3770 | // Steps 6.b-6.e: +0 != -0 | ||
3771 | return x !== 0 || 1 / x === 1 / y; | ||
3772 | } else { | ||
3773 | // Step 6.a: NaN == NaN | ||
3774 | return x !== x && y !== y; | ||
1616 | } | 3775 | } |
1617 | } | 3776 | } |
3777 | /*eslint-enable no-self-compare*/ | ||
1618 | 3778 | ||
1619 | module.exports = setTextContent; | 3779 | function createChainableTypeChecker(validate) { |
3780 | if (process.env.NODE_ENV !== 'production') { | ||
3781 | var manualPropTypeCallCache = {}; | ||
3782 | } | ||
3783 | function checkType(isRequired, props, propName, componentName, location, propFullName, secret) { | ||
3784 | componentName = componentName || ANONYMOUS; | ||
3785 | propFullName = propFullName || propName; | ||
3786 | if (process.env.NODE_ENV !== 'production') { | ||
3787 | if (secret !== ReactPropTypesSecret && typeof console !== 'undefined') { | ||
3788 | var cacheKey = componentName + ':' + propName; | ||
3789 | if (!manualPropTypeCallCache[cacheKey]) { | ||
3790 | process.env.NODE_ENV !== 'production' ? warning(false, 'You are manually calling a React.PropTypes validation ' + 'function for the `%s` prop on `%s`. This is deprecated ' + 'and will not work in the next major version. You may be ' + 'seeing this warning due to a third-party PropTypes library. ' + 'See https://fb.me/react-warning-dont-call-proptypes for details.', propFullName, componentName) : void 0; | ||
3791 | manualPropTypeCallCache[cacheKey] = true; | ||
3792 | } | ||
3793 | } | ||
3794 | } | ||
3795 | if (props[propName] == null) { | ||
3796 | var locationName = ReactPropTypeLocationNames[location]; | ||
3797 | if (isRequired) { | ||
3798 | return new Error('Required ' + locationName + ' `' + propFullName + '` was not specified in ' + ('`' + componentName + '`.')); | ||
3799 | } | ||
3800 | return null; | ||
3801 | } else { | ||
3802 | return validate(props, propName, componentName, location, propFullName); | ||
3803 | } | ||
3804 | } | ||
3805 | |||
3806 | var chainedCheckType = checkType.bind(null, false); | ||
3807 | chainedCheckType.isRequired = checkType.bind(null, true); | ||
3808 | |||
3809 | return chainedCheckType; | ||
3810 | } | ||
3811 | |||
3812 | function createPrimitiveTypeChecker(expectedType) { | ||
3813 | function validate(props, propName, componentName, location, propFullName, secret) { | ||
3814 | var propValue = props[propName]; | ||
3815 | var propType = getPropType(propValue); | ||
3816 | if (propType !== expectedType) { | ||
3817 | var locationName = ReactPropTypeLocationNames[location]; | ||
3818 | // `propValue` being instance of, say, date/regexp, pass the 'object' | ||
3819 | // check, but we can offer a more precise error message here rather than | ||
3820 | // 'of type `object`'. | ||
3821 | var preciseType = getPreciseType(propValue); | ||
3822 | |||
3823 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); | ||
3824 | } | ||
3825 | return null; | ||
3826 | } | ||
3827 | return createChainableTypeChecker(validate); | ||
3828 | } | ||
3829 | |||
3830 | function createAnyTypeChecker() { | ||
3831 | return createChainableTypeChecker(emptyFunction.thatReturns(null)); | ||
3832 | } | ||
3833 | |||
3834 | function createArrayOfTypeChecker(typeChecker) { | ||
3835 | function validate(props, propName, componentName, location, propFullName) { | ||
3836 | if (typeof typeChecker !== 'function') { | ||
3837 | return new Error('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.'); | ||
3838 | } | ||
3839 | var propValue = props[propName]; | ||
3840 | if (!Array.isArray(propValue)) { | ||
3841 | var locationName = ReactPropTypeLocationNames[location]; | ||
3842 | var propType = getPropType(propValue); | ||
3843 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.')); | ||
3844 | } | ||
3845 | for (var i = 0; i < propValue.length; i++) { | ||
3846 | var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret); | ||
3847 | if (error instanceof Error) { | ||
3848 | return error; | ||
3849 | } | ||
3850 | } | ||
3851 | return null; | ||
3852 | } | ||
3853 | return createChainableTypeChecker(validate); | ||
3854 | } | ||
3855 | |||
3856 | function createElementTypeChecker() { | ||
3857 | function validate(props, propName, componentName, location, propFullName) { | ||
3858 | var propValue = props[propName]; | ||
3859 | if (!ReactElement.isValidElement(propValue)) { | ||
3860 | var locationName = ReactPropTypeLocationNames[location]; | ||
3861 | var propType = getPropType(propValue); | ||
3862 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.')); | ||
3863 | } | ||
3864 | return null; | ||
3865 | } | ||
3866 | return createChainableTypeChecker(validate); | ||
3867 | } | ||
3868 | |||
3869 | function createInstanceTypeChecker(expectedClass) { | ||
3870 | function validate(props, propName, componentName, location, propFullName) { | ||
3871 | if (!(props[propName] instanceof expectedClass)) { | ||
3872 | var locationName = ReactPropTypeLocationNames[location]; | ||
3873 | var expectedClassName = expectedClass.name || ANONYMOUS; | ||
3874 | var actualClassName = getClassName(props[propName]); | ||
3875 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.')); | ||
3876 | } | ||
3877 | return null; | ||
3878 | } | ||
3879 | return createChainableTypeChecker(validate); | ||
3880 | } | ||
3881 | |||
3882 | function createEnumTypeChecker(expectedValues) { | ||
3883 | if (!Array.isArray(expectedValues)) { | ||
3884 | process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0; | ||
3885 | return emptyFunction.thatReturnsNull; | ||
3886 | } | ||
3887 | |||
3888 | function validate(props, propName, componentName, location, propFullName) { | ||
3889 | var propValue = props[propName]; | ||
3890 | for (var i = 0; i < expectedValues.length; i++) { | ||
3891 | if (is(propValue, expectedValues[i])) { | ||
3892 | return null; | ||
3893 | } | ||
3894 | } | ||
3895 | |||
3896 | var locationName = ReactPropTypeLocationNames[location]; | ||
3897 | var valuesString = JSON.stringify(expectedValues); | ||
3898 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.')); | ||
3899 | } | ||
3900 | return createChainableTypeChecker(validate); | ||
3901 | } | ||
3902 | |||
3903 | function createObjectOfTypeChecker(typeChecker) { | ||
3904 | function validate(props, propName, componentName, location, propFullName) { | ||
3905 | if (typeof typeChecker !== 'function') { | ||
3906 | return new Error('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.'); | ||
3907 | } | ||
3908 | var propValue = props[propName]; | ||
3909 | var propType = getPropType(propValue); | ||
3910 | if (propType !== 'object') { | ||
3911 | var locationName = ReactPropTypeLocationNames[location]; | ||
3912 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.')); | ||
3913 | } | ||
3914 | for (var key in propValue) { | ||
3915 | if (propValue.hasOwnProperty(key)) { | ||
3916 | var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); | ||
3917 | if (error instanceof Error) { | ||
3918 | return error; | ||
3919 | } | ||
3920 | } | ||
3921 | } | ||
3922 | return null; | ||
3923 | } | ||
3924 | return createChainableTypeChecker(validate); | ||
3925 | } | ||
3926 | |||
3927 | function createUnionTypeChecker(arrayOfTypeCheckers) { | ||
3928 | if (!Array.isArray(arrayOfTypeCheckers)) { | ||
3929 | process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0; | ||
3930 | return emptyFunction.thatReturnsNull; | ||
3931 | } | ||
3932 | |||
3933 | function validate(props, propName, componentName, location, propFullName) { | ||
3934 | for (var i = 0; i < arrayOfTypeCheckers.length; i++) { | ||
3935 | var checker = arrayOfTypeCheckers[i]; | ||
3936 | if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) { | ||
3937 | return null; | ||
3938 | } | ||
3939 | } | ||
3940 | |||
3941 | var locationName = ReactPropTypeLocationNames[location]; | ||
3942 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.')); | ||
3943 | } | ||
3944 | return createChainableTypeChecker(validate); | ||
3945 | } | ||
3946 | |||
3947 | function createNodeChecker() { | ||
3948 | function validate(props, propName, componentName, location, propFullName) { | ||
3949 | if (!isNode(props[propName])) { | ||
3950 | var locationName = ReactPropTypeLocationNames[location]; | ||
3951 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.')); | ||
3952 | } | ||
3953 | return null; | ||
3954 | } | ||
3955 | return createChainableTypeChecker(validate); | ||
3956 | } | ||
3957 | |||
3958 | function createShapeTypeChecker(shapeTypes) { | ||
3959 | function validate(props, propName, componentName, location, propFullName) { | ||
3960 | var propValue = props[propName]; | ||
3961 | var propType = getPropType(propValue); | ||
3962 | if (propType !== 'object') { | ||
3963 | var locationName = ReactPropTypeLocationNames[location]; | ||
3964 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); | ||
3965 | } | ||
3966 | for (var key in shapeTypes) { | ||
3967 | var checker = shapeTypes[key]; | ||
3968 | if (!checker) { | ||
3969 | continue; | ||
3970 | } | ||
3971 | var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); | ||
3972 | if (error) { | ||
3973 | return error; | ||
3974 | } | ||
3975 | } | ||
3976 | return null; | ||
3977 | } | ||
3978 | return createChainableTypeChecker(validate); | ||
3979 | } | ||
3980 | |||
3981 | function isNode(propValue) { | ||
3982 | switch (typeof propValue) { | ||
3983 | case 'number': | ||
3984 | case 'string': | ||
3985 | case 'undefined': | ||
3986 | return true; | ||
3987 | case 'boolean': | ||
3988 | return !propValue; | ||
3989 | case 'object': | ||
3990 | if (Array.isArray(propValue)) { | ||
3991 | return propValue.every(isNode); | ||
3992 | } | ||
3993 | if (propValue === null || ReactElement.isValidElement(propValue)) { | ||
3994 | return true; | ||
3995 | } | ||
3996 | |||
3997 | var iteratorFn = getIteratorFn(propValue); | ||
3998 | if (iteratorFn) { | ||
3999 | var iterator = iteratorFn.call(propValue); | ||
4000 | var step; | ||
4001 | if (iteratorFn !== propValue.entries) { | ||
4002 | while (!(step = iterator.next()).done) { | ||
4003 | if (!isNode(step.value)) { | ||
4004 | return false; | ||
4005 | } | ||
4006 | } | ||
4007 | } else { | ||
4008 | // Iterator will provide entry [k,v] tuples rather than values. | ||
4009 | while (!(step = iterator.next()).done) { | ||
4010 | var entry = step.value; | ||
4011 | if (entry) { | ||
4012 | if (!isNode(entry[1])) { | ||
4013 | return false; | ||
4014 | } | ||
4015 | } | ||
4016 | } | ||
4017 | } | ||
4018 | } else { | ||
4019 | return false; | ||
4020 | } | ||
4021 | |||
4022 | return true; | ||
4023 | default: | ||
4024 | return false; | ||
4025 | } | ||
4026 | } | ||
4027 | |||
4028 | function isSymbol(propType, propValue) { | ||
4029 | // Native Symbol. | ||
4030 | if (propType === 'symbol') { | ||
4031 | return true; | ||
4032 | } | ||
4033 | |||
4034 | // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol' | ||
4035 | if (propValue['@@toStringTag'] === 'Symbol') { | ||
4036 | return true; | ||
4037 | } | ||
4038 | |||
4039 | // Fallback for non-spec compliant Symbols which are polyfilled. | ||
4040 | if (typeof Symbol === 'function' && propValue instanceof Symbol) { | ||
4041 | return true; | ||
4042 | } | ||
4043 | |||
4044 | return false; | ||
4045 | } | ||
4046 | |||
4047 | // Equivalent of `typeof` but with special handling for array and regexp. | ||
4048 | function getPropType(propValue) { | ||
4049 | var propType = typeof propValue; | ||
4050 | if (Array.isArray(propValue)) { | ||
4051 | return 'array'; | ||
4052 | } | ||
4053 | if (propValue instanceof RegExp) { | ||
4054 | // Old webkits (at least until Android 4.0) return 'function' rather than | ||
4055 | // 'object' for typeof a RegExp. We'll normalize this here so that /bla/ | ||
4056 | // passes PropTypes.object. | ||
4057 | return 'object'; | ||
4058 | } | ||
4059 | if (isSymbol(propType, propValue)) { | ||
4060 | return 'symbol'; | ||
4061 | } | ||
4062 | return propType; | ||
4063 | } | ||
4064 | |||
4065 | // This handles more types than `getPropType`. Only used for error messages. | ||
4066 | // See `createPrimitiveTypeChecker`. | ||
4067 | function getPreciseType(propValue) { | ||
4068 | var propType = getPropType(propValue); | ||
4069 | if (propType === 'object') { | ||
4070 | if (propValue instanceof Date) { | ||
4071 | return 'date'; | ||
4072 | } else if (propValue instanceof RegExp) { | ||
4073 | return 'regexp'; | ||
4074 | } | ||
4075 | } | ||
4076 | return propType; | ||
4077 | } | ||
4078 | |||
4079 | // Returns class name of the object, if any. | ||
4080 | function getClassName(propValue) { | ||
4081 | if (!propValue.constructor || !propValue.constructor.name) { | ||
4082 | return ANONYMOUS; | ||
4083 | } | ||
4084 | return propValue.constructor.name; | ||
4085 | } | ||
4086 | |||
4087 | module.exports = ReactPropTypes; | ||
4088 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
1620 | 4089 | ||
1621 | /***/ }, | 4090 | /***/ }, |
1622 | /* 23 */ | 4091 | /* 35 */ |
1623 | /***/ function(module, exports) { | 4092 | /***/ function(module, exports) { |
1624 | 4093 | ||
1625 | /** | 4094 | /** |
1626 | * Copyright 2013-2015, Facebook, Inc. | 4095 | * Copyright 2013-present, Facebook, Inc. |
1627 | * All rights reserved. | 4096 | * All rights reserved. |
1628 | * | 4097 | * |
1629 | * This source code is licensed under the BSD-style license found in the | 4098 | * This source code is licensed under the BSD-style license found in the |
1630 | * LICENSE file in the root directory of this source tree. An additional grant | 4099 | * LICENSE file in the root directory of this source tree. An additional grant |
1631 | * of patent rights can be found in the PATENTS file in the same directory. | 4100 | * of patent rights can be found in the PATENTS file in the same directory. |
1632 | * | 4101 | * |
1633 | * @providesModule escapeTextContentForBrowser | 4102 | * @providesModule ReactVersion |
1634 | */ | 4103 | */ |
1635 | 4104 | ||
1636 | 'use strict'; | 4105 | 'use strict'; |
1637 | 4106 | ||
1638 | var ESCAPE_LOOKUP = { | 4107 | module.exports = '15.3.0'; |
1639 | '&': '&', | 4108 | |
1640 | '>': '>', | 4109 | /***/ }, |
1641 | '<': '<', | 4110 | /* 36 */ |
1642 | '"': '"', | 4111 | /***/ function(module, exports, __webpack_require__) { |
1643 | '\'': ''' | 4112 | |
1644 | }; | 4113 | /* WEBPACK VAR INJECTION */(function(process) {/** |
4114 | * Copyright 2013-present, Facebook, Inc. | ||
4115 | * All rights reserved. | ||
4116 | * | ||
4117 | * This source code is licensed under the BSD-style license found in the | ||
4118 | * LICENSE file in the root directory of this source tree. An additional grant | ||
4119 | * of patent rights can be found in the PATENTS file in the same directory. | ||
4120 | * | ||
4121 | * @providesModule onlyChild | ||
4122 | */ | ||
4123 | 'use strict'; | ||
1645 | 4124 | ||
1646 | var ESCAPE_REGEX = /[&><"']/g; | 4125 | var _prodInvariant = __webpack_require__(9); |
1647 | 4126 | ||
1648 | function escaper(match) { | 4127 | var ReactElement = __webpack_require__(11); |
1649 | return ESCAPE_LOOKUP[match]; | 4128 | |
1650 | } | 4129 | var invariant = __webpack_require__(10); |
1651 | 4130 | ||
1652 | /** | 4131 | /** |
1653 | * Escapes text to prevent scripting attacks. | 4132 | * Returns the first child in a collection of children and verifies that there |
4133 | * is only one child in the collection. | ||
1654 | * | 4134 | * |
1655 | * @param {*} text Text value to escape. | 4135 | * See https://facebook.github.io/react/docs/top-level-api.html#react.children.only |
1656 | * @return {string} An escaped string. | 4136 | * |
4137 | * The current implementation of this function assumes that a single child gets | ||
4138 | * passed without a wrapper, but the purpose of this helper function is to | ||
4139 | * abstract away the particular structure of children. | ||
4140 | * | ||
4141 | * @param {?object} children Child collection structure. | ||
4142 | * @return {ReactElement} The first and only `ReactElement` contained in the | ||
4143 | * structure. | ||
1657 | */ | 4144 | */ |
1658 | function escapeTextContentForBrowser(text) { | 4145 | function onlyChild(children) { |
1659 | return ('' + text).replace(ESCAPE_REGEX, escaper); | 4146 | !ReactElement.isValidElement(children) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'onlyChild must be passed a children with exactly one child.') : _prodInvariant('23') : void 0; |
4147 | return children; | ||
1660 | } | 4148 | } |
1661 | 4149 | ||
1662 | module.exports = escapeTextContentForBrowser; | 4150 | module.exports = onlyChild; |
4151 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
1663 | 4152 | ||
1664 | /***/ }, | 4153 | /***/ }, |
1665 | /* 24 */ | 4154 | /* 37 */ |
4155 | /***/ function(module, exports, __webpack_require__) { | ||
4156 | |||
4157 | 'use strict'; | ||
4158 | |||
4159 | module.exports = __webpack_require__(38); | ||
4160 | |||
4161 | |||
4162 | /***/ }, | ||
4163 | /* 38 */ | ||
1666 | /***/ function(module, exports, __webpack_require__) { | 4164 | /***/ function(module, exports, __webpack_require__) { |
1667 | 4165 | ||
1668 | /* WEBPACK VAR INJECTION */(function(process) {/** | 4166 | /* WEBPACK VAR INJECTION */(function(process) {/** |
1669 | * Copyright 2013-2015, Facebook, Inc. | 4167 | * Copyright 2013-present, Facebook, Inc. |
1670 | * All rights reserved. | 4168 | * All rights reserved. |
1671 | * | 4169 | * |
1672 | * This source code is licensed under the BSD-style license found in the | 4170 | * This source code is licensed under the BSD-style license found in the |
1673 | * LICENSE file in the root directory of this source tree. An additional grant | 4171 | * LICENSE file in the root directory of this source tree. An additional grant |
1674 | * of patent rights can be found in the PATENTS file in the same directory. | 4172 | * of patent rights can be found in the PATENTS file in the same directory. |
1675 | * | 4173 | * |
1676 | * @providesModule DOMPropertyOperations | 4174 | * @providesModule ReactDOM |
1677 | * @typechecks static-only | ||
1678 | */ | 4175 | */ |
1679 | 4176 | ||
4177 | /* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/ | ||
4178 | |||
1680 | 'use strict'; | 4179 | 'use strict'; |
1681 | 4180 | ||
1682 | var DOMProperty = __webpack_require__(25); | 4181 | var ReactDOMComponentTree = __webpack_require__(39); |
1683 | var ReactPerf = __webpack_require__(20); | 4182 | var ReactDefaultInjection = __webpack_require__(42); |
4183 | var ReactMount = __webpack_require__(169); | ||
4184 | var ReactReconciler = __webpack_require__(62); | ||
4185 | var ReactUpdates = __webpack_require__(59); | ||
4186 | var ReactVersion = __webpack_require__(35); | ||
1684 | 4187 | ||
1685 | var quoteAttributeValueForBrowser = __webpack_require__(26); | 4188 | var findDOMNode = __webpack_require__(174); |
1686 | var warning = __webpack_require__(27); | 4189 | var getHostComponentFromComposite = __webpack_require__(175); |
4190 | var renderSubtreeIntoContainer = __webpack_require__(176); | ||
4191 | var warning = __webpack_require__(13); | ||
1687 | 4192 | ||
1688 | // Simplified subset | 4193 | ReactDefaultInjection.inject(); |
1689 | var VALID_ATTRIBUTE_NAME_REGEX = /^[a-zA-Z_][\w\.\-]*$/; | ||
1690 | var illegalAttributeNameCache = {}; | ||
1691 | var validatedAttributeNameCache = {}; | ||
1692 | 4194 | ||
1693 | function isAttributeNameSafe(attributeName) { | 4195 | var ReactDOM = { |
1694 | if (validatedAttributeNameCache.hasOwnProperty(attributeName)) { | 4196 | findDOMNode: findDOMNode, |
1695 | return true; | 4197 | render: ReactMount.render, |
1696 | } | 4198 | unmountComponentAtNode: ReactMount.unmountComponentAtNode, |
1697 | if (illegalAttributeNameCache.hasOwnProperty(attributeName)) { | 4199 | version: ReactVersion, |
1698 | return false; | ||
1699 | } | ||
1700 | if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) { | ||
1701 | validatedAttributeNameCache[attributeName] = true; | ||
1702 | return true; | ||
1703 | } | ||
1704 | illegalAttributeNameCache[attributeName] = true; | ||
1705 | process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid attribute name: `%s`', attributeName) : undefined; | ||
1706 | return false; | ||
1707 | } | ||
1708 | 4200 | ||
1709 | function shouldIgnoreValue(propertyInfo, value) { | 4201 | /* eslint-disable camelcase */ |
1710 | return value == null || propertyInfo.hasBooleanValue && !value || propertyInfo.hasNumericValue && isNaN(value) || propertyInfo.hasPositiveNumericValue && value < 1 || propertyInfo.hasOverloadedBooleanValue && value === false; | 4202 | unstable_batchedUpdates: ReactUpdates.batchedUpdates, |
4203 | unstable_renderSubtreeIntoContainer: renderSubtreeIntoContainer | ||
4204 | }; | ||
4205 | |||
4206 | // Inject the runtime into a devtools global hook regardless of browser. | ||
4207 | // Allows for debugging when the hook is injected on the page. | ||
4208 | /* eslint-enable camelcase */ | ||
4209 | if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') { | ||
4210 | __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({ | ||
4211 | ComponentTree: { | ||
4212 | getClosestInstanceFromNode: ReactDOMComponentTree.getClosestInstanceFromNode, | ||
4213 | getNodeFromInstance: function (inst) { | ||
4214 | // inst is an internal instance (but could be a composite) | ||
4215 | if (inst._renderedComponent) { | ||
4216 | inst = getHostComponentFromComposite(inst); | ||
4217 | } | ||
4218 | if (inst) { | ||
4219 | return ReactDOMComponentTree.getNodeFromInstance(inst); | ||
4220 | } else { | ||
4221 | return null; | ||
4222 | } | ||
4223 | } | ||
4224 | }, | ||
4225 | Mount: ReactMount, | ||
4226 | Reconciler: ReactReconciler | ||
4227 | }); | ||
1711 | } | 4228 | } |
1712 | 4229 | ||
1713 | if (process.env.NODE_ENV !== 'production') { | 4230 | if (process.env.NODE_ENV !== 'production') { |
1714 | var reactProps = { | 4231 | var ExecutionEnvironment = __webpack_require__(52); |
1715 | children: true, | 4232 | if (ExecutionEnvironment.canUseDOM && window.top === window.self) { |
1716 | dangerouslySetInnerHTML: true, | ||
1717 | key: true, | ||
1718 | ref: true | ||
1719 | }; | ||
1720 | var warnedProperties = {}; | ||
1721 | 4233 | ||
1722 | var warnUnknownProperty = function (name) { | 4234 | // First check if devtools is not installed |
1723 | if (reactProps.hasOwnProperty(name) && reactProps[name] || warnedProperties.hasOwnProperty(name) && warnedProperties[name]) { | 4235 | if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') { |
1724 | return; | 4236 | // If we're in Chrome or Firefox, provide a download link if not installed. |
4237 | if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) { | ||
4238 | // Firefox does not have the issue with devtools loaded over file:// | ||
4239 | var showFileUrlMessage = window.location.protocol.indexOf('http') === -1 && navigator.userAgent.indexOf('Firefox') === -1; | ||
4240 | 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'); | ||
4241 | } | ||
1725 | } | 4242 | } |
1726 | 4243 | ||
1727 | warnedProperties[name] = true; | 4244 | var testFunc = function testFn() {}; |
1728 | var lowerCasedName = name.toLowerCase(); | 4245 | 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; |
1729 | 4246 | ||
1730 | // data-* attributes should be lowercase; suggest the lowercase version | 4247 | // If we're in IE8, check to see if we are in compatibility mode and provide |
1731 | var standardName = DOMProperty.isCustomAttribute(lowerCasedName) ? lowerCasedName : DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ? DOMProperty.getPossibleStandardName[lowerCasedName] : null; | 4248 | // information on preventing compatibility mode |
4249 | var ieCompatibilityMode = document.documentMode && document.documentMode < 8; | ||
1732 | 4250 | ||
1733 | // For now, only warn when we have a suggested correction. This prevents | 4251 | 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; |
1734 | // logging too much when using transferPropsTo. | 4252 | |
1735 | process.env.NODE_ENV !== 'production' ? warning(standardName == null, 'Unknown DOM property %s. Did you mean %s?', name, standardName) : undefined; | 4253 | var expectedFeatures = [ |
1736 | }; | 4254 | // shims |
4255 | Array.isArray, Array.prototype.every, Array.prototype.forEach, Array.prototype.indexOf, Array.prototype.map, Date.now, Function.prototype.bind, Object.keys, String.prototype.split, String.prototype.trim]; | ||
4256 | |||
4257 | for (var i = 0; i < expectedFeatures.length; i++) { | ||
4258 | if (!expectedFeatures[i]) { | ||
4259 | 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; | ||
4260 | break; | ||
4261 | } | ||
4262 | } | ||
4263 | } | ||
1737 | } | 4264 | } |
1738 | 4265 | ||
4266 | module.exports = ReactDOM; | ||
4267 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
4268 | |||
4269 | /***/ }, | ||
4270 | /* 39 */ | ||
4271 | /***/ function(module, exports, __webpack_require__) { | ||
4272 | |||
4273 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
4274 | * Copyright 2013-present, Facebook, Inc. | ||
4275 | * All rights reserved. | ||
4276 | * | ||
4277 | * This source code is licensed under the BSD-style license found in the | ||
4278 | * LICENSE file in the root directory of this source tree. An additional grant | ||
4279 | * of patent rights can be found in the PATENTS file in the same directory. | ||
4280 | * | ||
4281 | * @providesModule ReactDOMComponentTree | ||
4282 | */ | ||
4283 | |||
4284 | 'use strict'; | ||
4285 | |||
4286 | var _prodInvariant = __webpack_require__(9); | ||
4287 | |||
4288 | var DOMProperty = __webpack_require__(40); | ||
4289 | var ReactDOMComponentFlags = __webpack_require__(41); | ||
4290 | |||
4291 | var invariant = __webpack_require__(10); | ||
4292 | |||
4293 | var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME; | ||
4294 | var Flags = ReactDOMComponentFlags; | ||
4295 | |||
4296 | var internalInstanceKey = '__reactInternalInstance$' + Math.random().toString(36).slice(2); | ||
4297 | |||
1739 | /** | 4298 | /** |
1740 | * Operations for dealing with DOM properties. | 4299 | * Drill down (through composites and empty components) until we get a host or |
4300 | * host text component. | ||
4301 | * | ||
4302 | * This is pretty polymorphic but unavoidable with the current structure we have | ||
4303 | * for `_renderedChildren`. | ||
1741 | */ | 4304 | */ |
1742 | var DOMPropertyOperations = { | 4305 | function getRenderedHostOrTextFromComponent(component) { |
4306 | var rendered; | ||
4307 | while (rendered = component._renderedComponent) { | ||
4308 | component = rendered; | ||
4309 | } | ||
4310 | return component; | ||
4311 | } | ||
1743 | 4312 | ||
1744 | /** | 4313 | /** |
1745 | * Creates markup for the ID property. | 4314 | * Populate `_hostNode` on the rendered host/text component with the given |
1746 | * | 4315 | * DOM node. The passed `inst` can be a composite. |
1747 | * @param {string} id Unescaped ID. | 4316 | */ |
1748 | * @return {string} Markup string. | 4317 | function precacheNode(inst, node) { |
1749 | */ | 4318 | var hostInst = getRenderedHostOrTextFromComponent(inst); |
1750 | createMarkupForID: function (id) { | 4319 | hostInst._hostNode = node; |
1751 | return DOMProperty.ID_ATTRIBUTE_NAME + '=' + quoteAttributeValueForBrowser(id); | 4320 | node[internalInstanceKey] = hostInst; |
1752 | }, | 4321 | } |
1753 | 4322 | ||
1754 | setAttributeForID: function (node, id) { | 4323 | function uncacheNode(inst) { |
1755 | node.setAttribute(DOMProperty.ID_ATTRIBUTE_NAME, id); | 4324 | var node = inst._hostNode; |
1756 | }, | 4325 | if (node) { |
4326 | delete node[internalInstanceKey]; | ||
4327 | inst._hostNode = null; | ||
4328 | } | ||
4329 | } | ||
1757 | 4330 | ||
1758 | /** | 4331 | /** |
1759 | * Creates markup for a property. | 4332 | * Populate `_hostNode` on each child of `inst`, assuming that the children |
1760 | * | 4333 | * match up with the DOM (element) children of `node`. |
1761 | * @param {string} name | 4334 | * |
1762 | * @param {*} value | 4335 | * We cache entire levels at once to avoid an n^2 problem where we access the |
1763 | * @return {?string} Markup string, or null if the property was invalid. | 4336 | * children of a node sequentially and have to walk from the start to our target |
1764 | */ | 4337 | * node every time. |
1765 | createMarkupForProperty: function (name, value) { | 4338 | * |
1766 | var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null; | 4339 | * Since we update `_renderedChildren` and the actual DOM at (slightly) |
1767 | if (propertyInfo) { | 4340 | * different times, we could race here and see a newer `_renderedChildren` than |
1768 | if (shouldIgnoreValue(propertyInfo, value)) { | 4341 | * the DOM nodes we see. To avoid this, ReactMultiChild calls |
1769 | return ''; | 4342 | * `prepareToManageChildren` before we change `_renderedChildren`, at which |
1770 | } | 4343 | * time the container's child nodes are always cached (until it unmounts). |
1771 | var attributeName = propertyInfo.attributeName; | 4344 | */ |
1772 | if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) { | 4345 | function precacheChildNodes(inst, node) { |
1773 | return attributeName + '=""'; | 4346 | if (inst._flags & Flags.hasCachedChildNodes) { |
1774 | } | 4347 | return; |
1775 | return attributeName + '=' + quoteAttributeValueForBrowser(value); | 4348 | } |
1776 | } else if (DOMProperty.isCustomAttribute(name)) { | 4349 | var children = inst._renderedChildren; |
1777 | if (value == null) { | 4350 | var childNode = node.firstChild; |
1778 | return ''; | 4351 | outer: for (var name in children) { |
1779 | } | 4352 | if (!children.hasOwnProperty(name)) { |
1780 | return name + '=' + quoteAttributeValueForBrowser(value); | 4353 | continue; |
1781 | } else if (process.env.NODE_ENV !== 'production') { | ||
1782 | warnUnknownProperty(name); | ||
1783 | } | 4354 | } |
1784 | return null; | 4355 | var childInst = children[name]; |
1785 | }, | 4356 | var childID = getRenderedHostOrTextFromComponent(childInst)._domID; |
1786 | 4357 | if (childID == null) { | |
1787 | /** | 4358 | // We're currently unmounting this child in ReactMultiChild; skip it. |
1788 | * Creates markup for a custom property. | 4359 | continue; |
1789 | * | ||
1790 | * @param {string} name | ||
1791 | * @param {*} value | ||
1792 | * @return {string} Markup string, or empty string if the property was invalid. | ||
1793 | */ | ||
1794 | createMarkupForCustomAttribute: function (name, value) { | ||
1795 | if (!isAttributeNameSafe(name) || value == null) { | ||
1796 | return ''; | ||
1797 | } | 4360 | } |
1798 | return name + '=' + quoteAttributeValueForBrowser(value); | 4361 | // We assume the child nodes are in the same order as the child instances. |
1799 | }, | 4362 | for (; childNode !== null; childNode = childNode.nextSibling) { |
1800 | 4363 | if (childNode.nodeType === 1 && childNode.getAttribute(ATTR_NAME) === String(childID) || childNode.nodeType === 8 && childNode.nodeValue === ' react-text: ' + childID + ' ' || childNode.nodeType === 8 && childNode.nodeValue === ' react-empty: ' + childID + ' ') { | |
1801 | /** | 4364 | precacheNode(childInst, childNode); |
1802 | * Sets the value for a property on a node. | 4365 | continue outer; |
1803 | * | ||
1804 | * @param {DOMElement} node | ||
1805 | * @param {string} name | ||
1806 | * @param {*} value | ||
1807 | */ | ||
1808 | setValueForProperty: function (node, name, value) { | ||
1809 | var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null; | ||
1810 | if (propertyInfo) { | ||
1811 | var mutationMethod = propertyInfo.mutationMethod; | ||
1812 | if (mutationMethod) { | ||
1813 | mutationMethod(node, value); | ||
1814 | } else if (shouldIgnoreValue(propertyInfo, value)) { | ||
1815 | this.deleteValueForProperty(node, name); | ||
1816 | } else if (propertyInfo.mustUseAttribute) { | ||
1817 | var attributeName = propertyInfo.attributeName; | ||
1818 | var namespace = propertyInfo.attributeNamespace; | ||
1819 | // `setAttribute` with objects becomes only `[object]` in IE8/9, | ||
1820 | // ('' + value) makes it output the correct toString()-value. | ||
1821 | if (namespace) { | ||
1822 | node.setAttributeNS(namespace, attributeName, '' + value); | ||
1823 | } else if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) { | ||
1824 | node.setAttribute(attributeName, ''); | ||
1825 | } else { | ||
1826 | node.setAttribute(attributeName, '' + value); | ||
1827 | } | ||
1828 | } else { | ||
1829 | var propName = propertyInfo.propertyName; | ||
1830 | // Must explicitly cast values for HAS_SIDE_EFFECTS-properties to the | ||
1831 | // property type before comparing; only `value` does and is string. | ||
1832 | if (!propertyInfo.hasSideEffects || '' + node[propName] !== '' + value) { | ||
1833 | // Contrary to `setAttribute`, object properties are properly | ||
1834 | // `toString`ed by IE8/9. | ||
1835 | node[propName] = value; | ||
1836 | } | ||
1837 | } | 4366 | } |
1838 | } else if (DOMProperty.isCustomAttribute(name)) { | ||
1839 | DOMPropertyOperations.setValueForAttribute(node, name, value); | ||
1840 | } else if (process.env.NODE_ENV !== 'production') { | ||
1841 | warnUnknownProperty(name); | ||
1842 | } | 4367 | } |
1843 | }, | 4368 | // We reached the end of the DOM children without finding an ID match. |
4369 | true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Unable to find element with ID %s.', childID) : _prodInvariant('32', childID) : void 0; | ||
4370 | } | ||
4371 | inst._flags |= Flags.hasCachedChildNodes; | ||
4372 | } | ||
1844 | 4373 | ||
1845 | setValueForAttribute: function (node, name, value) { | 4374 | /** |
1846 | if (!isAttributeNameSafe(name)) { | 4375 | * Given a DOM node, return the closest ReactDOMComponent or |
1847 | return; | 4376 | * ReactDOMTextComponent instance ancestor. |
1848 | } | 4377 | */ |
1849 | if (value == null) { | 4378 | function getClosestInstanceFromNode(node) { |
1850 | node.removeAttribute(name); | 4379 | if (node[internalInstanceKey]) { |
4380 | return node[internalInstanceKey]; | ||
4381 | } | ||
4382 | |||
4383 | // Walk up the tree until we find an ancestor whose instance we have cached. | ||
4384 | var parents = []; | ||
4385 | while (!node[internalInstanceKey]) { | ||
4386 | parents.push(node); | ||
4387 | if (node.parentNode) { | ||
4388 | node = node.parentNode; | ||
1851 | } else { | 4389 | } else { |
1852 | node.setAttribute(name, '' + value); | 4390 | // Top of the tree. This node must not be part of a React tree (or is |
4391 | // unmounted, potentially). | ||
4392 | return null; | ||
1853 | } | 4393 | } |
1854 | }, | 4394 | } |
1855 | 4395 | ||
1856 | /** | 4396 | var closest; |
1857 | * Deletes the value for a property on a node. | 4397 | var inst; |
1858 | * | 4398 | for (; node && (inst = node[internalInstanceKey]); node = parents.pop()) { |
1859 | * @param {DOMElement} node | 4399 | closest = inst; |
1860 | * @param {string} name | 4400 | if (parents.length) { |
1861 | */ | 4401 | precacheChildNodes(inst, node); |
1862 | deleteValueForProperty: function (node, name) { | ||
1863 | var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null; | ||
1864 | if (propertyInfo) { | ||
1865 | var mutationMethod = propertyInfo.mutationMethod; | ||
1866 | if (mutationMethod) { | ||
1867 | mutationMethod(node, undefined); | ||
1868 | } else if (propertyInfo.mustUseAttribute) { | ||
1869 | node.removeAttribute(propertyInfo.attributeName); | ||
1870 | } else { | ||
1871 | var propName = propertyInfo.propertyName; | ||
1872 | var defaultValue = DOMProperty.getDefaultValueForProperty(node.nodeName, propName); | ||
1873 | if (!propertyInfo.hasSideEffects || '' + node[propName] !== defaultValue) { | ||
1874 | node[propName] = defaultValue; | ||
1875 | } | ||
1876 | } | ||
1877 | } else if (DOMProperty.isCustomAttribute(name)) { | ||
1878 | node.removeAttribute(name); | ||
1879 | } else if (process.env.NODE_ENV !== 'production') { | ||
1880 | warnUnknownProperty(name); | ||
1881 | } | 4402 | } |
1882 | } | 4403 | } |
1883 | 4404 | ||
1884 | }; | 4405 | return closest; |
4406 | } | ||
1885 | 4407 | ||
1886 | ReactPerf.measureMethods(DOMPropertyOperations, 'DOMPropertyOperations', { | 4408 | /** |
1887 | setValueForProperty: 'setValueForProperty', | 4409 | * Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent |
1888 | setValueForAttribute: 'setValueForAttribute', | 4410 | * instance, or null if the node was not rendered by this React. |
1889 | deleteValueForProperty: 'deleteValueForProperty' | 4411 | */ |
1890 | }); | 4412 | function getInstanceFromNode(node) { |
4413 | var inst = getClosestInstanceFromNode(node); | ||
4414 | if (inst != null && inst._hostNode === node) { | ||
4415 | return inst; | ||
4416 | } else { | ||
4417 | return null; | ||
4418 | } | ||
4419 | } | ||
1891 | 4420 | ||
1892 | module.exports = DOMPropertyOperations; | 4421 | /** |
1893 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | 4422 | * Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding |
4423 | * DOM node. | ||
4424 | */ | ||
4425 | function getNodeFromInstance(inst) { | ||
4426 | // Without this first invariant, passing a non-DOM-component triggers the next | ||
4427 | // invariant for a missing parent, which is super confusing. | ||
4428 | !(inst._hostNode !== undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0; | ||
4429 | |||
4430 | if (inst._hostNode) { | ||
4431 | return inst._hostNode; | ||
4432 | } | ||
4433 | |||
4434 | // Walk up the tree until we find an ancestor whose DOM node we have cached. | ||
4435 | var parents = []; | ||
4436 | while (!inst._hostNode) { | ||
4437 | parents.push(inst); | ||
4438 | !inst._hostParent ? process.env.NODE_ENV !== 'production' ? invariant(false, 'React DOM tree root should always have a node reference.') : _prodInvariant('34') : void 0; | ||
4439 | inst = inst._hostParent; | ||
4440 | } | ||
4441 | |||
4442 | // Now parents contains each ancestor that does *not* have a cached native | ||
4443 | // node, and `inst` is the deepest ancestor that does. | ||
4444 | for (; parents.length; inst = parents.pop()) { | ||
4445 | precacheChildNodes(inst, inst._hostNode); | ||
4446 | } | ||
4447 | |||
4448 | return inst._hostNode; | ||
4449 | } | ||
4450 | |||
4451 | var ReactDOMComponentTree = { | ||
4452 | getClosestInstanceFromNode: getClosestInstanceFromNode, | ||
4453 | getInstanceFromNode: getInstanceFromNode, | ||
4454 | getNodeFromInstance: getNodeFromInstance, | ||
4455 | precacheChildNodes: precacheChildNodes, | ||
4456 | precacheNode: precacheNode, | ||
4457 | uncacheNode: uncacheNode | ||
4458 | }; | ||
4459 | |||
4460 | module.exports = ReactDOMComponentTree; | ||
4461 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
1894 | 4462 | ||
1895 | /***/ }, | 4463 | /***/ }, |
1896 | /* 25 */ | 4464 | /* 40 */ |
1897 | /***/ function(module, exports, __webpack_require__) { | 4465 | /***/ function(module, exports, __webpack_require__) { |
1898 | 4466 | ||
1899 | /* WEBPACK VAR INJECTION */(function(process) {/** | 4467 | /* WEBPACK VAR INJECTION */(function(process) {/** |
1900 | * Copyright 2013-2015, Facebook, Inc. | 4468 | * Copyright 2013-present, Facebook, Inc. |
1901 | * All rights reserved. | 4469 | * All rights reserved. |
1902 | * | 4470 | * |
1903 | * This source code is licensed under the BSD-style license found in the | 4471 | * This source code is licensed under the BSD-style license found in the |
@@ -1905,12 +4473,13 @@ | |||
1905 | * of patent rights can be found in the PATENTS file in the same directory. | 4473 | * of patent rights can be found in the PATENTS file in the same directory. |
1906 | * | 4474 | * |
1907 | * @providesModule DOMProperty | 4475 | * @providesModule DOMProperty |
1908 | * @typechecks static-only | ||
1909 | */ | 4476 | */ |
1910 | 4477 | ||
1911 | 'use strict'; | 4478 | 'use strict'; |
1912 | 4479 | ||
1913 | var invariant = __webpack_require__(15); | 4480 | var _prodInvariant = __webpack_require__(9); |
4481 | |||
4482 | var invariant = __webpack_require__(10); | ||
1914 | 4483 | ||
1915 | function checkMask(value, bitmask) { | 4484 | function checkMask(value, bitmask) { |
1916 | return (value & bitmask) === bitmask; | 4485 | return (value & bitmask) === bitmask; |
@@ -1921,13 +4490,11 @@ | |||
1921 | * Mapping from normalized, camelcased property names to a configuration that | 4490 | * Mapping from normalized, camelcased property names to a configuration that |
1922 | * specifies how the associated DOM property should be accessed or rendered. | 4491 | * specifies how the associated DOM property should be accessed or rendered. |
1923 | */ | 4492 | */ |
1924 | MUST_USE_ATTRIBUTE: 0x1, | 4493 | MUST_USE_PROPERTY: 0x1, |
1925 | MUST_USE_PROPERTY: 0x2, | 4494 | HAS_BOOLEAN_VALUE: 0x4, |
1926 | HAS_SIDE_EFFECTS: 0x4, | 4495 | HAS_NUMERIC_VALUE: 0x8, |
1927 | HAS_BOOLEAN_VALUE: 0x8, | 4496 | HAS_POSITIVE_NUMERIC_VALUE: 0x10 | 0x8, |
1928 | HAS_NUMERIC_VALUE: 0x10, | 4497 | HAS_OVERLOADED_BOOLEAN_VALUE: 0x20, |
1929 | HAS_POSITIVE_NUMERIC_VALUE: 0x20 | 0x10, | ||
1930 | HAS_OVERLOADED_BOOLEAN_VALUE: 0x40, | ||
1931 | 4498 | ||
1932 | /** | 4499 | /** |
1933 | * Inject some specialized knowledge about the DOM. This takes a config object | 4500 | * Inject some specialized knowledge about the DOM. This takes a config object |
@@ -1970,7 +4537,7 @@ | |||
1970 | } | 4537 | } |
1971 | 4538 | ||
1972 | for (var propName in Properties) { | 4539 | for (var propName in Properties) { |
1973 | !!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) : invariant(false) : undefined; | 4540 | !!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; |
1974 | 4541 | ||
1975 | var lowerCased = propName.toLowerCase(); | 4542 | var lowerCased = propName.toLowerCase(); |
1976 | var propConfig = Properties[propName]; | 4543 | var propConfig = Properties[propName]; |
@@ -1981,18 +4548,13 @@ | |||
1981 | propertyName: propName, | 4548 | propertyName: propName, |
1982 | mutationMethod: null, | 4549 | mutationMethod: null, |
1983 | 4550 | ||
1984 | mustUseAttribute: checkMask(propConfig, Injection.MUST_USE_ATTRIBUTE), | ||
1985 | mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY), | 4551 | mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY), |
1986 | hasSideEffects: checkMask(propConfig, Injection.HAS_SIDE_EFFECTS), | ||
1987 | hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE), | 4552 | hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE), |
1988 | hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE), | 4553 | hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE), |
1989 | hasPositiveNumericValue: checkMask(propConfig, Injection.HAS_POSITIVE_NUMERIC_VALUE), | 4554 | hasPositiveNumericValue: checkMask(propConfig, Injection.HAS_POSITIVE_NUMERIC_VALUE), |
1990 | hasOverloadedBooleanValue: checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE) | 4555 | hasOverloadedBooleanValue: checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE) |
1991 | }; | 4556 | }; |
1992 | 4557 | !(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; | |
1993 | !(!propertyInfo.mustUseAttribute || !propertyInfo.mustUseProperty) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'DOMProperty: Cannot require using both attribute and property: %s', propName) : invariant(false) : undefined; | ||
1994 | !(propertyInfo.mustUseProperty || !propertyInfo.hasSideEffects) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'DOMProperty: Properties that have side effects must use property: %s', propName) : invariant(false) : undefined; | ||
1995 | !(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) : invariant(false) : undefined; | ||
1996 | 4558 | ||
1997 | if (process.env.NODE_ENV !== 'production') { | 4559 | if (process.env.NODE_ENV !== 'production') { |
1998 | DOMProperty.getPossibleStandardName[lowerCased] = propName; | 4560 | DOMProperty.getPossibleStandardName[lowerCased] = propName; |
@@ -2022,7 +4584,10 @@ | |||
2022 | } | 4584 | } |
2023 | } | 4585 | } |
2024 | }; | 4586 | }; |
2025 | var defaultValueCache = {}; | 4587 | |
4588 | /* eslint-disable max-len */ | ||
4589 | 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'; | ||
4590 | /* eslint-enable max-len */ | ||
2026 | 4591 | ||
2027 | /** | 4592 | /** |
2028 | * DOMProperty exports lookup objects that can be used like functions: | 4593 | * DOMProperty exports lookup objects that can be used like functions: |
@@ -2040,6 +4605,10 @@ | |||
2040 | var DOMProperty = { | 4605 | var DOMProperty = { |
2041 | 4606 | ||
2042 | ID_ATTRIBUTE_NAME: 'data-reactid', | 4607 | ID_ATTRIBUTE_NAME: 'data-reactid', |
4608 | ROOT_ATTRIBUTE_NAME: 'data-reactroot', | ||
4609 | |||
4610 | ATTRIBUTE_NAME_START_CHAR: ATTRIBUTE_NAME_START_CHAR, | ||
4611 | ATTRIBUTE_NAME_CHAR: ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040', | ||
2043 | 4612 | ||
2044 | /** | 4613 | /** |
2045 | * Map from property "standard name" to an object with info about how to set | 4614 | * Map from property "standard name" to an object with info about how to set |
@@ -2054,16 +4623,8 @@ | |||
2054 | * mutationMethod: | 4623 | * mutationMethod: |
2055 | * If non-null, used instead of the property or `setAttribute()` after | 4624 | * If non-null, used instead of the property or `setAttribute()` after |
2056 | * initial render. | 4625 | * initial render. |
2057 | * mustUseAttribute: | ||
2058 | * Whether the property must be accessed and mutated using `*Attribute()`. | ||
2059 | * (This includes anything that fails `<propName> in <element>`.) | ||
2060 | * mustUseProperty: | 4626 | * mustUseProperty: |
2061 | * Whether the property must be accessed and mutated as an object property. | 4627 | * Whether the property must be accessed and mutated as an object property. |
2062 | * hasSideEffects: | ||
2063 | * Whether or not setting a value causes side effects such as triggering | ||
2064 | * resources to be loaded or text selection changes. If true, we read from | ||
2065 | * the DOM before updating to ensure that the value is only set if it has | ||
2066 | * changed. | ||
2067 | * hasBooleanValue: | 4628 | * hasBooleanValue: |
2068 | * Whether the property should be removed when set to a falsey value. | 4629 | * Whether the property should be removed when set to a falsey value. |
2069 | * hasNumericValue: | 4630 | * hasNumericValue: |
@@ -2105,1464 +4666,523 @@ | |||
2105 | return false; | 4666 | return false; |
2106 | }, | 4667 | }, |
2107 | 4668 | ||
2108 | /** | ||
2109 | * Returns the default property value for a DOM property (i.e., not an | ||
2110 | * attribute). Most default values are '' or false, but not all. Worse yet, | ||
2111 | * some (in particular, `type`) vary depending on the type of element. | ||
2112 | * | ||
2113 | * TODO: Is it better to grab all the possible properties when creating an | ||
2114 | * element to avoid having to create the same element twice? | ||
2115 | */ | ||
2116 | getDefaultValueForProperty: function (nodeName, prop) { | ||
2117 | var nodeDefaults = defaultValueCache[nodeName]; | ||
2118 | var testElement; | ||
2119 | if (!nodeDefaults) { | ||
2120 | defaultValueCache[nodeName] = nodeDefaults = {}; | ||
2121 | } | ||
2122 | if (!(prop in nodeDefaults)) { | ||
2123 | testElement = document.createElement(nodeName); | ||
2124 | nodeDefaults[prop] = testElement[prop]; | ||
2125 | } | ||
2126 | return nodeDefaults[prop]; | ||
2127 | }, | ||
2128 | |||
2129 | injection: DOMPropertyInjection | 4669 | injection: DOMPropertyInjection |
2130 | }; | 4670 | }; |
2131 | 4671 | ||
2132 | module.exports = DOMProperty; | 4672 | module.exports = DOMProperty; |
2133 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | 4673 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) |
2134 | 4674 | ||
2135 | /***/ }, | 4675 | /***/ }, |
2136 | /* 26 */ | 4676 | /* 41 */ |
2137 | /***/ function(module, exports, __webpack_require__) { | 4677 | /***/ function(module, exports) { |
2138 | 4678 | ||
2139 | /** | 4679 | /** |
2140 | * Copyright 2013-2015, Facebook, Inc. | 4680 | * Copyright 2015-present, Facebook, Inc. |
2141 | * All rights reserved. | ||
2142 | * | ||
2143 | * This source code is licensed under the BSD-style license found in the | ||
2144 | * LICENSE file in the root directory of this source tree. An additional grant | ||
2145 | * of patent rights can be found in the PATENTS file in the same directory. | ||
2146 | * | ||
2147 | * @providesModule quoteAttributeValueForBrowser | ||
2148 | */ | ||
2149 | |||
2150 | 'use strict'; | ||
2151 | |||
2152 | var escapeTextContentForBrowser = __webpack_require__(23); | ||
2153 | |||
2154 | /** | ||
2155 | * Escapes attribute value to prevent scripting attacks. | ||
2156 | * | ||
2157 | * @param {*} value Value to escape. | ||
2158 | * @return {string} An escaped string. | ||
2159 | */ | ||
2160 | function quoteAttributeValueForBrowser(value) { | ||
2161 | return '"' + escapeTextContentForBrowser(value) + '"'; | ||
2162 | } | ||
2163 | |||
2164 | module.exports = quoteAttributeValueForBrowser; | ||
2165 | |||
2166 | /***/ }, | ||
2167 | /* 27 */ | ||
2168 | /***/ function(module, exports, __webpack_require__) { | ||
2169 | |||
2170 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
2171 | * Copyright 2014-2015, Facebook, Inc. | ||
2172 | * All rights reserved. | 4681 | * All rights reserved. |
2173 | * | 4682 | * |
2174 | * This source code is licensed under the BSD-style license found in the | 4683 | * This source code is licensed under the BSD-style license found in the |
2175 | * LICENSE file in the root directory of this source tree. An additional grant | 4684 | * LICENSE file in the root directory of this source tree. An additional grant |
2176 | * of patent rights can be found in the PATENTS file in the same directory. | 4685 | * of patent rights can be found in the PATENTS file in the same directory. |
2177 | * | 4686 | * |
2178 | * @providesModule warning | 4687 | * @providesModule ReactDOMComponentFlags |
2179 | */ | 4688 | */ |
2180 | 4689 | ||
2181 | 'use strict'; | 4690 | 'use strict'; |
2182 | 4691 | ||
2183 | var emptyFunction = __webpack_require__(17); | 4692 | var ReactDOMComponentFlags = { |
2184 | 4693 | hasCachedChildNodes: 1 << 0 | |
2185 | /** | 4694 | }; |
2186 | * Similar to invariant but only logs a warning if the condition is not met. | ||
2187 | * This can be used to log issues in development environments in critical | ||
2188 | * paths. Removing the logging code for production environments will keep the | ||
2189 | * same logic and follow the same code paths. | ||
2190 | */ | ||
2191 | |||
2192 | var warning = emptyFunction; | ||
2193 | |||
2194 | if (process.env.NODE_ENV !== 'production') { | ||
2195 | warning = function (condition, format) { | ||
2196 | for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { | ||
2197 | args[_key - 2] = arguments[_key]; | ||
2198 | } | ||
2199 | |||
2200 | if (format === undefined) { | ||
2201 | throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument'); | ||
2202 | } | ||
2203 | |||
2204 | if (format.indexOf('Failed Composite propType: ') === 0) { | ||
2205 | return; // Ignore CompositeComponent proptype check. | ||
2206 | } | ||
2207 | |||
2208 | if (!condition) { | ||
2209 | var argIndex = 0; | ||
2210 | var message = 'Warning: ' + format.replace(/%s/g, function () { | ||
2211 | return args[argIndex++]; | ||
2212 | }); | ||
2213 | if (typeof console !== 'undefined') { | ||
2214 | console.error(message); | ||
2215 | } | ||
2216 | try { | ||
2217 | // --- Welcome to debugging React --- | ||
2218 | // This error was thrown as a convenience so that you can use this stack | ||
2219 | // to find the callsite that caused this warning to fire. | ||
2220 | throw new Error(message); | ||
2221 | } catch (x) {} | ||
2222 | } | ||
2223 | }; | ||
2224 | } | ||
2225 | 4695 | ||
2226 | module.exports = warning; | 4696 | module.exports = ReactDOMComponentFlags; |
2227 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
2228 | 4697 | ||
2229 | /***/ }, | 4698 | /***/ }, |
2230 | /* 28 */ | 4699 | /* 42 */ |
2231 | /***/ function(module, exports, __webpack_require__) { | 4700 | /***/ function(module, exports, __webpack_require__) { |
2232 | 4701 | ||
2233 | /** | 4702 | /** |
2234 | * Copyright 2013-2015, Facebook, Inc. | 4703 | * Copyright 2013-present, Facebook, Inc. |
2235 | * All rights reserved. | 4704 | * All rights reserved. |
2236 | * | 4705 | * |
2237 | * This source code is licensed under the BSD-style license found in the | 4706 | * This source code is licensed under the BSD-style license found in the |
2238 | * LICENSE file in the root directory of this source tree. An additional grant | 4707 | * LICENSE file in the root directory of this source tree. An additional grant |
2239 | * of patent rights can be found in the PATENTS file in the same directory. | 4708 | * of patent rights can be found in the PATENTS file in the same directory. |
2240 | * | 4709 | * |
2241 | * @providesModule ReactComponentBrowserEnvironment | 4710 | * @providesModule ReactDefaultInjection |
2242 | */ | 4711 | */ |
2243 | 4712 | ||
2244 | 'use strict'; | 4713 | 'use strict'; |
2245 | 4714 | ||
2246 | var ReactDOMIDOperations = __webpack_require__(29); | 4715 | var BeforeInputEventPlugin = __webpack_require__(43); |
2247 | var ReactMount = __webpack_require__(30); | 4716 | var ChangeEventPlugin = __webpack_require__(58); |
4717 | var DefaultEventPluginOrder = __webpack_require__(76); | ||
4718 | var EnterLeaveEventPlugin = __webpack_require__(77); | ||
4719 | var HTMLDOMPropertyConfig = __webpack_require__(82); | ||
4720 | var ReactComponentBrowserEnvironment = __webpack_require__(83); | ||
4721 | var ReactDOMComponent = __webpack_require__(97); | ||
4722 | var ReactDOMComponentTree = __webpack_require__(39); | ||
4723 | var ReactDOMEmptyComponent = __webpack_require__(140); | ||
4724 | var ReactDOMTreeTraversal = __webpack_require__(141); | ||
4725 | var ReactDOMTextComponent = __webpack_require__(142); | ||
4726 | var ReactDefaultBatchingStrategy = __webpack_require__(143); | ||
4727 | var ReactEventListener = __webpack_require__(144); | ||
4728 | var ReactInjection = __webpack_require__(147); | ||
4729 | var ReactReconcileTransaction = __webpack_require__(148); | ||
4730 | var SVGDOMPropertyConfig = __webpack_require__(156); | ||
4731 | var SelectEventPlugin = __webpack_require__(157); | ||
4732 | var SimpleEventPlugin = __webpack_require__(158); | ||
2248 | 4733 | ||
2249 | /** | 4734 | var alreadyInjected = false; |
2250 | * Abstracts away all functionality of the reconciler that requires knowledge of | ||
2251 | * the browser context. TODO: These callers should be refactored to avoid the | ||
2252 | * need for this injection. | ||
2253 | */ | ||
2254 | var ReactComponentBrowserEnvironment = { | ||
2255 | 4735 | ||
2256 | processChildrenUpdates: ReactDOMIDOperations.dangerouslyProcessChildrenUpdates, | 4736 | function inject() { |
4737 | if (alreadyInjected) { | ||
4738 | // TODO: This is currently true because these injections are shared between | ||
4739 | // the client and the server package. They should be built independently | ||
4740 | // and not share any injection state. Then this problem will be solved. | ||
4741 | return; | ||
4742 | } | ||
4743 | alreadyInjected = true; | ||
2257 | 4744 | ||
2258 | replaceNodeWithMarkupByID: ReactDOMIDOperations.dangerouslyReplaceNodeWithMarkupByID, | 4745 | ReactInjection.EventEmitter.injectReactEventListener(ReactEventListener); |
2259 | 4746 | ||
2260 | /** | 4747 | /** |
2261 | * If a particular environment requires that some resources be cleaned up, | 4748 | * Inject modules for resolving DOM hierarchy and plugin ordering. |
2262 | * specify this in the injected Mixin. In the DOM, we would likely want to | ||
2263 | * purge any cached node ID lookups. | ||
2264 | * | ||
2265 | * @private | ||
2266 | */ | 4749 | */ |
2267 | unmountIDFromEnvironment: function (rootNodeID) { | 4750 | ReactInjection.EventPluginHub.injectEventPluginOrder(DefaultEventPluginOrder); |
2268 | ReactMount.purgeID(rootNodeID); | 4751 | ReactInjection.EventPluginUtils.injectComponentTree(ReactDOMComponentTree); |
2269 | } | 4752 | ReactInjection.EventPluginUtils.injectTreeTraversal(ReactDOMTreeTraversal); |
2270 | |||
2271 | }; | ||
2272 | |||
2273 | module.exports = ReactComponentBrowserEnvironment; | ||
2274 | |||
2275 | /***/ }, | ||
2276 | /* 29 */ | ||
2277 | /***/ function(module, exports, __webpack_require__) { | ||
2278 | |||
2279 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
2280 | * Copyright 2013-2015, Facebook, Inc. | ||
2281 | * All rights reserved. | ||
2282 | * | ||
2283 | * This source code is licensed under the BSD-style license found in the | ||
2284 | * LICENSE file in the root directory of this source tree. An additional grant | ||
2285 | * of patent rights can be found in the PATENTS file in the same directory. | ||
2286 | * | ||
2287 | * @providesModule ReactDOMIDOperations | ||
2288 | * @typechecks static-only | ||
2289 | */ | ||
2290 | |||
2291 | 'use strict'; | ||
2292 | 4753 | ||
2293 | var DOMChildrenOperations = __webpack_require__(9); | 4754 | /** |
2294 | var DOMPropertyOperations = __webpack_require__(24); | 4755 | * Some important event plugins included by default (without having to require |
2295 | var ReactMount = __webpack_require__(30); | 4756 | * them). |
2296 | var ReactPerf = __webpack_require__(20); | 4757 | */ |
4758 | ReactInjection.EventPluginHub.injectEventPluginsByName({ | ||
4759 | SimpleEventPlugin: SimpleEventPlugin, | ||
4760 | EnterLeaveEventPlugin: EnterLeaveEventPlugin, | ||
4761 | ChangeEventPlugin: ChangeEventPlugin, | ||
4762 | SelectEventPlugin: SelectEventPlugin, | ||
4763 | BeforeInputEventPlugin: BeforeInputEventPlugin | ||
4764 | }); | ||
2297 | 4765 | ||
2298 | var invariant = __webpack_require__(15); | 4766 | ReactInjection.HostComponent.injectGenericComponentClass(ReactDOMComponent); |
2299 | 4767 | ||
2300 | /** | 4768 | ReactInjection.HostComponent.injectTextComponentClass(ReactDOMTextComponent); |
2301 | * Errors for properties that should not be updated with `updatePropertyByID()`. | ||
2302 | * | ||
2303 | * @type {object} | ||
2304 | * @private | ||
2305 | */ | ||
2306 | var INVALID_PROPERTY_ERRORS = { | ||
2307 | dangerouslySetInnerHTML: '`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.', | ||
2308 | style: '`style` must be set using `updateStylesByID()`.' | ||
2309 | }; | ||
2310 | 4769 | ||
2311 | /** | 4770 | ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig); |
2312 | * Operations used to process updates to DOM nodes. | 4771 | ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig); |
2313 | */ | ||
2314 | var ReactDOMIDOperations = { | ||
2315 | 4772 | ||
2316 | /** | 4773 | ReactInjection.EmptyComponent.injectEmptyComponentFactory(function (instantiate) { |
2317 | * Updates a DOM node with new property values. This should only be used to | 4774 | return new ReactDOMEmptyComponent(instantiate); |
2318 | * update DOM properties in `DOMProperty`. | 4775 | }); |
2319 | * | ||
2320 | * @param {string} id ID of the node to update. | ||
2321 | * @param {string} name A valid property name, see `DOMProperty`. | ||
2322 | * @param {*} value New value of the property. | ||
2323 | * @internal | ||
2324 | */ | ||
2325 | updatePropertyByID: function (id, name, value) { | ||
2326 | var node = ReactMount.getNode(id); | ||
2327 | !!INVALID_PROPERTY_ERRORS.hasOwnProperty(name) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'updatePropertyByID(...): %s', INVALID_PROPERTY_ERRORS[name]) : invariant(false) : undefined; | ||
2328 | 4776 | ||
2329 | // If we're updating to null or undefined, we should remove the property | 4777 | ReactInjection.Updates.injectReconcileTransaction(ReactReconcileTransaction); |
2330 | // from the DOM node instead of inadvertantly setting to a string. This | 4778 | ReactInjection.Updates.injectBatchingStrategy(ReactDefaultBatchingStrategy); |
2331 | // brings us in line with the same behavior we have on initial render. | ||
2332 | if (value != null) { | ||
2333 | DOMPropertyOperations.setValueForProperty(node, name, value); | ||
2334 | } else { | ||
2335 | DOMPropertyOperations.deleteValueForProperty(node, name); | ||
2336 | } | ||
2337 | }, | ||
2338 | 4779 | ||
2339 | /** | 4780 | ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment); |
2340 | * Replaces a DOM node that exists in the document with markup. | 4781 | } |
2341 | * | ||
2342 | * @param {string} id ID of child to be replaced. | ||
2343 | * @param {string} markup Dangerous markup to inject in place of child. | ||
2344 | * @internal | ||
2345 | * @see {Danger.dangerouslyReplaceNodeWithMarkup} | ||
2346 | */ | ||
2347 | dangerouslyReplaceNodeWithMarkupByID: function (id, markup) { | ||
2348 | var node = ReactMount.getNode(id); | ||
2349 | DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup(node, markup); | ||
2350 | }, | ||
2351 | 4782 | ||
2352 | /** | 4783 | module.exports = { |
2353 | * Updates a component's children by processing a series of updates. | 4784 | inject: inject |
2354 | * | ||
2355 | * @param {array<object>} updates List of update configurations. | ||
2356 | * @param {array<string>} markup List of markup strings. | ||
2357 | * @internal | ||
2358 | */ | ||
2359 | dangerouslyProcessChildrenUpdates: function (updates, markup) { | ||
2360 | for (var i = 0; i < updates.length; i++) { | ||
2361 | updates[i].parentNode = ReactMount.getNode(updates[i].parentID); | ||
2362 | } | ||
2363 | DOMChildrenOperations.processUpdates(updates, markup); | ||
2364 | } | ||
2365 | }; | 4785 | }; |
2366 | |||
2367 | ReactPerf.measureMethods(ReactDOMIDOperations, 'ReactDOMIDOperations', { | ||
2368 | dangerouslyReplaceNodeWithMarkupByID: 'dangerouslyReplaceNodeWithMarkupByID', | ||
2369 | dangerouslyProcessChildrenUpdates: 'dangerouslyProcessChildrenUpdates' | ||
2370 | }); | ||
2371 | |||
2372 | module.exports = ReactDOMIDOperations; | ||
2373 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
2374 | 4786 | ||
2375 | /***/ }, | 4787 | /***/ }, |
2376 | /* 30 */ | 4788 | /* 43 */ |
2377 | /***/ function(module, exports, __webpack_require__) { | 4789 | /***/ function(module, exports, __webpack_require__) { |
2378 | 4790 | ||
2379 | /* WEBPACK VAR INJECTION */(function(process) {/** | 4791 | /** |
2380 | * Copyright 2013-2015, Facebook, Inc. | 4792 | * Copyright 2013-present Facebook, Inc. |
2381 | * All rights reserved. | 4793 | * All rights reserved. |
2382 | * | 4794 | * |
2383 | * This source code is licensed under the BSD-style license found in the | 4795 | * This source code is licensed under the BSD-style license found in the |
2384 | * LICENSE file in the root directory of this source tree. An additional grant | 4796 | * LICENSE file in the root directory of this source tree. An additional grant |
2385 | * of patent rights can be found in the PATENTS file in the same directory. | 4797 | * of patent rights can be found in the PATENTS file in the same directory. |
2386 | * | 4798 | * |
2387 | * @providesModule ReactMount | 4799 | * @providesModule BeforeInputEventPlugin |
2388 | */ | 4800 | */ |
2389 | 4801 | ||
2390 | 'use strict'; | 4802 | 'use strict'; |
2391 | 4803 | ||
2392 | var DOMProperty = __webpack_require__(25); | 4804 | var EventConstants = __webpack_require__(44); |
2393 | var ReactBrowserEventEmitter = __webpack_require__(31); | 4805 | var EventPropagators = __webpack_require__(45); |
2394 | var ReactCurrentOwner = __webpack_require__(7); | 4806 | var ExecutionEnvironment = __webpack_require__(52); |
2395 | var ReactDOMFeatureFlags = __webpack_require__(43); | 4807 | var FallbackCompositionState = __webpack_require__(53); |
2396 | var ReactElement = __webpack_require__(44); | 4808 | var SyntheticCompositionEvent = __webpack_require__(55); |
2397 | var ReactEmptyComponentRegistry = __webpack_require__(46); | 4809 | var SyntheticInputEvent = __webpack_require__(57); |
2398 | var ReactInstanceHandles = __webpack_require__(47); | ||
2399 | var ReactInstanceMap = __webpack_require__(49); | ||
2400 | var ReactMarkupChecksum = __webpack_require__(50); | ||
2401 | var ReactPerf = __webpack_require__(20); | ||
2402 | var ReactReconciler = __webpack_require__(52); | ||
2403 | var ReactUpdateQueue = __webpack_require__(55); | ||
2404 | var ReactUpdates = __webpack_require__(56); | ||
2405 | |||
2406 | var assign = __webpack_require__(41); | ||
2407 | var emptyObject = __webpack_require__(60); | ||
2408 | var containsNode = __webpack_require__(61); | ||
2409 | var instantiateReactComponent = __webpack_require__(64); | ||
2410 | var invariant = __webpack_require__(15); | ||
2411 | var setInnerHTML = __webpack_require__(21); | ||
2412 | var shouldUpdateReactComponent = __webpack_require__(69); | ||
2413 | var validateDOMNesting = __webpack_require__(72); | ||
2414 | var warning = __webpack_require__(27); | ||
2415 | 4810 | ||
2416 | var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME; | 4811 | var keyOf = __webpack_require__(27); |
2417 | var nodeCache = {}; | ||
2418 | |||
2419 | var ELEMENT_NODE_TYPE = 1; | ||
2420 | var DOC_NODE_TYPE = 9; | ||
2421 | var DOCUMENT_FRAGMENT_NODE_TYPE = 11; | ||
2422 | 4812 | ||
2423 | var ownerDocumentContextKey = '__ReactMount_ownerDocument$' + Math.random().toString(36).slice(2); | 4813 | var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space |
2424 | 4814 | var START_KEYCODE = 229; | |
2425 | /** Mapping from reactRootID to React component instance. */ | ||
2426 | var instancesByReactRootID = {}; | ||
2427 | 4815 | ||
2428 | /** Mapping from reactRootID to `container` nodes. */ | 4816 | var canUseCompositionEvent = ExecutionEnvironment.canUseDOM && 'CompositionEvent' in window; |
2429 | var containersByReactRootID = {}; | ||
2430 | 4817 | ||
2431 | if (process.env.NODE_ENV !== 'production') { | 4818 | var documentMode = null; |
2432 | /** __DEV__-only mapping from reactRootID to root elements. */ | 4819 | if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) { |
2433 | var rootElementsByReactRootID = {}; | 4820 | documentMode = document.documentMode; |
2434 | } | 4821 | } |
2435 | 4822 | ||
2436 | // Used to store breadth-first search state in findComponentRoot. | 4823 | // Webkit offers a very useful `textInput` event that can be used to |
2437 | var findComponentRootReusableArray = []; | 4824 | // directly represent `beforeInput`. The IE `textinput` event is not as |
4825 | // useful, so we don't use it. | ||
4826 | var canUseTextInputEvent = ExecutionEnvironment.canUseDOM && 'TextEvent' in window && !documentMode && !isPresto(); | ||
2438 | 4827 | ||
2439 | /** | 4828 | // In IE9+, we have access to composition events, but the data supplied |
2440 | * Finds the index of the first character | 4829 | // by the native compositionend event may be incorrect. Japanese ideographic |
2441 | * that's not common between the two given strings. | 4830 | // spaces, for instance (\u3000) are not recorded correctly. |
2442 | * | 4831 | var useFallbackCompositionData = ExecutionEnvironment.canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11); |
2443 | * @return {number} the index of the character where the strings diverge | ||
2444 | */ | ||
2445 | function firstDifferenceIndex(string1, string2) { | ||
2446 | var minLen = Math.min(string1.length, string2.length); | ||
2447 | for (var i = 0; i < minLen; i++) { | ||
2448 | if (string1.charAt(i) !== string2.charAt(i)) { | ||
2449 | return i; | ||
2450 | } | ||
2451 | } | ||
2452 | return string1.length === string2.length ? -1 : minLen; | ||
2453 | } | ||
2454 | 4832 | ||
2455 | /** | 4833 | /** |
2456 | * @param {DOMElement|DOMDocument} container DOM element that may contain | 4834 | * Opera <= 12 includes TextEvent in window, but does not fire |
2457 | * a React component | 4835 | * text input events. Rely on keypress instead. |
2458 | * @return {?*} DOM element that may have the reactRoot ID, or null. | ||
2459 | */ | 4836 | */ |
2460 | function getReactRootElementInContainer(container) { | 4837 | function isPresto() { |
2461 | if (!container) { | 4838 | var opera = window.opera; |
2462 | return null; | 4839 | return typeof opera === 'object' && typeof opera.version === 'function' && parseInt(opera.version(), 10) <= 12; |
2463 | } | ||
2464 | |||
2465 | if (container.nodeType === DOC_NODE_TYPE) { | ||
2466 | return container.documentElement; | ||
2467 | } else { | ||
2468 | return container.firstChild; | ||
2469 | } | ||
2470 | } | 4840 | } |
2471 | 4841 | ||
2472 | /** | 4842 | var SPACEBAR_CODE = 32; |
2473 | * @param {DOMElement} container DOM element that may contain a React component. | 4843 | var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE); |
2474 | * @return {?string} A "reactRoot" ID, if a React component is rendered. | ||
2475 | */ | ||
2476 | function getReactRootID(container) { | ||
2477 | var rootElement = getReactRootElementInContainer(container); | ||
2478 | return rootElement && ReactMount.getID(rootElement); | ||
2479 | } | ||
2480 | 4844 | ||
2481 | /** | 4845 | var topLevelTypes = EventConstants.topLevelTypes; |
2482 | * Accessing node[ATTR_NAME] or calling getAttribute(ATTR_NAME) on a form | ||
2483 | * element can return its control whose name or ID equals ATTR_NAME. All | ||
2484 | * DOM nodes support `getAttributeNode` but this can also get called on | ||
2485 | * other objects so just return '' if we're given something other than a | ||
2486 | * DOM node (such as window). | ||
2487 | * | ||
2488 | * @param {?DOMElement|DOMWindow|DOMDocument|DOMTextNode} node DOM node. | ||
2489 | * @return {string} ID of the supplied `domNode`. | ||
2490 | */ | ||
2491 | function getID(node) { | ||
2492 | var id = internalGetID(node); | ||
2493 | if (id) { | ||
2494 | if (nodeCache.hasOwnProperty(id)) { | ||
2495 | var cached = nodeCache[id]; | ||
2496 | if (cached !== node) { | ||
2497 | !!isValid(cached, id) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactMount: Two valid but unequal nodes with the same `%s`: %s', ATTR_NAME, id) : invariant(false) : undefined; | ||
2498 | 4846 | ||
2499 | nodeCache[id] = node; | 4847 | // Events and their corresponding property names. |
2500 | } | 4848 | var eventTypes = { |
2501 | } else { | 4849 | beforeInput: { |
2502 | nodeCache[id] = node; | 4850 | phasedRegistrationNames: { |
2503 | } | 4851 | bubbled: keyOf({ onBeforeInput: null }), |
4852 | captured: keyOf({ onBeforeInputCapture: null }) | ||
4853 | }, | ||
4854 | dependencies: [topLevelTypes.topCompositionEnd, topLevelTypes.topKeyPress, topLevelTypes.topTextInput, topLevelTypes.topPaste] | ||
4855 | }, | ||
4856 | compositionEnd: { | ||
4857 | phasedRegistrationNames: { | ||
4858 | bubbled: keyOf({ onCompositionEnd: null }), | ||
4859 | captured: keyOf({ onCompositionEndCapture: null }) | ||
4860 | }, | ||
4861 | dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionEnd, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown] | ||
4862 | }, | ||
4863 | compositionStart: { | ||
4864 | phasedRegistrationNames: { | ||
4865 | bubbled: keyOf({ onCompositionStart: null }), | ||
4866 | captured: keyOf({ onCompositionStartCapture: null }) | ||
4867 | }, | ||
4868 | dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionStart, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown] | ||
4869 | }, | ||
4870 | compositionUpdate: { | ||
4871 | phasedRegistrationNames: { | ||
4872 | bubbled: keyOf({ onCompositionUpdate: null }), | ||
4873 | captured: keyOf({ onCompositionUpdateCapture: null }) | ||
4874 | }, | ||
4875 | dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionUpdate, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown] | ||
2504 | } | 4876 | } |
4877 | }; | ||
2505 | 4878 | ||
2506 | return id; | 4879 | // Track whether we've ever handled a keypress on the space key. |
2507 | } | 4880 | var hasSpaceKeypress = false; |
2508 | |||
2509 | function internalGetID(node) { | ||
2510 | // If node is something like a window, document, or text node, none of | ||
2511 | // which support attributes or a .getAttribute method, gracefully return | ||
2512 | // the empty string, as if the attribute were missing. | ||
2513 | return node && node.getAttribute && node.getAttribute(ATTR_NAME) || ''; | ||
2514 | } | ||
2515 | 4881 | ||
2516 | /** | 4882 | /** |
2517 | * Sets the React-specific ID of the given node. | 4883 | * Return whether a native keypress event is assumed to be a command. |
2518 | * | 4884 | * This is required because Firefox fires `keypress` events for key commands |
2519 | * @param {DOMElement} node The DOM node whose ID will be set. | 4885 | * (cut, copy, select-all, etc.) even though no character is inserted. |
2520 | * @param {string} id The value of the ID attribute. | ||
2521 | */ | 4886 | */ |
2522 | function setID(node, id) { | 4887 | function isKeypressCommand(nativeEvent) { |
2523 | var oldID = internalGetID(node); | 4888 | return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) && |
2524 | if (oldID !== id) { | 4889 | // ctrlKey && altKey is equivalent to AltGr, and is not a command. |
2525 | delete nodeCache[oldID]; | 4890 | !(nativeEvent.ctrlKey && nativeEvent.altKey); |
2526 | } | ||
2527 | node.setAttribute(ATTR_NAME, id); | ||
2528 | nodeCache[id] = node; | ||
2529 | } | 4891 | } |
2530 | 4892 | ||
2531 | /** | 4893 | /** |
2532 | * Finds the node with the supplied React-generated DOM ID. | 4894 | * Translate native top level events into event types. |
2533 | * | 4895 | * |
2534 | * @param {string} id A React-generated DOM ID. | 4896 | * @param {string} topLevelType |
2535 | * @return {DOMElement} DOM node with the suppled `id`. | 4897 | * @return {object} |
2536 | * @internal | ||
2537 | */ | 4898 | */ |
2538 | function getNode(id) { | 4899 | function getCompositionEventType(topLevelType) { |
2539 | if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) { | 4900 | switch (topLevelType) { |
2540 | nodeCache[id] = ReactMount.findReactNodeByID(id); | 4901 | case topLevelTypes.topCompositionStart: |
4902 | return eventTypes.compositionStart; | ||
4903 | case topLevelTypes.topCompositionEnd: | ||
4904 | return eventTypes.compositionEnd; | ||
4905 | case topLevelTypes.topCompositionUpdate: | ||
4906 | return eventTypes.compositionUpdate; | ||
2541 | } | 4907 | } |
2542 | return nodeCache[id]; | ||
2543 | } | 4908 | } |
2544 | 4909 | ||
2545 | /** | 4910 | /** |
2546 | * Finds the node with the supplied public React instance. | 4911 | * Does our fallback best-guess model think this event signifies that |
4912 | * composition has begun? | ||
2547 | * | 4913 | * |
2548 | * @param {*} instance A public React instance. | 4914 | * @param {string} topLevelType |
2549 | * @return {?DOMElement} DOM node with the suppled `id`. | 4915 | * @param {object} nativeEvent |
2550 | * @internal | 4916 | * @return {boolean} |
2551 | */ | 4917 | */ |
2552 | function getNodeFromInstance(instance) { | 4918 | function isFallbackCompositionStart(topLevelType, nativeEvent) { |
2553 | var id = ReactInstanceMap.get(instance)._rootNodeID; | 4919 | return topLevelType === topLevelTypes.topKeyDown && nativeEvent.keyCode === START_KEYCODE; |
2554 | if (ReactEmptyComponentRegistry.isNullComponentID(id)) { | ||
2555 | return null; | ||
2556 | } | ||
2557 | if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) { | ||
2558 | nodeCache[id] = ReactMount.findReactNodeByID(id); | ||
2559 | } | ||
2560 | return nodeCache[id]; | ||
2561 | } | 4920 | } |
2562 | 4921 | ||
2563 | /** | 4922 | /** |
2564 | * A node is "valid" if it is contained by a currently mounted container. | 4923 | * Does our fallback mode think that this event is the end of composition? |
2565 | * | ||
2566 | * This means that the node does not have to be contained by a document in | ||
2567 | * order to be considered valid. | ||
2568 | * | 4924 | * |
2569 | * @param {?DOMElement} node The candidate DOM node. | 4925 | * @param {string} topLevelType |
2570 | * @param {string} id The expected ID of the node. | 4926 | * @param {object} nativeEvent |
2571 | * @return {boolean} Whether the node is contained by a mounted container. | 4927 | * @return {boolean} |
2572 | */ | 4928 | */ |
2573 | function isValid(node, id) { | 4929 | function isFallbackCompositionEnd(topLevelType, nativeEvent) { |
2574 | if (node) { | 4930 | switch (topLevelType) { |
2575 | !(internalGetID(node) === id) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactMount: Unexpected modification of `%s`', ATTR_NAME) : invariant(false) : undefined; | 4931 | case topLevelTypes.topKeyUp: |
2576 | 4932 | // Command keys insert or clear IME input. | |
2577 | var container = ReactMount.findReactContainerForID(id); | 4933 | return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1; |
2578 | if (container && containsNode(container, node)) { | 4934 | case topLevelTypes.topKeyDown: |
4935 | // Expect IME keyCode on each keydown. If we get any other | ||
4936 | // code we must have exited earlier. | ||
4937 | return nativeEvent.keyCode !== START_KEYCODE; | ||
4938 | case topLevelTypes.topKeyPress: | ||
4939 | case topLevelTypes.topMouseDown: | ||
4940 | case topLevelTypes.topBlur: | ||
4941 | // Events are not possible without cancelling IME. | ||
2579 | return true; | 4942 | return true; |
2580 | } | 4943 | default: |
2581 | } | 4944 | return false; |
2582 | |||
2583 | return false; | ||
2584 | } | ||
2585 | |||
2586 | /** | ||
2587 | * Causes the cache to forget about one React-specific ID. | ||
2588 | * | ||
2589 | * @param {string} id The ID to forget. | ||
2590 | */ | ||
2591 | function purgeID(id) { | ||
2592 | delete nodeCache[id]; | ||
2593 | } | ||
2594 | |||
2595 | var deepestNodeSoFar = null; | ||
2596 | function findDeepestCachedAncestorImpl(ancestorID) { | ||
2597 | var ancestor = nodeCache[ancestorID]; | ||
2598 | if (ancestor && isValid(ancestor, ancestorID)) { | ||
2599 | deepestNodeSoFar = ancestor; | ||
2600 | } else { | ||
2601 | // This node isn't populated in the cache, so presumably none of its | ||
2602 | // descendants are. Break out of the loop. | ||
2603 | return false; | ||
2604 | } | 4945 | } |
2605 | } | 4946 | } |
2606 | 4947 | ||
2607 | /** | 4948 | /** |
2608 | * Return the deepest cached node whose ID is a prefix of `targetID`. | 4949 | * Google Input Tools provides composition data via a CustomEvent, |
2609 | */ | 4950 | * with the `data` property populated in the `detail` object. If this |
2610 | function findDeepestCachedAncestor(targetID) { | 4951 | * is available on the event object, use it. If not, this is a plain |
2611 | deepestNodeSoFar = null; | 4952 | * composition event and we have nothing special to extract. |
2612 | ReactInstanceHandles.traverseAncestors(targetID, findDeepestCachedAncestorImpl); | ||
2613 | |||
2614 | var foundNode = deepestNodeSoFar; | ||
2615 | deepestNodeSoFar = null; | ||
2616 | return foundNode; | ||
2617 | } | ||
2618 | |||
2619 | /** | ||
2620 | * Mounts this component and inserts it into the DOM. | ||
2621 | * | 4953 | * |
2622 | * @param {ReactComponent} componentInstance The instance to mount. | 4954 | * @param {object} nativeEvent |
2623 | * @param {string} rootID DOM ID of the root node. | 4955 | * @return {?string} |
2624 | * @param {DOMElement} container DOM element to mount into. | ||
2625 | * @param {ReactReconcileTransaction} transaction | ||
2626 | * @param {boolean} shouldReuseMarkup If true, do not insert markup | ||
2627 | */ | 4956 | */ |
2628 | function mountComponentIntoNode(componentInstance, rootID, container, transaction, shouldReuseMarkup, context) { | 4957 | function getDataFromCustomEvent(nativeEvent) { |
2629 | if (ReactDOMFeatureFlags.useCreateElement) { | 4958 | var detail = nativeEvent.detail; |
2630 | context = assign({}, context); | 4959 | if (typeof detail === 'object' && 'data' in detail) { |
2631 | if (container.nodeType === DOC_NODE_TYPE) { | 4960 | return detail.data; |
2632 | context[ownerDocumentContextKey] = container; | ||
2633 | } else { | ||
2634 | context[ownerDocumentContextKey] = container.ownerDocument; | ||
2635 | } | ||
2636 | } | ||
2637 | if (process.env.NODE_ENV !== 'production') { | ||
2638 | if (context === emptyObject) { | ||
2639 | context = {}; | ||
2640 | } | ||
2641 | var tag = container.nodeName.toLowerCase(); | ||
2642 | context[validateDOMNesting.ancestorInfoContextKey] = validateDOMNesting.updatedAncestorInfo(null, tag, null); | ||
2643 | } | 4961 | } |
2644 | var markup = ReactReconciler.mountComponent(componentInstance, rootID, transaction, context); | 4962 | return null; |
2645 | componentInstance._renderedComponent._topLevelWrapper = componentInstance; | ||
2646 | ReactMount._mountImageIntoNode(markup, container, shouldReuseMarkup, transaction); | ||
2647 | } | 4963 | } |
2648 | 4964 | ||
2649 | /** | 4965 | // Track the current IME composition fallback object, if any. |
2650 | * Batched mount. | 4966 | var currentComposition = null; |
2651 | * | ||
2652 | * @param {ReactComponent} componentInstance The instance to mount. | ||
2653 | * @param {string} rootID DOM ID of the root node. | ||
2654 | * @param {DOMElement} container DOM element to mount into. | ||
2655 | * @param {boolean} shouldReuseMarkup If true, do not insert markup | ||
2656 | */ | ||
2657 | function batchedMountComponentIntoNode(componentInstance, rootID, container, shouldReuseMarkup, context) { | ||
2658 | var transaction = ReactUpdates.ReactReconcileTransaction.getPooled( | ||
2659 | /* forceHTML */shouldReuseMarkup); | ||
2660 | transaction.perform(mountComponentIntoNode, null, componentInstance, rootID, container, transaction, shouldReuseMarkup, context); | ||
2661 | ReactUpdates.ReactReconcileTransaction.release(transaction); | ||
2662 | } | ||
2663 | 4967 | ||
2664 | /** | 4968 | /** |
2665 | * Unmounts a component and removes it from the DOM. | 4969 | * @return {?object} A SyntheticCompositionEvent. |
2666 | * | ||
2667 | * @param {ReactComponent} instance React component instance. | ||
2668 | * @param {DOMElement} container DOM element to unmount from. | ||
2669 | * @final | ||
2670 | * @internal | ||
2671 | * @see {ReactMount.unmountComponentAtNode} | ||
2672 | */ | 4970 | */ |
2673 | function unmountComponentFromNode(instance, container) { | 4971 | function extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) { |
2674 | ReactReconciler.unmountComponent(instance); | 4972 | var eventType; |
4973 | var fallbackData; | ||
2675 | 4974 | ||
2676 | if (container.nodeType === DOC_NODE_TYPE) { | 4975 | if (canUseCompositionEvent) { |
2677 | container = container.documentElement; | 4976 | eventType = getCompositionEventType(topLevelType); |
4977 | } else if (!currentComposition) { | ||
4978 | if (isFallbackCompositionStart(topLevelType, nativeEvent)) { | ||
4979 | eventType = eventTypes.compositionStart; | ||
4980 | } | ||
4981 | } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) { | ||
4982 | eventType = eventTypes.compositionEnd; | ||
2678 | } | 4983 | } |
2679 | 4984 | ||
2680 | // http://jsperf.com/emptying-a-node | 4985 | if (!eventType) { |
2681 | while (container.lastChild) { | 4986 | return null; |
2682 | container.removeChild(container.lastChild); | ||
2683 | } | 4987 | } |
2684 | } | ||
2685 | 4988 | ||
2686 | /** | 4989 | if (useFallbackCompositionData) { |
2687 | * True if the supplied DOM node has a direct React-rendered child that is | 4990 | // The current composition is stored statically and must not be |
2688 | * not a React root element. Useful for warning in `render`, | 4991 | // overwritten while composition continues. |
2689 | * `unmountComponentAtNode`, etc. | 4992 | if (!currentComposition && eventType === eventTypes.compositionStart) { |
2690 | * | 4993 | currentComposition = FallbackCompositionState.getPooled(nativeEventTarget); |
2691 | * @param {?DOMElement} node The candidate DOM node. | 4994 | } else if (eventType === eventTypes.compositionEnd) { |
2692 | * @return {boolean} True if the DOM element contains a direct child that was | 4995 | if (currentComposition) { |
2693 | * rendered by React but is not a root element. | 4996 | fallbackData = currentComposition.getData(); |
2694 | * @internal | 4997 | } |
2695 | */ | ||
2696 | function hasNonRootReactChild(node) { | ||
2697 | var reactRootID = getReactRootID(node); | ||
2698 | return reactRootID ? reactRootID !== ReactInstanceHandles.getReactRootIDFromNodeID(reactRootID) : false; | ||
2699 | } | ||
2700 | |||
2701 | /** | ||
2702 | * Returns the first (deepest) ancestor of a node which is rendered by this copy | ||
2703 | * of React. | ||
2704 | */ | ||
2705 | function findFirstReactDOMImpl(node) { | ||
2706 | // This node might be from another React instance, so we make sure not to | ||
2707 | // examine the node cache here | ||
2708 | for (; node && node.parentNode !== node; node = node.parentNode) { | ||
2709 | if (node.nodeType !== 1) { | ||
2710 | // Not a DOMElement, therefore not a React component | ||
2711 | continue; | ||
2712 | } | ||
2713 | var nodeID = internalGetID(node); | ||
2714 | if (!nodeID) { | ||
2715 | continue; | ||
2716 | } | 4998 | } |
2717 | var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(nodeID); | 4999 | } |
2718 | 5000 | ||
2719 | // If containersByReactRootID contains the container we find by crawling up | 5001 | var event = SyntheticCompositionEvent.getPooled(eventType, targetInst, nativeEvent, nativeEventTarget); |
2720 | // the tree, we know that this instance of React rendered the node. | ||
2721 | // nb. isValid's strategy (with containsNode) does not work because render | ||
2722 | // trees may be nested and we don't want a false positive in that case. | ||
2723 | var current = node; | ||
2724 | var lastID; | ||
2725 | do { | ||
2726 | lastID = internalGetID(current); | ||
2727 | current = current.parentNode; | ||
2728 | if (current == null) { | ||
2729 | // The passed-in node has been detached from the container it was | ||
2730 | // originally rendered into. | ||
2731 | return null; | ||
2732 | } | ||
2733 | } while (lastID !== reactRootID); | ||
2734 | 5002 | ||
2735 | if (current === containersByReactRootID[reactRootID]) { | 5003 | if (fallbackData) { |
2736 | return node; | 5004 | // Inject data generated from fallback path into the synthetic event. |
5005 | // This matches the property of native CompositionEventInterface. | ||
5006 | event.data = fallbackData; | ||
5007 | } else { | ||
5008 | var customData = getDataFromCustomEvent(nativeEvent); | ||
5009 | if (customData !== null) { | ||
5010 | event.data = customData; | ||
2737 | } | 5011 | } |
2738 | } | 5012 | } |
2739 | return null; | ||
2740 | } | ||
2741 | 5013 | ||
2742 | /** | 5014 | EventPropagators.accumulateTwoPhaseDispatches(event); |
2743 | * Temporary (?) hack so that we can store all top-level pending updates on | 5015 | return event; |
2744 | * composites instead of having to worry about different types of components | ||
2745 | * here. | ||
2746 | */ | ||
2747 | var TopLevelWrapper = function () {}; | ||
2748 | TopLevelWrapper.prototype.isReactComponent = {}; | ||
2749 | if (process.env.NODE_ENV !== 'production') { | ||
2750 | TopLevelWrapper.displayName = 'TopLevelWrapper'; | ||
2751 | } | 5016 | } |
2752 | TopLevelWrapper.prototype.render = function () { | ||
2753 | // this.props is actually a ReactElement | ||
2754 | return this.props; | ||
2755 | }; | ||
2756 | 5017 | ||
2757 | /** | 5018 | /** |
2758 | * Mounting is the process of initializing a React component by creating its | 5019 | * @param {string} topLevelType Record from `EventConstants`. |
2759 | * representative DOM elements and inserting them into a supplied `container`. | 5020 | * @param {object} nativeEvent Native browser event. |
2760 | * Any prior content inside `container` is destroyed in the process. | 5021 | * @return {?string} The string corresponding to this `beforeInput` event. |
2761 | * | ||
2762 | * ReactMount.render( | ||
2763 | * component, | ||
2764 | * document.getElementById('container') | ||
2765 | * ); | ||
2766 | * | ||
2767 | * <div id="container"> <-- Supplied `container`. | ||
2768 | * <div data-reactid=".3"> <-- Rendered reactRoot of React | ||
2769 | * // ... component. | ||
2770 | * </div> | ||
2771 | * </div> | ||
2772 | * | ||
2773 | * Inside of `container`, the first element rendered is the "reactRoot". | ||
2774 | */ | 5022 | */ |
2775 | var ReactMount = { | 5023 | function getNativeBeforeInputChars(topLevelType, nativeEvent) { |
2776 | 5024 | switch (topLevelType) { | |
2777 | TopLevelWrapper: TopLevelWrapper, | 5025 | case topLevelTypes.topCompositionEnd: |
2778 | 5026 | return getDataFromCustomEvent(nativeEvent); | |
2779 | /** Exposed for debugging purposes **/ | 5027 | case topLevelTypes.topKeyPress: |
2780 | _instancesByReactRootID: instancesByReactRootID, | 5028 | /** |
2781 | 5029 | * If native `textInput` events are available, our goal is to make | |
2782 | /** | 5030 | * use of them. However, there is a special case: the spacebar key. |
2783 | * This is a hook provided to support rendering React components while | 5031 | * In Webkit, preventing default on a spacebar `textInput` event |
2784 | * ensuring that the apparent scroll position of its `container` does not | 5032 | * cancels character insertion, but it *also* causes the browser |
2785 | * change. | 5033 | * to fall back to its default spacebar behavior of scrolling the |
2786 | * | 5034 | * page. |
2787 | * @param {DOMElement} container The `container` being rendered into. | 5035 | * |
2788 | * @param {function} renderCallback This must be called once to do the render. | 5036 | * Tracking at: |
2789 | */ | 5037 | * https://code.google.com/p/chromium/issues/detail?id=355103 |
2790 | scrollMonitor: function (container, renderCallback) { | 5038 | * |
2791 | renderCallback(); | 5039 | * To avoid this issue, use the keypress event as if no `textInput` |
2792 | }, | 5040 | * event is available. |
2793 | 5041 | */ | |
2794 | /** | 5042 | var which = nativeEvent.which; |
2795 | * Take a component that's already mounted into the DOM and replace its props | 5043 | if (which !== SPACEBAR_CODE) { |
2796 | * @param {ReactComponent} prevComponent component instance already in the DOM | 5044 | return null; |
2797 | * @param {ReactElement} nextElement component instance to render | ||
2798 | * @param {DOMElement} container container to render into | ||
2799 | * @param {?function} callback function triggered on completion | ||
2800 | */ | ||
2801 | _updateRootComponent: function (prevComponent, nextElement, container, callback) { | ||
2802 | ReactMount.scrollMonitor(container, function () { | ||
2803 | ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement); | ||
2804 | if (callback) { | ||
2805 | ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback); | ||
2806 | } | ||
2807 | }); | ||
2808 | |||
2809 | if (process.env.NODE_ENV !== 'production') { | ||
2810 | // Record the root element in case it later gets transplanted. | ||
2811 | rootElementsByReactRootID[getReactRootID(container)] = getReactRootElementInContainer(container); | ||
2812 | } | ||
2813 | |||
2814 | return prevComponent; | ||
2815 | }, | ||
2816 | |||
2817 | /** | ||
2818 | * Register a component into the instance map and starts scroll value | ||
2819 | * monitoring | ||
2820 | * @param {ReactComponent} nextComponent component instance to render | ||
2821 | * @param {DOMElement} container container to render into | ||
2822 | * @return {string} reactRoot ID prefix | ||
2823 | */ | ||
2824 | _registerComponent: function (nextComponent, container) { | ||
2825 | !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '_registerComponent(...): Target container is not a DOM element.') : invariant(false) : undefined; | ||
2826 | |||
2827 | ReactBrowserEventEmitter.ensureScrollValueMonitoring(); | ||
2828 | |||
2829 | var reactRootID = ReactMount.registerContainer(container); | ||
2830 | instancesByReactRootID[reactRootID] = nextComponent; | ||
2831 | return reactRootID; | ||
2832 | }, | ||
2833 | |||
2834 | /** | ||
2835 | * Render a new component into the DOM. | ||
2836 | * @param {ReactElement} nextElement element to render | ||
2837 | * @param {DOMElement} container container to render into | ||
2838 | * @param {boolean} shouldReuseMarkup if we should skip the markup insertion | ||
2839 | * @return {ReactComponent} nextComponent | ||
2840 | */ | ||
2841 | _renderNewRootComponent: function (nextElement, container, shouldReuseMarkup, context) { | ||
2842 | // Various parts of our code (such as ReactCompositeComponent's | ||
2843 | // _renderValidatedComponent) assume that calls to render aren't nested; | ||
2844 | // verify that that's the case. | ||
2845 | 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') : undefined; | ||
2846 | |||
2847 | var componentInstance = instantiateReactComponent(nextElement, null); | ||
2848 | var reactRootID = ReactMount._registerComponent(componentInstance, container); | ||
2849 | |||
2850 | // The initial render is synchronous but any updates that happen during | ||
2851 | // rendering, in componentWillMount or componentDidMount, will be batched | ||
2852 | // according to the current batching strategy. | ||
2853 | |||
2854 | ReactUpdates.batchedUpdates(batchedMountComponentIntoNode, componentInstance, reactRootID, container, shouldReuseMarkup, context); | ||
2855 | |||
2856 | if (process.env.NODE_ENV !== 'production') { | ||
2857 | // Record the root element in case it later gets transplanted. | ||
2858 | rootElementsByReactRootID[reactRootID] = getReactRootElementInContainer(container); | ||
2859 | } | ||
2860 | |||
2861 | return componentInstance; | ||
2862 | }, | ||
2863 | |||
2864 | /** | ||
2865 | * Renders a React component into the DOM in the supplied `container`. | ||
2866 | * | ||
2867 | * If the React component was previously rendered into `container`, this will | ||
2868 | * perform an update on it and only mutate the DOM as necessary to reflect the | ||
2869 | * latest React component. | ||
2870 | * | ||
2871 | * @param {ReactComponent} parentComponent The conceptual parent of this render tree. | ||
2872 | * @param {ReactElement} nextElement Component element to render. | ||
2873 | * @param {DOMElement} container DOM element to render into. | ||
2874 | * @param {?function} callback function triggered on completion | ||
2875 | * @return {ReactComponent} Component instance rendered in `container`. | ||
2876 | */ | ||
2877 | renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) { | ||
2878 | !(parentComponent != null && parentComponent._reactInternalInstance != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'parentComponent must be a valid React Component') : invariant(false) : undefined; | ||
2879 | return ReactMount._renderSubtreeIntoContainer(parentComponent, nextElement, container, callback); | ||
2880 | }, | ||
2881 | |||
2882 | _renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) { | ||
2883 | !ReactElement.isValidElement(nextElement) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOM.render(): Invalid component element.%s', typeof nextElement === 'string' ? ' Instead of passing an element string, make sure to instantiate ' + 'it by passing it to React.createElement.' : typeof nextElement === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' : | ||
2884 | // Check if it quacks like an element | ||
2885 | nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : invariant(false) : undefined; | ||
2886 | |||
2887 | 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.') : undefined; | ||
2888 | |||
2889 | var nextWrappedElement = new ReactElement(TopLevelWrapper, null, null, null, null, null, nextElement); | ||
2890 | |||
2891 | var prevComponent = instancesByReactRootID[getReactRootID(container)]; | ||
2892 | |||
2893 | if (prevComponent) { | ||
2894 | var prevWrappedElement = prevComponent._currentElement; | ||
2895 | var prevElement = prevWrappedElement.props; | ||
2896 | if (shouldUpdateReactComponent(prevElement, nextElement)) { | ||
2897 | var publicInst = prevComponent._renderedComponent.getPublicInstance(); | ||
2898 | var updatedCallback = callback && function () { | ||
2899 | callback.call(publicInst); | ||
2900 | }; | ||
2901 | ReactMount._updateRootComponent(prevComponent, nextWrappedElement, container, updatedCallback); | ||
2902 | return publicInst; | ||
2903 | } else { | ||
2904 | ReactMount.unmountComponentAtNode(container); | ||
2905 | } | ||
2906 | } | ||
2907 | |||
2908 | var reactRootElement = getReactRootElementInContainer(container); | ||
2909 | var containerHasReactMarkup = reactRootElement && !!internalGetID(reactRootElement); | ||
2910 | var containerHasNonRootReactChild = hasNonRootReactChild(container); | ||
2911 | |||
2912 | if (process.env.NODE_ENV !== 'production') { | ||
2913 | 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.') : undefined; | ||
2914 | |||
2915 | if (!containerHasReactMarkup || reactRootElement.nextSibling) { | ||
2916 | var rootElementSibling = reactRootElement; | ||
2917 | while (rootElementSibling) { | ||
2918 | if (internalGetID(rootElementSibling)) { | ||
2919 | 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.') : undefined; | ||
2920 | break; | ||
2921 | } | ||
2922 | rootElementSibling = rootElementSibling.nextSibling; | ||
2923 | } | ||
2924 | } | ||
2925 | } | ||
2926 | |||
2927 | var shouldReuseMarkup = containerHasReactMarkup && !prevComponent && !containerHasNonRootReactChild; | ||
2928 | var component = ReactMount._renderNewRootComponent(nextWrappedElement, container, shouldReuseMarkup, parentComponent != null ? parentComponent._reactInternalInstance._processChildContext(parentComponent._reactInternalInstance._context) : emptyObject)._renderedComponent.getPublicInstance(); | ||
2929 | if (callback) { | ||
2930 | callback.call(component); | ||
2931 | } | ||
2932 | return component; | ||
2933 | }, | ||
2934 | |||
2935 | /** | ||
2936 | * Renders a React component into the DOM in the supplied `container`. | ||
2937 | * | ||
2938 | * If the React component was previously rendered into `container`, this will | ||
2939 | * perform an update on it and only mutate the DOM as necessary to reflect the | ||
2940 | * latest React component. | ||
2941 | * | ||
2942 | * @param {ReactElement} nextElement Component element to render. | ||
2943 | * @param {DOMElement} container DOM element to render into. | ||
2944 | * @param {?function} callback function triggered on completion | ||
2945 | * @return {ReactComponent} Component instance rendered in `container`. | ||
2946 | */ | ||
2947 | render: function (nextElement, container, callback) { | ||
2948 | return ReactMount._renderSubtreeIntoContainer(null, nextElement, container, callback); | ||
2949 | }, | ||
2950 | |||
2951 | /** | ||
2952 | * Registers a container node into which React components will be rendered. | ||
2953 | * This also creates the "reactRoot" ID that will be assigned to the element | ||
2954 | * rendered within. | ||
2955 | * | ||
2956 | * @param {DOMElement} container DOM element to register as a container. | ||
2957 | * @return {string} The "reactRoot" ID of elements rendered within. | ||
2958 | */ | ||
2959 | registerContainer: function (container) { | ||
2960 | var reactRootID = getReactRootID(container); | ||
2961 | if (reactRootID) { | ||
2962 | // If one exists, make sure it is a valid "reactRoot" ID. | ||
2963 | reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(reactRootID); | ||
2964 | } | ||
2965 | if (!reactRootID) { | ||
2966 | // No valid "reactRoot" ID found, create one. | ||
2967 | reactRootID = ReactInstanceHandles.createReactRootID(); | ||
2968 | } | ||
2969 | containersByReactRootID[reactRootID] = container; | ||
2970 | return reactRootID; | ||
2971 | }, | ||
2972 | |||
2973 | /** | ||
2974 | * Unmounts and destroys the React component rendered in the `container`. | ||
2975 | * | ||
2976 | * @param {DOMElement} container DOM element containing a React component. | ||
2977 | * @return {boolean} True if a component was found in and unmounted from | ||
2978 | * `container` | ||
2979 | */ | ||
2980 | unmountComponentAtNode: function (container) { | ||
2981 | // Various parts of our code (such as ReactCompositeComponent's | ||
2982 | // _renderValidatedComponent) assume that calls to render aren't nested; | ||
2983 | // verify that that's the case. (Strictly speaking, unmounting won't cause a | ||
2984 | // render but we still don't expect to be in a render call here.) | ||
2985 | 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') : undefined; | ||
2986 | |||
2987 | !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'unmountComponentAtNode(...): Target container is not a DOM element.') : invariant(false) : undefined; | ||
2988 | |||
2989 | var reactRootID = getReactRootID(container); | ||
2990 | var component = instancesByReactRootID[reactRootID]; | ||
2991 | if (!component) { | ||
2992 | // Check if the node being unmounted was rendered by React, but isn't a | ||
2993 | // root node. | ||
2994 | var containerHasNonRootReactChild = hasNonRootReactChild(container); | ||
2995 | |||
2996 | // Check if the container itself is a React root node. | ||
2997 | var containerID = internalGetID(container); | ||
2998 | var isContainerReactRoot = containerID && containerID === ReactInstanceHandles.getReactRootIDFromNodeID(containerID); | ||
2999 | |||
3000 | if (process.env.NODE_ENV !== 'production') { | ||
3001 | 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.') : undefined; | ||
3002 | } | ||
3003 | |||
3004 | return false; | ||
3005 | } | ||
3006 | ReactUpdates.batchedUpdates(unmountComponentFromNode, component, container); | ||
3007 | delete instancesByReactRootID[reactRootID]; | ||
3008 | delete containersByReactRootID[reactRootID]; | ||
3009 | if (process.env.NODE_ENV !== 'production') { | ||
3010 | delete rootElementsByReactRootID[reactRootID]; | ||
3011 | } | ||
3012 | return true; | ||
3013 | }, | ||
3014 | |||
3015 | /** | ||
3016 | * Finds the container DOM element that contains React component to which the | ||
3017 | * supplied DOM `id` belongs. | ||
3018 | * | ||
3019 | * @param {string} id The ID of an element rendered by a React component. | ||
3020 | * @return {?DOMElement} DOM element that contains the `id`. | ||
3021 | */ | ||
3022 | findReactContainerForID: function (id) { | ||
3023 | var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(id); | ||
3024 | var container = containersByReactRootID[reactRootID]; | ||
3025 | |||
3026 | if (process.env.NODE_ENV !== 'production') { | ||
3027 | var rootElement = rootElementsByReactRootID[reactRootID]; | ||
3028 | if (rootElement && rootElement.parentNode !== container) { | ||
3029 | process.env.NODE_ENV !== 'production' ? warning( | ||
3030 | // Call internalGetID here because getID calls isValid which calls | ||
3031 | // findReactContainerForID (this function). | ||
3032 | internalGetID(rootElement) === reactRootID, 'ReactMount: Root element ID differed from reactRootID.') : undefined; | ||
3033 | var containerChild = container.firstChild; | ||
3034 | if (containerChild && reactRootID === internalGetID(containerChild)) { | ||
3035 | // If the container has a new child with the same ID as the old | ||
3036 | // root element, then rootElementsByReactRootID[reactRootID] is | ||
3037 | // just stale and needs to be updated. The case that deserves a | ||
3038 | // warning is when the container is empty. | ||
3039 | rootElementsByReactRootID[reactRootID] = containerChild; | ||
3040 | } else { | ||
3041 | process.env.NODE_ENV !== 'production' ? warning(false, 'ReactMount: Root element has been removed from its original ' + 'container. New container: %s', rootElement.parentNode) : undefined; | ||
3042 | } | ||
3043 | } | ||
3044 | } | ||
3045 | |||
3046 | return container; | ||
3047 | }, | ||
3048 | |||
3049 | /** | ||
3050 | * Finds an element rendered by React with the supplied ID. | ||
3051 | * | ||
3052 | * @param {string} id ID of a DOM node in the React component. | ||
3053 | * @return {DOMElement} Root DOM node of the React component. | ||
3054 | */ | ||
3055 | findReactNodeByID: function (id) { | ||
3056 | var reactRoot = ReactMount.findReactContainerForID(id); | ||
3057 | return ReactMount.findComponentRoot(reactRoot, id); | ||
3058 | }, | ||
3059 | |||
3060 | /** | ||
3061 | * Traverses up the ancestors of the supplied node to find a node that is a | ||
3062 | * DOM representation of a React component rendered by this copy of React. | ||
3063 | * | ||
3064 | * @param {*} node | ||
3065 | * @return {?DOMEventTarget} | ||
3066 | * @internal | ||
3067 | */ | ||
3068 | getFirstReactDOM: function (node) { | ||
3069 | return findFirstReactDOMImpl(node); | ||
3070 | }, | ||
3071 | |||
3072 | /** | ||
3073 | * Finds a node with the supplied `targetID` inside of the supplied | ||
3074 | * `ancestorNode`. Exploits the ID naming scheme to perform the search | ||
3075 | * quickly. | ||
3076 | * | ||
3077 | * @param {DOMEventTarget} ancestorNode Search from this root. | ||
3078 | * @pararm {string} targetID ID of the DOM representation of the component. | ||
3079 | * @return {DOMEventTarget} DOM node with the supplied `targetID`. | ||
3080 | * @internal | ||
3081 | */ | ||
3082 | findComponentRoot: function (ancestorNode, targetID) { | ||
3083 | var firstChildren = findComponentRootReusableArray; | ||
3084 | var childIndex = 0; | ||
3085 | |||
3086 | var deepestAncestor = findDeepestCachedAncestor(targetID) || ancestorNode; | ||
3087 | |||
3088 | if (process.env.NODE_ENV !== 'production') { | ||
3089 | // This will throw on the next line; give an early warning | ||
3090 | process.env.NODE_ENV !== 'production' ? warning(deepestAncestor != null, 'React can\'t find the root component node for data-reactid value ' + '`%s`. If you\'re seeing this message, it probably means that ' + 'you\'ve loaded two copies of React on the page. At this time, only ' + 'a single copy of React can be loaded at a time.', targetID) : undefined; | ||
3091 | } | ||
3092 | |||
3093 | firstChildren[0] = deepestAncestor.firstChild; | ||
3094 | firstChildren.length = 1; | ||
3095 | |||
3096 | while (childIndex < firstChildren.length) { | ||
3097 | var child = firstChildren[childIndex++]; | ||
3098 | var targetChild; | ||
3099 | |||
3100 | while (child) { | ||
3101 | var childID = ReactMount.getID(child); | ||
3102 | if (childID) { | ||
3103 | // Even if we find the node we're looking for, we finish looping | ||
3104 | // through its siblings to ensure they're cached so that we don't have | ||
3105 | // to revisit this node again. Otherwise, we make n^2 calls to getID | ||
3106 | // when visiting the many children of a single node in order. | ||
3107 | |||
3108 | if (targetID === childID) { | ||
3109 | targetChild = child; | ||
3110 | } else if (ReactInstanceHandles.isAncestorIDOf(childID, targetID)) { | ||
3111 | // If we find a child whose ID is an ancestor of the given ID, | ||
3112 | // then we can be sure that we only want to search the subtree | ||
3113 | // rooted at this child, so we can throw out the rest of the | ||
3114 | // search state. | ||
3115 | firstChildren.length = childIndex = 0; | ||
3116 | firstChildren.push(child.firstChild); | ||
3117 | } | ||
3118 | } else { | ||
3119 | // If this child had no ID, then there's a chance that it was | ||
3120 | // injected automatically by the browser, as when a `<table>` | ||
3121 | // element sprouts an extra `<tbody>` child as a side effect of | ||
3122 | // `.innerHTML` parsing. Optimistically continue down this | ||
3123 | // branch, but not before examining the other siblings. | ||
3124 | firstChildren.push(child.firstChild); | ||
3125 | } | ||
3126 | |||
3127 | child = child.nextSibling; | ||
3128 | } | ||
3129 | |||
3130 | if (targetChild) { | ||
3131 | // Emptying firstChildren/findComponentRootReusableArray is | ||
3132 | // not necessary for correctness, but it helps the GC reclaim | ||
3133 | // any nodes that were left at the end of the search. | ||
3134 | firstChildren.length = 0; | ||
3135 | |||
3136 | return targetChild; | ||
3137 | } | 5045 | } |
3138 | } | ||
3139 | |||
3140 | firstChildren.length = 0; | ||
3141 | |||
3142 | true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findComponentRoot(..., %s): Unable to find element. This probably ' + 'means the DOM was unexpectedly mutated (e.g., by the browser), ' + 'usually due to forgetting a <tbody> when using tables, nesting tags ' + 'like <form>, <p>, or <a>, or using non-SVG elements in an <svg> ' + 'parent. ' + 'Try inspecting the child nodes of the element with React ID `%s`.', targetID, ReactMount.getID(ancestorNode)) : invariant(false) : undefined; | ||
3143 | }, | ||
3144 | |||
3145 | _mountImageIntoNode: function (markup, container, shouldReuseMarkup, transaction) { | ||
3146 | !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mountComponentIntoNode(...): Target container is not valid.') : invariant(false) : undefined; | ||
3147 | |||
3148 | if (shouldReuseMarkup) { | ||
3149 | var rootElement = getReactRootElementInContainer(container); | ||
3150 | if (ReactMarkupChecksum.canReuseMarkup(markup, rootElement)) { | ||
3151 | return; | ||
3152 | } else { | ||
3153 | var checksum = rootElement.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME); | ||
3154 | rootElement.removeAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME); | ||
3155 | |||
3156 | var rootMarkup = rootElement.outerHTML; | ||
3157 | rootElement.setAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME, checksum); | ||
3158 | |||
3159 | var normalizedMarkup = markup; | ||
3160 | if (process.env.NODE_ENV !== 'production') { | ||
3161 | // because rootMarkup is retrieved from the DOM, various normalizations | ||
3162 | // will have occurred which will not be present in `markup`. Here, | ||
3163 | // insert markup into a <div> or <iframe> depending on the container | ||
3164 | // type to perform the same normalizations before comparing. | ||
3165 | var normalizer; | ||
3166 | if (container.nodeType === ELEMENT_NODE_TYPE) { | ||
3167 | normalizer = document.createElement('div'); | ||
3168 | normalizer.innerHTML = markup; | ||
3169 | normalizedMarkup = normalizer.innerHTML; | ||
3170 | } else { | ||
3171 | normalizer = document.createElement('iframe'); | ||
3172 | document.body.appendChild(normalizer); | ||
3173 | normalizer.contentDocument.write(markup); | ||
3174 | normalizedMarkup = normalizer.contentDocument.documentElement.outerHTML; | ||
3175 | document.body.removeChild(normalizer); | ||
3176 | } | ||
3177 | } | ||
3178 | 5046 | ||
3179 | var diffIndex = firstDifferenceIndex(normalizedMarkup, rootMarkup); | 5047 | hasSpaceKeypress = true; |
3180 | var difference = ' (client) ' + normalizedMarkup.substring(diffIndex - 20, diffIndex + 20) + '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20); | 5048 | return SPACEBAR_CHAR; |
3181 | 5049 | ||
3182 | !(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) : invariant(false) : undefined; | 5050 | case topLevelTypes.topTextInput: |
5051 | // Record the characters to be added to the DOM. | ||
5052 | var chars = nativeEvent.data; | ||
3183 | 5053 | ||
3184 | if (process.env.NODE_ENV !== 'production') { | 5054 | // If it's a spacebar character, assume that we have already handled |
3185 | 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) : undefined; | 5055 | // it at the keypress level and bail immediately. Android Chrome |
3186 | } | 5056 | // doesn't give us keycodes, so we need to blacklist it. |
5057 | if (chars === SPACEBAR_CHAR && hasSpaceKeypress) { | ||
5058 | return null; | ||
3187 | } | 5059 | } |
3188 | } | ||
3189 | 5060 | ||
3190 | !(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.') : invariant(false) : undefined; | 5061 | return chars; |
3191 | |||
3192 | if (transaction.useCreateElement) { | ||
3193 | while (container.lastChild) { | ||
3194 | container.removeChild(container.lastChild); | ||
3195 | } | ||
3196 | container.appendChild(markup); | ||
3197 | } else { | ||
3198 | setInnerHTML(container, markup); | ||
3199 | } | ||
3200 | }, | ||
3201 | |||
3202 | ownerDocumentContextKey: ownerDocumentContextKey, | ||
3203 | |||
3204 | /** | ||
3205 | * React ID utilities. | ||
3206 | */ | ||
3207 | |||
3208 | getReactRootID: getReactRootID, | ||
3209 | |||
3210 | getID: getID, | ||
3211 | |||
3212 | setID: setID, | ||
3213 | |||
3214 | getNode: getNode, | ||
3215 | |||
3216 | getNodeFromInstance: getNodeFromInstance, | ||
3217 | |||
3218 | isValid: isValid, | ||
3219 | |||
3220 | purgeID: purgeID | ||
3221 | }; | ||
3222 | 5062 | ||
3223 | ReactPerf.measureMethods(ReactMount, 'ReactMount', { | 5063 | default: |
3224 | _renderNewRootComponent: '_renderNewRootComponent', | 5064 | // For other native event types, do nothing. |
3225 | _mountImageIntoNode: '_mountImageIntoNode' | 5065 | return null; |
3226 | }); | 5066 | } |
5067 | } | ||
3227 | 5068 | ||
3228 | module.exports = ReactMount; | ||
3229 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
3230 | |||
3231 | /***/ }, | ||
3232 | /* 31 */ | ||
3233 | /***/ function(module, exports, __webpack_require__) { | ||
3234 | |||
3235 | /** | 5069 | /** |
3236 | * Copyright 2013-2015, Facebook, Inc. | 5070 | * For browsers that do not provide the `textInput` event, extract the |
3237 | * All rights reserved. | 5071 | * appropriate string to use for SyntheticInputEvent. |
3238 | * | ||
3239 | * This source code is licensed under the BSD-style license found in the | ||
3240 | * LICENSE file in the root directory of this source tree. An additional grant | ||
3241 | * of patent rights can be found in the PATENTS file in the same directory. | ||
3242 | * | 5072 | * |
3243 | * @providesModule ReactBrowserEventEmitter | 5073 | * @param {string} topLevelType Record from `EventConstants`. |
3244 | * @typechecks static-only | 5074 | * @param {object} nativeEvent Native browser event. |
5075 | * @return {?string} The fallback string for this `beforeInput` event. | ||
3245 | */ | 5076 | */ |
5077 | function getFallbackBeforeInputChars(topLevelType, nativeEvent) { | ||
5078 | // If we are currently composing (IME) and using a fallback to do so, | ||
5079 | // try to extract the composed characters from the fallback object. | ||
5080 | if (currentComposition) { | ||
5081 | if (topLevelType === topLevelTypes.topCompositionEnd || isFallbackCompositionEnd(topLevelType, nativeEvent)) { | ||
5082 | var chars = currentComposition.getData(); | ||
5083 | FallbackCompositionState.release(currentComposition); | ||
5084 | currentComposition = null; | ||
5085 | return chars; | ||
5086 | } | ||
5087 | return null; | ||
5088 | } | ||
3246 | 5089 | ||
3247 | 'use strict'; | 5090 | switch (topLevelType) { |
3248 | 5091 | case topLevelTypes.topPaste: | |
3249 | var EventConstants = __webpack_require__(32); | 5092 | // If a paste event occurs after a keypress, throw out the input |
3250 | var EventPluginHub = __webpack_require__(33); | 5093 | // chars. Paste events should not lead to BeforeInput events. |
3251 | var EventPluginRegistry = __webpack_require__(34); | 5094 | return null; |
3252 | var ReactEventEmitterMixin = __webpack_require__(39); | 5095 | case topLevelTypes.topKeyPress: |
3253 | var ReactPerf = __webpack_require__(20); | 5096 | /** |
3254 | var ViewportMetrics = __webpack_require__(40); | 5097 | * As of v27, Firefox may fire keypress events even when no character |
3255 | 5098 | * will be inserted. A few possibilities: | |
3256 | var assign = __webpack_require__(41); | 5099 | * |
3257 | var isEventSupported = __webpack_require__(42); | 5100 | * - `which` is `0`. Arrow keys, Esc key, etc. |
5101 | * | ||
5102 | * - `which` is the pressed key code, but no char is available. | ||
5103 | * Ex: 'AltGr + d` in Polish. There is no modified character for | ||
5104 | * this key combination and no character is inserted into the | ||
5105 | * document, but FF fires the keypress for char code `100` anyway. | ||
5106 | * No `input` event will occur. | ||
5107 | * | ||
5108 | * - `which` is the pressed key code, but a command combination is | ||
5109 | * being used. Ex: `Cmd+C`. No character is inserted, and no | ||
5110 | * `input` event will occur. | ||
5111 | */ | ||
5112 | if (nativeEvent.which && !isKeypressCommand(nativeEvent)) { | ||
5113 | return String.fromCharCode(nativeEvent.which); | ||
5114 | } | ||
5115 | return null; | ||
5116 | case topLevelTypes.topCompositionEnd: | ||
5117 | return useFallbackCompositionData ? null : nativeEvent.data; | ||
5118 | default: | ||
5119 | return null; | ||
5120 | } | ||
5121 | } | ||
3258 | 5122 | ||
3259 | /** | 5123 | /** |
3260 | * Summary of `ReactBrowserEventEmitter` event handling: | 5124 | * Extract a SyntheticInputEvent for `beforeInput`, based on either native |
3261 | * | 5125 | * `textInput` or fallback behavior. |
3262 | * - Top-level delegation is used to trap most native browser events. This | ||
3263 | * may only occur in the main thread and is the responsibility of | ||
3264 | * ReactEventListener, which is injected and can therefore support pluggable | ||
3265 | * event sources. This is the only work that occurs in the main thread. | ||
3266 | * | ||
3267 | * - We normalize and de-duplicate events to account for browser quirks. This | ||
3268 | * may be done in the worker thread. | ||
3269 | * | ||
3270 | * - Forward these native events (with the associated top-level type used to | ||
3271 | * trap it) to `EventPluginHub`, which in turn will ask plugins if they want | ||
3272 | * to extract any synthetic events. | ||
3273 | * | ||
3274 | * - The `EventPluginHub` will then process each event by annotating them with | ||
3275 | * "dispatches", a sequence of listeners and IDs that care about that event. | ||
3276 | * | ||
3277 | * - The `EventPluginHub` then dispatches the events. | ||
3278 | * | ||
3279 | * Overview of React and the event system: | ||
3280 | * | 5126 | * |
3281 | * +------------+ . | 5127 | * @return {?object} A SyntheticInputEvent. |
3282 | * | DOM | . | ||
3283 | * +------------+ . | ||
3284 | * | . | ||
3285 | * v . | ||
3286 | * +------------+ . | ||
3287 | * | ReactEvent | . | ||
3288 | * | Listener | . | ||
3289 | * +------------+ . +-----------+ | ||
3290 | * | . +--------+|SimpleEvent| | ||
3291 | * | . | |Plugin | | ||
3292 | * +-----|------+ . v +-----------+ | ||
3293 | * | | | . +--------------+ +------------+ | ||
3294 | * | +-----------.--->|EventPluginHub| | Event | | ||
3295 | * | | . | | +-----------+ | Propagators| | ||
3296 | * | ReactEvent | . | | |TapEvent | |------------| | ||
3297 | * | Emitter | . | |<---+|Plugin | |other plugin| | ||
3298 | * | | . | | +-----------+ | utilities | | ||
3299 | * | +-----------.--->| | +------------+ | ||
3300 | * | | | . +--------------+ | ||
3301 | * +-----|------+ . ^ +-----------+ | ||
3302 | * | . | |Enter/Leave| | ||
3303 | * + . +-------+|Plugin | | ||
3304 | * +-------------+ . +-----------+ | ||
3305 | * | application | . | ||
3306 | * |-------------| . | ||
3307 | * | | . | ||
3308 | * | | . | ||
3309 | * +-------------+ . | ||
3310 | * . | ||
3311 | * React Core . General Purpose Event Plugin System | ||
3312 | */ | 5128 | */ |
5129 | function extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) { | ||
5130 | var chars; | ||
3313 | 5131 | ||
3314 | var alreadyListeningTo = {}; | 5132 | if (canUseTextInputEvent) { |
3315 | var isMonitoringScrollValue = false; | 5133 | chars = getNativeBeforeInputChars(topLevelType, nativeEvent); |
3316 | var reactTopListenersCounter = 0; | 5134 | } else { |
5135 | chars = getFallbackBeforeInputChars(topLevelType, nativeEvent); | ||
5136 | } | ||
3317 | 5137 | ||
3318 | // For events like 'submit' which don't consistently bubble (which we trap at a | 5138 | // If no characters are being inserted, no BeforeInput event should |
3319 | // lower node than `document`), binding at `document` would cause duplicate | 5139 | // be fired. |
3320 | // events so we don't include them here | 5140 | if (!chars) { |
3321 | var topEventMapping = { | 5141 | return null; |
3322 | topAbort: 'abort', | 5142 | } |
3323 | topBlur: 'blur', | ||
3324 | topCanPlay: 'canplay', | ||
3325 | topCanPlayThrough: 'canplaythrough', | ||
3326 | topChange: 'change', | ||
3327 | topClick: 'click', | ||
3328 | topCompositionEnd: 'compositionend', | ||
3329 | topCompositionStart: 'compositionstart', | ||
3330 | topCompositionUpdate: 'compositionupdate', | ||
3331 | topContextMenu: 'contextmenu', | ||
3332 | topCopy: 'copy', | ||
3333 | topCut: 'cut', | ||
3334 | topDoubleClick: 'dblclick', | ||
3335 | topDrag: 'drag', | ||
3336 | topDragEnd: 'dragend', | ||
3337 | topDragEnter: 'dragenter', | ||
3338 | topDragExit: 'dragexit', | ||
3339 | topDragLeave: 'dragleave', | ||
3340 | topDragOver: 'dragover', | ||
3341 | topDragStart: 'dragstart', | ||
3342 | topDrop: 'drop', | ||
3343 | topDurationChange: 'durationchange', | ||
3344 | topEmptied: 'emptied', | ||
3345 | topEncrypted: 'encrypted', | ||
3346 | topEnded: 'ended', | ||
3347 | topError: 'error', | ||
3348 | topFocus: 'focus', | ||
3349 | topInput: 'input', | ||
3350 | topKeyDown: 'keydown', | ||
3351 | topKeyPress: 'keypress', | ||
3352 | topKeyUp: 'keyup', | ||
3353 | topLoadedData: 'loadeddata', | ||
3354 | topLoadedMetadata: 'loadedmetadata', | ||
3355 | topLoadStart: 'loadstart', | ||
3356 | topMouseDown: 'mousedown', | ||
3357 | topMouseMove: 'mousemove', | ||
3358 | topMouseOut: 'mouseout', | ||
3359 | topMouseOver: 'mouseover', | ||
3360 | topMouseUp: 'mouseup', | ||
3361 | topPaste: 'paste', | ||
3362 | topPause: 'pause', | ||
3363 | topPlay: 'play', | ||
3364 | topPlaying: 'playing', | ||
3365 | topProgress: 'progress', | ||
3366 | topRateChange: 'ratechange', | ||
3367 | topScroll: 'scroll', | ||
3368 | topSeeked: 'seeked', | ||
3369 | topSeeking: 'seeking', | ||
3370 | topSelectionChange: 'selectionchange', | ||
3371 | topStalled: 'stalled', | ||
3372 | topSuspend: 'suspend', | ||
3373 | topTextInput: 'textInput', | ||
3374 | topTimeUpdate: 'timeupdate', | ||
3375 | topTouchCancel: 'touchcancel', | ||
3376 | topTouchEnd: 'touchend', | ||
3377 | topTouchMove: 'touchmove', | ||
3378 | topTouchStart: 'touchstart', | ||
3379 | topVolumeChange: 'volumechange', | ||
3380 | topWaiting: 'waiting', | ||
3381 | topWheel: 'wheel' | ||
3382 | }; | ||
3383 | 5143 | ||
3384 | /** | 5144 | var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, targetInst, nativeEvent, nativeEventTarget); |
3385 | * To ensure no conflicts with other potential React instances on the page | ||
3386 | */ | ||
3387 | var topListenersIDKey = '_reactListenersID' + String(Math.random()).slice(2); | ||
3388 | 5145 | ||
3389 | function getListeningForDocument(mountAt) { | 5146 | event.data = chars; |
3390 | // In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty` | 5147 | EventPropagators.accumulateTwoPhaseDispatches(event); |
3391 | // directly. | 5148 | return event; |
3392 | if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) { | ||
3393 | mountAt[topListenersIDKey] = reactTopListenersCounter++; | ||
3394 | alreadyListeningTo[mountAt[topListenersIDKey]] = {}; | ||
3395 | } | ||
3396 | return alreadyListeningTo[mountAt[topListenersIDKey]]; | ||
3397 | } | 5149 | } |
3398 | 5150 | ||
3399 | /** | 5151 | /** |
3400 | * `ReactBrowserEventEmitter` is used to attach top-level event listeners. For | 5152 | * Create an `onBeforeInput` event to match |
3401 | * example: | 5153 | * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents. |
3402 | * | 5154 | * |
3403 | * ReactBrowserEventEmitter.putListener('myID', 'onClick', myFunction); | 5155 | * This event plugin is based on the native `textInput` event |
5156 | * available in Chrome, Safari, Opera, and IE. This event fires after | ||
5157 | * `onKeyPress` and `onCompositionEnd`, but before `onInput`. | ||
3404 | * | 5158 | * |
3405 | * This would allocate a "registration" of `('onClick', myFunction)` on 'myID'. | 5159 | * `beforeInput` is spec'd but not implemented in any browsers, and |
5160 | * the `input` event does not provide any useful information about what has | ||
5161 | * actually been added, contrary to the spec. Thus, `textInput` is the best | ||
5162 | * available event to identify the characters that have actually been inserted | ||
5163 | * into the target node. | ||
3406 | * | 5164 | * |
3407 | * @internal | 5165 | * This plugin is also responsible for emitting `composition` events, thus |
5166 | * allowing us to share composition fallback code for both `beforeInput` and | ||
5167 | * `composition` event types. | ||
3408 | */ | 5168 | */ |
3409 | var ReactBrowserEventEmitter = assign({}, ReactEventEmitterMixin, { | 5169 | var BeforeInputEventPlugin = { |
3410 | |||
3411 | /** | ||
3412 | * Injectable event backend | ||
3413 | */ | ||
3414 | ReactEventListener: null, | ||
3415 | |||
3416 | injection: { | ||
3417 | /** | ||
3418 | * @param {object} ReactEventListener | ||
3419 | */ | ||
3420 | injectReactEventListener: function (ReactEventListener) { | ||
3421 | ReactEventListener.setHandleTopLevel(ReactBrowserEventEmitter.handleTopLevel); | ||
3422 | ReactBrowserEventEmitter.ReactEventListener = ReactEventListener; | ||
3423 | } | ||
3424 | }, | ||
3425 | |||
3426 | /** | ||
3427 | * Sets whether or not any created callbacks should be enabled. | ||
3428 | * | ||
3429 | * @param {boolean} enabled True if callbacks should be enabled. | ||
3430 | */ | ||
3431 | setEnabled: function (enabled) { | ||
3432 | if (ReactBrowserEventEmitter.ReactEventListener) { | ||
3433 | ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled); | ||
3434 | } | ||
3435 | }, | ||
3436 | |||
3437 | /** | ||
3438 | * @return {boolean} True if callbacks are enabled. | ||
3439 | */ | ||
3440 | isEnabled: function () { | ||
3441 | return !!(ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled()); | ||
3442 | }, | ||
3443 | |||
3444 | /** | ||
3445 | * We listen for bubbled touch events on the document object. | ||
3446 | * | ||
3447 | * Firefox v8.01 (and possibly others) exhibited strange behavior when | ||
3448 | * mounting `onmousemove` events at some node that was not the document | ||
3449 | * element. The symptoms were that if your mouse is not moving over something | ||
3450 | * contained within that mount point (for example on the background) the | ||
3451 | * top-level listeners for `onmousemove` won't be called. However, if you | ||
3452 | * register the `mousemove` on the document object, then it will of course | ||
3453 | * catch all `mousemove`s. This along with iOS quirks, justifies restricting | ||
3454 | * top-level listeners to the document object only, at least for these | ||
3455 | * movement types of events and possibly all events. | ||
3456 | * | ||
3457 | * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html | ||
3458 | * | ||
3459 | * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but | ||
3460 | * they bubble to document. | ||
3461 | * | ||
3462 | * @param {string} registrationName Name of listener (e.g. `onClick`). | ||
3463 | * @param {object} contentDocumentHandle Document which owns the container | ||
3464 | */ | ||
3465 | listenTo: function (registrationName, contentDocumentHandle) { | ||
3466 | var mountAt = contentDocumentHandle; | ||
3467 | var isListening = getListeningForDocument(mountAt); | ||
3468 | var dependencies = EventPluginRegistry.registrationNameDependencies[registrationName]; | ||
3469 | |||
3470 | var topLevelTypes = EventConstants.topLevelTypes; | ||
3471 | for (var i = 0; i < dependencies.length; i++) { | ||
3472 | var dependency = dependencies[i]; | ||
3473 | if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) { | ||
3474 | if (dependency === topLevelTypes.topWheel) { | ||
3475 | if (isEventSupported('wheel')) { | ||
3476 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'wheel', mountAt); | ||
3477 | } else if (isEventSupported('mousewheel')) { | ||
3478 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'mousewheel', mountAt); | ||
3479 | } else { | ||
3480 | // Firefox needs to capture a different mouse scroll event. | ||
3481 | // @see http://www.quirksmode.org/dom/events/tests/scroll.html | ||
3482 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'DOMMouseScroll', mountAt); | ||
3483 | } | ||
3484 | } else if (dependency === topLevelTypes.topScroll) { | ||
3485 | |||
3486 | if (isEventSupported('scroll', true)) { | ||
3487 | ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topScroll, 'scroll', mountAt); | ||
3488 | } else { | ||
3489 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topScroll, 'scroll', ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE); | ||
3490 | } | ||
3491 | } else if (dependency === topLevelTypes.topFocus || dependency === topLevelTypes.topBlur) { | ||
3492 | |||
3493 | if (isEventSupported('focus', true)) { | ||
3494 | ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topFocus, 'focus', mountAt); | ||
3495 | ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topBlur, 'blur', mountAt); | ||
3496 | } else if (isEventSupported('focusin')) { | ||
3497 | // IE has `focusin` and `focusout` events which bubble. | ||
3498 | // @see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html | ||
3499 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topFocus, 'focusin', mountAt); | ||
3500 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topBlur, 'focusout', mountAt); | ||
3501 | } | ||
3502 | |||
3503 | // to make sure blur and focus event listeners are only attached once | ||
3504 | isListening[topLevelTypes.topBlur] = true; | ||
3505 | isListening[topLevelTypes.topFocus] = true; | ||
3506 | } else if (topEventMapping.hasOwnProperty(dependency)) { | ||
3507 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(dependency, topEventMapping[dependency], mountAt); | ||
3508 | } | ||
3509 | |||
3510 | isListening[dependency] = true; | ||
3511 | } | ||
3512 | } | ||
3513 | }, | ||
3514 | |||
3515 | trapBubbledEvent: function (topLevelType, handlerBaseName, handle) { | ||
3516 | return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelType, handlerBaseName, handle); | ||
3517 | }, | ||
3518 | |||
3519 | trapCapturedEvent: function (topLevelType, handlerBaseName, handle) { | ||
3520 | return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelType, handlerBaseName, handle); | ||
3521 | }, | ||
3522 | |||
3523 | /** | ||
3524 | * Listens to window scroll and resize events. We cache scroll values so that | ||
3525 | * application code can access them without triggering reflows. | ||
3526 | * | ||
3527 | * NOTE: Scroll events do not bubble. | ||
3528 | * | ||
3529 | * @see http://www.quirksmode.org/dom/events/scroll.html | ||
3530 | */ | ||
3531 | ensureScrollValueMonitoring: function () { | ||
3532 | if (!isMonitoringScrollValue) { | ||
3533 | var refresh = ViewportMetrics.refreshScrollValues; | ||
3534 | ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh); | ||
3535 | isMonitoringScrollValue = true; | ||
3536 | } | ||
3537 | }, | ||
3538 | |||
3539 | eventNameDispatchConfigs: EventPluginHub.eventNameDispatchConfigs, | ||
3540 | |||
3541 | registrationNameModules: EventPluginHub.registrationNameModules, | ||
3542 | |||
3543 | putListener: EventPluginHub.putListener, | ||
3544 | |||
3545 | getListener: EventPluginHub.getListener, | ||
3546 | |||
3547 | deleteListener: EventPluginHub.deleteListener, | ||
3548 | |||
3549 | deleteAllListeners: EventPluginHub.deleteAllListeners | ||
3550 | 5170 | ||
3551 | }); | 5171 | eventTypes: eventTypes, |
3552 | 5172 | ||
3553 | ReactPerf.measureMethods(ReactBrowserEventEmitter, 'ReactBrowserEventEmitter', { | 5173 | extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { |
3554 | putListener: 'putListener', | 5174 | return [extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget), extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget)]; |
3555 | deleteListener: 'deleteListener' | 5175 | } |
3556 | }); | 5176 | }; |
3557 | 5177 | ||
3558 | module.exports = ReactBrowserEventEmitter; | 5178 | module.exports = BeforeInputEventPlugin; |
3559 | 5179 | ||
3560 | /***/ }, | 5180 | /***/ }, |
3561 | /* 32 */ | 5181 | /* 44 */ |
3562 | /***/ function(module, exports, __webpack_require__) { | 5182 | /***/ function(module, exports, __webpack_require__) { |
3563 | 5183 | ||
3564 | /** | 5184 | /** |
3565 | * Copyright 2013-2015, Facebook, Inc. | 5185 | * Copyright 2013-present, Facebook, Inc. |
3566 | * All rights reserved. | 5186 | * All rights reserved. |
3567 | * | 5187 | * |
3568 | * This source code is licensed under the BSD-style license found in the | 5188 | * This source code is licensed under the BSD-style license found in the |
@@ -3574,7 +5194,7 @@ | |||
3574 | 5194 | ||
3575 | 'use strict'; | 5195 | 'use strict'; |
3576 | 5196 | ||
3577 | var keyMirror = __webpack_require__(19); | 5197 | var keyMirror = __webpack_require__(25); |
3578 | 5198 | ||
3579 | var PropagationPhases = keyMirror({ bubbled: null, captured: null }); | 5199 | var PropagationPhases = keyMirror({ bubbled: null, captured: null }); |
3580 | 5200 | ||
@@ -3583,6 +5203,9 @@ | |||
3583 | */ | 5203 | */ |
3584 | var topLevelTypes = keyMirror({ | 5204 | var topLevelTypes = keyMirror({ |
3585 | topAbort: null, | 5205 | topAbort: null, |
5206 | topAnimationEnd: null, | ||
5207 | topAnimationIteration: null, | ||
5208 | topAnimationStart: null, | ||
3586 | topBlur: null, | 5209 | topBlur: null, |
3587 | topCanPlay: null, | 5210 | topCanPlay: null, |
3588 | topCanPlayThrough: null, | 5211 | topCanPlayThrough: null, |
@@ -3610,6 +5233,7 @@ | |||
3610 | topError: null, | 5233 | topError: null, |
3611 | topFocus: null, | 5234 | topFocus: null, |
3612 | topInput: null, | 5235 | topInput: null, |
5236 | topInvalid: null, | ||
3613 | topKeyDown: null, | 5237 | topKeyDown: null, |
3614 | topKeyPress: null, | 5238 | topKeyPress: null, |
3615 | topKeyUp: null, | 5239 | topKeyUp: null, |
@@ -3642,6 +5266,7 @@ | |||
3642 | topTouchEnd: null, | 5266 | topTouchEnd: null, |
3643 | topTouchMove: null, | 5267 | topTouchMove: null, |
3644 | topTouchStart: null, | 5268 | topTouchStart: null, |
5269 | topTransitionEnd: null, | ||
3645 | topVolumeChange: null, | 5270 | topVolumeChange: null, |
3646 | topWaiting: null, | 5271 | topWaiting: null, |
3647 | topWheel: null | 5272 | topWheel: null |
@@ -3655,11 +5280,154 @@ | |||
3655 | module.exports = EventConstants; | 5280 | module.exports = EventConstants; |
3656 | 5281 | ||
3657 | /***/ }, | 5282 | /***/ }, |
3658 | /* 33 */ | 5283 | /* 45 */ |
5284 | /***/ function(module, exports, __webpack_require__) { | ||
5285 | |||
5286 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
5287 | * Copyright 2013-present, Facebook, Inc. | ||
5288 | * All rights reserved. | ||
5289 | * | ||
5290 | * This source code is licensed under the BSD-style license found in the | ||
5291 | * LICENSE file in the root directory of this source tree. An additional grant | ||
5292 | * of patent rights can be found in the PATENTS file in the same directory. | ||
5293 | * | ||
5294 | * @providesModule EventPropagators | ||
5295 | */ | ||
5296 | |||
5297 | 'use strict'; | ||
5298 | |||
5299 | var EventConstants = __webpack_require__(44); | ||
5300 | var EventPluginHub = __webpack_require__(46); | ||
5301 | var EventPluginUtils = __webpack_require__(48); | ||
5302 | |||
5303 | var accumulateInto = __webpack_require__(50); | ||
5304 | var forEachAccumulated = __webpack_require__(51); | ||
5305 | var warning = __webpack_require__(13); | ||
5306 | |||
5307 | var PropagationPhases = EventConstants.PropagationPhases; | ||
5308 | var getListener = EventPluginHub.getListener; | ||
5309 | |||
5310 | /** | ||
5311 | * Some event types have a notion of different registration names for different | ||
5312 | * "phases" of propagation. This finds listeners by a given phase. | ||
5313 | */ | ||
5314 | function listenerAtPhase(inst, event, propagationPhase) { | ||
5315 | var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase]; | ||
5316 | return getListener(inst, registrationName); | ||
5317 | } | ||
5318 | |||
5319 | /** | ||
5320 | * Tags a `SyntheticEvent` with dispatched listeners. Creating this function | ||
5321 | * here, allows us to not have to bind or create functions for each event. | ||
5322 | * Mutating the event's members allows us to not have to create a wrapping | ||
5323 | * "dispatch" object that pairs the event with the listener. | ||
5324 | */ | ||
5325 | function accumulateDirectionalDispatches(inst, upwards, event) { | ||
5326 | if (process.env.NODE_ENV !== 'production') { | ||
5327 | process.env.NODE_ENV !== 'production' ? warning(inst, 'Dispatching inst must not be null') : void 0; | ||
5328 | } | ||
5329 | var phase = upwards ? PropagationPhases.bubbled : PropagationPhases.captured; | ||
5330 | var listener = listenerAtPhase(inst, event, phase); | ||
5331 | if (listener) { | ||
5332 | event._dispatchListeners = accumulateInto(event._dispatchListeners, listener); | ||
5333 | event._dispatchInstances = accumulateInto(event._dispatchInstances, inst); | ||
5334 | } | ||
5335 | } | ||
5336 | |||
5337 | /** | ||
5338 | * Collect dispatches (must be entirely collected before dispatching - see unit | ||
5339 | * tests). Lazily allocate the array to conserve memory. We must loop through | ||
5340 | * each event and perform the traversal for each one. We cannot perform a | ||
5341 | * single traversal for the entire collection of events because each event may | ||
5342 | * have a different target. | ||
5343 | */ | ||
5344 | function accumulateTwoPhaseDispatchesSingle(event) { | ||
5345 | if (event && event.dispatchConfig.phasedRegistrationNames) { | ||
5346 | EventPluginUtils.traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event); | ||
5347 | } | ||
5348 | } | ||
5349 | |||
5350 | /** | ||
5351 | * Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID. | ||
5352 | */ | ||
5353 | function accumulateTwoPhaseDispatchesSingleSkipTarget(event) { | ||
5354 | if (event && event.dispatchConfig.phasedRegistrationNames) { | ||
5355 | var targetInst = event._targetInst; | ||
5356 | var parentInst = targetInst ? EventPluginUtils.getParentInstance(targetInst) : null; | ||
5357 | EventPluginUtils.traverseTwoPhase(parentInst, accumulateDirectionalDispatches, event); | ||
5358 | } | ||
5359 | } | ||
5360 | |||
5361 | /** | ||
5362 | * Accumulates without regard to direction, does not look for phased | ||
5363 | * registration names. Same as `accumulateDirectDispatchesSingle` but without | ||
5364 | * requiring that the `dispatchMarker` be the same as the dispatched ID. | ||
5365 | */ | ||
5366 | function accumulateDispatches(inst, ignoredDirection, event) { | ||
5367 | if (event && event.dispatchConfig.registrationName) { | ||
5368 | var registrationName = event.dispatchConfig.registrationName; | ||
5369 | var listener = getListener(inst, registrationName); | ||
5370 | if (listener) { | ||
5371 | event._dispatchListeners = accumulateInto(event._dispatchListeners, listener); | ||
5372 | event._dispatchInstances = accumulateInto(event._dispatchInstances, inst); | ||
5373 | } | ||
5374 | } | ||
5375 | } | ||
5376 | |||
5377 | /** | ||
5378 | * Accumulates dispatches on an `SyntheticEvent`, but only for the | ||
5379 | * `dispatchMarker`. | ||
5380 | * @param {SyntheticEvent} event | ||
5381 | */ | ||
5382 | function accumulateDirectDispatchesSingle(event) { | ||
5383 | if (event && event.dispatchConfig.registrationName) { | ||
5384 | accumulateDispatches(event._targetInst, null, event); | ||
5385 | } | ||
5386 | } | ||
5387 | |||
5388 | function accumulateTwoPhaseDispatches(events) { | ||
5389 | forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle); | ||
5390 | } | ||
5391 | |||
5392 | function accumulateTwoPhaseDispatchesSkipTarget(events) { | ||
5393 | forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget); | ||
5394 | } | ||
5395 | |||
5396 | function accumulateEnterLeaveDispatches(leave, enter, from, to) { | ||
5397 | EventPluginUtils.traverseEnterLeave(from, to, accumulateDispatches, leave, enter); | ||
5398 | } | ||
5399 | |||
5400 | function accumulateDirectDispatches(events) { | ||
5401 | forEachAccumulated(events, accumulateDirectDispatchesSingle); | ||
5402 | } | ||
5403 | |||
5404 | /** | ||
5405 | * A small set of propagation patterns, each of which will accept a small amount | ||
5406 | * of information, and generate a set of "dispatch ready event objects" - which | ||
5407 | * are sets of events that have already been annotated with a set of dispatched | ||
5408 | * listener functions/ids. The API is designed this way to discourage these | ||
5409 | * propagation strategies from actually executing the dispatches, since we | ||
5410 | * always want to collect the entire set of dispatches before executing event a | ||
5411 | * single one. | ||
5412 | * | ||
5413 | * @constructor EventPropagators | ||
5414 | */ | ||
5415 | var EventPropagators = { | ||
5416 | accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches, | ||
5417 | accumulateTwoPhaseDispatchesSkipTarget: accumulateTwoPhaseDispatchesSkipTarget, | ||
5418 | accumulateDirectDispatches: accumulateDirectDispatches, | ||
5419 | accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches | ||
5420 | }; | ||
5421 | |||
5422 | module.exports = EventPropagators; | ||
5423 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
5424 | |||
5425 | /***/ }, | ||
5426 | /* 46 */ | ||
3659 | /***/ function(module, exports, __webpack_require__) { | 5427 | /***/ function(module, exports, __webpack_require__) { |
3660 | 5428 | ||
3661 | /* WEBPACK VAR INJECTION */(function(process) {/** | 5429 | /* WEBPACK VAR INJECTION */(function(process) {/** |
3662 | * Copyright 2013-2015, Facebook, Inc. | 5430 | * Copyright 2013-present, Facebook, Inc. |
3663 | * All rights reserved. | 5431 | * All rights reserved. |
3664 | * | 5432 | * |
3665 | * This source code is licensed under the BSD-style license found in the | 5433 | * This source code is licensed under the BSD-style license found in the |
@@ -3671,14 +5439,15 @@ | |||
3671 | 5439 | ||
3672 | 'use strict'; | 5440 | 'use strict'; |
3673 | 5441 | ||
3674 | var EventPluginRegistry = __webpack_require__(34); | 5442 | var _prodInvariant = __webpack_require__(9); |
3675 | var EventPluginUtils = __webpack_require__(35); | 5443 | |
3676 | var ReactErrorUtils = __webpack_require__(36); | 5444 | var EventPluginRegistry = __webpack_require__(47); |
5445 | var EventPluginUtils = __webpack_require__(48); | ||
5446 | var ReactErrorUtils = __webpack_require__(49); | ||
3677 | 5447 | ||
3678 | var accumulateInto = __webpack_require__(37); | 5448 | var accumulateInto = __webpack_require__(50); |
3679 | var forEachAccumulated = __webpack_require__(38); | 5449 | var forEachAccumulated = __webpack_require__(51); |
3680 | var invariant = __webpack_require__(15); | 5450 | var invariant = __webpack_require__(10); |
3681 | var warning = __webpack_require__(27); | ||
3682 | 5451 | ||
3683 | /** | 5452 | /** |
3684 | * Internal store for event listeners | 5453 | * Internal store for event listeners |
@@ -3714,16 +5483,9 @@ | |||
3714 | return executeDispatchesAndRelease(e, false); | 5483 | return executeDispatchesAndRelease(e, false); |
3715 | }; | 5484 | }; |
3716 | 5485 | ||
3717 | /** | 5486 | var getDictionaryKey = function (inst) { |
3718 | * - `InstanceHandle`: [required] Module that performs logical traversals of DOM | 5487 | return '.' + inst._rootNodeID; |
3719 | * hierarchy given ids of the logical DOM elements involved. | 5488 | }; |
3720 | */ | ||
3721 | var InstanceHandle = null; | ||
3722 | |||
3723 | function validateInstanceHandle() { | ||
3724 | var valid = InstanceHandle && InstanceHandle.traverseTwoPhase && InstanceHandle.traverseEnterLeave; | ||
3725 | process.env.NODE_ENV !== 'production' ? warning(valid, 'InstanceHandle not injected before use!') : undefined; | ||
3726 | } | ||
3727 | 5489 | ||
3728 | /** | 5490 | /** |
3729 | * This is a unified interface for event plugins to be installed and configured. | 5491 | * This is a unified interface for event plugins to be installed and configured. |
@@ -3755,30 +5517,6 @@ | |||
3755 | injection: { | 5517 | injection: { |
3756 | 5518 | ||
3757 | /** | 5519 | /** |
3758 | * @param {object} InjectedMount | ||
3759 | * @public | ||
3760 | */ | ||
3761 | injectMount: EventPluginUtils.injection.injectMount, | ||
3762 | |||
3763 | /** | ||
3764 | * @param {object} InjectedInstanceHandle | ||
3765 | * @public | ||
3766 | */ | ||
3767 | injectInstanceHandle: function (InjectedInstanceHandle) { | ||
3768 | InstanceHandle = InjectedInstanceHandle; | ||
3769 | if (process.env.NODE_ENV !== 'production') { | ||
3770 | validateInstanceHandle(); | ||
3771 | } | ||
3772 | }, | ||
3773 | |||
3774 | getInstanceHandle: function () { | ||
3775 | if (process.env.NODE_ENV !== 'production') { | ||
3776 | validateInstanceHandle(); | ||
3777 | } | ||
3778 | return InstanceHandle; | ||
3779 | }, | ||
3780 | |||
3781 | /** | ||
3782 | * @param {array} InjectedEventPluginOrder | 5520 | * @param {array} InjectedEventPluginOrder |
3783 | * @public | 5521 | * @public |
3784 | */ | 5522 | */ |
@@ -3791,75 +5529,79 @@ | |||
3791 | 5529 | ||
3792 | }, | 5530 | }, |
3793 | 5531 | ||
3794 | eventNameDispatchConfigs: EventPluginRegistry.eventNameDispatchConfigs, | ||
3795 | |||
3796 | registrationNameModules: EventPluginRegistry.registrationNameModules, | ||
3797 | |||
3798 | /** | 5532 | /** |
3799 | * Stores `listener` at `listenerBank[registrationName][id]`. Is idempotent. | 5533 | * Stores `listener` at `listenerBank[registrationName][key]`. Is idempotent. |
3800 | * | 5534 | * |
3801 | * @param {string} id ID of the DOM element. | 5535 | * @param {object} inst The instance, which is the source of events. |
3802 | * @param {string} registrationName Name of listener (e.g. `onClick`). | 5536 | * @param {string} registrationName Name of listener (e.g. `onClick`). |
3803 | * @param {?function} listener The callback to store. | 5537 | * @param {function} listener The callback to store. |
3804 | */ | 5538 | */ |
3805 | putListener: function (id, registrationName, listener) { | 5539 | putListener: function (inst, registrationName, listener) { |
3806 | !(typeof listener === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected %s listener to be a function, instead got type %s', registrationName, typeof listener) : invariant(false) : undefined; | 5540 | !(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; |
3807 | 5541 | ||
5542 | var key = getDictionaryKey(inst); | ||
3808 | var bankForRegistrationName = listenerBank[registrationName] || (listenerBank[registrationName] = {}); | 5543 | var bankForRegistrationName = listenerBank[registrationName] || (listenerBank[registrationName] = {}); |
3809 | bankForRegistrationName[id] = listener; | 5544 | bankForRegistrationName[key] = listener; |
3810 | 5545 | ||
3811 | var PluginModule = EventPluginRegistry.registrationNameModules[registrationName]; | 5546 | var PluginModule = EventPluginRegistry.registrationNameModules[registrationName]; |
3812 | if (PluginModule && PluginModule.didPutListener) { | 5547 | if (PluginModule && PluginModule.didPutListener) { |
3813 | PluginModule.didPutListener(id, registrationName, listener); | 5548 | PluginModule.didPutListener(inst, registrationName, listener); |
3814 | } | 5549 | } |
3815 | }, | 5550 | }, |
3816 | 5551 | ||
3817 | /** | 5552 | /** |
3818 | * @param {string} id ID of the DOM element. | 5553 | * @param {object} inst The instance, which is the source of events. |
3819 | * @param {string} registrationName Name of listener (e.g. `onClick`). | 5554 | * @param {string} registrationName Name of listener (e.g. `onClick`). |
3820 | * @return {?function} The stored callback. | 5555 | * @return {?function} The stored callback. |
3821 | */ | 5556 | */ |
3822 | getListener: function (id, registrationName) { | 5557 | getListener: function (inst, registrationName) { |
3823 | var bankForRegistrationName = listenerBank[registrationName]; | 5558 | var bankForRegistrationName = listenerBank[registrationName]; |
3824 | return bankForRegistrationName && bankForRegistrationName[id]; | 5559 | var key = getDictionaryKey(inst); |
5560 | return bankForRegistrationName && bankForRegistrationName[key]; | ||
3825 | }, | 5561 | }, |
3826 | 5562 | ||
3827 | /** | 5563 | /** |
3828 | * Deletes a listener from the registration bank. | 5564 | * Deletes a listener from the registration bank. |
3829 | * | 5565 | * |
3830 | * @param {string} id ID of the DOM element. | 5566 | * @param {object} inst The instance, which is the source of events. |
3831 | * @param {string} registrationName Name of listener (e.g. `onClick`). | 5567 | * @param {string} registrationName Name of listener (e.g. `onClick`). |
3832 | */ | 5568 | */ |
3833 | deleteListener: function (id, registrationName) { | 5569 | deleteListener: function (inst, registrationName) { |
3834 | var PluginModule = EventPluginRegistry.registrationNameModules[registrationName]; | 5570 | var PluginModule = EventPluginRegistry.registrationNameModules[registrationName]; |
3835 | if (PluginModule && PluginModule.willDeleteListener) { | 5571 | if (PluginModule && PluginModule.willDeleteListener) { |
3836 | PluginModule.willDeleteListener(id, registrationName); | 5572 | PluginModule.willDeleteListener(inst, registrationName); |
3837 | } | 5573 | } |
3838 | 5574 | ||
3839 | var bankForRegistrationName = listenerBank[registrationName]; | 5575 | var bankForRegistrationName = listenerBank[registrationName]; |
3840 | // TODO: This should never be null -- when is it? | 5576 | // TODO: This should never be null -- when is it? |
3841 | if (bankForRegistrationName) { | 5577 | if (bankForRegistrationName) { |
3842 | delete bankForRegistrationName[id]; | 5578 | var key = getDictionaryKey(inst); |
5579 | delete bankForRegistrationName[key]; | ||
3843 | } | 5580 | } |
3844 | }, | 5581 | }, |
3845 | 5582 | ||
3846 | /** | 5583 | /** |
3847 | * Deletes all listeners for the DOM element with the supplied ID. | 5584 | * Deletes all listeners for the DOM element with the supplied ID. |
3848 | * | 5585 | * |
3849 | * @param {string} id ID of the DOM element. | 5586 | * @param {object} inst The instance, which is the source of events. |
3850 | */ | 5587 | */ |
3851 | deleteAllListeners: function (id) { | 5588 | deleteAllListeners: function (inst) { |
5589 | var key = getDictionaryKey(inst); | ||
3852 | for (var registrationName in listenerBank) { | 5590 | for (var registrationName in listenerBank) { |
3853 | if (!listenerBank[registrationName][id]) { | 5591 | if (!listenerBank.hasOwnProperty(registrationName)) { |
5592 | continue; | ||
5593 | } | ||
5594 | |||
5595 | if (!listenerBank[registrationName][key]) { | ||
3854 | continue; | 5596 | continue; |
3855 | } | 5597 | } |
3856 | 5598 | ||
3857 | var PluginModule = EventPluginRegistry.registrationNameModules[registrationName]; | 5599 | var PluginModule = EventPluginRegistry.registrationNameModules[registrationName]; |
3858 | if (PluginModule && PluginModule.willDeleteListener) { | 5600 | if (PluginModule && PluginModule.willDeleteListener) { |
3859 | PluginModule.willDeleteListener(id, registrationName); | 5601 | PluginModule.willDeleteListener(inst, registrationName); |
3860 | } | 5602 | } |
3861 | 5603 | ||
3862 | delete listenerBank[registrationName][id]; | 5604 | delete listenerBank[registrationName][key]; |
3863 | } | 5605 | } |
3864 | }, | 5606 | }, |
3865 | 5607 | ||
@@ -3867,21 +5609,17 @@ | |||
3867 | * Allows registered plugins an opportunity to extract events from top-level | 5609 | * Allows registered plugins an opportunity to extract events from top-level |
3868 | * native browser events. | 5610 | * native browser events. |
3869 | * | 5611 | * |
3870 | * @param {string} topLevelType Record from `EventConstants`. | ||
3871 | * @param {DOMEventTarget} topLevelTarget The listening component root node. | ||
3872 | * @param {string} topLevelTargetID ID of `topLevelTarget`. | ||
3873 | * @param {object} nativeEvent Native browser event. | ||
3874 | * @return {*} An accumulation of synthetic events. | 5612 | * @return {*} An accumulation of synthetic events. |
3875 | * @internal | 5613 | * @internal |
3876 | */ | 5614 | */ |
3877 | extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) { | 5615 | extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { |
3878 | var events; | 5616 | var events; |
3879 | var plugins = EventPluginRegistry.plugins; | 5617 | var plugins = EventPluginRegistry.plugins; |
3880 | for (var i = 0; i < plugins.length; i++) { | 5618 | for (var i = 0; i < plugins.length; i++) { |
3881 | // Not every plugin in the ordering may be loaded at runtime. | 5619 | // Not every plugin in the ordering may be loaded at runtime. |
3882 | var possiblePlugin = plugins[i]; | 5620 | var possiblePlugin = plugins[i]; |
3883 | if (possiblePlugin) { | 5621 | if (possiblePlugin) { |
3884 | var extractedEvents = possiblePlugin.extractEvents(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget); | 5622 | var extractedEvents = possiblePlugin.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget); |
3885 | if (extractedEvents) { | 5623 | if (extractedEvents) { |
3886 | events = accumulateInto(events, extractedEvents); | 5624 | events = accumulateInto(events, extractedEvents); |
3887 | } | 5625 | } |
@@ -3918,7 +5656,7 @@ | |||
3918 | } else { | 5656 | } else { |
3919 | forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel); | 5657 | forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel); |
3920 | } | 5658 | } |
3921 | !!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.') : invariant(false) : undefined; | 5659 | !!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; |
3922 | // This would be a good time to rethrow if any of the event handlers threw. | 5660 | // This would be a good time to rethrow if any of the event handlers threw. |
3923 | ReactErrorUtils.rethrowCaughtError(); | 5661 | ReactErrorUtils.rethrowCaughtError(); |
3924 | }, | 5662 | }, |
@@ -3937,14 +5675,14 @@ | |||
3937 | }; | 5675 | }; |
3938 | 5676 | ||
3939 | module.exports = EventPluginHub; | 5677 | module.exports = EventPluginHub; |
3940 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | 5678 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) |
3941 | 5679 | ||
3942 | /***/ }, | 5680 | /***/ }, |
3943 | /* 34 */ | 5681 | /* 47 */ |
3944 | /***/ function(module, exports, __webpack_require__) { | 5682 | /***/ function(module, exports, __webpack_require__) { |
3945 | 5683 | ||
3946 | /* WEBPACK VAR INJECTION */(function(process) {/** | 5684 | /* WEBPACK VAR INJECTION */(function(process) {/** |
3947 | * Copyright 2013-2015, Facebook, Inc. | 5685 | * Copyright 2013-present, Facebook, Inc. |
3948 | * All rights reserved. | 5686 | * All rights reserved. |
3949 | * | 5687 | * |
3950 | * This source code is licensed under the BSD-style license found in the | 5688 | * This source code is licensed under the BSD-style license found in the |
@@ -3952,12 +5690,13 @@ | |||
3952 | * of patent rights can be found in the PATENTS file in the same directory. | 5690 | * of patent rights can be found in the PATENTS file in the same directory. |
3953 | * | 5691 | * |
3954 | * @providesModule EventPluginRegistry | 5692 | * @providesModule EventPluginRegistry |
3955 | * @typechecks static-only | ||
3956 | */ | 5693 | */ |
3957 | 5694 | ||
3958 | 'use strict'; | 5695 | 'use strict'; |
3959 | 5696 | ||
3960 | var invariant = __webpack_require__(15); | 5697 | var _prodInvariant = __webpack_require__(9); |
5698 | |||
5699 | var invariant = __webpack_require__(10); | ||
3961 | 5700 | ||
3962 | /** | 5701 | /** |
3963 | * Injectable ordering of event plugins. | 5702 | * Injectable ordering of event plugins. |
@@ -3982,15 +5721,15 @@ | |||
3982 | for (var pluginName in namesToPlugins) { | 5721 | for (var pluginName in namesToPlugins) { |
3983 | var PluginModule = namesToPlugins[pluginName]; | 5722 | var PluginModule = namesToPlugins[pluginName]; |
3984 | var pluginIndex = EventPluginOrder.indexOf(pluginName); | 5723 | var pluginIndex = EventPluginOrder.indexOf(pluginName); |
3985 | !(pluginIndex > -1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in ' + 'the plugin ordering, `%s`.', pluginName) : invariant(false) : undefined; | 5724 | !(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; |
3986 | if (EventPluginRegistry.plugins[pluginIndex]) { | 5725 | if (EventPluginRegistry.plugins[pluginIndex]) { |
3987 | continue; | 5726 | continue; |
3988 | } | 5727 | } |
3989 | !PluginModule.extractEvents ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` ' + 'method, but `%s` does not.', pluginName) : invariant(false) : undefined; | 5728 | !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; |
3990 | EventPluginRegistry.plugins[pluginIndex] = PluginModule; | 5729 | EventPluginRegistry.plugins[pluginIndex] = PluginModule; |
3991 | var publishedEvents = PluginModule.eventTypes; | 5730 | var publishedEvents = PluginModule.eventTypes; |
3992 | for (var eventName in publishedEvents) { | 5731 | for (var eventName in publishedEvents) { |
3993 | !publishEventForPlugin(publishedEvents[eventName], PluginModule, eventName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : invariant(false) : undefined; | 5732 | !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; |
3994 | } | 5733 | } |
3995 | } | 5734 | } |
3996 | } | 5735 | } |
@@ -4004,7 +5743,7 @@ | |||
4004 | * @private | 5743 | * @private |
4005 | */ | 5744 | */ |
4006 | function publishEventForPlugin(dispatchConfig, PluginModule, eventName) { | 5745 | function publishEventForPlugin(dispatchConfig, PluginModule, eventName) { |
4007 | !!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) : invariant(false) : undefined; | 5746 | !!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; |
4008 | EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig; | 5747 | EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig; |
4009 | 5748 | ||
4010 | var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; | 5749 | var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; |
@@ -4032,9 +5771,18 @@ | |||
4032 | * @private | 5771 | * @private |
4033 | */ | 5772 | */ |
4034 | function publishRegistrationName(registrationName, PluginModule, eventName) { | 5773 | function publishRegistrationName(registrationName, PluginModule, eventName) { |
4035 | !!EventPluginRegistry.registrationNameModules[registrationName] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same ' + 'registration name, `%s`.', registrationName) : invariant(false) : undefined; | 5774 | !!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; |
4036 | EventPluginRegistry.registrationNameModules[registrationName] = PluginModule; | 5775 | EventPluginRegistry.registrationNameModules[registrationName] = PluginModule; |
4037 | EventPluginRegistry.registrationNameDependencies[registrationName] = PluginModule.eventTypes[eventName].dependencies; | 5776 | EventPluginRegistry.registrationNameDependencies[registrationName] = PluginModule.eventTypes[eventName].dependencies; |
5777 | |||
5778 | if (process.env.NODE_ENV !== 'production') { | ||
5779 | var lowerCasedName = registrationName.toLowerCase(); | ||
5780 | EventPluginRegistry.possibleRegistrationNames[lowerCasedName] = registrationName; | ||
5781 | |||
5782 | if (registrationName === 'onDoubleClick') { | ||
5783 | EventPluginRegistry.possibleRegistrationNames.ondblclick = registrationName; | ||
5784 | } | ||
5785 | } | ||
4038 | } | 5786 | } |
4039 | 5787 | ||
4040 | /** | 5788 | /** |
@@ -4065,6 +5813,14 @@ | |||
4065 | registrationNameDependencies: {}, | 5813 | registrationNameDependencies: {}, |
4066 | 5814 | ||
4067 | /** | 5815 | /** |
5816 | * Mapping from lowercase registration names to the properly cased version, | ||
5817 | * used to warn in the case of missing event handlers. Available | ||
5818 | * only in __DEV__. | ||
5819 | * @type {Object} | ||
5820 | */ | ||
5821 | possibleRegistrationNames: process.env.NODE_ENV !== 'production' ? {} : null, | ||
5822 | |||
5823 | /** | ||
4068 | * Injects an ordering of plugins (by plugin name). This allows the ordering | 5824 | * Injects an ordering of plugins (by plugin name). This allows the ordering |
4069 | * to be decoupled from injection of the actual plugins so that ordering is | 5825 | * to be decoupled from injection of the actual plugins so that ordering is |
4070 | * always deterministic regardless of packaging, on-the-fly injection, etc. | 5826 | * always deterministic regardless of packaging, on-the-fly injection, etc. |
@@ -4074,7 +5830,7 @@ | |||
4074 | * @see {EventPluginHub.injection.injectEventPluginOrder} | 5830 | * @see {EventPluginHub.injection.injectEventPluginOrder} |
4075 | */ | 5831 | */ |
4076 | injectEventPluginOrder: function (InjectedEventPluginOrder) { | 5832 | injectEventPluginOrder: function (InjectedEventPluginOrder) { |
4077 | !!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.') : invariant(false) : undefined; | 5833 | !!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; |
4078 | // Clone the ordering so it cannot be dynamically mutated. | 5834 | // Clone the ordering so it cannot be dynamically mutated. |
4079 | EventPluginOrder = Array.prototype.slice.call(InjectedEventPluginOrder); | 5835 | EventPluginOrder = Array.prototype.slice.call(InjectedEventPluginOrder); |
4080 | recomputePluginOrdering(); | 5836 | recomputePluginOrdering(); |
@@ -4098,7 +5854,7 @@ | |||
4098 | } | 5854 | } |
4099 | var PluginModule = injectedNamesToPlugins[pluginName]; | 5855 | var PluginModule = injectedNamesToPlugins[pluginName]; |
4100 | if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== PluginModule) { | 5856 | if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== PluginModule) { |
4101 | !!namesToPlugins[pluginName] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins ' + 'using the same name, `%s`.', pluginName) : invariant(false) : undefined; | 5857 | !!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; |
4102 | namesToPlugins[pluginName] = PluginModule; | 5858 | namesToPlugins[pluginName] = PluginModule; |
4103 | isOrderingDirty = true; | 5859 | isOrderingDirty = true; |
4104 | } | 5860 | } |
@@ -4158,19 +5914,28 @@ | |||
4158 | delete registrationNameModules[registrationName]; | 5914 | delete registrationNameModules[registrationName]; |
4159 | } | 5915 | } |
4160 | } | 5916 | } |
5917 | |||
5918 | if (process.env.NODE_ENV !== 'production') { | ||
5919 | var possibleRegistrationNames = EventPluginRegistry.possibleRegistrationNames; | ||
5920 | for (var lowerCasedName in possibleRegistrationNames) { | ||
5921 | if (possibleRegistrationNames.hasOwnProperty(lowerCasedName)) { | ||
5922 | delete possibleRegistrationNames[lowerCasedName]; | ||
5923 | } | ||
5924 | } | ||
5925 | } | ||
4161 | } | 5926 | } |
4162 | 5927 | ||
4163 | }; | 5928 | }; |
4164 | 5929 | ||
4165 | module.exports = EventPluginRegistry; | 5930 | module.exports = EventPluginRegistry; |
4166 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | 5931 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) |
4167 | 5932 | ||
4168 | /***/ }, | 5933 | /***/ }, |
4169 | /* 35 */ | 5934 | /* 48 */ |
4170 | /***/ function(module, exports, __webpack_require__) { | 5935 | /***/ function(module, exports, __webpack_require__) { |
4171 | 5936 | ||
4172 | /* WEBPACK VAR INJECTION */(function(process) {/** | 5937 | /* WEBPACK VAR INJECTION */(function(process) {/** |
4173 | * Copyright 2013-2015, Facebook, Inc. | 5938 | * Copyright 2013-present, Facebook, Inc. |
4174 | * All rights reserved. | 5939 | * All rights reserved. |
4175 | * | 5940 | * |
4176 | * This source code is licensed under the BSD-style license found in the | 5941 | * This source code is licensed under the BSD-style license found in the |
@@ -4182,26 +5947,35 @@ | |||
4182 | 5947 | ||
4183 | 'use strict'; | 5948 | 'use strict'; |
4184 | 5949 | ||
4185 | var EventConstants = __webpack_require__(32); | 5950 | var _prodInvariant = __webpack_require__(9); |
4186 | var ReactErrorUtils = __webpack_require__(36); | 5951 | |
5952 | var EventConstants = __webpack_require__(44); | ||
5953 | var ReactErrorUtils = __webpack_require__(49); | ||
4187 | 5954 | ||
4188 | var invariant = __webpack_require__(15); | 5955 | var invariant = __webpack_require__(10); |
4189 | var warning = __webpack_require__(27); | 5956 | var warning = __webpack_require__(13); |
4190 | 5957 | ||
4191 | /** | 5958 | /** |
4192 | * Injected dependencies: | 5959 | * Injected dependencies: |
4193 | */ | 5960 | */ |
4194 | 5961 | ||
4195 | /** | 5962 | /** |
4196 | * - `Mount`: [required] Module that can convert between React dom IDs and | 5963 | * - `ComponentTree`: [required] Module that can convert between React instances |
4197 | * actual node references. | 5964 | * and actual node references. |
4198 | */ | 5965 | */ |
5966 | var ComponentTree; | ||
5967 | var TreeTraversal; | ||
4199 | var injection = { | 5968 | var injection = { |
4200 | Mount: null, | 5969 | injectComponentTree: function (Injected) { |
4201 | injectMount: function (InjectedMount) { | 5970 | ComponentTree = Injected; |
4202 | injection.Mount = InjectedMount; | ||
4203 | if (process.env.NODE_ENV !== 'production') { | 5971 | if (process.env.NODE_ENV !== 'production') { |
4204 | process.env.NODE_ENV !== 'production' ? warning(InjectedMount && InjectedMount.getNode && InjectedMount.getID, 'EventPluginUtils.injection.injectMount(...): Injected Mount ' + 'module is missing getNode or getID.') : undefined; | 5972 | process.env.NODE_ENV !== 'production' ? warning(Injected && Injected.getNodeFromInstance && Injected.getInstanceFromNode, 'EventPluginUtils.injection.injectComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.') : void 0; |
5973 | } | ||
5974 | }, | ||
5975 | injectTreeTraversal: function (Injected) { | ||
5976 | TreeTraversal = Injected; | ||
5977 | if (process.env.NODE_ENV !== 'production') { | ||
5978 | process.env.NODE_ENV !== 'production' ? warning(Injected && Injected.isAncestor && Injected.getLowestCommonAncestor, 'EventPluginUtils.injection.injectTreeTraversal(...): Injected ' + 'module is missing isAncestor or getLowestCommonAncestor.') : void 0; | ||
4205 | } | 5979 | } |
4206 | } | 5980 | } |
4207 | }; | 5981 | }; |
@@ -4223,14 +5997,15 @@ | |||
4223 | if (process.env.NODE_ENV !== 'production') { | 5997 | if (process.env.NODE_ENV !== 'production') { |
4224 | validateEventDispatches = function (event) { | 5998 | validateEventDispatches = function (event) { |
4225 | var dispatchListeners = event._dispatchListeners; | 5999 | var dispatchListeners = event._dispatchListeners; |
4226 | var dispatchIDs = event._dispatchIDs; | 6000 | var dispatchInstances = event._dispatchInstances; |
4227 | 6001 | ||
4228 | var listenersIsArr = Array.isArray(dispatchListeners); | 6002 | var listenersIsArr = Array.isArray(dispatchListeners); |
4229 | var idsIsArr = Array.isArray(dispatchIDs); | ||
4230 | var IDsLen = idsIsArr ? dispatchIDs.length : dispatchIDs ? 1 : 0; | ||
4231 | var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0; | 6003 | var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0; |
4232 | 6004 | ||
4233 | process.env.NODE_ENV !== 'production' ? warning(idsIsArr === listenersIsArr && IDsLen === listenersLen, 'EventPluginUtils: Invalid `event`.') : undefined; | 6005 | var instancesIsArr = Array.isArray(dispatchInstances); |
6006 | var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0; | ||
6007 | |||
6008 | process.env.NODE_ENV !== 'production' ? warning(instancesIsArr === listenersIsArr && instancesLen === listenersLen, 'EventPluginUtils: Invalid `event`.') : void 0; | ||
4234 | }; | 6009 | }; |
4235 | } | 6010 | } |
4236 | 6011 | ||
@@ -4239,15 +6014,15 @@ | |||
4239 | * @param {SyntheticEvent} event SyntheticEvent to handle | 6014 | * @param {SyntheticEvent} event SyntheticEvent to handle |
4240 | * @param {boolean} simulated If the event is simulated (changes exn behavior) | 6015 | * @param {boolean} simulated If the event is simulated (changes exn behavior) |
4241 | * @param {function} listener Application-level callback | 6016 | * @param {function} listener Application-level callback |
4242 | * @param {string} domID DOM id to pass to the callback. | 6017 | * @param {*} inst Internal component instance |
4243 | */ | 6018 | */ |
4244 | function executeDispatch(event, simulated, listener, domID) { | 6019 | function executeDispatch(event, simulated, listener, inst) { |
4245 | var type = event.type || 'unknown-event'; | 6020 | var type = event.type || 'unknown-event'; |
4246 | event.currentTarget = injection.Mount.getNode(domID); | 6021 | event.currentTarget = EventPluginUtils.getNodeFromInstance(inst); |
4247 | if (simulated) { | 6022 | if (simulated) { |
4248 | ReactErrorUtils.invokeGuardedCallbackWithCatch(type, listener, event, domID); | 6023 | ReactErrorUtils.invokeGuardedCallbackWithCatch(type, listener, event); |
4249 | } else { | 6024 | } else { |
4250 | ReactErrorUtils.invokeGuardedCallback(type, listener, event, domID); | 6025 | ReactErrorUtils.invokeGuardedCallback(type, listener, event); |
4251 | } | 6026 | } |
4252 | event.currentTarget = null; | 6027 | event.currentTarget = null; |
4253 | } | 6028 | } |
@@ -4257,7 +6032,7 @@ | |||
4257 | */ | 6032 | */ |
4258 | function executeDispatchesInOrder(event, simulated) { | 6033 | function executeDispatchesInOrder(event, simulated) { |
4259 | var dispatchListeners = event._dispatchListeners; | 6034 | var dispatchListeners = event._dispatchListeners; |
4260 | var dispatchIDs = event._dispatchIDs; | 6035 | var dispatchInstances = event._dispatchInstances; |
4261 | if (process.env.NODE_ENV !== 'production') { | 6036 | if (process.env.NODE_ENV !== 'production') { |
4262 | validateEventDispatches(event); | 6037 | validateEventDispatches(event); |
4263 | } | 6038 | } |
@@ -4266,14 +6041,14 @@ | |||
4266 | if (event.isPropagationStopped()) { | 6041 | if (event.isPropagationStopped()) { |
4267 | break; | 6042 | break; |
4268 | } | 6043 | } |
4269 | // Listeners and IDs are two parallel arrays that are always in sync. | 6044 | // Listeners and Instances are two parallel arrays that are always in sync. |
4270 | executeDispatch(event, simulated, dispatchListeners[i], dispatchIDs[i]); | 6045 | executeDispatch(event, simulated, dispatchListeners[i], dispatchInstances[i]); |
4271 | } | 6046 | } |
4272 | } else if (dispatchListeners) { | 6047 | } else if (dispatchListeners) { |
4273 | executeDispatch(event, simulated, dispatchListeners, dispatchIDs); | 6048 | executeDispatch(event, simulated, dispatchListeners, dispatchInstances); |
4274 | } | 6049 | } |
4275 | event._dispatchListeners = null; | 6050 | event._dispatchListeners = null; |
4276 | event._dispatchIDs = null; | 6051 | event._dispatchInstances = null; |
4277 | } | 6052 | } |
4278 | 6053 | ||
4279 | /** | 6054 | /** |
@@ -4285,7 +6060,7 @@ | |||
4285 | */ | 6060 | */ |
4286 | function executeDispatchesInOrderStopAtTrueImpl(event) { | 6061 | function executeDispatchesInOrderStopAtTrueImpl(event) { |
4287 | var dispatchListeners = event._dispatchListeners; | 6062 | var dispatchListeners = event._dispatchListeners; |
4288 | var dispatchIDs = event._dispatchIDs; | 6063 | var dispatchInstances = event._dispatchInstances; |
4289 | if (process.env.NODE_ENV !== 'production') { | 6064 | if (process.env.NODE_ENV !== 'production') { |
4290 | validateEventDispatches(event); | 6065 | validateEventDispatches(event); |
4291 | } | 6066 | } |
@@ -4294,14 +6069,14 @@ | |||
4294 | if (event.isPropagationStopped()) { | 6069 | if (event.isPropagationStopped()) { |
4295 | break; | 6070 | break; |
4296 | } | 6071 | } |
4297 | // Listeners and IDs are two parallel arrays that are always in sync. | 6072 | // Listeners and Instances are two parallel arrays that are always in sync. |
4298 | if (dispatchListeners[i](event, dispatchIDs[i])) { | 6073 | if (dispatchListeners[i](event, dispatchInstances[i])) { |
4299 | return dispatchIDs[i]; | 6074 | return dispatchInstances[i]; |
4300 | } | 6075 | } |
4301 | } | 6076 | } |
4302 | } else if (dispatchListeners) { | 6077 | } else if (dispatchListeners) { |
4303 | if (dispatchListeners(event, dispatchIDs)) { | 6078 | if (dispatchListeners(event, dispatchInstances)) { |
4304 | return dispatchIDs; | 6079 | return dispatchInstances; |
4305 | } | 6080 | } |
4306 | } | 6081 | } |
4307 | return null; | 6082 | return null; |
@@ -4312,7 +6087,7 @@ | |||
4312 | */ | 6087 | */ |
4313 | function executeDispatchesInOrderStopAtTrue(event) { | 6088 | function executeDispatchesInOrderStopAtTrue(event) { |
4314 | var ret = executeDispatchesInOrderStopAtTrueImpl(event); | 6089 | var ret = executeDispatchesInOrderStopAtTrueImpl(event); |
4315 | event._dispatchIDs = null; | 6090 | event._dispatchInstances = null; |
4316 | event._dispatchListeners = null; | 6091 | event._dispatchListeners = null; |
4317 | return ret; | 6092 | return ret; |
4318 | } | 6093 | } |
@@ -4331,11 +6106,13 @@ | |||
4331 | validateEventDispatches(event); | 6106 | validateEventDispatches(event); |
4332 | } | 6107 | } |
4333 | var dispatchListener = event._dispatchListeners; | 6108 | var dispatchListener = event._dispatchListeners; |
4334 | var dispatchID = event._dispatchIDs; | 6109 | var dispatchInstance = event._dispatchInstances; |
4335 | !!Array.isArray(dispatchListener) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : invariant(false) : undefined; | 6110 | !!Array.isArray(dispatchListener) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : _prodInvariant('103') : void 0; |
4336 | var res = dispatchListener ? dispatchListener(event, dispatchID) : null; | 6111 | event.currentTarget = dispatchListener ? EventPluginUtils.getNodeFromInstance(dispatchInstance) : null; |
6112 | var res = dispatchListener ? dispatchListener(event) : null; | ||
6113 | event.currentTarget = null; | ||
4337 | event._dispatchListeners = null; | 6114 | event._dispatchListeners = null; |
4338 | event._dispatchIDs = null; | 6115 | event._dispatchInstances = null; |
4339 | return res; | 6116 | return res; |
4340 | } | 6117 | } |
4341 | 6118 | ||
@@ -4360,25 +6137,40 @@ | |||
4360 | executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue, | 6137 | executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue, |
4361 | hasDispatches: hasDispatches, | 6138 | hasDispatches: hasDispatches, |
4362 | 6139 | ||
4363 | getNode: function (id) { | 6140 | getInstanceFromNode: function (node) { |
4364 | return injection.Mount.getNode(id); | 6141 | return ComponentTree.getInstanceFromNode(node); |
4365 | }, | 6142 | }, |
4366 | getID: function (node) { | 6143 | getNodeFromInstance: function (node) { |
4367 | return injection.Mount.getID(node); | 6144 | return ComponentTree.getNodeFromInstance(node); |
6145 | }, | ||
6146 | isAncestor: function (a, b) { | ||
6147 | return TreeTraversal.isAncestor(a, b); | ||
6148 | }, | ||
6149 | getLowestCommonAncestor: function (a, b) { | ||
6150 | return TreeTraversal.getLowestCommonAncestor(a, b); | ||
6151 | }, | ||
6152 | getParentInstance: function (inst) { | ||
6153 | return TreeTraversal.getParentInstance(inst); | ||
6154 | }, | ||
6155 | traverseTwoPhase: function (target, fn, arg) { | ||
6156 | return TreeTraversal.traverseTwoPhase(target, fn, arg); | ||
6157 | }, | ||
6158 | traverseEnterLeave: function (from, to, fn, argFrom, argTo) { | ||
6159 | return TreeTraversal.traverseEnterLeave(from, to, fn, argFrom, argTo); | ||
4368 | }, | 6160 | }, |
4369 | 6161 | ||
4370 | injection: injection | 6162 | injection: injection |
4371 | }; | 6163 | }; |
4372 | 6164 | ||
4373 | module.exports = EventPluginUtils; | 6165 | module.exports = EventPluginUtils; |
4374 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | 6166 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) |
4375 | 6167 | ||
4376 | /***/ }, | 6168 | /***/ }, |
4377 | /* 36 */ | 6169 | /* 49 */ |
4378 | /***/ function(module, exports, __webpack_require__) { | 6170 | /***/ function(module, exports, __webpack_require__) { |
4379 | 6171 | ||
4380 | /* WEBPACK VAR INJECTION */(function(process) {/** | 6172 | /* WEBPACK VAR INJECTION */(function(process) {/** |
4381 | * Copyright 2013-2015, Facebook, Inc. | 6173 | * Copyright 2013-present, Facebook, Inc. |
4382 | * All rights reserved. | 6174 | * All rights reserved. |
4383 | * | 6175 | * |
4384 | * This source code is licensed under the BSD-style license found in the | 6176 | * This source code is licensed under the BSD-style license found in the |
@@ -4386,7 +6178,6 @@ | |||
4386 | * of patent rights can be found in the PATENTS file in the same directory. | 6178 | * of patent rights can be found in the PATENTS file in the same directory. |
4387 | * | 6179 | * |
4388 | * @providesModule ReactErrorUtils | 6180 | * @providesModule ReactErrorUtils |
4389 | * @typechecks | ||
4390 | */ | 6181 | */ |
4391 | 6182 | ||
4392 | 'use strict'; | 6183 | 'use strict'; |
@@ -4454,14 +6245,14 @@ | |||
4454 | } | 6245 | } |
4455 | 6246 | ||
4456 | module.exports = ReactErrorUtils; | 6247 | module.exports = ReactErrorUtils; |
4457 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | 6248 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) |
4458 | 6249 | ||
4459 | /***/ }, | 6250 | /***/ }, |
4460 | /* 37 */ | 6251 | /* 50 */ |
4461 | /***/ function(module, exports, __webpack_require__) { | 6252 | /***/ function(module, exports, __webpack_require__) { |
4462 | 6253 | ||
4463 | /* WEBPACK VAR INJECTION */(function(process) {/** | 6254 | /* WEBPACK VAR INJECTION */(function(process) {/** |
4464 | * Copyright 2014-2015, Facebook, Inc. | 6255 | * Copyright 2014-present, Facebook, Inc. |
4465 | * All rights reserved. | 6256 | * All rights reserved. |
4466 | * | 6257 | * |
4467 | * This source code is licensed under the BSD-style license found in the | 6258 | * This source code is licensed under the BSD-style license found in the |
@@ -4469,14 +6260,16 @@ | |||
4469 | * of patent rights can be found in the PATENTS file in the same directory. | 6260 | * of patent rights can be found in the PATENTS file in the same directory. |
4470 | * | 6261 | * |
4471 | * @providesModule accumulateInto | 6262 | * @providesModule accumulateInto |
6263 | * | ||
4472 | */ | 6264 | */ |
4473 | 6265 | ||
4474 | 'use strict'; | 6266 | 'use strict'; |
4475 | 6267 | ||
4476 | var invariant = __webpack_require__(15); | 6268 | var _prodInvariant = __webpack_require__(9); |
6269 | |||
6270 | var invariant = __webpack_require__(10); | ||
4477 | 6271 | ||
4478 | /** | 6272 | /** |
4479 | * | ||
4480 | * Accumulates items that must not be null or undefined into the first one. This | 6273 | * Accumulates items that must not be null or undefined into the first one. This |
4481 | * is used to conserve memory by avoiding array allocations, and thus sacrifices | 6274 | * is used to conserve memory by avoiding array allocations, and thus sacrifices |
4482 | * API cleanness. Since `current` can be null before being passed in and not | 6275 | * API cleanness. Since `current` can be null before being passed in and not |
@@ -4490,27 +6283,24 @@ | |||
4490 | */ | 6283 | */ |
4491 | 6284 | ||
4492 | function accumulateInto(current, next) { | 6285 | function accumulateInto(current, next) { |
4493 | !(next != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : invariant(false) : undefined; | 6286 | !(next != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : _prodInvariant('30') : void 0; |
6287 | |||
4494 | if (current == null) { | 6288 | if (current == null) { |
4495 | return next; | 6289 | return next; |
4496 | } | 6290 | } |
4497 | 6291 | ||
4498 | // Both are not empty. Warning: Never call x.concat(y) when you are not | 6292 | // Both are not empty. Warning: Never call x.concat(y) when you are not |
4499 | // certain that x is an Array (x could be a string with concat method). | 6293 | // certain that x is an Array (x could be a string with concat method). |
4500 | var currentIsArray = Array.isArray(current); | 6294 | if (Array.isArray(current)) { |
4501 | var nextIsArray = Array.isArray(next); | 6295 | if (Array.isArray(next)) { |
4502 | 6296 | current.push.apply(current, next); | |
4503 | if (currentIsArray && nextIsArray) { | 6297 | return current; |
4504 | current.push.apply(current, next); | 6298 | } |
4505 | return current; | ||
4506 | } | ||
4507 | |||
4508 | if (currentIsArray) { | ||
4509 | current.push(next); | 6299 | current.push(next); |
4510 | return current; | 6300 | return current; |
4511 | } | 6301 | } |
4512 | 6302 | ||
4513 | if (nextIsArray) { | 6303 | if (Array.isArray(next)) { |
4514 | // A bit too dangerous to mutate `next`. | 6304 | // A bit too dangerous to mutate `next`. |
4515 | return [current].concat(next); | 6305 | return [current].concat(next); |
4516 | } | 6306 | } |
@@ -4519,14 +6309,14 @@ | |||
4519 | } | 6309 | } |
4520 | 6310 | ||
4521 | module.exports = accumulateInto; | 6311 | module.exports = accumulateInto; |
4522 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | 6312 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) |
4523 | 6313 | ||
4524 | /***/ }, | 6314 | /***/ }, |
4525 | /* 38 */ | 6315 | /* 51 */ |
4526 | /***/ function(module, exports) { | 6316 | /***/ function(module, exports) { |
4527 | 6317 | ||
4528 | /** | 6318 | /** |
4529 | * Copyright 2013-2015, Facebook, Inc. | 6319 | * Copyright 2013-present, Facebook, Inc. |
4530 | * All rights reserved. | 6320 | * All rights reserved. |
4531 | * | 6321 | * |
4532 | * This source code is licensed under the BSD-style license found in the | 6322 | * This source code is licensed under the BSD-style license found in the |
@@ -4534,6 +6324,7 @@ | |||
4534 | * of patent rights can be found in the PATENTS file in the same directory. | 6324 | * of patent rights can be found in the PATENTS file in the same directory. |
4535 | * | 6325 | * |
4536 | * @providesModule forEachAccumulated | 6326 | * @providesModule forEachAccumulated |
6327 | * | ||
4537 | */ | 6328 | */ |
4538 | 6329 | ||
4539 | 'use strict'; | 6330 | 'use strict'; |
@@ -4545,1064 +6336,1276 @@ | |||
4545 | * handling the case when there is exactly one item (and we do not need to | 6336 | * handling the case when there is exactly one item (and we do not need to |
4546 | * allocate an array). | 6337 | * allocate an array). |
4547 | */ | 6338 | */ |
4548 | var forEachAccumulated = function (arr, cb, scope) { | 6339 | |
6340 | function forEachAccumulated(arr, cb, scope) { | ||
4549 | if (Array.isArray(arr)) { | 6341 | if (Array.isArray(arr)) { |
4550 | arr.forEach(cb, scope); | 6342 | arr.forEach(cb, scope); |
4551 | } else if (arr) { | 6343 | } else if (arr) { |
4552 | cb.call(scope, arr); | 6344 | cb.call(scope, arr); |
4553 | } | 6345 | } |
4554 | }; | 6346 | } |
4555 | 6347 | ||
4556 | module.exports = forEachAccumulated; | 6348 | module.exports = forEachAccumulated; |
4557 | 6349 | ||
4558 | /***/ }, | 6350 | /***/ }, |
4559 | /* 39 */ | 6351 | /* 52 */ |
4560 | /***/ function(module, exports, __webpack_require__) { | 6352 | /***/ function(module, exports) { |
4561 | 6353 | ||
4562 | /** | 6354 | /** |
4563 | * Copyright 2013-2015, Facebook, Inc. | 6355 | * Copyright (c) 2013-present, Facebook, Inc. |
4564 | * All rights reserved. | 6356 | * All rights reserved. |
4565 | * | 6357 | * |
4566 | * This source code is licensed under the BSD-style license found in the | 6358 | * This source code is licensed under the BSD-style license found in the |
4567 | * LICENSE file in the root directory of this source tree. An additional grant | 6359 | * LICENSE file in the root directory of this source tree. An additional grant |
4568 | * of patent rights can be found in the PATENTS file in the same directory. | 6360 | * of patent rights can be found in the PATENTS file in the same directory. |
4569 | * | 6361 | * |
4570 | * @providesModule ReactEventEmitterMixin | ||
4571 | */ | 6362 | */ |
4572 | 6363 | ||
4573 | 'use strict'; | 6364 | 'use strict'; |
4574 | 6365 | ||
4575 | var EventPluginHub = __webpack_require__(33); | 6366 | var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement); |
4576 | 6367 | ||
4577 | function runEventQueueInBatch(events) { | 6368 | /** |
4578 | EventPluginHub.enqueueEvents(events); | 6369 | * Simple, lightweight module assisting with the detection and context of |
4579 | EventPluginHub.processEventQueue(false); | 6370 | * Worker. Helps avoid circular dependencies and allows code to reason about |
4580 | } | 6371 | * whether or not they are in a Worker, even if they never include the main |
6372 | * `ReactWorker` dependency. | ||
6373 | */ | ||
6374 | var ExecutionEnvironment = { | ||
4581 | 6375 | ||
4582 | var ReactEventEmitterMixin = { | 6376 | canUseDOM: canUseDOM, |
6377 | |||
6378 | canUseWorkers: typeof Worker !== 'undefined', | ||
6379 | |||
6380 | canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent), | ||
6381 | |||
6382 | canUseViewport: canUseDOM && !!window.screen, | ||
6383 | |||
6384 | isInWorker: !canUseDOM // For now, this is true - might change in the future. | ||
4583 | 6385 | ||
4584 | /** | ||
4585 | * Streams a fired top-level event to `EventPluginHub` where plugins have the | ||
4586 | * opportunity to create `ReactEvent`s to be dispatched. | ||
4587 | * | ||
4588 | * @param {string} topLevelType Record from `EventConstants`. | ||
4589 | * @param {object} topLevelTarget The listening component root node. | ||
4590 | * @param {string} topLevelTargetID ID of `topLevelTarget`. | ||
4591 | * @param {object} nativeEvent Native environment event. | ||
4592 | */ | ||
4593 | handleTopLevel: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) { | ||
4594 | var events = EventPluginHub.extractEvents(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget); | ||
4595 | runEventQueueInBatch(events); | ||
4596 | } | ||
4597 | }; | 6386 | }; |
4598 | 6387 | ||
4599 | module.exports = ReactEventEmitterMixin; | 6388 | module.exports = ExecutionEnvironment; |
4600 | 6389 | ||
4601 | /***/ }, | 6390 | /***/ }, |
4602 | /* 40 */ | 6391 | /* 53 */ |
4603 | /***/ function(module, exports) { | 6392 | /***/ function(module, exports, __webpack_require__) { |
4604 | 6393 | ||
4605 | /** | 6394 | /** |
4606 | * Copyright 2013-2015, Facebook, Inc. | 6395 | * Copyright 2013-present, Facebook, Inc. |
4607 | * All rights reserved. | 6396 | * All rights reserved. |
4608 | * | 6397 | * |
4609 | * This source code is licensed under the BSD-style license found in the | 6398 | * This source code is licensed under the BSD-style license found in the |
4610 | * LICENSE file in the root directory of this source tree. An additional grant | 6399 | * LICENSE file in the root directory of this source tree. An additional grant |
4611 | * of patent rights can be found in the PATENTS file in the same directory. | 6400 | * of patent rights can be found in the PATENTS file in the same directory. |
4612 | * | 6401 | * |
4613 | * @providesModule ViewportMetrics | 6402 | * @providesModule FallbackCompositionState |
4614 | */ | 6403 | */ |
4615 | 6404 | ||
4616 | 'use strict'; | 6405 | 'use strict'; |
4617 | 6406 | ||
4618 | var ViewportMetrics = { | 6407 | var _assign = __webpack_require__(6); |
4619 | |||
4620 | currentScrollLeft: 0, | ||
4621 | |||
4622 | currentScrollTop: 0, | ||
4623 | 6408 | ||
4624 | refreshScrollValues: function (scrollPosition) { | 6409 | var PooledClass = __webpack_require__(8); |
4625 | ViewportMetrics.currentScrollLeft = scrollPosition.x; | ||
4626 | ViewportMetrics.currentScrollTop = scrollPosition.y; | ||
4627 | } | ||
4628 | 6410 | ||
4629 | }; | 6411 | var getTextContentAccessor = __webpack_require__(54); |
4630 | 6412 | ||
4631 | module.exports = ViewportMetrics; | ||
4632 | |||
4633 | /***/ }, | ||
4634 | /* 41 */ | ||
4635 | /***/ function(module, exports) { | ||
4636 | |||
4637 | /** | 6413 | /** |
4638 | * Copyright 2014-2015, Facebook, Inc. | 6414 | * This helper class stores information about text content of a target node, |
4639 | * All rights reserved. | 6415 | * allowing comparison of content before and after a given event. |
4640 | * | 6416 | * |
4641 | * This source code is licensed under the BSD-style license found in the | 6417 | * Identify the node where selection currently begins, then observe |
4642 | * LICENSE file in the root directory of this source tree. An additional grant | 6418 | * both its text content and its current position in the DOM. Since the |
4643 | * of patent rights can be found in the PATENTS file in the same directory. | 6419 | * browser may natively replace the target node during composition, we can |
6420 | * use its position to find its replacement. | ||
4644 | * | 6421 | * |
4645 | * @providesModule Object.assign | 6422 | * @param {DOMEventTarget} root |
4646 | */ | 6423 | */ |
6424 | function FallbackCompositionState(root) { | ||
6425 | this._root = root; | ||
6426 | this._startText = this.getText(); | ||
6427 | this._fallbackText = null; | ||
6428 | } | ||
4647 | 6429 | ||
4648 | // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign | 6430 | _assign(FallbackCompositionState.prototype, { |
4649 | 6431 | destructor: function () { | |
4650 | 'use strict'; | 6432 | this._root = null; |
4651 | 6433 | this._startText = null; | |
4652 | function assign(target, sources) { | 6434 | this._fallbackText = null; |
4653 | if (target == null) { | 6435 | }, |
4654 | throw new TypeError('Object.assign target cannot be null or undefined'); | ||
4655 | } | ||
4656 | 6436 | ||
4657 | var to = Object(target); | 6437 | /** |
4658 | var hasOwnProperty = Object.prototype.hasOwnProperty; | 6438 | * Get current text of input. |
6439 | * | ||
6440 | * @return {string} | ||
6441 | */ | ||
6442 | getText: function () { | ||
6443 | if ('value' in this._root) { | ||
6444 | return this._root.value; | ||
6445 | } | ||
6446 | return this._root[getTextContentAccessor()]; | ||
6447 | }, | ||
4659 | 6448 | ||
4660 | for (var nextIndex = 1; nextIndex < arguments.length; nextIndex++) { | 6449 | /** |
4661 | var nextSource = arguments[nextIndex]; | 6450 | * Determine the differing substring between the initially stored |
4662 | if (nextSource == null) { | 6451 | * text content and the current content. |
4663 | continue; | 6452 | * |
6453 | * @return {string} | ||
6454 | */ | ||
6455 | getData: function () { | ||
6456 | if (this._fallbackText) { | ||
6457 | return this._fallbackText; | ||
4664 | } | 6458 | } |
4665 | 6459 | ||
4666 | var from = Object(nextSource); | 6460 | var start; |
6461 | var startValue = this._startText; | ||
6462 | var startLength = startValue.length; | ||
6463 | var end; | ||
6464 | var endValue = this.getText(); | ||
6465 | var endLength = endValue.length; | ||
4667 | 6466 | ||
4668 | // We don't currently support accessors nor proxies. Therefore this | 6467 | for (start = 0; start < startLength; start++) { |
4669 | // copy cannot throw. If we ever supported this then we must handle | 6468 | if (startValue[start] !== endValue[start]) { |
4670 | // exceptions and side-effects. We don't support symbols so they won't | 6469 | break; |
4671 | // be transferred. | 6470 | } |
6471 | } | ||
4672 | 6472 | ||
4673 | for (var key in from) { | 6473 | var minEnd = startLength - start; |
4674 | if (hasOwnProperty.call(from, key)) { | 6474 | for (end = 1; end <= minEnd; end++) { |
4675 | to[key] = from[key]; | 6475 | if (startValue[startLength - end] !== endValue[endLength - end]) { |
6476 | break; | ||
4676 | } | 6477 | } |
4677 | } | 6478 | } |
6479 | |||
6480 | var sliceTail = end > 1 ? 1 - end : undefined; | ||
6481 | this._fallbackText = endValue.slice(start, sliceTail); | ||
6482 | return this._fallbackText; | ||
4678 | } | 6483 | } |
6484 | }); | ||
4679 | 6485 | ||
4680 | return to; | 6486 | PooledClass.addPoolingTo(FallbackCompositionState); |
4681 | } | ||
4682 | 6487 | ||
4683 | module.exports = assign; | 6488 | module.exports = FallbackCompositionState; |
4684 | 6489 | ||
4685 | /***/ }, | 6490 | /***/ }, |
4686 | /* 42 */ | 6491 | /* 54 */ |
4687 | /***/ function(module, exports, __webpack_require__) { | 6492 | /***/ function(module, exports, __webpack_require__) { |
4688 | 6493 | ||
4689 | /** | 6494 | /** |
4690 | * Copyright 2013-2015, Facebook, Inc. | 6495 | * Copyright 2013-present, Facebook, Inc. |
4691 | * All rights reserved. | 6496 | * All rights reserved. |
4692 | * | 6497 | * |
4693 | * This source code is licensed under the BSD-style license found in the | 6498 | * This source code is licensed under the BSD-style license found in the |
4694 | * LICENSE file in the root directory of this source tree. An additional grant | 6499 | * LICENSE file in the root directory of this source tree. An additional grant |
4695 | * of patent rights can be found in the PATENTS file in the same directory. | 6500 | * of patent rights can be found in the PATENTS file in the same directory. |
4696 | * | 6501 | * |
4697 | * @providesModule isEventSupported | 6502 | * @providesModule getTextContentAccessor |
4698 | */ | 6503 | */ |
4699 | 6504 | ||
4700 | 'use strict'; | 6505 | 'use strict'; |
4701 | 6506 | ||
4702 | var ExecutionEnvironment = __webpack_require__(11); | 6507 | var ExecutionEnvironment = __webpack_require__(52); |
4703 | 6508 | ||
4704 | var useHasFeature; | 6509 | var contentKey = null; |
4705 | if (ExecutionEnvironment.canUseDOM) { | ||
4706 | useHasFeature = document.implementation && document.implementation.hasFeature && | ||
4707 | // always returns true in newer browsers as per the standard. | ||
4708 | // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature | ||
4709 | document.implementation.hasFeature('', '') !== true; | ||
4710 | } | ||
4711 | 6510 | ||
4712 | /** | 6511 | /** |
4713 | * Checks if an event is supported in the current execution environment. | 6512 | * Gets the key used to access text content on a DOM node. |
4714 | * | ||
4715 | * NOTE: This will not work correctly for non-generic events such as `change`, | ||
4716 | * `reset`, `load`, `error`, and `select`. | ||
4717 | * | ||
4718 | * Borrows from Modernizr. | ||
4719 | * | 6513 | * |
4720 | * @param {string} eventNameSuffix Event name, e.g. "click". | 6514 | * @return {?string} Key used to access text content. |
4721 | * @param {?boolean} capture Check if the capture phase is supported. | ||
4722 | * @return {boolean} True if the event is supported. | ||
4723 | * @internal | 6515 | * @internal |
4724 | * @license Modernizr 3.0.0pre (Custom Build) | MIT | ||
4725 | */ | 6516 | */ |
4726 | function isEventSupported(eventNameSuffix, capture) { | 6517 | function getTextContentAccessor() { |
4727 | if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) { | 6518 | if (!contentKey && ExecutionEnvironment.canUseDOM) { |
4728 | return false; | 6519 | // Prefer textContent to innerText because many browsers support both but |
4729 | } | 6520 | // SVG <text> elements don't support innerText even when <div> does. |
4730 | 6521 | contentKey = 'textContent' in document.documentElement ? 'textContent' : 'innerText'; | |
4731 | var eventName = 'on' + eventNameSuffix; | ||
4732 | var isSupported = (eventName in document); | ||
4733 | |||
4734 | if (!isSupported) { | ||
4735 | var element = document.createElement('div'); | ||
4736 | element.setAttribute(eventName, 'return;'); | ||
4737 | isSupported = typeof element[eventName] === 'function'; | ||
4738 | } | ||
4739 | |||
4740 | if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') { | ||
4741 | // This is the only way to test support for the `wheel` event in IE9+. | ||
4742 | isSupported = document.implementation.hasFeature('Events.wheel', '3.0'); | ||
4743 | } | 6522 | } |
4744 | 6523 | return contentKey; | |
4745 | return isSupported; | ||
4746 | } | 6524 | } |
4747 | 6525 | ||
4748 | module.exports = isEventSupported; | 6526 | module.exports = getTextContentAccessor; |
4749 | 6527 | ||
4750 | /***/ }, | 6528 | /***/ }, |
4751 | /* 43 */ | 6529 | /* 55 */ |
4752 | /***/ function(module, exports) { | 6530 | /***/ function(module, exports, __webpack_require__) { |
4753 | 6531 | ||
4754 | /** | 6532 | /** |
4755 | * Copyright 2013-2015, Facebook, Inc. | 6533 | * Copyright 2013-present, Facebook, Inc. |
4756 | * All rights reserved. | 6534 | * All rights reserved. |
4757 | * | 6535 | * |
4758 | * This source code is licensed under the BSD-style license found in the | 6536 | * This source code is licensed under the BSD-style license found in the |
4759 | * LICENSE file in the root directory of this source tree. An additional grant | 6537 | * LICENSE file in the root directory of this source tree. An additional grant |
4760 | * of patent rights can be found in the PATENTS file in the same directory. | 6538 | * of patent rights can be found in the PATENTS file in the same directory. |
4761 | * | 6539 | * |
4762 | * @providesModule ReactDOMFeatureFlags | 6540 | * @providesModule SyntheticCompositionEvent |
4763 | */ | 6541 | */ |
4764 | 6542 | ||
4765 | 'use strict'; | 6543 | 'use strict'; |
4766 | 6544 | ||
4767 | var ReactDOMFeatureFlags = { | 6545 | var SyntheticEvent = __webpack_require__(56); |
4768 | useCreateElement: false | 6546 | |
6547 | /** | ||
6548 | * @interface Event | ||
6549 | * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents | ||
6550 | */ | ||
6551 | var CompositionEventInterface = { | ||
6552 | data: null | ||
4769 | }; | 6553 | }; |
4770 | 6554 | ||
4771 | module.exports = ReactDOMFeatureFlags; | 6555 | /** |
6556 | * @param {object} dispatchConfig Configuration used to dispatch this event. | ||
6557 | * @param {string} dispatchMarker Marker identifying the event target. | ||
6558 | * @param {object} nativeEvent Native browser event. | ||
6559 | * @extends {SyntheticUIEvent} | ||
6560 | */ | ||
6561 | function SyntheticCompositionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | ||
6562 | return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | ||
6563 | } | ||
6564 | |||
6565 | SyntheticEvent.augmentClass(SyntheticCompositionEvent, CompositionEventInterface); | ||
6566 | |||
6567 | module.exports = SyntheticCompositionEvent; | ||
4772 | 6568 | ||
4773 | /***/ }, | 6569 | /***/ }, |
4774 | /* 44 */ | 6570 | /* 56 */ |
4775 | /***/ function(module, exports, __webpack_require__) { | 6571 | /***/ function(module, exports, __webpack_require__) { |
4776 | 6572 | ||
4777 | /* WEBPACK VAR INJECTION */(function(process) {/** | 6573 | /* WEBPACK VAR INJECTION */(function(process) {/** |
4778 | * Copyright 2014-2015, Facebook, Inc. | 6574 | * Copyright 2013-present, Facebook, Inc. |
4779 | * All rights reserved. | 6575 | * All rights reserved. |
4780 | * | 6576 | * |
4781 | * This source code is licensed under the BSD-style license found in the | 6577 | * This source code is licensed under the BSD-style license found in the |
4782 | * LICENSE file in the root directory of this source tree. An additional grant | 6578 | * LICENSE file in the root directory of this source tree. An additional grant |
4783 | * of patent rights can be found in the PATENTS file in the same directory. | 6579 | * of patent rights can be found in the PATENTS file in the same directory. |
4784 | * | 6580 | * |
4785 | * @providesModule ReactElement | 6581 | * @providesModule SyntheticEvent |
4786 | */ | 6582 | */ |
4787 | 6583 | ||
4788 | 'use strict'; | 6584 | 'use strict'; |
4789 | 6585 | ||
4790 | var ReactCurrentOwner = __webpack_require__(7); | 6586 | var _assign = __webpack_require__(6); |
4791 | 6587 | ||
4792 | var assign = __webpack_require__(41); | 6588 | var PooledClass = __webpack_require__(8); |
4793 | var canDefineProperty = __webpack_require__(45); | ||
4794 | 6589 | ||
4795 | // The Symbol used to tag the ReactElement type. If there is no native Symbol | 6590 | var emptyFunction = __webpack_require__(14); |
4796 | // nor polyfill, then a plain number is used for performance. | 6591 | var warning = __webpack_require__(13); |
4797 | var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7; | ||
4798 | 6592 | ||
4799 | var RESERVED_PROPS = { | 6593 | var didWarnForAddedNewProperty = false; |
4800 | key: true, | 6594 | var isProxySupported = typeof Proxy === 'function'; |
4801 | ref: true, | 6595 | |
4802 | __self: true, | 6596 | var shouldBeReleasedProperties = ['dispatchConfig', '_targetInst', 'nativeEvent', 'isDefaultPrevented', 'isPropagationStopped', '_dispatchListeners', '_dispatchInstances']; |
4803 | __source: true | 6597 | |
6598 | /** | ||
6599 | * @interface Event | ||
6600 | * @see http://www.w3.org/TR/DOM-Level-3-Events/ | ||
6601 | */ | ||
6602 | var EventInterface = { | ||
6603 | type: null, | ||
6604 | target: null, | ||
6605 | // currentTarget is set when dispatching; no use in copying it here | ||
6606 | currentTarget: emptyFunction.thatReturnsNull, | ||
6607 | eventPhase: null, | ||
6608 | bubbles: null, | ||
6609 | cancelable: null, | ||
6610 | timeStamp: function (event) { | ||
6611 | return event.timeStamp || Date.now(); | ||
6612 | }, | ||
6613 | defaultPrevented: null, | ||
6614 | isTrusted: null | ||
4804 | }; | 6615 | }; |
4805 | 6616 | ||
4806 | /** | 6617 | /** |
4807 | * Base constructor for all React elements. This is only used to make this | 6618 | * Synthetic events are dispatched by event plugins, typically in response to a |
4808 | * work with a dynamic instanceof check. Nothing should live on this prototype. | 6619 | * top-level event delegation handler. |
4809 | * | 6620 | * |
4810 | * @param {*} type | 6621 | * These systems should generally use pooling to reduce the frequency of garbage |
4811 | * @param {*} key | 6622 | * collection. The system should check `isPersistent` to determine whether the |
4812 | * @param {string|object} ref | 6623 | * event should be released into the pool after being dispatched. Users that |
4813 | * @param {*} self A *temporary* helper to detect places where `this` is | 6624 | * need a persisted event should invoke `persist`. |
4814 | * different from the `owner` when React.createElement is called, so that we | 6625 | * |
4815 | * can warn. We want to get rid of owner and replace string `ref`s with arrow | 6626 | * Synthetic events (and subclasses) implement the DOM Level 3 Events API by |
4816 | * functions, and as long as `this` and owner are the same, there will be no | 6627 | * normalizing browser quirks. Subclasses do not necessarily have to implement a |
4817 | * change in behavior. | 6628 | * DOM interface; custom application-specific events can also subclass this. |
4818 | * @param {*} source An annotation object (added by a transpiler or otherwise) | 6629 | * |
4819 | * indicating filename, line number, and/or other information. | 6630 | * @param {object} dispatchConfig Configuration used to dispatch this event. |
4820 | * @param {*} owner | 6631 | * @param {*} targetInst Marker identifying the event target. |
4821 | * @param {*} props | 6632 | * @param {object} nativeEvent Native browser event. |
4822 | * @internal | 6633 | * @param {DOMEventTarget} nativeEventTarget Target node. |
4823 | */ | 6634 | */ |
4824 | var ReactElement = function (type, key, ref, self, source, owner, props) { | 6635 | function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarget) { |
4825 | var element = { | ||
4826 | // This tag allow us to uniquely identify this as a React Element | ||
4827 | $$typeof: REACT_ELEMENT_TYPE, | ||
4828 | |||
4829 | // Built-in properties that belong on the element | ||
4830 | type: type, | ||
4831 | key: key, | ||
4832 | ref: ref, | ||
4833 | props: props, | ||
4834 | |||
4835 | // Record the component responsible for creating this element. | ||
4836 | _owner: owner | ||
4837 | }; | ||
4838 | |||
4839 | if (process.env.NODE_ENV !== 'production') { | 6636 | if (process.env.NODE_ENV !== 'production') { |
4840 | // The validation flag is currently mutative. We put it on | 6637 | // these have a getter/setter for warnings |
4841 | // an external backing store so that we can freeze the whole object. | 6638 | delete this.nativeEvent; |
4842 | // This can be replaced with a WeakMap once they are implemented in | 6639 | delete this.preventDefault; |
4843 | // commonly used development environments. | 6640 | delete this.stopPropagation; |
4844 | element._store = {}; | 6641 | } |
4845 | 6642 | ||
4846 | // To make comparing ReactElements easier for testing purposes, we make | 6643 | this.dispatchConfig = dispatchConfig; |
4847 | // the validation flag non-enumerable (where possible, which should | 6644 | this._targetInst = targetInst; |
4848 | // include every environment we run tests in), so the test framework | 6645 | this.nativeEvent = nativeEvent; |
4849 | // ignores it. | 6646 | |
4850 | if (canDefineProperty) { | 6647 | var Interface = this.constructor.Interface; |
4851 | Object.defineProperty(element._store, 'validated', { | 6648 | for (var propName in Interface) { |
4852 | configurable: false, | 6649 | if (!Interface.hasOwnProperty(propName)) { |
4853 | enumerable: false, | 6650 | continue; |
4854 | writable: true, | 6651 | } |
4855 | value: false | 6652 | if (process.env.NODE_ENV !== 'production') { |
4856 | }); | 6653 | delete this[propName]; // this has a getter/setter for warnings |
4857 | // self and source are DEV only properties. | 6654 | } |
4858 | Object.defineProperty(element, '_self', { | 6655 | var normalize = Interface[propName]; |
4859 | configurable: false, | 6656 | if (normalize) { |
4860 | enumerable: false, | 6657 | this[propName] = normalize(nativeEvent); |
4861 | writable: false, | ||
4862 | value: self | ||
4863 | }); | ||
4864 | // Two elements created in two different places should be considered | ||
4865 | // equal for testing purposes and therefore we hide it from enumeration. | ||
4866 | Object.defineProperty(element, '_source', { | ||
4867 | configurable: false, | ||
4868 | enumerable: false, | ||
4869 | writable: false, | ||
4870 | value: source | ||
4871 | }); | ||
4872 | } else { | 6658 | } else { |
4873 | element._store.validated = false; | 6659 | if (propName === 'target') { |
4874 | element._self = self; | 6660 | this.target = nativeEventTarget; |
4875 | element._source = source; | 6661 | } else { |
6662 | this[propName] = nativeEvent[propName]; | ||
6663 | } | ||
4876 | } | 6664 | } |
4877 | Object.freeze(element.props); | ||
4878 | Object.freeze(element); | ||
4879 | } | 6665 | } |
4880 | 6666 | ||
4881 | return element; | 6667 | var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false; |
4882 | }; | 6668 | if (defaultPrevented) { |
6669 | this.isDefaultPrevented = emptyFunction.thatReturnsTrue; | ||
6670 | } else { | ||
6671 | this.isDefaultPrevented = emptyFunction.thatReturnsFalse; | ||
6672 | } | ||
6673 | this.isPropagationStopped = emptyFunction.thatReturnsFalse; | ||
6674 | return this; | ||
6675 | } | ||
4883 | 6676 | ||
4884 | ReactElement.createElement = function (type, config, children) { | 6677 | _assign(SyntheticEvent.prototype, { |
4885 | var propName; | ||
4886 | 6678 | ||
4887 | // Reserved names are extracted | 6679 | preventDefault: function () { |
4888 | var props = {}; | 6680 | this.defaultPrevented = true; |
6681 | var event = this.nativeEvent; | ||
6682 | if (!event) { | ||
6683 | return; | ||
6684 | } | ||
4889 | 6685 | ||
4890 | var key = null; | 6686 | if (event.preventDefault) { |
4891 | var ref = null; | 6687 | event.preventDefault(); |
4892 | var self = null; | 6688 | } else { |
4893 | var source = null; | 6689 | event.returnValue = false; |
6690 | } | ||
6691 | this.isDefaultPrevented = emptyFunction.thatReturnsTrue; | ||
6692 | }, | ||
4894 | 6693 | ||
4895 | if (config != null) { | 6694 | stopPropagation: function () { |
4896 | ref = config.ref === undefined ? null : config.ref; | 6695 | var event = this.nativeEvent; |
4897 | key = config.key === undefined ? null : '' + config.key; | 6696 | if (!event) { |
4898 | self = config.__self === undefined ? null : config.__self; | 6697 | return; |
4899 | source = config.__source === undefined ? null : config.__source; | ||
4900 | // Remaining properties are added to a new props object | ||
4901 | for (propName in config) { | ||
4902 | if (config.hasOwnProperty(propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { | ||
4903 | props[propName] = config[propName]; | ||
4904 | } | ||
4905 | } | 6698 | } |
4906 | } | ||
4907 | 6699 | ||
4908 | // Children can be more than one argument, and those are transferred onto | 6700 | if (event.stopPropagation) { |
4909 | // the newly allocated props object. | 6701 | event.stopPropagation(); |
4910 | var childrenLength = arguments.length - 2; | 6702 | } else { |
4911 | if (childrenLength === 1) { | 6703 | event.cancelBubble = true; |
4912 | props.children = children; | ||
4913 | } else if (childrenLength > 1) { | ||
4914 | var childArray = Array(childrenLength); | ||
4915 | for (var i = 0; i < childrenLength; i++) { | ||
4916 | childArray[i] = arguments[i + 2]; | ||
4917 | } | 6704 | } |
4918 | props.children = childArray; | 6705 | this.isPropagationStopped = emptyFunction.thatReturnsTrue; |
4919 | } | 6706 | }, |
4920 | 6707 | ||
4921 | // Resolve default props | 6708 | /** |
4922 | if (type && type.defaultProps) { | 6709 | * We release all dispatched `SyntheticEvent`s after each event loop, adding |
4923 | var defaultProps = type.defaultProps; | 6710 | * them back into the pool. This allows a way to hold onto a reference that |
4924 | for (propName in defaultProps) { | 6711 | * won't be added back into the pool. |
4925 | if (typeof props[propName] === 'undefined') { | 6712 | */ |
4926 | props[propName] = defaultProps[propName]; | 6713 | persist: function () { |
6714 | this.isPersistent = emptyFunction.thatReturnsTrue; | ||
6715 | }, | ||
6716 | |||
6717 | /** | ||
6718 | * Checks if this event should be released back into the pool. | ||
6719 | * | ||
6720 | * @return {boolean} True if this should not be released, false otherwise. | ||
6721 | */ | ||
6722 | isPersistent: emptyFunction.thatReturnsFalse, | ||
6723 | |||
6724 | /** | ||
6725 | * `PooledClass` looks for `destructor` on each instance it releases. | ||
6726 | */ | ||
6727 | destructor: function () { | ||
6728 | var Interface = this.constructor.Interface; | ||
6729 | for (var propName in Interface) { | ||
6730 | if (process.env.NODE_ENV !== 'production') { | ||
6731 | Object.defineProperty(this, propName, getPooledWarningPropertyDefinition(propName, Interface[propName])); | ||
6732 | } else { | ||
6733 | this[propName] = null; | ||
4927 | } | 6734 | } |
4928 | } | 6735 | } |
6736 | for (var i = 0; i < shouldBeReleasedProperties.length; i++) { | ||
6737 | this[shouldBeReleasedProperties[i]] = null; | ||
6738 | } | ||
6739 | if (process.env.NODE_ENV !== 'production') { | ||
6740 | Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null)); | ||
6741 | Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', emptyFunction)); | ||
6742 | Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', emptyFunction)); | ||
6743 | } | ||
4929 | } | 6744 | } |
4930 | 6745 | ||
4931 | return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props); | 6746 | }); |
4932 | }; | ||
4933 | 6747 | ||
4934 | ReactElement.createFactory = function (type) { | 6748 | SyntheticEvent.Interface = EventInterface; |
4935 | var factory = ReactElement.createElement.bind(null, type); | ||
4936 | // Expose the type on the factory and the prototype so that it can be | ||
4937 | // easily accessed on elements. E.g. `<Foo />.type === Foo`. | ||
4938 | // This should not be named `constructor` since this may not be the function | ||
4939 | // that created the element, and it may not even be a constructor. | ||
4940 | // Legacy hook TODO: Warn if this is accessed | ||
4941 | factory.type = type; | ||
4942 | return factory; | ||
4943 | }; | ||
4944 | 6749 | ||
4945 | ReactElement.cloneAndReplaceKey = function (oldElement, newKey) { | 6750 | if (process.env.NODE_ENV !== 'production') { |
4946 | var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props); | 6751 | if (isProxySupported) { |
6752 | /*eslint-disable no-func-assign */ | ||
6753 | SyntheticEvent = new Proxy(SyntheticEvent, { | ||
6754 | construct: function (target, args) { | ||
6755 | return this.apply(target, Object.create(target.prototype), args); | ||
6756 | }, | ||
6757 | apply: function (constructor, that, args) { | ||
6758 | return new Proxy(constructor.apply(that, args), { | ||
6759 | set: function (target, prop, value) { | ||
6760 | if (prop !== 'isPersistent' && !target.constructor.Interface.hasOwnProperty(prop) && shouldBeReleasedProperties.indexOf(prop) === -1) { | ||
6761 | 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; | ||
6762 | didWarnForAddedNewProperty = true; | ||
6763 | } | ||
6764 | target[prop] = value; | ||
6765 | return true; | ||
6766 | } | ||
6767 | }); | ||
6768 | } | ||
6769 | }); | ||
6770 | /*eslint-enable no-func-assign */ | ||
6771 | } | ||
6772 | } | ||
6773 | /** | ||
6774 | * Helper to reduce boilerplate when creating subclasses. | ||
6775 | * | ||
6776 | * @param {function} Class | ||
6777 | * @param {?object} Interface | ||
6778 | */ | ||
6779 | SyntheticEvent.augmentClass = function (Class, Interface) { | ||
6780 | var Super = this; | ||
4947 | 6781 | ||
4948 | return newElement; | 6782 | var E = function () {}; |
4949 | }; | 6783 | E.prototype = Super.prototype; |
6784 | var prototype = new E(); | ||
4950 | 6785 | ||
4951 | ReactElement.cloneAndReplaceProps = function (oldElement, newProps) { | 6786 | _assign(prototype, Class.prototype); |
4952 | var newElement = ReactElement(oldElement.type, oldElement.key, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, newProps); | 6787 | Class.prototype = prototype; |
6788 | Class.prototype.constructor = Class; | ||
4953 | 6789 | ||
4954 | if (process.env.NODE_ENV !== 'production') { | 6790 | Class.Interface = _assign({}, Super.Interface, Interface); |
4955 | // If the key on the original is valid, then the clone is valid | 6791 | Class.augmentClass = Super.augmentClass; |
4956 | newElement._store.validated = oldElement._store.validated; | ||
4957 | } | ||
4958 | 6792 | ||
4959 | return newElement; | 6793 | PooledClass.addPoolingTo(Class, PooledClass.fourArgumentPooler); |
4960 | }; | 6794 | }; |
4961 | 6795 | ||
4962 | ReactElement.cloneElement = function (element, config, children) { | 6796 | PooledClass.addPoolingTo(SyntheticEvent, PooledClass.fourArgumentPooler); |
4963 | var propName; | ||
4964 | |||
4965 | // Original props are copied | ||
4966 | var props = assign({}, element.props); | ||
4967 | 6797 | ||
4968 | // Reserved names are extracted | 6798 | module.exports = SyntheticEvent; |
4969 | var key = element.key; | ||
4970 | var ref = element.ref; | ||
4971 | // Self is preserved since the owner is preserved. | ||
4972 | var self = element._self; | ||
4973 | // Source is preserved since cloneElement is unlikely to be targeted by a | ||
4974 | // transpiler, and the original source is probably a better indicator of the | ||
4975 | // true owner. | ||
4976 | var source = element._source; | ||
4977 | 6799 | ||
4978 | // Owner will be preserved, unless ref is overridden | 6800 | /** |
4979 | var owner = element._owner; | 6801 | * Helper to nullify syntheticEvent instance properties when destructing |
6802 | * | ||
6803 | * @param {object} SyntheticEvent | ||
6804 | * @param {String} propName | ||
6805 | * @return {object} defineProperty object | ||
6806 | */ | ||
6807 | function getPooledWarningPropertyDefinition(propName, getVal) { | ||
6808 | var isFunction = typeof getVal === 'function'; | ||
6809 | return { | ||
6810 | configurable: true, | ||
6811 | set: set, | ||
6812 | get: get | ||
6813 | }; | ||
4980 | 6814 | ||
4981 | if (config != null) { | 6815 | function set(val) { |
4982 | if (config.ref !== undefined) { | 6816 | var action = isFunction ? 'setting the method' : 'setting the property'; |
4983 | // Silently steal the ref from the parent. | 6817 | warn(action, 'This is effectively a no-op'); |
4984 | ref = config.ref; | 6818 | return val; |
4985 | owner = ReactCurrentOwner.current; | ||
4986 | } | ||
4987 | if (config.key !== undefined) { | ||
4988 | key = '' + config.key; | ||
4989 | } | ||
4990 | // Remaining properties override existing props | ||
4991 | for (propName in config) { | ||
4992 | if (config.hasOwnProperty(propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { | ||
4993 | props[propName] = config[propName]; | ||
4994 | } | ||
4995 | } | ||
4996 | } | 6819 | } |
4997 | 6820 | ||
4998 | // Children can be more than one argument, and those are transferred onto | 6821 | function get() { |
4999 | // the newly allocated props object. | 6822 | var action = isFunction ? 'accessing the method' : 'accessing the property'; |
5000 | var childrenLength = arguments.length - 2; | 6823 | var result = isFunction ? 'This is a no-op function' : 'This is set to null'; |
5001 | if (childrenLength === 1) { | 6824 | warn(action, result); |
5002 | props.children = children; | 6825 | return getVal; |
5003 | } else if (childrenLength > 1) { | ||
5004 | var childArray = Array(childrenLength); | ||
5005 | for (var i = 0; i < childrenLength; i++) { | ||
5006 | childArray[i] = arguments[i + 2]; | ||
5007 | } | ||
5008 | props.children = childArray; | ||
5009 | } | 6826 | } |
5010 | 6827 | ||
5011 | return ReactElement(element.type, key, ref, self, source, owner, props); | 6828 | function warn(action, result) { |
5012 | }; | 6829 | var warningCondition = false; |
5013 | 6830 | 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; | |
5014 | /** | ||
5015 | * @param {?object} object | ||
5016 | * @return {boolean} True if `object` is a valid component. | ||
5017 | * @final | ||
5018 | */ | ||
5019 | ReactElement.isValidElement = function (object) { | ||
5020 | return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; | ||
5021 | }; | ||
5022 | |||
5023 | module.exports = ReactElement; | ||
5024 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
5025 | |||
5026 | /***/ }, | ||
5027 | /* 45 */ | ||
5028 | /***/ function(module, exports, __webpack_require__) { | ||
5029 | |||
5030 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
5031 | * Copyright 2013-2015, Facebook, Inc. | ||
5032 | * All rights reserved. | ||
5033 | * | ||
5034 | * This source code is licensed under the BSD-style license found in the | ||
5035 | * LICENSE file in the root directory of this source tree. An additional grant | ||
5036 | * of patent rights can be found in the PATENTS file in the same directory. | ||
5037 | * | ||
5038 | * @providesModule canDefineProperty | ||
5039 | */ | ||
5040 | |||
5041 | 'use strict'; | ||
5042 | |||
5043 | var canDefineProperty = false; | ||
5044 | if (process.env.NODE_ENV !== 'production') { | ||
5045 | try { | ||
5046 | Object.defineProperty({}, 'x', { get: function () {} }); | ||
5047 | canDefineProperty = true; | ||
5048 | } catch (x) { | ||
5049 | // IE will fail on defineProperty | ||
5050 | } | 6831 | } |
5051 | } | 6832 | } |
5052 | 6833 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | |
5053 | module.exports = canDefineProperty; | ||
5054 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
5055 | 6834 | ||
5056 | /***/ }, | 6835 | /***/ }, |
5057 | /* 46 */ | 6836 | /* 57 */ |
5058 | /***/ function(module, exports) { | 6837 | /***/ function(module, exports, __webpack_require__) { |
5059 | 6838 | ||
5060 | /** | 6839 | /** |
5061 | * Copyright 2014-2015, Facebook, Inc. | 6840 | * Copyright 2013-present, Facebook, Inc. |
5062 | * All rights reserved. | 6841 | * All rights reserved. |
5063 | * | 6842 | * |
5064 | * This source code is licensed under the BSD-style license found in the | 6843 | * This source code is licensed under the BSD-style license found in the |
5065 | * LICENSE file in the root directory of this source tree. An additional grant | 6844 | * LICENSE file in the root directory of this source tree. An additional grant |
5066 | * of patent rights can be found in the PATENTS file in the same directory. | 6845 | * of patent rights can be found in the PATENTS file in the same directory. |
5067 | * | 6846 | * |
5068 | * @providesModule ReactEmptyComponentRegistry | 6847 | * @providesModule SyntheticInputEvent |
5069 | */ | 6848 | */ |
5070 | 6849 | ||
5071 | 'use strict'; | 6850 | 'use strict'; |
5072 | 6851 | ||
5073 | // This registry keeps track of the React IDs of the components that rendered to | 6852 | var SyntheticEvent = __webpack_require__(56); |
5074 | // `null` (in reality a placeholder such as `noscript`) | ||
5075 | var nullComponentIDsRegistry = {}; | ||
5076 | |||
5077 | /** | ||
5078 | * @param {string} id Component's `_rootNodeID`. | ||
5079 | * @return {boolean} True if the component is rendered to null. | ||
5080 | */ | ||
5081 | function isNullComponentID(id) { | ||
5082 | return !!nullComponentIDsRegistry[id]; | ||
5083 | } | ||
5084 | 6853 | ||
5085 | /** | 6854 | /** |
5086 | * Mark the component as having rendered to null. | 6855 | * @interface Event |
5087 | * @param {string} id Component's `_rootNodeID`. | 6856 | * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105 |
6857 | * /#events-inputevents | ||
5088 | */ | 6858 | */ |
5089 | function registerNullComponentID(id) { | 6859 | var InputEventInterface = { |
5090 | nullComponentIDsRegistry[id] = true; | 6860 | data: null |
5091 | } | 6861 | }; |
5092 | 6862 | ||
5093 | /** | 6863 | /** |
5094 | * Unmark the component as having rendered to null: it renders to something now. | 6864 | * @param {object} dispatchConfig Configuration used to dispatch this event. |
5095 | * @param {string} id Component's `_rootNodeID`. | 6865 | * @param {string} dispatchMarker Marker identifying the event target. |
6866 | * @param {object} nativeEvent Native browser event. | ||
6867 | * @extends {SyntheticUIEvent} | ||
5096 | */ | 6868 | */ |
5097 | function deregisterNullComponentID(id) { | 6869 | function SyntheticInputEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { |
5098 | delete nullComponentIDsRegistry[id]; | 6870 | return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); |
5099 | } | 6871 | } |
5100 | 6872 | ||
5101 | var ReactEmptyComponentRegistry = { | 6873 | SyntheticEvent.augmentClass(SyntheticInputEvent, InputEventInterface); |
5102 | isNullComponentID: isNullComponentID, | ||
5103 | registerNullComponentID: registerNullComponentID, | ||
5104 | deregisterNullComponentID: deregisterNullComponentID | ||
5105 | }; | ||
5106 | 6874 | ||
5107 | module.exports = ReactEmptyComponentRegistry; | 6875 | module.exports = SyntheticInputEvent; |
5108 | 6876 | ||
5109 | /***/ }, | 6877 | /***/ }, |
5110 | /* 47 */ | 6878 | /* 58 */ |
5111 | /***/ function(module, exports, __webpack_require__) { | 6879 | /***/ function(module, exports, __webpack_require__) { |
5112 | 6880 | ||
5113 | /* WEBPACK VAR INJECTION */(function(process) {/** | 6881 | /** |
5114 | * Copyright 2013-2015, Facebook, Inc. | 6882 | * Copyright 2013-present, Facebook, Inc. |
5115 | * All rights reserved. | 6883 | * All rights reserved. |
5116 | * | 6884 | * |
5117 | * This source code is licensed under the BSD-style license found in the | 6885 | * This source code is licensed under the BSD-style license found in the |
5118 | * LICENSE file in the root directory of this source tree. An additional grant | 6886 | * LICENSE file in the root directory of this source tree. An additional grant |
5119 | * of patent rights can be found in the PATENTS file in the same directory. | 6887 | * of patent rights can be found in the PATENTS file in the same directory. |
5120 | * | 6888 | * |
5121 | * @providesModule ReactInstanceHandles | 6889 | * @providesModule ChangeEventPlugin |
5122 | * @typechecks static-only | ||
5123 | */ | 6890 | */ |
5124 | 6891 | ||
5125 | 'use strict'; | 6892 | 'use strict'; |
5126 | 6893 | ||
5127 | var ReactRootIndex = __webpack_require__(48); | 6894 | var EventConstants = __webpack_require__(44); |
6895 | var EventPluginHub = __webpack_require__(46); | ||
6896 | var EventPropagators = __webpack_require__(45); | ||
6897 | var ExecutionEnvironment = __webpack_require__(52); | ||
6898 | var ReactDOMComponentTree = __webpack_require__(39); | ||
6899 | var ReactUpdates = __webpack_require__(59); | ||
6900 | var SyntheticEvent = __webpack_require__(56); | ||
5128 | 6901 | ||
5129 | var invariant = __webpack_require__(15); | 6902 | var getEventTarget = __webpack_require__(73); |
6903 | var isEventSupported = __webpack_require__(74); | ||
6904 | var isTextInputElement = __webpack_require__(75); | ||
6905 | var keyOf = __webpack_require__(27); | ||
5130 | 6906 | ||
5131 | var SEPARATOR = '.'; | 6907 | var topLevelTypes = EventConstants.topLevelTypes; |
5132 | var SEPARATOR_LENGTH = SEPARATOR.length; | 6908 | |
6909 | var eventTypes = { | ||
6910 | change: { | ||
6911 | phasedRegistrationNames: { | ||
6912 | bubbled: keyOf({ onChange: null }), | ||
6913 | captured: keyOf({ onChangeCapture: null }) | ||
6914 | }, | ||
6915 | dependencies: [topLevelTypes.topBlur, topLevelTypes.topChange, topLevelTypes.topClick, topLevelTypes.topFocus, topLevelTypes.topInput, topLevelTypes.topKeyDown, topLevelTypes.topKeyUp, topLevelTypes.topSelectionChange] | ||
6916 | } | ||
6917 | }; | ||
5133 | 6918 | ||
5134 | /** | 6919 | /** |
5135 | * Maximum depth of traversals before we consider the possibility of a bad ID. | 6920 | * For IE shims |
5136 | */ | 6921 | */ |
5137 | var MAX_TREE_DEPTH = 10000; | 6922 | var activeElement = null; |
6923 | var activeElementInst = null; | ||
6924 | var activeElementValue = null; | ||
6925 | var activeElementValueProp = null; | ||
5138 | 6926 | ||
5139 | /** | 6927 | /** |
5140 | * Creates a DOM ID prefix to use when mounting React components. | 6928 | * SECTION: handle `change` event |
5141 | * | ||
5142 | * @param {number} index A unique integer | ||
5143 | * @return {string} React root ID. | ||
5144 | * @internal | ||
5145 | */ | 6929 | */ |
5146 | function getReactRootIDString(index) { | 6930 | function shouldUseChangeEvent(elem) { |
5147 | return SEPARATOR + index.toString(36); | 6931 | var nodeName = elem.nodeName && elem.nodeName.toLowerCase(); |
6932 | return nodeName === 'select' || nodeName === 'input' && elem.type === 'file'; | ||
6933 | } | ||
6934 | |||
6935 | var doesChangeEventBubble = false; | ||
6936 | if (ExecutionEnvironment.canUseDOM) { | ||
6937 | // See `handleChange` comment below | ||
6938 | doesChangeEventBubble = isEventSupported('change') && (!('documentMode' in document) || document.documentMode > 8); | ||
6939 | } | ||
6940 | |||
6941 | function manualDispatchChangeEvent(nativeEvent) { | ||
6942 | var event = SyntheticEvent.getPooled(eventTypes.change, activeElementInst, nativeEvent, getEventTarget(nativeEvent)); | ||
6943 | EventPropagators.accumulateTwoPhaseDispatches(event); | ||
6944 | |||
6945 | // If change and propertychange bubbled, we'd just bind to it like all the | ||
6946 | // other events and have it go through ReactBrowserEventEmitter. Since it | ||
6947 | // doesn't, we manually listen for the events and so we have to enqueue and | ||
6948 | // process the abstract event manually. | ||
6949 | // | ||
6950 | // Batching is necessary here in order to ensure that all event handlers run | ||
6951 | // before the next rerender (including event handlers attached to ancestor | ||
6952 | // elements instead of directly on the input). Without this, controlled | ||
6953 | // components don't work properly in conjunction with event bubbling because | ||
6954 | // the component is rerendered and the value reverted before all the event | ||
6955 | // handlers can run. See https://github.com/facebook/react/issues/708. | ||
6956 | ReactUpdates.batchedUpdates(runEventInBatch, event); | ||
6957 | } | ||
6958 | |||
6959 | function runEventInBatch(event) { | ||
6960 | EventPluginHub.enqueueEvents(event); | ||
6961 | EventPluginHub.processEventQueue(false); | ||
6962 | } | ||
6963 | |||
6964 | function startWatchingForChangeEventIE8(target, targetInst) { | ||
6965 | activeElement = target; | ||
6966 | activeElementInst = targetInst; | ||
6967 | activeElement.attachEvent('onchange', manualDispatchChangeEvent); | ||
6968 | } | ||
6969 | |||
6970 | function stopWatchingForChangeEventIE8() { | ||
6971 | if (!activeElement) { | ||
6972 | return; | ||
6973 | } | ||
6974 | activeElement.detachEvent('onchange', manualDispatchChangeEvent); | ||
6975 | activeElement = null; | ||
6976 | activeElementInst = null; | ||
6977 | } | ||
6978 | |||
6979 | function getTargetInstForChangeEvent(topLevelType, targetInst) { | ||
6980 | if (topLevelType === topLevelTypes.topChange) { | ||
6981 | return targetInst; | ||
6982 | } | ||
6983 | } | ||
6984 | function handleEventsForChangeEventIE8(topLevelType, target, targetInst) { | ||
6985 | if (topLevelType === topLevelTypes.topFocus) { | ||
6986 | // stopWatching() should be a noop here but we call it just in case we | ||
6987 | // missed a blur event somehow. | ||
6988 | stopWatchingForChangeEventIE8(); | ||
6989 | startWatchingForChangeEventIE8(target, targetInst); | ||
6990 | } else if (topLevelType === topLevelTypes.topBlur) { | ||
6991 | stopWatchingForChangeEventIE8(); | ||
6992 | } | ||
5148 | } | 6993 | } |
5149 | 6994 | ||
5150 | /** | 6995 | /** |
5151 | * Checks if a character in the supplied ID is a separator or the end. | 6996 | * SECTION: handle `input` event |
5152 | * | ||
5153 | * @param {string} id A React DOM ID. | ||
5154 | * @param {number} index Index of the character to check. | ||
5155 | * @return {boolean} True if the character is a separator or end of the ID. | ||
5156 | * @private | ||
5157 | */ | 6997 | */ |
5158 | function isBoundary(id, index) { | 6998 | var isInputEventSupported = false; |
5159 | return id.charAt(index) === SEPARATOR || index === id.length; | 6999 | if (ExecutionEnvironment.canUseDOM) { |
7000 | // IE9 claims to support the input event but fails to trigger it when | ||
7001 | // deleting text, so we ignore its input events. | ||
7002 | // IE10+ fire input events to often, such when a placeholder | ||
7003 | // changes or when an input with a placeholder is focused. | ||
7004 | isInputEventSupported = isEventSupported('input') && (!('documentMode' in document) || document.documentMode > 11); | ||
5160 | } | 7005 | } |
5161 | 7006 | ||
5162 | /** | 7007 | /** |
5163 | * Checks if the supplied string is a valid React DOM ID. | 7008 | * (For IE <=11) Replacement getter/setter for the `value` property that gets |
5164 | * | 7009 | * set on the active element. |
5165 | * @param {string} id A React DOM ID, maybe. | ||
5166 | * @return {boolean} True if the string is a valid React DOM ID. | ||
5167 | * @private | ||
5168 | */ | 7010 | */ |
5169 | function isValidID(id) { | 7011 | var newValueProp = { |
5170 | return id === '' || id.charAt(0) === SEPARATOR && id.charAt(id.length - 1) !== SEPARATOR; | 7012 | get: function () { |
5171 | } | 7013 | return activeElementValueProp.get.call(this); |
7014 | }, | ||
7015 | set: function (val) { | ||
7016 | // Cast to a string so we can do equality checks. | ||
7017 | activeElementValue = '' + val; | ||
7018 | activeElementValueProp.set.call(this, val); | ||
7019 | } | ||
7020 | }; | ||
5172 | 7021 | ||
5173 | /** | 7022 | /** |
5174 | * Checks if the first ID is an ancestor of or equal to the second ID. | 7023 | * (For IE <=11) Starts tracking propertychange events on the passed-in element |
5175 | * | 7024 | * and override the value property so that we can distinguish user events from |
5176 | * @param {string} ancestorID | 7025 | * value changes in JS. |
5177 | * @param {string} descendantID | ||
5178 | * @return {boolean} True if `ancestorID` is an ancestor of `descendantID`. | ||
5179 | * @internal | ||
5180 | */ | 7026 | */ |
5181 | function isAncestorIDOf(ancestorID, descendantID) { | 7027 | function startWatchingForValueChange(target, targetInst) { |
5182 | return descendantID.indexOf(ancestorID) === 0 && isBoundary(descendantID, ancestorID.length); | 7028 | activeElement = target; |
7029 | activeElementInst = targetInst; | ||
7030 | activeElementValue = target.value; | ||
7031 | activeElementValueProp = Object.getOwnPropertyDescriptor(target.constructor.prototype, 'value'); | ||
7032 | |||
7033 | // Not guarded in a canDefineProperty check: IE8 supports defineProperty only | ||
7034 | // on DOM elements | ||
7035 | Object.defineProperty(activeElement, 'value', newValueProp); | ||
7036 | if (activeElement.attachEvent) { | ||
7037 | activeElement.attachEvent('onpropertychange', handlePropertyChange); | ||
7038 | } else { | ||
7039 | activeElement.addEventListener('propertychange', handlePropertyChange, false); | ||
7040 | } | ||
5183 | } | 7041 | } |
5184 | 7042 | ||
5185 | /** | 7043 | /** |
5186 | * Gets the parent ID of the supplied React DOM ID, `id`. | 7044 | * (For IE <=11) Removes the event listeners from the currently-tracked element, |
5187 | * | 7045 | * if any exists. |
5188 | * @param {string} id ID of a component. | ||
5189 | * @return {string} ID of the parent, or an empty string. | ||
5190 | * @private | ||
5191 | */ | 7046 | */ |
5192 | function getParentID(id) { | 7047 | function stopWatchingForValueChange() { |
5193 | return id ? id.substr(0, id.lastIndexOf(SEPARATOR)) : ''; | 7048 | if (!activeElement) { |
7049 | return; | ||
7050 | } | ||
7051 | |||
7052 | // delete restores the original property definition | ||
7053 | delete activeElement.value; | ||
7054 | |||
7055 | if (activeElement.detachEvent) { | ||
7056 | activeElement.detachEvent('onpropertychange', handlePropertyChange); | ||
7057 | } else { | ||
7058 | activeElement.removeEventListener('propertychange', handlePropertyChange, false); | ||
7059 | } | ||
7060 | |||
7061 | activeElement = null; | ||
7062 | activeElementInst = null; | ||
7063 | activeElementValue = null; | ||
7064 | activeElementValueProp = null; | ||
5194 | } | 7065 | } |
5195 | 7066 | ||
5196 | /** | 7067 | /** |
5197 | * Gets the next DOM ID on the tree path from the supplied `ancestorID` to the | 7068 | * (For IE <=11) Handles a propertychange event, sending a `change` event if |
5198 | * supplied `destinationID`. If they are equal, the ID is returned. | 7069 | * the value of the active element has changed. |
5199 | * | ||
5200 | * @param {string} ancestorID ID of an ancestor node of `destinationID`. | ||
5201 | * @param {string} destinationID ID of the destination node. | ||
5202 | * @return {string} Next ID on the path from `ancestorID` to `destinationID`. | ||
5203 | * @private | ||
5204 | */ | 7070 | */ |
5205 | function getNextDescendantID(ancestorID, destinationID) { | 7071 | function handlePropertyChange(nativeEvent) { |
5206 | !(isValidID(ancestorID) && isValidID(destinationID)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNextDescendantID(%s, %s): Received an invalid React DOM ID.', ancestorID, destinationID) : invariant(false) : undefined; | 7072 | if (nativeEvent.propertyName !== 'value') { |
5207 | !isAncestorIDOf(ancestorID, destinationID) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNextDescendantID(...): React has made an invalid assumption about ' + 'the DOM hierarchy. Expected `%s` to be an ancestor of `%s`.', ancestorID, destinationID) : invariant(false) : undefined; | 7073 | return; |
5208 | if (ancestorID === destinationID) { | ||
5209 | return ancestorID; | ||
5210 | } | 7074 | } |
5211 | // Skip over the ancestor and the immediate separator. Traverse until we hit | 7075 | var value = nativeEvent.srcElement.value; |
5212 | // another separator or we reach the end of `destinationID`. | 7076 | if (value === activeElementValue) { |
5213 | var start = ancestorID.length + SEPARATOR_LENGTH; | 7077 | return; |
5214 | var i; | ||
5215 | for (i = start; i < destinationID.length; i++) { | ||
5216 | if (isBoundary(destinationID, i)) { | ||
5217 | break; | ||
5218 | } | ||
5219 | } | 7078 | } |
5220 | return destinationID.substr(0, i); | 7079 | activeElementValue = value; |
7080 | |||
7081 | manualDispatchChangeEvent(nativeEvent); | ||
5221 | } | 7082 | } |
5222 | 7083 | ||
5223 | /** | 7084 | /** |
5224 | * Gets the nearest common ancestor ID of two IDs. | 7085 | * If a `change` event should be fired, returns the target's ID. |
5225 | * | ||
5226 | * Using this ID scheme, the nearest common ancestor ID is the longest common | ||
5227 | * prefix of the two IDs that immediately preceded a "marker" in both strings. | ||
5228 | * | ||
5229 | * @param {string} oneID | ||
5230 | * @param {string} twoID | ||
5231 | * @return {string} Nearest common ancestor ID, or the empty string if none. | ||
5232 | * @private | ||
5233 | */ | 7086 | */ |
5234 | function getFirstCommonAncestorID(oneID, twoID) { | 7087 | function getTargetInstForInputEvent(topLevelType, targetInst) { |
5235 | var minLength = Math.min(oneID.length, twoID.length); | 7088 | if (topLevelType === topLevelTypes.topInput) { |
5236 | if (minLength === 0) { | 7089 | // In modern browsers (i.e., not IE8 or IE9), the input event is exactly |
5237 | return ''; | 7090 | // what we want so fall through here and trigger an abstract event |
7091 | return targetInst; | ||
5238 | } | 7092 | } |
5239 | var lastCommonMarkerIndex = 0; | 7093 | } |
5240 | // Use `<=` to traverse until the "EOL" of the shorter string. | 7094 | |
5241 | for (var i = 0; i <= minLength; i++) { | 7095 | function handleEventsForInputEventIE(topLevelType, target, targetInst) { |
5242 | if (isBoundary(oneID, i) && isBoundary(twoID, i)) { | 7096 | if (topLevelType === topLevelTypes.topFocus) { |
5243 | lastCommonMarkerIndex = i; | 7097 | // In IE8, we can capture almost all .value changes by adding a |
5244 | } else if (oneID.charAt(i) !== twoID.charAt(i)) { | 7098 | // propertychange handler and looking for events with propertyName |
5245 | break; | 7099 | // equal to 'value' |
7100 | // In IE9-11, propertychange fires for most input events but is buggy and | ||
7101 | // doesn't fire when text is deleted, but conveniently, selectionchange | ||
7102 | // appears to fire in all of the remaining cases so we catch those and | ||
7103 | // forward the event if the value has changed | ||
7104 | // In either case, we don't want to call the event handler if the value | ||
7105 | // is changed from JS so we redefine a setter for `.value` that updates | ||
7106 | // our activeElementValue variable, allowing us to ignore those changes | ||
7107 | // | ||
7108 | // stopWatching() should be a noop here but we call it just in case we | ||
7109 | // missed a blur event somehow. | ||
7110 | stopWatchingForValueChange(); | ||
7111 | startWatchingForValueChange(target, targetInst); | ||
7112 | } else if (topLevelType === topLevelTypes.topBlur) { | ||
7113 | stopWatchingForValueChange(); | ||
7114 | } | ||
7115 | } | ||
7116 | |||
7117 | // For IE8 and IE9. | ||
7118 | function getTargetInstForInputEventIE(topLevelType, targetInst) { | ||
7119 | if (topLevelType === topLevelTypes.topSelectionChange || topLevelType === topLevelTypes.topKeyUp || topLevelType === topLevelTypes.topKeyDown) { | ||
7120 | // On the selectionchange event, the target is just document which isn't | ||
7121 | // helpful for us so just check activeElement instead. | ||
7122 | // | ||
7123 | // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire | ||
7124 | // propertychange on the first input event after setting `value` from a | ||
7125 | // script and fires only keydown, keypress, keyup. Catching keyup usually | ||
7126 | // gets it and catching keydown lets us fire an event for the first | ||
7127 | // keystroke if user does a key repeat (it'll be a little delayed: right | ||
7128 | // before the second keystroke). Other input methods (e.g., paste) seem to | ||
7129 | // fire selectionchange normally. | ||
7130 | if (activeElement && activeElement.value !== activeElementValue) { | ||
7131 | activeElementValue = activeElement.value; | ||
7132 | return activeElementInst; | ||
5246 | } | 7133 | } |
5247 | } | 7134 | } |
5248 | var longestCommonID = oneID.substr(0, lastCommonMarkerIndex); | ||
5249 | !isValidID(longestCommonID) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getFirstCommonAncestorID(%s, %s): Expected a valid React DOM ID: %s', oneID, twoID, longestCommonID) : invariant(false) : undefined; | ||
5250 | return longestCommonID; | ||
5251 | } | 7135 | } |
5252 | 7136 | ||
5253 | /** | 7137 | /** |
5254 | * Traverses the parent path between two IDs (either up or down). The IDs must | 7138 | * SECTION: handle `click` event |
5255 | * not be the same, and there must exist a parent path between them. If the | ||
5256 | * callback returns `false`, traversal is stopped. | ||
5257 | * | ||
5258 | * @param {?string} start ID at which to start traversal. | ||
5259 | * @param {?string} stop ID at which to end traversal. | ||
5260 | * @param {function} cb Callback to invoke each ID with. | ||
5261 | * @param {*} arg Argument to invoke the callback with. | ||
5262 | * @param {?boolean} skipFirst Whether or not to skip the first node. | ||
5263 | * @param {?boolean} skipLast Whether or not to skip the last node. | ||
5264 | * @private | ||
5265 | */ | 7139 | */ |
5266 | function traverseParentPath(start, stop, cb, arg, skipFirst, skipLast) { | 7140 | function shouldUseClickEvent(elem) { |
5267 | start = start || ''; | 7141 | // Use the `click` event to detect changes to checkbox and radio inputs. |
5268 | stop = stop || ''; | 7142 | // This approach works across all browsers, whereas `change` does not fire |
5269 | !(start !== stop) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'traverseParentPath(...): Cannot traverse from and to the same ID, `%s`.', start) : invariant(false) : undefined; | 7143 | // until `blur` in IE8. |
5270 | var traverseUp = isAncestorIDOf(stop, start); | 7144 | return elem.nodeName && elem.nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio'); |
5271 | !(traverseUp || isAncestorIDOf(start, stop)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'traverseParentPath(%s, %s, ...): Cannot traverse from two IDs that do ' + 'not have a parent path.', start, stop) : invariant(false) : undefined; | 7145 | } |
5272 | // Traverse from `start` to `stop` one depth at a time. | 7146 | |
5273 | var depth = 0; | 7147 | function getTargetInstForClickEvent(topLevelType, targetInst) { |
5274 | var traverse = traverseUp ? getParentID : getNextDescendantID; | 7148 | if (topLevelType === topLevelTypes.topClick) { |
5275 | for (var id = start;; /* until break */id = traverse(id, stop)) { | 7149 | return targetInst; |
5276 | var ret; | ||
5277 | if ((!skipFirst || id !== start) && (!skipLast || id !== stop)) { | ||
5278 | ret = cb(id, traverseUp, arg); | ||
5279 | } | ||
5280 | if (ret === false || id === stop) { | ||
5281 | // Only break //after// visiting `stop`. | ||
5282 | break; | ||
5283 | } | ||
5284 | !(depth++ < MAX_TREE_DEPTH) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'traverseParentPath(%s, %s, ...): Detected an infinite loop while ' + 'traversing the React DOM ID tree. This may be due to malformed IDs: %s', start, stop, id) : invariant(false) : undefined; | ||
5285 | } | 7150 | } |
5286 | } | 7151 | } |
5287 | 7152 | ||
5288 | /** | 7153 | /** |
5289 | * Manages the IDs assigned to DOM representations of React components. This | 7154 | * This plugin creates an `onChange` event that normalizes change events |
5290 | * uses a specific scheme in order to traverse the DOM efficiently (e.g. in | 7155 | * across form elements. This event fires at a time when it's possible to |
5291 | * order to simulate events). | 7156 | * change the element's value without seeing a flicker. |
5292 | * | 7157 | * |
5293 | * @internal | 7158 | * Supported elements are: |
7159 | * - input (see `isTextInputElement`) | ||
7160 | * - textarea | ||
7161 | * - select | ||
5294 | */ | 7162 | */ |
5295 | var ReactInstanceHandles = { | 7163 | var ChangeEventPlugin = { |
5296 | 7164 | ||
5297 | /** | 7165 | eventTypes: eventTypes, |
5298 | * Constructs a React root ID | ||
5299 | * @return {string} A React root ID. | ||
5300 | */ | ||
5301 | createReactRootID: function () { | ||
5302 | return getReactRootIDString(ReactRootIndex.createReactRootIndex()); | ||
5303 | }, | ||
5304 | 7166 | ||
5305 | /** | 7167 | extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { |
5306 | * Constructs a React ID by joining a root ID with a name. | 7168 | var targetNode = targetInst ? ReactDOMComponentTree.getNodeFromInstance(targetInst) : window; |
5307 | * | ||
5308 | * @param {string} rootID Root ID of a parent component. | ||
5309 | * @param {string} name A component's name (as flattened children). | ||
5310 | * @return {string} A React ID. | ||
5311 | * @internal | ||
5312 | */ | ||
5313 | createReactID: function (rootID, name) { | ||
5314 | return rootID + name; | ||
5315 | }, | ||
5316 | 7169 | ||
5317 | /** | 7170 | var getTargetInstFunc, handleEventFunc; |
5318 | * Gets the DOM ID of the React component that is the root of the tree that | 7171 | if (shouldUseChangeEvent(targetNode)) { |
5319 | * contains the React component with the supplied DOM ID. | 7172 | if (doesChangeEventBubble) { |
5320 | * | 7173 | getTargetInstFunc = getTargetInstForChangeEvent; |
5321 | * @param {string} id DOM ID of a React component. | 7174 | } else { |
5322 | * @return {?string} DOM ID of the React component that is the root. | 7175 | handleEventFunc = handleEventsForChangeEventIE8; |
5323 | * @internal | 7176 | } |
5324 | */ | 7177 | } else if (isTextInputElement(targetNode)) { |
5325 | getReactRootIDFromNodeID: function (id) { | 7178 | if (isInputEventSupported) { |
5326 | if (id && id.charAt(0) === SEPARATOR && id.length > 1) { | 7179 | getTargetInstFunc = getTargetInstForInputEvent; |
5327 | var index = id.indexOf(SEPARATOR, 1); | 7180 | } else { |
5328 | return index > -1 ? id.substr(0, index) : id; | 7181 | getTargetInstFunc = getTargetInstForInputEventIE; |
5329 | } | 7182 | handleEventFunc = handleEventsForInputEventIE; |
5330 | return null; | 7183 | } |
5331 | }, | 7184 | } else if (shouldUseClickEvent(targetNode)) { |
5332 | 7185 | getTargetInstFunc = getTargetInstForClickEvent; | |
5333 | /** | ||
5334 | * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that | ||
5335 | * should would receive a `mouseEnter` or `mouseLeave` event. | ||
5336 | * | ||
5337 | * NOTE: Does not invoke the callback on the nearest common ancestor because | ||
5338 | * nothing "entered" or "left" that element. | ||
5339 | * | ||
5340 | * @param {string} leaveID ID being left. | ||
5341 | * @param {string} enterID ID being entered. | ||
5342 | * @param {function} cb Callback to invoke on each entered/left ID. | ||
5343 | * @param {*} upArg Argument to invoke the callback with on left IDs. | ||
5344 | * @param {*} downArg Argument to invoke the callback with on entered IDs. | ||
5345 | * @internal | ||
5346 | */ | ||
5347 | traverseEnterLeave: function (leaveID, enterID, cb, upArg, downArg) { | ||
5348 | var ancestorID = getFirstCommonAncestorID(leaveID, enterID); | ||
5349 | if (ancestorID !== leaveID) { | ||
5350 | traverseParentPath(leaveID, ancestorID, cb, upArg, false, true); | ||
5351 | } | ||
5352 | if (ancestorID !== enterID) { | ||
5353 | traverseParentPath(ancestorID, enterID, cb, downArg, true, false); | ||
5354 | } | 7186 | } |
5355 | }, | ||
5356 | 7187 | ||
5357 | /** | 7188 | if (getTargetInstFunc) { |
5358 | * Simulates the traversal of a two-phase, capture/bubble event dispatch. | 7189 | var inst = getTargetInstFunc(topLevelType, targetInst); |
5359 | * | 7190 | if (inst) { |
5360 | * NOTE: This traversal happens on IDs without touching the DOM. | 7191 | var event = SyntheticEvent.getPooled(eventTypes.change, inst, nativeEvent, nativeEventTarget); |
5361 | * | 7192 | event.type = 'change'; |
5362 | * @param {string} targetID ID of the target node. | 7193 | EventPropagators.accumulateTwoPhaseDispatches(event); |
5363 | * @param {function} cb Callback to invoke. | 7194 | return event; |
5364 | * @param {*} arg Argument to invoke the callback with. | 7195 | } |
5365 | * @internal | ||
5366 | */ | ||
5367 | traverseTwoPhase: function (targetID, cb, arg) { | ||
5368 | if (targetID) { | ||
5369 | traverseParentPath('', targetID, cb, arg, true, false); | ||
5370 | traverseParentPath(targetID, '', cb, arg, false, true); | ||
5371 | } | 7196 | } |
5372 | }, | ||
5373 | 7197 | ||
5374 | /** | 7198 | if (handleEventFunc) { |
5375 | * Same as `traverseTwoPhase` but skips the `targetID`. | 7199 | handleEventFunc(topLevelType, targetNode, targetInst); |
5376 | */ | ||
5377 | traverseTwoPhaseSkipTarget: function (targetID, cb, arg) { | ||
5378 | if (targetID) { | ||
5379 | traverseParentPath('', targetID, cb, arg, true, true); | ||
5380 | traverseParentPath(targetID, '', cb, arg, true, true); | ||
5381 | } | 7200 | } |
5382 | }, | 7201 | } |
5383 | |||
5384 | /** | ||
5385 | * Traverse a node ID, calling the supplied `cb` for each ancestor ID. For | ||
5386 | * example, passing `.0.$row-0.1` would result in `cb` getting called | ||
5387 | * with `.0`, `.0.$row-0`, and `.0.$row-0.1`. | ||
5388 | * | ||
5389 | * NOTE: This traversal happens on IDs without touching the DOM. | ||
5390 | * | ||
5391 | * @param {string} targetID ID of the target node. | ||
5392 | * @param {function} cb Callback to invoke. | ||
5393 | * @param {*} arg Argument to invoke the callback with. | ||
5394 | * @internal | ||
5395 | */ | ||
5396 | traverseAncestors: function (targetID, cb, arg) { | ||
5397 | traverseParentPath('', targetID, cb, arg, true, false); | ||
5398 | }, | ||
5399 | |||
5400 | getFirstCommonAncestorID: getFirstCommonAncestorID, | ||
5401 | |||
5402 | /** | ||
5403 | * Exposed for unit testing. | ||
5404 | * @private | ||
5405 | */ | ||
5406 | _getNextDescendantID: getNextDescendantID, | ||
5407 | |||
5408 | isAncestorIDOf: isAncestorIDOf, | ||
5409 | |||
5410 | SEPARATOR: SEPARATOR | ||
5411 | 7202 | ||
5412 | }; | 7203 | }; |
5413 | 7204 | ||
5414 | module.exports = ReactInstanceHandles; | 7205 | module.exports = ChangeEventPlugin; |
5415 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
5416 | 7206 | ||
5417 | /***/ }, | 7207 | /***/ }, |
5418 | /* 48 */ | 7208 | /* 59 */ |
5419 | /***/ function(module, exports) { | 7209 | /***/ function(module, exports, __webpack_require__) { |
5420 | 7210 | ||
5421 | /** | 7211 | /* WEBPACK VAR INJECTION */(function(process) {/** |
5422 | * Copyright 2013-2015, Facebook, Inc. | 7212 | * Copyright 2013-present, Facebook, Inc. |
5423 | * All rights reserved. | 7213 | * All rights reserved. |
5424 | * | 7214 | * |
5425 | * This source code is licensed under the BSD-style license found in the | 7215 | * This source code is licensed under the BSD-style license found in the |
5426 | * LICENSE file in the root directory of this source tree. An additional grant | 7216 | * LICENSE file in the root directory of this source tree. An additional grant |
5427 | * of patent rights can be found in the PATENTS file in the same directory. | 7217 | * of patent rights can be found in the PATENTS file in the same directory. |
5428 | * | 7218 | * |
5429 | * @providesModule ReactRootIndex | 7219 | * @providesModule ReactUpdates |
5430 | * @typechecks | ||
5431 | */ | 7220 | */ |
5432 | 7221 | ||
5433 | 'use strict'; | 7222 | 'use strict'; |
5434 | 7223 | ||
5435 | var ReactRootIndexInjection = { | 7224 | var _prodInvariant = __webpack_require__(9), |
5436 | /** | 7225 | _assign = __webpack_require__(6); |
5437 | * @param {function} _createReactRootIndex | 7226 | |
5438 | */ | 7227 | var CallbackQueue = __webpack_require__(60); |
5439 | injectCreateReactRootIndex: function (_createReactRootIndex) { | 7228 | var PooledClass = __webpack_require__(8); |
5440 | ReactRootIndex.createReactRootIndex = _createReactRootIndex; | 7229 | var ReactFeatureFlags = __webpack_require__(61); |
7230 | var ReactReconciler = __webpack_require__(62); | ||
7231 | var Transaction = __webpack_require__(72); | ||
7232 | |||
7233 | var invariant = __webpack_require__(10); | ||
7234 | |||
7235 | var dirtyComponents = []; | ||
7236 | var updateBatchNumber = 0; | ||
7237 | var asapCallbackQueue = CallbackQueue.getPooled(); | ||
7238 | var asapEnqueued = false; | ||
7239 | |||
7240 | var batchingStrategy = null; | ||
7241 | |||
7242 | function ensureInjected() { | ||
7243 | !(ReactUpdates.ReactReconcileTransaction && batchingStrategy) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must inject a reconcile transaction class and batching strategy') : _prodInvariant('123') : void 0; | ||
7244 | } | ||
7245 | |||
7246 | var NESTED_UPDATES = { | ||
7247 | initialize: function () { | ||
7248 | this.dirtyComponentsLength = dirtyComponents.length; | ||
7249 | }, | ||
7250 | close: function () { | ||
7251 | if (this.dirtyComponentsLength !== dirtyComponents.length) { | ||
7252 | // Additional updates were enqueued by componentDidUpdate handlers or | ||
7253 | // similar; before our own UPDATE_QUEUEING wrapper closes, we want to run | ||
7254 | // these new updates so that if A's componentDidUpdate calls setState on | ||
7255 | // B, B will update before the callback A's updater provided when calling | ||
7256 | // setState. | ||
7257 | dirtyComponents.splice(0, this.dirtyComponentsLength); | ||
7258 | flushBatchedUpdates(); | ||
7259 | } else { | ||
7260 | dirtyComponents.length = 0; | ||
7261 | } | ||
5441 | } | 7262 | } |
5442 | }; | 7263 | }; |
5443 | 7264 | ||
5444 | var ReactRootIndex = { | 7265 | var UPDATE_QUEUEING = { |
5445 | createReactRootIndex: null, | 7266 | initialize: function () { |
5446 | injection: ReactRootIndexInjection | 7267 | this.callbackQueue.reset(); |
7268 | }, | ||
7269 | close: function () { | ||
7270 | this.callbackQueue.notifyAll(); | ||
7271 | } | ||
5447 | }; | 7272 | }; |
5448 | 7273 | ||
5449 | module.exports = ReactRootIndex; | 7274 | var TRANSACTION_WRAPPERS = [NESTED_UPDATES, UPDATE_QUEUEING]; |
5450 | 7275 | ||
5451 | /***/ }, | 7276 | function ReactUpdatesFlushTransaction() { |
5452 | /* 49 */ | 7277 | this.reinitializeTransaction(); |
5453 | /***/ function(module, exports) { | 7278 | this.dirtyComponentsLength = null; |
5454 | 7279 | this.callbackQueue = CallbackQueue.getPooled(); | |
7280 | this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled( | ||
7281 | /* useCreateElement */true); | ||
7282 | } | ||
7283 | |||
7284 | _assign(ReactUpdatesFlushTransaction.prototype, Transaction.Mixin, { | ||
7285 | getTransactionWrappers: function () { | ||
7286 | return TRANSACTION_WRAPPERS; | ||
7287 | }, | ||
7288 | |||
7289 | destructor: function () { | ||
7290 | this.dirtyComponentsLength = null; | ||
7291 | CallbackQueue.release(this.callbackQueue); | ||
7292 | this.callbackQueue = null; | ||
7293 | ReactUpdates.ReactReconcileTransaction.release(this.reconcileTransaction); | ||
7294 | this.reconcileTransaction = null; | ||
7295 | }, | ||
7296 | |||
7297 | perform: function (method, scope, a) { | ||
7298 | // Essentially calls `this.reconcileTransaction.perform(method, scope, a)` | ||
7299 | // with this transaction's wrappers around it. | ||
7300 | return Transaction.Mixin.perform.call(this, this.reconcileTransaction.perform, this.reconcileTransaction, method, scope, a); | ||
7301 | } | ||
7302 | }); | ||
7303 | |||
7304 | PooledClass.addPoolingTo(ReactUpdatesFlushTransaction); | ||
7305 | |||
7306 | function batchedUpdates(callback, a, b, c, d, e) { | ||
7307 | ensureInjected(); | ||
7308 | batchingStrategy.batchedUpdates(callback, a, b, c, d, e); | ||
7309 | } | ||
7310 | |||
5455 | /** | 7311 | /** |
5456 | * Copyright 2013-2015, Facebook, Inc. | 7312 | * Array comparator for ReactComponents by mount ordering. |
5457 | * All rights reserved. | ||
5458 | * | ||
5459 | * This source code is licensed under the BSD-style license found in the | ||
5460 | * LICENSE file in the root directory of this source tree. An additional grant | ||
5461 | * of patent rights can be found in the PATENTS file in the same directory. | ||
5462 | * | 7313 | * |
5463 | * @providesModule ReactInstanceMap | 7314 | * @param {ReactComponent} c1 first component you're comparing |
7315 | * @param {ReactComponent} c2 second component you're comparing | ||
7316 | * @return {number} Return value usable by Array.prototype.sort(). | ||
5464 | */ | 7317 | */ |
7318 | function mountOrderComparator(c1, c2) { | ||
7319 | return c1._mountOrder - c2._mountOrder; | ||
7320 | } | ||
5465 | 7321 | ||
5466 | 'use strict'; | 7322 | function runBatchedUpdates(transaction) { |
7323 | var len = transaction.dirtyComponentsLength; | ||
7324 | !(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; | ||
7325 | |||
7326 | // Since reconciling a component higher in the owner hierarchy usually (not | ||
7327 | // always -- see shouldComponentUpdate()) will reconcile children, reconcile | ||
7328 | // them before their children by sorting the array. | ||
7329 | dirtyComponents.sort(mountOrderComparator); | ||
7330 | |||
7331 | // Any updates enqueued while reconciling must be performed after this entire | ||
7332 | // batch. Otherwise, if dirtyComponents is [A, B] where A has children B and | ||
7333 | // C, B could update twice in a single batch if C's render enqueues an update | ||
7334 | // to B (since B would have already updated, we should skip it, and the only | ||
7335 | // way we can know to do so is by checking the batch counter). | ||
7336 | updateBatchNumber++; | ||
7337 | |||
7338 | for (var i = 0; i < len; i++) { | ||
7339 | // If a component is unmounted before pending changes apply, it will still | ||
7340 | // be here, but we assume that it has cleared its _pendingCallbacks and | ||
7341 | // that performUpdateIfNecessary is a noop. | ||
7342 | var component = dirtyComponents[i]; | ||
7343 | |||
7344 | // If performUpdateIfNecessary happens to enqueue any new updates, we | ||
7345 | // shouldn't execute the callbacks until the next render happens, so | ||
7346 | // stash the callbacks first | ||
7347 | var callbacks = component._pendingCallbacks; | ||
7348 | component._pendingCallbacks = null; | ||
7349 | |||
7350 | var markerName; | ||
7351 | if (ReactFeatureFlags.logTopLevelRenders) { | ||
7352 | var namedComponent = component; | ||
7353 | // Duck type TopLevelWrapper. This is probably always true. | ||
7354 | if (component._currentElement.props === component._renderedComponent._currentElement) { | ||
7355 | namedComponent = component._renderedComponent; | ||
7356 | } | ||
7357 | markerName = 'React update: ' + namedComponent.getName(); | ||
7358 | console.time(markerName); | ||
7359 | } | ||
7360 | |||
7361 | ReactReconciler.performUpdateIfNecessary(component, transaction.reconcileTransaction, updateBatchNumber); | ||
7362 | |||
7363 | if (markerName) { | ||
7364 | console.timeEnd(markerName); | ||
7365 | } | ||
7366 | |||
7367 | if (callbacks) { | ||
7368 | for (var j = 0; j < callbacks.length; j++) { | ||
7369 | transaction.callbackQueue.enqueue(callbacks[j], component.getPublicInstance()); | ||
7370 | } | ||
7371 | } | ||
7372 | } | ||
7373 | } | ||
7374 | |||
7375 | var flushBatchedUpdates = function () { | ||
7376 | // ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents | ||
7377 | // array and perform any updates enqueued by mount-ready handlers (i.e., | ||
7378 | // componentDidUpdate) but we need to check here too in order to catch | ||
7379 | // updates enqueued by setState callbacks and asap calls. | ||
7380 | while (dirtyComponents.length || asapEnqueued) { | ||
7381 | if (dirtyComponents.length) { | ||
7382 | var transaction = ReactUpdatesFlushTransaction.getPooled(); | ||
7383 | transaction.perform(runBatchedUpdates, null, transaction); | ||
7384 | ReactUpdatesFlushTransaction.release(transaction); | ||
7385 | } | ||
7386 | |||
7387 | if (asapEnqueued) { | ||
7388 | asapEnqueued = false; | ||
7389 | var queue = asapCallbackQueue; | ||
7390 | asapCallbackQueue = CallbackQueue.getPooled(); | ||
7391 | queue.notifyAll(); | ||
7392 | CallbackQueue.release(queue); | ||
7393 | } | ||
7394 | } | ||
7395 | }; | ||
5467 | 7396 | ||
5468 | /** | 7397 | /** |
5469 | * `ReactInstanceMap` maintains a mapping from a public facing stateful | 7398 | * Mark a component as needing a rerender, adding an optional callback to a |
5470 | * instance (key) and the internal representation (value). This allows public | 7399 | * list of functions which will be executed once the rerender occurs. |
5471 | * methods to accept the user facing instance as an argument and map them back | ||
5472 | * to internal methods. | ||
5473 | */ | 7400 | */ |
7401 | function enqueueUpdate(component) { | ||
7402 | ensureInjected(); | ||
5474 | 7403 | ||
5475 | // TODO: Replace this with ES6: var ReactInstanceMap = new Map(); | 7404 | // Various parts of our code (such as ReactCompositeComponent's |
5476 | var ReactInstanceMap = { | 7405 | // _renderValidatedComponent) assume that calls to render aren't nested; |
7406 | // verify that that's the case. (This is called by each top-level update | ||
7407 | // function, like setState, forceUpdate, etc.; creation and | ||
7408 | // destruction of top-level components is guarded in ReactMount.) | ||
5477 | 7409 | ||
5478 | /** | 7410 | if (!batchingStrategy.isBatchingUpdates) { |
5479 | * This API should be called `delete` but we'd have to make sure to always | 7411 | batchingStrategy.batchedUpdates(enqueueUpdate, component); |
5480 | * transform these to strings for IE support. When this transform is fully | 7412 | return; |
5481 | * supported we can rename it. | 7413 | } |
5482 | */ | ||
5483 | remove: function (key) { | ||
5484 | key._reactInternalInstance = undefined; | ||
5485 | }, | ||
5486 | 7414 | ||
5487 | get: function (key) { | 7415 | dirtyComponents.push(component); |
5488 | return key._reactInternalInstance; | 7416 | if (component._updateBatchNumber == null) { |
5489 | }, | 7417 | component._updateBatchNumber = updateBatchNumber + 1; |
7418 | } | ||
7419 | } | ||
5490 | 7420 | ||
5491 | has: function (key) { | 7421 | /** |
5492 | return key._reactInternalInstance !== undefined; | 7422 | * Enqueue a callback to be run at the end of the current batching cycle. Throws |
7423 | * if no updates are currently being performed. | ||
7424 | */ | ||
7425 | function asap(callback, context) { | ||
7426 | !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; | ||
7427 | asapCallbackQueue.enqueue(callback, context); | ||
7428 | asapEnqueued = true; | ||
7429 | } | ||
7430 | |||
7431 | var ReactUpdatesInjection = { | ||
7432 | injectReconcileTransaction: function (ReconcileTransaction) { | ||
7433 | !ReconcileTransaction ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a reconcile transaction class') : _prodInvariant('126') : void 0; | ||
7434 | ReactUpdates.ReactReconcileTransaction = ReconcileTransaction; | ||
5493 | }, | 7435 | }, |
5494 | 7436 | ||
5495 | set: function (key, value) { | 7437 | injectBatchingStrategy: function (_batchingStrategy) { |
5496 | key._reactInternalInstance = value; | 7438 | !_batchingStrategy ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batching strategy') : _prodInvariant('127') : void 0; |
7439 | !(typeof _batchingStrategy.batchedUpdates === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batchedUpdates() function') : _prodInvariant('128') : void 0; | ||
7440 | !(typeof _batchingStrategy.isBatchingUpdates === 'boolean') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide an isBatchingUpdates boolean attribute') : _prodInvariant('129') : void 0; | ||
7441 | batchingStrategy = _batchingStrategy; | ||
5497 | } | 7442 | } |
7443 | }; | ||
5498 | 7444 | ||
7445 | var ReactUpdates = { | ||
7446 | /** | ||
7447 | * React references `ReactReconcileTransaction` using this property in order | ||
7448 | * to allow dependency injection. | ||
7449 | * | ||
7450 | * @internal | ||
7451 | */ | ||
7452 | ReactReconcileTransaction: null, | ||
7453 | |||
7454 | batchedUpdates: batchedUpdates, | ||
7455 | enqueueUpdate: enqueueUpdate, | ||
7456 | flushBatchedUpdates: flushBatchedUpdates, | ||
7457 | injection: ReactUpdatesInjection, | ||
7458 | asap: asap | ||
5499 | }; | 7459 | }; |
5500 | 7460 | ||
5501 | module.exports = ReactInstanceMap; | 7461 | module.exports = ReactUpdates; |
7462 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
5502 | 7463 | ||
5503 | /***/ }, | 7464 | /***/ }, |
5504 | /* 50 */ | 7465 | /* 60 */ |
5505 | /***/ function(module, exports, __webpack_require__) { | 7466 | /***/ function(module, exports, __webpack_require__) { |
5506 | 7467 | ||
5507 | /** | 7468 | /* WEBPACK VAR INJECTION */(function(process) {/** |
5508 | * Copyright 2013-2015, Facebook, Inc. | 7469 | * Copyright 2013-present, Facebook, Inc. |
5509 | * All rights reserved. | 7470 | * All rights reserved. |
5510 | * | 7471 | * |
5511 | * This source code is licensed under the BSD-style license found in the | 7472 | * This source code is licensed under the BSD-style license found in the |
5512 | * LICENSE file in the root directory of this source tree. An additional grant | 7473 | * LICENSE file in the root directory of this source tree. An additional grant |
5513 | * of patent rights can be found in the PATENTS file in the same directory. | 7474 | * of patent rights can be found in the PATENTS file in the same directory. |
5514 | * | 7475 | * |
5515 | * @providesModule ReactMarkupChecksum | 7476 | * @providesModule CallbackQueue |
5516 | */ | 7477 | */ |
5517 | 7478 | ||
5518 | 'use strict'; | 7479 | 'use strict'; |
5519 | 7480 | ||
5520 | var adler32 = __webpack_require__(51); | 7481 | var _prodInvariant = __webpack_require__(9), |
7482 | _assign = __webpack_require__(6); | ||
5521 | 7483 | ||
5522 | var TAG_END = /\/?>/; | 7484 | var PooledClass = __webpack_require__(8); |
5523 | 7485 | ||
5524 | var ReactMarkupChecksum = { | 7486 | var invariant = __webpack_require__(10); |
5525 | CHECKSUM_ATTR_NAME: 'data-react-checksum', | 7487 | |
7488 | /** | ||
7489 | * A specialized pseudo-event module to help keep track of components waiting to | ||
7490 | * be notified when their DOM representations are available for use. | ||
7491 | * | ||
7492 | * This implements `PooledClass`, so you should never need to instantiate this. | ||
7493 | * Instead, use `CallbackQueue.getPooled()`. | ||
7494 | * | ||
7495 | * @class ReactMountReady | ||
7496 | * @implements PooledClass | ||
7497 | * @internal | ||
7498 | */ | ||
7499 | function CallbackQueue() { | ||
7500 | this._callbacks = null; | ||
7501 | this._contexts = null; | ||
7502 | } | ||
7503 | |||
7504 | _assign(CallbackQueue.prototype, { | ||
5526 | 7505 | ||
5527 | /** | 7506 | /** |
5528 | * @param {string} markup Markup string | 7507 | * Enqueues a callback to be invoked when `notifyAll` is invoked. |
5529 | * @return {string} Markup string with checksum attribute attached | 7508 | * |
7509 | * @param {function} callback Invoked when `notifyAll` is invoked. | ||
7510 | * @param {?object} context Context to call `callback` with. | ||
7511 | * @internal | ||
5530 | */ | 7512 | */ |
5531 | addChecksumToMarkup: function (markup) { | 7513 | enqueue: function (callback, context) { |
5532 | var checksum = adler32(markup); | 7514 | this._callbacks = this._callbacks || []; |
7515 | this._contexts = this._contexts || []; | ||
7516 | this._callbacks.push(callback); | ||
7517 | this._contexts.push(context); | ||
7518 | }, | ||
7519 | |||
7520 | /** | ||
7521 | * Invokes all enqueued callbacks and clears the queue. This is invoked after | ||
7522 | * the DOM representation of a component has been created or updated. | ||
7523 | * | ||
7524 | * @internal | ||
7525 | */ | ||
7526 | notifyAll: function () { | ||
7527 | var callbacks = this._callbacks; | ||
7528 | var contexts = this._contexts; | ||
7529 | if (callbacks) { | ||
7530 | !(callbacks.length === contexts.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Mismatched list of contexts in callback queue') : _prodInvariant('24') : void 0; | ||
7531 | this._callbacks = null; | ||
7532 | this._contexts = null; | ||
7533 | for (var i = 0; i < callbacks.length; i++) { | ||
7534 | callbacks[i].call(contexts[i]); | ||
7535 | } | ||
7536 | callbacks.length = 0; | ||
7537 | contexts.length = 0; | ||
7538 | } | ||
7539 | }, | ||
7540 | |||
7541 | checkpoint: function () { | ||
7542 | return this._callbacks ? this._callbacks.length : 0; | ||
7543 | }, | ||
7544 | |||
7545 | rollback: function (len) { | ||
7546 | if (this._callbacks) { | ||
7547 | this._callbacks.length = len; | ||
7548 | this._contexts.length = len; | ||
7549 | } | ||
7550 | }, | ||
5533 | 7551 | ||
5534 | // Add checksum (handle both parent tags and self-closing tags) | 7552 | /** |
5535 | return markup.replace(TAG_END, ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '"$&'); | 7553 | * Resets the internal queue. |
7554 | * | ||
7555 | * @internal | ||
7556 | */ | ||
7557 | reset: function () { | ||
7558 | this._callbacks = null; | ||
7559 | this._contexts = null; | ||
5536 | }, | 7560 | }, |
5537 | 7561 | ||
5538 | /** | 7562 | /** |
5539 | * @param {string} markup to use | 7563 | * `PooledClass` looks for this. |
5540 | * @param {DOMElement} element root React element | ||
5541 | * @returns {boolean} whether or not the markup is the same | ||
5542 | */ | 7564 | */ |
5543 | canReuseMarkup: function (markup, element) { | 7565 | destructor: function () { |
5544 | var existingChecksum = element.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME); | 7566 | this.reset(); |
5545 | existingChecksum = existingChecksum && parseInt(existingChecksum, 10); | ||
5546 | var markupChecksum = adler32(markup); | ||
5547 | return markupChecksum === existingChecksum; | ||
5548 | } | 7567 | } |
5549 | }; | ||
5550 | 7568 | ||
5551 | module.exports = ReactMarkupChecksum; | 7569 | }); |
7570 | |||
7571 | PooledClass.addPoolingTo(CallbackQueue); | ||
7572 | |||
7573 | module.exports = CallbackQueue; | ||
7574 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
5552 | 7575 | ||
5553 | /***/ }, | 7576 | /***/ }, |
5554 | /* 51 */ | 7577 | /* 61 */ |
5555 | /***/ function(module, exports) { | 7578 | /***/ function(module, exports) { |
5556 | 7579 | ||
5557 | /** | 7580 | /** |
5558 | * Copyright 2013-2015, Facebook, Inc. | 7581 | * Copyright 2013-present, Facebook, Inc. |
5559 | * All rights reserved. | 7582 | * All rights reserved. |
5560 | * | 7583 | * |
5561 | * This source code is licensed under the BSD-style license found in the | 7584 | * This source code is licensed under the BSD-style license found in the |
5562 | * LICENSE file in the root directory of this source tree. An additional grant | 7585 | * LICENSE file in the root directory of this source tree. An additional grant |
5563 | * of patent rights can be found in the PATENTS file in the same directory. | 7586 | * of patent rights can be found in the PATENTS file in the same directory. |
5564 | * | 7587 | * |
5565 | * @providesModule adler32 | 7588 | * @providesModule ReactFeatureFlags |
7589 | * | ||
5566 | */ | 7590 | */ |
5567 | 7591 | ||
5568 | 'use strict'; | 7592 | 'use strict'; |
5569 | 7593 | ||
5570 | var MOD = 65521; | 7594 | var ReactFeatureFlags = { |
5571 | 7595 | // When true, call console.time() before and .timeEnd() after each top-level | |
5572 | // adler32 is not cryptographically strong, and is only used to sanity check that | 7596 | // render (both initial renders and updates). Useful when looking at prod-mode |
5573 | // markup generated on the server matches the markup generated on the client. | 7597 | // timeline profiles in Chrome, for example. |
5574 | // This implementation (a modified version of the SheetJS version) has been optimized | 7598 | logTopLevelRenders: false |
5575 | // for our use case, at the expense of conforming to the adler32 specification | 7599 | }; |
5576 | // for non-ascii inputs. | ||
5577 | function adler32(data) { | ||
5578 | var a = 1; | ||
5579 | var b = 0; | ||
5580 | var i = 0; | ||
5581 | var l = data.length; | ||
5582 | var m = l & ~0x3; | ||
5583 | while (i < m) { | ||
5584 | for (; i < Math.min(i + 4096, m); i += 4) { | ||
5585 | b += (a += data.charCodeAt(i)) + (a += data.charCodeAt(i + 1)) + (a += data.charCodeAt(i + 2)) + (a += data.charCodeAt(i + 3)); | ||
5586 | } | ||
5587 | a %= MOD; | ||
5588 | b %= MOD; | ||
5589 | } | ||
5590 | for (; i < l; i++) { | ||
5591 | b += a += data.charCodeAt(i); | ||
5592 | } | ||
5593 | a %= MOD; | ||
5594 | b %= MOD; | ||
5595 | return a | b << 16; | ||
5596 | } | ||
5597 | 7600 | ||
5598 | module.exports = adler32; | 7601 | module.exports = ReactFeatureFlags; |
5599 | 7602 | ||
5600 | /***/ }, | 7603 | /***/ }, |
5601 | /* 52 */ | 7604 | /* 62 */ |
5602 | /***/ function(module, exports, __webpack_require__) { | 7605 | /***/ function(module, exports, __webpack_require__) { |
5603 | 7606 | ||
5604 | /** | 7607 | /* WEBPACK VAR INJECTION */(function(process) {/** |
5605 | * Copyright 2013-2015, Facebook, Inc. | 7608 | * Copyright 2013-present, Facebook, Inc. |
5606 | * All rights reserved. | 7609 | * All rights reserved. |
5607 | * | 7610 | * |
5608 | * This source code is licensed under the BSD-style license found in the | 7611 | * This source code is licensed under the BSD-style license found in the |
@@ -5614,7 +7617,10 @@ | |||
5614 | 7617 | ||
5615 | 'use strict'; | 7618 | 'use strict'; |
5616 | 7619 | ||
5617 | var ReactRef = __webpack_require__(53); | 7620 | var ReactRef = __webpack_require__(63); |
7621 | var ReactInstrumentation = __webpack_require__(65); | ||
7622 | |||
7623 | var warning = __webpack_require__(13); | ||
5618 | 7624 | ||
5619 | /** | 7625 | /** |
5620 | * Helper to call ReactRef.attachRefs with this composite component, split out | 7626 | * Helper to call ReactRef.attachRefs with this composite component, split out |
@@ -5630,29 +7636,61 @@ | |||
5630 | * Initializes the component, renders markup, and registers event listeners. | 7636 | * Initializes the component, renders markup, and registers event listeners. |
5631 | * | 7637 | * |
5632 | * @param {ReactComponent} internalInstance | 7638 | * @param {ReactComponent} internalInstance |
5633 | * @param {string} rootID DOM ID of the root node. | ||
5634 | * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction | 7639 | * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction |
7640 | * @param {?object} the containing host component instance | ||
7641 | * @param {?object} info about the host container | ||
5635 | * @return {?string} Rendered markup to be inserted into the DOM. | 7642 | * @return {?string} Rendered markup to be inserted into the DOM. |
5636 | * @final | 7643 | * @final |
5637 | * @internal | 7644 | * @internal |
5638 | */ | 7645 | */ |
5639 | mountComponent: function (internalInstance, rootID, transaction, context) { | 7646 | mountComponent: function (internalInstance, transaction, hostParent, hostContainerInfo, context) { |
5640 | var markup = internalInstance.mountComponent(rootID, transaction, context); | 7647 | if (process.env.NODE_ENV !== 'production') { |
7648 | if (internalInstance._debugID !== 0) { | ||
7649 | ReactInstrumentation.debugTool.onBeforeMountComponent(internalInstance._debugID, internalInstance._currentElement); | ||
7650 | ReactInstrumentation.debugTool.onBeginReconcilerTimer(internalInstance._debugID, 'mountComponent'); | ||
7651 | } | ||
7652 | } | ||
7653 | var markup = internalInstance.mountComponent(transaction, hostParent, hostContainerInfo, context); | ||
5641 | if (internalInstance._currentElement && internalInstance._currentElement.ref != null) { | 7654 | if (internalInstance._currentElement && internalInstance._currentElement.ref != null) { |
5642 | transaction.getReactMountReady().enqueue(attachRefs, internalInstance); | 7655 | transaction.getReactMountReady().enqueue(attachRefs, internalInstance); |
5643 | } | 7656 | } |
7657 | if (process.env.NODE_ENV !== 'production') { | ||
7658 | if (internalInstance._debugID !== 0) { | ||
7659 | ReactInstrumentation.debugTool.onEndReconcilerTimer(internalInstance._debugID, 'mountComponent'); | ||
7660 | ReactInstrumentation.debugTool.onMountComponent(internalInstance._debugID); | ||
7661 | } | ||
7662 | } | ||
5644 | return markup; | 7663 | return markup; |
5645 | }, | 7664 | }, |
5646 | 7665 | ||
5647 | /** | 7666 | /** |
7667 | * Returns a value that can be passed to | ||
7668 | * ReactComponentEnvironment.replaceNodeWithMarkup. | ||
7669 | */ | ||
7670 | getHostNode: function (internalInstance) { | ||
7671 | return internalInstance.getHostNode(); | ||
7672 | }, | ||
7673 | |||
7674 | /** | ||
5648 | * Releases any resources allocated by `mountComponent`. | 7675 | * Releases any resources allocated by `mountComponent`. |
5649 | * | 7676 | * |
5650 | * @final | 7677 | * @final |
5651 | * @internal | 7678 | * @internal |
5652 | */ | 7679 | */ |
5653 | unmountComponent: function (internalInstance) { | 7680 | unmountComponent: function (internalInstance, safely) { |
7681 | if (process.env.NODE_ENV !== 'production') { | ||
7682 | if (internalInstance._debugID !== 0) { | ||
7683 | ReactInstrumentation.debugTool.onBeginReconcilerTimer(internalInstance._debugID, 'unmountComponent'); | ||
7684 | } | ||
7685 | } | ||
5654 | ReactRef.detachRefs(internalInstance, internalInstance._currentElement); | 7686 | ReactRef.detachRefs(internalInstance, internalInstance._currentElement); |
5655 | internalInstance.unmountComponent(); | 7687 | internalInstance.unmountComponent(safely); |
7688 | if (process.env.NODE_ENV !== 'production') { | ||
7689 | if (internalInstance._debugID !== 0) { | ||
7690 | ReactInstrumentation.debugTool.onEndReconcilerTimer(internalInstance._debugID, 'unmountComponent'); | ||
7691 | ReactInstrumentation.debugTool.onUnmountComponent(internalInstance._debugID); | ||
7692 | } | ||
7693 | } | ||
5656 | }, | 7694 | }, |
5657 | 7695 | ||
5658 | /** | 7696 | /** |
@@ -5681,6 +7719,13 @@ | |||
5681 | return; | 7719 | return; |
5682 | } | 7720 | } |
5683 | 7721 | ||
7722 | if (process.env.NODE_ENV !== 'production') { | ||
7723 | if (internalInstance._debugID !== 0) { | ||
7724 | ReactInstrumentation.debugTool.onBeforeUpdateComponent(internalInstance._debugID, nextElement); | ||
7725 | ReactInstrumentation.debugTool.onBeginReconcilerTimer(internalInstance._debugID, 'receiveComponent'); | ||
7726 | } | ||
7727 | } | ||
7728 | |||
5684 | var refsChanged = ReactRef.shouldUpdateRefs(prevElement, nextElement); | 7729 | var refsChanged = ReactRef.shouldUpdateRefs(prevElement, nextElement); |
5685 | 7730 | ||
5686 | if (refsChanged) { | 7731 | if (refsChanged) { |
@@ -5692,6 +7737,13 @@ | |||
5692 | if (refsChanged && internalInstance._currentElement && internalInstance._currentElement.ref != null) { | 7737 | if (refsChanged && internalInstance._currentElement && internalInstance._currentElement.ref != null) { |
5693 | transaction.getReactMountReady().enqueue(attachRefs, internalInstance); | 7738 | transaction.getReactMountReady().enqueue(attachRefs, internalInstance); |
5694 | } | 7739 | } |
7740 | |||
7741 | if (process.env.NODE_ENV !== 'production') { | ||
7742 | if (internalInstance._debugID !== 0) { | ||
7743 | ReactInstrumentation.debugTool.onEndReconcilerTimer(internalInstance._debugID, 'receiveComponent'); | ||
7744 | ReactInstrumentation.debugTool.onUpdateComponent(internalInstance._debugID); | ||
7745 | } | ||
7746 | } | ||
5695 | }, | 7747 | }, |
5696 | 7748 | ||
5697 | /** | 7749 | /** |
@@ -5701,20 +7753,39 @@ | |||
5701 | * @param {ReactReconcileTransaction} transaction | 7753 | * @param {ReactReconcileTransaction} transaction |
5702 | * @internal | 7754 | * @internal |
5703 | */ | 7755 | */ |
5704 | performUpdateIfNecessary: function (internalInstance, transaction) { | 7756 | performUpdateIfNecessary: function (internalInstance, transaction, updateBatchNumber) { |
7757 | if (internalInstance._updateBatchNumber !== updateBatchNumber) { | ||
7758 | // The component's enqueued batch number should always be the current | ||
7759 | // batch or the following one. | ||
7760 | 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; | ||
7761 | return; | ||
7762 | } | ||
7763 | if (process.env.NODE_ENV !== 'production') { | ||
7764 | if (internalInstance._debugID !== 0) { | ||
7765 | ReactInstrumentation.debugTool.onBeginReconcilerTimer(internalInstance._debugID, 'performUpdateIfNecessary'); | ||
7766 | ReactInstrumentation.debugTool.onBeforeUpdateComponent(internalInstance._debugID, internalInstance._currentElement); | ||
7767 | } | ||
7768 | } | ||
5705 | internalInstance.performUpdateIfNecessary(transaction); | 7769 | internalInstance.performUpdateIfNecessary(transaction); |
7770 | if (process.env.NODE_ENV !== 'production') { | ||
7771 | if (internalInstance._debugID !== 0) { | ||
7772 | ReactInstrumentation.debugTool.onEndReconcilerTimer(internalInstance._debugID, 'performUpdateIfNecessary'); | ||
7773 | ReactInstrumentation.debugTool.onUpdateComponent(internalInstance._debugID); | ||
7774 | } | ||
7775 | } | ||
5706 | } | 7776 | } |
5707 | 7777 | ||
5708 | }; | 7778 | }; |
5709 | 7779 | ||
5710 | module.exports = ReactReconciler; | 7780 | module.exports = ReactReconciler; |
7781 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
5711 | 7782 | ||
5712 | /***/ }, | 7783 | /***/ }, |
5713 | /* 53 */ | 7784 | /* 63 */ |
5714 | /***/ function(module, exports, __webpack_require__) { | 7785 | /***/ function(module, exports, __webpack_require__) { |
5715 | 7786 | ||
5716 | /** | 7787 | /** |
5717 | * Copyright 2013-2015, Facebook, Inc. | 7788 | * Copyright 2013-present, Facebook, Inc. |
5718 | * All rights reserved. | 7789 | * All rights reserved. |
5719 | * | 7790 | * |
5720 | * This source code is licensed under the BSD-style license found in the | 7791 | * This source code is licensed under the BSD-style license found in the |
@@ -5726,7 +7797,7 @@ | |||
5726 | 7797 | ||
5727 | 'use strict'; | 7798 | 'use strict'; |
5728 | 7799 | ||
5729 | var ReactOwner = __webpack_require__(54); | 7800 | var ReactOwner = __webpack_require__(64); |
5730 | 7801 | ||
5731 | var ReactRef = {}; | 7802 | var ReactRef = {}; |
5732 | 7803 | ||
@@ -5776,7 +7847,9 @@ | |||
5776 | 7847 | ||
5777 | return( | 7848 | return( |
5778 | // This has a few false positives w/r/t empty components. | 7849 | // This has a few false positives w/r/t empty components. |
5779 | prevEmpty || nextEmpty || nextElement._owner !== prevElement._owner || nextElement.ref !== prevElement.ref | 7850 | prevEmpty || nextEmpty || nextElement.ref !== prevElement.ref || |
7851 | // If owner changes but we have an unchanged function ref, don't update refs | ||
7852 | typeof nextElement.ref === 'string' && nextElement._owner !== prevElement._owner | ||
5780 | ); | 7853 | ); |
5781 | }; | 7854 | }; |
5782 | 7855 | ||
@@ -5793,11 +7866,11 @@ | |||
5793 | module.exports = ReactRef; | 7866 | module.exports = ReactRef; |
5794 | 7867 | ||
5795 | /***/ }, | 7868 | /***/ }, |
5796 | /* 54 */ | 7869 | /* 64 */ |
5797 | /***/ function(module, exports, __webpack_require__) { | 7870 | /***/ function(module, exports, __webpack_require__) { |
5798 | 7871 | ||
5799 | /* WEBPACK VAR INJECTION */(function(process) {/** | 7872 | /* WEBPACK VAR INJECTION */(function(process) {/** |
5800 | * Copyright 2013-2015, Facebook, Inc. | 7873 | * Copyright 2013-present, Facebook, Inc. |
5801 | * All rights reserved. | 7874 | * All rights reserved. |
5802 | * | 7875 | * |
5803 | * This source code is licensed under the BSD-style license found in the | 7876 | * This source code is licensed under the BSD-style license found in the |
@@ -5809,7 +7882,9 @@ | |||
5809 | 7882 | ||
5810 | 'use strict'; | 7883 | 'use strict'; |
5811 | 7884 | ||
5812 | var invariant = __webpack_require__(15); | 7885 | var _prodInvariant = __webpack_require__(9); |
7886 | |||
7887 | var invariant = __webpack_require__(10); | ||
5813 | 7888 | ||
5814 | /** | 7889 | /** |
5815 | * ReactOwners are capable of storing references to owned components. | 7890 | * ReactOwners are capable of storing references to owned components. |
@@ -5862,7 +7937,7 @@ | |||
5862 | * @internal | 7937 | * @internal |
5863 | */ | 7938 | */ |
5864 | addComponentAsRefTo: function (component, ref, owner) { | 7939 | addComponentAsRefTo: function (component, ref, owner) { |
5865 | !ReactOwner.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).') : invariant(false) : undefined; | 7940 | !ReactOwner.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; |
5866 | owner.attachRef(ref, component); | 7941 | owner.attachRef(ref, component); |
5867 | }, | 7942 | }, |
5868 | 7943 | ||
@@ -5876,10 +7951,11 @@ | |||
5876 | * @internal | 7951 | * @internal |
5877 | */ | 7952 | */ |
5878 | removeComponentAsRefFrom: function (component, ref, owner) { | 7953 | removeComponentAsRefFrom: function (component, ref, owner) { |
5879 | !ReactOwner.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).') : invariant(false) : undefined; | 7954 | !ReactOwner.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; |
5880 | // Check that `component` is still the current ref because we do not want to | 7955 | var ownerPublicInstance = owner.getPublicInstance(); |
5881 | // detach the ref if another component stole it. | 7956 | // Check that `component`'s owner is still alive and that `component` is still the current ref |
5882 | if (owner.getPublicInstance().refs[ref] === component.getPublicInstance()) { | 7957 | // because we do not want to detach the ref if another component stole it. |
7958 | if (ownerPublicInstance && ownerPublicInstance.refs[ref] === component.getPublicInstance()) { | ||
5883 | owner.detachRef(ref); | 7959 | owner.detachRef(ref); |
5884 | } | 7960 | } |
5885 | } | 7961 | } |
@@ -5887,730 +7963,585 @@ | |||
5887 | }; | 7963 | }; |
5888 | 7964 | ||
5889 | module.exports = ReactOwner; | 7965 | module.exports = ReactOwner; |
5890 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | 7966 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) |
5891 | 7967 | ||
5892 | /***/ }, | 7968 | /***/ }, |
5893 | /* 55 */ | 7969 | /* 65 */ |
5894 | /***/ function(module, exports, __webpack_require__) { | 7970 | /***/ function(module, exports, __webpack_require__) { |
5895 | 7971 | ||
5896 | /* WEBPACK VAR INJECTION */(function(process) {/** | 7972 | /* WEBPACK VAR INJECTION */(function(process) {/** |
5897 | * Copyright 2015, Facebook, Inc. | 7973 | * Copyright 2016-present, Facebook, Inc. |
5898 | * All rights reserved. | 7974 | * All rights reserved. |
5899 | * | 7975 | * |
5900 | * This source code is licensed under the BSD-style license found in the | 7976 | * This source code is licensed under the BSD-style license found in the |
5901 | * LICENSE file in the root directory of this source tree. An additional grant | 7977 | * LICENSE file in the root directory of this source tree. An additional grant |
5902 | * of patent rights can be found in the PATENTS file in the same directory. | 7978 | * of patent rights can be found in the PATENTS file in the same directory. |
5903 | * | 7979 | * |
5904 | * @providesModule ReactUpdateQueue | 7980 | * @providesModule ReactInstrumentation |
5905 | */ | 7981 | */ |
5906 | 7982 | ||
5907 | 'use strict'; | 7983 | 'use strict'; |
5908 | 7984 | ||
5909 | var ReactCurrentOwner = __webpack_require__(7); | 7985 | var debugTool = null; |
5910 | var ReactElement = __webpack_require__(44); | ||
5911 | var ReactInstanceMap = __webpack_require__(49); | ||
5912 | var ReactUpdates = __webpack_require__(56); | ||
5913 | |||
5914 | var assign = __webpack_require__(41); | ||
5915 | var invariant = __webpack_require__(15); | ||
5916 | var warning = __webpack_require__(27); | ||
5917 | 7986 | ||
5918 | function enqueueUpdate(internalInstance) { | 7987 | if (process.env.NODE_ENV !== 'production') { |
5919 | ReactUpdates.enqueueUpdate(internalInstance); | 7988 | var ReactDebugTool = __webpack_require__(66); |
7989 | debugTool = ReactDebugTool; | ||
5920 | } | 7990 | } |
5921 | 7991 | ||
5922 | function getInternalInstanceReadyForUpdate(publicInstance, callerName) { | 7992 | module.exports = { debugTool: debugTool }; |
5923 | var internalInstance = ReactInstanceMap.get(publicInstance); | 7993 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) |
5924 | if (!internalInstance) { | 7994 | |
5925 | if (process.env.NODE_ENV !== 'production') { | 7995 | /***/ }, |
5926 | // Only warn when we have a callerName. Otherwise we should be silent. | 7996 | /* 66 */ |
5927 | // We're probably calling from enqueueCallback. We don't want to warn | 7997 | /***/ function(module, exports, __webpack_require__) { |
5928 | // there because we already warned for the corresponding lifecycle method. | 7998 | |
5929 | 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, publicInstance.constructor.displayName) : undefined; | 7999 | /* WEBPACK VAR INJECTION */(function(process) {/** |
5930 | } | 8000 | * Copyright 2016-present, Facebook, Inc. |
5931 | return null; | 8001 | * All rights reserved. |
5932 | } | 8002 | * |
8003 | * This source code is licensed under the BSD-style license found in the | ||
8004 | * LICENSE file in the root directory of this source tree. An additional grant | ||
8005 | * of patent rights can be found in the PATENTS file in the same directory. | ||
8006 | * | ||
8007 | * @providesModule ReactDebugTool | ||
8008 | */ | ||
5933 | 8009 | ||
5934 | if (process.env.NODE_ENV !== 'production') { | 8010 | 'use strict'; |
5935 | process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, '%s(...): Cannot update during an existing state transition ' + '(such as within `render`). Render methods should be a pure function ' + 'of props and state.', callerName) : undefined; | ||
5936 | } | ||
5937 | 8011 | ||
5938 | return internalInstance; | 8012 | var ReactInvalidSetStateWarningDevTool = __webpack_require__(67); |
5939 | } | 8013 | var ReactHostOperationHistoryDevtool = __webpack_require__(68); |
8014 | var ReactComponentTreeDevtool = __webpack_require__(31); | ||
8015 | var ReactChildrenMutationWarningDevtool = __webpack_require__(69); | ||
8016 | var ExecutionEnvironment = __webpack_require__(52); | ||
5940 | 8017 | ||
5941 | /** | 8018 | var performanceNow = __webpack_require__(70); |
5942 | * ReactUpdateQueue allows for state updates to be scheduled into a later | 8019 | var warning = __webpack_require__(13); |
5943 | * reconciliation step. | ||
5944 | */ | ||
5945 | var ReactUpdateQueue = { | ||
5946 | 8020 | ||
5947 | /** | 8021 | var eventHandlers = []; |
5948 | * Checks whether or not this composite component is mounted. | 8022 | var handlerDoesThrowForEvent = {}; |
5949 | * @param {ReactClass} publicInstance The instance we want to test. | 8023 | |
5950 | * @return {boolean} True if mounted, false otherwise. | 8024 | function emitEvent(handlerFunctionName, arg1, arg2, arg3, arg4, arg5) { |
5951 | * @protected | 8025 | eventHandlers.forEach(function (handler) { |
5952 | * @final | 8026 | try { |
5953 | */ | 8027 | if (handler[handlerFunctionName]) { |
5954 | isMounted: function (publicInstance) { | 8028 | handler[handlerFunctionName](arg1, arg2, arg3, arg4, arg5); |
5955 | if (process.env.NODE_ENV !== 'production') { | ||
5956 | var owner = ReactCurrentOwner.current; | ||
5957 | if (owner !== null) { | ||
5958 | 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') : undefined; | ||
5959 | owner._warnedAboutRefsInRender = true; | ||
5960 | } | 8029 | } |
8030 | } catch (e) { | ||
8031 | process.env.NODE_ENV !== 'production' ? warning(handlerDoesThrowForEvent[handlerFunctionName], 'exception thrown by devtool while handling %s: %s', handlerFunctionName, e + '\n' + e.stack) : void 0; | ||
8032 | handlerDoesThrowForEvent[handlerFunctionName] = true; | ||
5961 | } | 8033 | } |
5962 | var internalInstance = ReactInstanceMap.get(publicInstance); | 8034 | }); |
5963 | if (internalInstance) { | 8035 | } |
5964 | // During componentWillMount and render this will still be null but after | ||
5965 | // that will always render to something. At least for now. So we can use | ||
5966 | // this hack. | ||
5967 | return !!internalInstance._renderedComponent; | ||
5968 | } else { | ||
5969 | return false; | ||
5970 | } | ||
5971 | }, | ||
5972 | 8036 | ||
5973 | /** | 8037 | var isProfiling = false; |
5974 | * Enqueue a callback that will be executed after all the pending updates | 8038 | var flushHistory = []; |
5975 | * have processed. | 8039 | var lifeCycleTimerStack = []; |
5976 | * | 8040 | var currentFlushNesting = 0; |
5977 | * @param {ReactClass} publicInstance The instance to use as `this` context. | 8041 | var currentFlushMeasurements = null; |
5978 | * @param {?function} callback Called after state is updated. | 8042 | var currentFlushStartTime = null; |
5979 | * @internal | 8043 | var currentTimerDebugID = null; |
5980 | */ | 8044 | var currentTimerStartTime = null; |
5981 | enqueueCallback: function (publicInstance, callback) { | 8045 | var currentTimerNestedFlushDuration = null; |
5982 | !(typeof callback === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' + '`setState`, `replaceState`, or `forceUpdate` with a callback that ' + 'isn\'t callable.') : invariant(false) : undefined; | 8046 | var currentTimerType = null; |
5983 | var internalInstance = getInternalInstanceReadyForUpdate(publicInstance); | 8047 | |
8048 | var lifeCycleTimerHasWarned = false; | ||
8049 | |||
8050 | function clearHistory() { | ||
8051 | ReactComponentTreeDevtool.purgeUnmountedComponents(); | ||
8052 | ReactHostOperationHistoryDevtool.clearHistory(); | ||
8053 | } | ||
8054 | |||
8055 | function getTreeSnapshot(registeredIDs) { | ||
8056 | return registeredIDs.reduce(function (tree, id) { | ||
8057 | var ownerID = ReactComponentTreeDevtool.getOwnerID(id); | ||
8058 | var parentID = ReactComponentTreeDevtool.getParentID(id); | ||
8059 | tree[id] = { | ||
8060 | displayName: ReactComponentTreeDevtool.getDisplayName(id), | ||
8061 | text: ReactComponentTreeDevtool.getText(id), | ||
8062 | updateCount: ReactComponentTreeDevtool.getUpdateCount(id), | ||
8063 | childIDs: ReactComponentTreeDevtool.getChildIDs(id), | ||
8064 | // Text nodes don't have owners but this is close enough. | ||
8065 | ownerID: ownerID || ReactComponentTreeDevtool.getOwnerID(parentID), | ||
8066 | parentID: parentID | ||
8067 | }; | ||
8068 | return tree; | ||
8069 | }, {}); | ||
8070 | } | ||
5984 | 8071 | ||
5985 | // Previously we would throw an error if we didn't have an internal | 8072 | function resetMeasurements() { |
5986 | // instance. Since we want to make it a no-op instead, we mirror the same | 8073 | var previousStartTime = currentFlushStartTime; |
5987 | // behavior we have in other enqueue* methods. | 8074 | var previousMeasurements = currentFlushMeasurements || []; |
5988 | // We also need to ignore callbacks in componentWillMount. See | 8075 | var previousOperations = ReactHostOperationHistoryDevtool.getHistory(); |
5989 | // enqueueUpdates. | ||
5990 | if (!internalInstance) { | ||
5991 | return null; | ||
5992 | } | ||
5993 | 8076 | ||
5994 | if (internalInstance._pendingCallbacks) { | 8077 | if (currentFlushNesting === 0) { |
5995 | internalInstance._pendingCallbacks.push(callback); | 8078 | currentFlushStartTime = null; |
5996 | } else { | 8079 | currentFlushMeasurements = null; |
5997 | internalInstance._pendingCallbacks = [callback]; | 8080 | clearHistory(); |
5998 | } | 8081 | return; |
5999 | // TODO: The callback here is ignored when setState is called from | 8082 | } |
6000 | // componentWillMount. Either fix it or disallow doing so completely in | ||
6001 | // favor of getInitialState. Alternatively, we can disallow | ||
6002 | // componentWillMount during server-side rendering. | ||
6003 | enqueueUpdate(internalInstance); | ||
6004 | }, | ||
6005 | |||
6006 | enqueueCallbackInternal: function (internalInstance, callback) { | ||
6007 | !(typeof callback === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' + '`setState`, `replaceState`, or `forceUpdate` with a callback that ' + 'isn\'t callable.') : invariant(false) : undefined; | ||
6008 | if (internalInstance._pendingCallbacks) { | ||
6009 | internalInstance._pendingCallbacks.push(callback); | ||
6010 | } else { | ||
6011 | internalInstance._pendingCallbacks = [callback]; | ||
6012 | } | ||
6013 | enqueueUpdate(internalInstance); | ||
6014 | }, | ||
6015 | 8083 | ||
6016 | /** | 8084 | if (previousMeasurements.length || previousOperations.length) { |
6017 | * Forces an update. This should only be invoked when it is known with | 8085 | var registeredIDs = ReactComponentTreeDevtool.getRegisteredIDs(); |
6018 | * certainty that we are **not** in a DOM transaction. | 8086 | flushHistory.push({ |
6019 | * | 8087 | duration: performanceNow() - previousStartTime, |
6020 | * You may want to call this when you know that some deeper aspect of the | 8088 | measurements: previousMeasurements || [], |
6021 | * component's state has changed but `setState` was not called. | 8089 | operations: previousOperations || [], |
6022 | * | 8090 | treeSnapshot: getTreeSnapshot(registeredIDs) |
6023 | * This will not invoke `shouldComponentUpdate`, but it will invoke | 8091 | }); |
6024 | * `componentWillUpdate` and `componentDidUpdate`. | 8092 | } |
6025 | * | ||
6026 | * @param {ReactClass} publicInstance The instance that should rerender. | ||
6027 | * @internal | ||
6028 | */ | ||
6029 | enqueueForceUpdate: function (publicInstance) { | ||
6030 | var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'forceUpdate'); | ||
6031 | 8093 | ||
6032 | if (!internalInstance) { | 8094 | clearHistory(); |
6033 | return; | 8095 | currentFlushStartTime = performanceNow(); |
6034 | } | 8096 | currentFlushMeasurements = []; |
8097 | } | ||
6035 | 8098 | ||
6036 | internalInstance._pendingForceUpdate = true; | 8099 | function checkDebugID(debugID) { |
8100 | process.env.NODE_ENV !== 'production' ? warning(debugID, 'ReactDebugTool: debugID may not be empty.') : void 0; | ||
8101 | } | ||
6037 | 8102 | ||
6038 | enqueueUpdate(internalInstance); | 8103 | function beginLifeCycleTimer(debugID, timerType) { |
6039 | }, | 8104 | if (currentFlushNesting === 0) { |
8105 | return; | ||
8106 | } | ||
8107 | if (currentTimerType && !lifeCycleTimerHasWarned) { | ||
8108 | 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; | ||
8109 | lifeCycleTimerHasWarned = true; | ||
8110 | } | ||
8111 | currentTimerStartTime = performanceNow(); | ||
8112 | currentTimerNestedFlushDuration = 0; | ||
8113 | currentTimerDebugID = debugID; | ||
8114 | currentTimerType = timerType; | ||
8115 | } | ||
6040 | 8116 | ||
6041 | /** | 8117 | function endLifeCycleTimer(debugID, timerType) { |
6042 | * Replaces all of the state. Always use this or `setState` to mutate state. | 8118 | if (currentFlushNesting === 0) { |
6043 | * You should treat `this.state` as immutable. | 8119 | return; |
6044 | * | 8120 | } |
6045 | * There is no guarantee that `this.state` will be immediately updated, so | 8121 | if (currentTimerType !== timerType && !lifeCycleTimerHasWarned) { |
6046 | * accessing `this.state` after calling this method may return the old value. | 8122 | 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; |
6047 | * | 8123 | lifeCycleTimerHasWarned = true; |
6048 | * @param {ReactClass} publicInstance The instance that should rerender. | 8124 | } |
6049 | * @param {object} completeState Next state. | 8125 | if (isProfiling) { |
6050 | * @internal | 8126 | currentFlushMeasurements.push({ |
6051 | */ | 8127 | timerType: timerType, |
6052 | enqueueReplaceState: function (publicInstance, completeState) { | 8128 | instanceID: debugID, |
6053 | var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceState'); | 8129 | duration: performanceNow() - currentTimerStartTime - currentTimerNestedFlushDuration |
8130 | }); | ||
8131 | } | ||
8132 | currentTimerStartTime = null; | ||
8133 | currentTimerNestedFlushDuration = null; | ||
8134 | currentTimerDebugID = null; | ||
8135 | currentTimerType = null; | ||
8136 | } | ||
6054 | 8137 | ||
6055 | if (!internalInstance) { | 8138 | function pauseCurrentLifeCycleTimer() { |
6056 | return; | 8139 | var currentTimer = { |
6057 | } | 8140 | startTime: currentTimerStartTime, |
8141 | nestedFlushStartTime: performanceNow(), | ||
8142 | debugID: currentTimerDebugID, | ||
8143 | timerType: currentTimerType | ||
8144 | }; | ||
8145 | lifeCycleTimerStack.push(currentTimer); | ||
8146 | currentTimerStartTime = null; | ||
8147 | currentTimerNestedFlushDuration = null; | ||
8148 | currentTimerDebugID = null; | ||
8149 | currentTimerType = null; | ||
8150 | } | ||
6058 | 8151 | ||
6059 | internalInstance._pendingStateQueue = [completeState]; | 8152 | function resumeCurrentLifeCycleTimer() { |
6060 | internalInstance._pendingReplaceState = true; | 8153 | var _lifeCycleTimerStack$ = lifeCycleTimerStack.pop(); |
6061 | 8154 | ||
6062 | enqueueUpdate(internalInstance); | 8155 | var startTime = _lifeCycleTimerStack$.startTime; |
6063 | }, | 8156 | var nestedFlushStartTime = _lifeCycleTimerStack$.nestedFlushStartTime; |
8157 | var debugID = _lifeCycleTimerStack$.debugID; | ||
8158 | var timerType = _lifeCycleTimerStack$.timerType; | ||
6064 | 8159 | ||
6065 | /** | 8160 | var nestedFlushDuration = performanceNow() - nestedFlushStartTime; |
6066 | * Sets a subset of the state. This only exists because _pendingState is | 8161 | currentTimerStartTime = startTime; |
6067 | * internal. This provides a merging strategy that is not available to deep | 8162 | currentTimerNestedFlushDuration += nestedFlushDuration; |
6068 | * properties which is confusing. TODO: Expose pendingState or don't use it | 8163 | currentTimerDebugID = debugID; |
6069 | * during the merge. | 8164 | currentTimerType = timerType; |
6070 | * | 8165 | } |
6071 | * @param {ReactClass} publicInstance The instance that should rerender. | ||
6072 | * @param {object} partialState Next partial state to be merged with state. | ||
6073 | * @internal | ||
6074 | */ | ||
6075 | enqueueSetState: function (publicInstance, partialState) { | ||
6076 | var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setState'); | ||
6077 | 8166 | ||
6078 | if (!internalInstance) { | 8167 | var ReactDebugTool = { |
8168 | addDevtool: function (devtool) { | ||
8169 | eventHandlers.push(devtool); | ||
8170 | }, | ||
8171 | removeDevtool: function (devtool) { | ||
8172 | for (var i = 0; i < eventHandlers.length; i++) { | ||
8173 | if (eventHandlers[i] === devtool) { | ||
8174 | eventHandlers.splice(i, 1); | ||
8175 | i--; | ||
8176 | } | ||
8177 | } | ||
8178 | }, | ||
8179 | isProfiling: function () { | ||
8180 | return isProfiling; | ||
8181 | }, | ||
8182 | beginProfiling: function () { | ||
8183 | if (isProfiling) { | ||
6079 | return; | 8184 | return; |
6080 | } | 8185 | } |
6081 | 8186 | ||
6082 | var queue = internalInstance._pendingStateQueue || (internalInstance._pendingStateQueue = []); | 8187 | isProfiling = true; |
6083 | queue.push(partialState); | 8188 | flushHistory.length = 0; |
6084 | 8189 | resetMeasurements(); | |
6085 | enqueueUpdate(internalInstance); | 8190 | ReactDebugTool.addDevtool(ReactHostOperationHistoryDevtool); |
6086 | }, | 8191 | }, |
6087 | 8192 | endProfiling: function () { | |
6088 | /** | 8193 | if (!isProfiling) { |
6089 | * Sets a subset of the props. | ||
6090 | * | ||
6091 | * @param {ReactClass} publicInstance The instance that should rerender. | ||
6092 | * @param {object} partialProps Subset of the next props. | ||
6093 | * @internal | ||
6094 | */ | ||
6095 | enqueueSetProps: function (publicInstance, partialProps) { | ||
6096 | var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setProps'); | ||
6097 | if (!internalInstance) { | ||
6098 | return; | 8194 | return; |
6099 | } | 8195 | } |
6100 | ReactUpdateQueue.enqueueSetPropsInternal(internalInstance, partialProps); | ||
6101 | }, | ||
6102 | |||
6103 | enqueueSetPropsInternal: function (internalInstance, partialProps) { | ||
6104 | var topLevelWrapper = internalInstance._topLevelWrapper; | ||
6105 | !topLevelWrapper ? process.env.NODE_ENV !== 'production' ? invariant(false, 'setProps(...): You called `setProps` on a ' + 'component with a parent. This is an anti-pattern since props will ' + 'get reactively updated when rendered. Instead, change the owner\'s ' + '`render` method to pass the correct value as props to the component ' + 'where it is created.') : invariant(false) : undefined; | ||
6106 | 8196 | ||
6107 | // Merge with the pending element if it exists, otherwise with existing | 8197 | isProfiling = false; |
6108 | // element props. | 8198 | resetMeasurements(); |
6109 | var wrapElement = topLevelWrapper._pendingElement || topLevelWrapper._currentElement; | 8199 | ReactDebugTool.removeDevtool(ReactHostOperationHistoryDevtool); |
6110 | var element = wrapElement.props; | ||
6111 | var props = assign({}, element.props, partialProps); | ||
6112 | topLevelWrapper._pendingElement = ReactElement.cloneAndReplaceProps(wrapElement, ReactElement.cloneAndReplaceProps(element, props)); | ||
6113 | |||
6114 | enqueueUpdate(topLevelWrapper); | ||
6115 | }, | 8200 | }, |
6116 | 8201 | getFlushHistory: function () { | |
6117 | /** | 8202 | return flushHistory; |
6118 | * Replaces all of the props. | 8203 | }, |
6119 | * | 8204 | onBeginFlush: function () { |
6120 | * @param {ReactClass} publicInstance The instance that should rerender. | 8205 | currentFlushNesting++; |
6121 | * @param {object} props New props. | 8206 | resetMeasurements(); |
6122 | * @internal | 8207 | pauseCurrentLifeCycleTimer(); |
6123 | */ | 8208 | emitEvent('onBeginFlush'); |
6124 | enqueueReplaceProps: function (publicInstance, props) { | 8209 | }, |
6125 | var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceProps'); | 8210 | onEndFlush: function () { |
6126 | if (!internalInstance) { | 8211 | resetMeasurements(); |
6127 | return; | 8212 | currentFlushNesting--; |
8213 | resumeCurrentLifeCycleTimer(); | ||
8214 | emitEvent('onEndFlush'); | ||
8215 | }, | ||
8216 | onBeginLifeCycleTimer: function (debugID, timerType) { | ||
8217 | checkDebugID(debugID); | ||
8218 | emitEvent('onBeginLifeCycleTimer', debugID, timerType); | ||
8219 | beginLifeCycleTimer(debugID, timerType); | ||
8220 | }, | ||
8221 | onEndLifeCycleTimer: function (debugID, timerType) { | ||
8222 | checkDebugID(debugID); | ||
8223 | endLifeCycleTimer(debugID, timerType); | ||
8224 | emitEvent('onEndLifeCycleTimer', debugID, timerType); | ||
8225 | }, | ||
8226 | onBeginReconcilerTimer: function (debugID, timerType) { | ||
8227 | checkDebugID(debugID); | ||
8228 | emitEvent('onBeginReconcilerTimer', debugID, timerType); | ||
8229 | }, | ||
8230 | onEndReconcilerTimer: function (debugID, timerType) { | ||
8231 | checkDebugID(debugID); | ||
8232 | emitEvent('onEndReconcilerTimer', debugID, timerType); | ||
8233 | }, | ||
8234 | onError: function (debugID) { | ||
8235 | if (currentTimerDebugID != null) { | ||
8236 | endLifeCycleTimer(currentTimerDebugID, currentTimerType); | ||
6128 | } | 8237 | } |
6129 | ReactUpdateQueue.enqueueReplacePropsInternal(internalInstance, props); | 8238 | emitEvent('onError', debugID); |
6130 | }, | 8239 | }, |
6131 | 8240 | onBeginProcessingChildContext: function () { | |
6132 | enqueueReplacePropsInternal: function (internalInstance, props) { | 8241 | emitEvent('onBeginProcessingChildContext'); |
6133 | var topLevelWrapper = internalInstance._topLevelWrapper; | ||
6134 | !topLevelWrapper ? process.env.NODE_ENV !== 'production' ? invariant(false, 'replaceProps(...): You called `replaceProps` on a ' + 'component with a parent. This is an anti-pattern since props will ' + 'get reactively updated when rendered. Instead, change the owner\'s ' + '`render` method to pass the correct value as props to the component ' + 'where it is created.') : invariant(false) : undefined; | ||
6135 | |||
6136 | // Merge with the pending element if it exists, otherwise with existing | ||
6137 | // element props. | ||
6138 | var wrapElement = topLevelWrapper._pendingElement || topLevelWrapper._currentElement; | ||
6139 | var element = wrapElement.props; | ||
6140 | topLevelWrapper._pendingElement = ReactElement.cloneAndReplaceProps(wrapElement, ReactElement.cloneAndReplaceProps(element, props)); | ||
6141 | |||
6142 | enqueueUpdate(topLevelWrapper); | ||
6143 | }, | 8242 | }, |
6144 | 8243 | onEndProcessingChildContext: function () { | |
6145 | enqueueElementInternal: function (internalInstance, newElement) { | 8244 | emitEvent('onEndProcessingChildContext'); |
6146 | internalInstance._pendingElement = newElement; | 8245 | }, |
6147 | enqueueUpdate(internalInstance); | 8246 | onHostOperation: function (debugID, type, payload) { |
8247 | checkDebugID(debugID); | ||
8248 | emitEvent('onHostOperation', debugID, type, payload); | ||
8249 | }, | ||
8250 | onComponentHasMounted: function (debugID) { | ||
8251 | checkDebugID(debugID); | ||
8252 | emitEvent('onComponentHasMounted', debugID); | ||
8253 | }, | ||
8254 | onComponentHasUpdated: function (debugID) { | ||
8255 | checkDebugID(debugID); | ||
8256 | emitEvent('onComponentHasUpdated', debugID); | ||
8257 | }, | ||
8258 | onSetState: function () { | ||
8259 | emitEvent('onSetState'); | ||
8260 | }, | ||
8261 | onSetDisplayName: function (debugID, displayName) { | ||
8262 | checkDebugID(debugID); | ||
8263 | emitEvent('onSetDisplayName', debugID, displayName); | ||
8264 | }, | ||
8265 | onSetChildren: function (debugID, childDebugIDs) { | ||
8266 | checkDebugID(debugID); | ||
8267 | childDebugIDs.forEach(checkDebugID); | ||
8268 | emitEvent('onSetChildren', debugID, childDebugIDs); | ||
8269 | }, | ||
8270 | onSetOwner: function (debugID, ownerDebugID) { | ||
8271 | checkDebugID(debugID); | ||
8272 | emitEvent('onSetOwner', debugID, ownerDebugID); | ||
8273 | }, | ||
8274 | onSetParent: function (debugID, parentDebugID) { | ||
8275 | checkDebugID(debugID); | ||
8276 | emitEvent('onSetParent', debugID, parentDebugID); | ||
8277 | }, | ||
8278 | onSetText: function (debugID, text) { | ||
8279 | checkDebugID(debugID); | ||
8280 | emitEvent('onSetText', debugID, text); | ||
8281 | }, | ||
8282 | onMountRootComponent: function (debugID) { | ||
8283 | checkDebugID(debugID); | ||
8284 | emitEvent('onMountRootComponent', debugID); | ||
8285 | }, | ||
8286 | onBeforeMountComponent: function (debugID, element) { | ||
8287 | checkDebugID(debugID); | ||
8288 | emitEvent('onBeforeMountComponent', debugID, element); | ||
8289 | }, | ||
8290 | onMountComponent: function (debugID) { | ||
8291 | checkDebugID(debugID); | ||
8292 | emitEvent('onMountComponent', debugID); | ||
8293 | }, | ||
8294 | onBeforeUpdateComponent: function (debugID, element) { | ||
8295 | checkDebugID(debugID); | ||
8296 | emitEvent('onBeforeUpdateComponent', debugID, element); | ||
8297 | }, | ||
8298 | onUpdateComponent: function (debugID) { | ||
8299 | checkDebugID(debugID); | ||
8300 | emitEvent('onUpdateComponent', debugID); | ||
8301 | }, | ||
8302 | onUnmountComponent: function (debugID) { | ||
8303 | checkDebugID(debugID); | ||
8304 | emitEvent('onUnmountComponent', debugID); | ||
8305 | }, | ||
8306 | onTestEvent: function () { | ||
8307 | emitEvent('onTestEvent'); | ||
6148 | } | 8308 | } |
6149 | |||
6150 | }; | 8309 | }; |
6151 | 8310 | ||
6152 | module.exports = ReactUpdateQueue; | 8311 | ReactDebugTool.addDevtool(ReactInvalidSetStateWarningDevTool); |
6153 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | 8312 | ReactDebugTool.addDevtool(ReactComponentTreeDevtool); |
8313 | ReactDebugTool.addDevtool(ReactChildrenMutationWarningDevtool); | ||
8314 | var url = ExecutionEnvironment.canUseDOM && window.location.href || ''; | ||
8315 | if (/[?&]react_perf\b/.test(url)) { | ||
8316 | ReactDebugTool.beginProfiling(); | ||
8317 | } | ||
8318 | |||
8319 | module.exports = ReactDebugTool; | ||
8320 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
6154 | 8321 | ||
6155 | /***/ }, | 8322 | /***/ }, |
6156 | /* 56 */ | 8323 | /* 67 */ |
6157 | /***/ function(module, exports, __webpack_require__) { | 8324 | /***/ function(module, exports, __webpack_require__) { |
6158 | 8325 | ||
6159 | /* WEBPACK VAR INJECTION */(function(process) {/** | 8326 | /* WEBPACK VAR INJECTION */(function(process) {/** |
6160 | * Copyright 2013-2015, Facebook, Inc. | 8327 | * Copyright 2016-present, Facebook, Inc. |
6161 | * All rights reserved. | 8328 | * All rights reserved. |
6162 | * | 8329 | * |
6163 | * This source code is licensed under the BSD-style license found in the | 8330 | * This source code is licensed under the BSD-style license found in the |
6164 | * LICENSE file in the root directory of this source tree. An additional grant | 8331 | * LICENSE file in the root directory of this source tree. An additional grant |
6165 | * of patent rights can be found in the PATENTS file in the same directory. | 8332 | * of patent rights can be found in the PATENTS file in the same directory. |
6166 | * | 8333 | * |
6167 | * @providesModule ReactUpdates | 8334 | * @providesModule ReactInvalidSetStateWarningDevTool |
6168 | */ | 8335 | */ |
6169 | 8336 | ||
6170 | 'use strict'; | 8337 | 'use strict'; |
6171 | 8338 | ||
6172 | var CallbackQueue = __webpack_require__(57); | 8339 | var warning = __webpack_require__(13); |
6173 | var PooledClass = __webpack_require__(58); | ||
6174 | var ReactPerf = __webpack_require__(20); | ||
6175 | var ReactReconciler = __webpack_require__(52); | ||
6176 | var Transaction = __webpack_require__(59); | ||
6177 | |||
6178 | var assign = __webpack_require__(41); | ||
6179 | var invariant = __webpack_require__(15); | ||
6180 | |||
6181 | var dirtyComponents = []; | ||
6182 | var asapCallbackQueue = CallbackQueue.getPooled(); | ||
6183 | var asapEnqueued = false; | ||
6184 | 8340 | ||
6185 | var batchingStrategy = null; | 8341 | if (process.env.NODE_ENV !== 'production') { |
8342 | var processingChildContext = false; | ||
6186 | 8343 | ||
6187 | function ensureInjected() { | 8344 | var warnInvalidSetState = function () { |
6188 | !(ReactUpdates.ReactReconcileTransaction && batchingStrategy) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must inject a reconcile transaction class and batching ' + 'strategy') : invariant(false) : undefined; | 8345 | process.env.NODE_ENV !== 'production' ? warning(!processingChildContext, 'setState(...): Cannot call setState() inside getChildContext()') : void 0; |
8346 | }; | ||
6189 | } | 8347 | } |
6190 | 8348 | ||
6191 | var NESTED_UPDATES = { | 8349 | var ReactInvalidSetStateWarningDevTool = { |
6192 | initialize: function () { | 8350 | onBeginProcessingChildContext: function () { |
6193 | this.dirtyComponentsLength = dirtyComponents.length; | 8351 | processingChildContext = true; |
6194 | }, | 8352 | }, |
6195 | close: function () { | 8353 | onEndProcessingChildContext: function () { |
6196 | if (this.dirtyComponentsLength !== dirtyComponents.length) { | 8354 | processingChildContext = false; |
6197 | // Additional updates were enqueued by componentDidUpdate handlers or | ||
6198 | // similar; before our own UPDATE_QUEUEING wrapper closes, we want to run | ||
6199 | // these new updates so that if A's componentDidUpdate calls setState on | ||
6200 | // B, B will update before the callback A's updater provided when calling | ||
6201 | // setState. | ||
6202 | dirtyComponents.splice(0, this.dirtyComponentsLength); | ||
6203 | flushBatchedUpdates(); | ||
6204 | } else { | ||
6205 | dirtyComponents.length = 0; | ||
6206 | } | ||
6207 | } | ||
6208 | }; | ||
6209 | |||
6210 | var UPDATE_QUEUEING = { | ||
6211 | initialize: function () { | ||
6212 | this.callbackQueue.reset(); | ||
6213 | }, | 8355 | }, |
6214 | close: function () { | 8356 | onSetState: function () { |
6215 | this.callbackQueue.notifyAll(); | 8357 | warnInvalidSetState(); |
6216 | } | 8358 | } |
6217 | }; | 8359 | }; |
6218 | 8360 | ||
6219 | var TRANSACTION_WRAPPERS = [NESTED_UPDATES, UPDATE_QUEUEING]; | 8361 | module.exports = ReactInvalidSetStateWarningDevTool; |
8362 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
8363 | |||
8364 | /***/ }, | ||
8365 | /* 68 */ | ||
8366 | /***/ function(module, exports) { | ||
8367 | |||
8368 | /** | ||
8369 | * Copyright 2016-present, Facebook, Inc. | ||
8370 | * All rights reserved. | ||
8371 | * | ||
8372 | * This source code is licensed under the BSD-style license found in the | ||
8373 | * LICENSE file in the root directory of this source tree. An additional grant | ||
8374 | * of patent rights can be found in the PATENTS file in the same directory. | ||
8375 | * | ||
8376 | * @providesModule ReactHostOperationHistoryDevtool | ||
8377 | */ | ||
6220 | 8378 | ||
6221 | function ReactUpdatesFlushTransaction() { | 8379 | 'use strict'; |
6222 | this.reinitializeTransaction(); | ||
6223 | this.dirtyComponentsLength = null; | ||
6224 | this.callbackQueue = CallbackQueue.getPooled(); | ||
6225 | this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled( /* forceHTML */false); | ||
6226 | } | ||
6227 | 8380 | ||
6228 | assign(ReactUpdatesFlushTransaction.prototype, Transaction.Mixin, { | 8381 | var history = []; |
6229 | getTransactionWrappers: function () { | ||
6230 | return TRANSACTION_WRAPPERS; | ||
6231 | }, | ||
6232 | 8382 | ||
6233 | destructor: function () { | 8383 | var ReactHostOperationHistoryDevtool = { |
6234 | this.dirtyComponentsLength = null; | 8384 | onHostOperation: function (debugID, type, payload) { |
6235 | CallbackQueue.release(this.callbackQueue); | 8385 | history.push({ |
6236 | this.callbackQueue = null; | 8386 | instanceID: debugID, |
6237 | ReactUpdates.ReactReconcileTransaction.release(this.reconcileTransaction); | 8387 | type: type, |
6238 | this.reconcileTransaction = null; | 8388 | payload: payload |
8389 | }); | ||
6239 | }, | 8390 | }, |
8391 | clearHistory: function () { | ||
8392 | if (ReactHostOperationHistoryDevtool._preventClearing) { | ||
8393 | // Should only be used for tests. | ||
8394 | return; | ||
8395 | } | ||
6240 | 8396 | ||
6241 | perform: function (method, scope, a) { | 8397 | history = []; |
6242 | // Essentially calls `this.reconcileTransaction.perform(method, scope, a)` | 8398 | }, |
6243 | // with this transaction's wrappers around it. | 8399 | getHistory: function () { |
6244 | return Transaction.Mixin.perform.call(this, this.reconcileTransaction.perform, this.reconcileTransaction, method, scope, a); | 8400 | return history; |
6245 | } | 8401 | } |
6246 | }); | 8402 | }; |
6247 | |||
6248 | PooledClass.addPoolingTo(ReactUpdatesFlushTransaction); | ||
6249 | |||
6250 | function batchedUpdates(callback, a, b, c, d, e) { | ||
6251 | ensureInjected(); | ||
6252 | batchingStrategy.batchedUpdates(callback, a, b, c, d, e); | ||
6253 | } | ||
6254 | 8403 | ||
6255 | /** | 8404 | module.exports = ReactHostOperationHistoryDevtool; |
6256 | * Array comparator for ReactComponents by mount ordering. | 8405 | |
8406 | /***/ }, | ||
8407 | /* 69 */ | ||
8408 | /***/ function(module, exports, __webpack_require__) { | ||
8409 | |||
8410 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
8411 | * Copyright 2013-present, Facebook, Inc. | ||
8412 | * All rights reserved. | ||
6257 | * | 8413 | * |
6258 | * @param {ReactComponent} c1 first component you're comparing | 8414 | * This source code is licensed under the BSD-style license found in the |
6259 | * @param {ReactComponent} c2 second component you're comparing | 8415 | * LICENSE file in the root directory of this source tree. An additional grant |
6260 | * @return {number} Return value usable by Array.prototype.sort(). | 8416 | * of patent rights can be found in the PATENTS file in the same directory. |
8417 | * | ||
8418 | * @providesModule ReactChildrenMutationWarningDevtool | ||
6261 | */ | 8419 | */ |
6262 | function mountOrderComparator(c1, c2) { | ||
6263 | return c1._mountOrder - c2._mountOrder; | ||
6264 | } | ||
6265 | 8420 | ||
6266 | function runBatchedUpdates(transaction) { | 8421 | 'use strict'; |
6267 | var len = transaction.dirtyComponentsLength; | ||
6268 | !(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) : invariant(false) : undefined; | ||
6269 | 8422 | ||
6270 | // Since reconciling a component higher in the owner hierarchy usually (not | 8423 | var ReactComponentTreeDevtool = __webpack_require__(31); |
6271 | // always -- see shouldComponentUpdate()) will reconcile children, reconcile | ||
6272 | // them before their children by sorting the array. | ||
6273 | dirtyComponents.sort(mountOrderComparator); | ||
6274 | 8424 | ||
6275 | for (var i = 0; i < len; i++) { | 8425 | var warning = __webpack_require__(13); |
6276 | // If a component is unmounted before pending changes apply, it will still | ||
6277 | // be here, but we assume that it has cleared its _pendingCallbacks and | ||
6278 | // that performUpdateIfNecessary is a noop. | ||
6279 | var component = dirtyComponents[i]; | ||
6280 | 8426 | ||
6281 | // If performUpdateIfNecessary happens to enqueue any new updates, we | 8427 | var elements = {}; |
6282 | // shouldn't execute the callbacks until the next render happens, so | ||
6283 | // stash the callbacks first | ||
6284 | var callbacks = component._pendingCallbacks; | ||
6285 | component._pendingCallbacks = null; | ||
6286 | |||
6287 | ReactReconciler.performUpdateIfNecessary(component, transaction.reconcileTransaction); | ||
6288 | 8428 | ||
6289 | if (callbacks) { | 8429 | function handleElement(debugID, element) { |
6290 | for (var j = 0; j < callbacks.length; j++) { | 8430 | if (element == null) { |
6291 | transaction.callbackQueue.enqueue(callbacks[j], component.getPublicInstance()); | 8431 | return; |
6292 | } | ||
6293 | } | ||
6294 | } | 8432 | } |
6295 | } | 8433 | if (element._shadowChildren === undefined) { |
6296 | 8434 | return; | |
6297 | var flushBatchedUpdates = function () { | ||
6298 | // ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents | ||
6299 | // array and perform any updates enqueued by mount-ready handlers (i.e., | ||
6300 | // componentDidUpdate) but we need to check here too in order to catch | ||
6301 | // updates enqueued by setState callbacks and asap calls. | ||
6302 | while (dirtyComponents.length || asapEnqueued) { | ||
6303 | if (dirtyComponents.length) { | ||
6304 | var transaction = ReactUpdatesFlushTransaction.getPooled(); | ||
6305 | transaction.perform(runBatchedUpdates, null, transaction); | ||
6306 | ReactUpdatesFlushTransaction.release(transaction); | ||
6307 | } | ||
6308 | |||
6309 | if (asapEnqueued) { | ||
6310 | asapEnqueued = false; | ||
6311 | var queue = asapCallbackQueue; | ||
6312 | asapCallbackQueue = CallbackQueue.getPooled(); | ||
6313 | queue.notifyAll(); | ||
6314 | CallbackQueue.release(queue); | ||
6315 | } | ||
6316 | } | 8435 | } |
6317 | }; | 8436 | if (element._shadowChildren === element.props.children) { |
6318 | flushBatchedUpdates = ReactPerf.measure('ReactUpdates', 'flushBatchedUpdates', flushBatchedUpdates); | ||
6319 | |||
6320 | /** | ||
6321 | * Mark a component as needing a rerender, adding an optional callback to a | ||
6322 | * list of functions which will be executed once the rerender occurs. | ||
6323 | */ | ||
6324 | function enqueueUpdate(component) { | ||
6325 | ensureInjected(); | ||
6326 | |||
6327 | // Various parts of our code (such as ReactCompositeComponent's | ||
6328 | // _renderValidatedComponent) assume that calls to render aren't nested; | ||
6329 | // verify that that's the case. (This is called by each top-level update | ||
6330 | // function, like setProps, setState, forceUpdate, etc.; creation and | ||
6331 | // destruction of top-level components is guarded in ReactMount.) | ||
6332 | |||
6333 | if (!batchingStrategy.isBatchingUpdates) { | ||
6334 | batchingStrategy.batchedUpdates(enqueueUpdate, component); | ||
6335 | return; | 8437 | return; |
6336 | } | 8438 | } |
6337 | 8439 | var isMutated = false; | |
6338 | dirtyComponents.push(component); | 8440 | if (Array.isArray(element._shadowChildren)) { |
6339 | } | 8441 | if (element._shadowChildren.length === element.props.children.length) { |
6340 | 8442 | for (var i = 0; i < element._shadowChildren.length; i++) { | |
6341 | /** | 8443 | if (element._shadowChildren[i] !== element.props.children[i]) { |
6342 | * Enqueue a callback to be run at the end of the current batching cycle. Throws | 8444 | isMutated = true; |
6343 | * if no updates are currently being performed. | 8445 | } |
6344 | */ | 8446 | } |
6345 | function asap(callback, context) { | 8447 | } else { |
6346 | !batchingStrategy.isBatchingUpdates ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context where' + 'updates are not being batched.') : invariant(false) : undefined; | 8448 | isMutated = true; |
6347 | asapCallbackQueue.enqueue(callback, context); | 8449 | } |
6348 | asapEnqueued = true; | 8450 | } |
8451 | process.env.NODE_ENV !== 'production' ? warning(Array.isArray(element._shadowChildren) && !isMutated, 'Component\'s children should not be mutated.%s', ReactComponentTreeDevtool.getStackAddendumByID(debugID)) : void 0; | ||
6349 | } | 8452 | } |
6350 | 8453 | ||
6351 | var ReactUpdatesInjection = { | 8454 | var ReactDOMUnknownPropertyDevtool = { |
6352 | injectReconcileTransaction: function (ReconcileTransaction) { | 8455 | onBeforeMountComponent: function (debugID, element) { |
6353 | !ReconcileTransaction ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a reconcile transaction class') : invariant(false) : undefined; | 8456 | elements[debugID] = element; |
6354 | ReactUpdates.ReactReconcileTransaction = ReconcileTransaction; | ||
6355 | }, | 8457 | }, |
6356 | 8458 | onBeforeUpdateComponent: function (debugID, element) { | |
6357 | injectBatchingStrategy: function (_batchingStrategy) { | 8459 | elements[debugID] = element; |
6358 | !_batchingStrategy ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batching strategy') : invariant(false) : undefined; | 8460 | }, |
6359 | !(typeof _batchingStrategy.batchedUpdates === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batchedUpdates() function') : invariant(false) : undefined; | 8461 | onComponentHasMounted: function (debugID) { |
6360 | !(typeof _batchingStrategy.isBatchingUpdates === 'boolean') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide an isBatchingUpdates boolean attribute') : invariant(false) : undefined; | 8462 | handleElement(debugID, elements[debugID]); |
6361 | batchingStrategy = _batchingStrategy; | 8463 | delete elements[debugID]; |
8464 | }, | ||
8465 | onComponentHasUpdated: function (debugID) { | ||
8466 | handleElement(debugID, elements[debugID]); | ||
8467 | delete elements[debugID]; | ||
6362 | } | 8468 | } |
6363 | }; | 8469 | }; |
6364 | 8470 | ||
6365 | var ReactUpdates = { | 8471 | module.exports = ReactDOMUnknownPropertyDevtool; |
6366 | /** | 8472 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) |
6367 | * React references `ReactReconcileTransaction` using this property in order | ||
6368 | * to allow dependency injection. | ||
6369 | * | ||
6370 | * @internal | ||
6371 | */ | ||
6372 | ReactReconcileTransaction: null, | ||
6373 | |||
6374 | batchedUpdates: batchedUpdates, | ||
6375 | enqueueUpdate: enqueueUpdate, | ||
6376 | flushBatchedUpdates: flushBatchedUpdates, | ||
6377 | injection: ReactUpdatesInjection, | ||
6378 | asap: asap | ||
6379 | }; | ||
6380 | |||
6381 | module.exports = ReactUpdates; | ||
6382 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
6383 | 8473 | ||
6384 | /***/ }, | 8474 | /***/ }, |
6385 | /* 57 */ | 8475 | /* 70 */ |
6386 | /***/ function(module, exports, __webpack_require__) { | 8476 | /***/ function(module, exports, __webpack_require__) { |
6387 | 8477 | ||
6388 | /* WEBPACK VAR INJECTION */(function(process) {/** | 8478 | 'use strict'; |
6389 | * Copyright 2013-2015, Facebook, Inc. | 8479 | |
8480 | /** | ||
8481 | * Copyright (c) 2013-present, Facebook, Inc. | ||
6390 | * All rights reserved. | 8482 | * All rights reserved. |
6391 | * | 8483 | * |
6392 | * This source code is licensed under the BSD-style license found in the | 8484 | * This source code is licensed under the BSD-style license found in the |
6393 | * LICENSE file in the root directory of this source tree. An additional grant | 8485 | * LICENSE file in the root directory of this source tree. An additional grant |
6394 | * of patent rights can be found in the PATENTS file in the same directory. | 8486 | * of patent rights can be found in the PATENTS file in the same directory. |
6395 | * | 8487 | * |
6396 | * @providesModule CallbackQueue | 8488 | * @typechecks |
6397 | */ | 8489 | */ |
6398 | 8490 | ||
6399 | 'use strict'; | 8491 | var performance = __webpack_require__(71); |
6400 | |||
6401 | var PooledClass = __webpack_require__(58); | ||
6402 | 8492 | ||
6403 | var assign = __webpack_require__(41); | 8493 | var performanceNow; |
6404 | var invariant = __webpack_require__(15); | ||
6405 | 8494 | ||
6406 | /** | 8495 | /** |
6407 | * A specialized pseudo-event module to help keep track of components waiting to | 8496 | * Detect if we can use `window.performance.now()` and gracefully fallback to |
6408 | * be notified when their DOM representations are available for use. | 8497 | * `Date.now()` if it doesn't exist. We need to support Firefox < 15 for now |
6409 | * | 8498 | * because of Facebook's testing infrastructure. |
6410 | * This implements `PooledClass`, so you should never need to instantiate this. | ||
6411 | * Instead, use `CallbackQueue.getPooled()`. | ||
6412 | * | ||
6413 | * @class ReactMountReady | ||
6414 | * @implements PooledClass | ||
6415 | * @internal | ||
6416 | */ | 8499 | */ |
6417 | function CallbackQueue() { | 8500 | if (performance.now) { |
6418 | this._callbacks = null; | 8501 | performanceNow = function performanceNow() { |
6419 | this._contexts = null; | 8502 | return performance.now(); |
8503 | }; | ||
8504 | } else { | ||
8505 | performanceNow = function performanceNow() { | ||
8506 | return Date.now(); | ||
8507 | }; | ||
6420 | } | 8508 | } |
6421 | 8509 | ||
6422 | assign(CallbackQueue.prototype, { | 8510 | module.exports = performanceNow; |
6423 | |||
6424 | /** | ||
6425 | * Enqueues a callback to be invoked when `notifyAll` is invoked. | ||
6426 | * | ||
6427 | * @param {function} callback Invoked when `notifyAll` is invoked. | ||
6428 | * @param {?object} context Context to call `callback` with. | ||
6429 | * @internal | ||
6430 | */ | ||
6431 | enqueue: function (callback, context) { | ||
6432 | this._callbacks = this._callbacks || []; | ||
6433 | this._contexts = this._contexts || []; | ||
6434 | this._callbacks.push(callback); | ||
6435 | this._contexts.push(context); | ||
6436 | }, | ||
6437 | |||
6438 | /** | ||
6439 | * Invokes all enqueued callbacks and clears the queue. This is invoked after | ||
6440 | * the DOM representation of a component has been created or updated. | ||
6441 | * | ||
6442 | * @internal | ||
6443 | */ | ||
6444 | notifyAll: function () { | ||
6445 | var callbacks = this._callbacks; | ||
6446 | var contexts = this._contexts; | ||
6447 | if (callbacks) { | ||
6448 | !(callbacks.length === contexts.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Mismatched list of contexts in callback queue') : invariant(false) : undefined; | ||
6449 | this._callbacks = null; | ||
6450 | this._contexts = null; | ||
6451 | for (var i = 0; i < callbacks.length; i++) { | ||
6452 | callbacks[i].call(contexts[i]); | ||
6453 | } | ||
6454 | callbacks.length = 0; | ||
6455 | contexts.length = 0; | ||
6456 | } | ||
6457 | }, | ||
6458 | |||
6459 | /** | ||
6460 | * Resets the internal queue. | ||
6461 | * | ||
6462 | * @internal | ||
6463 | */ | ||
6464 | reset: function () { | ||
6465 | this._callbacks = null; | ||
6466 | this._contexts = null; | ||
6467 | }, | ||
6468 | |||
6469 | /** | ||
6470 | * `PooledClass` looks for this. | ||
6471 | */ | ||
6472 | destructor: function () { | ||
6473 | this.reset(); | ||
6474 | } | ||
6475 | |||
6476 | }); | ||
6477 | |||
6478 | PooledClass.addPoolingTo(CallbackQueue); | ||
6479 | |||
6480 | module.exports = CallbackQueue; | ||
6481 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
6482 | 8511 | ||
6483 | /***/ }, | 8512 | /***/ }, |
6484 | /* 58 */ | 8513 | /* 71 */ |
6485 | /***/ function(module, exports, __webpack_require__) { | 8514 | /***/ function(module, exports, __webpack_require__) { |
6486 | 8515 | ||
6487 | /* WEBPACK VAR INJECTION */(function(process) {/** | 8516 | /** |
6488 | * Copyright 2013-2015, Facebook, Inc. | 8517 | * Copyright (c) 2013-present, Facebook, Inc. |
6489 | * All rights reserved. | 8518 | * All rights reserved. |
6490 | * | 8519 | * |
6491 | * This source code is licensed under the BSD-style license found in the | 8520 | * This source code is licensed under the BSD-style license found in the |
6492 | * LICENSE file in the root directory of this source tree. An additional grant | 8521 | * LICENSE file in the root directory of this source tree. An additional grant |
6493 | * of patent rights can be found in the PATENTS file in the same directory. | 8522 | * of patent rights can be found in the PATENTS file in the same directory. |
6494 | * | 8523 | * |
6495 | * @providesModule PooledClass | 8524 | * @typechecks |
6496 | */ | 8525 | */ |
6497 | 8526 | ||
6498 | 'use strict'; | 8527 | 'use strict'; |
6499 | 8528 | ||
6500 | var invariant = __webpack_require__(15); | 8529 | var ExecutionEnvironment = __webpack_require__(52); |
6501 | |||
6502 | /** | ||
6503 | * Static poolers. Several custom versions for each potential number of | ||
6504 | * arguments. A completely generic pooler is easy to implement, but would | ||
6505 | * require accessing the `arguments` object. In each of these, `this` refers to | ||
6506 | * the Class itself, not an instance. If any others are needed, simply add them | ||
6507 | * here, or in their own files. | ||
6508 | */ | ||
6509 | var oneArgumentPooler = function (copyFieldsFrom) { | ||
6510 | var Klass = this; | ||
6511 | if (Klass.instancePool.length) { | ||
6512 | var instance = Klass.instancePool.pop(); | ||
6513 | Klass.call(instance, copyFieldsFrom); | ||
6514 | return instance; | ||
6515 | } else { | ||
6516 | return new Klass(copyFieldsFrom); | ||
6517 | } | ||
6518 | }; | ||
6519 | |||
6520 | var twoArgumentPooler = function (a1, a2) { | ||
6521 | var Klass = this; | ||
6522 | if (Klass.instancePool.length) { | ||
6523 | var instance = Klass.instancePool.pop(); | ||
6524 | Klass.call(instance, a1, a2); | ||
6525 | return instance; | ||
6526 | } else { | ||
6527 | return new Klass(a1, a2); | ||
6528 | } | ||
6529 | }; | ||
6530 | 8530 | ||
6531 | var threeArgumentPooler = function (a1, a2, a3) { | 8531 | var performance; |
6532 | var Klass = this; | ||
6533 | if (Klass.instancePool.length) { | ||
6534 | var instance = Klass.instancePool.pop(); | ||
6535 | Klass.call(instance, a1, a2, a3); | ||
6536 | return instance; | ||
6537 | } else { | ||
6538 | return new Klass(a1, a2, a3); | ||
6539 | } | ||
6540 | }; | ||
6541 | |||
6542 | var fourArgumentPooler = function (a1, a2, a3, a4) { | ||
6543 | var Klass = this; | ||
6544 | if (Klass.instancePool.length) { | ||
6545 | var instance = Klass.instancePool.pop(); | ||
6546 | Klass.call(instance, a1, a2, a3, a4); | ||
6547 | return instance; | ||
6548 | } else { | ||
6549 | return new Klass(a1, a2, a3, a4); | ||
6550 | } | ||
6551 | }; | ||
6552 | |||
6553 | var fiveArgumentPooler = function (a1, a2, a3, a4, a5) { | ||
6554 | var Klass = this; | ||
6555 | if (Klass.instancePool.length) { | ||
6556 | var instance = Klass.instancePool.pop(); | ||
6557 | Klass.call(instance, a1, a2, a3, a4, a5); | ||
6558 | return instance; | ||
6559 | } else { | ||
6560 | return new Klass(a1, a2, a3, a4, a5); | ||
6561 | } | ||
6562 | }; | ||
6563 | |||
6564 | var standardReleaser = function (instance) { | ||
6565 | var Klass = this; | ||
6566 | !(instance instanceof Klass) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Trying to release an instance into a pool of a different type.') : invariant(false) : undefined; | ||
6567 | instance.destructor(); | ||
6568 | if (Klass.instancePool.length < Klass.poolSize) { | ||
6569 | Klass.instancePool.push(instance); | ||
6570 | } | ||
6571 | }; | ||
6572 | |||
6573 | var DEFAULT_POOL_SIZE = 10; | ||
6574 | var DEFAULT_POOLER = oneArgumentPooler; | ||
6575 | |||
6576 | /** | ||
6577 | * Augments `CopyConstructor` to be a poolable class, augmenting only the class | ||
6578 | * itself (statically) not adding any prototypical fields. Any CopyConstructor | ||
6579 | * you give this may have a `poolSize` property, and will look for a | ||
6580 | * prototypical `destructor` on instances (optional). | ||
6581 | * | ||
6582 | * @param {Function} CopyConstructor Constructor that can be used to reset. | ||
6583 | * @param {Function} pooler Customizable pooler. | ||
6584 | */ | ||
6585 | var addPoolingTo = function (CopyConstructor, pooler) { | ||
6586 | var NewKlass = CopyConstructor; | ||
6587 | NewKlass.instancePool = []; | ||
6588 | NewKlass.getPooled = pooler || DEFAULT_POOLER; | ||
6589 | if (!NewKlass.poolSize) { | ||
6590 | NewKlass.poolSize = DEFAULT_POOL_SIZE; | ||
6591 | } | ||
6592 | NewKlass.release = standardReleaser; | ||
6593 | return NewKlass; | ||
6594 | }; | ||
6595 | 8532 | ||
6596 | var PooledClass = { | 8533 | if (ExecutionEnvironment.canUseDOM) { |
6597 | addPoolingTo: addPoolingTo, | 8534 | performance = window.performance || window.msPerformance || window.webkitPerformance; |
6598 | oneArgumentPooler: oneArgumentPooler, | 8535 | } |
6599 | twoArgumentPooler: twoArgumentPooler, | ||
6600 | threeArgumentPooler: threeArgumentPooler, | ||
6601 | fourArgumentPooler: fourArgumentPooler, | ||
6602 | fiveArgumentPooler: fiveArgumentPooler | ||
6603 | }; | ||
6604 | 8536 | ||
6605 | module.exports = PooledClass; | 8537 | module.exports = performance || {}; |
6606 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
6607 | 8538 | ||
6608 | /***/ }, | 8539 | /***/ }, |
6609 | /* 59 */ | 8540 | /* 72 */ |
6610 | /***/ function(module, exports, __webpack_require__) { | 8541 | /***/ function(module, exports, __webpack_require__) { |
6611 | 8542 | ||
6612 | /* WEBPACK VAR INJECTION */(function(process) {/** | 8543 | /* WEBPACK VAR INJECTION */(function(process) {/** |
6613 | * Copyright 2013-2015, Facebook, Inc. | 8544 | * Copyright 2013-present, Facebook, Inc. |
6614 | * All rights reserved. | 8545 | * All rights reserved. |
6615 | * | 8546 | * |
6616 | * This source code is licensed under the BSD-style license found in the | 8547 | * This source code is licensed under the BSD-style license found in the |
@@ -6622,7 +8553,9 @@ | |||
6622 | 8553 | ||
6623 | 'use strict'; | 8554 | 'use strict'; |
6624 | 8555 | ||
6625 | var invariant = __webpack_require__(15); | 8556 | var _prodInvariant = __webpack_require__(9); |
8557 | |||
8558 | var invariant = __webpack_require__(10); | ||
6626 | 8559 | ||
6627 | /** | 8560 | /** |
6628 | * `Transaction` creates a black box that is able to wrap any method such that | 8561 | * `Transaction` creates a black box that is able to wrap any method such that |
@@ -6733,7 +8666,7 @@ | |||
6733 | * @return {*} Return value from `method`. | 8666 | * @return {*} Return value from `method`. |
6734 | */ | 8667 | */ |
6735 | perform: function (method, scope, a, b, c, d, e, f) { | 8668 | perform: function (method, scope, a, b, c, d, e, f) { |
6736 | !!this.isInTransaction() ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Transaction.perform(...): Cannot initialize a transaction when there ' + 'is already an outstanding transaction.') : invariant(false) : undefined; | 8669 | !!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; |
6737 | var errorThrown; | 8670 | var errorThrown; |
6738 | var ret; | 8671 | var ret; |
6739 | try { | 8672 | try { |
@@ -6797,7 +8730,7 @@ | |||
6797 | * invoked). | 8730 | * invoked). |
6798 | */ | 8731 | */ |
6799 | closeAll: function (startIndex) { | 8732 | closeAll: function (startIndex) { |
6800 | !this.isInTransaction() ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Transaction.closeAll(): Cannot close transaction when none are open.') : invariant(false) : undefined; | 8733 | !this.isInTransaction() ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Transaction.closeAll(): Cannot close transaction when none are open.') : _prodInvariant('28') : void 0; |
6801 | var transactionWrappers = this.transactionWrappers; | 8734 | var transactionWrappers = this.transactionWrappers; |
6802 | for (var i = startIndex; i < transactionWrappers.length; i++) { | 8735 | for (var i = startIndex; i < transactionWrappers.length; i++) { |
6803 | var wrapper = transactionWrappers[i]; | 8736 | var wrapper = transactionWrappers[i]; |
@@ -6840,3955 +8773,1915 @@ | |||
6840 | }; | 8773 | }; |
6841 | 8774 | ||
6842 | module.exports = Transaction; | 8775 | module.exports = Transaction; |
6843 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | 8776 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) |
6844 | |||
6845 | /***/ }, | ||
6846 | /* 60 */ | ||
6847 | /***/ function(module, exports, __webpack_require__) { | ||
6848 | |||
6849 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
6850 | * Copyright 2013-2015, Facebook, Inc. | ||
6851 | * All rights reserved. | ||
6852 | * | ||
6853 | * This source code is licensed under the BSD-style license found in the | ||
6854 | * LICENSE file in the root directory of this source tree. An additional grant | ||
6855 | * of patent rights can be found in the PATENTS file in the same directory. | ||
6856 | * | ||
6857 | * @providesModule emptyObject | ||
6858 | */ | ||
6859 | |||
6860 | 'use strict'; | ||
6861 | |||
6862 | var emptyObject = {}; | ||
6863 | |||
6864 | if (process.env.NODE_ENV !== 'production') { | ||
6865 | Object.freeze(emptyObject); | ||
6866 | } | ||
6867 | |||
6868 | module.exports = emptyObject; | ||
6869 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
6870 | 8777 | ||
6871 | /***/ }, | 8778 | /***/ }, |
6872 | /* 61 */ | 8779 | /* 73 */ |
6873 | /***/ function(module, exports, __webpack_require__) { | 8780 | /***/ function(module, exports) { |
6874 | 8781 | ||
6875 | /** | 8782 | /** |
6876 | * Copyright 2013-2015, Facebook, Inc. | 8783 | * Copyright 2013-present, Facebook, Inc. |
6877 | * All rights reserved. | 8784 | * All rights reserved. |
6878 | * | 8785 | * |
6879 | * This source code is licensed under the BSD-style license found in the | 8786 | * This source code is licensed under the BSD-style license found in the |
6880 | * LICENSE file in the root directory of this source tree. An additional grant | 8787 | * LICENSE file in the root directory of this source tree. An additional grant |
6881 | * of patent rights can be found in the PATENTS file in the same directory. | 8788 | * of patent rights can be found in the PATENTS file in the same directory. |
6882 | * | 8789 | * |
6883 | * @providesModule containsNode | 8790 | * @providesModule getEventTarget |
6884 | * @typechecks | ||
6885 | */ | 8791 | */ |
6886 | 8792 | ||
6887 | 'use strict'; | 8793 | 'use strict'; |
6888 | 8794 | ||
6889 | var isTextNode = __webpack_require__(62); | ||
6890 | |||
6891 | /*eslint-disable no-bitwise */ | ||
6892 | |||
6893 | /** | 8795 | /** |
6894 | * Checks if a given DOM node contains or is another DOM node. | 8796 | * Gets the target node from a native browser event by accounting for |
8797 | * inconsistencies in browser DOM APIs. | ||
6895 | * | 8798 | * |
6896 | * @param {?DOMNode} outerNode Outer DOM node. | 8799 | * @param {object} nativeEvent Native browser event. |
6897 | * @param {?DOMNode} innerNode Inner DOM node. | 8800 | * @return {DOMEventTarget} Target node. |
6898 | * @return {boolean} True if `outerNode` contains or is `innerNode`. | ||
6899 | */ | 8801 | */ |
6900 | function containsNode(_x, _x2) { | ||
6901 | var _again = true; | ||
6902 | 8802 | ||
6903 | _function: while (_again) { | 8803 | function getEventTarget(nativeEvent) { |
6904 | var outerNode = _x, | 8804 | var target = nativeEvent.target || nativeEvent.srcElement || window; |
6905 | innerNode = _x2; | ||
6906 | _again = false; | ||
6907 | 8805 | ||
6908 | if (!outerNode || !innerNode) { | 8806 | // Normalize SVG <use> element events #4963 |
6909 | return false; | 8807 | if (target.correspondingUseElement) { |
6910 | } else if (outerNode === innerNode) { | 8808 | target = target.correspondingUseElement; |
6911 | return true; | ||
6912 | } else if (isTextNode(outerNode)) { | ||
6913 | return false; | ||
6914 | } else if (isTextNode(innerNode)) { | ||
6915 | _x = outerNode; | ||
6916 | _x2 = innerNode.parentNode; | ||
6917 | _again = true; | ||
6918 | continue _function; | ||
6919 | } else if (outerNode.contains) { | ||
6920 | return outerNode.contains(innerNode); | ||
6921 | } else if (outerNode.compareDocumentPosition) { | ||
6922 | return !!(outerNode.compareDocumentPosition(innerNode) & 16); | ||
6923 | } else { | ||
6924 | return false; | ||
6925 | } | ||
6926 | } | 8809 | } |
8810 | |||
8811 | // Safari may fire events on text nodes (Node.TEXT_NODE is 3). | ||
8812 | // @see http://www.quirksmode.org/js/events_properties.html | ||
8813 | return target.nodeType === 3 ? target.parentNode : target; | ||
6927 | } | 8814 | } |
6928 | 8815 | ||
6929 | module.exports = containsNode; | 8816 | module.exports = getEventTarget; |
6930 | 8817 | ||
6931 | /***/ }, | 8818 | /***/ }, |
6932 | /* 62 */ | 8819 | /* 74 */ |
6933 | /***/ function(module, exports, __webpack_require__) { | 8820 | /***/ function(module, exports, __webpack_require__) { |
6934 | 8821 | ||
6935 | /** | 8822 | /** |
6936 | * Copyright 2013-2015, Facebook, Inc. | 8823 | * Copyright 2013-present, Facebook, Inc. |
6937 | * All rights reserved. | 8824 | * All rights reserved. |
6938 | * | 8825 | * |
6939 | * This source code is licensed under the BSD-style license found in the | 8826 | * This source code is licensed under the BSD-style license found in the |
6940 | * LICENSE file in the root directory of this source tree. An additional grant | 8827 | * LICENSE file in the root directory of this source tree. An additional grant |
6941 | * of patent rights can be found in the PATENTS file in the same directory. | 8828 | * of patent rights can be found in the PATENTS file in the same directory. |
6942 | * | 8829 | * |
6943 | * @providesModule isTextNode | 8830 | * @providesModule isEventSupported |
6944 | * @typechecks | ||
6945 | */ | 8831 | */ |
6946 | 8832 | ||
6947 | 'use strict'; | 8833 | 'use strict'; |
6948 | 8834 | ||
6949 | var isNode = __webpack_require__(63); | 8835 | var ExecutionEnvironment = __webpack_require__(52); |
6950 | 8836 | ||
6951 | /** | 8837 | var useHasFeature; |
6952 | * @param {*} object The object to check. | 8838 | if (ExecutionEnvironment.canUseDOM) { |
6953 | * @return {boolean} Whether or not the object is a DOM text node. | 8839 | useHasFeature = document.implementation && document.implementation.hasFeature && |
6954 | */ | 8840 | // always returns true in newer browsers as per the standard. |
6955 | function isTextNode(object) { | 8841 | // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature |
6956 | return isNode(object) && object.nodeType == 3; | 8842 | document.implementation.hasFeature('', '') !== true; |
6957 | } | 8843 | } |
6958 | 8844 | ||
6959 | module.exports = isTextNode; | ||
6960 | |||
6961 | /***/ }, | ||
6962 | /* 63 */ | ||
6963 | /***/ function(module, exports) { | ||
6964 | |||
6965 | /** | 8845 | /** |
6966 | * Copyright 2013-2015, Facebook, Inc. | 8846 | * Checks if an event is supported in the current execution environment. |
6967 | * All rights reserved. | ||
6968 | * | 8847 | * |
6969 | * This source code is licensed under the BSD-style license found in the | 8848 | * NOTE: This will not work correctly for non-generic events such as `change`, |
6970 | * LICENSE file in the root directory of this source tree. An additional grant | 8849 | * `reset`, `load`, `error`, and `select`. |
6971 | * of patent rights can be found in the PATENTS file in the same directory. | ||
6972 | * | 8850 | * |
6973 | * @providesModule isNode | 8851 | * Borrows from Modernizr. |
6974 | * @typechecks | 8852 | * |
8853 | * @param {string} eventNameSuffix Event name, e.g. "click". | ||
8854 | * @param {?boolean} capture Check if the capture phase is supported. | ||
8855 | * @return {boolean} True if the event is supported. | ||
8856 | * @internal | ||
8857 | * @license Modernizr 3.0.0pre (Custom Build) | MIT | ||
6975 | */ | 8858 | */ |
8859 | function isEventSupported(eventNameSuffix, capture) { | ||
8860 | if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) { | ||
8861 | return false; | ||
8862 | } | ||
6976 | 8863 | ||
6977 | /** | 8864 | var eventName = 'on' + eventNameSuffix; |
6978 | * @param {*} object The object to check. | 8865 | var isSupported = eventName in document; |
6979 | * @return {boolean} Whether or not the object is a DOM node. | ||
6980 | */ | ||
6981 | 'use strict'; | ||
6982 | 8866 | ||
6983 | function isNode(object) { | 8867 | if (!isSupported) { |
6984 | return !!(object && (typeof Node === 'function' ? object instanceof Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string')); | 8868 | var element = document.createElement('div'); |
8869 | element.setAttribute(eventName, 'return;'); | ||
8870 | isSupported = typeof element[eventName] === 'function'; | ||
8871 | } | ||
8872 | |||
8873 | if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') { | ||
8874 | // This is the only way to test support for the `wheel` event in IE9+. | ||
8875 | isSupported = document.implementation.hasFeature('Events.wheel', '3.0'); | ||
8876 | } | ||
8877 | |||
8878 | return isSupported; | ||
6985 | } | 8879 | } |
6986 | 8880 | ||
6987 | module.exports = isNode; | 8881 | module.exports = isEventSupported; |
6988 | 8882 | ||
6989 | /***/ }, | 8883 | /***/ }, |
6990 | /* 64 */ | 8884 | /* 75 */ |
6991 | /***/ function(module, exports, __webpack_require__) { | 8885 | /***/ function(module, exports) { |
6992 | 8886 | ||
6993 | /* WEBPACK VAR INJECTION */(function(process) {/** | 8887 | /** |
6994 | * Copyright 2013-2015, Facebook, Inc. | 8888 | * Copyright 2013-present, Facebook, Inc. |
6995 | * All rights reserved. | 8889 | * All rights reserved. |
6996 | * | 8890 | * |
6997 | * This source code is licensed under the BSD-style license found in the | 8891 | * This source code is licensed under the BSD-style license found in the |
6998 | * LICENSE file in the root directory of this source tree. An additional grant | 8892 | * LICENSE file in the root directory of this source tree. An additional grant |
6999 | * of patent rights can be found in the PATENTS file in the same directory. | 8893 | * of patent rights can be found in the PATENTS file in the same directory. |
7000 | * | 8894 | * |
7001 | * @providesModule instantiateReactComponent | 8895 | * @providesModule isTextInputElement |
7002 | * @typechecks static-only | 8896 | * |
7003 | */ | 8897 | */ |
7004 | 8898 | ||
7005 | 'use strict'; | 8899 | 'use strict'; |
7006 | 8900 | ||
7007 | var ReactCompositeComponent = __webpack_require__(65); | ||
7008 | var ReactEmptyComponent = __webpack_require__(70); | ||
7009 | var ReactNativeComponent = __webpack_require__(71); | ||
7010 | |||
7011 | var assign = __webpack_require__(41); | ||
7012 | var invariant = __webpack_require__(15); | ||
7013 | var warning = __webpack_require__(27); | ||
7014 | |||
7015 | // To avoid a cyclic dependency, we create the final class in this module | ||
7016 | var ReactCompositeComponentWrapper = function () {}; | ||
7017 | assign(ReactCompositeComponentWrapper.prototype, ReactCompositeComponent.Mixin, { | ||
7018 | _instantiateReactComponent: instantiateReactComponent | ||
7019 | }); | ||
7020 | |||
7021 | function getDeclarationErrorAddendum(owner) { | ||
7022 | if (owner) { | ||
7023 | var name = owner.getName(); | ||
7024 | if (name) { | ||
7025 | return ' Check the render method of `' + name + '`.'; | ||
7026 | } | ||
7027 | } | ||
7028 | return ''; | ||
7029 | } | ||
7030 | |||
7031 | /** | 8901 | /** |
7032 | * Check if the type reference is a known internal type. I.e. not a user | 8902 | * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary |
7033 | * provided composite type. | ||
7034 | * | ||
7035 | * @param {function} type | ||
7036 | * @return {boolean} Returns true if this is a valid internal type. | ||
7037 | */ | ||
7038 | function isInternalComponentType(type) { | ||
7039 | return typeof type === 'function' && typeof type.prototype !== 'undefined' && typeof type.prototype.mountComponent === 'function' && typeof type.prototype.receiveComponent === 'function'; | ||
7040 | } | ||
7041 | |||
7042 | /** | ||
7043 | * Given a ReactNode, create an instance that will actually be mounted. | ||
7044 | * | ||
7045 | * @param {ReactNode} node | ||
7046 | * @return {object} A new instance of the element's constructor. | ||
7047 | * @protected | ||
7048 | */ | 8903 | */ |
7049 | function instantiateReactComponent(node) { | ||
7050 | var instance; | ||
7051 | |||
7052 | if (node === null || node === false) { | ||
7053 | instance = new ReactEmptyComponent(instantiateReactComponent); | ||
7054 | } else if (typeof node === 'object') { | ||
7055 | var element = node; | ||
7056 | !(element && (typeof element.type === 'function' || typeof element.type === 'string')) ? 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', element.type == null ? element.type : typeof element.type, getDeclarationErrorAddendum(element._owner)) : invariant(false) : undefined; | ||
7057 | 8904 | ||
7058 | // Special case string values | 8905 | var supportedInputTypes = { |
7059 | if (typeof element.type === 'string') { | 8906 | 'color': true, |
7060 | instance = ReactNativeComponent.createInternalComponent(element); | 8907 | 'date': true, |
7061 | } else if (isInternalComponentType(element.type)) { | 8908 | 'datetime': true, |
7062 | // This is temporarily available for custom components that are not string | 8909 | 'datetime-local': true, |
7063 | // representations. I.e. ART. Once those are updated to use the string | 8910 | 'email': true, |
7064 | // representation, we can drop this code path. | 8911 | 'month': true, |
7065 | instance = new element.type(element); | 8912 | 'number': true, |
7066 | } else { | 8913 | 'password': true, |
7067 | instance = new ReactCompositeComponentWrapper(); | 8914 | 'range': true, |
7068 | } | 8915 | 'search': true, |
7069 | } else if (typeof node === 'string' || typeof node === 'number') { | 8916 | 'tel': true, |
7070 | instance = ReactNativeComponent.createInstanceForText(node); | 8917 | 'text': true, |
7071 | } else { | 8918 | 'time': true, |
7072 | true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Encountered invalid React node of type %s', typeof node) : invariant(false) : undefined; | 8919 | 'url': true, |
7073 | } | 8920 | 'week': true |
7074 | 8921 | }; | |
7075 | if (process.env.NODE_ENV !== 'production') { | ||
7076 | process.env.NODE_ENV !== 'production' ? warning(typeof instance.construct === 'function' && typeof instance.mountComponent === 'function' && typeof instance.receiveComponent === 'function' && typeof instance.unmountComponent === 'function', 'Only React Components can be mounted.') : undefined; | ||
7077 | } | ||
7078 | |||
7079 | // Sets up the instance. This can probably just move into the constructor now. | ||
7080 | instance.construct(node); | ||
7081 | 8922 | ||
7082 | // These two fields are used by the DOM and ART diffing algorithms | 8923 | function isTextInputElement(elem) { |
7083 | // respectively. Instead of using expandos on components, we should be | 8924 | var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase(); |
7084 | // storing the state needed by the diffing algorithms elsewhere. | ||
7085 | instance._mountIndex = 0; | ||
7086 | instance._mountImage = null; | ||
7087 | 8925 | ||
7088 | if (process.env.NODE_ENV !== 'production') { | 8926 | if (nodeName === 'input') { |
7089 | instance._isOwnerNecessary = false; | 8927 | return !!supportedInputTypes[elem.type]; |
7090 | instance._warnedAboutRefsInRender = false; | ||
7091 | } | 8928 | } |
7092 | 8929 | ||
7093 | // Internal instances should fully constructed at this point, so they should | 8930 | if (nodeName === 'textarea') { |
7094 | // not get any new fields added to them at this point. | 8931 | return true; |
7095 | if (process.env.NODE_ENV !== 'production') { | ||
7096 | if (Object.preventExtensions) { | ||
7097 | Object.preventExtensions(instance); | ||
7098 | } | ||
7099 | } | 8932 | } |
7100 | 8933 | ||
7101 | return instance; | 8934 | return false; |
7102 | } | 8935 | } |
7103 | 8936 | ||
7104 | module.exports = instantiateReactComponent; | 8937 | module.exports = isTextInputElement; |
7105 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
7106 | 8938 | ||
7107 | /***/ }, | 8939 | /***/ }, |
7108 | /* 65 */ | 8940 | /* 76 */ |
7109 | /***/ function(module, exports, __webpack_require__) { | 8941 | /***/ function(module, exports, __webpack_require__) { |
7110 | 8942 | ||
7111 | /* WEBPACK VAR INJECTION */(function(process) {/** | 8943 | /** |
7112 | * Copyright 2013-2015, Facebook, Inc. | 8944 | * Copyright 2013-present, Facebook, Inc. |
7113 | * All rights reserved. | 8945 | * All rights reserved. |
7114 | * | 8946 | * |
7115 | * This source code is licensed under the BSD-style license found in the | 8947 | * This source code is licensed under the BSD-style license found in the |
7116 | * LICENSE file in the root directory of this source tree. An additional grant | 8948 | * LICENSE file in the root directory of this source tree. An additional grant |
7117 | * of patent rights can be found in the PATENTS file in the same directory. | 8949 | * of patent rights can be found in the PATENTS file in the same directory. |
7118 | * | 8950 | * |
7119 | * @providesModule ReactCompositeComponent | 8951 | * @providesModule DefaultEventPluginOrder |
7120 | */ | 8952 | */ |
7121 | 8953 | ||
7122 | 'use strict'; | 8954 | 'use strict'; |
7123 | 8955 | ||
7124 | var ReactComponentEnvironment = __webpack_require__(66); | 8956 | var keyOf = __webpack_require__(27); |
7125 | var ReactCurrentOwner = __webpack_require__(7); | ||
7126 | var ReactElement = __webpack_require__(44); | ||
7127 | var ReactInstanceMap = __webpack_require__(49); | ||
7128 | var ReactPerf = __webpack_require__(20); | ||
7129 | var ReactPropTypeLocations = __webpack_require__(67); | ||
7130 | var ReactPropTypeLocationNames = __webpack_require__(68); | ||
7131 | var ReactReconciler = __webpack_require__(52); | ||
7132 | var ReactUpdateQueue = __webpack_require__(55); | ||
7133 | |||
7134 | var assign = __webpack_require__(41); | ||
7135 | var emptyObject = __webpack_require__(60); | ||
7136 | var invariant = __webpack_require__(15); | ||
7137 | var shouldUpdateReactComponent = __webpack_require__(69); | ||
7138 | var warning = __webpack_require__(27); | ||
7139 | |||
7140 | function getDeclarationErrorAddendum(component) { | ||
7141 | var owner = component._currentElement._owner || null; | ||
7142 | if (owner) { | ||
7143 | var name = owner.getName(); | ||
7144 | if (name) { | ||
7145 | return ' Check the render method of `' + name + '`.'; | ||
7146 | } | ||
7147 | } | ||
7148 | return ''; | ||
7149 | } | ||
7150 | |||
7151 | function StatelessComponent(Component) {} | ||
7152 | StatelessComponent.prototype.render = function () { | ||
7153 | var Component = ReactInstanceMap.get(this)._currentElement.type; | ||
7154 | return Component(this.props, this.context, this.updater); | ||
7155 | }; | ||
7156 | 8957 | ||
7157 | /** | 8958 | /** |
7158 | * ------------------ The Life-Cycle of a Composite Component ------------------ | 8959 | * Module that is injectable into `EventPluginHub`, that specifies a |
7159 | * | 8960 | * deterministic ordering of `EventPlugin`s. A convenient way to reason about |
7160 | * - constructor: Initialization of state. The instance is now retained. | 8961 | * plugins, without having to package every one of them. This is better than |
7161 | * - componentWillMount | 8962 | * having plugins be ordered in the same order that they are injected because |
7162 | * - render | 8963 | * that ordering would be influenced by the packaging order. |
7163 | * - [children's constructors] | 8964 | * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that |
7164 | * - [children's componentWillMount and render] | 8965 | * preventing default on events is convenient in `SimpleEventPlugin` handlers. |
7165 | * - [children's componentDidMount] | ||
7166 | * - componentDidMount | ||
7167 | * | ||
7168 | * Update Phases: | ||
7169 | * - componentWillReceiveProps (only called if parent updated) | ||
7170 | * - shouldComponentUpdate | ||
7171 | * - componentWillUpdate | ||
7172 | * - render | ||
7173 | * - [children's constructors or receive props phases] | ||
7174 | * - componentDidUpdate | ||
7175 | * | ||
7176 | * - componentWillUnmount | ||
7177 | * - [children's componentWillUnmount] | ||
7178 | * - [children destroyed] | ||
7179 | * - (destroyed): The instance is now blank, released by React and ready for GC. | ||
7180 | * | ||
7181 | * ----------------------------------------------------------------------------- | ||
7182 | */ | 8966 | */ |
8967 | var DefaultEventPluginOrder = [keyOf({ ResponderEventPlugin: null }), keyOf({ SimpleEventPlugin: null }), keyOf({ TapEventPlugin: null }), keyOf({ EnterLeaveEventPlugin: null }), keyOf({ ChangeEventPlugin: null }), keyOf({ SelectEventPlugin: null }), keyOf({ BeforeInputEventPlugin: null })]; | ||
7183 | 8968 | ||
8969 | module.exports = DefaultEventPluginOrder; | ||
8970 | |||
8971 | /***/ }, | ||
8972 | /* 77 */ | ||
8973 | /***/ function(module, exports, __webpack_require__) { | ||
8974 | |||
7184 | /** | 8975 | /** |
7185 | * An incrementing ID assigned to each component when it is mounted. This is | 8976 | * Copyright 2013-present, Facebook, Inc. |
7186 | * used to enforce the order in which `ReactUpdates` updates dirty components. | 8977 | * All rights reserved. |
7187 | * | 8978 | * |
7188 | * @private | 8979 | * This source code is licensed under the BSD-style license found in the |
7189 | */ | 8980 | * LICENSE file in the root directory of this source tree. An additional grant |
7190 | var nextMountID = 1; | 8981 | * of patent rights can be found in the PATENTS file in the same directory. |
7191 | 8982 | * | |
7192 | /** | 8983 | * @providesModule EnterLeaveEventPlugin |
7193 | * @lends {ReactCompositeComponent.prototype} | ||
7194 | */ | 8984 | */ |
7195 | var ReactCompositeComponentMixin = { | ||
7196 | |||
7197 | /** | ||
7198 | * Base constructor for all composite component. | ||
7199 | * | ||
7200 | * @param {ReactElement} element | ||
7201 | * @final | ||
7202 | * @internal | ||
7203 | */ | ||
7204 | construct: function (element) { | ||
7205 | this._currentElement = element; | ||
7206 | this._rootNodeID = null; | ||
7207 | this._instance = null; | ||
7208 | |||
7209 | // See ReactUpdateQueue | ||
7210 | this._pendingElement = null; | ||
7211 | this._pendingStateQueue = null; | ||
7212 | this._pendingReplaceState = false; | ||
7213 | this._pendingForceUpdate = false; | ||
7214 | |||
7215 | this._renderedComponent = null; | ||
7216 | |||
7217 | this._context = null; | ||
7218 | this._mountOrder = 0; | ||
7219 | this._topLevelWrapper = null; | ||
7220 | |||
7221 | // See ReactUpdates and ReactUpdateQueue. | ||
7222 | this._pendingCallbacks = null; | ||
7223 | }, | ||
7224 | |||
7225 | /** | ||
7226 | * Initializes the component, renders markup, and registers event listeners. | ||
7227 | * | ||
7228 | * @param {string} rootID DOM ID of the root node. | ||
7229 | * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction | ||
7230 | * @return {?string} Rendered markup to be inserted into the DOM. | ||
7231 | * @final | ||
7232 | * @internal | ||
7233 | */ | ||
7234 | mountComponent: function (rootID, transaction, context) { | ||
7235 | this._context = context; | ||
7236 | this._mountOrder = nextMountID++; | ||
7237 | this._rootNodeID = rootID; | ||
7238 | |||
7239 | var publicProps = this._processProps(this._currentElement.props); | ||
7240 | var publicContext = this._processContext(context); | ||
7241 | |||
7242 | var Component = this._currentElement.type; | ||
7243 | |||
7244 | // Initialize the public class | ||
7245 | var inst; | ||
7246 | var renderedElement; | ||
7247 | |||
7248 | // This is a way to detect if Component is a stateless arrow function | ||
7249 | // component, which is not newable. It might not be 100% reliable but is | ||
7250 | // something we can do until we start detecting that Component extends | ||
7251 | // React.Component. We already assume that typeof Component === 'function'. | ||
7252 | var canInstantiate = ('prototype' in Component); | ||
7253 | |||
7254 | if (canInstantiate) { | ||
7255 | if (process.env.NODE_ENV !== 'production') { | ||
7256 | ReactCurrentOwner.current = this; | ||
7257 | try { | ||
7258 | inst = new Component(publicProps, publicContext, ReactUpdateQueue); | ||
7259 | } finally { | ||
7260 | ReactCurrentOwner.current = null; | ||
7261 | } | ||
7262 | } else { | ||
7263 | inst = new Component(publicProps, publicContext, ReactUpdateQueue); | ||
7264 | } | ||
7265 | } | ||
7266 | |||
7267 | if (!canInstantiate || inst === null || inst === false || ReactElement.isValidElement(inst)) { | ||
7268 | renderedElement = inst; | ||
7269 | inst = new StatelessComponent(Component); | ||
7270 | } | ||
7271 | |||
7272 | if (process.env.NODE_ENV !== 'production') { | ||
7273 | // This will throw later in _renderValidatedComponent, but add an early | ||
7274 | // warning now to help debugging | ||
7275 | if (inst.render == null) { | ||
7276 | process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`, returned ' + 'null/false from a stateless component, or tried to render an ' + 'element whose type is a function that isn\'t a React component.', Component.displayName || Component.name || 'Component') : undefined; | ||
7277 | } else { | ||
7278 | // We support ES6 inheriting from React.Component, the module pattern, | ||
7279 | // and stateless components, but not ES6 classes that don't extend | ||
7280 | process.env.NODE_ENV !== 'production' ? warning(Component.prototype && Component.prototype.isReactComponent || !canInstantiate || !(inst instanceof Component), '%s(...): React component classes must extend React.Component.', Component.displayName || Component.name || 'Component') : undefined; | ||
7281 | } | ||
7282 | } | ||
7283 | |||
7284 | // These should be set up in the constructor, but as a convenience for | ||
7285 | // simpler class abstractions, we set them up after the fact. | ||
7286 | inst.props = publicProps; | ||
7287 | inst.context = publicContext; | ||
7288 | inst.refs = emptyObject; | ||
7289 | inst.updater = ReactUpdateQueue; | ||
7290 | |||
7291 | this._instance = inst; | ||
7292 | |||
7293 | // Store a reference from the instance back to the internal representation | ||
7294 | ReactInstanceMap.set(inst, this); | ||
7295 | |||
7296 | if (process.env.NODE_ENV !== 'production') { | ||
7297 | // Since plain JS classes are defined without any special initialization | ||
7298 | // logic, we can not catch common errors early. Therefore, we have to | ||
7299 | // catch them here, at initialization time, instead. | ||
7300 | process.env.NODE_ENV !== 'production' ? warning(!inst.getInitialState || inst.getInitialState.isReactClassApproved, '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') : undefined; | ||
7301 | 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') : undefined; | ||
7302 | 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') : undefined; | ||
7303 | 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') : undefined; | ||
7304 | 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') : undefined; | ||
7305 | 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') : undefined; | ||
7306 | process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentWillRecieveProps !== 'function', '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', this.getName() || 'A component') : undefined; | ||
7307 | } | ||
7308 | |||
7309 | var initialState = inst.state; | ||
7310 | if (initialState === undefined) { | ||
7311 | inst.state = initialState = null; | ||
7312 | } | ||
7313 | !(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') : invariant(false) : undefined; | ||
7314 | |||
7315 | this._pendingStateQueue = null; | ||
7316 | this._pendingReplaceState = false; | ||
7317 | this._pendingForceUpdate = false; | ||
7318 | |||
7319 | if (inst.componentWillMount) { | ||
7320 | inst.componentWillMount(); | ||
7321 | // When mounting, calls to `setState` by `componentWillMount` will set | ||
7322 | // `this._pendingStateQueue` without triggering a re-render. | ||
7323 | if (this._pendingStateQueue) { | ||
7324 | inst.state = this._processPendingState(inst.props, inst.context); | ||
7325 | } | ||
7326 | } | ||
7327 | |||
7328 | // If not a stateless component, we now render | ||
7329 | if (renderedElement === undefined) { | ||
7330 | renderedElement = this._renderValidatedComponent(); | ||
7331 | } | ||
7332 | |||
7333 | this._renderedComponent = this._instantiateReactComponent(renderedElement); | ||
7334 | |||
7335 | var markup = ReactReconciler.mountComponent(this._renderedComponent, rootID, transaction, this._processChildContext(context)); | ||
7336 | if (inst.componentDidMount) { | ||
7337 | transaction.getReactMountReady().enqueue(inst.componentDidMount, inst); | ||
7338 | } | ||
7339 | |||
7340 | return markup; | ||
7341 | }, | ||
7342 | 8985 | ||
7343 | /** | 8986 | 'use strict'; |
7344 | * Releases any resources allocated by `mountComponent`. | ||
7345 | * | ||
7346 | * @final | ||
7347 | * @internal | ||
7348 | */ | ||
7349 | unmountComponent: function () { | ||
7350 | var inst = this._instance; | ||
7351 | |||
7352 | if (inst.componentWillUnmount) { | ||
7353 | inst.componentWillUnmount(); | ||
7354 | } | ||
7355 | |||
7356 | ReactReconciler.unmountComponent(this._renderedComponent); | ||
7357 | this._renderedComponent = null; | ||
7358 | this._instance = null; | ||
7359 | |||
7360 | // Reset pending fields | ||
7361 | // Even if this component is scheduled for another update in ReactUpdates, | ||
7362 | // it would still be ignored because these fields are reset. | ||
7363 | this._pendingStateQueue = null; | ||
7364 | this._pendingReplaceState = false; | ||
7365 | this._pendingForceUpdate = false; | ||
7366 | this._pendingCallbacks = null; | ||
7367 | this._pendingElement = null; | ||
7368 | |||
7369 | // These fields do not really need to be reset since this object is no | ||
7370 | // longer accessible. | ||
7371 | this._context = null; | ||
7372 | this._rootNodeID = null; | ||
7373 | this._topLevelWrapper = null; | ||
7374 | |||
7375 | // Delete the reference from the instance to this internal representation | ||
7376 | // which allow the internals to be properly cleaned up even if the user | ||
7377 | // leaks a reference to the public instance. | ||
7378 | ReactInstanceMap.remove(inst); | ||
7379 | |||
7380 | // Some existing components rely on inst.props even after they've been | ||
7381 | // destroyed (in event handlers). | ||
7382 | // TODO: inst.props = null; | ||
7383 | // TODO: inst.state = null; | ||
7384 | // TODO: inst.context = null; | ||
7385 | }, | ||
7386 | |||
7387 | /** | ||
7388 | * Filters the context object to only contain keys specified in | ||
7389 | * `contextTypes` | ||
7390 | * | ||
7391 | * @param {object} context | ||
7392 | * @return {?object} | ||
7393 | * @private | ||
7394 | */ | ||
7395 | _maskContext: function (context) { | ||
7396 | var maskedContext = null; | ||
7397 | var Component = this._currentElement.type; | ||
7398 | var contextTypes = Component.contextTypes; | ||
7399 | if (!contextTypes) { | ||
7400 | return emptyObject; | ||
7401 | } | ||
7402 | maskedContext = {}; | ||
7403 | for (var contextName in contextTypes) { | ||
7404 | maskedContext[contextName] = context[contextName]; | ||
7405 | } | ||
7406 | return maskedContext; | ||
7407 | }, | ||
7408 | 8987 | ||
7409 | /** | 8988 | var EventConstants = __webpack_require__(44); |
7410 | * Filters the context object to only contain keys specified in | 8989 | var EventPropagators = __webpack_require__(45); |
7411 | * `contextTypes`, and asserts that they are valid. | 8990 | var ReactDOMComponentTree = __webpack_require__(39); |
7412 | * | 8991 | var SyntheticMouseEvent = __webpack_require__(78); |
7413 | * @param {object} context | ||
7414 | * @return {?object} | ||
7415 | * @private | ||
7416 | */ | ||
7417 | _processContext: function (context) { | ||
7418 | var maskedContext = this._maskContext(context); | ||
7419 | if (process.env.NODE_ENV !== 'production') { | ||
7420 | var Component = this._currentElement.type; | ||
7421 | if (Component.contextTypes) { | ||
7422 | this._checkPropTypes(Component.contextTypes, maskedContext, ReactPropTypeLocations.context); | ||
7423 | } | ||
7424 | } | ||
7425 | return maskedContext; | ||
7426 | }, | ||
7427 | 8992 | ||
7428 | /** | 8993 | var keyOf = __webpack_require__(27); |
7429 | * @param {object} currentContext | ||
7430 | * @return {object} | ||
7431 | * @private | ||
7432 | */ | ||
7433 | _processChildContext: function (currentContext) { | ||
7434 | var Component = this._currentElement.type; | ||
7435 | var inst = this._instance; | ||
7436 | var childContext = inst.getChildContext && inst.getChildContext(); | ||
7437 | if (childContext) { | ||
7438 | !(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') : invariant(false) : undefined; | ||
7439 | if (process.env.NODE_ENV !== 'production') { | ||
7440 | this._checkPropTypes(Component.childContextTypes, childContext, ReactPropTypeLocations.childContext); | ||
7441 | } | ||
7442 | for (var name in childContext) { | ||
7443 | !(name in Component.childContextTypes) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', this.getName() || 'ReactCompositeComponent', name) : invariant(false) : undefined; | ||
7444 | } | ||
7445 | return assign({}, currentContext, childContext); | ||
7446 | } | ||
7447 | return currentContext; | ||
7448 | }, | ||
7449 | 8994 | ||
7450 | /** | 8995 | var topLevelTypes = EventConstants.topLevelTypes; |
7451 | * Processes props by setting default values for unspecified props and | ||
7452 | * asserting that the props are valid. Does not mutate its argument; returns | ||
7453 | * a new props object with defaults merged in. | ||
7454 | * | ||
7455 | * @param {object} newProps | ||
7456 | * @return {object} | ||
7457 | * @private | ||
7458 | */ | ||
7459 | _processProps: function (newProps) { | ||
7460 | if (process.env.NODE_ENV !== 'production') { | ||
7461 | var Component = this._currentElement.type; | ||
7462 | if (Component.propTypes) { | ||
7463 | this._checkPropTypes(Component.propTypes, newProps, ReactPropTypeLocations.prop); | ||
7464 | } | ||
7465 | } | ||
7466 | return newProps; | ||
7467 | }, | ||
7468 | 8996 | ||
7469 | /** | 8997 | var eventTypes = { |
7470 | * Assert that the props are valid | 8998 | mouseEnter: { |
7471 | * | 8999 | registrationName: keyOf({ onMouseEnter: null }), |
7472 | * @param {object} propTypes Map of prop name to a ReactPropType | 9000 | dependencies: [topLevelTypes.topMouseOut, topLevelTypes.topMouseOver] |
7473 | * @param {object} props | ||
7474 | * @param {string} location e.g. "prop", "context", "child context" | ||
7475 | * @private | ||
7476 | */ | ||
7477 | _checkPropTypes: function (propTypes, props, location) { | ||
7478 | // TODO: Stop validating prop types here and only use the element | ||
7479 | // validation. | ||
7480 | var componentName = this.getName(); | ||
7481 | for (var propName in propTypes) { | ||
7482 | if (propTypes.hasOwnProperty(propName)) { | ||
7483 | var error; | ||
7484 | try { | ||
7485 | // This is intentionally an invariant that gets caught. It's the same | ||
7486 | // behavior as without this statement except with a better message. | ||
7487 | !(typeof propTypes[propName] === '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], propName) : invariant(false) : undefined; | ||
7488 | error = propTypes[propName](props, propName, componentName, location); | ||
7489 | } catch (ex) { | ||
7490 | error = ex; | ||
7491 | } | ||
7492 | if (error instanceof Error) { | ||
7493 | // We may want to extend this logic for similar errors in | ||
7494 | // top-level render calls, so I'm abstracting it away into | ||
7495 | // a function to minimize refactoring in the future | ||
7496 | var addendum = getDeclarationErrorAddendum(this); | ||
7497 | |||
7498 | if (location === ReactPropTypeLocations.prop) { | ||
7499 | // Preface gives us something to blacklist in warning module | ||
7500 | process.env.NODE_ENV !== 'production' ? warning(false, 'Failed Composite propType: %s%s', error.message, addendum) : undefined; | ||
7501 | } else { | ||
7502 | process.env.NODE_ENV !== 'production' ? warning(false, 'Failed Context Types: %s%s', error.message, addendum) : undefined; | ||
7503 | } | ||
7504 | } | ||
7505 | } | ||
7506 | } | ||
7507 | }, | 9001 | }, |
9002 | mouseLeave: { | ||
9003 | registrationName: keyOf({ onMouseLeave: null }), | ||
9004 | dependencies: [topLevelTypes.topMouseOut, topLevelTypes.topMouseOver] | ||
9005 | } | ||
9006 | }; | ||
7508 | 9007 | ||
7509 | receiveComponent: function (nextElement, transaction, nextContext) { | 9008 | var EnterLeaveEventPlugin = { |
7510 | var prevElement = this._currentElement; | ||
7511 | var prevContext = this._context; | ||
7512 | |||
7513 | this._pendingElement = null; | ||
7514 | 9009 | ||
7515 | this.updateComponent(transaction, prevElement, nextElement, prevContext, nextContext); | 9010 | eventTypes: eventTypes, |
7516 | }, | ||
7517 | 9011 | ||
7518 | /** | 9012 | /** |
7519 | * If any of `_pendingElement`, `_pendingStateQueue`, or `_pendingForceUpdate` | 9013 | * For almost every interaction we care about, there will be both a top-level |
7520 | * is set, update the component. | 9014 | * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that |
7521 | * | 9015 | * we do not extract duplicate events. However, moving the mouse into the |
7522 | * @param {ReactReconcileTransaction} transaction | 9016 | * browser from outside will not fire a `mouseout` event. In this case, we use |
7523 | * @internal | 9017 | * the `mouseover` top-level event. |
7524 | */ | 9018 | */ |
7525 | performUpdateIfNecessary: function (transaction) { | 9019 | extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { |
7526 | if (this._pendingElement != null) { | 9020 | if (topLevelType === topLevelTypes.topMouseOver && (nativeEvent.relatedTarget || nativeEvent.fromElement)) { |
7527 | ReactReconciler.receiveComponent(this, this._pendingElement || this._currentElement, transaction, this._context); | 9021 | return null; |
7528 | } | 9022 | } |
7529 | 9023 | if (topLevelType !== topLevelTypes.topMouseOut && topLevelType !== topLevelTypes.topMouseOver) { | |
7530 | if (this._pendingStateQueue !== null || this._pendingForceUpdate) { | 9024 | // Must not be a mouse in or mouse out - ignoring. |
7531 | this.updateComponent(transaction, this._currentElement, this._currentElement, this._context, this._context); | 9025 | return null; |
7532 | } | 9026 | } |
7533 | }, | ||
7534 | |||
7535 | /** | ||
7536 | * Perform an update to a mounted component. The componentWillReceiveProps and | ||
7537 | * shouldComponentUpdate methods are called, then (assuming the update isn't | ||
7538 | * skipped) the remaining update lifecycle methods are called and the DOM | ||
7539 | * representation is updated. | ||
7540 | * | ||
7541 | * By default, this implements React's rendering and reconciliation algorithm. | ||
7542 | * Sophisticated clients may wish to override this. | ||
7543 | * | ||
7544 | * @param {ReactReconcileTransaction} transaction | ||
7545 | * @param {ReactElement} prevParentElement | ||
7546 | * @param {ReactElement} nextParentElement | ||
7547 | * @internal | ||
7548 | * @overridable | ||
7549 | */ | ||
7550 | updateComponent: function (transaction, prevParentElement, nextParentElement, prevUnmaskedContext, nextUnmaskedContext) { | ||
7551 | var inst = this._instance; | ||
7552 | 9027 | ||
7553 | var nextContext = this._context === nextUnmaskedContext ? inst.context : this._processContext(nextUnmaskedContext); | 9028 | var win; |
7554 | var nextProps; | 9029 | if (nativeEventTarget.window === nativeEventTarget) { |
7555 | 9030 | // `nativeEventTarget` is probably a window object. | |
7556 | // Distinguish between a props update versus a simple state update | 9031 | win = nativeEventTarget; |
7557 | if (prevParentElement === nextParentElement) { | ||
7558 | // Skip checking prop types again -- we don't read inst.props to avoid | ||
7559 | // warning for DOM component props in this upgrade | ||
7560 | nextProps = nextParentElement.props; | ||
7561 | } else { | 9032 | } else { |
7562 | nextProps = this._processProps(nextParentElement.props); | 9033 | // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8. |
7563 | // An update here will schedule an update but immediately set | 9034 | var doc = nativeEventTarget.ownerDocument; |
7564 | // _pendingStateQueue which will ensure that any state updates gets | 9035 | if (doc) { |
7565 | // immediately reconciled instead of waiting for the next batch. | 9036 | win = doc.defaultView || doc.parentWindow; |
7566 | 9037 | } else { | |
7567 | if (inst.componentWillReceiveProps) { | 9038 | win = window; |
7568 | inst.componentWillReceiveProps(nextProps, nextContext); | ||
7569 | } | 9039 | } |
7570 | } | 9040 | } |
7571 | 9041 | ||
7572 | var nextState = this._processPendingState(nextProps, nextContext); | 9042 | var from; |
7573 | 9043 | var to; | |
7574 | var shouldUpdate = this._pendingForceUpdate || !inst.shouldComponentUpdate || inst.shouldComponentUpdate(nextProps, nextState, nextContext); | 9044 | if (topLevelType === topLevelTypes.topMouseOut) { |
7575 | 9045 | from = targetInst; | |
7576 | if (process.env.NODE_ENV !== 'production') { | 9046 | var related = nativeEvent.relatedTarget || nativeEvent.toElement; |
7577 | process.env.NODE_ENV !== 'production' ? warning(typeof shouldUpdate !== 'undefined', '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', this.getName() || 'ReactCompositeComponent') : undefined; | 9047 | to = related ? ReactDOMComponentTree.getClosestInstanceFromNode(related) : null; |
7578 | } | ||
7579 | |||
7580 | if (shouldUpdate) { | ||
7581 | this._pendingForceUpdate = false; | ||
7582 | // Will set `this.props`, `this.state` and `this.context`. | ||
7583 | this._performComponentUpdate(nextParentElement, nextProps, nextState, nextContext, transaction, nextUnmaskedContext); | ||
7584 | } else { | ||
7585 | // If it's determined that a component should not update, we still want | ||
7586 | // to set props and state but we shortcut the rest of the update. | ||
7587 | this._currentElement = nextParentElement; | ||
7588 | this._context = nextUnmaskedContext; | ||
7589 | inst.props = nextProps; | ||
7590 | inst.state = nextState; | ||
7591 | inst.context = nextContext; | ||
7592 | } | ||
7593 | }, | ||
7594 | |||
7595 | _processPendingState: function (props, context) { | ||
7596 | var inst = this._instance; | ||
7597 | var queue = this._pendingStateQueue; | ||
7598 | var replace = this._pendingReplaceState; | ||
7599 | this._pendingReplaceState = false; | ||
7600 | this._pendingStateQueue = null; | ||
7601 | |||
7602 | if (!queue) { | ||
7603 | return inst.state; | ||
7604 | } | ||
7605 | |||
7606 | if (replace && queue.length === 1) { | ||
7607 | return queue[0]; | ||
7608 | } | ||
7609 | |||
7610 | var nextState = assign({}, replace ? queue[0] : inst.state); | ||
7611 | for (var i = replace ? 1 : 0; i < queue.length; i++) { | ||
7612 | var partial = queue[i]; | ||
7613 | assign(nextState, typeof partial === 'function' ? partial.call(inst, nextState, props, context) : partial); | ||
7614 | } | ||
7615 | |||
7616 | return nextState; | ||
7617 | }, | ||
7618 | |||
7619 | /** | ||
7620 | * Merges new props and state, notifies delegate methods of update and | ||
7621 | * performs update. | ||
7622 | * | ||
7623 | * @param {ReactElement} nextElement Next element | ||
7624 | * @param {object} nextProps Next public object to set as properties. | ||
7625 | * @param {?object} nextState Next object to set as state. | ||
7626 | * @param {?object} nextContext Next public object to set as context. | ||
7627 | * @param {ReactReconcileTransaction} transaction | ||
7628 | * @param {?object} unmaskedContext | ||
7629 | * @private | ||
7630 | */ | ||
7631 | _performComponentUpdate: function (nextElement, nextProps, nextState, nextContext, transaction, unmaskedContext) { | ||
7632 | var inst = this._instance; | ||
7633 | |||
7634 | var hasComponentDidUpdate = Boolean(inst.componentDidUpdate); | ||
7635 | var prevProps; | ||
7636 | var prevState; | ||
7637 | var prevContext; | ||
7638 | if (hasComponentDidUpdate) { | ||
7639 | prevProps = inst.props; | ||
7640 | prevState = inst.state; | ||
7641 | prevContext = inst.context; | ||
7642 | } | ||
7643 | |||
7644 | if (inst.componentWillUpdate) { | ||
7645 | inst.componentWillUpdate(nextProps, nextState, nextContext); | ||
7646 | } | ||
7647 | |||
7648 | this._currentElement = nextElement; | ||
7649 | this._context = unmaskedContext; | ||
7650 | inst.props = nextProps; | ||
7651 | inst.state = nextState; | ||
7652 | inst.context = nextContext; | ||
7653 | |||
7654 | this._updateRenderedComponent(transaction, unmaskedContext); | ||
7655 | |||
7656 | if (hasComponentDidUpdate) { | ||
7657 | transaction.getReactMountReady().enqueue(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), inst); | ||
7658 | } | ||
7659 | }, | ||
7660 | |||
7661 | /** | ||
7662 | * Call the component's `render` method and update the DOM accordingly. | ||
7663 | * | ||
7664 | * @param {ReactReconcileTransaction} transaction | ||
7665 | * @internal | ||
7666 | */ | ||
7667 | _updateRenderedComponent: function (transaction, context) { | ||
7668 | var prevComponentInstance = this._renderedComponent; | ||
7669 | var prevRenderedElement = prevComponentInstance._currentElement; | ||
7670 | var nextRenderedElement = this._renderValidatedComponent(); | ||
7671 | if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) { | ||
7672 | ReactReconciler.receiveComponent(prevComponentInstance, nextRenderedElement, transaction, this._processChildContext(context)); | ||
7673 | } else { | 9048 | } else { |
7674 | // These two IDs are actually the same! But nothing should rely on that. | 9049 | // Moving to a node from outside the window. |
7675 | var thisID = this._rootNodeID; | 9050 | from = null; |
7676 | var prevComponentID = prevComponentInstance._rootNodeID; | 9051 | to = targetInst; |
7677 | ReactReconciler.unmountComponent(prevComponentInstance); | ||
7678 | |||
7679 | this._renderedComponent = this._instantiateReactComponent(nextRenderedElement); | ||
7680 | var nextMarkup = ReactReconciler.mountComponent(this._renderedComponent, thisID, transaction, this._processChildContext(context)); | ||
7681 | this._replaceNodeWithMarkupByID(prevComponentID, nextMarkup); | ||
7682 | } | ||
7683 | }, | ||
7684 | |||
7685 | /** | ||
7686 | * @protected | ||
7687 | */ | ||
7688 | _replaceNodeWithMarkupByID: function (prevComponentID, nextMarkup) { | ||
7689 | ReactComponentEnvironment.replaceNodeWithMarkupByID(prevComponentID, nextMarkup); | ||
7690 | }, | ||
7691 | |||
7692 | /** | ||
7693 | * @protected | ||
7694 | */ | ||
7695 | _renderValidatedComponentWithoutOwnerOrContext: function () { | ||
7696 | var inst = this._instance; | ||
7697 | var renderedComponent = inst.render(); | ||
7698 | if (process.env.NODE_ENV !== 'production') { | ||
7699 | // We allow auto-mocks to proceed as if they're returning null. | ||
7700 | if (typeof renderedComponent === 'undefined' && inst.render._isMockFunction) { | ||
7701 | // This is probably bad practice. Consider warning here and | ||
7702 | // deprecating this convenience. | ||
7703 | renderedComponent = null; | ||
7704 | } | ||
7705 | } | 9052 | } |
7706 | 9053 | ||
7707 | return renderedComponent; | 9054 | if (from === to) { |
7708 | }, | 9055 | // Nothing pertains to our managed components. |
7709 | |||
7710 | /** | ||
7711 | * @private | ||
7712 | */ | ||
7713 | _renderValidatedComponent: function () { | ||
7714 | var renderedComponent; | ||
7715 | ReactCurrentOwner.current = this; | ||
7716 | try { | ||
7717 | renderedComponent = this._renderValidatedComponentWithoutOwnerOrContext(); | ||
7718 | } finally { | ||
7719 | ReactCurrentOwner.current = null; | ||
7720 | } | ||
7721 | !( | ||
7722 | // TODO: An `isValidNode` function would probably be more appropriate | ||
7723 | renderedComponent === null || renderedComponent === false || ReactElement.isValidElement(renderedComponent)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.render(): A valid ReactComponent must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined; | ||
7724 | return renderedComponent; | ||
7725 | }, | ||
7726 | |||
7727 | /** | ||
7728 | * Lazily allocates the refs object and stores `component` as `ref`. | ||
7729 | * | ||
7730 | * @param {string} ref Reference name. | ||
7731 | * @param {component} component Component to store as `ref`. | ||
7732 | * @final | ||
7733 | * @private | ||
7734 | */ | ||
7735 | attachRef: function (ref, component) { | ||
7736 | var inst = this.getPublicInstance(); | ||
7737 | !(inst != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Stateless function components cannot have refs.') : invariant(false) : undefined; | ||
7738 | var publicComponentInstance = component.getPublicInstance(); | ||
7739 | if (process.env.NODE_ENV !== 'production') { | ||
7740 | var componentName = component && component.getName ? component.getName() : 'a component'; | ||
7741 | process.env.NODE_ENV !== 'production' ? warning(publicComponentInstance != null, '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()) : undefined; | ||
7742 | } | ||
7743 | var refs = inst.refs === emptyObject ? inst.refs = {} : inst.refs; | ||
7744 | refs[ref] = publicComponentInstance; | ||
7745 | }, | ||
7746 | |||
7747 | /** | ||
7748 | * Detaches a reference name. | ||
7749 | * | ||
7750 | * @param {string} ref Name to dereference. | ||
7751 | * @final | ||
7752 | * @private | ||
7753 | */ | ||
7754 | detachRef: function (ref) { | ||
7755 | var refs = this.getPublicInstance().refs; | ||
7756 | delete refs[ref]; | ||
7757 | }, | ||
7758 | |||
7759 | /** | ||
7760 | * Get a text description of the component that can be used to identify it | ||
7761 | * in error messages. | ||
7762 | * @return {string} The name or null. | ||
7763 | * @internal | ||
7764 | */ | ||
7765 | getName: function () { | ||
7766 | var type = this._currentElement.type; | ||
7767 | var constructor = this._instance && this._instance.constructor; | ||
7768 | return type.displayName || constructor && constructor.displayName || type.name || constructor && constructor.name || null; | ||
7769 | }, | ||
7770 | |||
7771 | /** | ||
7772 | * Get the publicly accessible representation of this component - i.e. what | ||
7773 | * is exposed by refs and returned by render. Can be null for stateless | ||
7774 | * components. | ||
7775 | * | ||
7776 | * @return {ReactComponent} the public component instance. | ||
7777 | * @internal | ||
7778 | */ | ||
7779 | getPublicInstance: function () { | ||
7780 | var inst = this._instance; | ||
7781 | if (inst instanceof StatelessComponent) { | ||
7782 | return null; | 9056 | return null; |
7783 | } | 9057 | } |
7784 | return inst; | ||
7785 | }, | ||
7786 | 9058 | ||
7787 | // Stub | 9059 | var fromNode = from == null ? win : ReactDOMComponentTree.getNodeFromInstance(from); |
7788 | _instantiateReactComponent: null | 9060 | var toNode = to == null ? win : ReactDOMComponentTree.getNodeFromInstance(to); |
7789 | 9061 | ||
7790 | }; | 9062 | var leave = SyntheticMouseEvent.getPooled(eventTypes.mouseLeave, from, nativeEvent, nativeEventTarget); |
9063 | leave.type = 'mouseleave'; | ||
9064 | leave.target = fromNode; | ||
9065 | leave.relatedTarget = toNode; | ||
7791 | 9066 | ||
7792 | ReactPerf.measureMethods(ReactCompositeComponentMixin, 'ReactCompositeComponent', { | 9067 | var enter = SyntheticMouseEvent.getPooled(eventTypes.mouseEnter, to, nativeEvent, nativeEventTarget); |
7793 | mountComponent: 'mountComponent', | 9068 | enter.type = 'mouseenter'; |
7794 | updateComponent: 'updateComponent', | 9069 | enter.target = toNode; |
7795 | _renderValidatedComponent: '_renderValidatedComponent' | 9070 | enter.relatedTarget = fromNode; |
7796 | }); | ||
7797 | 9071 | ||
7798 | var ReactCompositeComponent = { | 9072 | EventPropagators.accumulateEnterLeaveDispatches(leave, enter, from, to); |
7799 | 9073 | ||
7800 | Mixin: ReactCompositeComponentMixin | 9074 | return [leave, enter]; |
9075 | } | ||
7801 | 9076 | ||
7802 | }; | 9077 | }; |
7803 | 9078 | ||
7804 | module.exports = ReactCompositeComponent; | 9079 | module.exports = EnterLeaveEventPlugin; |
7805 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
7806 | 9080 | ||
7807 | /***/ }, | 9081 | /***/ }, |
7808 | /* 66 */ | 9082 | /* 78 */ |
7809 | /***/ function(module, exports, __webpack_require__) { | 9083 | /***/ function(module, exports, __webpack_require__) { |
7810 | 9084 | ||
7811 | /* WEBPACK VAR INJECTION */(function(process) {/** | 9085 | /** |
7812 | * Copyright 2014-2015, Facebook, Inc. | 9086 | * Copyright 2013-present, Facebook, Inc. |
7813 | * All rights reserved. | 9087 | * All rights reserved. |
7814 | * | 9088 | * |
7815 | * This source code is licensed under the BSD-style license found in the | 9089 | * This source code is licensed under the BSD-style license found in the |
7816 | * LICENSE file in the root directory of this source tree. An additional grant | 9090 | * LICENSE file in the root directory of this source tree. An additional grant |
7817 | * of patent rights can be found in the PATENTS file in the same directory. | 9091 | * of patent rights can be found in the PATENTS file in the same directory. |
7818 | * | 9092 | * |
7819 | * @providesModule ReactComponentEnvironment | 9093 | * @providesModule SyntheticMouseEvent |
7820 | */ | 9094 | */ |
7821 | 9095 | ||
7822 | 'use strict'; | 9096 | 'use strict'; |
7823 | 9097 | ||
7824 | var invariant = __webpack_require__(15); | 9098 | var SyntheticUIEvent = __webpack_require__(79); |
7825 | 9099 | var ViewportMetrics = __webpack_require__(80); | |
7826 | var injected = false; | ||
7827 | |||
7828 | var ReactComponentEnvironment = { | ||
7829 | |||
7830 | /** | ||
7831 | * Optionally injectable environment dependent cleanup hook. (server vs. | ||
7832 | * browser etc). Example: A browser system caches DOM nodes based on component | ||
7833 | * ID and must remove that cache entry when this instance is unmounted. | ||
7834 | */ | ||
7835 | unmountIDFromEnvironment: null, | ||
7836 | 9100 | ||
7837 | /** | 9101 | var getEventModifierState = __webpack_require__(81); |
7838 | * Optionally injectable hook for swapping out mount images in the middle of | ||
7839 | * the tree. | ||
7840 | */ | ||
7841 | replaceNodeWithMarkupByID: null, | ||
7842 | 9102 | ||
7843 | /** | 9103 | /** |
7844 | * Optionally injectable hook for processing a queue of child updates. Will | 9104 | * @interface MouseEvent |
7845 | * later move into MultiChildComponents. | 9105 | * @see http://www.w3.org/TR/DOM-Level-3-Events/ |
7846 | */ | 9106 | */ |
7847 | processChildrenUpdates: null, | 9107 | var MouseEventInterface = { |
7848 | 9108 | screenX: null, | |
7849 | injection: { | 9109 | screenY: null, |
7850 | injectEnvironment: function (environment) { | 9110 | clientX: null, |
7851 | !!injected ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactCompositeComponent: injectEnvironment() can only be called once.') : invariant(false) : undefined; | 9111 | clientY: null, |
7852 | ReactComponentEnvironment.unmountIDFromEnvironment = environment.unmountIDFromEnvironment; | 9112 | ctrlKey: null, |
7853 | ReactComponentEnvironment.replaceNodeWithMarkupByID = environment.replaceNodeWithMarkupByID; | 9113 | shiftKey: null, |
7854 | ReactComponentEnvironment.processChildrenUpdates = environment.processChildrenUpdates; | 9114 | altKey: null, |
7855 | injected = true; | 9115 | metaKey: null, |
9116 | getModifierState: getEventModifierState, | ||
9117 | button: function (event) { | ||
9118 | // Webkit, Firefox, IE9+ | ||
9119 | // which: 1 2 3 | ||
9120 | // button: 0 1 2 (standard) | ||
9121 | var button = event.button; | ||
9122 | if ('which' in event) { | ||
9123 | return button; | ||
7856 | } | 9124 | } |
9125 | // IE<9 | ||
9126 | // which: undefined | ||
9127 | // button: 0 0 0 | ||
9128 | // button: 1 4 2 (onmouseup) | ||
9129 | return button === 2 ? 2 : button === 4 ? 1 : 0; | ||
9130 | }, | ||
9131 | buttons: null, | ||
9132 | relatedTarget: function (event) { | ||
9133 | return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement); | ||
9134 | }, | ||
9135 | // "Proprietary" Interface. | ||
9136 | pageX: function (event) { | ||
9137 | return 'pageX' in event ? event.pageX : event.clientX + ViewportMetrics.currentScrollLeft; | ||
9138 | }, | ||
9139 | pageY: function (event) { | ||
9140 | return 'pageY' in event ? event.pageY : event.clientY + ViewportMetrics.currentScrollTop; | ||
7857 | } | 9141 | } |
7858 | |||
7859 | }; | 9142 | }; |
7860 | 9143 | ||
7861 | module.exports = ReactComponentEnvironment; | ||
7862 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
7863 | |||
7864 | /***/ }, | ||
7865 | /* 67 */ | ||
7866 | /***/ function(module, exports, __webpack_require__) { | ||
7867 | |||
7868 | /** | 9144 | /** |
7869 | * Copyright 2013-2015, Facebook, Inc. | 9145 | * @param {object} dispatchConfig Configuration used to dispatch this event. |
7870 | * All rights reserved. | 9146 | * @param {string} dispatchMarker Marker identifying the event target. |
7871 | * | 9147 | * @param {object} nativeEvent Native browser event. |
7872 | * This source code is licensed under the BSD-style license found in the | 9148 | * @extends {SyntheticUIEvent} |
7873 | * LICENSE file in the root directory of this source tree. An additional grant | ||
7874 | * of patent rights can be found in the PATENTS file in the same directory. | ||
7875 | * | ||
7876 | * @providesModule ReactPropTypeLocations | ||
7877 | */ | 9149 | */ |
9150 | function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | ||
9151 | return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | ||
9152 | } | ||
7878 | 9153 | ||
7879 | 'use strict'; | 9154 | SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface); |
7880 | |||
7881 | var keyMirror = __webpack_require__(19); | ||
7882 | |||
7883 | var ReactPropTypeLocations = keyMirror({ | ||
7884 | prop: null, | ||
7885 | context: null, | ||
7886 | childContext: null | ||
7887 | }); | ||
7888 | 9155 | ||
7889 | module.exports = ReactPropTypeLocations; | 9156 | module.exports = SyntheticMouseEvent; |
7890 | 9157 | ||
7891 | /***/ }, | 9158 | /***/ }, |
7892 | /* 68 */ | 9159 | /* 79 */ |
7893 | /***/ function(module, exports, __webpack_require__) { | 9160 | /***/ function(module, exports, __webpack_require__) { |
7894 | 9161 | ||
7895 | /* WEBPACK VAR INJECTION */(function(process) {/** | 9162 | /** |
7896 | * Copyright 2013-2015, Facebook, Inc. | 9163 | * Copyright 2013-present, Facebook, Inc. |
7897 | * All rights reserved. | 9164 | * All rights reserved. |
7898 | * | 9165 | * |
7899 | * This source code is licensed under the BSD-style license found in the | 9166 | * This source code is licensed under the BSD-style license found in the |
7900 | * LICENSE file in the root directory of this source tree. An additional grant | 9167 | * LICENSE file in the root directory of this source tree. An additional grant |
7901 | * of patent rights can be found in the PATENTS file in the same directory. | 9168 | * of patent rights can be found in the PATENTS file in the same directory. |
7902 | * | 9169 | * |
7903 | * @providesModule ReactPropTypeLocationNames | 9170 | * @providesModule SyntheticUIEvent |
7904 | */ | 9171 | */ |
7905 | 9172 | ||
7906 | 'use strict'; | 9173 | 'use strict'; |
7907 | 9174 | ||
7908 | var ReactPropTypeLocationNames = {}; | 9175 | var SyntheticEvent = __webpack_require__(56); |
7909 | 9176 | ||
7910 | if (process.env.NODE_ENV !== 'production') { | 9177 | var getEventTarget = __webpack_require__(73); |
7911 | ReactPropTypeLocationNames = { | ||
7912 | prop: 'prop', | ||
7913 | context: 'context', | ||
7914 | childContext: 'child context' | ||
7915 | }; | ||
7916 | } | ||
7917 | 9178 | ||
7918 | module.exports = ReactPropTypeLocationNames; | ||
7919 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
7920 | |||
7921 | /***/ }, | ||
7922 | /* 69 */ | ||
7923 | /***/ function(module, exports) { | ||
7924 | |||
7925 | /** | 9179 | /** |
7926 | * Copyright 2013-2015, Facebook, Inc. | 9180 | * @interface UIEvent |
7927 | * All rights reserved. | 9181 | * @see http://www.w3.org/TR/DOM-Level-3-Events/ |
7928 | * | ||
7929 | * This source code is licensed under the BSD-style license found in the | ||
7930 | * LICENSE file in the root directory of this source tree. An additional grant | ||
7931 | * of patent rights can be found in the PATENTS file in the same directory. | ||
7932 | * | ||
7933 | * @providesModule shouldUpdateReactComponent | ||
7934 | * @typechecks static-only | ||
7935 | */ | 9182 | */ |
9183 | var UIEventInterface = { | ||
9184 | view: function (event) { | ||
9185 | if (event.view) { | ||
9186 | return event.view; | ||
9187 | } | ||
7936 | 9188 | ||
7937 | 'use strict'; | 9189 | var target = getEventTarget(event); |
9190 | if (target.window === target) { | ||
9191 | // target is a window object | ||
9192 | return target; | ||
9193 | } | ||
7938 | 9194 | ||
7939 | /** | 9195 | var doc = target.ownerDocument; |
7940 | * Given a `prevElement` and `nextElement`, determines if the existing | 9196 | // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8. |
7941 | * instance should be updated as opposed to being destroyed or replaced by a new | 9197 | if (doc) { |
7942 | * instance. Both arguments are elements. This ensures that this logic can | 9198 | return doc.defaultView || doc.parentWindow; |
7943 | * operate on stateless trees without any backing instance. | 9199 | } else { |
7944 | * | 9200 | return window; |
7945 | * @param {?object} prevElement | 9201 | } |
7946 | * @param {?object} nextElement | 9202 | }, |
7947 | * @return {boolean} True if the existing instance should be updated. | 9203 | detail: function (event) { |
7948 | * @protected | 9204 | return event.detail || 0; |
7949 | */ | ||
7950 | function shouldUpdateReactComponent(prevElement, nextElement) { | ||
7951 | var prevEmpty = prevElement === null || prevElement === false; | ||
7952 | var nextEmpty = nextElement === null || nextElement === false; | ||
7953 | if (prevEmpty || nextEmpty) { | ||
7954 | return prevEmpty === nextEmpty; | ||
7955 | } | 9205 | } |
9206 | }; | ||
7956 | 9207 | ||
7957 | var prevType = typeof prevElement; | 9208 | /** |
7958 | var nextType = typeof nextElement; | 9209 | * @param {object} dispatchConfig Configuration used to dispatch this event. |
7959 | if (prevType === 'string' || prevType === 'number') { | 9210 | * @param {string} dispatchMarker Marker identifying the event target. |
7960 | return nextType === 'string' || nextType === 'number'; | 9211 | * @param {object} nativeEvent Native browser event. |
7961 | } else { | 9212 | * @extends {SyntheticEvent} |
7962 | return nextType === 'object' && prevElement.type === nextElement.type && prevElement.key === nextElement.key; | 9213 | */ |
7963 | } | 9214 | function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { |
7964 | return false; | 9215 | return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); |
7965 | } | 9216 | } |
7966 | 9217 | ||
7967 | module.exports = shouldUpdateReactComponent; | 9218 | SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface); |
9219 | |||
9220 | module.exports = SyntheticUIEvent; | ||
7968 | 9221 | ||
7969 | /***/ }, | 9222 | /***/ }, |
7970 | /* 70 */ | 9223 | /* 80 */ |
7971 | /***/ function(module, exports, __webpack_require__) { | 9224 | /***/ function(module, exports) { |
7972 | 9225 | ||
7973 | /** | 9226 | /** |
7974 | * Copyright 2014-2015, Facebook, Inc. | 9227 | * Copyright 2013-present, Facebook, Inc. |
7975 | * All rights reserved. | 9228 | * All rights reserved. |
7976 | * | 9229 | * |
7977 | * This source code is licensed under the BSD-style license found in the | 9230 | * This source code is licensed under the BSD-style license found in the |
7978 | * LICENSE file in the root directory of this source tree. An additional grant | 9231 | * LICENSE file in the root directory of this source tree. An additional grant |
7979 | * of patent rights can be found in the PATENTS file in the same directory. | 9232 | * of patent rights can be found in the PATENTS file in the same directory. |
7980 | * | 9233 | * |
7981 | * @providesModule ReactEmptyComponent | 9234 | * @providesModule ViewportMetrics |
7982 | */ | 9235 | */ |
7983 | 9236 | ||
7984 | 'use strict'; | 9237 | 'use strict'; |
7985 | 9238 | ||
7986 | var ReactElement = __webpack_require__(44); | 9239 | var ViewportMetrics = { |
7987 | var ReactEmptyComponentRegistry = __webpack_require__(46); | ||
7988 | var ReactReconciler = __webpack_require__(52); | ||
7989 | 9240 | ||
7990 | var assign = __webpack_require__(41); | 9241 | currentScrollLeft: 0, |
7991 | 9242 | ||
7992 | var placeholderElement; | 9243 | currentScrollTop: 0, |
7993 | 9244 | ||
7994 | var ReactEmptyComponentInjection = { | 9245 | refreshScrollValues: function (scrollPosition) { |
7995 | injectEmptyComponent: function (component) { | 9246 | ViewportMetrics.currentScrollLeft = scrollPosition.x; |
7996 | placeholderElement = ReactElement.createElement(component); | 9247 | ViewportMetrics.currentScrollTop = scrollPosition.y; |
7997 | } | 9248 | } |
7998 | }; | ||
7999 | 9249 | ||
8000 | var ReactEmptyComponent = function (instantiate) { | ||
8001 | this._currentElement = null; | ||
8002 | this._rootNodeID = null; | ||
8003 | this._renderedComponent = instantiate(placeholderElement); | ||
8004 | }; | 9250 | }; |
8005 | assign(ReactEmptyComponent.prototype, { | ||
8006 | construct: function (element) {}, | ||
8007 | mountComponent: function (rootID, transaction, context) { | ||
8008 | ReactEmptyComponentRegistry.registerNullComponentID(rootID); | ||
8009 | this._rootNodeID = rootID; | ||
8010 | return ReactReconciler.mountComponent(this._renderedComponent, rootID, transaction, context); | ||
8011 | }, | ||
8012 | receiveComponent: function () {}, | ||
8013 | unmountComponent: function (rootID, transaction, context) { | ||
8014 | ReactReconciler.unmountComponent(this._renderedComponent); | ||
8015 | ReactEmptyComponentRegistry.deregisterNullComponentID(this._rootNodeID); | ||
8016 | this._rootNodeID = null; | ||
8017 | this._renderedComponent = null; | ||
8018 | } | ||
8019 | }); | ||
8020 | 9251 | ||
8021 | ReactEmptyComponent.injection = ReactEmptyComponentInjection; | 9252 | module.exports = ViewportMetrics; |
8022 | |||
8023 | module.exports = ReactEmptyComponent; | ||
8024 | 9253 | ||
8025 | /***/ }, | 9254 | /***/ }, |
8026 | /* 71 */ | 9255 | /* 81 */ |
8027 | /***/ function(module, exports, __webpack_require__) { | 9256 | /***/ function(module, exports) { |
8028 | 9257 | ||
8029 | /* WEBPACK VAR INJECTION */(function(process) {/** | 9258 | /** |
8030 | * Copyright 2014-2015, Facebook, Inc. | 9259 | * Copyright 2013-present, Facebook, Inc. |
8031 | * All rights reserved. | 9260 | * All rights reserved. |
8032 | * | 9261 | * |
8033 | * This source code is licensed under the BSD-style license found in the | 9262 | * This source code is licensed under the BSD-style license found in the |
8034 | * LICENSE file in the root directory of this source tree. An additional grant | 9263 | * LICENSE file in the root directory of this source tree. An additional grant |
8035 | * of patent rights can be found in the PATENTS file in the same directory. | 9264 | * of patent rights can be found in the PATENTS file in the same directory. |
8036 | * | 9265 | * |
8037 | * @providesModule ReactNativeComponent | 9266 | * @providesModule getEventModifierState |
8038 | */ | 9267 | */ |
8039 | 9268 | ||
8040 | 'use strict'; | 9269 | 'use strict'; |
8041 | 9270 | ||
8042 | var assign = __webpack_require__(41); | ||
8043 | var invariant = __webpack_require__(15); | ||
8044 | |||
8045 | var autoGenerateWrapperClass = null; | ||
8046 | var genericComponentClass = null; | ||
8047 | // This registry keeps track of wrapper classes around native tags. | ||
8048 | var tagToComponentClass = {}; | ||
8049 | var textComponentClass = null; | ||
8050 | |||
8051 | var ReactNativeComponentInjection = { | ||
8052 | // This accepts a class that receives the tag string. This is a catch all | ||
8053 | // that can render any kind of tag. | ||
8054 | injectGenericComponentClass: function (componentClass) { | ||
8055 | genericComponentClass = componentClass; | ||
8056 | }, | ||
8057 | // This accepts a text component class that takes the text string to be | ||
8058 | // rendered as props. | ||
8059 | injectTextComponentClass: function (componentClass) { | ||
8060 | textComponentClass = componentClass; | ||
8061 | }, | ||
8062 | // This accepts a keyed object with classes as values. Each key represents a | ||
8063 | // tag. That particular tag will use this class instead of the generic one. | ||
8064 | injectComponentClasses: function (componentClasses) { | ||
8065 | assign(tagToComponentClass, componentClasses); | ||
8066 | } | ||
8067 | }; | ||
8068 | |||
8069 | /** | 9271 | /** |
8070 | * Get a composite component wrapper class for a specific tag. | 9272 | * Translation from modifier key to the associated property in the event. |
8071 | * | 9273 | * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers |
8072 | * @param {ReactElement} element The tag for which to get the class. | ||
8073 | * @return {function} The React class constructor function. | ||
8074 | */ | 9274 | */ |
8075 | function getComponentClassForElement(element) { | ||
8076 | if (typeof element.type === 'function') { | ||
8077 | return element.type; | ||
8078 | } | ||
8079 | var tag = element.type; | ||
8080 | var componentClass = tagToComponentClass[tag]; | ||
8081 | if (componentClass == null) { | ||
8082 | tagToComponentClass[tag] = componentClass = autoGenerateWrapperClass(tag); | ||
8083 | } | ||
8084 | return componentClass; | ||
8085 | } | ||
8086 | 9275 | ||
8087 | /** | 9276 | var modifierKeyToProp = { |
8088 | * Get a native internal component class for a specific tag. | 9277 | 'Alt': 'altKey', |
8089 | * | 9278 | 'Control': 'ctrlKey', |
8090 | * @param {ReactElement} element The element to create. | 9279 | 'Meta': 'metaKey', |
8091 | * @return {function} The internal class constructor function. | 9280 | 'Shift': 'shiftKey' |
8092 | */ | 9281 | }; |
8093 | function createInternalComponent(element) { | ||
8094 | !genericComponentClass ? process.env.NODE_ENV !== 'production' ? invariant(false, 'There is no registered component for the tag %s', element.type) : invariant(false) : undefined; | ||
8095 | return new genericComponentClass(element.type, element.props); | ||
8096 | } | ||
8097 | 9282 | ||
8098 | /** | 9283 | // IE8 does not implement getModifierState so we simply map it to the only |
8099 | * @param {ReactText} text | 9284 | // modifier keys exposed by the event itself, does not support Lock-keys. |
8100 | * @return {ReactComponent} | 9285 | // Currently, all major browsers except Chrome seems to support Lock-keys. |
8101 | */ | 9286 | function modifierStateGetter(keyArg) { |
8102 | function createInstanceForText(text) { | 9287 | var syntheticEvent = this; |
8103 | return new textComponentClass(text); | 9288 | var nativeEvent = syntheticEvent.nativeEvent; |
9289 | if (nativeEvent.getModifierState) { | ||
9290 | return nativeEvent.getModifierState(keyArg); | ||
9291 | } | ||
9292 | var keyProp = modifierKeyToProp[keyArg]; | ||
9293 | return keyProp ? !!nativeEvent[keyProp] : false; | ||
8104 | } | 9294 | } |
8105 | 9295 | ||
8106 | /** | 9296 | function getEventModifierState(nativeEvent) { |
8107 | * @param {ReactComponent} component | 9297 | return modifierStateGetter; |
8108 | * @return {boolean} | ||
8109 | */ | ||
8110 | function isTextComponent(component) { | ||
8111 | return component instanceof textComponentClass; | ||
8112 | } | 9298 | } |
8113 | 9299 | ||
8114 | var ReactNativeComponent = { | 9300 | module.exports = getEventModifierState; |
8115 | getComponentClassForElement: getComponentClassForElement, | ||
8116 | createInternalComponent: createInternalComponent, | ||
8117 | createInstanceForText: createInstanceForText, | ||
8118 | isTextComponent: isTextComponent, | ||
8119 | injection: ReactNativeComponentInjection | ||
8120 | }; | ||
8121 | |||
8122 | module.exports = ReactNativeComponent; | ||
8123 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
8124 | 9301 | ||
8125 | /***/ }, | 9302 | /***/ }, |
8126 | /* 72 */ | 9303 | /* 82 */ |
8127 | /***/ function(module, exports, __webpack_require__) { | 9304 | /***/ function(module, exports, __webpack_require__) { |
8128 | 9305 | ||
8129 | /* WEBPACK VAR INJECTION */(function(process) {/** | 9306 | /** |
8130 | * Copyright 2015, Facebook, Inc. | 9307 | * Copyright 2013-present, Facebook, Inc. |
8131 | * All rights reserved. | 9308 | * All rights reserved. |
8132 | * | 9309 | * |
8133 | * This source code is licensed under the BSD-style license found in the | 9310 | * This source code is licensed under the BSD-style license found in the |
8134 | * LICENSE file in the root directory of this source tree. An additional grant | 9311 | * LICENSE file in the root directory of this source tree. An additional grant |
8135 | * of patent rights can be found in the PATENTS file in the same directory. | 9312 | * of patent rights can be found in the PATENTS file in the same directory. |
8136 | * | 9313 | * |
8137 | * @providesModule validateDOMNesting | 9314 | * @providesModule HTMLDOMPropertyConfig |
8138 | */ | 9315 | */ |
8139 | 9316 | ||
8140 | 'use strict'; | 9317 | 'use strict'; |
8141 | 9318 | ||
8142 | var assign = __webpack_require__(41); | 9319 | var DOMProperty = __webpack_require__(40); |
8143 | var emptyFunction = __webpack_require__(17); | ||
8144 | var warning = __webpack_require__(27); | ||
8145 | |||
8146 | var validateDOMNesting = emptyFunction; | ||
8147 | |||
8148 | if (process.env.NODE_ENV !== 'production') { | ||
8149 | // This validation code was written based on the HTML5 parsing spec: | ||
8150 | // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope | ||
8151 | // | ||
8152 | // Note: this does not catch all invalid nesting, nor does it try to (as it's | ||
8153 | // not clear what practical benefit doing so provides); instead, we warn only | ||
8154 | // for cases where the parser will give a parse tree differing from what React | ||
8155 | // intended. For example, <b><div></div></b> is invalid but we don't warn | ||
8156 | // because it still parses correctly; we do warn for other cases like nested | ||
8157 | // <p> tags where the beginning of the second element implicitly closes the | ||
8158 | // first, causing a confusing mess. | ||
8159 | |||
8160 | // https://html.spec.whatwg.org/multipage/syntax.html#special | ||
8161 | 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']; | ||
8162 | |||
8163 | // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope | ||
8164 | var inScopeTags = ['applet', 'caption', 'html', 'table', 'td', 'th', 'marquee', 'object', 'template', | ||
8165 | |||
8166 | // https://html.spec.whatwg.org/multipage/syntax.html#html-integration-point | ||
8167 | // TODO: Distinguish by namespace here -- for <title>, including it here | ||
8168 | // errs on the side of fewer warnings | ||
8169 | 'foreignObject', 'desc', 'title']; | ||
8170 | |||
8171 | // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-button-scope | ||
8172 | var buttonScopeTags = inScopeTags.concat(['button']); | ||
8173 | |||
8174 | // https://html.spec.whatwg.org/multipage/syntax.html#generate-implied-end-tags | ||
8175 | var impliedEndTags = ['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt']; | ||
8176 | |||
8177 | var emptyAncestorInfo = { | ||
8178 | parentTag: null, | ||
8179 | |||
8180 | formTag: null, | ||
8181 | aTagInScope: null, | ||
8182 | buttonTagInScope: null, | ||
8183 | nobrTagInScope: null, | ||
8184 | pTagInButtonScope: null, | ||
8185 | |||
8186 | listItemTagAutoclosing: null, | ||
8187 | dlItemTagAutoclosing: null | ||
8188 | }; | ||
8189 | |||
8190 | var updatedAncestorInfo = function (oldInfo, tag, instance) { | ||
8191 | var ancestorInfo = assign({}, oldInfo || emptyAncestorInfo); | ||
8192 | var info = { tag: tag, instance: instance }; | ||
8193 | |||
8194 | if (inScopeTags.indexOf(tag) !== -1) { | ||
8195 | ancestorInfo.aTagInScope = null; | ||
8196 | ancestorInfo.buttonTagInScope = null; | ||
8197 | ancestorInfo.nobrTagInScope = null; | ||
8198 | } | ||
8199 | if (buttonScopeTags.indexOf(tag) !== -1) { | ||
8200 | ancestorInfo.pTagInButtonScope = null; | ||
8201 | } | ||
8202 | |||
8203 | // See rules for 'li', 'dd', 'dt' start tags in | ||
8204 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody | ||
8205 | if (specialTags.indexOf(tag) !== -1 && tag !== 'address' && tag !== 'div' && tag !== 'p') { | ||
8206 | ancestorInfo.listItemTagAutoclosing = null; | ||
8207 | ancestorInfo.dlItemTagAutoclosing = null; | ||
8208 | } | ||
8209 | |||
8210 | ancestorInfo.parentTag = info; | ||
8211 | |||
8212 | if (tag === 'form') { | ||
8213 | ancestorInfo.formTag = info; | ||
8214 | } | ||
8215 | if (tag === 'a') { | ||
8216 | ancestorInfo.aTagInScope = info; | ||
8217 | } | ||
8218 | if (tag === 'button') { | ||
8219 | ancestorInfo.buttonTagInScope = info; | ||
8220 | } | ||
8221 | if (tag === 'nobr') { | ||
8222 | ancestorInfo.nobrTagInScope = info; | ||
8223 | } | ||
8224 | if (tag === 'p') { | ||
8225 | ancestorInfo.pTagInButtonScope = info; | ||
8226 | } | ||
8227 | if (tag === 'li') { | ||
8228 | ancestorInfo.listItemTagAutoclosing = info; | ||
8229 | } | ||
8230 | if (tag === 'dd' || tag === 'dt') { | ||
8231 | ancestorInfo.dlItemTagAutoclosing = info; | ||
8232 | } | ||
8233 | |||
8234 | return ancestorInfo; | ||
8235 | }; | ||
8236 | 9320 | ||
8237 | /** | 9321 | var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY; |
8238 | * Returns whether | 9322 | var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE; |
8239 | */ | 9323 | var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE; |
8240 | var isTagValidWithParent = function (tag, parentTag) { | 9324 | var HAS_POSITIVE_NUMERIC_VALUE = DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE; |
8241 | // First, let's check if we're in an unusual parsing mode... | 9325 | var HAS_OVERLOADED_BOOLEAN_VALUE = DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE; |
8242 | switch (parentTag) { | ||
8243 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inselect | ||
8244 | case 'select': | ||
8245 | return tag === 'option' || tag === 'optgroup' || tag === '#text'; | ||
8246 | case 'optgroup': | ||
8247 | return tag === 'option' || tag === '#text'; | ||
8248 | // Strictly speaking, seeing an <option> doesn't mean we're in a <select> | ||
8249 | // but | ||
8250 | case 'option': | ||
8251 | return tag === '#text'; | ||
8252 | |||
8253 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intd | ||
8254 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incaption | ||
8255 | // No special behavior since these rules fall back to "in body" mode for | ||
8256 | // all except special table nodes which cause bad parsing behavior anyway. | ||
8257 | |||
8258 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intr | ||
8259 | case 'tr': | ||
8260 | return tag === 'th' || tag === 'td' || tag === 'style' || tag === 'script' || tag === 'template'; | ||
8261 | |||
8262 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intbody | ||
8263 | case 'tbody': | ||
8264 | case 'thead': | ||
8265 | case 'tfoot': | ||
8266 | return tag === 'tr' || tag === 'style' || tag === 'script' || tag === 'template'; | ||
8267 | |||
8268 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incolgroup | ||
8269 | case 'colgroup': | ||
8270 | return tag === 'col' || tag === 'template'; | ||
8271 | |||
8272 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intable | ||
8273 | case 'table': | ||
8274 | return tag === 'caption' || tag === 'colgroup' || tag === 'tbody' || tag === 'tfoot' || tag === 'thead' || tag === 'style' || tag === 'script' || tag === 'template'; | ||
8275 | |||
8276 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inhead | ||
8277 | case 'head': | ||
8278 | return tag === 'base' || tag === 'basefont' || tag === 'bgsound' || tag === 'link' || tag === 'meta' || tag === 'title' || tag === 'noscript' || tag === 'noframes' || tag === 'style' || tag === 'script' || tag === 'template'; | ||
8279 | |||
8280 | // https://html.spec.whatwg.org/multipage/semantics.html#the-html-element | ||
8281 | case 'html': | ||
8282 | return tag === 'head' || tag === 'body'; | ||
8283 | } | ||
8284 | |||
8285 | // Probably in the "in body" parsing mode, so we outlaw only tag combos | ||
8286 | // where the parsing rules cause implicit opens or closes to be added. | ||
8287 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody | ||
8288 | switch (tag) { | ||
8289 | case 'h1': | ||
8290 | case 'h2': | ||
8291 | case 'h3': | ||
8292 | case 'h4': | ||
8293 | case 'h5': | ||
8294 | case 'h6': | ||
8295 | return parentTag !== 'h1' && parentTag !== 'h2' && parentTag !== 'h3' && parentTag !== 'h4' && parentTag !== 'h5' && parentTag !== 'h6'; | ||
8296 | |||
8297 | case 'rp': | ||
8298 | case 'rt': | ||
8299 | return impliedEndTags.indexOf(parentTag) === -1; | ||
8300 | |||
8301 | case 'caption': | ||
8302 | case 'col': | ||
8303 | case 'colgroup': | ||
8304 | case 'frame': | ||
8305 | case 'head': | ||
8306 | case 'tbody': | ||
8307 | case 'td': | ||
8308 | case 'tfoot': | ||
8309 | case 'th': | ||
8310 | case 'thead': | ||
8311 | case 'tr': | ||
8312 | // These tags are only valid with a few parents that have special child | ||
8313 | // parsing rules -- if we're down here, then none of those matched and | ||
8314 | // so we allow it only if we don't know what the parent is, as all other | ||
8315 | // cases are invalid. | ||
8316 | return parentTag == null; | ||
8317 | } | ||
8318 | |||
8319 | return true; | ||
8320 | }; | ||
8321 | |||
8322 | /** | ||
8323 | * Returns whether | ||
8324 | */ | ||
8325 | var findInvalidAncestorForTag = function (tag, ancestorInfo) { | ||
8326 | switch (tag) { | ||
8327 | case 'address': | ||
8328 | case 'article': | ||
8329 | case 'aside': | ||
8330 | case 'blockquote': | ||
8331 | case 'center': | ||
8332 | case 'details': | ||
8333 | case 'dialog': | ||
8334 | case 'dir': | ||
8335 | case 'div': | ||
8336 | case 'dl': | ||
8337 | case 'fieldset': | ||
8338 | case 'figcaption': | ||
8339 | case 'figure': | ||
8340 | case 'footer': | ||
8341 | case 'header': | ||
8342 | case 'hgroup': | ||
8343 | case 'main': | ||
8344 | case 'menu': | ||
8345 | case 'nav': | ||
8346 | case 'ol': | ||
8347 | case 'p': | ||
8348 | case 'section': | ||
8349 | case 'summary': | ||
8350 | case 'ul': | ||
8351 | |||
8352 | case 'pre': | ||
8353 | case 'listing': | ||
8354 | |||
8355 | case 'table': | ||
8356 | |||
8357 | case 'hr': | ||
8358 | |||
8359 | case 'xmp': | ||
8360 | |||
8361 | case 'h1': | ||
8362 | case 'h2': | ||
8363 | case 'h3': | ||
8364 | case 'h4': | ||
8365 | case 'h5': | ||
8366 | case 'h6': | ||
8367 | return ancestorInfo.pTagInButtonScope; | ||
8368 | |||
8369 | case 'form': | ||
8370 | return ancestorInfo.formTag || ancestorInfo.pTagInButtonScope; | ||
8371 | |||
8372 | case 'li': | ||
8373 | return ancestorInfo.listItemTagAutoclosing; | ||
8374 | |||
8375 | case 'dd': | ||
8376 | case 'dt': | ||
8377 | return ancestorInfo.dlItemTagAutoclosing; | ||
8378 | |||
8379 | case 'button': | ||
8380 | return ancestorInfo.buttonTagInScope; | ||
8381 | |||
8382 | case 'a': | ||
8383 | // Spec says something about storing a list of markers, but it sounds | ||
8384 | // equivalent to this check. | ||
8385 | return ancestorInfo.aTagInScope; | ||
8386 | |||
8387 | case 'nobr': | ||
8388 | return ancestorInfo.nobrTagInScope; | ||
8389 | } | ||
8390 | |||
8391 | return null; | ||
8392 | }; | ||
8393 | |||
8394 | /** | ||
8395 | * Given a ReactCompositeComponent instance, return a list of its recursive | ||
8396 | * owners, starting at the root and ending with the instance itself. | ||
8397 | */ | ||
8398 | var findOwnerStack = function (instance) { | ||
8399 | if (!instance) { | ||
8400 | return []; | ||
8401 | } | ||
8402 | |||
8403 | var stack = []; | ||
8404 | /*eslint-disable space-after-keywords */ | ||
8405 | do { | ||
8406 | /*eslint-enable space-after-keywords */ | ||
8407 | stack.push(instance); | ||
8408 | } while (instance = instance._currentElement._owner); | ||
8409 | stack.reverse(); | ||
8410 | return stack; | ||
8411 | }; | ||
8412 | |||
8413 | var didWarn = {}; | ||
8414 | |||
8415 | validateDOMNesting = function (childTag, childInstance, ancestorInfo) { | ||
8416 | ancestorInfo = ancestorInfo || emptyAncestorInfo; | ||
8417 | var parentInfo = ancestorInfo.parentTag; | ||
8418 | var parentTag = parentInfo && parentInfo.tag; | ||
8419 | |||
8420 | var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo; | ||
8421 | var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo); | ||
8422 | var problematic = invalidParent || invalidAncestor; | ||
8423 | |||
8424 | if (problematic) { | ||
8425 | var ancestorTag = problematic.tag; | ||
8426 | var ancestorInstance = problematic.instance; | ||
8427 | |||
8428 | var childOwner = childInstance && childInstance._currentElement._owner; | ||
8429 | var ancestorOwner = ancestorInstance && ancestorInstance._currentElement._owner; | ||
8430 | |||
8431 | var childOwners = findOwnerStack(childOwner); | ||
8432 | var ancestorOwners = findOwnerStack(ancestorOwner); | ||
8433 | |||
8434 | var minStackLen = Math.min(childOwners.length, ancestorOwners.length); | ||
8435 | var i; | ||
8436 | |||
8437 | var deepestCommon = -1; | ||
8438 | for (i = 0; i < minStackLen; i++) { | ||
8439 | if (childOwners[i] === ancestorOwners[i]) { | ||
8440 | deepestCommon = i; | ||
8441 | } else { | ||
8442 | break; | ||
8443 | } | ||
8444 | } | ||
8445 | |||
8446 | var UNKNOWN = '(unknown)'; | ||
8447 | var childOwnerNames = childOwners.slice(deepestCommon + 1).map(function (inst) { | ||
8448 | return inst.getName() || UNKNOWN; | ||
8449 | }); | ||
8450 | var ancestorOwnerNames = ancestorOwners.slice(deepestCommon + 1).map(function (inst) { | ||
8451 | return inst.getName() || UNKNOWN; | ||
8452 | }); | ||
8453 | var ownerInfo = [].concat( | ||
8454 | // If the parent and child instances have a common owner ancestor, start | ||
8455 | // with that -- otherwise we just start with the parent's owners. | ||
8456 | deepestCommon !== -1 ? childOwners[deepestCommon].getName() || UNKNOWN : [], ancestorOwnerNames, ancestorTag, | ||
8457 | // If we're warning about an invalid (non-parent) ancestry, add '...' | ||
8458 | invalidAncestor ? ['...'] : [], childOwnerNames, childTag).join(' > '); | ||
8459 | |||
8460 | var warnKey = !!invalidParent + '|' + childTag + '|' + ancestorTag + '|' + ownerInfo; | ||
8461 | if (didWarn[warnKey]) { | ||
8462 | return; | ||
8463 | } | ||
8464 | didWarn[warnKey] = true; | ||
8465 | |||
8466 | if (invalidParent) { | ||
8467 | var info = ''; | ||
8468 | if (ancestorTag === 'table' && childTag === 'tr') { | ||
8469 | info += ' Add a <tbody> to your code to match the DOM tree generated by ' + 'the browser.'; | ||
8470 | } | ||
8471 | process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...): <%s> cannot appear as a child of <%s>. ' + 'See %s.%s', childTag, ancestorTag, ownerInfo, info) : undefined; | ||
8472 | } else { | ||
8473 | process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...): <%s> cannot appear as a descendant of ' + '<%s>. See %s.', childTag, ancestorTag, ownerInfo) : undefined; | ||
8474 | } | ||
8475 | } | ||
8476 | }; | ||
8477 | 9326 | ||
8478 | validateDOMNesting.ancestorInfoContextKey = '__validateDOMNesting_ancestorInfo$' + Math.random().toString(36).slice(2); | 9327 | var HTMLDOMPropertyConfig = { |
9328 | isCustomAttribute: RegExp.prototype.test.bind(new RegExp('^(data|aria)-[' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$')), | ||
9329 | Properties: { | ||
9330 | /** | ||
9331 | * Standard Properties | ||
9332 | */ | ||
9333 | accept: 0, | ||
9334 | acceptCharset: 0, | ||
9335 | accessKey: 0, | ||
9336 | action: 0, | ||
9337 | allowFullScreen: HAS_BOOLEAN_VALUE, | ||
9338 | allowTransparency: 0, | ||
9339 | alt: 0, | ||
9340 | async: HAS_BOOLEAN_VALUE, | ||
9341 | autoComplete: 0, | ||
9342 | // autoFocus is polyfilled/normalized by AutoFocusUtils | ||
9343 | // autoFocus: HAS_BOOLEAN_VALUE, | ||
9344 | autoPlay: HAS_BOOLEAN_VALUE, | ||
9345 | capture: HAS_BOOLEAN_VALUE, | ||
9346 | cellPadding: 0, | ||
9347 | cellSpacing: 0, | ||
9348 | charSet: 0, | ||
9349 | challenge: 0, | ||
9350 | checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, | ||
9351 | cite: 0, | ||
9352 | classID: 0, | ||
9353 | className: 0, | ||
9354 | cols: HAS_POSITIVE_NUMERIC_VALUE, | ||
9355 | colSpan: 0, | ||
9356 | content: 0, | ||
9357 | contentEditable: 0, | ||
9358 | contextMenu: 0, | ||
9359 | controls: HAS_BOOLEAN_VALUE, | ||
9360 | coords: 0, | ||
9361 | crossOrigin: 0, | ||
9362 | data: 0, // For `<object />` acts as `src`. | ||
9363 | dateTime: 0, | ||
9364 | 'default': HAS_BOOLEAN_VALUE, | ||
9365 | defer: HAS_BOOLEAN_VALUE, | ||
9366 | dir: 0, | ||
9367 | disabled: HAS_BOOLEAN_VALUE, | ||
9368 | download: HAS_OVERLOADED_BOOLEAN_VALUE, | ||
9369 | draggable: 0, | ||
9370 | encType: 0, | ||
9371 | form: 0, | ||
9372 | formAction: 0, | ||
9373 | formEncType: 0, | ||
9374 | formMethod: 0, | ||
9375 | formNoValidate: HAS_BOOLEAN_VALUE, | ||
9376 | formTarget: 0, | ||
9377 | frameBorder: 0, | ||
9378 | headers: 0, | ||
9379 | height: 0, | ||
9380 | hidden: HAS_BOOLEAN_VALUE, | ||
9381 | high: 0, | ||
9382 | href: 0, | ||
9383 | hrefLang: 0, | ||
9384 | htmlFor: 0, | ||
9385 | httpEquiv: 0, | ||
9386 | icon: 0, | ||
9387 | id: 0, | ||
9388 | inputMode: 0, | ||
9389 | integrity: 0, | ||
9390 | is: 0, | ||
9391 | keyParams: 0, | ||
9392 | keyType: 0, | ||
9393 | kind: 0, | ||
9394 | label: 0, | ||
9395 | lang: 0, | ||
9396 | list: 0, | ||
9397 | loop: HAS_BOOLEAN_VALUE, | ||
9398 | low: 0, | ||
9399 | manifest: 0, | ||
9400 | marginHeight: 0, | ||
9401 | marginWidth: 0, | ||
9402 | max: 0, | ||
9403 | maxLength: 0, | ||
9404 | media: 0, | ||
9405 | mediaGroup: 0, | ||
9406 | method: 0, | ||
9407 | min: 0, | ||
9408 | minLength: 0, | ||
9409 | // Caution; `option.selected` is not updated if `select.multiple` is | ||
9410 | // disabled with `removeAttribute`. | ||
9411 | multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, | ||
9412 | muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, | ||
9413 | name: 0, | ||
9414 | nonce: 0, | ||
9415 | noValidate: HAS_BOOLEAN_VALUE, | ||
9416 | open: HAS_BOOLEAN_VALUE, | ||
9417 | optimum: 0, | ||
9418 | pattern: 0, | ||
9419 | placeholder: 0, | ||
9420 | poster: 0, | ||
9421 | preload: 0, | ||
9422 | profile: 0, | ||
9423 | radioGroup: 0, | ||
9424 | readOnly: HAS_BOOLEAN_VALUE, | ||
9425 | referrerPolicy: 0, | ||
9426 | rel: 0, | ||
9427 | required: HAS_BOOLEAN_VALUE, | ||
9428 | reversed: HAS_BOOLEAN_VALUE, | ||
9429 | role: 0, | ||
9430 | rows: HAS_POSITIVE_NUMERIC_VALUE, | ||
9431 | rowSpan: HAS_NUMERIC_VALUE, | ||
9432 | sandbox: 0, | ||
9433 | scope: 0, | ||
9434 | scoped: HAS_BOOLEAN_VALUE, | ||
9435 | scrolling: 0, | ||
9436 | seamless: HAS_BOOLEAN_VALUE, | ||
9437 | selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, | ||
9438 | shape: 0, | ||
9439 | size: HAS_POSITIVE_NUMERIC_VALUE, | ||
9440 | sizes: 0, | ||
9441 | span: HAS_POSITIVE_NUMERIC_VALUE, | ||
9442 | spellCheck: 0, | ||
9443 | src: 0, | ||
9444 | srcDoc: 0, | ||
9445 | srcLang: 0, | ||
9446 | srcSet: 0, | ||
9447 | start: HAS_NUMERIC_VALUE, | ||
9448 | step: 0, | ||
9449 | style: 0, | ||
9450 | summary: 0, | ||
9451 | tabIndex: 0, | ||
9452 | target: 0, | ||
9453 | title: 0, | ||
9454 | // Setting .type throws on non-<input> tags | ||
9455 | type: 0, | ||
9456 | useMap: 0, | ||
9457 | value: 0, | ||
9458 | width: 0, | ||
9459 | wmode: 0, | ||
9460 | wrap: 0, | ||
8479 | 9461 | ||
8480 | validateDOMNesting.updatedAncestorInfo = updatedAncestorInfo; | 9462 | /** |
9463 | * RDFa Properties | ||
9464 | */ | ||
9465 | about: 0, | ||
9466 | datatype: 0, | ||
9467 | inlist: 0, | ||
9468 | prefix: 0, | ||
9469 | // property is also supported for OpenGraph in meta tags. | ||
9470 | property: 0, | ||
9471 | resource: 0, | ||
9472 | 'typeof': 0, | ||
9473 | vocab: 0, | ||
8481 | 9474 | ||
8482 | // For testing | 9475 | /** |
8483 | validateDOMNesting.isTagValidInContext = function (tag, ancestorInfo) { | 9476 | * Non-standard Properties |
8484 | ancestorInfo = ancestorInfo || emptyAncestorInfo; | 9477 | */ |
8485 | var parentInfo = ancestorInfo.parentTag; | 9478 | // autoCapitalize and autoCorrect are supported in Mobile Safari for |
8486 | var parentTag = parentInfo && parentInfo.tag; | 9479 | // keyboard hints. |
8487 | return isTagValidWithParent(tag, parentTag) && !findInvalidAncestorForTag(tag, ancestorInfo); | 9480 | autoCapitalize: 0, |
8488 | }; | 9481 | autoCorrect: 0, |
8489 | } | 9482 | // autoSave allows WebKit/Blink to persist values of input fields on page reloads |
9483 | autoSave: 0, | ||
9484 | // color is for Safari mask-icon link | ||
9485 | color: 0, | ||
9486 | // itemProp, itemScope, itemType are for | ||
9487 | // Microdata support. See http://schema.org/docs/gs.html | ||
9488 | itemProp: 0, | ||
9489 | itemScope: HAS_BOOLEAN_VALUE, | ||
9490 | itemType: 0, | ||
9491 | // itemID and itemRef are for Microdata support as well but | ||
9492 | // only specified in the WHATWG spec document. See | ||
9493 | // https://html.spec.whatwg.org/multipage/microdata.html#microdata-dom-api | ||
9494 | itemID: 0, | ||
9495 | itemRef: 0, | ||
9496 | // results show looking glass icon and recent searches on input | ||
9497 | // search fields in WebKit/Blink | ||
9498 | results: 0, | ||
9499 | // IE-only attribute that specifies security restrictions on an iframe | ||
9500 | // as an alternative to the sandbox attribute on IE<10 | ||
9501 | security: 0, | ||
9502 | // IE-only attribute that controls focus behavior | ||
9503 | unselectable: 0 | ||
9504 | }, | ||
9505 | DOMAttributeNames: { | ||
9506 | acceptCharset: 'accept-charset', | ||
9507 | className: 'class', | ||
9508 | htmlFor: 'for', | ||
9509 | httpEquiv: 'http-equiv' | ||
9510 | }, | ||
9511 | DOMPropertyNames: {} | ||
9512 | }; | ||
8490 | 9513 | ||
8491 | module.exports = validateDOMNesting; | 9514 | module.exports = HTMLDOMPropertyConfig; |
8492 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
8493 | 9515 | ||
8494 | /***/ }, | 9516 | /***/ }, |
8495 | /* 73 */ | 9517 | /* 83 */ |
8496 | /***/ function(module, exports, __webpack_require__) { | 9518 | /***/ function(module, exports, __webpack_require__) { |
8497 | 9519 | ||
8498 | /* WEBPACK VAR INJECTION */(function(process) {/** | 9520 | /** |
8499 | * Copyright 2013-2015, Facebook, Inc. | 9521 | * Copyright 2013-present, Facebook, Inc. |
8500 | * All rights reserved. | 9522 | * All rights reserved. |
8501 | * | 9523 | * |
8502 | * This source code is licensed under the BSD-style license found in the | 9524 | * This source code is licensed under the BSD-style license found in the |
8503 | * LICENSE file in the root directory of this source tree. An additional grant | 9525 | * LICENSE file in the root directory of this source tree. An additional grant |
8504 | * of patent rights can be found in the PATENTS file in the same directory. | 9526 | * of patent rights can be found in the PATENTS file in the same directory. |
8505 | * | 9527 | * |
8506 | * @providesModule ReactDefaultInjection | 9528 | * @providesModule ReactComponentBrowserEnvironment |
8507 | */ | 9529 | */ |
8508 | 9530 | ||
8509 | 'use strict'; | 9531 | 'use strict'; |
8510 | 9532 | ||
8511 | var BeforeInputEventPlugin = __webpack_require__(74); | 9533 | var DOMChildrenOperations = __webpack_require__(84); |
8512 | var ChangeEventPlugin = __webpack_require__(82); | 9534 | var ReactDOMIDOperations = __webpack_require__(96); |
8513 | var ClientReactRootIndex = __webpack_require__(85); | ||
8514 | var DefaultEventPluginOrder = __webpack_require__(86); | ||
8515 | var EnterLeaveEventPlugin = __webpack_require__(87); | ||
8516 | var ExecutionEnvironment = __webpack_require__(11); | ||
8517 | var HTMLDOMPropertyConfig = __webpack_require__(91); | ||
8518 | var ReactBrowserComponentMixin = __webpack_require__(92); | ||
8519 | var ReactComponentBrowserEnvironment = __webpack_require__(28); | ||
8520 | var ReactDefaultBatchingStrategy = __webpack_require__(94); | ||
8521 | var ReactDOMComponent = __webpack_require__(95); | ||
8522 | var ReactDOMTextComponent = __webpack_require__(8); | ||
8523 | var ReactEventListener = __webpack_require__(120); | ||
8524 | var ReactInjection = __webpack_require__(123); | ||
8525 | var ReactInstanceHandles = __webpack_require__(47); | ||
8526 | var ReactMount = __webpack_require__(30); | ||
8527 | var ReactReconcileTransaction = __webpack_require__(127); | ||
8528 | var SelectEventPlugin = __webpack_require__(132); | ||
8529 | var ServerReactRootIndex = __webpack_require__(133); | ||
8530 | var SimpleEventPlugin = __webpack_require__(134); | ||
8531 | var SVGDOMPropertyConfig = __webpack_require__(143); | ||
8532 | |||
8533 | var alreadyInjected = false; | ||
8534 | 9535 | ||
8535 | function inject() { | 9536 | /** |
8536 | if (alreadyInjected) { | 9537 | * Abstracts away all functionality of the reconciler that requires knowledge of |
8537 | // TODO: This is currently true because these injections are shared between | 9538 | * the browser context. TODO: These callers should be refactored to avoid the |
8538 | // the client and the server package. They should be built independently | 9539 | * need for this injection. |
8539 | // and not share any injection state. Then this problem will be solved. | 9540 | */ |
8540 | return; | 9541 | var ReactComponentBrowserEnvironment = { |
8541 | } | ||
8542 | alreadyInjected = true; | ||
8543 | 9542 | ||
8544 | ReactInjection.EventEmitter.injectReactEventListener(ReactEventListener); | 9543 | processChildrenUpdates: ReactDOMIDOperations.dangerouslyProcessChildrenUpdates, |
8545 | 9544 | ||
8546 | /** | 9545 | replaceNodeWithMarkup: DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup, |
8547 | * Inject modules for resolving DOM hierarchy and plugin ordering. | ||
8548 | */ | ||
8549 | ReactInjection.EventPluginHub.injectEventPluginOrder(DefaultEventPluginOrder); | ||
8550 | ReactInjection.EventPluginHub.injectInstanceHandle(ReactInstanceHandles); | ||
8551 | ReactInjection.EventPluginHub.injectMount(ReactMount); | ||
8552 | 9546 | ||
8553 | /** | 9547 | /** |
8554 | * Some important event plugins included by default (without having to require | 9548 | * If a particular environment requires that some resources be cleaned up, |
8555 | * them). | 9549 | * specify this in the injected Mixin. In the DOM, we would likely want to |
9550 | * purge any cached node ID lookups. | ||
9551 | * | ||
9552 | * @private | ||
8556 | */ | 9553 | */ |
8557 | ReactInjection.EventPluginHub.injectEventPluginsByName({ | 9554 | unmountIDFromEnvironment: function (rootNodeID) {} |
8558 | SimpleEventPlugin: SimpleEventPlugin, | ||
8559 | EnterLeaveEventPlugin: EnterLeaveEventPlugin, | ||
8560 | ChangeEventPlugin: ChangeEventPlugin, | ||
8561 | SelectEventPlugin: SelectEventPlugin, | ||
8562 | BeforeInputEventPlugin: BeforeInputEventPlugin | ||
8563 | }); | ||
8564 | |||
8565 | ReactInjection.NativeComponent.injectGenericComponentClass(ReactDOMComponent); | ||
8566 | |||
8567 | ReactInjection.NativeComponent.injectTextComponentClass(ReactDOMTextComponent); | ||
8568 | |||
8569 | ReactInjection.Class.injectMixin(ReactBrowserComponentMixin); | ||
8570 | 9555 | ||
8571 | ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig); | ||
8572 | ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig); | ||
8573 | |||
8574 | ReactInjection.EmptyComponent.injectEmptyComponent('noscript'); | ||
8575 | |||
8576 | ReactInjection.Updates.injectReconcileTransaction(ReactReconcileTransaction); | ||
8577 | ReactInjection.Updates.injectBatchingStrategy(ReactDefaultBatchingStrategy); | ||
8578 | |||
8579 | ReactInjection.RootIndex.injectCreateReactRootIndex(ExecutionEnvironment.canUseDOM ? ClientReactRootIndex.createReactRootIndex : ServerReactRootIndex.createReactRootIndex); | ||
8580 | |||
8581 | ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment); | ||
8582 | |||
8583 | if (process.env.NODE_ENV !== 'production') { | ||
8584 | var url = ExecutionEnvironment.canUseDOM && window.location.href || ''; | ||
8585 | if (/[?&]react_perf\b/.test(url)) { | ||
8586 | var ReactDefaultPerf = __webpack_require__(144); | ||
8587 | ReactDefaultPerf.start(); | ||
8588 | } | ||
8589 | } | ||
8590 | } | ||
8591 | |||
8592 | module.exports = { | ||
8593 | inject: inject | ||
8594 | }; | 9556 | }; |
8595 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | 9557 | |
9558 | module.exports = ReactComponentBrowserEnvironment; | ||
8596 | 9559 | ||
8597 | /***/ }, | 9560 | /***/ }, |
8598 | /* 74 */ | 9561 | /* 84 */ |
8599 | /***/ function(module, exports, __webpack_require__) { | 9562 | /***/ function(module, exports, __webpack_require__) { |
8600 | 9563 | ||
8601 | /** | 9564 | /* WEBPACK VAR INJECTION */(function(process) {/** |
8602 | * Copyright 2013-2015 Facebook, Inc. | 9565 | * Copyright 2013-present, Facebook, Inc. |
8603 | * All rights reserved. | 9566 | * All rights reserved. |
8604 | * | 9567 | * |
8605 | * This source code is licensed under the BSD-style license found in the | 9568 | * This source code is licensed under the BSD-style license found in the |
8606 | * LICENSE file in the root directory of this source tree. An additional grant | 9569 | * LICENSE file in the root directory of this source tree. An additional grant |
8607 | * of patent rights can be found in the PATENTS file in the same directory. | 9570 | * of patent rights can be found in the PATENTS file in the same directory. |
8608 | * | 9571 | * |
8609 | * @providesModule BeforeInputEventPlugin | 9572 | * @providesModule DOMChildrenOperations |
8610 | * @typechecks static-only | ||
8611 | */ | 9573 | */ |
8612 | 9574 | ||
8613 | 'use strict'; | 9575 | 'use strict'; |
8614 | 9576 | ||
8615 | var EventConstants = __webpack_require__(32); | 9577 | var DOMLazyTree = __webpack_require__(85); |
8616 | var EventPropagators = __webpack_require__(75); | 9578 | var Danger = __webpack_require__(91); |
8617 | var ExecutionEnvironment = __webpack_require__(11); | 9579 | var ReactMultiChildUpdateTypes = __webpack_require__(95); |
8618 | var FallbackCompositionState = __webpack_require__(76); | 9580 | var ReactDOMComponentTree = __webpack_require__(39); |
8619 | var SyntheticCompositionEvent = __webpack_require__(78); | 9581 | var ReactInstrumentation = __webpack_require__(65); |
8620 | var SyntheticInputEvent = __webpack_require__(80); | ||
8621 | |||
8622 | var keyOf = __webpack_require__(81); | ||
8623 | |||
8624 | var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space | ||
8625 | var START_KEYCODE = 229; | ||
8626 | |||
8627 | var canUseCompositionEvent = ExecutionEnvironment.canUseDOM && 'CompositionEvent' in window; | ||
8628 | |||
8629 | var documentMode = null; | ||
8630 | if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) { | ||
8631 | documentMode = document.documentMode; | ||
8632 | } | ||
8633 | |||
8634 | // Webkit offers a very useful `textInput` event that can be used to | ||
8635 | // directly represent `beforeInput`. The IE `textinput` event is not as | ||
8636 | // useful, so we don't use it. | ||
8637 | var canUseTextInputEvent = ExecutionEnvironment.canUseDOM && 'TextEvent' in window && !documentMode && !isPresto(); | ||
8638 | |||
8639 | // In IE9+, we have access to composition events, but the data supplied | ||
8640 | // by the native compositionend event may be incorrect. Japanese ideographic | ||
8641 | // spaces, for instance (\u3000) are not recorded correctly. | ||
8642 | var useFallbackCompositionData = ExecutionEnvironment.canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11); | ||
8643 | |||
8644 | /** | ||
8645 | * Opera <= 12 includes TextEvent in window, but does not fire | ||
8646 | * text input events. Rely on keypress instead. | ||
8647 | */ | ||
8648 | function isPresto() { | ||
8649 | var opera = window.opera; | ||
8650 | return typeof opera === 'object' && typeof opera.version === 'function' && parseInt(opera.version(), 10) <= 12; | ||
8651 | } | ||
8652 | |||
8653 | var SPACEBAR_CODE = 32; | ||
8654 | var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE); | ||
8655 | 9582 | ||
8656 | var topLevelTypes = EventConstants.topLevelTypes; | 9583 | var createMicrosoftUnsafeLocalFunction = __webpack_require__(88); |
9584 | var setInnerHTML = __webpack_require__(87); | ||
9585 | var setTextContent = __webpack_require__(89); | ||
8657 | 9586 | ||
8658 | // Events and their corresponding property names. | 9587 | function getNodeAfter(parentNode, node) { |
8659 | var eventTypes = { | 9588 | // Special case for text components, which return [open, close] comments |
8660 | beforeInput: { | 9589 | // from getHostNode. |
8661 | phasedRegistrationNames: { | 9590 | if (Array.isArray(node)) { |
8662 | bubbled: keyOf({ onBeforeInput: null }), | 9591 | node = node[1]; |
8663 | captured: keyOf({ onBeforeInputCapture: null }) | ||
8664 | }, | ||
8665 | dependencies: [topLevelTypes.topCompositionEnd, topLevelTypes.topKeyPress, topLevelTypes.topTextInput, topLevelTypes.topPaste] | ||
8666 | }, | ||
8667 | compositionEnd: { | ||
8668 | phasedRegistrationNames: { | ||
8669 | bubbled: keyOf({ onCompositionEnd: null }), | ||
8670 | captured: keyOf({ onCompositionEndCapture: null }) | ||
8671 | }, | ||
8672 | dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionEnd, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown] | ||
8673 | }, | ||
8674 | compositionStart: { | ||
8675 | phasedRegistrationNames: { | ||
8676 | bubbled: keyOf({ onCompositionStart: null }), | ||
8677 | captured: keyOf({ onCompositionStartCapture: null }) | ||
8678 | }, | ||
8679 | dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionStart, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown] | ||
8680 | }, | ||
8681 | compositionUpdate: { | ||
8682 | phasedRegistrationNames: { | ||
8683 | bubbled: keyOf({ onCompositionUpdate: null }), | ||
8684 | captured: keyOf({ onCompositionUpdateCapture: null }) | ||
8685 | }, | ||
8686 | dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionUpdate, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown] | ||
8687 | } | 9592 | } |
8688 | }; | 9593 | return node ? node.nextSibling : parentNode.firstChild; |
8689 | |||
8690 | // Track whether we've ever handled a keypress on the space key. | ||
8691 | var hasSpaceKeypress = false; | ||
8692 | |||
8693 | /** | ||
8694 | * Return whether a native keypress event is assumed to be a command. | ||
8695 | * This is required because Firefox fires `keypress` events for key commands | ||
8696 | * (cut, copy, select-all, etc.) even though no character is inserted. | ||
8697 | */ | ||
8698 | function isKeypressCommand(nativeEvent) { | ||
8699 | return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) && | ||
8700 | // ctrlKey && altKey is equivalent to AltGr, and is not a command. | ||
8701 | !(nativeEvent.ctrlKey && nativeEvent.altKey); | ||
8702 | } | 9594 | } |
8703 | 9595 | ||
8704 | /** | 9596 | /** |
8705 | * Translate native top level events into event types. | 9597 | * Inserts `childNode` as a child of `parentNode` at the `index`. |
8706 | * | 9598 | * |
8707 | * @param {string} topLevelType | 9599 | * @param {DOMElement} parentNode Parent node in which to insert. |
8708 | * @return {object} | 9600 | * @param {DOMElement} childNode Child node to insert. |
9601 | * @param {number} index Index at which to insert the child. | ||
9602 | * @internal | ||
8709 | */ | 9603 | */ |
8710 | function getCompositionEventType(topLevelType) { | 9604 | var insertChildAt = createMicrosoftUnsafeLocalFunction(function (parentNode, childNode, referenceNode) { |
8711 | switch (topLevelType) { | 9605 | // We rely exclusively on `insertBefore(node, null)` instead of also using |
8712 | case topLevelTypes.topCompositionStart: | 9606 | // `appendChild(node)`. (Using `undefined` is not allowed by all browsers so |
8713 | return eventTypes.compositionStart; | 9607 | // we are careful to use `null`.) |
8714 | case topLevelTypes.topCompositionEnd: | 9608 | parentNode.insertBefore(childNode, referenceNode); |
8715 | return eventTypes.compositionEnd; | 9609 | }); |
8716 | case topLevelTypes.topCompositionUpdate: | ||
8717 | return eventTypes.compositionUpdate; | ||
8718 | } | ||
8719 | } | ||
8720 | 9610 | ||
8721 | /** | 9611 | function insertLazyTreeChildAt(parentNode, childTree, referenceNode) { |
8722 | * Does our fallback best-guess model think this event signifies that | 9612 | DOMLazyTree.insertTreeBefore(parentNode, childTree, referenceNode); |
8723 | * composition has begun? | ||
8724 | * | ||
8725 | * @param {string} topLevelType | ||
8726 | * @param {object} nativeEvent | ||
8727 | * @return {boolean} | ||
8728 | */ | ||
8729 | function isFallbackCompositionStart(topLevelType, nativeEvent) { | ||
8730 | return topLevelType === topLevelTypes.topKeyDown && nativeEvent.keyCode === START_KEYCODE; | ||
8731 | } | 9613 | } |
8732 | 9614 | ||
8733 | /** | 9615 | function moveChild(parentNode, childNode, referenceNode) { |
8734 | * Does our fallback mode think that this event is the end of composition? | 9616 | if (Array.isArray(childNode)) { |
8735 | * | 9617 | moveDelimitedText(parentNode, childNode[0], childNode[1], referenceNode); |
8736 | * @param {string} topLevelType | 9618 | } else { |
8737 | * @param {object} nativeEvent | 9619 | insertChildAt(parentNode, childNode, referenceNode); |
8738 | * @return {boolean} | ||
8739 | */ | ||
8740 | function isFallbackCompositionEnd(topLevelType, nativeEvent) { | ||
8741 | switch (topLevelType) { | ||
8742 | case topLevelTypes.topKeyUp: | ||
8743 | // Command keys insert or clear IME input. | ||
8744 | return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1; | ||
8745 | case topLevelTypes.topKeyDown: | ||
8746 | // Expect IME keyCode on each keydown. If we get any other | ||
8747 | // code we must have exited earlier. | ||
8748 | return nativeEvent.keyCode !== START_KEYCODE; | ||
8749 | case topLevelTypes.topKeyPress: | ||
8750 | case topLevelTypes.topMouseDown: | ||
8751 | case topLevelTypes.topBlur: | ||
8752 | // Events are not possible without cancelling IME. | ||
8753 | return true; | ||
8754 | default: | ||
8755 | return false; | ||
8756 | } | 9620 | } |
8757 | } | 9621 | } |
8758 | 9622 | ||
8759 | /** | 9623 | function removeChild(parentNode, childNode) { |
8760 | * Google Input Tools provides composition data via a CustomEvent, | 9624 | if (Array.isArray(childNode)) { |
8761 | * with the `data` property populated in the `detail` object. If this | 9625 | var closingComment = childNode[1]; |
8762 | * is available on the event object, use it. If not, this is a plain | 9626 | childNode = childNode[0]; |
8763 | * composition event and we have nothing special to extract. | 9627 | removeDelimitedText(parentNode, childNode, closingComment); |
8764 | * | 9628 | parentNode.removeChild(closingComment); |
8765 | * @param {object} nativeEvent | ||
8766 | * @return {?string} | ||
8767 | */ | ||
8768 | function getDataFromCustomEvent(nativeEvent) { | ||
8769 | var detail = nativeEvent.detail; | ||
8770 | if (typeof detail === 'object' && 'data' in detail) { | ||
8771 | return detail.data; | ||
8772 | } | 9629 | } |
8773 | return null; | 9630 | parentNode.removeChild(childNode); |
8774 | } | 9631 | } |
8775 | 9632 | ||
8776 | // Track the current IME composition fallback object, if any. | 9633 | function moveDelimitedText(parentNode, openingComment, closingComment, referenceNode) { |
8777 | var currentComposition = null; | 9634 | var node = openingComment; |
8778 | 9635 | while (true) { | |
8779 | /** | 9636 | var nextNode = node.nextSibling; |
8780 | * @param {string} topLevelType Record from `EventConstants`. | 9637 | insertChildAt(parentNode, node, referenceNode); |
8781 | * @param {DOMEventTarget} topLevelTarget The listening component root node. | 9638 | if (node === closingComment) { |
8782 | * @param {string} topLevelTargetID ID of `topLevelTarget`. | 9639 | break; |
8783 | * @param {object} nativeEvent Native browser event. | ||
8784 | * @return {?object} A SyntheticCompositionEvent. | ||
8785 | */ | ||
8786 | function extractCompositionEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) { | ||
8787 | var eventType; | ||
8788 | var fallbackData; | ||
8789 | |||
8790 | if (canUseCompositionEvent) { | ||
8791 | eventType = getCompositionEventType(topLevelType); | ||
8792 | } else if (!currentComposition) { | ||
8793 | if (isFallbackCompositionStart(topLevelType, nativeEvent)) { | ||
8794 | eventType = eventTypes.compositionStart; | ||
8795 | } | 9640 | } |
8796 | } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) { | 9641 | node = nextNode; |
8797 | eventType = eventTypes.compositionEnd; | ||
8798 | } | ||
8799 | |||
8800 | if (!eventType) { | ||
8801 | return null; | ||
8802 | } | 9642 | } |
9643 | } | ||
8803 | 9644 | ||
8804 | if (useFallbackCompositionData) { | 9645 | function removeDelimitedText(parentNode, startNode, closingComment) { |
8805 | // The current composition is stored statically and must not be | 9646 | while (true) { |
8806 | // overwritten while composition continues. | 9647 | var node = startNode.nextSibling; |
8807 | if (!currentComposition && eventType === eventTypes.compositionStart) { | 9648 | if (node === closingComment) { |
8808 | currentComposition = FallbackCompositionState.getPooled(topLevelTarget); | 9649 | // The closing comment is removed by ReactMultiChild. |
8809 | } else if (eventType === eventTypes.compositionEnd) { | 9650 | break; |
8810 | if (currentComposition) { | 9651 | } else { |
8811 | fallbackData = currentComposition.getData(); | 9652 | parentNode.removeChild(node); |
8812 | } | ||
8813 | } | 9653 | } |
8814 | } | 9654 | } |
9655 | } | ||
8815 | 9656 | ||
8816 | var event = SyntheticCompositionEvent.getPooled(eventType, topLevelTargetID, nativeEvent, nativeEventTarget); | 9657 | function replaceDelimitedText(openingComment, closingComment, stringText) { |
8817 | 9658 | var parentNode = openingComment.parentNode; | |
8818 | if (fallbackData) { | 9659 | var nodeAfterComment = openingComment.nextSibling; |
8819 | // Inject data generated from fallback path into the synthetic event. | 9660 | if (nodeAfterComment === closingComment) { |
8820 | // This matches the property of native CompositionEventInterface. | 9661 | // There are no text nodes between the opening and closing comments; insert |
8821 | event.data = fallbackData; | 9662 | // a new one if stringText isn't empty. |
9663 | if (stringText) { | ||
9664 | insertChildAt(parentNode, document.createTextNode(stringText), nodeAfterComment); | ||
9665 | } | ||
8822 | } else { | 9666 | } else { |
8823 | var customData = getDataFromCustomEvent(nativeEvent); | 9667 | if (stringText) { |
8824 | if (customData !== null) { | 9668 | // Set the text content of the first node after the opening comment, and |
8825 | event.data = customData; | 9669 | // remove all following nodes up until the closing comment. |
9670 | setTextContent(nodeAfterComment, stringText); | ||
9671 | removeDelimitedText(parentNode, nodeAfterComment, closingComment); | ||
9672 | } else { | ||
9673 | removeDelimitedText(parentNode, openingComment, closingComment); | ||
8826 | } | 9674 | } |
8827 | } | 9675 | } |
8828 | 9676 | ||
8829 | EventPropagators.accumulateTwoPhaseDispatches(event); | 9677 | if (process.env.NODE_ENV !== 'production') { |
8830 | return event; | 9678 | ReactInstrumentation.debugTool.onHostOperation(ReactDOMComponentTree.getInstanceFromNode(openingComment)._debugID, 'replace text', stringText); |
8831 | } | ||
8832 | |||
8833 | /** | ||
8834 | * @param {string} topLevelType Record from `EventConstants`. | ||
8835 | * @param {object} nativeEvent Native browser event. | ||
8836 | * @return {?string} The string corresponding to this `beforeInput` event. | ||
8837 | */ | ||
8838 | function getNativeBeforeInputChars(topLevelType, nativeEvent) { | ||
8839 | switch (topLevelType) { | ||
8840 | case topLevelTypes.topCompositionEnd: | ||
8841 | return getDataFromCustomEvent(nativeEvent); | ||
8842 | case topLevelTypes.topKeyPress: | ||
8843 | /** | ||
8844 | * If native `textInput` events are available, our goal is to make | ||
8845 | * use of them. However, there is a special case: the spacebar key. | ||
8846 | * In Webkit, preventing default on a spacebar `textInput` event | ||
8847 | * cancels character insertion, but it *also* causes the browser | ||
8848 | * to fall back to its default spacebar behavior of scrolling the | ||
8849 | * page. | ||
8850 | * | ||
8851 | * Tracking at: | ||
8852 | * https://code.google.com/p/chromium/issues/detail?id=355103 | ||
8853 | * | ||
8854 | * To avoid this issue, use the keypress event as if no `textInput` | ||
8855 | * event is available. | ||
8856 | */ | ||
8857 | var which = nativeEvent.which; | ||
8858 | if (which !== SPACEBAR_CODE) { | ||
8859 | return null; | ||
8860 | } | ||
8861 | |||
8862 | hasSpaceKeypress = true; | ||
8863 | return SPACEBAR_CHAR; | ||
8864 | |||
8865 | case topLevelTypes.topTextInput: | ||
8866 | // Record the characters to be added to the DOM. | ||
8867 | var chars = nativeEvent.data; | ||
8868 | |||
8869 | // If it's a spacebar character, assume that we have already handled | ||
8870 | // it at the keypress level and bail immediately. Android Chrome | ||
8871 | // doesn't give us keycodes, so we need to blacklist it. | ||
8872 | if (chars === SPACEBAR_CHAR && hasSpaceKeypress) { | ||
8873 | return null; | ||
8874 | } | ||
8875 | |||
8876 | return chars; | ||
8877 | |||
8878 | default: | ||
8879 | // For other native event types, do nothing. | ||
8880 | return null; | ||
8881 | } | 9679 | } |
8882 | } | 9680 | } |
8883 | 9681 | ||
8884 | /** | 9682 | var dangerouslyReplaceNodeWithMarkup = Danger.dangerouslyReplaceNodeWithMarkup; |
8885 | * For browsers that do not provide the `textInput` event, extract the | 9683 | if (process.env.NODE_ENV !== 'production') { |
8886 | * appropriate string to use for SyntheticInputEvent. | 9684 | dangerouslyReplaceNodeWithMarkup = function (oldChild, markup, prevInstance) { |
8887 | * | 9685 | Danger.dangerouslyReplaceNodeWithMarkup(oldChild, markup); |
8888 | * @param {string} topLevelType Record from `EventConstants`. | 9686 | if (prevInstance._debugID !== 0) { |
8889 | * @param {object} nativeEvent Native browser event. | 9687 | ReactInstrumentation.debugTool.onHostOperation(prevInstance._debugID, 'replace with', markup.toString()); |
8890 | * @return {?string} The fallback string for this `beforeInput` event. | 9688 | } else { |
8891 | */ | 9689 | var nextInstance = ReactDOMComponentTree.getInstanceFromNode(markup.node); |
8892 | function getFallbackBeforeInputChars(topLevelType, nativeEvent) { | 9690 | if (nextInstance._debugID !== 0) { |
8893 | // If we are currently composing (IME) and using a fallback to do so, | 9691 | ReactInstrumentation.debugTool.onHostOperation(nextInstance._debugID, 'mount', markup.toString()); |
8894 | // try to extract the composed characters from the fallback object. | ||
8895 | if (currentComposition) { | ||
8896 | if (topLevelType === topLevelTypes.topCompositionEnd || isFallbackCompositionEnd(topLevelType, nativeEvent)) { | ||
8897 | var chars = currentComposition.getData(); | ||
8898 | FallbackCompositionState.release(currentComposition); | ||
8899 | currentComposition = null; | ||
8900 | return chars; | ||
8901 | } | ||
8902 | return null; | ||
8903 | } | ||
8904 | |||
8905 | switch (topLevelType) { | ||
8906 | case topLevelTypes.topPaste: | ||
8907 | // If a paste event occurs after a keypress, throw out the input | ||
8908 | // chars. Paste events should not lead to BeforeInput events. | ||
8909 | return null; | ||
8910 | case topLevelTypes.topKeyPress: | ||
8911 | /** | ||
8912 | * As of v27, Firefox may fire keypress events even when no character | ||
8913 | * will be inserted. A few possibilities: | ||
8914 | * | ||
8915 | * - `which` is `0`. Arrow keys, Esc key, etc. | ||
8916 | * | ||
8917 | * - `which` is the pressed key code, but no char is available. | ||
8918 | * Ex: 'AltGr + d` in Polish. There is no modified character for | ||
8919 | * this key combination and no character is inserted into the | ||
8920 | * document, but FF fires the keypress for char code `100` anyway. | ||
8921 | * No `input` event will occur. | ||
8922 | * | ||
8923 | * - `which` is the pressed key code, but a command combination is | ||
8924 | * being used. Ex: `Cmd+C`. No character is inserted, and no | ||
8925 | * `input` event will occur. | ||
8926 | */ | ||
8927 | if (nativeEvent.which && !isKeypressCommand(nativeEvent)) { | ||
8928 | return String.fromCharCode(nativeEvent.which); | ||
8929 | } | 9692 | } |
8930 | return null; | 9693 | } |
8931 | case topLevelTypes.topCompositionEnd: | 9694 | }; |
8932 | return useFallbackCompositionData ? null : nativeEvent.data; | ||
8933 | default: | ||
8934 | return null; | ||
8935 | } | ||
8936 | } | 9695 | } |
8937 | 9696 | ||
8938 | /** | 9697 | /** |
8939 | * Extract a SyntheticInputEvent for `beforeInput`, based on either native | 9698 | * Operations for updating with DOM children. |
8940 | * `textInput` or fallback behavior. | ||
8941 | * | ||
8942 | * @param {string} topLevelType Record from `EventConstants`. | ||
8943 | * @param {DOMEventTarget} topLevelTarget The listening component root node. | ||
8944 | * @param {string} topLevelTargetID ID of `topLevelTarget`. | ||
8945 | * @param {object} nativeEvent Native browser event. | ||
8946 | * @return {?object} A SyntheticInputEvent. | ||
8947 | */ | 9699 | */ |
8948 | function extractBeforeInputEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) { | 9700 | var DOMChildrenOperations = { |
8949 | var chars; | ||
8950 | |||
8951 | if (canUseTextInputEvent) { | ||
8952 | chars = getNativeBeforeInputChars(topLevelType, nativeEvent); | ||
8953 | } else { | ||
8954 | chars = getFallbackBeforeInputChars(topLevelType, nativeEvent); | ||
8955 | } | ||
8956 | |||
8957 | // If no characters are being inserted, no BeforeInput event should | ||
8958 | // be fired. | ||
8959 | if (!chars) { | ||
8960 | return null; | ||
8961 | } | ||
8962 | |||
8963 | var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, topLevelTargetID, nativeEvent, nativeEventTarget); | ||
8964 | |||
8965 | event.data = chars; | ||
8966 | EventPropagators.accumulateTwoPhaseDispatches(event); | ||
8967 | return event; | ||
8968 | } | ||
8969 | 9701 | ||
8970 | /** | 9702 | dangerouslyReplaceNodeWithMarkup: dangerouslyReplaceNodeWithMarkup, |
8971 | * Create an `onBeforeInput` event to match | ||
8972 | * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents. | ||
8973 | * | ||
8974 | * This event plugin is based on the native `textInput` event | ||
8975 | * available in Chrome, Safari, Opera, and IE. This event fires after | ||
8976 | * `onKeyPress` and `onCompositionEnd`, but before `onInput`. | ||
8977 | * | ||
8978 | * `beforeInput` is spec'd but not implemented in any browsers, and | ||
8979 | * the `input` event does not provide any useful information about what has | ||
8980 | * actually been added, contrary to the spec. Thus, `textInput` is the best | ||
8981 | * available event to identify the characters that have actually been inserted | ||
8982 | * into the target node. | ||
8983 | * | ||
8984 | * This plugin is also responsible for emitting `composition` events, thus | ||
8985 | * allowing us to share composition fallback code for both `beforeInput` and | ||
8986 | * `composition` event types. | ||
8987 | */ | ||
8988 | var BeforeInputEventPlugin = { | ||
8989 | 9703 | ||
8990 | eventTypes: eventTypes, | 9704 | replaceDelimitedText: replaceDelimitedText, |
8991 | 9705 | ||
8992 | /** | 9706 | /** |
8993 | * @param {string} topLevelType Record from `EventConstants`. | 9707 | * Updates a component's children by processing a series of updates. The |
8994 | * @param {DOMEventTarget} topLevelTarget The listening component root node. | 9708 | * update configurations are each expected to have a `parentNode` property. |
8995 | * @param {string} topLevelTargetID ID of `topLevelTarget`. | 9709 | * |
8996 | * @param {object} nativeEvent Native browser event. | 9710 | * @param {array<object>} updates List of update configurations. |
8997 | * @return {*} An accumulation of synthetic events. | 9711 | * @internal |
8998 | * @see {EventPluginHub.extractEvents} | ||
8999 | */ | 9712 | */ |
9000 | extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) { | 9713 | processUpdates: function (parentNode, updates) { |
9001 | return [extractCompositionEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget), extractBeforeInputEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget)]; | 9714 | if (process.env.NODE_ENV !== 'production') { |
9715 | var parentNodeDebugID = ReactDOMComponentTree.getInstanceFromNode(parentNode)._debugID; | ||
9716 | } | ||
9717 | |||
9718 | for (var k = 0; k < updates.length; k++) { | ||
9719 | var update = updates[k]; | ||
9720 | switch (update.type) { | ||
9721 | case ReactMultiChildUpdateTypes.INSERT_MARKUP: | ||
9722 | insertLazyTreeChildAt(parentNode, update.content, getNodeAfter(parentNode, update.afterNode)); | ||
9723 | if (process.env.NODE_ENV !== 'production') { | ||
9724 | ReactInstrumentation.debugTool.onHostOperation(parentNodeDebugID, 'insert child', { toIndex: update.toIndex, content: update.content.toString() }); | ||
9725 | } | ||
9726 | break; | ||
9727 | case ReactMultiChildUpdateTypes.MOVE_EXISTING: | ||
9728 | moveChild(parentNode, update.fromNode, getNodeAfter(parentNode, update.afterNode)); | ||
9729 | if (process.env.NODE_ENV !== 'production') { | ||
9730 | ReactInstrumentation.debugTool.onHostOperation(parentNodeDebugID, 'move child', { fromIndex: update.fromIndex, toIndex: update.toIndex }); | ||
9731 | } | ||
9732 | break; | ||
9733 | case ReactMultiChildUpdateTypes.SET_MARKUP: | ||
9734 | setInnerHTML(parentNode, update.content); | ||
9735 | if (process.env.NODE_ENV !== 'production') { | ||
9736 | ReactInstrumentation.debugTool.onHostOperation(parentNodeDebugID, 'replace children', update.content.toString()); | ||
9737 | } | ||
9738 | break; | ||
9739 | case ReactMultiChildUpdateTypes.TEXT_CONTENT: | ||
9740 | setTextContent(parentNode, update.content); | ||
9741 | if (process.env.NODE_ENV !== 'production') { | ||
9742 | ReactInstrumentation.debugTool.onHostOperation(parentNodeDebugID, 'replace text', update.content.toString()); | ||
9743 | } | ||
9744 | break; | ||
9745 | case ReactMultiChildUpdateTypes.REMOVE_NODE: | ||
9746 | removeChild(parentNode, update.fromNode); | ||
9747 | if (process.env.NODE_ENV !== 'production') { | ||
9748 | ReactInstrumentation.debugTool.onHostOperation(parentNodeDebugID, 'remove child', { fromIndex: update.fromIndex }); | ||
9749 | } | ||
9750 | break; | ||
9751 | } | ||
9752 | } | ||
9002 | } | 9753 | } |
9754 | |||
9003 | }; | 9755 | }; |
9004 | 9756 | ||
9005 | module.exports = BeforeInputEventPlugin; | 9757 | module.exports = DOMChildrenOperations; |
9758 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
9006 | 9759 | ||
9007 | /***/ }, | 9760 | /***/ }, |
9008 | /* 75 */ | 9761 | /* 85 */ |
9009 | /***/ function(module, exports, __webpack_require__) { | 9762 | /***/ function(module, exports, __webpack_require__) { |
9010 | 9763 | ||
9011 | /* WEBPACK VAR INJECTION */(function(process) {/** | 9764 | /** |
9012 | * Copyright 2013-2015, Facebook, Inc. | 9765 | * Copyright 2015-present, Facebook, Inc. |
9013 | * All rights reserved. | 9766 | * All rights reserved. |
9014 | * | 9767 | * |
9015 | * This source code is licensed under the BSD-style license found in the | 9768 | * This source code is licensed under the BSD-style license found in the |
9016 | * LICENSE file in the root directory of this source tree. An additional grant | 9769 | * LICENSE file in the root directory of this source tree. An additional grant |
9017 | * of patent rights can be found in the PATENTS file in the same directory. | 9770 | * of patent rights can be found in the PATENTS file in the same directory. |
9018 | * | 9771 | * |
9019 | * @providesModule EventPropagators | 9772 | * @providesModule DOMLazyTree |
9020 | */ | 9773 | */ |
9021 | 9774 | ||
9022 | 'use strict'; | 9775 | 'use strict'; |
9023 | 9776 | ||
9024 | var EventConstants = __webpack_require__(32); | 9777 | var DOMNamespaces = __webpack_require__(86); |
9025 | var EventPluginHub = __webpack_require__(33); | 9778 | var setInnerHTML = __webpack_require__(87); |
9026 | |||
9027 | var warning = __webpack_require__(27); | ||
9028 | 9779 | ||
9029 | var accumulateInto = __webpack_require__(37); | 9780 | var createMicrosoftUnsafeLocalFunction = __webpack_require__(88); |
9030 | var forEachAccumulated = __webpack_require__(38); | 9781 | var setTextContent = __webpack_require__(89); |
9031 | 9782 | ||
9032 | var PropagationPhases = EventConstants.PropagationPhases; | 9783 | var ELEMENT_NODE_TYPE = 1; |
9033 | var getListener = EventPluginHub.getListener; | 9784 | var DOCUMENT_FRAGMENT_NODE_TYPE = 11; |
9034 | 9785 | ||
9035 | /** | 9786 | /** |
9036 | * Some event types have a notion of different registration names for different | 9787 | * In IE (8-11) and Edge, appending nodes with no children is dramatically |
9037 | * "phases" of propagation. This finds listeners by a given phase. | 9788 | * faster than appending a full subtree, so we essentially queue up the |
9789 | * .appendChild calls here and apply them so each node is added to its parent | ||
9790 | * before any children are added. | ||
9791 | * | ||
9792 | * In other browsers, doing so is slower or neutral compared to the other order | ||
9793 | * (in Firefox, twice as slow) so we only do this inversion in IE. | ||
9794 | * | ||
9795 | * See https://github.com/spicyj/innerhtml-vs-createelement-vs-clonenode. | ||
9038 | */ | 9796 | */ |
9039 | function listenerAtPhase(id, event, propagationPhase) { | 9797 | var enableLazy = typeof document !== 'undefined' && typeof document.documentMode === 'number' || typeof navigator !== 'undefined' && typeof navigator.userAgent === 'string' && /\bEdge\/\d/.test(navigator.userAgent); |
9040 | var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase]; | ||
9041 | return getListener(id, registrationName); | ||
9042 | } | ||
9043 | 9798 | ||
9044 | /** | 9799 | function insertTreeChildren(tree) { |
9045 | * Tags a `SyntheticEvent` with dispatched listeners. Creating this function | 9800 | if (!enableLazy) { |
9046 | * here, allows us to not have to bind or create functions for each event. | 9801 | return; |
9047 | * Mutating the event's members allows us to not have to create a wrapping | ||
9048 | * "dispatch" object that pairs the event with the listener. | ||
9049 | */ | ||
9050 | function accumulateDirectionalDispatches(domID, upwards, event) { | ||
9051 | if (process.env.NODE_ENV !== 'production') { | ||
9052 | process.env.NODE_ENV !== 'production' ? warning(domID, 'Dispatching id must not be null') : undefined; | ||
9053 | } | 9802 | } |
9054 | var phase = upwards ? PropagationPhases.bubbled : PropagationPhases.captured; | 9803 | var node = tree.node; |
9055 | var listener = listenerAtPhase(domID, event, phase); | 9804 | var children = tree.children; |
9056 | if (listener) { | 9805 | if (children.length) { |
9057 | event._dispatchListeners = accumulateInto(event._dispatchListeners, listener); | 9806 | for (var i = 0; i < children.length; i++) { |
9058 | event._dispatchIDs = accumulateInto(event._dispatchIDs, domID); | 9807 | insertTreeBefore(node, children[i], null); |
9808 | } | ||
9809 | } else if (tree.html != null) { | ||
9810 | setInnerHTML(node, tree.html); | ||
9811 | } else if (tree.text != null) { | ||
9812 | setTextContent(node, tree.text); | ||
9059 | } | 9813 | } |
9060 | } | 9814 | } |
9061 | 9815 | ||
9062 | /** | 9816 | var insertTreeBefore = createMicrosoftUnsafeLocalFunction(function (parentNode, tree, referenceNode) { |
9063 | * Collect dispatches (must be entirely collected before dispatching - see unit | 9817 | // DocumentFragments aren't actually part of the DOM after insertion so |
9064 | * tests). Lazily allocate the array to conserve memory. We must loop through | 9818 | // appending children won't update the DOM. We need to ensure the fragment |
9065 | * each event and perform the traversal for each one. We cannot perform a | 9819 | // is properly populated first, breaking out of our lazy approach for just |
9066 | * single traversal for the entire collection of events because each event may | 9820 | // this level. Also, some <object> plugins (like Flash Player) will read |
9067 | * have a different target. | 9821 | // <param> nodes immediately upon insertion into the DOM, so <object> |
9068 | */ | 9822 | // must also be populated prior to insertion into the DOM. |
9069 | function accumulateTwoPhaseDispatchesSingle(event) { | 9823 | 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)) { |
9070 | if (event && event.dispatchConfig.phasedRegistrationNames) { | 9824 | insertTreeChildren(tree); |
9071 | EventPluginHub.injection.getInstanceHandle().traverseTwoPhase(event.dispatchMarker, accumulateDirectionalDispatches, event); | 9825 | parentNode.insertBefore(tree.node, referenceNode); |
9826 | } else { | ||
9827 | parentNode.insertBefore(tree.node, referenceNode); | ||
9828 | insertTreeChildren(tree); | ||
9072 | } | 9829 | } |
9073 | } | 9830 | }); |
9074 | 9831 | ||
9075 | /** | 9832 | function replaceChildWithTree(oldNode, newTree) { |
9076 | * Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID. | 9833 | oldNode.parentNode.replaceChild(newTree.node, oldNode); |
9077 | */ | 9834 | insertTreeChildren(newTree); |
9078 | function accumulateTwoPhaseDispatchesSingleSkipTarget(event) { | ||
9079 | if (event && event.dispatchConfig.phasedRegistrationNames) { | ||
9080 | EventPluginHub.injection.getInstanceHandle().traverseTwoPhaseSkipTarget(event.dispatchMarker, accumulateDirectionalDispatches, event); | ||
9081 | } | ||
9082 | } | 9835 | } |
9083 | 9836 | ||
9084 | /** | 9837 | function queueChild(parentTree, childTree) { |
9085 | * Accumulates without regard to direction, does not look for phased | 9838 | if (enableLazy) { |
9086 | * registration names. Same as `accumulateDirectDispatchesSingle` but without | 9839 | parentTree.children.push(childTree); |
9087 | * requiring that the `dispatchMarker` be the same as the dispatched ID. | 9840 | } else { |
9088 | */ | 9841 | parentTree.node.appendChild(childTree.node); |
9089 | function accumulateDispatches(id, ignoredDirection, event) { | ||
9090 | if (event && event.dispatchConfig.registrationName) { | ||
9091 | var registrationName = event.dispatchConfig.registrationName; | ||
9092 | var listener = getListener(id, registrationName); | ||
9093 | if (listener) { | ||
9094 | event._dispatchListeners = accumulateInto(event._dispatchListeners, listener); | ||
9095 | event._dispatchIDs = accumulateInto(event._dispatchIDs, id); | ||
9096 | } | ||
9097 | } | 9842 | } |
9098 | } | 9843 | } |
9099 | 9844 | ||
9100 | /** | 9845 | function queueHTML(tree, html) { |
9101 | * Accumulates dispatches on an `SyntheticEvent`, but only for the | 9846 | if (enableLazy) { |
9102 | * `dispatchMarker`. | 9847 | tree.html = html; |
9103 | * @param {SyntheticEvent} event | 9848 | } else { |
9104 | */ | 9849 | setInnerHTML(tree.node, html); |
9105 | function accumulateDirectDispatchesSingle(event) { | ||
9106 | if (event && event.dispatchConfig.registrationName) { | ||
9107 | accumulateDispatches(event.dispatchMarker, null, event); | ||
9108 | } | 9850 | } |
9109 | } | 9851 | } |
9110 | 9852 | ||
9111 | function accumulateTwoPhaseDispatches(events) { | 9853 | function queueText(tree, text) { |
9112 | forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle); | 9854 | if (enableLazy) { |
9855 | tree.text = text; | ||
9856 | } else { | ||
9857 | setTextContent(tree.node, text); | ||
9858 | } | ||
9113 | } | 9859 | } |
9114 | 9860 | ||
9115 | function accumulateTwoPhaseDispatchesSkipTarget(events) { | 9861 | function toString() { |
9116 | forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget); | 9862 | return this.node.nodeName; |
9117 | } | 9863 | } |
9118 | 9864 | ||
9119 | function accumulateEnterLeaveDispatches(leave, enter, fromID, toID) { | 9865 | function DOMLazyTree(node) { |
9120 | EventPluginHub.injection.getInstanceHandle().traverseEnterLeave(fromID, toID, accumulateDispatches, leave, enter); | 9866 | return { |
9867 | node: node, | ||
9868 | children: [], | ||
9869 | html: null, | ||
9870 | text: null, | ||
9871 | toString: toString | ||
9872 | }; | ||
9121 | } | 9873 | } |
9122 | 9874 | ||
9123 | function accumulateDirectDispatches(events) { | 9875 | DOMLazyTree.insertTreeBefore = insertTreeBefore; |
9124 | forEachAccumulated(events, accumulateDirectDispatchesSingle); | 9876 | DOMLazyTree.replaceChildWithTree = replaceChildWithTree; |
9125 | } | 9877 | DOMLazyTree.queueChild = queueChild; |
9878 | DOMLazyTree.queueHTML = queueHTML; | ||
9879 | DOMLazyTree.queueText = queueText; | ||
9126 | 9880 | ||
9881 | module.exports = DOMLazyTree; | ||
9882 | |||
9883 | /***/ }, | ||
9884 | /* 86 */ | ||
9885 | /***/ function(module, exports) { | ||
9886 | |||
9127 | /** | 9887 | /** |
9128 | * A small set of propagation patterns, each of which will accept a small amount | 9888 | * Copyright 2013-present, Facebook, Inc. |
9129 | * of information, and generate a set of "dispatch ready event objects" - which | 9889 | * All rights reserved. |
9130 | * are sets of events that have already been annotated with a set of dispatched | ||
9131 | * listener functions/ids. The API is designed this way to discourage these | ||
9132 | * propagation strategies from actually executing the dispatches, since we | ||
9133 | * always want to collect the entire set of dispatches before executing event a | ||
9134 | * single one. | ||
9135 | * | 9890 | * |
9136 | * @constructor EventPropagators | 9891 | * This source code is licensed under the BSD-style license found in the |
9892 | * LICENSE file in the root directory of this source tree. An additional grant | ||
9893 | * of patent rights can be found in the PATENTS file in the same directory. | ||
9894 | * | ||
9895 | * @providesModule DOMNamespaces | ||
9137 | */ | 9896 | */ |
9138 | var EventPropagators = { | 9897 | |
9139 | accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches, | 9898 | 'use strict'; |
9140 | accumulateTwoPhaseDispatchesSkipTarget: accumulateTwoPhaseDispatchesSkipTarget, | 9899 | |
9141 | accumulateDirectDispatches: accumulateDirectDispatches, | 9900 | var DOMNamespaces = { |
9142 | accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches | 9901 | html: 'http://www.w3.org/1999/xhtml', |
9902 | mathml: 'http://www.w3.org/1998/Math/MathML', | ||
9903 | svg: 'http://www.w3.org/2000/svg' | ||
9143 | }; | 9904 | }; |
9144 | 9905 | ||
9145 | module.exports = EventPropagators; | 9906 | module.exports = DOMNamespaces; |
9146 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
9147 | 9907 | ||
9148 | /***/ }, | 9908 | /***/ }, |
9149 | /* 76 */ | 9909 | /* 87 */ |
9150 | /***/ function(module, exports, __webpack_require__) { | 9910 | /***/ function(module, exports, __webpack_require__) { |
9151 | 9911 | ||
9152 | /** | 9912 | /** |
9153 | * Copyright 2013-2015, Facebook, Inc. | 9913 | * Copyright 2013-present, Facebook, Inc. |
9154 | * All rights reserved. | 9914 | * All rights reserved. |
9155 | * | 9915 | * |
9156 | * This source code is licensed under the BSD-style license found in the | 9916 | * This source code is licensed under the BSD-style license found in the |
9157 | * LICENSE file in the root directory of this source tree. An additional grant | 9917 | * LICENSE file in the root directory of this source tree. An additional grant |
9158 | * of patent rights can be found in the PATENTS file in the same directory. | 9918 | * of patent rights can be found in the PATENTS file in the same directory. |
9159 | * | 9919 | * |
9160 | * @providesModule FallbackCompositionState | 9920 | * @providesModule setInnerHTML |
9161 | * @typechecks static-only | ||
9162 | */ | 9921 | */ |
9163 | 9922 | ||
9164 | 'use strict'; | 9923 | 'use strict'; |
9165 | 9924 | ||
9166 | var PooledClass = __webpack_require__(58); | 9925 | var ExecutionEnvironment = __webpack_require__(52); |
9926 | var DOMNamespaces = __webpack_require__(86); | ||
9927 | |||
9928 | var WHITESPACE_TEST = /^[ \r\n\t\f]/; | ||
9929 | var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/; | ||
9930 | |||
9931 | var createMicrosoftUnsafeLocalFunction = __webpack_require__(88); | ||
9167 | 9932 | ||
9168 | var assign = __webpack_require__(41); | 9933 | // SVG temp container for IE lacking innerHTML |
9169 | var getTextContentAccessor = __webpack_require__(77); | 9934 | var reusableSVGContainer; |
9170 | 9935 | ||
9171 | /** | 9936 | /** |
9172 | * This helper class stores information about text content of a target node, | 9937 | * Set the innerHTML property of a node, ensuring that whitespace is preserved |
9173 | * allowing comparison of content before and after a given event. | 9938 | * even in IE8. |
9174 | * | ||
9175 | * Identify the node where selection currently begins, then observe | ||
9176 | * both its text content and its current position in the DOM. Since the | ||
9177 | * browser may natively replace the target node during composition, we can | ||
9178 | * use its position to find its replacement. | ||
9179 | * | 9939 | * |
9180 | * @param {DOMEventTarget} root | 9940 | * @param {DOMElement} node |
9941 | * @param {string} html | ||
9942 | * @internal | ||
9181 | */ | 9943 | */ |
9182 | function FallbackCompositionState(root) { | 9944 | var setInnerHTML = createMicrosoftUnsafeLocalFunction(function (node, html) { |
9183 | this._root = root; | 9945 | // IE does not have innerHTML for SVG nodes, so instead we inject the |
9184 | this._startText = this.getText(); | 9946 | // new markup in a temp node and then move the child nodes across into |
9185 | this._fallbackText = null; | 9947 | // the target node |
9186 | } | 9948 | if (node.namespaceURI === DOMNamespaces.svg && !('innerHTML' in node)) { |
9187 | 9949 | reusableSVGContainer = reusableSVGContainer || document.createElement('div'); | |
9188 | assign(FallbackCompositionState.prototype, { | 9950 | reusableSVGContainer.innerHTML = '<svg>' + html + '</svg>'; |
9189 | destructor: function () { | 9951 | var newNodes = reusableSVGContainer.firstChild.childNodes; |
9190 | this._root = null; | 9952 | for (var i = 0; i < newNodes.length; i++) { |
9191 | this._startText = null; | 9953 | node.appendChild(newNodes[i]); |
9192 | this._fallbackText = null; | ||
9193 | }, | ||
9194 | |||
9195 | /** | ||
9196 | * Get current text of input. | ||
9197 | * | ||
9198 | * @return {string} | ||
9199 | */ | ||
9200 | getText: function () { | ||
9201 | if ('value' in this._root) { | ||
9202 | return this._root.value; | ||
9203 | } | ||
9204 | return this._root[getTextContentAccessor()]; | ||
9205 | }, | ||
9206 | |||
9207 | /** | ||
9208 | * Determine the differing substring between the initially stored | ||
9209 | * text content and the current content. | ||
9210 | * | ||
9211 | * @return {string} | ||
9212 | */ | ||
9213 | getData: function () { | ||
9214 | if (this._fallbackText) { | ||
9215 | return this._fallbackText; | ||
9216 | } | 9954 | } |
9955 | } else { | ||
9956 | node.innerHTML = html; | ||
9957 | } | ||
9958 | }); | ||
9217 | 9959 | ||
9218 | var start; | 9960 | if (ExecutionEnvironment.canUseDOM) { |
9219 | var startValue = this._startText; | 9961 | // IE8: When updating a just created node with innerHTML only leading |
9220 | var startLength = startValue.length; | 9962 | // whitespace is removed. When updating an existing node with innerHTML |
9221 | var end; | 9963 | // whitespace in root TextNodes is also collapsed. |
9222 | var endValue = this.getText(); | 9964 | // @see quirksmode.org/bugreports/archives/2004/11/innerhtml_and_t.html |
9223 | var endLength = endValue.length; | ||
9224 | 9965 | ||
9225 | for (start = 0; start < startLength; start++) { | 9966 | // Feature detection; only IE8 is known to behave improperly like this. |
9226 | if (startValue[start] !== endValue[start]) { | 9967 | var testElement = document.createElement('div'); |
9227 | break; | 9968 | testElement.innerHTML = ' '; |
9969 | if (testElement.innerHTML === '') { | ||
9970 | setInnerHTML = function (node, html) { | ||
9971 | // Magic theory: IE8 supposedly differentiates between added and updated | ||
9972 | // nodes when processing innerHTML, innerHTML on updated nodes suffers | ||
9973 | // from worse whitespace behavior. Re-adding a node like this triggers | ||
9974 | // the initial and more favorable whitespace behavior. | ||
9975 | // TODO: What to do on a detached node? | ||
9976 | if (node.parentNode) { | ||
9977 | node.parentNode.replaceChild(node, node); | ||
9228 | } | 9978 | } |
9229 | } | ||
9230 | 9979 | ||
9231 | var minEnd = startLength - start; | 9980 | // We also implement a workaround for non-visible tags disappearing into |
9232 | for (end = 1; end <= minEnd; end++) { | 9981 | // thin air on IE8, this only happens if there is no visible text |
9233 | if (startValue[startLength - end] !== endValue[endLength - end]) { | 9982 | // in-front of the non-visible tags. Piggyback on the whitespace fix |
9234 | break; | 9983 | // and simply check if any non-visible tags appear in the source. |
9235 | } | 9984 | if (WHITESPACE_TEST.test(html) || html[0] === '<' && NONVISIBLE_TEST.test(html)) { |
9236 | } | 9985 | // Recover leading whitespace by temporarily prepending any character. |
9986 | // \uFEFF has the potential advantage of being zero-width/invisible. | ||
9987 | // UglifyJS drops U+FEFF chars when parsing, so use String.fromCharCode | ||
9988 | // in hopes that this is preserved even if "\uFEFF" is transformed to | ||
9989 | // the actual Unicode character (by Babel, for example). | ||
9990 | // https://github.com/mishoo/UglifyJS2/blob/v2.4.20/lib/parse.js#L216 | ||
9991 | node.innerHTML = String.fromCharCode(0xFEFF) + html; | ||
9237 | 9992 | ||
9238 | var sliceTail = end > 1 ? 1 - end : undefined; | 9993 | // deleteData leaves an empty `TextNode` which offsets the index of all |
9239 | this._fallbackText = endValue.slice(start, sliceTail); | 9994 | // children. Definitely want to avoid this. |
9240 | return this._fallbackText; | 9995 | var textNode = node.firstChild; |
9996 | if (textNode.data.length === 1) { | ||
9997 | node.removeChild(textNode); | ||
9998 | } else { | ||
9999 | textNode.deleteData(0, 1); | ||
10000 | } | ||
10001 | } else { | ||
10002 | node.innerHTML = html; | ||
10003 | } | ||
10004 | }; | ||
9241 | } | 10005 | } |
9242 | }); | 10006 | testElement = null; |
9243 | 10007 | } | |
9244 | PooledClass.addPoolingTo(FallbackCompositionState); | ||
9245 | 10008 | ||
9246 | module.exports = FallbackCompositionState; | 10009 | module.exports = setInnerHTML; |
9247 | 10010 | ||
9248 | /***/ }, | 10011 | /***/ }, |
9249 | /* 77 */ | 10012 | /* 88 */ |
9250 | /***/ function(module, exports, __webpack_require__) { | 10013 | /***/ function(module, exports) { |
9251 | 10014 | ||
9252 | /** | 10015 | /** |
9253 | * Copyright 2013-2015, Facebook, Inc. | 10016 | * Copyright 2013-present, Facebook, Inc. |
9254 | * All rights reserved. | 10017 | * All rights reserved. |
9255 | * | 10018 | * |
9256 | * This source code is licensed under the BSD-style license found in the | 10019 | * This source code is licensed under the BSD-style license found in the |
9257 | * LICENSE file in the root directory of this source tree. An additional grant | 10020 | * LICENSE file in the root directory of this source tree. An additional grant |
9258 | * of patent rights can be found in the PATENTS file in the same directory. | 10021 | * of patent rights can be found in the PATENTS file in the same directory. |
9259 | * | 10022 | * |
9260 | * @providesModule getTextContentAccessor | 10023 | * @providesModule createMicrosoftUnsafeLocalFunction |
9261 | */ | 10024 | */ |
9262 | 10025 | ||
9263 | 'use strict'; | 10026 | /* globals MSApp */ |
9264 | |||
9265 | var ExecutionEnvironment = __webpack_require__(11); | ||
9266 | 10027 | ||
9267 | var contentKey = null; | 10028 | 'use strict'; |
9268 | 10029 | ||
9269 | /** | 10030 | /** |
9270 | * Gets the key used to access text content on a DOM node. | 10031 | * Create a function which has 'unsafe' privileges (required by windows8 apps) |
9271 | * | ||
9272 | * @return {?string} Key used to access text content. | ||
9273 | * @internal | ||
9274 | */ | 10032 | */ |
9275 | function getTextContentAccessor() { | 10033 | |
9276 | if (!contentKey && ExecutionEnvironment.canUseDOM) { | 10034 | var createMicrosoftUnsafeLocalFunction = function (func) { |
9277 | // Prefer textContent to innerText because many browsers support both but | 10035 | if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) { |
9278 | // SVG <text> elements don't support innerText even when <div> does. | 10036 | return function (arg0, arg1, arg2, arg3) { |
9279 | contentKey = 'textContent' in document.documentElement ? 'textContent' : 'innerText'; | 10037 | MSApp.execUnsafeLocalFunction(function () { |
10038 | return func(arg0, arg1, arg2, arg3); | ||
10039 | }); | ||
10040 | }; | ||
10041 | } else { | ||
10042 | return func; | ||
9280 | } | 10043 | } |
9281 | return contentKey; | 10044 | }; |
9282 | } | ||
9283 | 10045 | ||
9284 | module.exports = getTextContentAccessor; | 10046 | module.exports = createMicrosoftUnsafeLocalFunction; |
9285 | 10047 | ||
9286 | /***/ }, | 10048 | /***/ }, |
9287 | /* 78 */ | 10049 | /* 89 */ |
9288 | /***/ function(module, exports, __webpack_require__) { | 10050 | /***/ function(module, exports, __webpack_require__) { |
9289 | 10051 | ||
9290 | /** | 10052 | /** |
9291 | * Copyright 2013-2015, Facebook, Inc. | 10053 | * Copyright 2013-present, Facebook, Inc. |
9292 | * All rights reserved. | 10054 | * All rights reserved. |
9293 | * | 10055 | * |
9294 | * This source code is licensed under the BSD-style license found in the | 10056 | * 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 | 10057 | * 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. | 10058 | * of patent rights can be found in the PATENTS file in the same directory. |
9297 | * | 10059 | * |
9298 | * @providesModule SyntheticCompositionEvent | 10060 | * @providesModule setTextContent |
9299 | * @typechecks static-only | ||
9300 | */ | 10061 | */ |
9301 | 10062 | ||
9302 | 'use strict'; | 10063 | 'use strict'; |
9303 | 10064 | ||
9304 | var SyntheticEvent = __webpack_require__(79); | 10065 | var ExecutionEnvironment = __webpack_require__(52); |
10066 | var escapeTextContentForBrowser = __webpack_require__(90); | ||
10067 | var setInnerHTML = __webpack_require__(87); | ||
9305 | 10068 | ||
9306 | /** | 10069 | /** |
9307 | * @interface Event | 10070 | * Set the textContent property of a node, ensuring that whitespace is preserved |
9308 | * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents | 10071 | * even in IE8. innerText is a poor substitute for textContent and, among many |
10072 | * issues, inserts <br> instead of the literal newline chars. innerHTML behaves | ||
10073 | * as it should. | ||
10074 | * | ||
10075 | * @param {DOMElement} node | ||
10076 | * @param {string} text | ||
10077 | * @internal | ||
9309 | */ | 10078 | */ |
9310 | var CompositionEventInterface = { | 10079 | var setTextContent = function (node, text) { |
9311 | data: null | 10080 | if (text) { |
10081 | var firstChild = node.firstChild; | ||
10082 | |||
10083 | if (firstChild && firstChild === node.lastChild && firstChild.nodeType === 3) { | ||
10084 | firstChild.nodeValue = text; | ||
10085 | return; | ||
10086 | } | ||
10087 | } | ||
10088 | node.textContent = text; | ||
9312 | }; | 10089 | }; |
9313 | 10090 | ||
9314 | /** | 10091 | if (ExecutionEnvironment.canUseDOM) { |
9315 | * @param {object} dispatchConfig Configuration used to dispatch this event. | 10092 | if (!('textContent' in document.documentElement)) { |
9316 | * @param {string} dispatchMarker Marker identifying the event target. | 10093 | setTextContent = function (node, text) { |
9317 | * @param {object} nativeEvent Native browser event. | 10094 | setInnerHTML(node, escapeTextContentForBrowser(text)); |
9318 | * @extends {SyntheticUIEvent} | 10095 | }; |
9319 | */ | 10096 | } |
9320 | function SyntheticCompositionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | ||
9321 | SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | ||
9322 | } | 10097 | } |
9323 | 10098 | ||
9324 | SyntheticEvent.augmentClass(SyntheticCompositionEvent, CompositionEventInterface); | 10099 | module.exports = setTextContent; |
9325 | |||
9326 | module.exports = SyntheticCompositionEvent; | ||
9327 | 10100 | ||
9328 | /***/ }, | 10101 | /***/ }, |
9329 | /* 79 */ | 10102 | /* 90 */ |
9330 | /***/ function(module, exports, __webpack_require__) { | 10103 | /***/ function(module, exports) { |
9331 | 10104 | ||
9332 | /* WEBPACK VAR INJECTION */(function(process) {/** | 10105 | /** |
9333 | * Copyright 2013-2015, Facebook, Inc. | 10106 | * Copyright 2016-present, Facebook, Inc. |
9334 | * All rights reserved. | 10107 | * All rights reserved. |
9335 | * | 10108 | * |
9336 | * This source code is licensed under the BSD-style license found in the | 10109 | * This source code is licensed under the BSD-style license found in the |
9337 | * LICENSE file in the root directory of this source tree. An additional grant | 10110 | * LICENSE file in the root directory of this source tree. An additional grant |
9338 | * of patent rights can be found in the PATENTS file in the same directory. | 10111 | * of patent rights can be found in the PATENTS file in the same directory. |
9339 | * | 10112 | * |
9340 | * @providesModule SyntheticEvent | 10113 | * Based on the escape-html library, which is used under the MIT License below: |
9341 | * @typechecks static-only | 10114 | * |
10115 | * Copyright (c) 2012-2013 TJ Holowaychuk | ||
10116 | * Copyright (c) 2015 Andreas Lubbe | ||
10117 | * Copyright (c) 2015 Tiancheng "Timothy" Gu | ||
10118 | * | ||
10119 | * Permission is hereby granted, free of charge, to any person obtaining | ||
10120 | * a copy of this software and associated documentation files (the | ||
10121 | * 'Software'), to deal in the Software without restriction, including | ||
10122 | * without limitation the rights to use, copy, modify, merge, publish, | ||
10123 | * distribute, sublicense, and/or sell copies of the Software, and to | ||
10124 | * permit persons to whom the Software is furnished to do so, subject to | ||
10125 | * the following conditions: | ||
10126 | * | ||
10127 | * The above copyright notice and this permission notice shall be | ||
10128 | * included in all copies or substantial portions of the Software. | ||
10129 | * | ||
10130 | * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, | ||
10131 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
10132 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
10133 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | ||
10134 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
10135 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
10136 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
10137 | * | ||
10138 | * @providesModule escapeTextContentForBrowser | ||
9342 | */ | 10139 | */ |
9343 | 10140 | ||
9344 | 'use strict'; | 10141 | 'use strict'; |
9345 | 10142 | ||
9346 | var PooledClass = __webpack_require__(58); | 10143 | // code copied and modified from escape-html |
9347 | |||
9348 | var assign = __webpack_require__(41); | ||
9349 | var emptyFunction = __webpack_require__(17); | ||
9350 | var warning = __webpack_require__(27); | ||
9351 | |||
9352 | /** | 10144 | /** |
9353 | * @interface Event | 10145 | * Module variables. |
9354 | * @see http://www.w3.org/TR/DOM-Level-3-Events/ | 10146 | * @private |
9355 | */ | 10147 | */ |
9356 | var EventInterface = { | 10148 | |
9357 | type: null, | 10149 | var matchHtmlRegExp = /["'&<>]/; |
9358 | // currentTarget is set when dispatching; no use in copying it here | ||
9359 | currentTarget: emptyFunction.thatReturnsNull, | ||
9360 | eventPhase: null, | ||
9361 | bubbles: null, | ||
9362 | cancelable: null, | ||
9363 | timeStamp: function (event) { | ||
9364 | return event.timeStamp || Date.now(); | ||
9365 | }, | ||
9366 | defaultPrevented: null, | ||
9367 | isTrusted: null | ||
9368 | }; | ||
9369 | 10150 | ||
9370 | /** | 10151 | /** |
9371 | * Synthetic events are dispatched by event plugins, typically in response to a | 10152 | * Escape special characters in the given string of html. |
9372 | * top-level event delegation handler. | ||
9373 | * | ||
9374 | * These systems should generally use pooling to reduce the frequency of garbage | ||
9375 | * collection. The system should check `isPersistent` to determine whether the | ||
9376 | * event should be released into the pool after being dispatched. Users that | ||
9377 | * need a persisted event should invoke `persist`. | ||
9378 | * | ||
9379 | * Synthetic events (and subclasses) implement the DOM Level 3 Events API by | ||
9380 | * normalizing browser quirks. Subclasses do not necessarily have to implement a | ||
9381 | * DOM interface; custom application-specific events can also subclass this. | ||
9382 | * | 10153 | * |
9383 | * @param {object} dispatchConfig Configuration used to dispatch this event. | 10154 | * @param {string} string The string to escape for inserting into HTML |
9384 | * @param {string} dispatchMarker Marker identifying the event target. | 10155 | * @return {string} |
9385 | * @param {object} nativeEvent Native browser event. | 10156 | * @public |
9386 | */ | 10157 | */ |
9387 | function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | ||
9388 | this.dispatchConfig = dispatchConfig; | ||
9389 | this.dispatchMarker = dispatchMarker; | ||
9390 | this.nativeEvent = nativeEvent; | ||
9391 | this.target = nativeEventTarget; | ||
9392 | this.currentTarget = nativeEventTarget; | ||
9393 | 10158 | ||
9394 | var Interface = this.constructor.Interface; | 10159 | function escapeHtml(string) { |
9395 | for (var propName in Interface) { | 10160 | var str = '' + string; |
9396 | if (!Interface.hasOwnProperty(propName)) { | 10161 | var match = matchHtmlRegExp.exec(str); |
9397 | continue; | ||
9398 | } | ||
9399 | var normalize = Interface[propName]; | ||
9400 | if (normalize) { | ||
9401 | this[propName] = normalize(nativeEvent); | ||
9402 | } else { | ||
9403 | this[propName] = nativeEvent[propName]; | ||
9404 | } | ||
9405 | } | ||
9406 | 10162 | ||
9407 | var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false; | 10163 | if (!match) { |
9408 | if (defaultPrevented) { | 10164 | return str; |
9409 | this.isDefaultPrevented = emptyFunction.thatReturnsTrue; | ||
9410 | } else { | ||
9411 | this.isDefaultPrevented = emptyFunction.thatReturnsFalse; | ||
9412 | } | 10165 | } |
9413 | this.isPropagationStopped = emptyFunction.thatReturnsFalse; | ||
9414 | } | ||
9415 | 10166 | ||
9416 | assign(SyntheticEvent.prototype, { | 10167 | var escape; |
10168 | var html = ''; | ||
10169 | var index = 0; | ||
10170 | var lastIndex = 0; | ||
9417 | 10171 | ||
9418 | preventDefault: function () { | 10172 | for (index = match.index; index < str.length; index++) { |
9419 | this.defaultPrevented = true; | 10173 | switch (str.charCodeAt(index)) { |
9420 | var event = this.nativeEvent; | 10174 | case 34: |
9421 | if (process.env.NODE_ENV !== 'production') { | 10175 | // " |
9422 | process.env.NODE_ENV !== 'production' ? warning(event, 'This synthetic event is reused for performance reasons. If you\'re ' + 'seeing this, you\'re calling `preventDefault` on a ' + 'released/nullified synthetic event. This is a no-op. See ' + 'https://fb.me/react-event-pooling for more information.') : undefined; | 10176 | escape = '"'; |
9423 | } | 10177 | break; |
9424 | if (!event) { | 10178 | case 38: |
9425 | return; | 10179 | // & |
9426 | } | 10180 | escape = '&'; |
9427 | 10181 | break; | |
9428 | if (event.preventDefault) { | 10182 | case 39: |
9429 | event.preventDefault(); | 10183 | // ' |
9430 | } else { | 10184 | escape = '''; // modified from escape-html; used to be ''' |
9431 | event.returnValue = false; | 10185 | break; |
9432 | } | 10186 | case 60: |
9433 | this.isDefaultPrevented = emptyFunction.thatReturnsTrue; | 10187 | // < |
9434 | }, | 10188 | escape = '<'; |
9435 | 10189 | break; | |
9436 | stopPropagation: function () { | 10190 | case 62: |
9437 | var event = this.nativeEvent; | 10191 | // > |
9438 | if (process.env.NODE_ENV !== 'production') { | 10192 | escape = '>'; |
9439 | process.env.NODE_ENV !== 'production' ? warning(event, 'This synthetic event is reused for performance reasons. If you\'re ' + 'seeing this, you\'re calling `stopPropagation` on a ' + 'released/nullified synthetic event. This is a no-op. See ' + 'https://fb.me/react-event-pooling for more information.') : undefined; | 10193 | break; |
9440 | } | 10194 | default: |
9441 | if (!event) { | 10195 | continue; |
9442 | return; | ||
9443 | } | 10196 | } |
9444 | 10197 | ||
9445 | if (event.stopPropagation) { | 10198 | if (lastIndex !== index) { |
9446 | event.stopPropagation(); | 10199 | html += str.substring(lastIndex, index); |
9447 | } else { | ||
9448 | event.cancelBubble = true; | ||
9449 | } | 10200 | } |
9450 | this.isPropagationStopped = emptyFunction.thatReturnsTrue; | ||
9451 | }, | ||
9452 | 10201 | ||
9453 | /** | 10202 | lastIndex = index + 1; |
9454 | * We release all dispatched `SyntheticEvent`s after each event loop, adding | 10203 | html += escape; |
9455 | * them back into the pool. This allows a way to hold onto a reference that | ||
9456 | * won't be added back into the pool. | ||
9457 | */ | ||
9458 | persist: function () { | ||
9459 | this.isPersistent = emptyFunction.thatReturnsTrue; | ||
9460 | }, | ||
9461 | |||
9462 | /** | ||
9463 | * Checks if this event should be released back into the pool. | ||
9464 | * | ||
9465 | * @return {boolean} True if this should not be released, false otherwise. | ||
9466 | */ | ||
9467 | isPersistent: emptyFunction.thatReturnsFalse, | ||
9468 | |||
9469 | /** | ||
9470 | * `PooledClass` looks for `destructor` on each instance it releases. | ||
9471 | */ | ||
9472 | destructor: function () { | ||
9473 | var Interface = this.constructor.Interface; | ||
9474 | for (var propName in Interface) { | ||
9475 | this[propName] = null; | ||
9476 | } | ||
9477 | this.dispatchConfig = null; | ||
9478 | this.dispatchMarker = null; | ||
9479 | this.nativeEvent = null; | ||
9480 | } | 10204 | } |
9481 | 10205 | ||
9482 | }); | 10206 | return lastIndex !== index ? html + str.substring(lastIndex, index) : html; |
9483 | 10207 | } | |
9484 | SyntheticEvent.Interface = EventInterface; | 10208 | // end code copied and modified from escape-html |
9485 | 10209 | ||
9486 | /** | 10210 | /** |
9487 | * Helper to reduce boilerplate when creating subclasses. | 10211 | * Escapes text to prevent scripting attacks. |
9488 | * | 10212 | * |
9489 | * @param {function} Class | 10213 | * @param {*} text Text value to escape. |
9490 | * @param {?object} Interface | 10214 | * @return {string} An escaped string. |
9491 | */ | 10215 | */ |
9492 | SyntheticEvent.augmentClass = function (Class, Interface) { | 10216 | function escapeTextContentForBrowser(text) { |
9493 | var Super = this; | 10217 | if (typeof text === 'boolean' || typeof text === 'number') { |
9494 | 10218 | // this shortcircuit helps perf for types that we know will never have | |
9495 | var prototype = Object.create(Super.prototype); | 10219 | // special characters, especially given that this function is used often |
9496 | assign(prototype, Class.prototype); | 10220 | // for numeric dom ids. |
9497 | Class.prototype = prototype; | 10221 | return '' + text; |
9498 | Class.prototype.constructor = Class; | 10222 | } |
9499 | 10223 | return escapeHtml(text); | |
9500 | Class.Interface = assign({}, Super.Interface, Interface); | 10224 | } |
9501 | Class.augmentClass = Super.augmentClass; | ||
9502 | |||
9503 | PooledClass.addPoolingTo(Class, PooledClass.fourArgumentPooler); | ||
9504 | }; | ||
9505 | |||
9506 | PooledClass.addPoolingTo(SyntheticEvent, PooledClass.fourArgumentPooler); | ||
9507 | 10225 | ||
9508 | module.exports = SyntheticEvent; | 10226 | module.exports = escapeTextContentForBrowser; |
9509 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
9510 | 10227 | ||
9511 | /***/ }, | 10228 | /***/ }, |
9512 | /* 80 */ | 10229 | /* 91 */ |
9513 | /***/ function(module, exports, __webpack_require__) { | 10230 | /***/ function(module, exports, __webpack_require__) { |
9514 | 10231 | ||
9515 | /** | 10232 | /* WEBPACK VAR INJECTION */(function(process) {/** |
9516 | * Copyright 2013-2015, Facebook, Inc. | 10233 | * Copyright 2013-present, Facebook, Inc. |
9517 | * All rights reserved. | 10234 | * All rights reserved. |
9518 | * | 10235 | * |
9519 | * This source code is licensed under the BSD-style license found in the | 10236 | * This source code is licensed under the BSD-style license found in the |
9520 | * LICENSE file in the root directory of this source tree. An additional grant | 10237 | * LICENSE file in the root directory of this source tree. An additional grant |
9521 | * of patent rights can be found in the PATENTS file in the same directory. | 10238 | * of patent rights can be found in the PATENTS file in the same directory. |
9522 | * | 10239 | * |
9523 | * @providesModule SyntheticInputEvent | 10240 | * @providesModule Danger |
9524 | * @typechecks static-only | ||
9525 | */ | 10241 | */ |
9526 | 10242 | ||
9527 | 'use strict'; | 10243 | 'use strict'; |
9528 | 10244 | ||
9529 | var SyntheticEvent = __webpack_require__(79); | 10245 | var _prodInvariant = __webpack_require__(9); |
9530 | 10246 | ||
9531 | /** | 10247 | var DOMLazyTree = __webpack_require__(85); |
9532 | * @interface Event | 10248 | var ExecutionEnvironment = __webpack_require__(52); |
9533 | * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105 | ||
9534 | * /#events-inputevents | ||
9535 | */ | ||
9536 | var InputEventInterface = { | ||
9537 | data: null | ||
9538 | }; | ||
9539 | |||
9540 | /** | ||
9541 | * @param {object} dispatchConfig Configuration used to dispatch this event. | ||
9542 | * @param {string} dispatchMarker Marker identifying the event target. | ||
9543 | * @param {object} nativeEvent Native browser event. | ||
9544 | * @extends {SyntheticUIEvent} | ||
9545 | */ | ||
9546 | function SyntheticInputEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | ||
9547 | SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | ||
9548 | } | ||
9549 | 10249 | ||
9550 | SyntheticEvent.augmentClass(SyntheticInputEvent, InputEventInterface); | 10250 | var createNodesFromMarkup = __webpack_require__(92); |
10251 | var emptyFunction = __webpack_require__(14); | ||
10252 | var invariant = __webpack_require__(10); | ||
9551 | 10253 | ||
9552 | module.exports = SyntheticInputEvent; | 10254 | var Danger = { |
9553 | |||
9554 | /***/ }, | ||
9555 | /* 81 */ | ||
9556 | /***/ function(module, exports) { | ||
9557 | |||
9558 | /** | ||
9559 | * Copyright 2013-2015, Facebook, Inc. | ||
9560 | * All rights reserved. | ||
9561 | * | ||
9562 | * This source code is licensed under the BSD-style license found in the | ||
9563 | * LICENSE file in the root directory of this source tree. An additional grant | ||
9564 | * of patent rights can be found in the PATENTS file in the same directory. | ||
9565 | * | ||
9566 | * @providesModule keyOf | ||
9567 | */ | ||
9568 | 10255 | ||
9569 | /** | 10256 | /** |
9570 | * Allows extraction of a minified key. Let's the build system minify keys | 10257 | * Replaces a node with a string of markup at its current position within its |
9571 | * without losing the ability to dynamically use key strings as values | 10258 | * parent. The markup must render into a single root node. |
9572 | * themselves. Pass in an object with a single key/val pair and it will return | 10259 | * |
9573 | * you the string key of that single record. Suppose you want to grab the | 10260 | * @param {DOMElement} oldChild Child node to replace. |
9574 | * value for a key 'className' inside of an object. Key/val minification may | 10261 | * @param {string} markup Markup to render in place of the child node. |
9575 | * have aliased that key to be 'xa12'. keyOf({className: null}) will return | 10262 | * @internal |
9576 | * 'xa12' in that case. Resolve keys you want to use once at startup time, then | 10263 | */ |
9577 | * reuse those resolutions. | 10264 | dangerouslyReplaceNodeWithMarkup: function (oldChild, markup) { |
9578 | */ | 10265 | !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; |
9579 | "use strict"; | 10266 | !markup ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : _prodInvariant('57') : void 0; |
10267 | !(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; | ||
9580 | 10268 | ||
9581 | var keyOf = function (oneKeyObj) { | 10269 | if (typeof markup === 'string') { |
9582 | var key; | 10270 | var newChild = createNodesFromMarkup(markup, emptyFunction)[0]; |
9583 | for (key in oneKeyObj) { | 10271 | oldChild.parentNode.replaceChild(newChild, oldChild); |
9584 | if (!oneKeyObj.hasOwnProperty(key)) { | 10272 | } else { |
9585 | continue; | 10273 | DOMLazyTree.replaceChildWithTree(oldChild, markup); |
9586 | } | 10274 | } |
9587 | return key; | ||
9588 | } | 10275 | } |
9589 | return null; | 10276 | |
9590 | }; | 10277 | }; |
9591 | 10278 | ||
9592 | module.exports = keyOf; | 10279 | module.exports = Danger; |
10280 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
9593 | 10281 | ||
9594 | /***/ }, | 10282 | /***/ }, |
9595 | /* 82 */ | 10283 | /* 92 */ |
9596 | /***/ function(module, exports, __webpack_require__) { | 10284 | /***/ function(module, exports, __webpack_require__) { |
9597 | 10285 | ||
10286 | /* WEBPACK VAR INJECTION */(function(process) {'use strict'; | ||
10287 | |||
9598 | /** | 10288 | /** |
9599 | * Copyright 2013-2015, Facebook, Inc. | 10289 | * Copyright (c) 2013-present, Facebook, Inc. |
9600 | * All rights reserved. | 10290 | * All rights reserved. |
9601 | * | 10291 | * |
9602 | * This source code is licensed under the BSD-style license found in the | 10292 | * This source code is licensed under the BSD-style license found in the |
9603 | * LICENSE file in the root directory of this source tree. An additional grant | 10293 | * LICENSE file in the root directory of this source tree. An additional grant |
9604 | * of patent rights can be found in the PATENTS file in the same directory. | 10294 | * of patent rights can be found in the PATENTS file in the same directory. |
9605 | * | 10295 | * |
9606 | * @providesModule ChangeEventPlugin | 10296 | * @typechecks |
9607 | */ | ||
9608 | |||
9609 | 'use strict'; | ||
9610 | |||
9611 | var EventConstants = __webpack_require__(32); | ||
9612 | var EventPluginHub = __webpack_require__(33); | ||
9613 | var EventPropagators = __webpack_require__(75); | ||
9614 | var ExecutionEnvironment = __webpack_require__(11); | ||
9615 | var ReactUpdates = __webpack_require__(56); | ||
9616 | var SyntheticEvent = __webpack_require__(79); | ||
9617 | |||
9618 | var getEventTarget = __webpack_require__(83); | ||
9619 | var isEventSupported = __webpack_require__(42); | ||
9620 | var isTextInputElement = __webpack_require__(84); | ||
9621 | var keyOf = __webpack_require__(81); | ||
9622 | |||
9623 | var topLevelTypes = EventConstants.topLevelTypes; | ||
9624 | |||
9625 | var eventTypes = { | ||
9626 | change: { | ||
9627 | phasedRegistrationNames: { | ||
9628 | bubbled: keyOf({ onChange: null }), | ||
9629 | captured: keyOf({ onChangeCapture: null }) | ||
9630 | }, | ||
9631 | dependencies: [topLevelTypes.topBlur, topLevelTypes.topChange, topLevelTypes.topClick, topLevelTypes.topFocus, topLevelTypes.topInput, topLevelTypes.topKeyDown, topLevelTypes.topKeyUp, topLevelTypes.topSelectionChange] | ||
9632 | } | ||
9633 | }; | ||
9634 | |||
9635 | /** | ||
9636 | * For IE shims | ||
9637 | */ | ||
9638 | var activeElement = null; | ||
9639 | var activeElementID = null; | ||
9640 | var activeElementValue = null; | ||
9641 | var activeElementValueProp = null; | ||
9642 | |||
9643 | /** | ||
9644 | * SECTION: handle `change` event | ||
9645 | */ | 10297 | */ |
9646 | function shouldUseChangeEvent(elem) { | ||
9647 | var nodeName = elem.nodeName && elem.nodeName.toLowerCase(); | ||
9648 | return nodeName === 'select' || nodeName === 'input' && elem.type === 'file'; | ||
9649 | } | ||
9650 | |||
9651 | var doesChangeEventBubble = false; | ||
9652 | if (ExecutionEnvironment.canUseDOM) { | ||
9653 | // See `handleChange` comment below | ||
9654 | doesChangeEventBubble = isEventSupported('change') && (!('documentMode' in document) || document.documentMode > 8); | ||
9655 | } | ||
9656 | |||
9657 | function manualDispatchChangeEvent(nativeEvent) { | ||
9658 | var event = SyntheticEvent.getPooled(eventTypes.change, activeElementID, nativeEvent, getEventTarget(nativeEvent)); | ||
9659 | EventPropagators.accumulateTwoPhaseDispatches(event); | ||
9660 | |||
9661 | // If change and propertychange bubbled, we'd just bind to it like all the | ||
9662 | // other events and have it go through ReactBrowserEventEmitter. Since it | ||
9663 | // doesn't, we manually listen for the events and so we have to enqueue and | ||
9664 | // process the abstract event manually. | ||
9665 | // | ||
9666 | // Batching is necessary here in order to ensure that all event handlers run | ||
9667 | // before the next rerender (including event handlers attached to ancestor | ||
9668 | // elements instead of directly on the input). Without this, controlled | ||
9669 | // components don't work properly in conjunction with event bubbling because | ||
9670 | // the component is rerendered and the value reverted before all the event | ||
9671 | // handlers can run. See https://github.com/facebook/react/issues/708. | ||
9672 | ReactUpdates.batchedUpdates(runEventInBatch, event); | ||
9673 | } | ||
9674 | |||
9675 | function runEventInBatch(event) { | ||
9676 | EventPluginHub.enqueueEvents(event); | ||
9677 | EventPluginHub.processEventQueue(false); | ||
9678 | } | ||
9679 | 10298 | ||
9680 | function startWatchingForChangeEventIE8(target, targetID) { | 10299 | /*eslint-disable fb-www/unsafe-html*/ |
9681 | activeElement = target; | ||
9682 | activeElementID = targetID; | ||
9683 | activeElement.attachEvent('onchange', manualDispatchChangeEvent); | ||
9684 | } | ||
9685 | 10300 | ||
9686 | function stopWatchingForChangeEventIE8() { | 10301 | var ExecutionEnvironment = __webpack_require__(52); |
9687 | if (!activeElement) { | ||
9688 | return; | ||
9689 | } | ||
9690 | activeElement.detachEvent('onchange', manualDispatchChangeEvent); | ||
9691 | activeElement = null; | ||
9692 | activeElementID = null; | ||
9693 | } | ||
9694 | 10302 | ||
9695 | function getTargetIDForChangeEvent(topLevelType, topLevelTarget, topLevelTargetID) { | 10303 | var createArrayFromMixed = __webpack_require__(93); |
9696 | if (topLevelType === topLevelTypes.topChange) { | 10304 | var getMarkupWrap = __webpack_require__(94); |
9697 | return topLevelTargetID; | 10305 | var invariant = __webpack_require__(10); |
9698 | } | ||
9699 | } | ||
9700 | function handleEventsForChangeEventIE8(topLevelType, topLevelTarget, topLevelTargetID) { | ||
9701 | if (topLevelType === topLevelTypes.topFocus) { | ||
9702 | // stopWatching() should be a noop here but we call it just in case we | ||
9703 | // missed a blur event somehow. | ||
9704 | stopWatchingForChangeEventIE8(); | ||
9705 | startWatchingForChangeEventIE8(topLevelTarget, topLevelTargetID); | ||
9706 | } else if (topLevelType === topLevelTypes.topBlur) { | ||
9707 | stopWatchingForChangeEventIE8(); | ||
9708 | } | ||
9709 | } | ||
9710 | |||
9711 | /** | ||
9712 | * SECTION: handle `input` event | ||
9713 | */ | ||
9714 | var isInputEventSupported = false; | ||
9715 | if (ExecutionEnvironment.canUseDOM) { | ||
9716 | // IE9 claims to support the input event but fails to trigger it when | ||
9717 | // deleting text, so we ignore its input events | ||
9718 | isInputEventSupported = isEventSupported('input') && (!('documentMode' in document) || document.documentMode > 9); | ||
9719 | } | ||
9720 | 10306 | ||
9721 | /** | 10307 | /** |
9722 | * (For old IE.) Replacement getter/setter for the `value` property that gets | 10308 | * Dummy container used to render all markup. |
9723 | * set on the active element. | ||
9724 | */ | ||
9725 | var newValueProp = { | ||
9726 | get: function () { | ||
9727 | return activeElementValueProp.get.call(this); | ||
9728 | }, | ||
9729 | set: function (val) { | ||
9730 | // Cast to a string so we can do equality checks. | ||
9731 | activeElementValue = '' + val; | ||
9732 | activeElementValueProp.set.call(this, val); | ||
9733 | } | ||
9734 | }; | ||
9735 | |||
9736 | /** | ||
9737 | * (For old IE.) Starts tracking propertychange events on the passed-in element | ||
9738 | * and override the value property so that we can distinguish user events from | ||
9739 | * value changes in JS. | ||
9740 | */ | 10309 | */ |
9741 | function startWatchingForValueChange(target, targetID) { | 10310 | var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null; |
9742 | activeElement = target; | ||
9743 | activeElementID = targetID; | ||
9744 | activeElementValue = target.value; | ||
9745 | activeElementValueProp = Object.getOwnPropertyDescriptor(target.constructor.prototype, 'value'); | ||
9746 | |||
9747 | // Not guarded in a canDefineProperty check: IE8 supports defineProperty only | ||
9748 | // on DOM elements | ||
9749 | Object.defineProperty(activeElement, 'value', newValueProp); | ||
9750 | activeElement.attachEvent('onpropertychange', handlePropertyChange); | ||
9751 | } | ||
9752 | 10311 | ||
9753 | /** | 10312 | /** |
9754 | * (For old IE.) Removes the event listeners from the currently-tracked element, | 10313 | * Pattern used by `getNodeName`. |
9755 | * if any exists. | ||
9756 | */ | 10314 | */ |
9757 | function stopWatchingForValueChange() { | 10315 | var nodeNamePattern = /^\s*<(\w+)/; |
9758 | if (!activeElement) { | ||
9759 | return; | ||
9760 | } | ||
9761 | |||
9762 | // delete restores the original property definition | ||
9763 | delete activeElement.value; | ||
9764 | activeElement.detachEvent('onpropertychange', handlePropertyChange); | ||
9765 | |||
9766 | activeElement = null; | ||
9767 | activeElementID = null; | ||
9768 | activeElementValue = null; | ||
9769 | activeElementValueProp = null; | ||
9770 | } | ||
9771 | 10316 | ||
9772 | /** | 10317 | /** |
9773 | * (For old IE.) Handles a propertychange event, sending a `change` event if | 10318 | * Extracts the `nodeName` of the first element in a string of markup. |
9774 | * the value of the active element has changed. | 10319 | * |
10320 | * @param {string} markup String of markup. | ||
10321 | * @return {?string} Node name of the supplied markup. | ||
9775 | */ | 10322 | */ |
9776 | function handlePropertyChange(nativeEvent) { | 10323 | function getNodeName(markup) { |
9777 | if (nativeEvent.propertyName !== 'value') { | 10324 | var nodeNameMatch = markup.match(nodeNamePattern); |
9778 | return; | 10325 | return nodeNameMatch && nodeNameMatch[1].toLowerCase(); |
9779 | } | ||
9780 | var value = nativeEvent.srcElement.value; | ||
9781 | if (value === activeElementValue) { | ||
9782 | return; | ||
9783 | } | ||
9784 | activeElementValue = value; | ||
9785 | |||
9786 | manualDispatchChangeEvent(nativeEvent); | ||
9787 | } | 10326 | } |
9788 | 10327 | ||
9789 | /** | 10328 | /** |
9790 | * If a `change` event should be fired, returns the target's ID. | 10329 | * Creates an array containing the nodes rendered from the supplied markup. The |
10330 | * optionally supplied `handleScript` function will be invoked once for each | ||
10331 | * <script> element that is rendered. If no `handleScript` function is supplied, | ||
10332 | * an exception is thrown if any <script> elements are rendered. | ||
10333 | * | ||
10334 | * @param {string} markup A string of valid HTML markup. | ||
10335 | * @param {?function} handleScript Invoked once for each rendered <script>. | ||
10336 | * @return {array<DOMElement|DOMTextNode>} An array of rendered nodes. | ||
9791 | */ | 10337 | */ |
9792 | function getTargetIDForInputEvent(topLevelType, topLevelTarget, topLevelTargetID) { | 10338 | function createNodesFromMarkup(markup, handleScript) { |
9793 | if (topLevelType === topLevelTypes.topInput) { | 10339 | var node = dummyNode; |
9794 | // In modern browsers (i.e., not IE8 or IE9), the input event is exactly | 10340 | !!!dummyNode ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createNodesFromMarkup dummy not initialized') : invariant(false) : void 0; |
9795 | // what we want so fall through here and trigger an abstract event | 10341 | var nodeName = getNodeName(markup); |
9796 | return topLevelTargetID; | ||
9797 | } | ||
9798 | } | ||
9799 | 10342 | ||
9800 | // For IE8 and IE9. | 10343 | var wrap = nodeName && getMarkupWrap(nodeName); |
9801 | function handleEventsForInputEventIE(topLevelType, topLevelTarget, topLevelTargetID) { | 10344 | if (wrap) { |
9802 | if (topLevelType === topLevelTypes.topFocus) { | 10345 | node.innerHTML = wrap[1] + markup + wrap[2]; |
9803 | // In IE8, we can capture almost all .value changes by adding a | ||
9804 | // propertychange handler and looking for events with propertyName | ||
9805 | // equal to 'value' | ||
9806 | // In IE9, propertychange fires for most input events but is buggy and | ||
9807 | // doesn't fire when text is deleted, but conveniently, selectionchange | ||
9808 | // appears to fire in all of the remaining cases so we catch those and | ||
9809 | // forward the event if the value has changed | ||
9810 | // In either case, we don't want to call the event handler if the value | ||
9811 | // is changed from JS so we redefine a setter for `.value` that updates | ||
9812 | // our activeElementValue variable, allowing us to ignore those changes | ||
9813 | // | ||
9814 | // stopWatching() should be a noop here but we call it just in case we | ||
9815 | // missed a blur event somehow. | ||
9816 | stopWatchingForValueChange(); | ||
9817 | startWatchingForValueChange(topLevelTarget, topLevelTargetID); | ||
9818 | } else if (topLevelType === topLevelTypes.topBlur) { | ||
9819 | stopWatchingForValueChange(); | ||
9820 | } | ||
9821 | } | ||
9822 | 10346 | ||
9823 | // For IE8 and IE9. | 10347 | var wrapDepth = wrap[0]; |
9824 | function getTargetIDForInputEventIE(topLevelType, topLevelTarget, topLevelTargetID) { | 10348 | while (wrapDepth--) { |
9825 | if (topLevelType === topLevelTypes.topSelectionChange || topLevelType === topLevelTypes.topKeyUp || topLevelType === topLevelTypes.topKeyDown) { | 10349 | node = node.lastChild; |
9826 | // On the selectionchange event, the target is just document which isn't | ||
9827 | // helpful for us so just check activeElement instead. | ||
9828 | // | ||
9829 | // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire | ||
9830 | // propertychange on the first input event after setting `value` from a | ||
9831 | // script and fires only keydown, keypress, keyup. Catching keyup usually | ||
9832 | // gets it and catching keydown lets us fire an event for the first | ||
9833 | // keystroke if user does a key repeat (it'll be a little delayed: right | ||
9834 | // before the second keystroke). Other input methods (e.g., paste) seem to | ||
9835 | // fire selectionchange normally. | ||
9836 | if (activeElement && activeElement.value !== activeElementValue) { | ||
9837 | activeElementValue = activeElement.value; | ||
9838 | return activeElementID; | ||
9839 | } | 10350 | } |
10351 | } else { | ||
10352 | node.innerHTML = markup; | ||
9840 | } | 10353 | } |
9841 | } | ||
9842 | |||
9843 | /** | ||
9844 | * SECTION: handle `click` event | ||
9845 | */ | ||
9846 | function shouldUseClickEvent(elem) { | ||
9847 | // Use the `click` event to detect changes to checkbox and radio inputs. | ||
9848 | // This approach works across all browsers, whereas `change` does not fire | ||
9849 | // until `blur` in IE8. | ||
9850 | return elem.nodeName && elem.nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio'); | ||
9851 | } | ||
9852 | 10354 | ||
9853 | function getTargetIDForClickEvent(topLevelType, topLevelTarget, topLevelTargetID) { | 10355 | var scripts = node.getElementsByTagName('script'); |
9854 | if (topLevelType === topLevelTypes.topClick) { | 10356 | if (scripts.length) { |
9855 | return topLevelTargetID; | 10357 | !handleScript ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createNodesFromMarkup(...): Unexpected <script> element rendered.') : invariant(false) : void 0; |
10358 | createArrayFromMixed(scripts).forEach(handleScript); | ||
9856 | } | 10359 | } |
9857 | } | ||
9858 | |||
9859 | /** | ||
9860 | * This plugin creates an `onChange` event that normalizes change events | ||
9861 | * across form elements. This event fires at a time when it's possible to | ||
9862 | * change the element's value without seeing a flicker. | ||
9863 | * | ||
9864 | * Supported elements are: | ||
9865 | * - input (see `isTextInputElement`) | ||
9866 | * - textarea | ||
9867 | * - select | ||
9868 | */ | ||
9869 | var ChangeEventPlugin = { | ||
9870 | |||
9871 | eventTypes: eventTypes, | ||
9872 | |||
9873 | /** | ||
9874 | * @param {string} topLevelType Record from `EventConstants`. | ||
9875 | * @param {DOMEventTarget} topLevelTarget The listening component root node. | ||
9876 | * @param {string} topLevelTargetID ID of `topLevelTarget`. | ||
9877 | * @param {object} nativeEvent Native browser event. | ||
9878 | * @return {*} An accumulation of synthetic events. | ||
9879 | * @see {EventPluginHub.extractEvents} | ||
9880 | */ | ||
9881 | extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) { | ||
9882 | |||
9883 | var getTargetIDFunc, handleEventFunc; | ||
9884 | if (shouldUseChangeEvent(topLevelTarget)) { | ||
9885 | if (doesChangeEventBubble) { | ||
9886 | getTargetIDFunc = getTargetIDForChangeEvent; | ||
9887 | } else { | ||
9888 | handleEventFunc = handleEventsForChangeEventIE8; | ||
9889 | } | ||
9890 | } else if (isTextInputElement(topLevelTarget)) { | ||
9891 | if (isInputEventSupported) { | ||
9892 | getTargetIDFunc = getTargetIDForInputEvent; | ||
9893 | } else { | ||
9894 | getTargetIDFunc = getTargetIDForInputEventIE; | ||
9895 | handleEventFunc = handleEventsForInputEventIE; | ||
9896 | } | ||
9897 | } else if (shouldUseClickEvent(topLevelTarget)) { | ||
9898 | getTargetIDFunc = getTargetIDForClickEvent; | ||
9899 | } | ||
9900 | |||
9901 | if (getTargetIDFunc) { | ||
9902 | var targetID = getTargetIDFunc(topLevelType, topLevelTarget, topLevelTargetID); | ||
9903 | if (targetID) { | ||
9904 | var event = SyntheticEvent.getPooled(eventTypes.change, targetID, nativeEvent, nativeEventTarget); | ||
9905 | event.type = 'change'; | ||
9906 | EventPropagators.accumulateTwoPhaseDispatches(event); | ||
9907 | return event; | ||
9908 | } | ||
9909 | } | ||
9910 | 10360 | ||
9911 | if (handleEventFunc) { | 10361 | var nodes = Array.from(node.childNodes); |
9912 | handleEventFunc(topLevelType, topLevelTarget, topLevelTargetID); | 10362 | while (node.lastChild) { |
9913 | } | 10363 | node.removeChild(node.lastChild); |
9914 | } | 10364 | } |
10365 | return nodes; | ||
10366 | } | ||
9915 | 10367 | ||
9916 | }; | 10368 | module.exports = createNodesFromMarkup; |
9917 | 10369 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | |
9918 | module.exports = ChangeEventPlugin; | ||
9919 | 10370 | ||
9920 | /***/ }, | 10371 | /***/ }, |
9921 | /* 83 */ | 10372 | /* 93 */ |
9922 | /***/ function(module, exports) { | 10373 | /***/ function(module, exports, __webpack_require__) { |
9923 | 10374 | ||
10375 | /* WEBPACK VAR INJECTION */(function(process) {'use strict'; | ||
10376 | |||
9924 | /** | 10377 | /** |
9925 | * Copyright 2013-2015, Facebook, Inc. | 10378 | * Copyright (c) 2013-present, Facebook, Inc. |
9926 | * All rights reserved. | 10379 | * All rights reserved. |
9927 | * | 10380 | * |
9928 | * This source code is licensed under the BSD-style license found in the | 10381 | * This source code is licensed under the BSD-style license found in the |
9929 | * LICENSE file in the root directory of this source tree. An additional grant | 10382 | * LICENSE file in the root directory of this source tree. An additional grant |
9930 | * of patent rights can be found in the PATENTS file in the same directory. | 10383 | * of patent rights can be found in the PATENTS file in the same directory. |
9931 | * | 10384 | * |
9932 | * @providesModule getEventTarget | 10385 | * @typechecks |
9933 | * @typechecks static-only | ||
9934 | */ | 10386 | */ |
9935 | 10387 | ||
9936 | 'use strict'; | 10388 | var invariant = __webpack_require__(10); |
9937 | 10389 | ||
9938 | /** | 10390 | /** |
9939 | * Gets the target node from a native browser event by accounting for | 10391 | * Convert array-like objects to arrays. |
9940 | * inconsistencies in browser DOM APIs. | ||
9941 | * | ||
9942 | * @param {object} nativeEvent Native browser event. | ||
9943 | * @return {DOMEventTarget} Target node. | ||
9944 | */ | ||
9945 | function getEventTarget(nativeEvent) { | ||
9946 | var target = nativeEvent.target || nativeEvent.srcElement || window; | ||
9947 | // Safari may fire events on text nodes (Node.TEXT_NODE is 3). | ||
9948 | // @see http://www.quirksmode.org/js/events_properties.html | ||
9949 | return target.nodeType === 3 ? target.parentNode : target; | ||
9950 | } | ||
9951 | |||
9952 | module.exports = getEventTarget; | ||
9953 | |||
9954 | /***/ }, | ||
9955 | /* 84 */ | ||
9956 | /***/ function(module, exports) { | ||
9957 | |||
9958 | /** | ||
9959 | * Copyright 2013-2015, Facebook, Inc. | ||
9960 | * All rights reserved. | ||
9961 | * | 10392 | * |
9962 | * This source code is licensed under the BSD-style license found in the | 10393 | * This API assumes the caller knows the contents of the data type. For less |
9963 | * LICENSE file in the root directory of this source tree. An additional grant | 10394 | * well defined inputs use createArrayFromMixed. |
9964 | * of patent rights can be found in the PATENTS file in the same directory. | ||
9965 | * | 10395 | * |
9966 | * @providesModule isTextInputElement | 10396 | * @param {object|function|filelist} obj |
10397 | * @return {array} | ||
9967 | */ | 10398 | */ |
10399 | function toArray(obj) { | ||
10400 | var length = obj.length; | ||
9968 | 10401 | ||
9969 | 'use strict'; | 10402 | // Some browsers builtin objects can report typeof 'function' (e.g. NodeList |
10403 | // in old versions of Safari). | ||
10404 | !(!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; | ||
9970 | 10405 | ||
9971 | /** | 10406 | !(typeof length === 'number') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object needs a length property') : invariant(false) : void 0; |
9972 | * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary | ||
9973 | */ | ||
9974 | var supportedInputTypes = { | ||
9975 | 'color': true, | ||
9976 | 'date': true, | ||
9977 | 'datetime': true, | ||
9978 | 'datetime-local': true, | ||
9979 | 'email': true, | ||
9980 | 'month': true, | ||
9981 | 'number': true, | ||
9982 | 'password': true, | ||
9983 | 'range': true, | ||
9984 | 'search': true, | ||
9985 | 'tel': true, | ||
9986 | 'text': true, | ||
9987 | 'time': true, | ||
9988 | 'url': true, | ||
9989 | 'week': true | ||
9990 | }; | ||
9991 | 10407 | ||
9992 | function isTextInputElement(elem) { | 10408 | !(length === 0 || length - 1 in obj) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object should have keys for indices') : invariant(false) : void 0; |
9993 | var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase(); | ||
9994 | return nodeName && (nodeName === 'input' && supportedInputTypes[elem.type] || nodeName === 'textarea'); | ||
9995 | } | ||
9996 | 10409 | ||
9997 | module.exports = isTextInputElement; | 10410 | !(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; |
9998 | |||
9999 | /***/ }, | ||
10000 | /* 85 */ | ||
10001 | /***/ function(module, exports) { | ||
10002 | |||
10003 | /** | ||
10004 | * Copyright 2013-2015, Facebook, Inc. | ||
10005 | * All rights reserved. | ||
10006 | * | ||
10007 | * This source code is licensed under the BSD-style license found in the | ||
10008 | * LICENSE file in the root directory of this source tree. An additional grant | ||
10009 | * of patent rights can be found in the PATENTS file in the same directory. | ||
10010 | * | ||
10011 | * @providesModule ClientReactRootIndex | ||
10012 | * @typechecks | ||
10013 | */ | ||
10014 | |||
10015 | 'use strict'; | ||
10016 | 10411 | ||
10017 | var nextReactRootIndex = 0; | 10412 | // Old IE doesn't give collections access to hasOwnProperty. Assume inputs |
10413 | // without method will throw during the slice call and skip straight to the | ||
10414 | // fallback. | ||
10415 | if (obj.hasOwnProperty) { | ||
10416 | try { | ||
10417 | return Array.prototype.slice.call(obj); | ||
10418 | } catch (e) { | ||
10419 | // IE < 9 does not support Array#slice on collections objects | ||
10420 | } | ||
10421 | } | ||
10018 | 10422 | ||
10019 | var ClientReactRootIndex = { | 10423 | // Fall back to copying key by key. This assumes all keys have a value, |
10020 | createReactRootIndex: function () { | 10424 | // so will not preserve sparsely populated inputs. |
10021 | return nextReactRootIndex++; | 10425 | var ret = Array(length); |
10426 | for (var ii = 0; ii < length; ii++) { | ||
10427 | ret[ii] = obj[ii]; | ||
10022 | } | 10428 | } |
10023 | }; | 10429 | return ret; |
10430 | } | ||
10024 | 10431 | ||
10025 | module.exports = ClientReactRootIndex; | ||
10026 | |||
10027 | /***/ }, | ||
10028 | /* 86 */ | ||
10029 | /***/ function(module, exports, __webpack_require__) { | ||
10030 | |||
10031 | /** | 10432 | /** |
10032 | * Copyright 2013-2015, Facebook, Inc. | 10433 | * Perform a heuristic test to determine if an object is "array-like". |
10033 | * All rights reserved. | ||
10034 | * | 10434 | * |
10035 | * This source code is licensed under the BSD-style license found in the | 10435 | * A monk asked Joshu, a Zen master, "Has a dog Buddha nature?" |
10036 | * LICENSE file in the root directory of this source tree. An additional grant | 10436 | * Joshu replied: "Mu." |
10037 | * of patent rights can be found in the PATENTS file in the same directory. | ||
10038 | * | 10437 | * |
10039 | * @providesModule DefaultEventPluginOrder | 10438 | * This function determines if its argument has "array nature": it returns |
10040 | */ | 10439 | * true if the argument is an actual array, an `arguments' object, or an |
10041 | 10440 | * HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()). | |
10042 | 'use strict'; | 10441 | * |
10043 | 10442 | * It will return false for other array-like objects like Filelist. | |
10044 | var keyOf = __webpack_require__(81); | 10443 | * |
10045 | 10444 | * @param {*} obj | |
10046 | /** | 10445 | * @return {boolean} |
10047 | * Module that is injectable into `EventPluginHub`, that specifies a | ||
10048 | * deterministic ordering of `EventPlugin`s. A convenient way to reason about | ||
10049 | * plugins, without having to package every one of them. This is better than | ||
10050 | * having plugins be ordered in the same order that they are injected because | ||
10051 | * that ordering would be influenced by the packaging order. | ||
10052 | * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that | ||
10053 | * preventing default on events is convenient in `SimpleEventPlugin` handlers. | ||
10054 | */ | 10446 | */ |
10055 | var DefaultEventPluginOrder = [keyOf({ ResponderEventPlugin: null }), keyOf({ SimpleEventPlugin: null }), keyOf({ TapEventPlugin: null }), keyOf({ EnterLeaveEventPlugin: null }), keyOf({ ChangeEventPlugin: null }), keyOf({ SelectEventPlugin: null }), keyOf({ BeforeInputEventPlugin: null })]; | 10447 | function hasArrayNature(obj) { |
10448 | return( | ||
10449 | // not null/false | ||
10450 | !!obj && ( | ||
10451 | // arrays are objects, NodeLists are functions in Safari | ||
10452 | typeof obj == 'object' || typeof obj == 'function') && | ||
10453 | // quacks like an array | ||
10454 | 'length' in obj && | ||
10455 | // not window | ||
10456 | !('setInterval' in obj) && | ||
10457 | // no DOM node should be considered an array-like | ||
10458 | // a 'select' element has 'length' and 'item' properties on IE8 | ||
10459 | typeof obj.nodeType != 'number' && ( | ||
10460 | // a real array | ||
10461 | Array.isArray(obj) || | ||
10462 | // arguments | ||
10463 | 'callee' in obj || | ||
10464 | // HTMLCollection/NodeList | ||
10465 | 'item' in obj) | ||
10466 | ); | ||
10467 | } | ||
10056 | 10468 | ||
10057 | module.exports = DefaultEventPluginOrder; | ||
10058 | |||
10059 | /***/ }, | ||
10060 | /* 87 */ | ||
10061 | /***/ function(module, exports, __webpack_require__) { | ||
10062 | |||
10063 | /** | 10469 | /** |
10064 | * Copyright 2013-2015, Facebook, Inc. | 10470 | * Ensure that the argument is an array by wrapping it in an array if it is not. |
10065 | * All rights reserved. | 10471 | * Creates a copy of the argument if it is already an array. |
10066 | * | 10472 | * |
10067 | * This source code is licensed under the BSD-style license found in the | 10473 | * This is mostly useful idiomatically: |
10068 | * LICENSE file in the root directory of this source tree. An additional grant | ||
10069 | * of patent rights can be found in the PATENTS file in the same directory. | ||
10070 | * | 10474 | * |
10071 | * @providesModule EnterLeaveEventPlugin | 10475 | * var createArrayFromMixed = require('createArrayFromMixed'); |
10072 | * @typechecks static-only | 10476 | * |
10477 | * function takesOneOrMoreThings(things) { | ||
10478 | * things = createArrayFromMixed(things); | ||
10479 | * ... | ||
10480 | * } | ||
10481 | * | ||
10482 | * This allows you to treat `things' as an array, but accept scalars in the API. | ||
10483 | * | ||
10484 | * If you need to convert an array-like object, like `arguments`, into an array | ||
10485 | * use toArray instead. | ||
10486 | * | ||
10487 | * @param {*} obj | ||
10488 | * @return {array} | ||
10073 | */ | 10489 | */ |
10074 | 10490 | function createArrayFromMixed(obj) { | |
10075 | 'use strict'; | 10491 | if (!hasArrayNature(obj)) { |
10076 | 10492 | return [obj]; | |
10077 | var EventConstants = __webpack_require__(32); | 10493 | } else if (Array.isArray(obj)) { |
10078 | var EventPropagators = __webpack_require__(75); | 10494 | return obj.slice(); |
10079 | var SyntheticMouseEvent = __webpack_require__(88); | 10495 | } else { |
10080 | 10496 | return toArray(obj); | |
10081 | var ReactMount = __webpack_require__(30); | ||
10082 | var keyOf = __webpack_require__(81); | ||
10083 | |||
10084 | var topLevelTypes = EventConstants.topLevelTypes; | ||
10085 | var getFirstReactDOM = ReactMount.getFirstReactDOM; | ||
10086 | |||
10087 | var eventTypes = { | ||
10088 | mouseEnter: { | ||
10089 | registrationName: keyOf({ onMouseEnter: null }), | ||
10090 | dependencies: [topLevelTypes.topMouseOut, topLevelTypes.topMouseOver] | ||
10091 | }, | ||
10092 | mouseLeave: { | ||
10093 | registrationName: keyOf({ onMouseLeave: null }), | ||
10094 | dependencies: [topLevelTypes.topMouseOut, topLevelTypes.topMouseOver] | ||
10095 | } | ||
10096 | }; | ||
10097 | |||
10098 | var extractedEvents = [null, null]; | ||
10099 | |||
10100 | var EnterLeaveEventPlugin = { | ||
10101 | |||
10102 | eventTypes: eventTypes, | ||
10103 | |||
10104 | /** | ||
10105 | * For almost every interaction we care about, there will be both a top-level | ||
10106 | * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that | ||
10107 | * we do not extract duplicate events. However, moving the mouse into the | ||
10108 | * browser from outside will not fire a `mouseout` event. In this case, we use | ||
10109 | * the `mouseover` top-level event. | ||
10110 | * | ||
10111 | * @param {string} topLevelType Record from `EventConstants`. | ||
10112 | * @param {DOMEventTarget} topLevelTarget The listening component root node. | ||
10113 | * @param {string} topLevelTargetID ID of `topLevelTarget`. | ||
10114 | * @param {object} nativeEvent Native browser event. | ||
10115 | * @return {*} An accumulation of synthetic events. | ||
10116 | * @see {EventPluginHub.extractEvents} | ||
10117 | */ | ||
10118 | extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) { | ||
10119 | if (topLevelType === topLevelTypes.topMouseOver && (nativeEvent.relatedTarget || nativeEvent.fromElement)) { | ||
10120 | return null; | ||
10121 | } | ||
10122 | if (topLevelType !== topLevelTypes.topMouseOut && topLevelType !== topLevelTypes.topMouseOver) { | ||
10123 | // Must not be a mouse in or mouse out - ignoring. | ||
10124 | return null; | ||
10125 | } | ||
10126 | |||
10127 | var win; | ||
10128 | if (topLevelTarget.window === topLevelTarget) { | ||
10129 | // `topLevelTarget` is probably a window object. | ||
10130 | win = topLevelTarget; | ||
10131 | } else { | ||
10132 | // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8. | ||
10133 | var doc = topLevelTarget.ownerDocument; | ||
10134 | if (doc) { | ||
10135 | win = doc.defaultView || doc.parentWindow; | ||
10136 | } else { | ||
10137 | win = window; | ||
10138 | } | ||
10139 | } | ||
10140 | |||
10141 | var from; | ||
10142 | var to; | ||
10143 | var fromID = ''; | ||
10144 | var toID = ''; | ||
10145 | if (topLevelType === topLevelTypes.topMouseOut) { | ||
10146 | from = topLevelTarget; | ||
10147 | fromID = topLevelTargetID; | ||
10148 | to = getFirstReactDOM(nativeEvent.relatedTarget || nativeEvent.toElement); | ||
10149 | if (to) { | ||
10150 | toID = ReactMount.getID(to); | ||
10151 | } else { | ||
10152 | to = win; | ||
10153 | } | ||
10154 | to = to || win; | ||
10155 | } else { | ||
10156 | from = win; | ||
10157 | to = topLevelTarget; | ||
10158 | toID = topLevelTargetID; | ||
10159 | } | ||
10160 | |||
10161 | if (from === to) { | ||
10162 | // Nothing pertains to our managed components. | ||
10163 | return null; | ||
10164 | } | ||
10165 | |||
10166 | var leave = SyntheticMouseEvent.getPooled(eventTypes.mouseLeave, fromID, nativeEvent, nativeEventTarget); | ||
10167 | leave.type = 'mouseleave'; | ||
10168 | leave.target = from; | ||
10169 | leave.relatedTarget = to; | ||
10170 | |||
10171 | var enter = SyntheticMouseEvent.getPooled(eventTypes.mouseEnter, toID, nativeEvent, nativeEventTarget); | ||
10172 | enter.type = 'mouseenter'; | ||
10173 | enter.target = to; | ||
10174 | enter.relatedTarget = from; | ||
10175 | |||
10176 | EventPropagators.accumulateEnterLeaveDispatches(leave, enter, fromID, toID); | ||
10177 | |||
10178 | extractedEvents[0] = leave; | ||
10179 | extractedEvents[1] = enter; | ||
10180 | |||
10181 | return extractedEvents; | ||
10182 | } | 10497 | } |
10498 | } | ||
10183 | 10499 | ||
10184 | }; | 10500 | module.exports = createArrayFromMixed; |
10185 | 10501 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | |
10186 | module.exports = EnterLeaveEventPlugin; | ||
10187 | 10502 | ||
10188 | /***/ }, | 10503 | /***/ }, |
10189 | /* 88 */ | 10504 | /* 94 */ |
10190 | /***/ function(module, exports, __webpack_require__) { | 10505 | /***/ function(module, exports, __webpack_require__) { |
10191 | 10506 | ||
10507 | /* WEBPACK VAR INJECTION */(function(process) {'use strict'; | ||
10508 | |||
10192 | /** | 10509 | /** |
10193 | * Copyright 2013-2015, Facebook, Inc. | 10510 | * Copyright (c) 2013-present, Facebook, Inc. |
10194 | * All rights reserved. | 10511 | * All rights reserved. |
10195 | * | 10512 | * |
10196 | * This source code is licensed under the BSD-style license found in the | 10513 | * This source code is licensed under the BSD-style license found in the |
10197 | * LICENSE file in the root directory of this source tree. An additional grant | 10514 | * LICENSE file in the root directory of this source tree. An additional grant |
10198 | * of patent rights can be found in the PATENTS file in the same directory. | 10515 | * of patent rights can be found in the PATENTS file in the same directory. |
10199 | * | 10516 | * |
10200 | * @providesModule SyntheticMouseEvent | ||
10201 | * @typechecks static-only | ||
10202 | */ | 10517 | */ |
10203 | 10518 | ||
10204 | 'use strict'; | 10519 | /*eslint-disable fb-www/unsafe-html */ |
10205 | 10520 | ||
10206 | var SyntheticUIEvent = __webpack_require__(89); | 10521 | var ExecutionEnvironment = __webpack_require__(52); |
10207 | var ViewportMetrics = __webpack_require__(40); | ||
10208 | 10522 | ||
10209 | var getEventModifierState = __webpack_require__(90); | 10523 | var invariant = __webpack_require__(10); |
10210 | 10524 | ||
10211 | /** | 10525 | /** |
10212 | * @interface MouseEvent | 10526 | * Dummy container used to detect which wraps are necessary. |
10213 | * @see http://www.w3.org/TR/DOM-Level-3-Events/ | ||
10214 | */ | 10527 | */ |
10215 | var MouseEventInterface = { | 10528 | var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null; |
10216 | screenX: null, | ||
10217 | screenY: null, | ||
10218 | clientX: null, | ||
10219 | clientY: null, | ||
10220 | ctrlKey: null, | ||
10221 | shiftKey: null, | ||
10222 | altKey: null, | ||
10223 | metaKey: null, | ||
10224 | getModifierState: getEventModifierState, | ||
10225 | button: function (event) { | ||
10226 | // Webkit, Firefox, IE9+ | ||
10227 | // which: 1 2 3 | ||
10228 | // button: 0 1 2 (standard) | ||
10229 | var button = event.button; | ||
10230 | if ('which' in event) { | ||
10231 | return button; | ||
10232 | } | ||
10233 | // IE<9 | ||
10234 | // which: undefined | ||
10235 | // button: 0 0 0 | ||
10236 | // button: 1 4 2 (onmouseup) | ||
10237 | return button === 2 ? 2 : button === 4 ? 1 : 0; | ||
10238 | }, | ||
10239 | buttons: null, | ||
10240 | relatedTarget: function (event) { | ||
10241 | return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement); | ||
10242 | }, | ||
10243 | // "Proprietary" Interface. | ||
10244 | pageX: function (event) { | ||
10245 | return 'pageX' in event ? event.pageX : event.clientX + ViewportMetrics.currentScrollLeft; | ||
10246 | }, | ||
10247 | pageY: function (event) { | ||
10248 | return 'pageY' in event ? event.pageY : event.clientY + ViewportMetrics.currentScrollTop; | ||
10249 | } | ||
10250 | }; | ||
10251 | 10529 | ||
10252 | /** | 10530 | /** |
10253 | * @param {object} dispatchConfig Configuration used to dispatch this event. | 10531 | * Some browsers cannot use `innerHTML` to render certain elements standalone, |
10254 | * @param {string} dispatchMarker Marker identifying the event target. | 10532 | * so we wrap them, render the wrapped nodes, then extract the desired node. |
10255 | * @param {object} nativeEvent Native browser event. | 10533 | * |
10256 | * @extends {SyntheticUIEvent} | 10534 | * In IE8, certain elements cannot render alone, so wrap all elements ('*'). |
10257 | */ | 10535 | */ |
10258 | function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | ||
10259 | SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | ||
10260 | } | ||
10261 | 10536 | ||
10262 | SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface); | 10537 | var shouldWrap = {}; |
10263 | 10538 | ||
10264 | module.exports = SyntheticMouseEvent; | 10539 | var selectWrap = [1, '<select multiple="true">', '</select>']; |
10265 | 10540 | var tableWrap = [1, '<table>', '</table>']; | |
10266 | /***/ }, | 10541 | var trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>']; |
10267 | /* 89 */ | ||
10268 | /***/ function(module, exports, __webpack_require__) { | ||
10269 | |||
10270 | /** | ||
10271 | * Copyright 2013-2015, Facebook, Inc. | ||
10272 | * All rights reserved. | ||
10273 | * | ||
10274 | * This source code is licensed under the BSD-style license found in the | ||
10275 | * LICENSE file in the root directory of this source tree. An additional grant | ||
10276 | * of patent rights can be found in the PATENTS file in the same directory. | ||
10277 | * | ||
10278 | * @providesModule SyntheticUIEvent | ||
10279 | * @typechecks static-only | ||
10280 | */ | ||
10281 | 10542 | ||
10282 | 'use strict'; | 10543 | var svgWrap = [1, '<svg xmlns="http://www.w3.org/2000/svg">', '</svg>']; |
10283 | 10544 | ||
10284 | var SyntheticEvent = __webpack_require__(79); | 10545 | var markupWrap = { |
10546 | '*': [1, '?<div>', '</div>'], | ||
10285 | 10547 | ||
10286 | var getEventTarget = __webpack_require__(83); | 10548 | 'area': [1, '<map>', '</map>'], |
10549 | 'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'], | ||
10550 | 'legend': [1, '<fieldset>', '</fieldset>'], | ||
10551 | 'param': [1, '<object>', '</object>'], | ||
10552 | 'tr': [2, '<table><tbody>', '</tbody></table>'], | ||
10287 | 10553 | ||
10288 | /** | 10554 | 'optgroup': selectWrap, |
10289 | * @interface UIEvent | 10555 | 'option': selectWrap, |
10290 | * @see http://www.w3.org/TR/DOM-Level-3-Events/ | ||
10291 | */ | ||
10292 | var UIEventInterface = { | ||
10293 | view: function (event) { | ||
10294 | if (event.view) { | ||
10295 | return event.view; | ||
10296 | } | ||
10297 | 10556 | ||
10298 | var target = getEventTarget(event); | 10557 | 'caption': tableWrap, |
10299 | if (target != null && target.window === target) { | 10558 | 'colgroup': tableWrap, |
10300 | // target is a window object | 10559 | 'tbody': tableWrap, |
10301 | return target; | 10560 | 'tfoot': tableWrap, |
10302 | } | 10561 | 'thead': tableWrap, |
10303 | 10562 | ||
10304 | var doc = target.ownerDocument; | 10563 | 'td': trWrap, |
10305 | // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8. | 10564 | 'th': trWrap |
10306 | if (doc) { | ||
10307 | return doc.defaultView || doc.parentWindow; | ||
10308 | } else { | ||
10309 | return window; | ||
10310 | } | ||
10311 | }, | ||
10312 | detail: function (event) { | ||
10313 | return event.detail || 0; | ||
10314 | } | ||
10315 | }; | 10565 | }; |
10316 | 10566 | ||
10317 | /** | 10567 | // Initialize the SVG elements since we know they'll always need to be wrapped |
10318 | * @param {object} dispatchConfig Configuration used to dispatch this event. | 10568 | // consistently. If they are created inside a <div> they will be initialized in |
10319 | * @param {string} dispatchMarker Marker identifying the event target. | 10569 | // the wrong namespace (and will not display). |
10320 | * @param {object} nativeEvent Native browser event. | 10570 | var svgElements = ['circle', 'clipPath', 'defs', 'ellipse', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'text', 'tspan']; |
10321 | * @extends {SyntheticEvent} | 10571 | svgElements.forEach(function (nodeName) { |
10322 | */ | 10572 | markupWrap[nodeName] = svgWrap; |
10323 | function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | 10573 | shouldWrap[nodeName] = true; |
10324 | SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | 10574 | }); |
10325 | } | ||
10326 | |||
10327 | SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface); | ||
10328 | 10575 | ||
10329 | module.exports = SyntheticUIEvent; | ||
10330 | |||
10331 | /***/ }, | ||
10332 | /* 90 */ | ||
10333 | /***/ function(module, exports) { | ||
10334 | |||
10335 | /** | 10576 | /** |
10336 | * Copyright 2013-2015, Facebook, Inc. | 10577 | * Gets the markup wrap configuration for the supplied `nodeName`. |
10337 | * All rights reserved. | ||
10338 | * | 10578 | * |
10339 | * This source code is licensed under the BSD-style license found in the | 10579 | * NOTE: This lazily detects which wraps are necessary for the current browser. |
10340 | * LICENSE file in the root directory of this source tree. An additional grant | ||
10341 | * of patent rights can be found in the PATENTS file in the same directory. | ||
10342 | * | 10580 | * |
10343 | * @providesModule getEventModifierState | 10581 | * @param {string} nodeName Lowercase `nodeName`. |
10344 | * @typechecks static-only | 10582 | * @return {?array} Markup wrap configuration, if applicable. |
10345 | */ | ||
10346 | |||
10347 | 'use strict'; | ||
10348 | |||
10349 | /** | ||
10350 | * Translation from modifier key to the associated property in the event. | ||
10351 | * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers | ||
10352 | */ | 10583 | */ |
10353 | 10584 | function getMarkupWrap(nodeName) { | |
10354 | var modifierKeyToProp = { | 10585 | !!!dummyNode ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Markup wrapping node not initialized') : invariant(false) : void 0; |
10355 | 'Alt': 'altKey', | 10586 | if (!markupWrap.hasOwnProperty(nodeName)) { |
10356 | 'Control': 'ctrlKey', | 10587 | nodeName = '*'; |
10357 | 'Meta': 'metaKey', | ||
10358 | 'Shift': 'shiftKey' | ||
10359 | }; | ||
10360 | |||
10361 | // IE8 does not implement getModifierState so we simply map it to the only | ||
10362 | // modifier keys exposed by the event itself, does not support Lock-keys. | ||
10363 | // Currently, all major browsers except Chrome seems to support Lock-keys. | ||
10364 | function modifierStateGetter(keyArg) { | ||
10365 | var syntheticEvent = this; | ||
10366 | var nativeEvent = syntheticEvent.nativeEvent; | ||
10367 | if (nativeEvent.getModifierState) { | ||
10368 | return nativeEvent.getModifierState(keyArg); | ||
10369 | } | 10588 | } |
10370 | var keyProp = modifierKeyToProp[keyArg]; | 10589 | if (!shouldWrap.hasOwnProperty(nodeName)) { |
10371 | return keyProp ? !!nativeEvent[keyProp] : false; | 10590 | if (nodeName === '*') { |
10372 | } | 10591 | dummyNode.innerHTML = '<link />'; |
10373 | 10592 | } else { | |
10374 | function getEventModifierState(nativeEvent) { | 10593 | dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>'; |
10375 | return modifierStateGetter; | 10594 | } |
10595 | shouldWrap[nodeName] = !dummyNode.firstChild; | ||
10596 | } | ||
10597 | return shouldWrap[nodeName] ? markupWrap[nodeName] : null; | ||
10376 | } | 10598 | } |
10377 | 10599 | ||
10378 | module.exports = getEventModifierState; | 10600 | module.exports = getMarkupWrap; |
10601 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
10379 | 10602 | ||
10380 | /***/ }, | 10603 | /***/ }, |
10381 | /* 91 */ | 10604 | /* 95 */ |
10382 | /***/ function(module, exports, __webpack_require__) { | 10605 | /***/ function(module, exports, __webpack_require__) { |
10383 | 10606 | ||
10384 | /** | 10607 | /** |
10385 | * Copyright 2013-2015, Facebook, Inc. | 10608 | * Copyright 2013-present, Facebook, Inc. |
10386 | * All rights reserved. | 10609 | * All rights reserved. |
10387 | * | 10610 | * |
10388 | * This source code is licensed under the BSD-style license found in the | 10611 | * This source code is licensed under the BSD-style license found in the |
10389 | * LICENSE file in the root directory of this source tree. An additional grant | 10612 | * LICENSE file in the root directory of this source tree. An additional grant |
10390 | * of patent rights can be found in the PATENTS file in the same directory. | 10613 | * of patent rights can be found in the PATENTS file in the same directory. |
10391 | * | 10614 | * |
10392 | * @providesModule HTMLDOMPropertyConfig | 10615 | * @providesModule ReactMultiChildUpdateTypes |
10393 | */ | 10616 | */ |
10394 | 10617 | ||
10395 | 'use strict'; | 10618 | 'use strict'; |
10396 | 10619 | ||
10397 | var DOMProperty = __webpack_require__(25); | 10620 | var keyMirror = __webpack_require__(25); |
10398 | var ExecutionEnvironment = __webpack_require__(11); | ||
10399 | 10621 | ||
10400 | var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE; | 10622 | /** |
10401 | var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY; | 10623 | * When a component's children are updated, a series of update configuration |
10402 | var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE; | 10624 | * objects are created in order to batch and serialize the required changes. |
10403 | var HAS_SIDE_EFFECTS = DOMProperty.injection.HAS_SIDE_EFFECTS; | ||
10404 | var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE; | ||
10405 | var HAS_POSITIVE_NUMERIC_VALUE = DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE; | ||
10406 | var HAS_OVERLOADED_BOOLEAN_VALUE = DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE; | ||
10407 | |||
10408 | var hasSVG; | ||
10409 | if (ExecutionEnvironment.canUseDOM) { | ||
10410 | var implementation = document.implementation; | ||
10411 | hasSVG = implementation && implementation.hasFeature && implementation.hasFeature('http://www.w3.org/TR/SVG11/feature#BasicStructure', '1.1'); | ||
10412 | } | ||
10413 | |||
10414 | var HTMLDOMPropertyConfig = { | ||
10415 | isCustomAttribute: RegExp.prototype.test.bind(/^(data|aria)-[a-z_][a-z\d_.\-]*$/), | ||
10416 | Properties: { | ||
10417 | /** | ||
10418 | * Standard Properties | ||
10419 | */ | ||
10420 | accept: null, | ||
10421 | acceptCharset: null, | ||
10422 | accessKey: null, | ||
10423 | action: null, | ||
10424 | allowFullScreen: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE, | ||
10425 | allowTransparency: MUST_USE_ATTRIBUTE, | ||
10426 | alt: null, | ||
10427 | async: HAS_BOOLEAN_VALUE, | ||
10428 | autoComplete: null, | ||
10429 | // autoFocus is polyfilled/normalized by AutoFocusUtils | ||
10430 | // autoFocus: HAS_BOOLEAN_VALUE, | ||
10431 | autoPlay: HAS_BOOLEAN_VALUE, | ||
10432 | capture: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE, | ||
10433 | cellPadding: null, | ||
10434 | cellSpacing: null, | ||
10435 | charSet: MUST_USE_ATTRIBUTE, | ||
10436 | challenge: MUST_USE_ATTRIBUTE, | ||
10437 | checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, | ||
10438 | classID: MUST_USE_ATTRIBUTE, | ||
10439 | // To set className on SVG elements, it's necessary to use .setAttribute; | ||
10440 | // this works on HTML elements too in all browsers except IE8. Conveniently, | ||
10441 | // IE8 doesn't support SVG and so we can simply use the attribute in | ||
10442 | // browsers that support SVG and the property in browsers that don't, | ||
10443 | // regardless of whether the element is HTML or SVG. | ||
10444 | className: hasSVG ? MUST_USE_ATTRIBUTE : MUST_USE_PROPERTY, | ||
10445 | cols: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE, | ||
10446 | colSpan: null, | ||
10447 | content: null, | ||
10448 | contentEditable: null, | ||
10449 | contextMenu: MUST_USE_ATTRIBUTE, | ||
10450 | controls: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, | ||
10451 | coords: null, | ||
10452 | crossOrigin: null, | ||
10453 | data: null, // For `<object />` acts as `src`. | ||
10454 | dateTime: MUST_USE_ATTRIBUTE, | ||
10455 | 'default': HAS_BOOLEAN_VALUE, | ||
10456 | defer: HAS_BOOLEAN_VALUE, | ||
10457 | dir: null, | ||
10458 | disabled: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE, | ||
10459 | download: HAS_OVERLOADED_BOOLEAN_VALUE, | ||
10460 | draggable: null, | ||
10461 | encType: null, | ||
10462 | form: MUST_USE_ATTRIBUTE, | ||
10463 | formAction: MUST_USE_ATTRIBUTE, | ||
10464 | formEncType: MUST_USE_ATTRIBUTE, | ||
10465 | formMethod: MUST_USE_ATTRIBUTE, | ||
10466 | formNoValidate: HAS_BOOLEAN_VALUE, | ||
10467 | formTarget: MUST_USE_ATTRIBUTE, | ||
10468 | frameBorder: MUST_USE_ATTRIBUTE, | ||
10469 | headers: null, | ||
10470 | height: MUST_USE_ATTRIBUTE, | ||
10471 | hidden: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE, | ||
10472 | high: null, | ||
10473 | href: null, | ||
10474 | hrefLang: null, | ||
10475 | htmlFor: null, | ||
10476 | httpEquiv: null, | ||
10477 | icon: null, | ||
10478 | id: MUST_USE_PROPERTY, | ||
10479 | inputMode: MUST_USE_ATTRIBUTE, | ||
10480 | integrity: null, | ||
10481 | is: MUST_USE_ATTRIBUTE, | ||
10482 | keyParams: MUST_USE_ATTRIBUTE, | ||
10483 | keyType: MUST_USE_ATTRIBUTE, | ||
10484 | kind: null, | ||
10485 | label: null, | ||
10486 | lang: null, | ||
10487 | list: MUST_USE_ATTRIBUTE, | ||
10488 | loop: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, | ||
10489 | low: null, | ||
10490 | manifest: MUST_USE_ATTRIBUTE, | ||
10491 | marginHeight: null, | ||
10492 | marginWidth: null, | ||
10493 | max: null, | ||
10494 | maxLength: MUST_USE_ATTRIBUTE, | ||
10495 | media: MUST_USE_ATTRIBUTE, | ||
10496 | mediaGroup: null, | ||
10497 | method: null, | ||
10498 | min: null, | ||
10499 | minLength: MUST_USE_ATTRIBUTE, | ||
10500 | multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, | ||
10501 | muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, | ||
10502 | name: null, | ||
10503 | nonce: MUST_USE_ATTRIBUTE, | ||
10504 | noValidate: HAS_BOOLEAN_VALUE, | ||
10505 | open: HAS_BOOLEAN_VALUE, | ||
10506 | optimum: null, | ||
10507 | pattern: null, | ||
10508 | placeholder: null, | ||
10509 | poster: null, | ||
10510 | preload: null, | ||
10511 | radioGroup: null, | ||
10512 | readOnly: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, | ||
10513 | rel: null, | ||
10514 | required: HAS_BOOLEAN_VALUE, | ||
10515 | reversed: HAS_BOOLEAN_VALUE, | ||
10516 | role: MUST_USE_ATTRIBUTE, | ||
10517 | rows: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE, | ||
10518 | rowSpan: null, | ||
10519 | sandbox: null, | ||
10520 | scope: null, | ||
10521 | scoped: HAS_BOOLEAN_VALUE, | ||
10522 | scrolling: null, | ||
10523 | seamless: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE, | ||
10524 | selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, | ||
10525 | shape: null, | ||
10526 | size: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE, | ||
10527 | sizes: MUST_USE_ATTRIBUTE, | ||
10528 | span: HAS_POSITIVE_NUMERIC_VALUE, | ||
10529 | spellCheck: null, | ||
10530 | src: null, | ||
10531 | srcDoc: MUST_USE_PROPERTY, | ||
10532 | srcLang: null, | ||
10533 | srcSet: MUST_USE_ATTRIBUTE, | ||
10534 | start: HAS_NUMERIC_VALUE, | ||
10535 | step: null, | ||
10536 | style: null, | ||
10537 | summary: null, | ||
10538 | tabIndex: null, | ||
10539 | target: null, | ||
10540 | title: null, | ||
10541 | type: null, | ||
10542 | useMap: null, | ||
10543 | value: MUST_USE_PROPERTY | HAS_SIDE_EFFECTS, | ||
10544 | width: MUST_USE_ATTRIBUTE, | ||
10545 | wmode: MUST_USE_ATTRIBUTE, | ||
10546 | wrap: null, | ||
10547 | |||
10548 | /** | ||
10549 | * RDFa Properties | ||
10550 | */ | ||
10551 | about: MUST_USE_ATTRIBUTE, | ||
10552 | datatype: MUST_USE_ATTRIBUTE, | ||
10553 | inlist: MUST_USE_ATTRIBUTE, | ||
10554 | prefix: MUST_USE_ATTRIBUTE, | ||
10555 | // property is also supported for OpenGraph in meta tags. | ||
10556 | property: MUST_USE_ATTRIBUTE, | ||
10557 | resource: MUST_USE_ATTRIBUTE, | ||
10558 | 'typeof': MUST_USE_ATTRIBUTE, | ||
10559 | vocab: MUST_USE_ATTRIBUTE, | ||
10560 | |||
10561 | /** | ||
10562 | * Non-standard Properties | ||
10563 | */ | ||
10564 | // autoCapitalize and autoCorrect are supported in Mobile Safari for | ||
10565 | // keyboard hints. | ||
10566 | autoCapitalize: null, | ||
10567 | autoCorrect: null, | ||
10568 | // autoSave allows WebKit/Blink to persist values of input fields on page reloads | ||
10569 | autoSave: null, | ||
10570 | // color is for Safari mask-icon link | ||
10571 | color: null, | ||
10572 | // itemProp, itemScope, itemType are for | ||
10573 | // Microdata support. See http://schema.org/docs/gs.html | ||
10574 | itemProp: MUST_USE_ATTRIBUTE, | ||
10575 | itemScope: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE, | ||
10576 | itemType: MUST_USE_ATTRIBUTE, | ||
10577 | // itemID and itemRef are for Microdata support as well but | ||
10578 | // only specified in the the WHATWG spec document. See | ||
10579 | // https://html.spec.whatwg.org/multipage/microdata.html#microdata-dom-api | ||
10580 | itemID: MUST_USE_ATTRIBUTE, | ||
10581 | itemRef: MUST_USE_ATTRIBUTE, | ||
10582 | // results show looking glass icon and recent searches on input | ||
10583 | // search fields in WebKit/Blink | ||
10584 | results: null, | ||
10585 | // IE-only attribute that specifies security restrictions on an iframe | ||
10586 | // as an alternative to the sandbox attribute on IE<10 | ||
10587 | security: MUST_USE_ATTRIBUTE, | ||
10588 | // IE-only attribute that controls focus behavior | ||
10589 | unselectable: MUST_USE_ATTRIBUTE | ||
10590 | }, | ||
10591 | DOMAttributeNames: { | ||
10592 | acceptCharset: 'accept-charset', | ||
10593 | className: 'class', | ||
10594 | htmlFor: 'for', | ||
10595 | httpEquiv: 'http-equiv' | ||
10596 | }, | ||
10597 | DOMPropertyNames: { | ||
10598 | autoCapitalize: 'autocapitalize', | ||
10599 | autoComplete: 'autocomplete', | ||
10600 | autoCorrect: 'autocorrect', | ||
10601 | autoFocus: 'autofocus', | ||
10602 | autoPlay: 'autoplay', | ||
10603 | autoSave: 'autosave', | ||
10604 | // `encoding` is equivalent to `enctype`, IE8 lacks an `enctype` setter. | ||
10605 | // http://www.w3.org/TR/html5/forms.html#dom-fs-encoding | ||
10606 | encType: 'encoding', | ||
10607 | hrefLang: 'hreflang', | ||
10608 | radioGroup: 'radiogroup', | ||
10609 | spellCheck: 'spellcheck', | ||
10610 | srcDoc: 'srcdoc', | ||
10611 | srcSet: 'srcset' | ||
10612 | } | ||
10613 | }; | ||
10614 | |||
10615 | module.exports = HTMLDOMPropertyConfig; | ||
10616 | |||
10617 | /***/ }, | ||
10618 | /* 92 */ | ||
10619 | /***/ function(module, exports, __webpack_require__) { | ||
10620 | |||
10621 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
10622 | * Copyright 2013-2015, Facebook, Inc. | ||
10623 | * All rights reserved. | ||
10624 | * | 10625 | * |
10625 | * This source code is licensed under the BSD-style license found in the | 10626 | * Enumerates all the possible types of update configurations. |
10626 | * LICENSE file in the root directory of this source tree. An additional grant | ||
10627 | * of patent rights can be found in the PATENTS file in the same directory. | ||
10628 | * | 10627 | * |
10629 | * @providesModule ReactBrowserComponentMixin | 10628 | * @internal |
10630 | */ | 10629 | */ |
10630 | var ReactMultiChildUpdateTypes = keyMirror({ | ||
10631 | INSERT_MARKUP: null, | ||
10632 | MOVE_EXISTING: null, | ||
10633 | REMOVE_NODE: null, | ||
10634 | SET_MARKUP: null, | ||
10635 | TEXT_CONTENT: null | ||
10636 | }); | ||
10631 | 10637 | ||
10632 | 'use strict'; | 10638 | module.exports = ReactMultiChildUpdateTypes; |
10633 | |||
10634 | var ReactInstanceMap = __webpack_require__(49); | ||
10635 | |||
10636 | var findDOMNode = __webpack_require__(93); | ||
10637 | var warning = __webpack_require__(27); | ||
10638 | |||
10639 | var didWarnKey = '_getDOMNodeDidWarn'; | ||
10640 | |||
10641 | var ReactBrowserComponentMixin = { | ||
10642 | /** | ||
10643 | * Returns the DOM node rendered by this component. | ||
10644 | * | ||
10645 | * @return {DOMElement} The root node of this component. | ||
10646 | * @final | ||
10647 | * @protected | ||
10648 | */ | ||
10649 | getDOMNode: function () { | ||
10650 | process.env.NODE_ENV !== 'production' ? warning(this.constructor[didWarnKey], '%s.getDOMNode(...) is deprecated. Please use ' + 'ReactDOM.findDOMNode(instance) instead.', ReactInstanceMap.get(this).getName() || this.tagName || 'Unknown') : undefined; | ||
10651 | this.constructor[didWarnKey] = true; | ||
10652 | return findDOMNode(this); | ||
10653 | } | ||
10654 | }; | ||
10655 | |||
10656 | module.exports = ReactBrowserComponentMixin; | ||
10657 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
10658 | 10639 | ||
10659 | /***/ }, | 10640 | /***/ }, |
10660 | /* 93 */ | 10641 | /* 96 */ |
10661 | /***/ function(module, exports, __webpack_require__) { | 10642 | /***/ function(module, exports, __webpack_require__) { |
10662 | 10643 | ||
10663 | /* WEBPACK VAR INJECTION */(function(process) {/** | 10644 | /** |
10664 | * Copyright 2013-2015, Facebook, Inc. | 10645 | * Copyright 2013-present, Facebook, Inc. |
10665 | * All rights reserved. | 10646 | * All rights reserved. |
10666 | * | 10647 | * |
10667 | * This source code is licensed under the BSD-style license found in the | 10648 | * This source code is licensed under the BSD-style license found in the |
10668 | * LICENSE file in the root directory of this source tree. An additional grant | 10649 | * LICENSE file in the root directory of this source tree. An additional grant |
10669 | * of patent rights can be found in the PATENTS file in the same directory. | 10650 | * of patent rights can be found in the PATENTS file in the same directory. |
10670 | * | 10651 | * |
10671 | * @providesModule findDOMNode | 10652 | * @providesModule ReactDOMIDOperations |
10672 | * @typechecks static-only | ||
10673 | */ | 10653 | */ |
10674 | 10654 | ||
10675 | 'use strict'; | 10655 | 'use strict'; |
10676 | 10656 | ||
10677 | var ReactCurrentOwner = __webpack_require__(7); | 10657 | var DOMChildrenOperations = __webpack_require__(84); |
10678 | var ReactInstanceMap = __webpack_require__(49); | 10658 | var ReactDOMComponentTree = __webpack_require__(39); |
10679 | var ReactMount = __webpack_require__(30); | ||
10680 | |||
10681 | var invariant = __webpack_require__(15); | ||
10682 | var warning = __webpack_require__(27); | ||
10683 | 10659 | ||
10684 | /** | 10660 | /** |
10685 | * Returns the DOM node rendered by this element. | 10661 | * Operations used to process updates to DOM nodes. |
10686 | * | ||
10687 | * @param {ReactComponent|DOMElement} componentOrElement | ||
10688 | * @return {?DOMElement} The root node of this element. | ||
10689 | */ | ||
10690 | function findDOMNode(componentOrElement) { | ||
10691 | if (process.env.NODE_ENV !== 'production') { | ||
10692 | var owner = ReactCurrentOwner.current; | ||
10693 | if (owner !== null) { | ||
10694 | process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing getDOMNode or 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') : undefined; | ||
10695 | owner._warnedAboutRefsInRender = true; | ||
10696 | } | ||
10697 | } | ||
10698 | if (componentOrElement == null) { | ||
10699 | return null; | ||
10700 | } | ||
10701 | if (componentOrElement.nodeType === 1) { | ||
10702 | return componentOrElement; | ||
10703 | } | ||
10704 | if (ReactInstanceMap.has(componentOrElement)) { | ||
10705 | return ReactMount.getNodeFromInstance(componentOrElement); | ||
10706 | } | ||
10707 | !(componentOrElement.render == null || typeof componentOrElement.render !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findDOMNode was called on an unmounted component.') : invariant(false) : undefined; | ||
10708 | true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)', Object.keys(componentOrElement)) : invariant(false) : undefined; | ||
10709 | } | ||
10710 | |||
10711 | module.exports = findDOMNode; | ||
10712 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
10713 | |||
10714 | /***/ }, | ||
10715 | /* 94 */ | ||
10716 | /***/ function(module, exports, __webpack_require__) { | ||
10717 | |||
10718 | /** | ||
10719 | * Copyright 2013-2015, Facebook, Inc. | ||
10720 | * All rights reserved. | ||
10721 | * | ||
10722 | * This source code is licensed under the BSD-style license found in the | ||
10723 | * LICENSE file in the root directory of this source tree. An additional grant | ||
10724 | * of patent rights can be found in the PATENTS file in the same directory. | ||
10725 | * | ||
10726 | * @providesModule ReactDefaultBatchingStrategy | ||
10727 | */ | 10662 | */ |
10728 | 10663 | var ReactDOMIDOperations = { | |
10729 | 'use strict'; | ||
10730 | |||
10731 | var ReactUpdates = __webpack_require__(56); | ||
10732 | var Transaction = __webpack_require__(59); | ||
10733 | |||
10734 | var assign = __webpack_require__(41); | ||
10735 | var emptyFunction = __webpack_require__(17); | ||
10736 | |||
10737 | var RESET_BATCHED_UPDATES = { | ||
10738 | initialize: emptyFunction, | ||
10739 | close: function () { | ||
10740 | ReactDefaultBatchingStrategy.isBatchingUpdates = false; | ||
10741 | } | ||
10742 | }; | ||
10743 | |||
10744 | var FLUSH_BATCHED_UPDATES = { | ||
10745 | initialize: emptyFunction, | ||
10746 | close: ReactUpdates.flushBatchedUpdates.bind(ReactUpdates) | ||
10747 | }; | ||
10748 | |||
10749 | var TRANSACTION_WRAPPERS = [FLUSH_BATCHED_UPDATES, RESET_BATCHED_UPDATES]; | ||
10750 | |||
10751 | function ReactDefaultBatchingStrategyTransaction() { | ||
10752 | this.reinitializeTransaction(); | ||
10753 | } | ||
10754 | |||
10755 | assign(ReactDefaultBatchingStrategyTransaction.prototype, Transaction.Mixin, { | ||
10756 | getTransactionWrappers: function () { | ||
10757 | return TRANSACTION_WRAPPERS; | ||
10758 | } | ||
10759 | }); | ||
10760 | |||
10761 | var transaction = new ReactDefaultBatchingStrategyTransaction(); | ||
10762 | |||
10763 | var ReactDefaultBatchingStrategy = { | ||
10764 | isBatchingUpdates: false, | ||
10765 | 10664 | ||
10766 | /** | 10665 | /** |
10767 | * Call the provided function in a context within which calls to `setState` | 10666 | * Updates a component's children by processing a series of updates. |
10768 | * and friends are batched such that components aren't updated unnecessarily. | 10667 | * |
10668 | * @param {array<object>} updates List of update configurations. | ||
10669 | * @internal | ||
10769 | */ | 10670 | */ |
10770 | batchedUpdates: function (callback, a, b, c, d, e) { | 10671 | dangerouslyProcessChildrenUpdates: function (parentInst, updates) { |
10771 | var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates; | 10672 | var node = ReactDOMComponentTree.getNodeFromInstance(parentInst); |
10772 | 10673 | DOMChildrenOperations.processUpdates(node, updates); | |
10773 | ReactDefaultBatchingStrategy.isBatchingUpdates = true; | ||
10774 | |||
10775 | // The code is written this way to avoid extra allocations | ||
10776 | if (alreadyBatchingUpdates) { | ||
10777 | callback(a, b, c, d, e); | ||
10778 | } else { | ||
10779 | transaction.perform(callback, null, a, b, c, d, e); | ||
10780 | } | ||
10781 | } | 10674 | } |
10782 | }; | 10675 | }; |
10783 | 10676 | ||
10784 | module.exports = ReactDefaultBatchingStrategy; | 10677 | module.exports = ReactDOMIDOperations; |
10785 | 10678 | ||
10786 | /***/ }, | 10679 | /***/ }, |
10787 | /* 95 */ | 10680 | /* 97 */ |
10788 | /***/ function(module, exports, __webpack_require__) { | 10681 | /***/ function(module, exports, __webpack_require__) { |
10789 | 10682 | ||
10790 | /* WEBPACK VAR INJECTION */(function(process) {/** | 10683 | /* WEBPACK VAR INJECTION */(function(process) {/** |
10791 | * Copyright 2013-2015, Facebook, Inc. | 10684 | * Copyright 2013-present, Facebook, Inc. |
10792 | * All rights reserved. | 10685 | * All rights reserved. |
10793 | * | 10686 | * |
10794 | * This source code is licensed under the BSD-style license found in the | 10687 | * This source code is licensed under the BSD-style license found in the |
@@ -10796,54 +10689,65 @@ | |||
10796 | * of patent rights can be found in the PATENTS file in the same directory. | 10689 | * of patent rights can be found in the PATENTS file in the same directory. |
10797 | * | 10690 | * |
10798 | * @providesModule ReactDOMComponent | 10691 | * @providesModule ReactDOMComponent |
10799 | * @typechecks static-only | ||
10800 | */ | 10692 | */ |
10801 | 10693 | ||
10802 | /* global hasOwnProperty:true */ | 10694 | /* global hasOwnProperty:true */ |
10803 | 10695 | ||
10804 | 'use strict'; | 10696 | 'use strict'; |
10805 | 10697 | ||
10806 | var AutoFocusUtils = __webpack_require__(96); | 10698 | var _prodInvariant = __webpack_require__(9), |
10807 | var CSSPropertyOperations = __webpack_require__(98); | 10699 | _assign = __webpack_require__(6); |
10808 | var DOMProperty = __webpack_require__(25); | 10700 | |
10809 | var DOMPropertyOperations = __webpack_require__(24); | 10701 | var AutoFocusUtils = __webpack_require__(98); |
10810 | var EventConstants = __webpack_require__(32); | 10702 | var CSSPropertyOperations = __webpack_require__(100); |
10811 | var ReactBrowserEventEmitter = __webpack_require__(31); | 10703 | var DOMLazyTree = __webpack_require__(85); |
10812 | var ReactComponentBrowserEnvironment = __webpack_require__(28); | 10704 | var DOMNamespaces = __webpack_require__(86); |
10813 | var ReactDOMButton = __webpack_require__(106); | 10705 | var DOMProperty = __webpack_require__(40); |
10814 | var ReactDOMInput = __webpack_require__(107); | 10706 | var DOMPropertyOperations = __webpack_require__(108); |
10815 | var ReactDOMOption = __webpack_require__(111); | 10707 | var EventConstants = __webpack_require__(44); |
10816 | var ReactDOMSelect = __webpack_require__(114); | 10708 | var EventPluginHub = __webpack_require__(46); |
10817 | var ReactDOMTextarea = __webpack_require__(115); | 10709 | var EventPluginRegistry = __webpack_require__(47); |
10818 | var ReactMount = __webpack_require__(30); | 10710 | var ReactBrowserEventEmitter = __webpack_require__(114); |
10819 | var ReactMultiChild = __webpack_require__(116); | 10711 | var ReactComponentBrowserEnvironment = __webpack_require__(83); |
10820 | var ReactPerf = __webpack_require__(20); | 10712 | var ReactDOMButton = __webpack_require__(117); |
10821 | var ReactUpdateQueue = __webpack_require__(55); | 10713 | var ReactDOMComponentFlags = __webpack_require__(41); |
10822 | 10714 | var ReactDOMComponentTree = __webpack_require__(39); | |
10823 | var assign = __webpack_require__(41); | 10715 | var ReactDOMInput = __webpack_require__(119); |
10824 | var canDefineProperty = __webpack_require__(45); | 10716 | var ReactDOMOption = __webpack_require__(121); |
10825 | var escapeTextContentForBrowser = __webpack_require__(23); | 10717 | var ReactDOMSelect = __webpack_require__(122); |
10826 | var invariant = __webpack_require__(15); | 10718 | var ReactDOMTextarea = __webpack_require__(123); |
10827 | var isEventSupported = __webpack_require__(42); | 10719 | var ReactInstrumentation = __webpack_require__(65); |
10828 | var keyOf = __webpack_require__(81); | 10720 | var ReactMultiChild = __webpack_require__(124); |
10829 | var setInnerHTML = __webpack_require__(21); | 10721 | var ReactServerRenderingTransaction = __webpack_require__(136); |
10830 | var setTextContent = __webpack_require__(22); | 10722 | |
10831 | var shallowEqual = __webpack_require__(119); | 10723 | var emptyFunction = __webpack_require__(14); |
10832 | var validateDOMNesting = __webpack_require__(72); | 10724 | var escapeTextContentForBrowser = __webpack_require__(90); |
10833 | var warning = __webpack_require__(27); | 10725 | var invariant = __webpack_require__(10); |
10834 | 10726 | var isEventSupported = __webpack_require__(74); | |
10835 | var deleteListener = ReactBrowserEventEmitter.deleteListener; | 10727 | var keyOf = __webpack_require__(27); |
10728 | var shallowEqual = __webpack_require__(131); | ||
10729 | var validateDOMNesting = __webpack_require__(139); | ||
10730 | var warning = __webpack_require__(13); | ||
10731 | |||
10732 | var Flags = ReactDOMComponentFlags; | ||
10733 | var deleteListener = EventPluginHub.deleteListener; | ||
10734 | var getNode = ReactDOMComponentTree.getNodeFromInstance; | ||
10836 | var listenTo = ReactBrowserEventEmitter.listenTo; | 10735 | var listenTo = ReactBrowserEventEmitter.listenTo; |
10837 | var registrationNameModules = ReactBrowserEventEmitter.registrationNameModules; | 10736 | var registrationNameModules = EventPluginRegistry.registrationNameModules; |
10838 | 10737 | ||
10839 | // For quickly matching children type, to test if can be treated as content. | 10738 | // For quickly matching children type, to test if can be treated as content. |
10840 | var CONTENT_TYPES = { 'string': true, 'number': true }; | 10739 | var CONTENT_TYPES = { 'string': true, 'number': true }; |
10841 | 10740 | ||
10842 | var CHILDREN = keyOf({ children: null }); | ||
10843 | var STYLE = keyOf({ style: null }); | 10741 | var STYLE = keyOf({ style: null }); |
10844 | var HTML = keyOf({ __html: null }); | 10742 | var HTML = keyOf({ __html: null }); |
10743 | var RESERVED_PROPS = { | ||
10744 | children: null, | ||
10745 | dangerouslySetInnerHTML: null, | ||
10746 | suppressContentEditableWarning: null | ||
10747 | }; | ||
10845 | 10748 | ||
10846 | var ELEMENT_NODE_TYPE = 1; | 10749 | // Node type for document fragments (Node.DOCUMENT_FRAGMENT_NODE). |
10750 | var DOC_FRAGMENT_TYPE = 11; | ||
10847 | 10751 | ||
10848 | function getDeclarationErrorAddendum(internalInstance) { | 10752 | function getDeclarationErrorAddendum(internalInstance) { |
10849 | if (internalInstance) { | 10753 | if (internalInstance) { |
@@ -10858,71 +10762,6 @@ | |||
10858 | return ''; | 10762 | return ''; |
10859 | } | 10763 | } |
10860 | 10764 | ||
10861 | var legacyPropsDescriptor; | ||
10862 | if (process.env.NODE_ENV !== 'production') { | ||
10863 | legacyPropsDescriptor = { | ||
10864 | props: { | ||
10865 | enumerable: false, | ||
10866 | get: function () { | ||
10867 | var component = this._reactInternalComponent; | ||
10868 | process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .props of a DOM node; instead, ' + 'recreate the props as `render` did originally or read the DOM ' + 'properties/attributes directly from this node (e.g., ' + 'this.refs.box.className).%s', getDeclarationErrorAddendum(component)) : undefined; | ||
10869 | return component._currentElement.props; | ||
10870 | } | ||
10871 | } | ||
10872 | }; | ||
10873 | } | ||
10874 | |||
10875 | function legacyGetDOMNode() { | ||
10876 | if (process.env.NODE_ENV !== 'production') { | ||
10877 | var component = this._reactInternalComponent; | ||
10878 | process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .getDOMNode() of a DOM node; ' + 'instead, use the node directly.%s', getDeclarationErrorAddendum(component)) : undefined; | ||
10879 | } | ||
10880 | return this; | ||
10881 | } | ||
10882 | |||
10883 | function legacyIsMounted() { | ||
10884 | var component = this._reactInternalComponent; | ||
10885 | if (process.env.NODE_ENV !== 'production') { | ||
10886 | process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .isMounted() of a DOM node.%s', getDeclarationErrorAddendum(component)) : undefined; | ||
10887 | } | ||
10888 | return !!component; | ||
10889 | } | ||
10890 | |||
10891 | function legacySetStateEtc() { | ||
10892 | if (process.env.NODE_ENV !== 'production') { | ||
10893 | var component = this._reactInternalComponent; | ||
10894 | process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .setState(), .replaceState(), or ' + '.forceUpdate() of a DOM node. This is a no-op.%s', getDeclarationErrorAddendum(component)) : undefined; | ||
10895 | } | ||
10896 | } | ||
10897 | |||
10898 | function legacySetProps(partialProps, callback) { | ||
10899 | var component = this._reactInternalComponent; | ||
10900 | if (process.env.NODE_ENV !== 'production') { | ||
10901 | process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .setProps() of a DOM node. ' + 'Instead, call ReactDOM.render again at the top level.%s', getDeclarationErrorAddendum(component)) : undefined; | ||
10902 | } | ||
10903 | if (!component) { | ||
10904 | return; | ||
10905 | } | ||
10906 | ReactUpdateQueue.enqueueSetPropsInternal(component, partialProps); | ||
10907 | if (callback) { | ||
10908 | ReactUpdateQueue.enqueueCallbackInternal(component, callback); | ||
10909 | } | ||
10910 | } | ||
10911 | |||
10912 | function legacyReplaceProps(partialProps, callback) { | ||
10913 | var component = this._reactInternalComponent; | ||
10914 | if (process.env.NODE_ENV !== 'production') { | ||
10915 | process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .replaceProps() of a DOM node. ' + 'Instead, call ReactDOM.render again at the top level.%s', getDeclarationErrorAddendum(component)) : undefined; | ||
10916 | } | ||
10917 | if (!component) { | ||
10918 | return; | ||
10919 | } | ||
10920 | ReactUpdateQueue.enqueueReplacePropsInternal(component, partialProps); | ||
10921 | if (callback) { | ||
10922 | ReactUpdateQueue.enqueueCallbackInternal(component, callback); | ||
10923 | } | ||
10924 | } | ||
10925 | |||
10926 | function friendlyStringify(obj) { | 10765 | function friendlyStringify(obj) { |
10927 | if (typeof obj === 'object') { | 10766 | if (typeof obj === 'object') { |
10928 | if (Array.isArray(obj)) { | 10767 | if (Array.isArray(obj)) { |
@@ -10942,7 +10781,7 @@ | |||
10942 | } else if (typeof obj === 'function') { | 10781 | } else if (typeof obj === 'function') { |
10943 | return '[function object]'; | 10782 | return '[function object]'; |
10944 | } | 10783 | } |
10945 | // Differs from JSON.stringify in that undefined becauses undefined and that | 10784 | // Differs from JSON.stringify in that undefined because undefined and that |
10946 | // inf and nan don't become null | 10785 | // inf and nan don't become null |
10947 | return String(obj); | 10786 | return String(obj); |
10948 | } | 10787 | } |
@@ -10972,7 +10811,7 @@ | |||
10972 | 10811 | ||
10973 | styleMutationWarning[hash] = true; | 10812 | styleMutationWarning[hash] = true; |
10974 | 10813 | ||
10975 | 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)) : undefined; | 10814 | 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; |
10976 | } | 10815 | } |
10977 | 10816 | ||
10978 | /** | 10817 | /** |
@@ -10984,35 +10823,36 @@ | |||
10984 | return; | 10823 | return; |
10985 | } | 10824 | } |
10986 | // Note the use of `==` which checks for null or undefined. | 10825 | // Note the use of `==` which checks for null or undefined. |
10987 | if (process.env.NODE_ENV !== 'production') { | 10826 | if (voidElementTags[component._tag]) { |
10988 | if (voidElementTags[component._tag]) { | 10827 | !(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; |
10989 | process.env.NODE_ENV !== 'production' ? warning(props.children == null && props.dangerouslySetInnerHTML == null, '%s is a void element tag and must not have `children` or ' + 'use `props.dangerouslySetInnerHTML`.%s', component._tag, component._currentElement._owner ? ' Check the render method of ' + component._currentElement._owner.getName() + '.' : '') : undefined; | ||
10990 | } | ||
10991 | } | 10828 | } |
10992 | if (props.dangerouslySetInnerHTML != null) { | 10829 | if (props.dangerouslySetInnerHTML != null) { |
10993 | !(props.children == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : invariant(false) : undefined; | 10830 | !(props.children == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : _prodInvariant('60') : void 0; |
10994 | !(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.') : invariant(false) : undefined; | 10831 | !(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; |
10995 | } | 10832 | } |
10996 | if (process.env.NODE_ENV !== 'production') { | 10833 | if (process.env.NODE_ENV !== 'production') { |
10997 | process.env.NODE_ENV !== 'production' ? warning(props.innerHTML == null, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.') : undefined; | 10834 | 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; |
10998 | process.env.NODE_ENV !== 'production' ? warning(!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.') : undefined; | 10835 | 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; |
10836 | 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; | ||
10999 | } | 10837 | } |
11000 | !(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)) : invariant(false) : undefined; | 10838 | !(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; |
11001 | } | 10839 | } |
11002 | 10840 | ||
11003 | function enqueuePutListener(id, registrationName, listener, transaction) { | 10841 | function enqueuePutListener(inst, registrationName, listener, transaction) { |
10842 | if (transaction instanceof ReactServerRenderingTransaction) { | ||
10843 | return; | ||
10844 | } | ||
11004 | if (process.env.NODE_ENV !== 'production') { | 10845 | if (process.env.NODE_ENV !== 'production') { |
11005 | // IE8 has no API for event capturing and the `onScroll` event doesn't | 10846 | // IE8 has no API for event capturing and the `onScroll` event doesn't |
11006 | // bubble. | 10847 | // bubble. |
11007 | process.env.NODE_ENV !== 'production' ? warning(registrationName !== 'onScroll' || isEventSupported('scroll', true), 'This browser doesn\'t support the `onScroll` event') : undefined; | 10848 | process.env.NODE_ENV !== 'production' ? warning(registrationName !== 'onScroll' || isEventSupported('scroll', true), 'This browser doesn\'t support the `onScroll` event') : void 0; |
11008 | } | ||
11009 | var container = ReactMount.findReactContainerForID(id); | ||
11010 | if (container) { | ||
11011 | var doc = container.nodeType === ELEMENT_NODE_TYPE ? container.ownerDocument : container; | ||
11012 | listenTo(registrationName, doc); | ||
11013 | } | 10849 | } |
10850 | var containerInfo = inst._hostContainerInfo; | ||
10851 | var isDocumentFragment = containerInfo._node && containerInfo._node.nodeType === DOC_FRAGMENT_TYPE; | ||
10852 | var doc = isDocumentFragment ? containerInfo._node : containerInfo._ownerDocument; | ||
10853 | listenTo(registrationName, doc); | ||
11014 | transaction.getReactMountReady().enqueue(putListener, { | 10854 | transaction.getReactMountReady().enqueue(putListener, { |
11015 | id: id, | 10855 | inst: inst, |
11016 | registrationName: registrationName, | 10856 | registrationName: registrationName, |
11017 | listener: listener | 10857 | listener: listener |
11018 | }); | 10858 | }); |
@@ -11020,7 +10860,55 @@ | |||
11020 | 10860 | ||
11021 | function putListener() { | 10861 | function putListener() { |
11022 | var listenerToPut = this; | 10862 | var listenerToPut = this; |
11023 | ReactBrowserEventEmitter.putListener(listenerToPut.id, listenerToPut.registrationName, listenerToPut.listener); | 10863 | EventPluginHub.putListener(listenerToPut.inst, listenerToPut.registrationName, listenerToPut.listener); |
10864 | } | ||
10865 | |||
10866 | function inputPostMount() { | ||
10867 | var inst = this; | ||
10868 | ReactDOMInput.postMountWrapper(inst); | ||
10869 | } | ||
10870 | |||
10871 | function textareaPostMount() { | ||
10872 | var inst = this; | ||
10873 | ReactDOMTextarea.postMountWrapper(inst); | ||
10874 | } | ||
10875 | |||
10876 | function optionPostMount() { | ||
10877 | var inst = this; | ||
10878 | ReactDOMOption.postMountWrapper(inst); | ||
10879 | } | ||
10880 | |||
10881 | var setContentChildForInstrumentation = emptyFunction; | ||
10882 | if (process.env.NODE_ENV !== 'production') { | ||
10883 | setContentChildForInstrumentation = function (content) { | ||
10884 | var hasExistingContent = this._contentDebugID != null; | ||
10885 | var debugID = this._debugID; | ||
10886 | var contentDebugID = debugID + '#text'; | ||
10887 | |||
10888 | if (content == null) { | ||
10889 | if (hasExistingContent) { | ||
10890 | ReactInstrumentation.debugTool.onUnmountComponent(this._contentDebugID); | ||
10891 | } | ||
10892 | this._contentDebugID = null; | ||
10893 | return; | ||
10894 | } | ||
10895 | |||
10896 | this._contentDebugID = contentDebugID; | ||
10897 | var text = '' + content; | ||
10898 | |||
10899 | ReactInstrumentation.debugTool.onSetDisplayName(contentDebugID, '#text'); | ||
10900 | ReactInstrumentation.debugTool.onSetParent(contentDebugID, debugID); | ||
10901 | ReactInstrumentation.debugTool.onSetText(contentDebugID, text); | ||
10902 | |||
10903 | if (hasExistingContent) { | ||
10904 | ReactInstrumentation.debugTool.onBeforeUpdateComponent(contentDebugID, content); | ||
10905 | ReactInstrumentation.debugTool.onUpdateComponent(contentDebugID); | ||
10906 | } else { | ||
10907 | ReactInstrumentation.debugTool.onBeforeMountComponent(contentDebugID, content); | ||
10908 | ReactInstrumentation.debugTool.onMountComponent(contentDebugID); | ||
10909 | ReactInstrumentation.debugTool.onSetChildren(debugID, [contentDebugID]); | ||
10910 | } | ||
10911 | }; | ||
11024 | } | 10912 | } |
11025 | 10913 | ||
11026 | // There are so many media events, it makes sense to just | 10914 | // There are so many media events, it makes sense to just |
@@ -11055,25 +10943,28 @@ | |||
11055 | var inst = this; | 10943 | var inst = this; |
11056 | // If a component renders to null or if another component fatals and causes | 10944 | // If a component renders to null or if another component fatals and causes |
11057 | // the state of the tree to be corrupted, `node` here can be null. | 10945 | // the state of the tree to be corrupted, `node` here can be null. |
11058 | !inst._rootNodeID ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Must be mounted to trap events') : invariant(false) : undefined; | 10946 | !inst._rootNodeID ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Must be mounted to trap events') : _prodInvariant('63') : void 0; |
11059 | var node = ReactMount.getNode(inst._rootNodeID); | 10947 | var node = getNode(inst); |
11060 | !node ? process.env.NODE_ENV !== 'production' ? invariant(false, 'trapBubbledEvent(...): Requires node to be rendered.') : invariant(false) : undefined; | 10948 | !node ? process.env.NODE_ENV !== 'production' ? invariant(false, 'trapBubbledEvent(...): Requires node to be rendered.') : _prodInvariant('64') : void 0; |
11061 | 10949 | ||
11062 | switch (inst._tag) { | 10950 | switch (inst._tag) { |
11063 | case 'iframe': | 10951 | case 'iframe': |
10952 | case 'object': | ||
11064 | inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load', node)]; | 10953 | inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load', node)]; |
11065 | break; | 10954 | break; |
11066 | case 'video': | 10955 | case 'video': |
11067 | case 'audio': | 10956 | case 'audio': |
11068 | 10957 | ||
11069 | inst._wrapperState.listeners = []; | 10958 | inst._wrapperState.listeners = []; |
11070 | // create listener for each media event | 10959 | // Create listener for each media event |
11071 | for (var event in mediaEvents) { | 10960 | for (var event in mediaEvents) { |
11072 | if (mediaEvents.hasOwnProperty(event)) { | 10961 | if (mediaEvents.hasOwnProperty(event)) { |
11073 | inst._wrapperState.listeners.push(ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes[event], mediaEvents[event], node)); | 10962 | inst._wrapperState.listeners.push(ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes[event], mediaEvents[event], node)); |
11074 | } | 10963 | } |
11075 | } | 10964 | } |
11076 | 10965 | break; | |
10966 | case 'source': | ||
10967 | inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topError, 'error', node)]; | ||
11077 | break; | 10968 | break; |
11078 | case 'img': | 10969 | case 'img': |
11079 | inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topError, 'error', node), ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load', node)]; | 10970 | inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topError, 'error', node), ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load', node)]; |
@@ -11081,19 +10972,20 @@ | |||
11081 | case 'form': | 10972 | case 'form': |
11082 | inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topReset, 'reset', node), ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topSubmit, 'submit', node)]; | 10973 | inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topReset, 'reset', node), ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topSubmit, 'submit', node)]; |
11083 | break; | 10974 | break; |
10975 | case 'input': | ||
10976 | case 'select': | ||
10977 | case 'textarea': | ||
10978 | inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topInvalid, 'invalid', node)]; | ||
10979 | break; | ||
11084 | } | 10980 | } |
11085 | } | 10981 | } |
11086 | 10982 | ||
11087 | function mountReadyInputWrapper() { | ||
11088 | ReactDOMInput.mountReadyWrapper(this); | ||
11089 | } | ||
11090 | |||
11091 | function postUpdateSelectWrapper() { | 10983 | function postUpdateSelectWrapper() { |
11092 | ReactDOMSelect.postUpdateWrapper(this); | 10984 | ReactDOMSelect.postUpdateWrapper(this); |
11093 | } | 10985 | } |
11094 | 10986 | ||
11095 | // For HTML, certain tags should omit their close tag. We keep a whitelist for | 10987 | // For HTML, certain tags should omit their close tag. We keep a whitelist for |
11096 | // those special cased tags. | 10988 | // those special-case tags. |
11097 | 10989 | ||
11098 | var omittedCloseTags = { | 10990 | var omittedCloseTags = { |
11099 | 'area': true, | 10991 | 'area': true, |
@@ -11123,7 +11015,7 @@ | |||
11123 | // For HTML, certain tags cannot have children. This has the same purpose as | 11015 | // For HTML, certain tags cannot have children. This has the same purpose as |
11124 | // `omittedCloseTags` except that `menuitem` should still have its closing tag. | 11016 | // `omittedCloseTags` except that `menuitem` should still have its closing tag. |
11125 | 11017 | ||
11126 | var voidElementTags = assign({ | 11018 | var voidElementTags = _assign({ |
11127 | 'menuitem': true | 11019 | 'menuitem': true |
11128 | }, omittedCloseTags); | 11020 | }, omittedCloseTags); |
11129 | 11021 | ||
@@ -11133,27 +11025,21 @@ | |||
11133 | 11025 | ||
11134 | var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset | 11026 | var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset |
11135 | var validatedTagCache = {}; | 11027 | var validatedTagCache = {}; |
11136 | var hasOwnProperty = ({}).hasOwnProperty; | 11028 | var hasOwnProperty = {}.hasOwnProperty; |
11137 | 11029 | ||
11138 | function validateDangerousTag(tag) { | 11030 | function validateDangerousTag(tag) { |
11139 | if (!hasOwnProperty.call(validatedTagCache, tag)) { | 11031 | if (!hasOwnProperty.call(validatedTagCache, tag)) { |
11140 | !VALID_TAG_REGEX.test(tag) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Invalid tag: %s', tag) : invariant(false) : undefined; | 11032 | !VALID_TAG_REGEX.test(tag) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Invalid tag: %s', tag) : _prodInvariant('65', tag) : void 0; |
11141 | validatedTagCache[tag] = true; | 11033 | validatedTagCache[tag] = true; |
11142 | } | 11034 | } |
11143 | } | 11035 | } |
11144 | 11036 | ||
11145 | function processChildContextDev(context, inst) { | ||
11146 | // Pass down our tag name to child components for validation purposes | ||
11147 | context = assign({}, context); | ||
11148 | var info = context[validateDOMNesting.ancestorInfoContextKey]; | ||
11149 | context[validateDOMNesting.ancestorInfoContextKey] = validateDOMNesting.updatedAncestorInfo(info, inst._tag, inst); | ||
11150 | return context; | ||
11151 | } | ||
11152 | |||
11153 | function isCustomComponent(tagName, props) { | 11037 | function isCustomComponent(tagName, props) { |
11154 | return tagName.indexOf('-') >= 0 || props.is != null; | 11038 | return tagName.indexOf('-') >= 0 || props.is != null; |
11155 | } | 11039 | } |
11156 | 11040 | ||
11041 | var globalIdCounter = 1; | ||
11042 | |||
11157 | /** | 11043 | /** |
11158 | * Creates a new React class that is idempotent and capable of containing other | 11044 | * Creates a new React class that is idempotent and capable of containing other |
11159 | * React components. It accepts event listeners and DOM properties that are | 11045 | * React components. It accepts event listeners and DOM properties that are |
@@ -11168,19 +11054,26 @@ | |||
11168 | * @constructor ReactDOMComponent | 11054 | * @constructor ReactDOMComponent |
11169 | * @extends ReactMultiChild | 11055 | * @extends ReactMultiChild |
11170 | */ | 11056 | */ |
11171 | function ReactDOMComponent(tag) { | 11057 | function ReactDOMComponent(element) { |
11058 | var tag = element.type; | ||
11172 | validateDangerousTag(tag); | 11059 | validateDangerousTag(tag); |
11060 | this._currentElement = element; | ||
11173 | this._tag = tag.toLowerCase(); | 11061 | this._tag = tag.toLowerCase(); |
11062 | this._namespaceURI = null; | ||
11174 | this._renderedChildren = null; | 11063 | this._renderedChildren = null; |
11175 | this._previousStyle = null; | 11064 | this._previousStyle = null; |
11176 | this._previousStyleCopy = null; | 11065 | this._previousStyleCopy = null; |
11066 | this._hostNode = null; | ||
11067 | this._hostParent = null; | ||
11177 | this._rootNodeID = null; | 11068 | this._rootNodeID = null; |
11069 | this._domID = null; | ||
11070 | this._hostContainerInfo = null; | ||
11178 | this._wrapperState = null; | 11071 | this._wrapperState = null; |
11179 | this._topLevelWrapper = null; | 11072 | this._topLevelWrapper = null; |
11180 | this._nodeWithLegacyProperties = null; | 11073 | this._flags = 0; |
11181 | if (process.env.NODE_ENV !== 'production') { | 11074 | if (process.env.NODE_ENV !== 'production') { |
11182 | this._unprocessedContextDev = null; | 11075 | this._ancestorInfo = null; |
11183 | this._processedContextDev = null; | 11076 | setContentChildForInstrumentation.call(this, null); |
11184 | } | 11077 | } |
11185 | } | 11078 | } |
11186 | 11079 | ||
@@ -11188,81 +11081,137 @@ | |||
11188 | 11081 | ||
11189 | ReactDOMComponent.Mixin = { | 11082 | ReactDOMComponent.Mixin = { |
11190 | 11083 | ||
11191 | construct: function (element) { | ||
11192 | this._currentElement = element; | ||
11193 | }, | ||
11194 | |||
11195 | /** | 11084 | /** |
11196 | * Generates root tag markup then recurses. This method has side effects and | 11085 | * Generates root tag markup then recurses. This method has side effects and |
11197 | * is not idempotent. | 11086 | * is not idempotent. |
11198 | * | 11087 | * |
11199 | * @internal | 11088 | * @internal |
11200 | * @param {string} rootID The root DOM ID for this node. | ||
11201 | * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction | 11089 | * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction |
11090 | * @param {?ReactDOMComponent} the containing DOM component instance | ||
11091 | * @param {?object} info about the host container | ||
11202 | * @param {object} context | 11092 | * @param {object} context |
11203 | * @return {string} The computed markup. | 11093 | * @return {string} The computed markup. |
11204 | */ | 11094 | */ |
11205 | mountComponent: function (rootID, transaction, context) { | 11095 | mountComponent: function (transaction, hostParent, hostContainerInfo, context) { |
11206 | this._rootNodeID = rootID; | 11096 | var _this = this; |
11097 | |||
11098 | this._rootNodeID = globalIdCounter++; | ||
11099 | this._domID = hostContainerInfo._idCounter++; | ||
11100 | this._hostParent = hostParent; | ||
11101 | this._hostContainerInfo = hostContainerInfo; | ||
11207 | 11102 | ||
11208 | var props = this._currentElement.props; | 11103 | var props = this._currentElement.props; |
11209 | 11104 | ||
11210 | switch (this._tag) { | 11105 | switch (this._tag) { |
11106 | case 'audio': | ||
11107 | case 'form': | ||
11211 | case 'iframe': | 11108 | case 'iframe': |
11212 | case 'img': | 11109 | case 'img': |
11213 | case 'form': | 11110 | case 'link': |
11111 | case 'object': | ||
11112 | case 'source': | ||
11214 | case 'video': | 11113 | case 'video': |
11215 | case 'audio': | ||
11216 | this._wrapperState = { | 11114 | this._wrapperState = { |
11217 | listeners: null | 11115 | listeners: null |
11218 | }; | 11116 | }; |
11219 | transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this); | 11117 | transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this); |
11220 | break; | 11118 | break; |
11221 | case 'button': | 11119 | case 'button': |
11222 | props = ReactDOMButton.getNativeProps(this, props, context); | 11120 | props = ReactDOMButton.getHostProps(this, props, hostParent); |
11223 | break; | 11121 | break; |
11224 | case 'input': | 11122 | case 'input': |
11225 | ReactDOMInput.mountWrapper(this, props, context); | 11123 | ReactDOMInput.mountWrapper(this, props, hostParent); |
11226 | props = ReactDOMInput.getNativeProps(this, props, context); | 11124 | props = ReactDOMInput.getHostProps(this, props); |
11125 | transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this); | ||
11227 | break; | 11126 | break; |
11228 | case 'option': | 11127 | case 'option': |
11229 | ReactDOMOption.mountWrapper(this, props, context); | 11128 | ReactDOMOption.mountWrapper(this, props, hostParent); |
11230 | props = ReactDOMOption.getNativeProps(this, props, context); | 11129 | props = ReactDOMOption.getHostProps(this, props); |
11231 | break; | 11130 | break; |
11232 | case 'select': | 11131 | case 'select': |
11233 | ReactDOMSelect.mountWrapper(this, props, context); | 11132 | ReactDOMSelect.mountWrapper(this, props, hostParent); |
11234 | props = ReactDOMSelect.getNativeProps(this, props, context); | 11133 | props = ReactDOMSelect.getHostProps(this, props); |
11235 | context = ReactDOMSelect.processChildContext(this, props, context); | 11134 | transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this); |
11236 | break; | 11135 | break; |
11237 | case 'textarea': | 11136 | case 'textarea': |
11238 | ReactDOMTextarea.mountWrapper(this, props, context); | 11137 | ReactDOMTextarea.mountWrapper(this, props, hostParent); |
11239 | props = ReactDOMTextarea.getNativeProps(this, props, context); | 11138 | props = ReactDOMTextarea.getHostProps(this, props); |
11139 | transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this); | ||
11240 | break; | 11140 | break; |
11241 | } | 11141 | } |
11242 | 11142 | ||
11243 | assertValidProps(this, props); | 11143 | assertValidProps(this, props); |
11244 | if (process.env.NODE_ENV !== 'production') { | 11144 | |
11245 | if (context[validateDOMNesting.ancestorInfoContextKey]) { | 11145 | // We create tags in the namespace of their parent container, except HTML |
11246 | validateDOMNesting(this._tag, this, context[validateDOMNesting.ancestorInfoContextKey]); | 11146 | // tags get no namespace. |
11147 | var namespaceURI; | ||
11148 | var parentTag; | ||
11149 | if (hostParent != null) { | ||
11150 | namespaceURI = hostParent._namespaceURI; | ||
11151 | parentTag = hostParent._tag; | ||
11152 | } else if (hostContainerInfo._tag) { | ||
11153 | namespaceURI = hostContainerInfo._namespaceURI; | ||
11154 | parentTag = hostContainerInfo._tag; | ||
11155 | } | ||
11156 | if (namespaceURI == null || namespaceURI === DOMNamespaces.svg && parentTag === 'foreignobject') { | ||
11157 | namespaceURI = DOMNamespaces.html; | ||
11158 | } | ||
11159 | if (namespaceURI === DOMNamespaces.html) { | ||
11160 | if (this._tag === 'svg') { | ||
11161 | namespaceURI = DOMNamespaces.svg; | ||
11162 | } else if (this._tag === 'math') { | ||
11163 | namespaceURI = DOMNamespaces.mathml; | ||
11247 | } | 11164 | } |
11248 | } | 11165 | } |
11166 | this._namespaceURI = namespaceURI; | ||
11249 | 11167 | ||
11250 | if (process.env.NODE_ENV !== 'production') { | 11168 | if (process.env.NODE_ENV !== 'production') { |
11251 | this._unprocessedContextDev = context; | 11169 | var parentInfo; |
11252 | this._processedContextDev = processChildContextDev(context, this); | 11170 | if (hostParent != null) { |
11253 | context = this._processedContextDev; | 11171 | parentInfo = hostParent._ancestorInfo; |
11172 | } else if (hostContainerInfo._tag) { | ||
11173 | parentInfo = hostContainerInfo._ancestorInfo; | ||
11174 | } | ||
11175 | if (parentInfo) { | ||
11176 | // parentInfo should always be present except for the top-level | ||
11177 | // component when server rendering | ||
11178 | validateDOMNesting(this._tag, this, parentInfo); | ||
11179 | } | ||
11180 | this._ancestorInfo = validateDOMNesting.updatedAncestorInfo(parentInfo, this._tag, this); | ||
11254 | } | 11181 | } |
11255 | 11182 | ||
11256 | var mountImage; | 11183 | var mountImage; |
11257 | if (transaction.useCreateElement) { | 11184 | if (transaction.useCreateElement) { |
11258 | var ownerDocument = context[ReactMount.ownerDocumentContextKey]; | 11185 | var ownerDocument = hostContainerInfo._ownerDocument; |
11259 | var el = ownerDocument.createElement(this._currentElement.type); | 11186 | var el; |
11260 | DOMPropertyOperations.setAttributeForID(el, this._rootNodeID); | 11187 | if (namespaceURI === DOMNamespaces.html) { |
11261 | // Populate node cache | 11188 | if (this._tag === 'script') { |
11262 | ReactMount.getID(el); | 11189 | // Create the script via .innerHTML so its "parser-inserted" flag is |
11263 | this._updateDOMProperties({}, props, transaction, el); | 11190 | // set to true and it does not execute |
11264 | this._createInitialChildren(transaction, props, context, el); | 11191 | var div = ownerDocument.createElement('div'); |
11265 | mountImage = el; | 11192 | var type = this._currentElement.type; |
11193 | div.innerHTML = '<' + type + '></' + type + '>'; | ||
11194 | el = div.removeChild(div.firstChild); | ||
11195 | } else if (props.is) { | ||
11196 | el = ownerDocument.createElement(this._currentElement.type, props.is); | ||
11197 | } else { | ||
11198 | // Separate else branch instead of using `props.is || undefined` above becuase of a Firefox bug. | ||
11199 | // See discussion in https://github.com/facebook/react/pull/6896 | ||
11200 | // and discussion in https://bugzilla.mozilla.org/show_bug.cgi?id=1276240 | ||
11201 | el = ownerDocument.createElement(this._currentElement.type); | ||
11202 | } | ||
11203 | } else { | ||
11204 | el = ownerDocument.createElementNS(namespaceURI, this._currentElement.type); | ||
11205 | } | ||
11206 | ReactDOMComponentTree.precacheNode(this, el); | ||
11207 | this._flags |= Flags.hasCachedChildNodes; | ||
11208 | if (!this._hostParent) { | ||
11209 | DOMPropertyOperations.setAttributeForRoot(el); | ||
11210 | } | ||
11211 | this._updateDOMProperties(null, props, transaction); | ||
11212 | var lazyTree = DOMLazyTree(el); | ||
11213 | this._createInitialChildren(transaction, props, context, lazyTree); | ||
11214 | mountImage = lazyTree; | ||
11266 | } else { | 11215 | } else { |
11267 | var tagOpen = this._createOpenTagMarkupAndPutListeners(transaction, props); | 11216 | var tagOpen = this._createOpenTagMarkupAndPutListeners(transaction, props); |
11268 | var tagContent = this._createContentMarkup(transaction, props, context); | 11217 | var tagContent = this._createContentMarkup(transaction, props, context); |
@@ -11275,15 +11224,39 @@ | |||
11275 | 11224 | ||
11276 | switch (this._tag) { | 11225 | switch (this._tag) { |
11277 | case 'input': | 11226 | case 'input': |
11278 | transaction.getReactMountReady().enqueue(mountReadyInputWrapper, this); | 11227 | transaction.getReactMountReady().enqueue(inputPostMount, this); |
11279 | // falls through | 11228 | if (props.autoFocus) { |
11280 | case 'button': | 11229 | transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this); |
11281 | case 'select': | 11230 | } |
11231 | break; | ||
11282 | case 'textarea': | 11232 | case 'textarea': |
11233 | transaction.getReactMountReady().enqueue(textareaPostMount, this); | ||
11234 | if (props.autoFocus) { | ||
11235 | transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this); | ||
11236 | } | ||
11237 | break; | ||
11238 | case 'select': | ||
11239 | if (props.autoFocus) { | ||
11240 | transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this); | ||
11241 | } | ||
11242 | break; | ||
11243 | case 'button': | ||
11283 | if (props.autoFocus) { | 11244 | if (props.autoFocus) { |
11284 | transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this); | 11245 | transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this); |
11285 | } | 11246 | } |
11286 | break; | 11247 | break; |
11248 | case 'option': | ||
11249 | transaction.getReactMountReady().enqueue(optionPostMount, this); | ||
11250 | break; | ||
11251 | } | ||
11252 | |||
11253 | if (process.env.NODE_ENV !== 'production') { | ||
11254 | if (this._debugID) { | ||
11255 | var callback = function () { | ||
11256 | return ReactInstrumentation.debugTool.onComponentHasMounted(_this._debugID); | ||
11257 | }; | ||
11258 | transaction.getReactMountReady().enqueue(callback, this); | ||
11259 | } | ||
11287 | } | 11260 | } |
11288 | 11261 | ||
11289 | return mountImage; | 11262 | return mountImage; |
@@ -11315,7 +11288,7 @@ | |||
11315 | } | 11288 | } |
11316 | if (registrationNameModules.hasOwnProperty(propKey)) { | 11289 | if (registrationNameModules.hasOwnProperty(propKey)) { |
11317 | if (propValue) { | 11290 | if (propValue) { |
11318 | enqueuePutListener(this._rootNodeID, propKey, propValue, transaction); | 11291 | enqueuePutListener(this, propKey, propValue, transaction); |
11319 | } | 11292 | } |
11320 | } else { | 11293 | } else { |
11321 | if (propKey === STYLE) { | 11294 | if (propKey === STYLE) { |
@@ -11324,13 +11297,13 @@ | |||
11324 | // See `_updateDOMProperties`. style block | 11297 | // See `_updateDOMProperties`. style block |
11325 | this._previousStyle = propValue; | 11298 | this._previousStyle = propValue; |
11326 | } | 11299 | } |
11327 | propValue = this._previousStyleCopy = assign({}, props.style); | 11300 | propValue = this._previousStyleCopy = _assign({}, props.style); |
11328 | } | 11301 | } |
11329 | propValue = CSSPropertyOperations.createMarkupForStyles(propValue); | 11302 | propValue = CSSPropertyOperations.createMarkupForStyles(propValue, this); |
11330 | } | 11303 | } |
11331 | var markup = null; | 11304 | var markup = null; |
11332 | if (this._tag != null && isCustomComponent(this._tag, props)) { | 11305 | if (this._tag != null && isCustomComponent(this._tag, props)) { |
11333 | if (propKey !== CHILDREN) { | 11306 | if (!RESERVED_PROPS.hasOwnProperty(propKey)) { |
11334 | markup = DOMPropertyOperations.createMarkupForCustomAttribute(propKey, propValue); | 11307 | markup = DOMPropertyOperations.createMarkupForCustomAttribute(propKey, propValue); |
11335 | } | 11308 | } |
11336 | } else { | 11309 | } else { |
@@ -11348,8 +11321,11 @@ | |||
11348 | return ret; | 11321 | return ret; |
11349 | } | 11322 | } |
11350 | 11323 | ||
11351 | var markupForID = DOMPropertyOperations.createMarkupForID(this._rootNodeID); | 11324 | if (!this._hostParent) { |
11352 | return ret + ' ' + markupForID; | 11325 | ret += ' ' + DOMPropertyOperations.createMarkupForRoot(); |
11326 | } | ||
11327 | ret += ' ' + DOMPropertyOperations.createMarkupForID(this._domID); | ||
11328 | return ret; | ||
11353 | }, | 11329 | }, |
11354 | 11330 | ||
11355 | /** | 11331 | /** |
@@ -11376,6 +11352,9 @@ | |||
11376 | if (contentToUse != null) { | 11352 | if (contentToUse != null) { |
11377 | // TODO: Validate that text is allowed as a child of this node | 11353 | // TODO: Validate that text is allowed as a child of this node |
11378 | ret = escapeTextContentForBrowser(contentToUse); | 11354 | ret = escapeTextContentForBrowser(contentToUse); |
11355 | if (process.env.NODE_ENV !== 'production') { | ||
11356 | setContentChildForInstrumentation.call(this, contentToUse); | ||
11357 | } | ||
11379 | } else if (childrenToUse != null) { | 11358 | } else if (childrenToUse != null) { |
11380 | var mountImages = this.mountChildren(childrenToUse, transaction, context); | 11359 | var mountImages = this.mountChildren(childrenToUse, transaction, context); |
11381 | ret = mountImages.join(''); | 11360 | ret = mountImages.join(''); |
@@ -11398,23 +11377,26 @@ | |||
11398 | } | 11377 | } |
11399 | }, | 11378 | }, |
11400 | 11379 | ||
11401 | _createInitialChildren: function (transaction, props, context, el) { | 11380 | _createInitialChildren: function (transaction, props, context, lazyTree) { |
11402 | // Intentional use of != to avoid catching zero/false. | 11381 | // Intentional use of != to avoid catching zero/false. |
11403 | var innerHTML = props.dangerouslySetInnerHTML; | 11382 | var innerHTML = props.dangerouslySetInnerHTML; |
11404 | if (innerHTML != null) { | 11383 | if (innerHTML != null) { |
11405 | if (innerHTML.__html != null) { | 11384 | if (innerHTML.__html != null) { |
11406 | setInnerHTML(el, innerHTML.__html); | 11385 | DOMLazyTree.queueHTML(lazyTree, innerHTML.__html); |
11407 | } | 11386 | } |
11408 | } else { | 11387 | } else { |
11409 | var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null; | 11388 | var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null; |
11410 | var childrenToUse = contentToUse != null ? null : props.children; | 11389 | var childrenToUse = contentToUse != null ? null : props.children; |
11411 | if (contentToUse != null) { | 11390 | if (contentToUse != null) { |
11412 | // TODO: Validate that text is allowed as a child of this node | 11391 | // TODO: Validate that text is allowed as a child of this node |
11413 | setTextContent(el, contentToUse); | 11392 | if (process.env.NODE_ENV !== 'production') { |
11393 | setContentChildForInstrumentation.call(this, contentToUse); | ||
11394 | } | ||
11395 | DOMLazyTree.queueText(lazyTree, contentToUse); | ||
11414 | } else if (childrenToUse != null) { | 11396 | } else if (childrenToUse != null) { |
11415 | var mountImages = this.mountChildren(childrenToUse, transaction, context); | 11397 | var mountImages = this.mountChildren(childrenToUse, transaction, context); |
11416 | for (var i = 0; i < mountImages.length; i++) { | 11398 | for (var i = 0; i < mountImages.length; i++) { |
11417 | el.appendChild(mountImages[i]); | 11399 | DOMLazyTree.queueChild(lazyTree, mountImages[i]); |
11418 | } | 11400 | } |
11419 | } | 11401 | } |
11420 | } | 11402 | } |
@@ -11435,7 +11417,7 @@ | |||
11435 | }, | 11417 | }, |
11436 | 11418 | ||
11437 | /** | 11419 | /** |
11438 | * Updates a native DOM component after it has already been allocated and | 11420 | * Updates a DOM component after it has already been allocated and |
11439 | * attached to the DOM. Reconciles the root DOM node, then recurses. | 11421 | * attached to the DOM. Reconciles the root DOM node, then recurses. |
11440 | * | 11422 | * |
11441 | * @param {ReactReconcileTransaction} transaction | 11423 | * @param {ReactReconcileTransaction} transaction |
@@ -11445,58 +11427,54 @@ | |||
11445 | * @overridable | 11427 | * @overridable |
11446 | */ | 11428 | */ |
11447 | updateComponent: function (transaction, prevElement, nextElement, context) { | 11429 | updateComponent: function (transaction, prevElement, nextElement, context) { |
11430 | var _this2 = this; | ||
11431 | |||
11448 | var lastProps = prevElement.props; | 11432 | var lastProps = prevElement.props; |
11449 | var nextProps = this._currentElement.props; | 11433 | var nextProps = this._currentElement.props; |
11450 | 11434 | ||
11451 | switch (this._tag) { | 11435 | switch (this._tag) { |
11452 | case 'button': | 11436 | case 'button': |
11453 | lastProps = ReactDOMButton.getNativeProps(this, lastProps); | 11437 | lastProps = ReactDOMButton.getHostProps(this, lastProps); |
11454 | nextProps = ReactDOMButton.getNativeProps(this, nextProps); | 11438 | nextProps = ReactDOMButton.getHostProps(this, nextProps); |
11455 | break; | 11439 | break; |
11456 | case 'input': | 11440 | case 'input': |
11457 | ReactDOMInput.updateWrapper(this); | 11441 | ReactDOMInput.updateWrapper(this); |
11458 | lastProps = ReactDOMInput.getNativeProps(this, lastProps); | 11442 | lastProps = ReactDOMInput.getHostProps(this, lastProps); |
11459 | nextProps = ReactDOMInput.getNativeProps(this, nextProps); | 11443 | nextProps = ReactDOMInput.getHostProps(this, nextProps); |
11460 | break; | 11444 | break; |
11461 | case 'option': | 11445 | case 'option': |
11462 | lastProps = ReactDOMOption.getNativeProps(this, lastProps); | 11446 | lastProps = ReactDOMOption.getHostProps(this, lastProps); |
11463 | nextProps = ReactDOMOption.getNativeProps(this, nextProps); | 11447 | nextProps = ReactDOMOption.getHostProps(this, nextProps); |
11464 | break; | 11448 | break; |
11465 | case 'select': | 11449 | case 'select': |
11466 | lastProps = ReactDOMSelect.getNativeProps(this, lastProps); | 11450 | lastProps = ReactDOMSelect.getHostProps(this, lastProps); |
11467 | nextProps = ReactDOMSelect.getNativeProps(this, nextProps); | 11451 | nextProps = ReactDOMSelect.getHostProps(this, nextProps); |
11468 | break; | 11452 | break; |
11469 | case 'textarea': | 11453 | case 'textarea': |
11470 | ReactDOMTextarea.updateWrapper(this); | 11454 | ReactDOMTextarea.updateWrapper(this); |
11471 | lastProps = ReactDOMTextarea.getNativeProps(this, lastProps); | 11455 | lastProps = ReactDOMTextarea.getHostProps(this, lastProps); |
11472 | nextProps = ReactDOMTextarea.getNativeProps(this, nextProps); | 11456 | nextProps = ReactDOMTextarea.getHostProps(this, nextProps); |
11473 | break; | 11457 | break; |
11474 | } | 11458 | } |
11475 | 11459 | ||
11476 | if (process.env.NODE_ENV !== 'production') { | ||
11477 | // If the context is reference-equal to the old one, pass down the same | ||
11478 | // processed object so the update bailout in ReactReconciler behaves | ||
11479 | // correctly (and identically in dev and prod). See #5005. | ||
11480 | if (this._unprocessedContextDev !== context) { | ||
11481 | this._unprocessedContextDev = context; | ||
11482 | this._processedContextDev = processChildContextDev(context, this); | ||
11483 | } | ||
11484 | context = this._processedContextDev; | ||
11485 | } | ||
11486 | |||
11487 | assertValidProps(this, nextProps); | 11460 | assertValidProps(this, nextProps); |
11488 | this._updateDOMProperties(lastProps, nextProps, transaction, null); | 11461 | this._updateDOMProperties(lastProps, nextProps, transaction); |
11489 | this._updateDOMChildren(lastProps, nextProps, transaction, context); | 11462 | this._updateDOMChildren(lastProps, nextProps, transaction, context); |
11490 | 11463 | ||
11491 | if (!canDefineProperty && this._nodeWithLegacyProperties) { | ||
11492 | this._nodeWithLegacyProperties.props = nextProps; | ||
11493 | } | ||
11494 | |||
11495 | if (this._tag === 'select') { | 11464 | if (this._tag === 'select') { |
11496 | // <select> value update needs to occur after <option> children | 11465 | // <select> value update needs to occur after <option> children |
11497 | // reconciliation | 11466 | // reconciliation |
11498 | transaction.getReactMountReady().enqueue(postUpdateSelectWrapper, this); | 11467 | transaction.getReactMountReady().enqueue(postUpdateSelectWrapper, this); |
11499 | } | 11468 | } |
11469 | |||
11470 | if (process.env.NODE_ENV !== 'production') { | ||
11471 | if (this._debugID) { | ||
11472 | var callback = function () { | ||
11473 | return ReactInstrumentation.debugTool.onComponentHasUpdated(_this2._debugID); | ||
11474 | }; | ||
11475 | transaction.getReactMountReady().enqueue(callback, this); | ||
11476 | } | ||
11477 | } | ||
11500 | }, | 11478 | }, |
11501 | 11479 | ||
11502 | /** | 11480 | /** |
@@ -11513,15 +11491,14 @@ | |||
11513 | * @private | 11491 | * @private |
11514 | * @param {object} lastProps | 11492 | * @param {object} lastProps |
11515 | * @param {object} nextProps | 11493 | * @param {object} nextProps |
11516 | * @param {ReactReconcileTransaction} transaction | ||
11517 | * @param {?DOMElement} node | 11494 | * @param {?DOMElement} node |
11518 | */ | 11495 | */ |
11519 | _updateDOMProperties: function (lastProps, nextProps, transaction, node) { | 11496 | _updateDOMProperties: function (lastProps, nextProps, transaction) { |
11520 | var propKey; | 11497 | var propKey; |
11521 | var styleName; | 11498 | var styleName; |
11522 | var styleUpdates; | 11499 | var styleUpdates; |
11523 | for (propKey in lastProps) { | 11500 | for (propKey in lastProps) { |
11524 | if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey)) { | 11501 | if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey) || lastProps[propKey] == null) { |
11525 | continue; | 11502 | continue; |
11526 | } | 11503 | } |
11527 | if (propKey === STYLE) { | 11504 | if (propKey === STYLE) { |
@@ -11538,19 +11515,20 @@ | |||
11538 | // Only call deleteListener if there was a listener previously or | 11515 | // Only call deleteListener if there was a listener previously or |
11539 | // else willDeleteListener gets called when there wasn't actually a | 11516 | // else willDeleteListener gets called when there wasn't actually a |
11540 | // listener (e.g., onClick={null}) | 11517 | // listener (e.g., onClick={null}) |
11541 | deleteListener(this._rootNodeID, propKey); | 11518 | deleteListener(this, propKey); |
11542 | } | 11519 | } |
11543 | } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) { | 11520 | } else if (isCustomComponent(this._tag, lastProps)) { |
11544 | if (!node) { | 11521 | if (!RESERVED_PROPS.hasOwnProperty(propKey)) { |
11545 | node = ReactMount.getNode(this._rootNodeID); | 11522 | DOMPropertyOperations.deleteValueForAttribute(getNode(this), propKey); |
11546 | } | 11523 | } |
11547 | DOMPropertyOperations.deleteValueForProperty(node, propKey); | 11524 | } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) { |
11525 | DOMPropertyOperations.deleteValueForProperty(getNode(this), propKey); | ||
11548 | } | 11526 | } |
11549 | } | 11527 | } |
11550 | for (propKey in nextProps) { | 11528 | for (propKey in nextProps) { |
11551 | var nextProp = nextProps[propKey]; | 11529 | var nextProp = nextProps[propKey]; |
11552 | var lastProp = propKey === STYLE ? this._previousStyleCopy : lastProps[propKey]; | 11530 | var lastProp = propKey === STYLE ? this._previousStyleCopy : lastProps != null ? lastProps[propKey] : undefined; |
11553 | if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp) { | 11531 | if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp || nextProp == null && lastProp == null) { |
11554 | continue; | 11532 | continue; |
11555 | } | 11533 | } |
11556 | if (propKey === STYLE) { | 11534 | if (propKey === STYLE) { |
@@ -11559,7 +11537,7 @@ | |||
11559 | checkAndWarnForMutatedStyle(this._previousStyleCopy, this._previousStyle, this); | 11537 | checkAndWarnForMutatedStyle(this._previousStyleCopy, this._previousStyle, this); |
11560 | this._previousStyle = nextProp; | 11538 | this._previousStyle = nextProp; |
11561 | } | 11539 | } |
11562 | nextProp = this._previousStyleCopy = assign({}, nextProp); | 11540 | nextProp = this._previousStyleCopy = _assign({}, nextProp); |
11563 | } else { | 11541 | } else { |
11564 | this._previousStyleCopy = null; | 11542 | this._previousStyleCopy = null; |
11565 | } | 11543 | } |
@@ -11584,24 +11562,18 @@ | |||
11584 | } | 11562 | } |
11585 | } else if (registrationNameModules.hasOwnProperty(propKey)) { | 11563 | } else if (registrationNameModules.hasOwnProperty(propKey)) { |
11586 | if (nextProp) { | 11564 | if (nextProp) { |
11587 | enqueuePutListener(this._rootNodeID, propKey, nextProp, transaction); | 11565 | enqueuePutListener(this, propKey, nextProp, transaction); |
11588 | } else if (lastProp) { | 11566 | } else if (lastProp) { |
11589 | deleteListener(this._rootNodeID, propKey); | 11567 | deleteListener(this, propKey); |
11590 | } | 11568 | } |
11591 | } else if (isCustomComponent(this._tag, nextProps)) { | 11569 | } else if (isCustomComponent(this._tag, nextProps)) { |
11592 | if (!node) { | 11570 | if (!RESERVED_PROPS.hasOwnProperty(propKey)) { |
11593 | node = ReactMount.getNode(this._rootNodeID); | 11571 | DOMPropertyOperations.setValueForAttribute(getNode(this), propKey, nextProp); |
11594 | } | ||
11595 | if (propKey === CHILDREN) { | ||
11596 | nextProp = null; | ||
11597 | } | 11572 | } |
11598 | DOMPropertyOperations.setValueForAttribute(node, propKey, nextProp); | ||
11599 | } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) { | 11573 | } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) { |
11600 | if (!node) { | 11574 | var node = getNode(this); |
11601 | node = ReactMount.getNode(this._rootNodeID); | ||
11602 | } | ||
11603 | // If we're updating to null or undefined, we should remove the property | 11575 | // If we're updating to null or undefined, we should remove the property |
11604 | // from the DOM node instead of inadvertantly setting to a string. This | 11576 | // from the DOM node instead of inadvertently setting to a string. This |
11605 | // brings us in line with the same behavior we have on initial render. | 11577 | // brings us in line with the same behavior we have on initial render. |
11606 | if (nextProp != null) { | 11578 | if (nextProp != null) { |
11607 | DOMPropertyOperations.setValueForProperty(node, propKey, nextProp); | 11579 | DOMPropertyOperations.setValueForProperty(node, propKey, nextProp); |
@@ -11611,10 +11583,7 @@ | |||
11611 | } | 11583 | } |
11612 | } | 11584 | } |
11613 | if (styleUpdates) { | 11585 | if (styleUpdates) { |
11614 | if (!node) { | 11586 | CSSPropertyOperations.setValueForStyles(getNode(this), styleUpdates, this); |
11615 | node = ReactMount.getNode(this._rootNodeID); | ||
11616 | } | ||
11617 | CSSPropertyOperations.setValueForStyles(node, styleUpdates); | ||
11618 | } | 11587 | } |
11619 | }, | 11588 | }, |
11620 | 11589 | ||
@@ -11646,34 +11615,54 @@ | |||
11646 | this.updateChildren(null, transaction, context); | 11615 | this.updateChildren(null, transaction, context); |
11647 | } else if (lastHasContentOrHtml && !nextHasContentOrHtml) { | 11616 | } else if (lastHasContentOrHtml && !nextHasContentOrHtml) { |
11648 | this.updateTextContent(''); | 11617 | this.updateTextContent(''); |
11618 | if (process.env.NODE_ENV !== 'production') { | ||
11619 | ReactInstrumentation.debugTool.onSetChildren(this._debugID, []); | ||
11620 | } | ||
11649 | } | 11621 | } |
11650 | 11622 | ||
11651 | if (nextContent != null) { | 11623 | if (nextContent != null) { |
11652 | if (lastContent !== nextContent) { | 11624 | if (lastContent !== nextContent) { |
11653 | this.updateTextContent('' + nextContent); | 11625 | this.updateTextContent('' + nextContent); |
11626 | if (process.env.NODE_ENV !== 'production') { | ||
11627 | setContentChildForInstrumentation.call(this, nextContent); | ||
11628 | } | ||
11654 | } | 11629 | } |
11655 | } else if (nextHtml != null) { | 11630 | } else if (nextHtml != null) { |
11656 | if (lastHtml !== nextHtml) { | 11631 | if (lastHtml !== nextHtml) { |
11657 | this.updateMarkup('' + nextHtml); | 11632 | this.updateMarkup('' + nextHtml); |
11658 | } | 11633 | } |
11634 | if (process.env.NODE_ENV !== 'production') { | ||
11635 | ReactInstrumentation.debugTool.onSetChildren(this._debugID, []); | ||
11636 | } | ||
11659 | } else if (nextChildren != null) { | 11637 | } else if (nextChildren != null) { |
11638 | if (process.env.NODE_ENV !== 'production') { | ||
11639 | setContentChildForInstrumentation.call(this, null); | ||
11640 | } | ||
11641 | |||
11660 | this.updateChildren(nextChildren, transaction, context); | 11642 | this.updateChildren(nextChildren, transaction, context); |
11661 | } | 11643 | } |
11662 | }, | 11644 | }, |
11663 | 11645 | ||
11646 | getHostNode: function () { | ||
11647 | return getNode(this); | ||
11648 | }, | ||
11649 | |||
11664 | /** | 11650 | /** |
11665 | * Destroys all event registrations for this instance. Does not remove from | 11651 | * Destroys all event registrations for this instance. Does not remove from |
11666 | * the DOM. That must be done by the parent. | 11652 | * the DOM. That must be done by the parent. |
11667 | * | 11653 | * |
11668 | * @internal | 11654 | * @internal |
11669 | */ | 11655 | */ |
11670 | unmountComponent: function () { | 11656 | unmountComponent: function (safely) { |
11671 | switch (this._tag) { | 11657 | switch (this._tag) { |
11658 | case 'audio': | ||
11659 | case 'form': | ||
11672 | case 'iframe': | 11660 | case 'iframe': |
11673 | case 'img': | 11661 | case 'img': |
11674 | case 'form': | 11662 | case 'link': |
11663 | case 'object': | ||
11664 | case 'source': | ||
11675 | case 'video': | 11665 | case 'video': |
11676 | case 'audio': | ||
11677 | var listeners = this._wrapperState.listeners; | 11666 | var listeners = this._wrapperState.listeners; |
11678 | if (listeners) { | 11667 | if (listeners) { |
11679 | for (var i = 0; i < listeners.length; i++) { | 11668 | for (var i = 0; i < listeners.length; i++) { |
@@ -11681,9 +11670,6 @@ | |||
11681 | } | 11670 | } |
11682 | } | 11671 | } |
11683 | break; | 11672 | break; |
11684 | case 'input': | ||
11685 | ReactDOMInput.unmountWrapper(this); | ||
11686 | break; | ||
11687 | case 'html': | 11673 | case 'html': |
11688 | case 'head': | 11674 | case 'head': |
11689 | case 'body': | 11675 | case 'body': |
@@ -11693,70 +11679,40 @@ | |||
11693 | * take advantage of React's reconciliation for styling and <title> | 11679 | * take advantage of React's reconciliation for styling and <title> |
11694 | * management. So we just document it and throw in dangerous cases. | 11680 | * management. So we just document it and throw in dangerous cases. |
11695 | */ | 11681 | */ |
11696 | 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) : invariant(false) : undefined; | 11682 | 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; |
11697 | break; | 11683 | break; |
11698 | } | 11684 | } |
11699 | 11685 | ||
11700 | this.unmountChildren(); | 11686 | this.unmountChildren(safely); |
11701 | ReactBrowserEventEmitter.deleteAllListeners(this._rootNodeID); | 11687 | ReactDOMComponentTree.uncacheNode(this); |
11688 | EventPluginHub.deleteAllListeners(this); | ||
11702 | ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID); | 11689 | ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID); |
11703 | this._rootNodeID = null; | 11690 | this._rootNodeID = null; |
11691 | this._domID = null; | ||
11704 | this._wrapperState = null; | 11692 | this._wrapperState = null; |
11705 | if (this._nodeWithLegacyProperties) { | 11693 | |
11706 | var node = this._nodeWithLegacyProperties; | 11694 | if (process.env.NODE_ENV !== 'production') { |
11707 | node._reactInternalComponent = null; | 11695 | setContentChildForInstrumentation.call(this, null); |
11708 | this._nodeWithLegacyProperties = null; | ||
11709 | } | 11696 | } |
11710 | }, | 11697 | }, |
11711 | 11698 | ||
11712 | getPublicInstance: function () { | 11699 | getPublicInstance: function () { |
11713 | if (!this._nodeWithLegacyProperties) { | 11700 | return getNode(this); |
11714 | var node = ReactMount.getNode(this._rootNodeID); | ||
11715 | |||
11716 | node._reactInternalComponent = this; | ||
11717 | node.getDOMNode = legacyGetDOMNode; | ||
11718 | node.isMounted = legacyIsMounted; | ||
11719 | node.setState = legacySetStateEtc; | ||
11720 | node.replaceState = legacySetStateEtc; | ||
11721 | node.forceUpdate = legacySetStateEtc; | ||
11722 | node.setProps = legacySetProps; | ||
11723 | node.replaceProps = legacyReplaceProps; | ||
11724 | |||
11725 | if (process.env.NODE_ENV !== 'production') { | ||
11726 | if (canDefineProperty) { | ||
11727 | Object.defineProperties(node, legacyPropsDescriptor); | ||
11728 | } else { | ||
11729 | // updateComponent will update this property on subsequent renders | ||
11730 | node.props = this._currentElement.props; | ||
11731 | } | ||
11732 | } else { | ||
11733 | // updateComponent will update this property on subsequent renders | ||
11734 | node.props = this._currentElement.props; | ||
11735 | } | ||
11736 | |||
11737 | this._nodeWithLegacyProperties = node; | ||
11738 | } | ||
11739 | return this._nodeWithLegacyProperties; | ||
11740 | } | 11701 | } |
11741 | 11702 | ||
11742 | }; | 11703 | }; |
11743 | 11704 | ||
11744 | ReactPerf.measureMethods(ReactDOMComponent, 'ReactDOMComponent', { | 11705 | _assign(ReactDOMComponent.prototype, ReactDOMComponent.Mixin, ReactMultiChild.Mixin); |
11745 | mountComponent: 'mountComponent', | ||
11746 | updateComponent: 'updateComponent' | ||
11747 | }); | ||
11748 | |||
11749 | assign(ReactDOMComponent.prototype, ReactDOMComponent.Mixin, ReactMultiChild.Mixin); | ||
11750 | 11706 | ||
11751 | module.exports = ReactDOMComponent; | 11707 | module.exports = ReactDOMComponent; |
11752 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | 11708 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) |
11753 | 11709 | ||
11754 | /***/ }, | 11710 | /***/ }, |
11755 | /* 96 */ | 11711 | /* 98 */ |
11756 | /***/ function(module, exports, __webpack_require__) { | 11712 | /***/ function(module, exports, __webpack_require__) { |
11757 | 11713 | ||
11758 | /** | 11714 | /** |
11759 | * Copyright 2013-2015, Facebook, Inc. | 11715 | * Copyright 2013-present, Facebook, Inc. |
11760 | * All rights reserved. | 11716 | * All rights reserved. |
11761 | * | 11717 | * |
11762 | * This source code is licensed under the BSD-style license found in the | 11718 | * This source code is licensed under the BSD-style license found in the |
@@ -11764,47 +11720,34 @@ | |||
11764 | * of patent rights can be found in the PATENTS file in the same directory. | 11720 | * of patent rights can be found in the PATENTS file in the same directory. |
11765 | * | 11721 | * |
11766 | * @providesModule AutoFocusUtils | 11722 | * @providesModule AutoFocusUtils |
11767 | * @typechecks static-only | ||
11768 | */ | 11723 | */ |
11769 | 11724 | ||
11770 | 'use strict'; | 11725 | 'use strict'; |
11771 | 11726 | ||
11772 | var ReactMount = __webpack_require__(30); | 11727 | var ReactDOMComponentTree = __webpack_require__(39); |
11773 | 11728 | ||
11774 | var findDOMNode = __webpack_require__(93); | 11729 | var focusNode = __webpack_require__(99); |
11775 | var focusNode = __webpack_require__(97); | ||
11776 | |||
11777 | var Mixin = { | ||
11778 | componentDidMount: function () { | ||
11779 | if (this.props.autoFocus) { | ||
11780 | focusNode(findDOMNode(this)); | ||
11781 | } | ||
11782 | } | ||
11783 | }; | ||
11784 | 11730 | ||
11785 | var AutoFocusUtils = { | 11731 | var AutoFocusUtils = { |
11786 | Mixin: Mixin, | ||
11787 | |||
11788 | focusDOMComponent: function () { | 11732 | focusDOMComponent: function () { |
11789 | focusNode(ReactMount.getNode(this._rootNodeID)); | 11733 | focusNode(ReactDOMComponentTree.getNodeFromInstance(this)); |
11790 | } | 11734 | } |
11791 | }; | 11735 | }; |
11792 | 11736 | ||
11793 | module.exports = AutoFocusUtils; | 11737 | module.exports = AutoFocusUtils; |
11794 | 11738 | ||
11795 | /***/ }, | 11739 | /***/ }, |
11796 | /* 97 */ | 11740 | /* 99 */ |
11797 | /***/ function(module, exports) { | 11741 | /***/ function(module, exports) { |
11798 | 11742 | ||
11799 | /** | 11743 | /** |
11800 | * Copyright 2013-2015, Facebook, Inc. | 11744 | * Copyright (c) 2013-present, Facebook, Inc. |
11801 | * All rights reserved. | 11745 | * All rights reserved. |
11802 | * | 11746 | * |
11803 | * This source code is licensed under the BSD-style license found in the | 11747 | * This source code is licensed under the BSD-style license found in the |
11804 | * LICENSE file in the root directory of this source tree. An additional grant | 11748 | * LICENSE file in the root directory of this source tree. An additional grant |
11805 | * of patent rights can be found in the PATENTS file in the same directory. | 11749 | * of patent rights can be found in the PATENTS file in the same directory. |
11806 | * | 11750 | * |
11807 | * @providesModule focusNode | ||
11808 | */ | 11751 | */ |
11809 | 11752 | ||
11810 | 'use strict'; | 11753 | 'use strict'; |
@@ -11812,6 +11755,7 @@ | |||
11812 | /** | 11755 | /** |
11813 | * @param {DOMElement} node input/textarea to focus | 11756 | * @param {DOMElement} node input/textarea to focus |
11814 | */ | 11757 | */ |
11758 | |||
11815 | function focusNode(node) { | 11759 | function focusNode(node) { |
11816 | // IE8 can throw "Can't move focus to the control because it is invisible, | 11760 | // IE8 can throw "Can't move focus to the control because it is invisible, |
11817 | // not enabled, or of a type that does not accept the focus." for all kinds of | 11761 | // not enabled, or of a type that does not accept the focus." for all kinds of |
@@ -11824,11 +11768,11 @@ | |||
11824 | module.exports = focusNode; | 11768 | module.exports = focusNode; |
11825 | 11769 | ||
11826 | /***/ }, | 11770 | /***/ }, |
11827 | /* 98 */ | 11771 | /* 100 */ |
11828 | /***/ function(module, exports, __webpack_require__) { | 11772 | /***/ function(module, exports, __webpack_require__) { |
11829 | 11773 | ||
11830 | /* WEBPACK VAR INJECTION */(function(process) {/** | 11774 | /* WEBPACK VAR INJECTION */(function(process) {/** |
11831 | * Copyright 2013-2015, Facebook, Inc. | 11775 | * Copyright 2013-present, Facebook, Inc. |
11832 | * All rights reserved. | 11776 | * All rights reserved. |
11833 | * | 11777 | * |
11834 | * This source code is licensed under the BSD-style license found in the | 11778 | * This source code is licensed under the BSD-style license found in the |
@@ -11836,20 +11780,19 @@ | |||
11836 | * of patent rights can be found in the PATENTS file in the same directory. | 11780 | * of patent rights can be found in the PATENTS file in the same directory. |
11837 | * | 11781 | * |
11838 | * @providesModule CSSPropertyOperations | 11782 | * @providesModule CSSPropertyOperations |
11839 | * @typechecks static-only | ||
11840 | */ | 11783 | */ |
11841 | 11784 | ||
11842 | 'use strict'; | 11785 | 'use strict'; |
11843 | 11786 | ||
11844 | var CSSProperty = __webpack_require__(99); | 11787 | var CSSProperty = __webpack_require__(101); |
11845 | var ExecutionEnvironment = __webpack_require__(11); | 11788 | var ExecutionEnvironment = __webpack_require__(52); |
11846 | var ReactPerf = __webpack_require__(20); | 11789 | var ReactInstrumentation = __webpack_require__(65); |
11847 | 11790 | ||
11848 | var camelizeStyleName = __webpack_require__(100); | 11791 | var camelizeStyleName = __webpack_require__(102); |
11849 | var dangerousStyleValue = __webpack_require__(102); | 11792 | var dangerousStyleValue = __webpack_require__(104); |
11850 | var hyphenateStyleName = __webpack_require__(103); | 11793 | var hyphenateStyleName = __webpack_require__(105); |
11851 | var memoizeStringOnly = __webpack_require__(105); | 11794 | var memoizeStringOnly = __webpack_require__(107); |
11852 | var warning = __webpack_require__(27); | 11795 | var warning = __webpack_require__(13); |
11853 | 11796 | ||
11854 | var processStyleName = memoizeStringOnly(function (styleName) { | 11797 | var processStyleName = memoizeStringOnly(function (styleName) { |
11855 | return hyphenateStyleName(styleName); | 11798 | return hyphenateStyleName(styleName); |
@@ -11880,45 +11823,74 @@ | |||
11880 | 11823 | ||
11881 | var warnedStyleNames = {}; | 11824 | var warnedStyleNames = {}; |
11882 | var warnedStyleValues = {}; | 11825 | var warnedStyleValues = {}; |
11826 | var warnedForNaNValue = false; | ||
11883 | 11827 | ||
11884 | var warnHyphenatedStyleName = function (name) { | 11828 | var warnHyphenatedStyleName = function (name, owner) { |
11885 | if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) { | 11829 | if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) { |
11886 | return; | 11830 | return; |
11887 | } | 11831 | } |
11888 | 11832 | ||
11889 | warnedStyleNames[name] = true; | 11833 | warnedStyleNames[name] = true; |
11890 | process.env.NODE_ENV !== 'production' ? warning(false, 'Unsupported style property %s. Did you mean %s?', name, camelizeStyleName(name)) : undefined; | 11834 | process.env.NODE_ENV !== 'production' ? warning(false, 'Unsupported style property %s. Did you mean %s?%s', name, camelizeStyleName(name), checkRenderMessage(owner)) : void 0; |
11891 | }; | 11835 | }; |
11892 | 11836 | ||
11893 | var warnBadVendoredStyleName = function (name) { | 11837 | var warnBadVendoredStyleName = function (name, owner) { |
11894 | if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) { | 11838 | if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) { |
11895 | return; | 11839 | return; |
11896 | } | 11840 | } |
11897 | 11841 | ||
11898 | warnedStyleNames[name] = true; | 11842 | warnedStyleNames[name] = true; |
11899 | process.env.NODE_ENV !== 'production' ? warning(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?', name, name.charAt(0).toUpperCase() + name.slice(1)) : undefined; | 11843 | 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; |
11900 | }; | 11844 | }; |
11901 | 11845 | ||
11902 | var warnStyleValueWithSemicolon = function (name, value) { | 11846 | var warnStyleValueWithSemicolon = function (name, value, owner) { |
11903 | if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) { | 11847 | if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) { |
11904 | return; | 11848 | return; |
11905 | } | 11849 | } |
11906 | 11850 | ||
11907 | warnedStyleValues[value] = true; | 11851 | warnedStyleValues[value] = true; |
11908 | process.env.NODE_ENV !== 'production' ? warning(false, 'Style property values shouldn\'t contain a semicolon. ' + 'Try "%s: %s" instead.', name, value.replace(badStyleValueWithSemicolonPattern, '')) : undefined; | 11852 | 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; |
11853 | }; | ||
11854 | |||
11855 | var warnStyleValueIsNaN = function (name, value, owner) { | ||
11856 | if (warnedForNaNValue) { | ||
11857 | return; | ||
11858 | } | ||
11859 | |||
11860 | warnedForNaNValue = true; | ||
11861 | process.env.NODE_ENV !== 'production' ? warning(false, '`NaN` is an invalid value for the `%s` css style property.%s', name, checkRenderMessage(owner)) : void 0; | ||
11862 | }; | ||
11863 | |||
11864 | var checkRenderMessage = function (owner) { | ||
11865 | if (owner) { | ||
11866 | var name = owner.getName(); | ||
11867 | if (name) { | ||
11868 | return ' Check the render method of `' + name + '`.'; | ||
11869 | } | ||
11870 | } | ||
11871 | return ''; | ||
11909 | }; | 11872 | }; |
11910 | 11873 | ||
11911 | /** | 11874 | /** |
11912 | * @param {string} name | 11875 | * @param {string} name |
11913 | * @param {*} value | 11876 | * @param {*} value |
11877 | * @param {ReactDOMComponent} component | ||
11914 | */ | 11878 | */ |
11915 | var warnValidStyle = function (name, value) { | 11879 | var warnValidStyle = function (name, value, component) { |
11880 | var owner; | ||
11881 | if (component) { | ||
11882 | owner = component._currentElement._owner; | ||
11883 | } | ||
11916 | if (name.indexOf('-') > -1) { | 11884 | if (name.indexOf('-') > -1) { |
11917 | warnHyphenatedStyleName(name); | 11885 | warnHyphenatedStyleName(name, owner); |
11918 | } else if (badVendoredStyleNamePattern.test(name)) { | 11886 | } else if (badVendoredStyleNamePattern.test(name)) { |
11919 | warnBadVendoredStyleName(name); | 11887 | warnBadVendoredStyleName(name, owner); |
11920 | } else if (badStyleValueWithSemicolonPattern.test(value)) { | 11888 | } else if (badStyleValueWithSemicolonPattern.test(value)) { |
11921 | warnStyleValueWithSemicolon(name, value); | 11889 | warnStyleValueWithSemicolon(name, value, owner); |
11890 | } | ||
11891 | |||
11892 | if (typeof value === 'number' && isNaN(value)) { | ||
11893 | warnStyleValueIsNaN(name, value, owner); | ||
11922 | } | 11894 | } |
11923 | }; | 11895 | }; |
11924 | } | 11896 | } |
@@ -11938,9 +11910,10 @@ | |||
11938 | * The result should be HTML-escaped before insertion into the DOM. | 11910 | * The result should be HTML-escaped before insertion into the DOM. |
11939 | * | 11911 | * |
11940 | * @param {object} styles | 11912 | * @param {object} styles |
11913 | * @param {ReactDOMComponent} component | ||
11941 | * @return {?string} | 11914 | * @return {?string} |
11942 | */ | 11915 | */ |
11943 | createMarkupForStyles: function (styles) { | 11916 | createMarkupForStyles: function (styles, component) { |
11944 | var serialized = ''; | 11917 | var serialized = ''; |
11945 | for (var styleName in styles) { | 11918 | for (var styleName in styles) { |
11946 | if (!styles.hasOwnProperty(styleName)) { | 11919 | if (!styles.hasOwnProperty(styleName)) { |
@@ -11948,11 +11921,11 @@ | |||
11948 | } | 11921 | } |
11949 | var styleValue = styles[styleName]; | 11922 | var styleValue = styles[styleName]; |
11950 | if (process.env.NODE_ENV !== 'production') { | 11923 | if (process.env.NODE_ENV !== 'production') { |
11951 | warnValidStyle(styleName, styleValue); | 11924 | warnValidStyle(styleName, styleValue, component); |
11952 | } | 11925 | } |
11953 | if (styleValue != null) { | 11926 | if (styleValue != null) { |
11954 | serialized += processStyleName(styleName) + ':'; | 11927 | serialized += processStyleName(styleName) + ':'; |
11955 | serialized += dangerousStyleValue(styleName, styleValue) + ';'; | 11928 | serialized += dangerousStyleValue(styleName, styleValue, component) + ';'; |
11956 | } | 11929 | } |
11957 | } | 11930 | } |
11958 | return serialized || null; | 11931 | return serialized || null; |
@@ -11964,18 +11937,23 @@ | |||
11964 | * | 11937 | * |
11965 | * @param {DOMElement} node | 11938 | * @param {DOMElement} node |
11966 | * @param {object} styles | 11939 | * @param {object} styles |
11940 | * @param {ReactDOMComponent} component | ||
11967 | */ | 11941 | */ |
11968 | setValueForStyles: function (node, styles) { | 11942 | setValueForStyles: function (node, styles, component) { |
11943 | if (process.env.NODE_ENV !== 'production') { | ||
11944 | ReactInstrumentation.debugTool.onHostOperation(component._debugID, 'update styles', styles); | ||
11945 | } | ||
11946 | |||
11969 | var style = node.style; | 11947 | var style = node.style; |
11970 | for (var styleName in styles) { | 11948 | for (var styleName in styles) { |
11971 | if (!styles.hasOwnProperty(styleName)) { | 11949 | if (!styles.hasOwnProperty(styleName)) { |
11972 | continue; | 11950 | continue; |
11973 | } | 11951 | } |
11974 | if (process.env.NODE_ENV !== 'production') { | 11952 | if (process.env.NODE_ENV !== 'production') { |
11975 | warnValidStyle(styleName, styles[styleName]); | 11953 | warnValidStyle(styleName, styles[styleName], component); |
11976 | } | 11954 | } |
11977 | var styleValue = dangerousStyleValue(styleName, styles[styleName]); | 11955 | var styleValue = dangerousStyleValue(styleName, styles[styleName], component); |
11978 | if (styleName === 'float') { | 11956 | if (styleName === 'float' || styleName === 'cssFloat') { |
11979 | styleName = styleFloatAccessor; | 11957 | styleName = styleFloatAccessor; |
11980 | } | 11958 | } |
11981 | if (styleValue) { | 11959 | if (styleValue) { |
@@ -11997,19 +11975,15 @@ | |||
11997 | 11975 | ||
11998 | }; | 11976 | }; |
11999 | 11977 | ||
12000 | ReactPerf.measureMethods(CSSPropertyOperations, 'CSSPropertyOperations', { | ||
12001 | setValueForStyles: 'setValueForStyles' | ||
12002 | }); | ||
12003 | |||
12004 | module.exports = CSSPropertyOperations; | 11978 | module.exports = CSSPropertyOperations; |
12005 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | 11979 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) |
12006 | 11980 | ||
12007 | /***/ }, | 11981 | /***/ }, |
12008 | /* 99 */ | 11982 | /* 101 */ |
12009 | /***/ function(module, exports) { | 11983 | /***/ function(module, exports) { |
12010 | 11984 | ||
12011 | /** | 11985 | /** |
12012 | * Copyright 2013-2015, Facebook, Inc. | 11986 | * Copyright 2013-present, Facebook, Inc. |
12013 | * All rights reserved. | 11987 | * All rights reserved. |
12014 | * | 11988 | * |
12015 | * This source code is licensed under the BSD-style license found in the | 11989 | * This source code is licensed under the BSD-style license found in the |
@@ -12024,8 +11998,12 @@ | |||
12024 | /** | 11998 | /** |
12025 | * CSS properties which accept numbers but are not in units of "px". | 11999 | * CSS properties which accept numbers but are not in units of "px". |
12026 | */ | 12000 | */ |
12001 | |||
12027 | var isUnitlessNumber = { | 12002 | var isUnitlessNumber = { |
12028 | animationIterationCount: true, | 12003 | animationIterationCount: true, |
12004 | borderImageOutset: true, | ||
12005 | borderImageSlice: true, | ||
12006 | borderImageWidth: true, | ||
12029 | boxFlex: true, | 12007 | boxFlex: true, |
12030 | boxFlexGroup: true, | 12008 | boxFlexGroup: true, |
12031 | boxOrdinalGroup: true, | 12009 | boxOrdinalGroup: true, |
@@ -12036,6 +12014,8 @@ | |||
12036 | flexShrink: true, | 12014 | flexShrink: true, |
12037 | flexNegative: true, | 12015 | flexNegative: true, |
12038 | flexOrder: true, | 12016 | flexOrder: true, |
12017 | gridRow: true, | ||
12018 | gridColumn: true, | ||
12039 | fontWeight: true, | 12019 | fontWeight: true, |
12040 | lineClamp: true, | 12020 | lineClamp: true, |
12041 | lineHeight: true, | 12021 | lineHeight: true, |
@@ -12049,8 +12029,11 @@ | |||
12049 | 12029 | ||
12050 | // SVG-related properties | 12030 | // SVG-related properties |
12051 | fillOpacity: true, | 12031 | fillOpacity: true, |
12032 | floodOpacity: true, | ||
12052 | stopOpacity: true, | 12033 | stopOpacity: true, |
12034 | strokeDasharray: true, | ||
12053 | strokeDashoffset: true, | 12035 | strokeDashoffset: true, |
12036 | strokeMiterlimit: true, | ||
12054 | strokeOpacity: true, | 12037 | strokeOpacity: true, |
12055 | strokeWidth: true | 12038 | strokeWidth: true |
12056 | }; | 12039 | }; |
@@ -12149,24 +12132,23 @@ | |||
12149 | module.exports = CSSProperty; | 12132 | module.exports = CSSProperty; |
12150 | 12133 | ||
12151 | /***/ }, | 12134 | /***/ }, |
12152 | /* 100 */ | 12135 | /* 102 */ |
12153 | /***/ function(module, exports, __webpack_require__) { | 12136 | /***/ function(module, exports, __webpack_require__) { |
12154 | 12137 | ||
12155 | /** | 12138 | /** |
12156 | * Copyright 2013-2015, Facebook, Inc. | 12139 | * Copyright (c) 2013-present, Facebook, Inc. |
12157 | * All rights reserved. | 12140 | * All rights reserved. |
12158 | * | 12141 | * |
12159 | * This source code is licensed under the BSD-style license found in the | 12142 | * This source code is licensed under the BSD-style license found in the |
12160 | * LICENSE file in the root directory of this source tree. An additional grant | 12143 | * LICENSE file in the root directory of this source tree. An additional grant |
12161 | * of patent rights can be found in the PATENTS file in the same directory. | 12144 | * of patent rights can be found in the PATENTS file in the same directory. |
12162 | * | 12145 | * |
12163 | * @providesModule camelizeStyleName | ||
12164 | * @typechecks | 12146 | * @typechecks |
12165 | */ | 12147 | */ |
12166 | 12148 | ||
12167 | 'use strict'; | 12149 | 'use strict'; |
12168 | 12150 | ||
12169 | var camelize = __webpack_require__(101); | 12151 | var camelize = __webpack_require__(103); |
12170 | 12152 | ||
12171 | var msPattern = /^-ms-/; | 12153 | var msPattern = /^-ms-/; |
12172 | 12154 | ||
@@ -12194,23 +12176,22 @@ | |||
12194 | module.exports = camelizeStyleName; | 12176 | module.exports = camelizeStyleName; |
12195 | 12177 | ||
12196 | /***/ }, | 12178 | /***/ }, |
12197 | /* 101 */ | 12179 | /* 103 */ |
12198 | /***/ function(module, exports) { | 12180 | /***/ function(module, exports) { |
12199 | 12181 | ||
12182 | "use strict"; | ||
12183 | |||
12200 | /** | 12184 | /** |
12201 | * Copyright 2013-2015, Facebook, Inc. | 12185 | * Copyright (c) 2013-present, Facebook, Inc. |
12202 | * All rights reserved. | 12186 | * All rights reserved. |
12203 | * | 12187 | * |
12204 | * This source code is licensed under the BSD-style license found in the | 12188 | * 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 | 12189 | * 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. | 12190 | * of patent rights can be found in the PATENTS file in the same directory. |
12207 | * | 12191 | * |
12208 | * @providesModule camelize | ||
12209 | * @typechecks | 12192 | * @typechecks |
12210 | */ | 12193 | */ |
12211 | 12194 | ||
12212 | "use strict"; | ||
12213 | |||
12214 | var _hyphenPattern = /-(.)/g; | 12195 | var _hyphenPattern = /-(.)/g; |
12215 | 12196 | ||
12216 | /** | 12197 | /** |
@@ -12231,11 +12212,11 @@ | |||
12231 | module.exports = camelize; | 12212 | module.exports = camelize; |
12232 | 12213 | ||
12233 | /***/ }, | 12214 | /***/ }, |
12234 | /* 102 */ | 12215 | /* 104 */ |
12235 | /***/ function(module, exports, __webpack_require__) { | 12216 | /***/ function(module, exports, __webpack_require__) { |
12236 | 12217 | ||
12237 | /** | 12218 | /* WEBPACK VAR INJECTION */(function(process) {/** |
12238 | * Copyright 2013-2015, Facebook, Inc. | 12219 | * Copyright 2013-present, Facebook, Inc. |
12239 | * All rights reserved. | 12220 | * All rights reserved. |
12240 | * | 12221 | * |
12241 | * This source code is licensed under the BSD-style license found in the | 12222 | * This source code is licensed under the BSD-style license found in the |
@@ -12243,14 +12224,15 @@ | |||
12243 | * of patent rights can be found in the PATENTS file in the same directory. | 12224 | * of patent rights can be found in the PATENTS file in the same directory. |
12244 | * | 12225 | * |
12245 | * @providesModule dangerousStyleValue | 12226 | * @providesModule dangerousStyleValue |
12246 | * @typechecks static-only | ||
12247 | */ | 12227 | */ |
12248 | 12228 | ||
12249 | 'use strict'; | 12229 | 'use strict'; |
12250 | 12230 | ||
12251 | var CSSProperty = __webpack_require__(99); | 12231 | var CSSProperty = __webpack_require__(101); |
12232 | var warning = __webpack_require__(13); | ||
12252 | 12233 | ||
12253 | var isUnitlessNumber = CSSProperty.isUnitlessNumber; | 12234 | var isUnitlessNumber = CSSProperty.isUnitlessNumber; |
12235 | var styleWarnings = {}; | ||
12254 | 12236 | ||
12255 | /** | 12237 | /** |
12256 | * Convert a value into the proper css writable value. The style name `name` | 12238 | * Convert a value into the proper css writable value. The style name `name` |
@@ -12259,9 +12241,10 @@ | |||
12259 | * | 12241 | * |
12260 | * @param {string} name CSS property name such as `topMargin`. | 12242 | * @param {string} name CSS property name such as `topMargin`. |
12261 | * @param {*} value CSS property value such as `10px`. | 12243 | * @param {*} value CSS property value such as `10px`. |
12244 | * @param {ReactDOMComponent} component | ||
12262 | * @return {string} Normalized style value with dimensions applied. | 12245 | * @return {string} Normalized style value with dimensions applied. |
12263 | */ | 12246 | */ |
12264 | function dangerousStyleValue(name, value) { | 12247 | function dangerousStyleValue(name, value, component) { |
12265 | // Note that we've removed escapeTextForBrowser() calls here since the | 12248 | // Note that we've removed escapeTextForBrowser() calls here since the |
12266 | // whole string will be escaped when the attribute is injected into | 12249 | // whole string will be escaped when the attribute is injected into |
12267 | // the markup. If you provide unsafe user data here they can inject | 12250 | // the markup. If you provide unsafe user data here they can inject |
@@ -12283,32 +12266,54 @@ | |||
12283 | } | 12266 | } |
12284 | 12267 | ||
12285 | if (typeof value === 'string') { | 12268 | if (typeof value === 'string') { |
12269 | if (process.env.NODE_ENV !== 'production') { | ||
12270 | // Allow '0' to pass through without warning. 0 is already special and | ||
12271 | // doesn't require units, so we don't need to warn about it. | ||
12272 | if (component && value !== '0') { | ||
12273 | var owner = component._currentElement._owner; | ||
12274 | var ownerName = owner ? owner.getName() : null; | ||
12275 | if (ownerName && !styleWarnings[ownerName]) { | ||
12276 | styleWarnings[ownerName] = {}; | ||
12277 | } | ||
12278 | var warned = false; | ||
12279 | if (ownerName) { | ||
12280 | var warnings = styleWarnings[ownerName]; | ||
12281 | warned = warnings[name]; | ||
12282 | if (!warned) { | ||
12283 | warnings[name] = true; | ||
12284 | } | ||
12285 | } | ||
12286 | if (!warned) { | ||
12287 | 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; | ||
12288 | } | ||
12289 | } | ||
12290 | } | ||
12286 | value = value.trim(); | 12291 | value = value.trim(); |
12287 | } | 12292 | } |
12288 | return value + 'px'; | 12293 | return value + 'px'; |
12289 | } | 12294 | } |
12290 | 12295 | ||
12291 | module.exports = dangerousStyleValue; | 12296 | module.exports = dangerousStyleValue; |
12297 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
12292 | 12298 | ||
12293 | /***/ }, | 12299 | /***/ }, |
12294 | /* 103 */ | 12300 | /* 105 */ |
12295 | /***/ function(module, exports, __webpack_require__) { | 12301 | /***/ function(module, exports, __webpack_require__) { |
12296 | 12302 | ||
12297 | /** | 12303 | /** |
12298 | * Copyright 2013-2015, Facebook, Inc. | 12304 | * Copyright (c) 2013-present, Facebook, Inc. |
12299 | * All rights reserved. | 12305 | * All rights reserved. |
12300 | * | 12306 | * |
12301 | * This source code is licensed under the BSD-style license found in the | 12307 | * This source code is licensed under the BSD-style license found in the |
12302 | * LICENSE file in the root directory of this source tree. An additional grant | 12308 | * LICENSE file in the root directory of this source tree. An additional grant |
12303 | * of patent rights can be found in the PATENTS file in the same directory. | 12309 | * of patent rights can be found in the PATENTS file in the same directory. |
12304 | * | 12310 | * |
12305 | * @providesModule hyphenateStyleName | ||
12306 | * @typechecks | 12311 | * @typechecks |
12307 | */ | 12312 | */ |
12308 | 12313 | ||
12309 | 'use strict'; | 12314 | 'use strict'; |
12310 | 12315 | ||
12311 | var hyphenate = __webpack_require__(104); | 12316 | var hyphenate = __webpack_require__(106); |
12312 | 12317 | ||
12313 | var msPattern = /^ms-/; | 12318 | var msPattern = /^ms-/; |
12314 | 12319 | ||
@@ -12335,23 +12340,22 @@ | |||
12335 | module.exports = hyphenateStyleName; | 12340 | module.exports = hyphenateStyleName; |
12336 | 12341 | ||
12337 | /***/ }, | 12342 | /***/ }, |
12338 | /* 104 */ | 12343 | /* 106 */ |
12339 | /***/ function(module, exports) { | 12344 | /***/ function(module, exports) { |
12340 | 12345 | ||
12346 | 'use strict'; | ||
12347 | |||
12341 | /** | 12348 | /** |
12342 | * Copyright 2013-2015, Facebook, Inc. | 12349 | * Copyright (c) 2013-present, Facebook, Inc. |
12343 | * All rights reserved. | 12350 | * All rights reserved. |
12344 | * | 12351 | * |
12345 | * This source code is licensed under the BSD-style license found in the | 12352 | * This source code is licensed under the BSD-style license found in the |
12346 | * LICENSE file in the root directory of this source tree. An additional grant | 12353 | * LICENSE file in the root directory of this source tree. An additional grant |
12347 | * of patent rights can be found in the PATENTS file in the same directory. | 12354 | * of patent rights can be found in the PATENTS file in the same directory. |
12348 | * | 12355 | * |
12349 | * @providesModule hyphenate | ||
12350 | * @typechecks | 12356 | * @typechecks |
12351 | */ | 12357 | */ |
12352 | 12358 | ||
12353 | 'use strict'; | ||
12354 | |||
12355 | var _uppercasePattern = /([A-Z])/g; | 12359 | var _uppercasePattern = /([A-Z])/g; |
12356 | 12360 | ||
12357 | /** | 12361 | /** |
@@ -12373,18 +12377,18 @@ | |||
12373 | module.exports = hyphenate; | 12377 | module.exports = hyphenate; |
12374 | 12378 | ||
12375 | /***/ }, | 12379 | /***/ }, |
12376 | /* 105 */ | 12380 | /* 107 */ |
12377 | /***/ function(module, exports) { | 12381 | /***/ function(module, exports) { |
12378 | 12382 | ||
12379 | /** | 12383 | /** |
12380 | * Copyright 2013-2015, Facebook, Inc. | 12384 | * Copyright (c) 2013-present, Facebook, Inc. |
12381 | * All rights reserved. | 12385 | * All rights reserved. |
12382 | * | 12386 | * |
12383 | * This source code is licensed under the BSD-style license found in the | 12387 | * This source code is licensed under the BSD-style license found in the |
12384 | * LICENSE file in the root directory of this source tree. An additional grant | 12388 | * LICENSE file in the root directory of this source tree. An additional grant |
12385 | * of patent rights can be found in the PATENTS file in the same directory. | 12389 | * of patent rights can be found in the PATENTS file in the same directory. |
12386 | * | 12390 | * |
12387 | * @providesModule memoizeStringOnly | 12391 | * |
12388 | * @typechecks static-only | 12392 | * @typechecks static-only |
12389 | */ | 12393 | */ |
12390 | 12394 | ||
@@ -12392,10 +12396,8 @@ | |||
12392 | 12396 | ||
12393 | /** | 12397 | /** |
12394 | * Memoizes the return value of a function that accepts one string argument. | 12398 | * Memoizes the return value of a function that accepts one string argument. |
12395 | * | ||
12396 | * @param {function} callback | ||
12397 | * @return {function} | ||
12398 | */ | 12399 | */ |
12400 | |||
12399 | function memoizeStringOnly(callback) { | 12401 | function memoizeStringOnly(callback) { |
12400 | var cache = {}; | 12402 | var cache = {}; |
12401 | return function (string) { | 12403 | return function (string) { |
@@ -12409,11 +12411,1009 @@ | |||
12409 | module.exports = memoizeStringOnly; | 12411 | module.exports = memoizeStringOnly; |
12410 | 12412 | ||
12411 | /***/ }, | 12413 | /***/ }, |
12412 | /* 106 */ | 12414 | /* 108 */ |
12413 | /***/ function(module, exports) { | 12415 | /***/ function(module, exports, __webpack_require__) { |
12414 | 12416 | ||
12417 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
12418 | * Copyright 2013-present, Facebook, Inc. | ||
12419 | * All rights reserved. | ||
12420 | * | ||
12421 | * This source code is licensed under the BSD-style license found in the | ||
12422 | * LICENSE file in the root directory of this source tree. An additional grant | ||
12423 | * of patent rights can be found in the PATENTS file in the same directory. | ||
12424 | * | ||
12425 | * @providesModule DOMPropertyOperations | ||
12426 | */ | ||
12427 | |||
12428 | 'use strict'; | ||
12429 | |||
12430 | var DOMProperty = __webpack_require__(40); | ||
12431 | var ReactDOMComponentTree = __webpack_require__(39); | ||
12432 | var ReactDOMInstrumentation = __webpack_require__(109); | ||
12433 | var ReactInstrumentation = __webpack_require__(65); | ||
12434 | |||
12435 | var quoteAttributeValueForBrowser = __webpack_require__(113); | ||
12436 | var warning = __webpack_require__(13); | ||
12437 | |||
12438 | var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + DOMProperty.ATTRIBUTE_NAME_START_CHAR + '][' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$'); | ||
12439 | var illegalAttributeNameCache = {}; | ||
12440 | var validatedAttributeNameCache = {}; | ||
12441 | |||
12442 | function isAttributeNameSafe(attributeName) { | ||
12443 | if (validatedAttributeNameCache.hasOwnProperty(attributeName)) { | ||
12444 | return true; | ||
12445 | } | ||
12446 | if (illegalAttributeNameCache.hasOwnProperty(attributeName)) { | ||
12447 | return false; | ||
12448 | } | ||
12449 | if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) { | ||
12450 | validatedAttributeNameCache[attributeName] = true; | ||
12451 | return true; | ||
12452 | } | ||
12453 | illegalAttributeNameCache[attributeName] = true; | ||
12454 | process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid attribute name: `%s`', attributeName) : void 0; | ||
12455 | return false; | ||
12456 | } | ||
12457 | |||
12458 | function shouldIgnoreValue(propertyInfo, value) { | ||
12459 | return value == null || propertyInfo.hasBooleanValue && !value || propertyInfo.hasNumericValue && isNaN(value) || propertyInfo.hasPositiveNumericValue && value < 1 || propertyInfo.hasOverloadedBooleanValue && value === false; | ||
12460 | } | ||
12461 | |||
12415 | /** | 12462 | /** |
12416 | * Copyright 2013-2015, Facebook, Inc. | 12463 | * Operations for dealing with DOM properties. |
12464 | */ | ||
12465 | var DOMPropertyOperations = { | ||
12466 | |||
12467 | /** | ||
12468 | * Creates markup for the ID property. | ||
12469 | * | ||
12470 | * @param {string} id Unescaped ID. | ||
12471 | * @return {string} Markup string. | ||
12472 | */ | ||
12473 | createMarkupForID: function (id) { | ||
12474 | return DOMProperty.ID_ATTRIBUTE_NAME + '=' + quoteAttributeValueForBrowser(id); | ||
12475 | }, | ||
12476 | |||
12477 | setAttributeForID: function (node, id) { | ||
12478 | node.setAttribute(DOMProperty.ID_ATTRIBUTE_NAME, id); | ||
12479 | }, | ||
12480 | |||
12481 | createMarkupForRoot: function () { | ||
12482 | return DOMProperty.ROOT_ATTRIBUTE_NAME + '=""'; | ||
12483 | }, | ||
12484 | |||
12485 | setAttributeForRoot: function (node) { | ||
12486 | node.setAttribute(DOMProperty.ROOT_ATTRIBUTE_NAME, ''); | ||
12487 | }, | ||
12488 | |||
12489 | /** | ||
12490 | * Creates markup for a property. | ||
12491 | * | ||
12492 | * @param {string} name | ||
12493 | * @param {*} value | ||
12494 | * @return {?string} Markup string, or null if the property was invalid. | ||
12495 | */ | ||
12496 | createMarkupForProperty: function (name, value) { | ||
12497 | if (process.env.NODE_ENV !== 'production') { | ||
12498 | ReactDOMInstrumentation.debugTool.onCreateMarkupForProperty(name, value); | ||
12499 | } | ||
12500 | var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null; | ||
12501 | if (propertyInfo) { | ||
12502 | if (shouldIgnoreValue(propertyInfo, value)) { | ||
12503 | return ''; | ||
12504 | } | ||
12505 | var attributeName = propertyInfo.attributeName; | ||
12506 | if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) { | ||
12507 | return attributeName + '=""'; | ||
12508 | } | ||
12509 | return attributeName + '=' + quoteAttributeValueForBrowser(value); | ||
12510 | } else if (DOMProperty.isCustomAttribute(name)) { | ||
12511 | if (value == null) { | ||
12512 | return ''; | ||
12513 | } | ||
12514 | return name + '=' + quoteAttributeValueForBrowser(value); | ||
12515 | } | ||
12516 | return null; | ||
12517 | }, | ||
12518 | |||
12519 | /** | ||
12520 | * Creates markup for a custom property. | ||
12521 | * | ||
12522 | * @param {string} name | ||
12523 | * @param {*} value | ||
12524 | * @return {string} Markup string, or empty string if the property was invalid. | ||
12525 | */ | ||
12526 | createMarkupForCustomAttribute: function (name, value) { | ||
12527 | if (!isAttributeNameSafe(name) || value == null) { | ||
12528 | return ''; | ||
12529 | } | ||
12530 | return name + '=' + quoteAttributeValueForBrowser(value); | ||
12531 | }, | ||
12532 | |||
12533 | /** | ||
12534 | * Sets the value for a property on a node. | ||
12535 | * | ||
12536 | * @param {DOMElement} node | ||
12537 | * @param {string} name | ||
12538 | * @param {*} value | ||
12539 | */ | ||
12540 | setValueForProperty: function (node, name, value) { | ||
12541 | var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null; | ||
12542 | if (propertyInfo) { | ||
12543 | var mutationMethod = propertyInfo.mutationMethod; | ||
12544 | if (mutationMethod) { | ||
12545 | mutationMethod(node, value); | ||
12546 | } else if (shouldIgnoreValue(propertyInfo, value)) { | ||
12547 | this.deleteValueForProperty(node, name); | ||
12548 | return; | ||
12549 | } else if (propertyInfo.mustUseProperty) { | ||
12550 | // Contrary to `setAttribute`, object properties are properly | ||
12551 | // `toString`ed by IE8/9. | ||
12552 | node[propertyInfo.propertyName] = value; | ||
12553 | } else { | ||
12554 | var attributeName = propertyInfo.attributeName; | ||
12555 | var namespace = propertyInfo.attributeNamespace; | ||
12556 | // `setAttribute` with objects becomes only `[object]` in IE8/9, | ||
12557 | // ('' + value) makes it output the correct toString()-value. | ||
12558 | if (namespace) { | ||
12559 | node.setAttributeNS(namespace, attributeName, '' + value); | ||
12560 | } else if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) { | ||
12561 | node.setAttribute(attributeName, ''); | ||
12562 | } else { | ||
12563 | node.setAttribute(attributeName, '' + value); | ||
12564 | } | ||
12565 | } | ||
12566 | } else if (DOMProperty.isCustomAttribute(name)) { | ||
12567 | DOMPropertyOperations.setValueForAttribute(node, name, value); | ||
12568 | return; | ||
12569 | } | ||
12570 | |||
12571 | if (process.env.NODE_ENV !== 'production') { | ||
12572 | ReactDOMInstrumentation.debugTool.onSetValueForProperty(node, name, value); | ||
12573 | var payload = {}; | ||
12574 | payload[name] = value; | ||
12575 | ReactInstrumentation.debugTool.onHostOperation(ReactDOMComponentTree.getInstanceFromNode(node)._debugID, 'update attribute', payload); | ||
12576 | } | ||
12577 | }, | ||
12578 | |||
12579 | setValueForAttribute: function (node, name, value) { | ||
12580 | if (!isAttributeNameSafe(name)) { | ||
12581 | return; | ||
12582 | } | ||
12583 | if (value == null) { | ||
12584 | node.removeAttribute(name); | ||
12585 | } else { | ||
12586 | node.setAttribute(name, '' + value); | ||
12587 | } | ||
12588 | |||
12589 | if (process.env.NODE_ENV !== 'production') { | ||
12590 | var payload = {}; | ||
12591 | payload[name] = value; | ||
12592 | ReactInstrumentation.debugTool.onHostOperation(ReactDOMComponentTree.getInstanceFromNode(node)._debugID, 'update attribute', payload); | ||
12593 | } | ||
12594 | }, | ||
12595 | |||
12596 | /** | ||
12597 | * Deletes an attributes from a node. | ||
12598 | * | ||
12599 | * @param {DOMElement} node | ||
12600 | * @param {string} name | ||
12601 | */ | ||
12602 | deleteValueForAttribute: function (node, name) { | ||
12603 | node.removeAttribute(name); | ||
12604 | if (process.env.NODE_ENV !== 'production') { | ||
12605 | ReactDOMInstrumentation.debugTool.onDeleteValueForProperty(node, name); | ||
12606 | ReactInstrumentation.debugTool.onHostOperation(ReactDOMComponentTree.getInstanceFromNode(node)._debugID, 'remove attribute', name); | ||
12607 | } | ||
12608 | }, | ||
12609 | |||
12610 | /** | ||
12611 | * Deletes the value for a property on a node. | ||
12612 | * | ||
12613 | * @param {DOMElement} node | ||
12614 | * @param {string} name | ||
12615 | */ | ||
12616 | deleteValueForProperty: function (node, name) { | ||
12617 | var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null; | ||
12618 | if (propertyInfo) { | ||
12619 | var mutationMethod = propertyInfo.mutationMethod; | ||
12620 | if (mutationMethod) { | ||
12621 | mutationMethod(node, undefined); | ||
12622 | } else if (propertyInfo.mustUseProperty) { | ||
12623 | var propName = propertyInfo.propertyName; | ||
12624 | if (propertyInfo.hasBooleanValue) { | ||
12625 | node[propName] = false; | ||
12626 | } else { | ||
12627 | node[propName] = ''; | ||
12628 | } | ||
12629 | } else { | ||
12630 | node.removeAttribute(propertyInfo.attributeName); | ||
12631 | } | ||
12632 | } else if (DOMProperty.isCustomAttribute(name)) { | ||
12633 | node.removeAttribute(name); | ||
12634 | } | ||
12635 | |||
12636 | if (process.env.NODE_ENV !== 'production') { | ||
12637 | ReactDOMInstrumentation.debugTool.onDeleteValueForProperty(node, name); | ||
12638 | ReactInstrumentation.debugTool.onHostOperation(ReactDOMComponentTree.getInstanceFromNode(node)._debugID, 'remove attribute', name); | ||
12639 | } | ||
12640 | } | ||
12641 | |||
12642 | }; | ||
12643 | |||
12644 | module.exports = DOMPropertyOperations; | ||
12645 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
12646 | |||
12647 | /***/ }, | ||
12648 | /* 109 */ | ||
12649 | /***/ function(module, exports, __webpack_require__) { | ||
12650 | |||
12651 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
12652 | * Copyright 2013-present, Facebook, Inc. | ||
12653 | * All rights reserved. | ||
12654 | * | ||
12655 | * This source code is licensed under the BSD-style license found in the | ||
12656 | * LICENSE file in the root directory of this source tree. An additional grant | ||
12657 | * of patent rights can be found in the PATENTS file in the same directory. | ||
12658 | * | ||
12659 | * @providesModule ReactDOMInstrumentation | ||
12660 | */ | ||
12661 | |||
12662 | 'use strict'; | ||
12663 | |||
12664 | var debugTool = null; | ||
12665 | |||
12666 | if (process.env.NODE_ENV !== 'production') { | ||
12667 | var ReactDOMDebugTool = __webpack_require__(110); | ||
12668 | debugTool = ReactDOMDebugTool; | ||
12669 | } | ||
12670 | |||
12671 | module.exports = { debugTool: debugTool }; | ||
12672 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
12673 | |||
12674 | /***/ }, | ||
12675 | /* 110 */ | ||
12676 | /***/ function(module, exports, __webpack_require__) { | ||
12677 | |||
12678 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
12679 | * Copyright 2013-present, Facebook, Inc. | ||
12680 | * All rights reserved. | ||
12681 | * | ||
12682 | * This source code is licensed under the BSD-style license found in the | ||
12683 | * LICENSE file in the root directory of this source tree. An additional grant | ||
12684 | * of patent rights can be found in the PATENTS file in the same directory. | ||
12685 | * | ||
12686 | * @providesModule ReactDOMDebugTool | ||
12687 | */ | ||
12688 | |||
12689 | 'use strict'; | ||
12690 | |||
12691 | var ReactDOMNullInputValuePropDevtool = __webpack_require__(111); | ||
12692 | var ReactDOMUnknownPropertyDevtool = __webpack_require__(112); | ||
12693 | var ReactDebugTool = __webpack_require__(66); | ||
12694 | |||
12695 | var warning = __webpack_require__(13); | ||
12696 | |||
12697 | var eventHandlers = []; | ||
12698 | var handlerDoesThrowForEvent = {}; | ||
12699 | |||
12700 | function emitEvent(handlerFunctionName, arg1, arg2, arg3, arg4, arg5) { | ||
12701 | eventHandlers.forEach(function (handler) { | ||
12702 | try { | ||
12703 | if (handler[handlerFunctionName]) { | ||
12704 | handler[handlerFunctionName](arg1, arg2, arg3, arg4, arg5); | ||
12705 | } | ||
12706 | } catch (e) { | ||
12707 | process.env.NODE_ENV !== 'production' ? warning(handlerDoesThrowForEvent[handlerFunctionName], 'exception thrown by devtool while handling %s: %s', handlerFunctionName, e + '\n' + e.stack) : void 0; | ||
12708 | handlerDoesThrowForEvent[handlerFunctionName] = true; | ||
12709 | } | ||
12710 | }); | ||
12711 | } | ||
12712 | |||
12713 | var ReactDOMDebugTool = { | ||
12714 | addDevtool: function (devtool) { | ||
12715 | ReactDebugTool.addDevtool(devtool); | ||
12716 | eventHandlers.push(devtool); | ||
12717 | }, | ||
12718 | removeDevtool: function (devtool) { | ||
12719 | ReactDebugTool.removeDevtool(devtool); | ||
12720 | for (var i = 0; i < eventHandlers.length; i++) { | ||
12721 | if (eventHandlers[i] === devtool) { | ||
12722 | eventHandlers.splice(i, 1); | ||
12723 | i--; | ||
12724 | } | ||
12725 | } | ||
12726 | }, | ||
12727 | onCreateMarkupForProperty: function (name, value) { | ||
12728 | emitEvent('onCreateMarkupForProperty', name, value); | ||
12729 | }, | ||
12730 | onSetValueForProperty: function (node, name, value) { | ||
12731 | emitEvent('onSetValueForProperty', node, name, value); | ||
12732 | }, | ||
12733 | onDeleteValueForProperty: function (node, name) { | ||
12734 | emitEvent('onDeleteValueForProperty', node, name); | ||
12735 | }, | ||
12736 | onTestEvent: function () { | ||
12737 | emitEvent('onTestEvent'); | ||
12738 | } | ||
12739 | }; | ||
12740 | |||
12741 | ReactDOMDebugTool.addDevtool(ReactDOMUnknownPropertyDevtool); | ||
12742 | ReactDOMDebugTool.addDevtool(ReactDOMNullInputValuePropDevtool); | ||
12743 | |||
12744 | module.exports = ReactDOMDebugTool; | ||
12745 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
12746 | |||
12747 | /***/ }, | ||
12748 | /* 111 */ | ||
12749 | /***/ function(module, exports, __webpack_require__) { | ||
12750 | |||
12751 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
12752 | * Copyright 2013-present, Facebook, Inc. | ||
12753 | * All rights reserved. | ||
12754 | * | ||
12755 | * This source code is licensed under the BSD-style license found in the | ||
12756 | * LICENSE file in the root directory of this source tree. An additional grant | ||
12757 | * of patent rights can be found in the PATENTS file in the same directory. | ||
12758 | * | ||
12759 | * @providesModule ReactDOMNullInputValuePropDevtool | ||
12760 | */ | ||
12761 | |||
12762 | 'use strict'; | ||
12763 | |||
12764 | var ReactComponentTreeDevtool = __webpack_require__(31); | ||
12765 | |||
12766 | var warning = __webpack_require__(13); | ||
12767 | |||
12768 | var didWarnValueNull = false; | ||
12769 | |||
12770 | function handleElement(debugID, element) { | ||
12771 | if (element == null) { | ||
12772 | return; | ||
12773 | } | ||
12774 | if (element.type !== 'input' && element.type !== 'textarea' && element.type !== 'select') { | ||
12775 | return; | ||
12776 | } | ||
12777 | if (element.props != null && element.props.value === null && !didWarnValueNull) { | ||
12778 | 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, ReactComponentTreeDevtool.getStackAddendumByID(debugID)) : void 0; | ||
12779 | |||
12780 | didWarnValueNull = true; | ||
12781 | } | ||
12782 | } | ||
12783 | |||
12784 | var ReactDOMUnknownPropertyDevtool = { | ||
12785 | onBeforeMountComponent: function (debugID, element) { | ||
12786 | handleElement(debugID, element); | ||
12787 | }, | ||
12788 | onBeforeUpdateComponent: function (debugID, element) { | ||
12789 | handleElement(debugID, element); | ||
12790 | } | ||
12791 | }; | ||
12792 | |||
12793 | module.exports = ReactDOMUnknownPropertyDevtool; | ||
12794 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
12795 | |||
12796 | /***/ }, | ||
12797 | /* 112 */ | ||
12798 | /***/ function(module, exports, __webpack_require__) { | ||
12799 | |||
12800 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
12801 | * Copyright 2013-present, Facebook, Inc. | ||
12802 | * All rights reserved. | ||
12803 | * | ||
12804 | * This source code is licensed under the BSD-style license found in the | ||
12805 | * LICENSE file in the root directory of this source tree. An additional grant | ||
12806 | * of patent rights can be found in the PATENTS file in the same directory. | ||
12807 | * | ||
12808 | * @providesModule ReactDOMUnknownPropertyDevtool | ||
12809 | */ | ||
12810 | |||
12811 | 'use strict'; | ||
12812 | |||
12813 | var DOMProperty = __webpack_require__(40); | ||
12814 | var EventPluginRegistry = __webpack_require__(47); | ||
12815 | var ReactComponentTreeDevtool = __webpack_require__(31); | ||
12816 | |||
12817 | var warning = __webpack_require__(13); | ||
12818 | |||
12819 | if (process.env.NODE_ENV !== 'production') { | ||
12820 | var reactProps = { | ||
12821 | children: true, | ||
12822 | dangerouslySetInnerHTML: true, | ||
12823 | key: true, | ||
12824 | ref: true, | ||
12825 | |||
12826 | autoFocus: true, | ||
12827 | defaultValue: true, | ||
12828 | valueLink: true, | ||
12829 | defaultChecked: true, | ||
12830 | checkedLink: true, | ||
12831 | innerHTML: true, | ||
12832 | suppressContentEditableWarning: true, | ||
12833 | onFocusIn: true, | ||
12834 | onFocusOut: true | ||
12835 | }; | ||
12836 | var warnedProperties = {}; | ||
12837 | |||
12838 | var validateProperty = function (tagName, name, debugID) { | ||
12839 | if (DOMProperty.properties.hasOwnProperty(name) || DOMProperty.isCustomAttribute(name)) { | ||
12840 | return true; | ||
12841 | } | ||
12842 | if (reactProps.hasOwnProperty(name) && reactProps[name] || warnedProperties.hasOwnProperty(name) && warnedProperties[name]) { | ||
12843 | return true; | ||
12844 | } | ||
12845 | if (EventPluginRegistry.registrationNameModules.hasOwnProperty(name)) { | ||
12846 | return true; | ||
12847 | } | ||
12848 | warnedProperties[name] = true; | ||
12849 | var lowerCasedName = name.toLowerCase(); | ||
12850 | |||
12851 | // data-* attributes should be lowercase; suggest the lowercase version | ||
12852 | var standardName = DOMProperty.isCustomAttribute(lowerCasedName) ? lowerCasedName : DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ? DOMProperty.getPossibleStandardName[lowerCasedName] : null; | ||
12853 | |||
12854 | var registrationName = EventPluginRegistry.possibleRegistrationNames.hasOwnProperty(lowerCasedName) ? EventPluginRegistry.possibleRegistrationNames[lowerCasedName] : null; | ||
12855 | |||
12856 | if (standardName != null) { | ||
12857 | process.env.NODE_ENV !== 'production' ? warning(standardName == null, 'Unknown DOM property %s. Did you mean %s?%s', name, standardName, ReactComponentTreeDevtool.getStackAddendumByID(debugID)) : void 0; | ||
12858 | return true; | ||
12859 | } else if (registrationName != null) { | ||
12860 | process.env.NODE_ENV !== 'production' ? warning(registrationName == null, 'Unknown event handler property %s. Did you mean `%s`?%s', name, registrationName, ReactComponentTreeDevtool.getStackAddendumByID(debugID)) : void 0; | ||
12861 | return true; | ||
12862 | } else { | ||
12863 | // We were unable to guess which prop the user intended. | ||
12864 | // It is likely that the user was just blindly spreading/forwarding props | ||
12865 | // Components should be careful to only render valid props/attributes. | ||
12866 | // Warning will be invoked in warnUnknownProperties to allow grouping. | ||
12867 | return false; | ||
12868 | } | ||
12869 | }; | ||
12870 | } | ||
12871 | |||
12872 | var warnUnknownProperties = function (debugID, element) { | ||
12873 | var unknownProps = []; | ||
12874 | for (var key in element.props) { | ||
12875 | var isValid = validateProperty(element.type, key, debugID); | ||
12876 | if (!isValid) { | ||
12877 | unknownProps.push(key); | ||
12878 | } | ||
12879 | } | ||
12880 | |||
12881 | var unknownPropString = unknownProps.map(function (prop) { | ||
12882 | return '`' + prop + '`'; | ||
12883 | }).join(', '); | ||
12884 | |||
12885 | if (unknownProps.length === 1) { | ||
12886 | 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, ReactComponentTreeDevtool.getStackAddendumByID(debugID)) : void 0; | ||
12887 | } else if (unknownProps.length > 1) { | ||
12888 | 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, ReactComponentTreeDevtool.getStackAddendumByID(debugID)) : void 0; | ||
12889 | } | ||
12890 | }; | ||
12891 | |||
12892 | function handleElement(debugID, element) { | ||
12893 | if (element == null || typeof element.type !== 'string') { | ||
12894 | return; | ||
12895 | } | ||
12896 | if (element.type.indexOf('-') >= 0 || element.props.is) { | ||
12897 | return; | ||
12898 | } | ||
12899 | warnUnknownProperties(debugID, element); | ||
12900 | } | ||
12901 | |||
12902 | var ReactDOMUnknownPropertyDevtool = { | ||
12903 | onBeforeMountComponent: function (debugID, element) { | ||
12904 | handleElement(debugID, element); | ||
12905 | }, | ||
12906 | onBeforeUpdateComponent: function (debugID, element) { | ||
12907 | handleElement(debugID, element); | ||
12908 | } | ||
12909 | }; | ||
12910 | |||
12911 | module.exports = ReactDOMUnknownPropertyDevtool; | ||
12912 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
12913 | |||
12914 | /***/ }, | ||
12915 | /* 113 */ | ||
12916 | /***/ function(module, exports, __webpack_require__) { | ||
12917 | |||
12918 | /** | ||
12919 | * Copyright 2013-present, Facebook, Inc. | ||
12920 | * All rights reserved. | ||
12921 | * | ||
12922 | * This source code is licensed under the BSD-style license found in the | ||
12923 | * LICENSE file in the root directory of this source tree. An additional grant | ||
12924 | * of patent rights can be found in the PATENTS file in the same directory. | ||
12925 | * | ||
12926 | * @providesModule quoteAttributeValueForBrowser | ||
12927 | */ | ||
12928 | |||
12929 | 'use strict'; | ||
12930 | |||
12931 | var escapeTextContentForBrowser = __webpack_require__(90); | ||
12932 | |||
12933 | /** | ||
12934 | * Escapes attribute value to prevent scripting attacks. | ||
12935 | * | ||
12936 | * @param {*} value Value to escape. | ||
12937 | * @return {string} An escaped string. | ||
12938 | */ | ||
12939 | function quoteAttributeValueForBrowser(value) { | ||
12940 | return '"' + escapeTextContentForBrowser(value) + '"'; | ||
12941 | } | ||
12942 | |||
12943 | module.exports = quoteAttributeValueForBrowser; | ||
12944 | |||
12945 | /***/ }, | ||
12946 | /* 114 */ | ||
12947 | /***/ function(module, exports, __webpack_require__) { | ||
12948 | |||
12949 | /** | ||
12950 | * Copyright 2013-present, Facebook, Inc. | ||
12951 | * All rights reserved. | ||
12952 | * | ||
12953 | * This source code is licensed under the BSD-style license found in the | ||
12954 | * LICENSE file in the root directory of this source tree. An additional grant | ||
12955 | * of patent rights can be found in the PATENTS file in the same directory. | ||
12956 | * | ||
12957 | * @providesModule ReactBrowserEventEmitter | ||
12958 | */ | ||
12959 | |||
12960 | 'use strict'; | ||
12961 | |||
12962 | var _assign = __webpack_require__(6); | ||
12963 | |||
12964 | var EventConstants = __webpack_require__(44); | ||
12965 | var EventPluginRegistry = __webpack_require__(47); | ||
12966 | var ReactEventEmitterMixin = __webpack_require__(115); | ||
12967 | var ViewportMetrics = __webpack_require__(80); | ||
12968 | |||
12969 | var getVendorPrefixedEventName = __webpack_require__(116); | ||
12970 | var isEventSupported = __webpack_require__(74); | ||
12971 | |||
12972 | /** | ||
12973 | * Summary of `ReactBrowserEventEmitter` event handling: | ||
12974 | * | ||
12975 | * - Top-level delegation is used to trap most native browser events. This | ||
12976 | * may only occur in the main thread and is the responsibility of | ||
12977 | * ReactEventListener, which is injected and can therefore support pluggable | ||
12978 | * event sources. This is the only work that occurs in the main thread. | ||
12979 | * | ||
12980 | * - We normalize and de-duplicate events to account for browser quirks. This | ||
12981 | * may be done in the worker thread. | ||
12982 | * | ||
12983 | * - Forward these native events (with the associated top-level type used to | ||
12984 | * trap it) to `EventPluginHub`, which in turn will ask plugins if they want | ||
12985 | * to extract any synthetic events. | ||
12986 | * | ||
12987 | * - The `EventPluginHub` will then process each event by annotating them with | ||
12988 | * "dispatches", a sequence of listeners and IDs that care about that event. | ||
12989 | * | ||
12990 | * - The `EventPluginHub` then dispatches the events. | ||
12991 | * | ||
12992 | * Overview of React and the event system: | ||
12993 | * | ||
12994 | * +------------+ . | ||
12995 | * | DOM | . | ||
12996 | * +------------+ . | ||
12997 | * | . | ||
12998 | * v . | ||
12999 | * +------------+ . | ||
13000 | * | ReactEvent | . | ||
13001 | * | Listener | . | ||
13002 | * +------------+ . +-----------+ | ||
13003 | * | . +--------+|SimpleEvent| | ||
13004 | * | . | |Plugin | | ||
13005 | * +-----|------+ . v +-----------+ | ||
13006 | * | | | . +--------------+ +------------+ | ||
13007 | * | +-----------.--->|EventPluginHub| | Event | | ||
13008 | * | | . | | +-----------+ | Propagators| | ||
13009 | * | ReactEvent | . | | |TapEvent | |------------| | ||
13010 | * | Emitter | . | |<---+|Plugin | |other plugin| | ||
13011 | * | | . | | +-----------+ | utilities | | ||
13012 | * | +-----------.--->| | +------------+ | ||
13013 | * | | | . +--------------+ | ||
13014 | * +-----|------+ . ^ +-----------+ | ||
13015 | * | . | |Enter/Leave| | ||
13016 | * + . +-------+|Plugin | | ||
13017 | * +-------------+ . +-----------+ | ||
13018 | * | application | . | ||
13019 | * |-------------| . | ||
13020 | * | | . | ||
13021 | * | | . | ||
13022 | * +-------------+ . | ||
13023 | * . | ||
13024 | * React Core . General Purpose Event Plugin System | ||
13025 | */ | ||
13026 | |||
13027 | var hasEventPageXY; | ||
13028 | var alreadyListeningTo = {}; | ||
13029 | var isMonitoringScrollValue = false; | ||
13030 | var reactTopListenersCounter = 0; | ||
13031 | |||
13032 | // For events like 'submit' which don't consistently bubble (which we trap at a | ||
13033 | // lower node than `document`), binding at `document` would cause duplicate | ||
13034 | // events so we don't include them here | ||
13035 | var topEventMapping = { | ||
13036 | topAbort: 'abort', | ||
13037 | topAnimationEnd: getVendorPrefixedEventName('animationend') || 'animationend', | ||
13038 | topAnimationIteration: getVendorPrefixedEventName('animationiteration') || 'animationiteration', | ||
13039 | topAnimationStart: getVendorPrefixedEventName('animationstart') || 'animationstart', | ||
13040 | topBlur: 'blur', | ||
13041 | topCanPlay: 'canplay', | ||
13042 | topCanPlayThrough: 'canplaythrough', | ||
13043 | topChange: 'change', | ||
13044 | topClick: 'click', | ||
13045 | topCompositionEnd: 'compositionend', | ||
13046 | topCompositionStart: 'compositionstart', | ||
13047 | topCompositionUpdate: 'compositionupdate', | ||
13048 | topContextMenu: 'contextmenu', | ||
13049 | topCopy: 'copy', | ||
13050 | topCut: 'cut', | ||
13051 | topDoubleClick: 'dblclick', | ||
13052 | topDrag: 'drag', | ||
13053 | topDragEnd: 'dragend', | ||
13054 | topDragEnter: 'dragenter', | ||
13055 | topDragExit: 'dragexit', | ||
13056 | topDragLeave: 'dragleave', | ||
13057 | topDragOver: 'dragover', | ||
13058 | topDragStart: 'dragstart', | ||
13059 | topDrop: 'drop', | ||
13060 | topDurationChange: 'durationchange', | ||
13061 | topEmptied: 'emptied', | ||
13062 | topEncrypted: 'encrypted', | ||
13063 | topEnded: 'ended', | ||
13064 | topError: 'error', | ||
13065 | topFocus: 'focus', | ||
13066 | topInput: 'input', | ||
13067 | topKeyDown: 'keydown', | ||
13068 | topKeyPress: 'keypress', | ||
13069 | topKeyUp: 'keyup', | ||
13070 | topLoadedData: 'loadeddata', | ||
13071 | topLoadedMetadata: 'loadedmetadata', | ||
13072 | topLoadStart: 'loadstart', | ||
13073 | topMouseDown: 'mousedown', | ||
13074 | topMouseMove: 'mousemove', | ||
13075 | topMouseOut: 'mouseout', | ||
13076 | topMouseOver: 'mouseover', | ||
13077 | topMouseUp: 'mouseup', | ||
13078 | topPaste: 'paste', | ||
13079 | topPause: 'pause', | ||
13080 | topPlay: 'play', | ||
13081 | topPlaying: 'playing', | ||
13082 | topProgress: 'progress', | ||
13083 | topRateChange: 'ratechange', | ||
13084 | topScroll: 'scroll', | ||
13085 | topSeeked: 'seeked', | ||
13086 | topSeeking: 'seeking', | ||
13087 | topSelectionChange: 'selectionchange', | ||
13088 | topStalled: 'stalled', | ||
13089 | topSuspend: 'suspend', | ||
13090 | topTextInput: 'textInput', | ||
13091 | topTimeUpdate: 'timeupdate', | ||
13092 | topTouchCancel: 'touchcancel', | ||
13093 | topTouchEnd: 'touchend', | ||
13094 | topTouchMove: 'touchmove', | ||
13095 | topTouchStart: 'touchstart', | ||
13096 | topTransitionEnd: getVendorPrefixedEventName('transitionend') || 'transitionend', | ||
13097 | topVolumeChange: 'volumechange', | ||
13098 | topWaiting: 'waiting', | ||
13099 | topWheel: 'wheel' | ||
13100 | }; | ||
13101 | |||
13102 | /** | ||
13103 | * To ensure no conflicts with other potential React instances on the page | ||
13104 | */ | ||
13105 | var topListenersIDKey = '_reactListenersID' + String(Math.random()).slice(2); | ||
13106 | |||
13107 | function getListeningForDocument(mountAt) { | ||
13108 | // In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty` | ||
13109 | // directly. | ||
13110 | if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) { | ||
13111 | mountAt[topListenersIDKey] = reactTopListenersCounter++; | ||
13112 | alreadyListeningTo[mountAt[topListenersIDKey]] = {}; | ||
13113 | } | ||
13114 | return alreadyListeningTo[mountAt[topListenersIDKey]]; | ||
13115 | } | ||
13116 | |||
13117 | /** | ||
13118 | * `ReactBrowserEventEmitter` is used to attach top-level event listeners. For | ||
13119 | * example: | ||
13120 | * | ||
13121 | * EventPluginHub.putListener('myID', 'onClick', myFunction); | ||
13122 | * | ||
13123 | * This would allocate a "registration" of `('onClick', myFunction)` on 'myID'. | ||
13124 | * | ||
13125 | * @internal | ||
13126 | */ | ||
13127 | var ReactBrowserEventEmitter = _assign({}, ReactEventEmitterMixin, { | ||
13128 | |||
13129 | /** | ||
13130 | * Injectable event backend | ||
13131 | */ | ||
13132 | ReactEventListener: null, | ||
13133 | |||
13134 | injection: { | ||
13135 | /** | ||
13136 | * @param {object} ReactEventListener | ||
13137 | */ | ||
13138 | injectReactEventListener: function (ReactEventListener) { | ||
13139 | ReactEventListener.setHandleTopLevel(ReactBrowserEventEmitter.handleTopLevel); | ||
13140 | ReactBrowserEventEmitter.ReactEventListener = ReactEventListener; | ||
13141 | } | ||
13142 | }, | ||
13143 | |||
13144 | /** | ||
13145 | * Sets whether or not any created callbacks should be enabled. | ||
13146 | * | ||
13147 | * @param {boolean} enabled True if callbacks should be enabled. | ||
13148 | */ | ||
13149 | setEnabled: function (enabled) { | ||
13150 | if (ReactBrowserEventEmitter.ReactEventListener) { | ||
13151 | ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled); | ||
13152 | } | ||
13153 | }, | ||
13154 | |||
13155 | /** | ||
13156 | * @return {boolean} True if callbacks are enabled. | ||
13157 | */ | ||
13158 | isEnabled: function () { | ||
13159 | return !!(ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled()); | ||
13160 | }, | ||
13161 | |||
13162 | /** | ||
13163 | * We listen for bubbled touch events on the document object. | ||
13164 | * | ||
13165 | * Firefox v8.01 (and possibly others) exhibited strange behavior when | ||
13166 | * mounting `onmousemove` events at some node that was not the document | ||
13167 | * element. The symptoms were that if your mouse is not moving over something | ||
13168 | * contained within that mount point (for example on the background) the | ||
13169 | * top-level listeners for `onmousemove` won't be called. However, if you | ||
13170 | * register the `mousemove` on the document object, then it will of course | ||
13171 | * catch all `mousemove`s. This along with iOS quirks, justifies restricting | ||
13172 | * top-level listeners to the document object only, at least for these | ||
13173 | * movement types of events and possibly all events. | ||
13174 | * | ||
13175 | * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html | ||
13176 | * | ||
13177 | * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but | ||
13178 | * they bubble to document. | ||
13179 | * | ||
13180 | * @param {string} registrationName Name of listener (e.g. `onClick`). | ||
13181 | * @param {object} contentDocumentHandle Document which owns the container | ||
13182 | */ | ||
13183 | listenTo: function (registrationName, contentDocumentHandle) { | ||
13184 | var mountAt = contentDocumentHandle; | ||
13185 | var isListening = getListeningForDocument(mountAt); | ||
13186 | var dependencies = EventPluginRegistry.registrationNameDependencies[registrationName]; | ||
13187 | |||
13188 | var topLevelTypes = EventConstants.topLevelTypes; | ||
13189 | for (var i = 0; i < dependencies.length; i++) { | ||
13190 | var dependency = dependencies[i]; | ||
13191 | if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) { | ||
13192 | if (dependency === topLevelTypes.topWheel) { | ||
13193 | if (isEventSupported('wheel')) { | ||
13194 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'wheel', mountAt); | ||
13195 | } else if (isEventSupported('mousewheel')) { | ||
13196 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'mousewheel', mountAt); | ||
13197 | } else { | ||
13198 | // Firefox needs to capture a different mouse scroll event. | ||
13199 | // @see http://www.quirksmode.org/dom/events/tests/scroll.html | ||
13200 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'DOMMouseScroll', mountAt); | ||
13201 | } | ||
13202 | } else if (dependency === topLevelTypes.topScroll) { | ||
13203 | |||
13204 | if (isEventSupported('scroll', true)) { | ||
13205 | ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topScroll, 'scroll', mountAt); | ||
13206 | } else { | ||
13207 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topScroll, 'scroll', ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE); | ||
13208 | } | ||
13209 | } else if (dependency === topLevelTypes.topFocus || dependency === topLevelTypes.topBlur) { | ||
13210 | |||
13211 | if (isEventSupported('focus', true)) { | ||
13212 | ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topFocus, 'focus', mountAt); | ||
13213 | ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topBlur, 'blur', mountAt); | ||
13214 | } else if (isEventSupported('focusin')) { | ||
13215 | // IE has `focusin` and `focusout` events which bubble. | ||
13216 | // @see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html | ||
13217 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topFocus, 'focusin', mountAt); | ||
13218 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topBlur, 'focusout', mountAt); | ||
13219 | } | ||
13220 | |||
13221 | // to make sure blur and focus event listeners are only attached once | ||
13222 | isListening[topLevelTypes.topBlur] = true; | ||
13223 | isListening[topLevelTypes.topFocus] = true; | ||
13224 | } else if (topEventMapping.hasOwnProperty(dependency)) { | ||
13225 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(dependency, topEventMapping[dependency], mountAt); | ||
13226 | } | ||
13227 | |||
13228 | isListening[dependency] = true; | ||
13229 | } | ||
13230 | } | ||
13231 | }, | ||
13232 | |||
13233 | trapBubbledEvent: function (topLevelType, handlerBaseName, handle) { | ||
13234 | return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelType, handlerBaseName, handle); | ||
13235 | }, | ||
13236 | |||
13237 | trapCapturedEvent: function (topLevelType, handlerBaseName, handle) { | ||
13238 | return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelType, handlerBaseName, handle); | ||
13239 | }, | ||
13240 | |||
13241 | /** | ||
13242 | * Listens to window scroll and resize events. We cache scroll values so that | ||
13243 | * application code can access them without triggering reflows. | ||
13244 | * | ||
13245 | * ViewportMetrics is only used by SyntheticMouse/TouchEvent and only when | ||
13246 | * pageX/pageY isn't supported (legacy browsers). | ||
13247 | * | ||
13248 | * NOTE: Scroll events do not bubble. | ||
13249 | * | ||
13250 | * @see http://www.quirksmode.org/dom/events/scroll.html | ||
13251 | */ | ||
13252 | ensureScrollValueMonitoring: function () { | ||
13253 | if (hasEventPageXY === undefined) { | ||
13254 | hasEventPageXY = document.createEvent && 'pageX' in document.createEvent('MouseEvent'); | ||
13255 | } | ||
13256 | if (!hasEventPageXY && !isMonitoringScrollValue) { | ||
13257 | var refresh = ViewportMetrics.refreshScrollValues; | ||
13258 | ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh); | ||
13259 | isMonitoringScrollValue = true; | ||
13260 | } | ||
13261 | } | ||
13262 | |||
13263 | }); | ||
13264 | |||
13265 | module.exports = ReactBrowserEventEmitter; | ||
13266 | |||
13267 | /***/ }, | ||
13268 | /* 115 */ | ||
13269 | /***/ function(module, exports, __webpack_require__) { | ||
13270 | |||
13271 | /** | ||
13272 | * Copyright 2013-present, Facebook, Inc. | ||
13273 | * All rights reserved. | ||
13274 | * | ||
13275 | * This source code is licensed under the BSD-style license found in the | ||
13276 | * LICENSE file in the root directory of this source tree. An additional grant | ||
13277 | * of patent rights can be found in the PATENTS file in the same directory. | ||
13278 | * | ||
13279 | * @providesModule ReactEventEmitterMixin | ||
13280 | */ | ||
13281 | |||
13282 | 'use strict'; | ||
13283 | |||
13284 | var EventPluginHub = __webpack_require__(46); | ||
13285 | |||
13286 | function runEventQueueInBatch(events) { | ||
13287 | EventPluginHub.enqueueEvents(events); | ||
13288 | EventPluginHub.processEventQueue(false); | ||
13289 | } | ||
13290 | |||
13291 | var ReactEventEmitterMixin = { | ||
13292 | |||
13293 | /** | ||
13294 | * Streams a fired top-level event to `EventPluginHub` where plugins have the | ||
13295 | * opportunity to create `ReactEvent`s to be dispatched. | ||
13296 | */ | ||
13297 | handleTopLevel: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { | ||
13298 | var events = EventPluginHub.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget); | ||
13299 | runEventQueueInBatch(events); | ||
13300 | } | ||
13301 | }; | ||
13302 | |||
13303 | module.exports = ReactEventEmitterMixin; | ||
13304 | |||
13305 | /***/ }, | ||
13306 | /* 116 */ | ||
13307 | /***/ function(module, exports, __webpack_require__) { | ||
13308 | |||
13309 | /** | ||
13310 | * Copyright 2013-present, Facebook, Inc. | ||
13311 | * All rights reserved. | ||
13312 | * | ||
13313 | * This source code is licensed under the BSD-style license found in the | ||
13314 | * LICENSE file in the root directory of this source tree. An additional grant | ||
13315 | * of patent rights can be found in the PATENTS file in the same directory. | ||
13316 | * | ||
13317 | * @providesModule getVendorPrefixedEventName | ||
13318 | */ | ||
13319 | |||
13320 | 'use strict'; | ||
13321 | |||
13322 | var ExecutionEnvironment = __webpack_require__(52); | ||
13323 | |||
13324 | /** | ||
13325 | * Generate a mapping of standard vendor prefixes using the defined style property and event name. | ||
13326 | * | ||
13327 | * @param {string} styleProp | ||
13328 | * @param {string} eventName | ||
13329 | * @returns {object} | ||
13330 | */ | ||
13331 | function makePrefixMap(styleProp, eventName) { | ||
13332 | var prefixes = {}; | ||
13333 | |||
13334 | prefixes[styleProp.toLowerCase()] = eventName.toLowerCase(); | ||
13335 | prefixes['Webkit' + styleProp] = 'webkit' + eventName; | ||
13336 | prefixes['Moz' + styleProp] = 'moz' + eventName; | ||
13337 | prefixes['ms' + styleProp] = 'MS' + eventName; | ||
13338 | prefixes['O' + styleProp] = 'o' + eventName.toLowerCase(); | ||
13339 | |||
13340 | return prefixes; | ||
13341 | } | ||
13342 | |||
13343 | /** | ||
13344 | * A list of event names to a configurable list of vendor prefixes. | ||
13345 | */ | ||
13346 | var vendorPrefixes = { | ||
13347 | animationend: makePrefixMap('Animation', 'AnimationEnd'), | ||
13348 | animationiteration: makePrefixMap('Animation', 'AnimationIteration'), | ||
13349 | animationstart: makePrefixMap('Animation', 'AnimationStart'), | ||
13350 | transitionend: makePrefixMap('Transition', 'TransitionEnd') | ||
13351 | }; | ||
13352 | |||
13353 | /** | ||
13354 | * Event names that have already been detected and prefixed (if applicable). | ||
13355 | */ | ||
13356 | var prefixedEventNames = {}; | ||
13357 | |||
13358 | /** | ||
13359 | * Element to check for prefixes on. | ||
13360 | */ | ||
13361 | var style = {}; | ||
13362 | |||
13363 | /** | ||
13364 | * Bootstrap if a DOM exists. | ||
13365 | */ | ||
13366 | if (ExecutionEnvironment.canUseDOM) { | ||
13367 | style = document.createElement('div').style; | ||
13368 | |||
13369 | // On some platforms, in particular some releases of Android 4.x, | ||
13370 | // the un-prefixed "animation" and "transition" properties are defined on the | ||
13371 | // style object but the events that fire will still be prefixed, so we need | ||
13372 | // to check if the un-prefixed events are usable, and if not remove them from the map. | ||
13373 | if (!('AnimationEvent' in window)) { | ||
13374 | delete vendorPrefixes.animationend.animation; | ||
13375 | delete vendorPrefixes.animationiteration.animation; | ||
13376 | delete vendorPrefixes.animationstart.animation; | ||
13377 | } | ||
13378 | |||
13379 | // Same as above | ||
13380 | if (!('TransitionEvent' in window)) { | ||
13381 | delete vendorPrefixes.transitionend.transition; | ||
13382 | } | ||
13383 | } | ||
13384 | |||
13385 | /** | ||
13386 | * Attempts to determine the correct vendor prefixed event name. | ||
13387 | * | ||
13388 | * @param {string} eventName | ||
13389 | * @returns {string} | ||
13390 | */ | ||
13391 | function getVendorPrefixedEventName(eventName) { | ||
13392 | if (prefixedEventNames[eventName]) { | ||
13393 | return prefixedEventNames[eventName]; | ||
13394 | } else if (!vendorPrefixes[eventName]) { | ||
13395 | return eventName; | ||
13396 | } | ||
13397 | |||
13398 | var prefixMap = vendorPrefixes[eventName]; | ||
13399 | |||
13400 | for (var styleProp in prefixMap) { | ||
13401 | if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) { | ||
13402 | return prefixedEventNames[eventName] = prefixMap[styleProp]; | ||
13403 | } | ||
13404 | } | ||
13405 | |||
13406 | return ''; | ||
13407 | } | ||
13408 | |||
13409 | module.exports = getVendorPrefixedEventName; | ||
13410 | |||
13411 | /***/ }, | ||
13412 | /* 117 */ | ||
13413 | /***/ function(module, exports, __webpack_require__) { | ||
13414 | |||
13415 | /** | ||
13416 | * Copyright 2013-present, Facebook, Inc. | ||
12417 | * All rights reserved. | 13417 | * All rights reserved. |
12418 | * | 13418 | * |
12419 | * This source code is licensed under the BSD-style license found in the | 13419 | * This source code is licensed under the BSD-style license found in the |
@@ -12425,7 +13425,36 @@ | |||
12425 | 13425 | ||
12426 | 'use strict'; | 13426 | 'use strict'; |
12427 | 13427 | ||
12428 | var mouseListenerNames = { | 13428 | var DisabledInputUtils = __webpack_require__(118); |
13429 | |||
13430 | /** | ||
13431 | * Implements a <button> host component that does not receive mouse events | ||
13432 | * when `disabled` is set. | ||
13433 | */ | ||
13434 | var ReactDOMButton = { | ||
13435 | getHostProps: DisabledInputUtils.getHostProps | ||
13436 | }; | ||
13437 | |||
13438 | module.exports = ReactDOMButton; | ||
13439 | |||
13440 | /***/ }, | ||
13441 | /* 118 */ | ||
13442 | /***/ function(module, exports) { | ||
13443 | |||
13444 | /** | ||
13445 | * Copyright 2013-present, Facebook, Inc. | ||
13446 | * All rights reserved. | ||
13447 | * | ||
13448 | * This source code is licensed under the BSD-style license found in the | ||
13449 | * LICENSE file in the root directory of this source tree. An additional grant | ||
13450 | * of patent rights can be found in the PATENTS file in the same directory. | ||
13451 | * | ||
13452 | * @providesModule DisabledInputUtils | ||
13453 | */ | ||
13454 | |||
13455 | 'use strict'; | ||
13456 | |||
13457 | var disableableMouseListenerNames = { | ||
12429 | onClick: true, | 13458 | onClick: true, |
12430 | onDoubleClick: true, | 13459 | onDoubleClick: true, |
12431 | onMouseDown: true, | 13460 | onMouseDown: true, |
@@ -12440,35 +13469,35 @@ | |||
12440 | }; | 13469 | }; |
12441 | 13470 | ||
12442 | /** | 13471 | /** |
12443 | * Implements a <button> native component that does not receive mouse events | 13472 | * Implements a host component that does not receive mouse events |
12444 | * when `disabled` is set. | 13473 | * when `disabled` is set. |
12445 | */ | 13474 | */ |
12446 | var ReactDOMButton = { | 13475 | var DisabledInputUtils = { |
12447 | getNativeProps: function (inst, props, context) { | 13476 | getHostProps: function (inst, props) { |
12448 | if (!props.disabled) { | 13477 | if (!props.disabled) { |
12449 | return props; | 13478 | return props; |
12450 | } | 13479 | } |
12451 | 13480 | ||
12452 | // Copy the props, except the mouse listeners | 13481 | // Copy the props, except the mouse listeners |
12453 | var nativeProps = {}; | 13482 | var hostProps = {}; |
12454 | for (var key in props) { | 13483 | for (var key in props) { |
12455 | if (props.hasOwnProperty(key) && !mouseListenerNames[key]) { | 13484 | if (!disableableMouseListenerNames[key] && props.hasOwnProperty(key)) { |
12456 | nativeProps[key] = props[key]; | 13485 | hostProps[key] = props[key]; |
12457 | } | 13486 | } |
12458 | } | 13487 | } |
12459 | 13488 | ||
12460 | return nativeProps; | 13489 | return hostProps; |
12461 | } | 13490 | } |
12462 | }; | 13491 | }; |
12463 | 13492 | ||
12464 | module.exports = ReactDOMButton; | 13493 | module.exports = DisabledInputUtils; |
12465 | 13494 | ||
12466 | /***/ }, | 13495 | /***/ }, |
12467 | /* 107 */ | 13496 | /* 119 */ |
12468 | /***/ function(module, exports, __webpack_require__) { | 13497 | /***/ function(module, exports, __webpack_require__) { |
12469 | 13498 | ||
12470 | /* WEBPACK VAR INJECTION */(function(process) {/** | 13499 | /* WEBPACK VAR INJECTION */(function(process) {/** |
12471 | * Copyright 2013-2015, Facebook, Inc. | 13500 | * Copyright 2013-present, Facebook, Inc. |
12472 | * All rights reserved. | 13501 | * All rights reserved. |
12473 | * | 13502 | * |
12474 | * This source code is licensed under the BSD-style license found in the | 13503 | * This source code is licensed under the BSD-style license found in the |
@@ -12480,15 +13509,24 @@ | |||
12480 | 13509 | ||
12481 | 'use strict'; | 13510 | 'use strict'; |
12482 | 13511 | ||
12483 | var ReactDOMIDOperations = __webpack_require__(29); | 13512 | var _prodInvariant = __webpack_require__(9), |
12484 | var LinkedValueUtils = __webpack_require__(108); | 13513 | _assign = __webpack_require__(6); |
12485 | var ReactMount = __webpack_require__(30); | 13514 | |
12486 | var ReactUpdates = __webpack_require__(56); | 13515 | var DisabledInputUtils = __webpack_require__(118); |
13516 | var DOMPropertyOperations = __webpack_require__(108); | ||
13517 | var LinkedValueUtils = __webpack_require__(120); | ||
13518 | var ReactDOMComponentTree = __webpack_require__(39); | ||
13519 | var ReactUpdates = __webpack_require__(59); | ||
12487 | 13520 | ||
12488 | var assign = __webpack_require__(41); | 13521 | var invariant = __webpack_require__(10); |
12489 | var invariant = __webpack_require__(15); | 13522 | var warning = __webpack_require__(13); |
12490 | 13523 | ||
12491 | var instancesByReactID = {}; | 13524 | var didWarnValueLink = false; |
13525 | var didWarnCheckedLink = false; | ||
13526 | var didWarnValueDefaultValue = false; | ||
13527 | var didWarnCheckedDefaultChecked = false; | ||
13528 | var didWarnControlledToUncontrolled = false; | ||
13529 | var didWarnUncontrolledToControlled = false; | ||
12492 | 13530 | ||
12493 | function forceUpdateIfMounted() { | 13531 | function forceUpdateIfMounted() { |
12494 | if (this._rootNodeID) { | 13532 | if (this._rootNodeID) { |
@@ -12497,8 +13535,13 @@ | |||
12497 | } | 13535 | } |
12498 | } | 13536 | } |
12499 | 13537 | ||
13538 | function isControlled(props) { | ||
13539 | var usesChecked = props.type === 'checkbox' || props.type === 'radio'; | ||
13540 | return usesChecked ? props.checked !== undefined : props.value !== undefined; | ||
13541 | } | ||
13542 | |||
12500 | /** | 13543 | /** |
12501 | * Implements an <input> native component that allows setting these optional | 13544 | * Implements an <input> host component that allows setting these optional |
12502 | * props: `checked`, `value`, `defaultChecked`, and `defaultValue`. | 13545 | * props: `checked`, `value`, `defaultChecked`, and `defaultValue`. |
12503 | * | 13546 | * |
12504 | * If `checked` or `value` are not supplied (or null/undefined), user actions | 13547 | * If `checked` or `value` are not supplied (or null/undefined), user actions |
@@ -12514,11 +13557,18 @@ | |||
12514 | * @see http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html | 13557 | * @see http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html |
12515 | */ | 13558 | */ |
12516 | var ReactDOMInput = { | 13559 | var ReactDOMInput = { |
12517 | getNativeProps: function (inst, props, context) { | 13560 | getHostProps: function (inst, props) { |
12518 | var value = LinkedValueUtils.getValue(props); | 13561 | var value = LinkedValueUtils.getValue(props); |
12519 | var checked = LinkedValueUtils.getChecked(props); | 13562 | var checked = LinkedValueUtils.getChecked(props); |
12520 | 13563 | ||
12521 | var nativeProps = assign({}, props, { | 13564 | var hostProps = _assign({ |
13565 | // Make sure we set .type before any other properties (setting .value | ||
13566 | // before .type means .value is lost in IE11 and below) | ||
13567 | type: undefined, | ||
13568 | // Make sure we set .step before .value (setting .value before .step | ||
13569 | // means .value is rounded on mount, based upon step precision) | ||
13570 | step: undefined | ||
13571 | }, DisabledInputUtils.getHostProps(inst, props), { | ||
12522 | defaultChecked: undefined, | 13572 | defaultChecked: undefined, |
12523 | defaultValue: undefined, | 13573 | defaultValue: undefined, |
12524 | value: value != null ? value : inst._wrapperState.initialValue, | 13574 | value: value != null ? value : inst._wrapperState.initialValue, |
@@ -12526,45 +13576,120 @@ | |||
12526 | onChange: inst._wrapperState.onChange | 13576 | onChange: inst._wrapperState.onChange |
12527 | }); | 13577 | }); |
12528 | 13578 | ||
12529 | return nativeProps; | 13579 | return hostProps; |
12530 | }, | 13580 | }, |
12531 | 13581 | ||
12532 | mountWrapper: function (inst, props) { | 13582 | mountWrapper: function (inst, props) { |
12533 | if (process.env.NODE_ENV !== 'production') { | 13583 | if (process.env.NODE_ENV !== 'production') { |
12534 | LinkedValueUtils.checkPropTypes('input', props, inst._currentElement._owner); | 13584 | LinkedValueUtils.checkPropTypes('input', props, inst._currentElement._owner); |
13585 | |||
13586 | var owner = inst._currentElement._owner; | ||
13587 | |||
13588 | if (props.valueLink !== undefined && !didWarnValueLink) { | ||
13589 | process.env.NODE_ENV !== 'production' ? warning(false, '`valueLink` prop on `input` is deprecated; set `value` and `onChange` instead.') : void 0; | ||
13590 | didWarnValueLink = true; | ||
13591 | } | ||
13592 | if (props.checkedLink !== undefined && !didWarnCheckedLink) { | ||
13593 | process.env.NODE_ENV !== 'production' ? warning(false, '`checkedLink` prop on `input` is deprecated; set `value` and `onChange` instead.') : void 0; | ||
13594 | didWarnCheckedLink = true; | ||
13595 | } | ||
13596 | if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnCheckedDefaultChecked) { | ||
13597 | 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; | ||
13598 | didWarnCheckedDefaultChecked = true; | ||
13599 | } | ||
13600 | if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) { | ||
13601 | 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; | ||
13602 | didWarnValueDefaultValue = true; | ||
13603 | } | ||
12535 | } | 13604 | } |
12536 | 13605 | ||
12537 | var defaultValue = props.defaultValue; | 13606 | var defaultValue = props.defaultValue; |
12538 | inst._wrapperState = { | 13607 | inst._wrapperState = { |
12539 | initialChecked: props.defaultChecked || false, | 13608 | initialChecked: props.checked != null ? props.checked : props.defaultChecked, |
12540 | initialValue: defaultValue != null ? defaultValue : null, | 13609 | initialValue: props.value != null ? props.value : defaultValue, |
13610 | listeners: null, | ||
12541 | onChange: _handleChange.bind(inst) | 13611 | onChange: _handleChange.bind(inst) |
12542 | }; | 13612 | }; |
12543 | }, | ||
12544 | 13613 | ||
12545 | mountReadyWrapper: function (inst) { | 13614 | if (process.env.NODE_ENV !== 'production') { |
12546 | // Can't be in mountWrapper or else server rendering leaks. | 13615 | inst._wrapperState.controlled = isControlled(props); |
12547 | instancesByReactID[inst._rootNodeID] = inst; | 13616 | } |
12548 | }, | ||
12549 | |||
12550 | unmountWrapper: function (inst) { | ||
12551 | delete instancesByReactID[inst._rootNodeID]; | ||
12552 | }, | 13617 | }, |
12553 | 13618 | ||
12554 | updateWrapper: function (inst) { | 13619 | updateWrapper: function (inst) { |
12555 | var props = inst._currentElement.props; | 13620 | var props = inst._currentElement.props; |
12556 | 13621 | ||
13622 | if (process.env.NODE_ENV !== 'production') { | ||
13623 | var controlled = isControlled(props); | ||
13624 | var owner = inst._currentElement._owner; | ||
13625 | |||
13626 | if (!inst._wrapperState.controlled && controlled && !didWarnUncontrolledToControlled) { | ||
13627 | 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; | ||
13628 | didWarnUncontrolledToControlled = true; | ||
13629 | } | ||
13630 | if (inst._wrapperState.controlled && !controlled && !didWarnControlledToUncontrolled) { | ||
13631 | 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; | ||
13632 | didWarnControlledToUncontrolled = true; | ||
13633 | } | ||
13634 | } | ||
13635 | |||
12557 | // TODO: Shouldn't this be getChecked(props)? | 13636 | // TODO: Shouldn't this be getChecked(props)? |
12558 | var checked = props.checked; | 13637 | var checked = props.checked; |
12559 | if (checked != null) { | 13638 | if (checked != null) { |
12560 | ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'checked', checked || false); | 13639 | DOMPropertyOperations.setValueForProperty(ReactDOMComponentTree.getNodeFromInstance(inst), 'checked', checked || false); |
12561 | } | 13640 | } |
12562 | 13641 | ||
13642 | var node = ReactDOMComponentTree.getNodeFromInstance(inst); | ||
12563 | var value = LinkedValueUtils.getValue(props); | 13643 | var value = LinkedValueUtils.getValue(props); |
12564 | if (value != null) { | 13644 | if (value != null) { |
13645 | |||
12565 | // Cast `value` to a string to ensure the value is set correctly. While | 13646 | // Cast `value` to a string to ensure the value is set correctly. While |
12566 | // browsers typically do this as necessary, jsdom doesn't. | 13647 | // browsers typically do this as necessary, jsdom doesn't. |
12567 | ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'value', '' + value); | 13648 | var newValue = '' + value; |
13649 | |||
13650 | // To avoid side effects (such as losing text selection), only set value if changed | ||
13651 | if (newValue !== node.value) { | ||
13652 | node.value = newValue; | ||
13653 | } | ||
13654 | } else { | ||
13655 | if (props.value == null && props.defaultValue != null) { | ||
13656 | node.defaultValue = '' + props.defaultValue; | ||
13657 | } | ||
13658 | if (props.checked == null && props.defaultChecked != null) { | ||
13659 | node.defaultChecked = !!props.defaultChecked; | ||
13660 | } | ||
13661 | } | ||
13662 | }, | ||
13663 | |||
13664 | postMountWrapper: function (inst) { | ||
13665 | var props = inst._currentElement.props; | ||
13666 | |||
13667 | // This is in postMount because we need access to the DOM node, which is not | ||
13668 | // available until after the component has mounted. | ||
13669 | var node = ReactDOMComponentTree.getNodeFromInstance(inst); | ||
13670 | |||
13671 | // Detach value from defaultValue. We won't do anything if we're working on | ||
13672 | // submit or reset inputs as those values & defaultValues are linked. They | ||
13673 | // are not resetable nodes so this operation doesn't matter and actually | ||
13674 | // removes browser-default values (eg "Submit Query") when no value is | ||
13675 | // provided. | ||
13676 | if (props.type !== 'submit' && props.type !== 'reset') { | ||
13677 | node.value = node.value; | ||
13678 | } | ||
13679 | |||
13680 | // Normally, we'd just do `node.checked = node.checked` upon initial mount, less this bug | ||
13681 | // this is needed to work around a chrome bug where setting defaultChecked | ||
13682 | // will sometimes influence the value of checked (even after detachment). | ||
13683 | // Reference: https://bugs.chromium.org/p/chromium/issues/detail?id=608416 | ||
13684 | // We need to temporarily unset name to avoid disrupting radio button groups. | ||
13685 | var name = node.name; | ||
13686 | if (name !== '') { | ||
13687 | node.name = ''; | ||
13688 | } | ||
13689 | node.defaultChecked = !node.defaultChecked; | ||
13690 | node.defaultChecked = !node.defaultChecked; | ||
13691 | if (name !== '') { | ||
13692 | node.name = name; | ||
12568 | } | 13693 | } |
12569 | } | 13694 | } |
12570 | }; | 13695 | }; |
@@ -12581,7 +13706,7 @@ | |||
12581 | 13706 | ||
12582 | var name = props.name; | 13707 | var name = props.name; |
12583 | if (props.type === 'radio' && name != null) { | 13708 | if (props.type === 'radio' && name != null) { |
12584 | var rootNode = ReactMount.getNode(this._rootNodeID); | 13709 | var rootNode = ReactDOMComponentTree.getNodeFromInstance(this); |
12585 | var queryRoot = rootNode; | 13710 | var queryRoot = rootNode; |
12586 | 13711 | ||
12587 | while (queryRoot.parentNode) { | 13712 | while (queryRoot.parentNode) { |
@@ -12604,11 +13729,9 @@ | |||
12604 | // This will throw if radio buttons rendered by different copies of React | 13729 | // This will throw if radio buttons rendered by different copies of React |
12605 | // and the same name are rendered into the same form (same as #1939). | 13730 | // and the same name are rendered into the same form (same as #1939). |
12606 | // That's probably okay; we don't support it just as we don't support | 13731 | // That's probably okay; we don't support it just as we don't support |
12607 | // mixing React with non-React. | 13732 | // mixing React radio buttons with non-React ones. |
12608 | var otherID = ReactMount.getID(otherNode); | 13733 | var otherInstance = ReactDOMComponentTree.getInstanceFromNode(otherNode); |
12609 | !otherID ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOMInput: Mixing React and non-React radio inputs with the ' + 'same `name` is not supported.') : invariant(false) : undefined; | 13734 | !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; |
12610 | var otherInstance = instancesByReactID[otherID]; | ||
12611 | !otherInstance ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOMInput: Unknown radio button ID %s.', otherID) : invariant(false) : undefined; | ||
12612 | // If this is a controlled radio button group, forcing the input that | 13735 | // If this is a controlled radio button group, forcing the input that |
12613 | // was previously checked to update will cause it to be come re-checked | 13736 | // was previously checked to update will cause it to be come re-checked |
12614 | // as appropriate. | 13737 | // as appropriate. |
@@ -12620,14 +13743,14 @@ | |||
12620 | } | 13743 | } |
12621 | 13744 | ||
12622 | module.exports = ReactDOMInput; | 13745 | module.exports = ReactDOMInput; |
12623 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | 13746 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) |
12624 | 13747 | ||
12625 | /***/ }, | 13748 | /***/ }, |
12626 | /* 108 */ | 13749 | /* 120 */ |
12627 | /***/ function(module, exports, __webpack_require__) { | 13750 | /***/ function(module, exports, __webpack_require__) { |
12628 | 13751 | ||
12629 | /* WEBPACK VAR INJECTION */(function(process) {/** | 13752 | /* WEBPACK VAR INJECTION */(function(process) {/** |
12630 | * Copyright 2013-2015, Facebook, Inc. | 13753 | * Copyright 2013-present, Facebook, Inc. |
12631 | * All rights reserved. | 13754 | * All rights reserved. |
12632 | * | 13755 | * |
12633 | * This source code is licensed under the BSD-style license found in the | 13756 | * This source code is licensed under the BSD-style license found in the |
@@ -12635,16 +13758,18 @@ | |||
12635 | * of patent rights can be found in the PATENTS file in the same directory. | 13758 | * of patent rights can be found in the PATENTS file in the same directory. |
12636 | * | 13759 | * |
12637 | * @providesModule LinkedValueUtils | 13760 | * @providesModule LinkedValueUtils |
12638 | * @typechecks static-only | ||
12639 | */ | 13761 | */ |
12640 | 13762 | ||
12641 | 'use strict'; | 13763 | 'use strict'; |
12642 | 13764 | ||
12643 | var ReactPropTypes = __webpack_require__(109); | 13765 | var _prodInvariant = __webpack_require__(9); |
12644 | var ReactPropTypeLocations = __webpack_require__(67); | ||
12645 | 13766 | ||
12646 | var invariant = __webpack_require__(15); | 13767 | var ReactPropTypes = __webpack_require__(34); |
12647 | var warning = __webpack_require__(27); | 13768 | var ReactPropTypeLocations = __webpack_require__(24); |
13769 | var ReactPropTypesSecret = __webpack_require__(33); | ||
13770 | |||
13771 | var invariant = __webpack_require__(10); | ||
13772 | var warning = __webpack_require__(13); | ||
12648 | 13773 | ||
12649 | var hasReadOnlyValue = { | 13774 | var hasReadOnlyValue = { |
12650 | 'button': true, | 13775 | 'button': true, |
@@ -12657,16 +13782,16 @@ | |||
12657 | }; | 13782 | }; |
12658 | 13783 | ||
12659 | function _assertSingleLink(inputProps) { | 13784 | function _assertSingleLink(inputProps) { |
12660 | !(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.') : invariant(false) : undefined; | 13785 | !(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; |
12661 | } | 13786 | } |
12662 | function _assertValueLink(inputProps) { | 13787 | function _assertValueLink(inputProps) { |
12663 | _assertSingleLink(inputProps); | 13788 | _assertSingleLink(inputProps); |
12664 | !(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.') : invariant(false) : undefined; | 13789 | !(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; |
12665 | } | 13790 | } |
12666 | 13791 | ||
12667 | function _assertCheckedLink(inputProps) { | 13792 | function _assertCheckedLink(inputProps) { |
12668 | _assertSingleLink(inputProps); | 13793 | _assertSingleLink(inputProps); |
12669 | !(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') : invariant(false) : undefined; | 13794 | !(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; |
12670 | } | 13795 | } |
12671 | 13796 | ||
12672 | var propTypes = { | 13797 | var propTypes = { |
@@ -12704,7 +13829,7 @@ | |||
12704 | checkPropTypes: function (tagName, props, owner) { | 13829 | checkPropTypes: function (tagName, props, owner) { |
12705 | for (var propName in propTypes) { | 13830 | for (var propName in propTypes) { |
12706 | if (propTypes.hasOwnProperty(propName)) { | 13831 | if (propTypes.hasOwnProperty(propName)) { |
12707 | var error = propTypes[propName](props, propName, tagName, ReactPropTypeLocations.prop); | 13832 | var error = propTypes[propName](props, propName, tagName, ReactPropTypeLocations.prop, null, ReactPropTypesSecret); |
12708 | } | 13833 | } |
12709 | if (error instanceof Error && !(error.message in loggedTypeFailures)) { | 13834 | if (error instanceof Error && !(error.message in loggedTypeFailures)) { |
12710 | // Only monitor this failure once because there tends to be a lot of the | 13835 | // Only monitor this failure once because there tends to be a lot of the |
@@ -12712,7 +13837,7 @@ | |||
12712 | loggedTypeFailures[error.message] = true; | 13837 | loggedTypeFailures[error.message] = true; |
12713 | 13838 | ||
12714 | var addendum = getDeclarationErrorAddendum(owner); | 13839 | var addendum = getDeclarationErrorAddendum(owner); |
12715 | process.env.NODE_ENV !== 'production' ? warning(false, 'Failed form propType: %s%s', error.message, addendum) : undefined; | 13840 | process.env.NODE_ENV !== 'production' ? warning(false, 'Failed form propType: %s%s', error.message, addendum) : void 0; |
12716 | } | 13841 | } |
12717 | } | 13842 | } |
12718 | }, | 13843 | }, |
@@ -12760,894 +13885,143 @@ | |||
12760 | }; | 13885 | }; |
12761 | 13886 | ||
12762 | module.exports = LinkedValueUtils; | 13887 | module.exports = LinkedValueUtils; |
12763 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | 13888 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) |
12764 | 13889 | ||
12765 | /***/ }, | 13890 | /***/ }, |
12766 | /* 109 */ | 13891 | /* 121 */ |
12767 | /***/ function(module, exports, __webpack_require__) { | 13892 | /***/ function(module, exports, __webpack_require__) { |
12768 | 13893 | ||
12769 | /** | 13894 | /* WEBPACK VAR INJECTION */(function(process) {/** |
12770 | * Copyright 2013-2015, Facebook, Inc. | 13895 | * Copyright 2013-present, Facebook, Inc. |
12771 | * All rights reserved. | 13896 | * All rights reserved. |
12772 | * | 13897 | * |
12773 | * This source code is licensed under the BSD-style license found in the | 13898 | * This source code is licensed under the BSD-style license found in the |
12774 | * LICENSE file in the root directory of this source tree. An additional grant | 13899 | * LICENSE file in the root directory of this source tree. An additional grant |
12775 | * of patent rights can be found in the PATENTS file in the same directory. | 13900 | * of patent rights can be found in the PATENTS file in the same directory. |
12776 | * | 13901 | * |
12777 | * @providesModule ReactPropTypes | 13902 | * @providesModule ReactDOMOption |
12778 | */ | 13903 | */ |
12779 | 13904 | ||
12780 | 'use strict'; | 13905 | 'use strict'; |
12781 | 13906 | ||
12782 | var ReactElement = __webpack_require__(44); | 13907 | var _assign = __webpack_require__(6); |
12783 | var ReactPropTypeLocationNames = __webpack_require__(68); | ||
12784 | |||
12785 | var emptyFunction = __webpack_require__(17); | ||
12786 | var getIteratorFn = __webpack_require__(110); | ||
12787 | |||
12788 | /** | ||
12789 | * Collection of methods that allow declaration and validation of props that are | ||
12790 | * supplied to React components. Example usage: | ||
12791 | * | ||
12792 | * var Props = require('ReactPropTypes'); | ||
12793 | * var MyArticle = React.createClass({ | ||
12794 | * propTypes: { | ||
12795 | * // An optional string prop named "description". | ||
12796 | * description: Props.string, | ||
12797 | * | ||
12798 | * // A required enum prop named "category". | ||
12799 | * category: Props.oneOf(['News','Photos']).isRequired, | ||
12800 | * | ||
12801 | * // A prop named "dialog" that requires an instance of Dialog. | ||
12802 | * dialog: Props.instanceOf(Dialog).isRequired | ||
12803 | * }, | ||
12804 | * render: function() { ... } | ||
12805 | * }); | ||
12806 | * | ||
12807 | * A more formal specification of how these methods are used: | ||
12808 | * | ||
12809 | * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...) | ||
12810 | * decl := ReactPropTypes.{type}(.isRequired)? | ||
12811 | * | ||
12812 | * Each and every declaration produces a function with the same signature. This | ||
12813 | * allows the creation of custom validation functions. For example: | ||
12814 | * | ||
12815 | * var MyLink = React.createClass({ | ||
12816 | * propTypes: { | ||
12817 | * // An optional string or URI prop named "href". | ||
12818 | * href: function(props, propName, componentName) { | ||
12819 | * var propValue = props[propName]; | ||
12820 | * if (propValue != null && typeof propValue !== 'string' && | ||
12821 | * !(propValue instanceof URI)) { | ||
12822 | * return new Error( | ||
12823 | * 'Expected a string or an URI for ' + propName + ' in ' + | ||
12824 | * componentName | ||
12825 | * ); | ||
12826 | * } | ||
12827 | * } | ||
12828 | * }, | ||
12829 | * render: function() {...} | ||
12830 | * }); | ||
12831 | * | ||
12832 | * @internal | ||
12833 | */ | ||
12834 | |||
12835 | var ANONYMOUS = '<<anonymous>>'; | ||
12836 | 13908 | ||
12837 | var ReactPropTypes = { | 13909 | var ReactChildren = __webpack_require__(7); |
12838 | array: createPrimitiveTypeChecker('array'), | 13910 | var ReactDOMComponentTree = __webpack_require__(39); |
12839 | bool: createPrimitiveTypeChecker('boolean'), | 13911 | var ReactDOMSelect = __webpack_require__(122); |
12840 | func: createPrimitiveTypeChecker('function'), | ||
12841 | number: createPrimitiveTypeChecker('number'), | ||
12842 | object: createPrimitiveTypeChecker('object'), | ||
12843 | string: createPrimitiveTypeChecker('string'), | ||
12844 | 13912 | ||
12845 | any: createAnyTypeChecker(), | 13913 | var warning = __webpack_require__(13); |
12846 | arrayOf: createArrayOfTypeChecker, | 13914 | var didWarnInvalidOptionChildren = false; |
12847 | element: createElementTypeChecker(), | ||
12848 | instanceOf: createInstanceTypeChecker, | ||
12849 | node: createNodeChecker(), | ||
12850 | objectOf: createObjectOfTypeChecker, | ||
12851 | oneOf: createEnumTypeChecker, | ||
12852 | oneOfType: createUnionTypeChecker, | ||
12853 | shape: createShapeTypeChecker | ||
12854 | }; | ||
12855 | |||
12856 | function createChainableTypeChecker(validate) { | ||
12857 | function checkType(isRequired, props, propName, componentName, location, propFullName) { | ||
12858 | componentName = componentName || ANONYMOUS; | ||
12859 | propFullName = propFullName || propName; | ||
12860 | if (props[propName] == null) { | ||
12861 | var locationName = ReactPropTypeLocationNames[location]; | ||
12862 | if (isRequired) { | ||
12863 | return new Error('Required ' + locationName + ' `' + propFullName + '` was not specified in ' + ('`' + componentName + '`.')); | ||
12864 | } | ||
12865 | return null; | ||
12866 | } else { | ||
12867 | return validate(props, propName, componentName, location, propFullName); | ||
12868 | } | ||
12869 | } | ||
12870 | 13915 | ||
12871 | var chainedCheckType = checkType.bind(null, false); | 13916 | function flattenChildren(children) { |
12872 | chainedCheckType.isRequired = checkType.bind(null, true); | 13917 | var content = ''; |
12873 | |||
12874 | return chainedCheckType; | ||
12875 | } | ||
12876 | |||
12877 | function createPrimitiveTypeChecker(expectedType) { | ||
12878 | function validate(props, propName, componentName, location, propFullName) { | ||
12879 | var propValue = props[propName]; | ||
12880 | var propType = getPropType(propValue); | ||
12881 | if (propType !== expectedType) { | ||
12882 | var locationName = ReactPropTypeLocationNames[location]; | ||
12883 | // `propValue` being instance of, say, date/regexp, pass the 'object' | ||
12884 | // check, but we can offer a more precise error message here rather than | ||
12885 | // 'of type `object`'. | ||
12886 | var preciseType = getPreciseType(propValue); | ||
12887 | |||
12888 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); | ||
12889 | } | ||
12890 | return null; | ||
12891 | } | ||
12892 | return createChainableTypeChecker(validate); | ||
12893 | } | ||
12894 | |||
12895 | function createAnyTypeChecker() { | ||
12896 | return createChainableTypeChecker(emptyFunction.thatReturns(null)); | ||
12897 | } | ||
12898 | |||
12899 | function createArrayOfTypeChecker(typeChecker) { | ||
12900 | function validate(props, propName, componentName, location, propFullName) { | ||
12901 | var propValue = props[propName]; | ||
12902 | if (!Array.isArray(propValue)) { | ||
12903 | var locationName = ReactPropTypeLocationNames[location]; | ||
12904 | var propType = getPropType(propValue); | ||
12905 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.')); | ||
12906 | } | ||
12907 | for (var i = 0; i < propValue.length; i++) { | ||
12908 | var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']'); | ||
12909 | if (error instanceof Error) { | ||
12910 | return error; | ||
12911 | } | ||
12912 | } | ||
12913 | return null; | ||
12914 | } | ||
12915 | return createChainableTypeChecker(validate); | ||
12916 | } | ||
12917 | |||
12918 | function createElementTypeChecker() { | ||
12919 | function validate(props, propName, componentName, location, propFullName) { | ||
12920 | if (!ReactElement.isValidElement(props[propName])) { | ||
12921 | var locationName = ReactPropTypeLocationNames[location]; | ||
12922 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a single ReactElement.')); | ||
12923 | } | ||
12924 | return null; | ||
12925 | } | ||
12926 | return createChainableTypeChecker(validate); | ||
12927 | } | ||
12928 | |||
12929 | function createInstanceTypeChecker(expectedClass) { | ||
12930 | function validate(props, propName, componentName, location, propFullName) { | ||
12931 | if (!(props[propName] instanceof expectedClass)) { | ||
12932 | var locationName = ReactPropTypeLocationNames[location]; | ||
12933 | var expectedClassName = expectedClass.name || ANONYMOUS; | ||
12934 | var actualClassName = getClassName(props[propName]); | ||
12935 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.')); | ||
12936 | } | ||
12937 | return null; | ||
12938 | } | ||
12939 | return createChainableTypeChecker(validate); | ||
12940 | } | ||
12941 | |||
12942 | function createEnumTypeChecker(expectedValues) { | ||
12943 | if (!Array.isArray(expectedValues)) { | ||
12944 | return createChainableTypeChecker(function () { | ||
12945 | return new Error('Invalid argument supplied to oneOf, expected an instance of array.'); | ||
12946 | }); | ||
12947 | } | ||
12948 | |||
12949 | function validate(props, propName, componentName, location, propFullName) { | ||
12950 | var propValue = props[propName]; | ||
12951 | for (var i = 0; i < expectedValues.length; i++) { | ||
12952 | if (propValue === expectedValues[i]) { | ||
12953 | return null; | ||
12954 | } | ||
12955 | } | ||
12956 | |||
12957 | var locationName = ReactPropTypeLocationNames[location]; | ||
12958 | var valuesString = JSON.stringify(expectedValues); | ||
12959 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.')); | ||
12960 | } | ||
12961 | return createChainableTypeChecker(validate); | ||
12962 | } | ||
12963 | |||
12964 | function createObjectOfTypeChecker(typeChecker) { | ||
12965 | function validate(props, propName, componentName, location, propFullName) { | ||
12966 | var propValue = props[propName]; | ||
12967 | var propType = getPropType(propValue); | ||
12968 | if (propType !== 'object') { | ||
12969 | var locationName = ReactPropTypeLocationNames[location]; | ||
12970 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.')); | ||
12971 | } | ||
12972 | for (var key in propValue) { | ||
12973 | if (propValue.hasOwnProperty(key)) { | ||
12974 | var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key); | ||
12975 | if (error instanceof Error) { | ||
12976 | return error; | ||
12977 | } | ||
12978 | } | ||
12979 | } | ||
12980 | return null; | ||
12981 | } | ||
12982 | return createChainableTypeChecker(validate); | ||
12983 | } | ||
12984 | |||
12985 | function createUnionTypeChecker(arrayOfTypeCheckers) { | ||
12986 | if (!Array.isArray(arrayOfTypeCheckers)) { | ||
12987 | return createChainableTypeChecker(function () { | ||
12988 | return new Error('Invalid argument supplied to oneOfType, expected an instance of array.'); | ||
12989 | }); | ||
12990 | } | ||
12991 | |||
12992 | function validate(props, propName, componentName, location, propFullName) { | ||
12993 | for (var i = 0; i < arrayOfTypeCheckers.length; i++) { | ||
12994 | var checker = arrayOfTypeCheckers[i]; | ||
12995 | if (checker(props, propName, componentName, location, propFullName) == null) { | ||
12996 | return null; | ||
12997 | } | ||
12998 | } | ||
12999 | |||
13000 | var locationName = ReactPropTypeLocationNames[location]; | ||
13001 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.')); | ||
13002 | } | ||
13003 | return createChainableTypeChecker(validate); | ||
13004 | } | ||
13005 | |||
13006 | function createNodeChecker() { | ||
13007 | function validate(props, propName, componentName, location, propFullName) { | ||
13008 | if (!isNode(props[propName])) { | ||
13009 | var locationName = ReactPropTypeLocationNames[location]; | ||
13010 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.')); | ||
13011 | } | ||
13012 | return null; | ||
13013 | } | ||
13014 | return createChainableTypeChecker(validate); | ||
13015 | } | ||
13016 | 13918 | ||
13017 | function createShapeTypeChecker(shapeTypes) { | 13919 | // Flatten children and warn if they aren't strings or numbers; |
13018 | function validate(props, propName, componentName, location, propFullName) { | 13920 | // invalid types are ignored. |
13019 | var propValue = props[propName]; | 13921 | ReactChildren.forEach(children, function (child) { |
13020 | var propType = getPropType(propValue); | 13922 | if (child == null) { |
13021 | if (propType !== 'object') { | 13923 | return; |
13022 | var locationName = ReactPropTypeLocationNames[location]; | ||
13023 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); | ||
13024 | } | 13924 | } |
13025 | for (var key in shapeTypes) { | 13925 | if (typeof child === 'string' || typeof child === 'number') { |
13026 | var checker = shapeTypes[key]; | 13926 | content += child; |
13027 | if (!checker) { | 13927 | } else if (!didWarnInvalidOptionChildren) { |
13028 | continue; | 13928 | didWarnInvalidOptionChildren = true; |
13029 | } | 13929 | process.env.NODE_ENV !== 'production' ? warning(false, 'Only strings and numbers are supported as <option> children.') : void 0; |
13030 | var error = checker(propValue, key, componentName, location, propFullName + '.' + key); | ||
13031 | if (error) { | ||
13032 | return error; | ||
13033 | } | ||
13034 | } | 13930 | } |
13035 | return null; | 13931 | }); |
13036 | } | ||
13037 | return createChainableTypeChecker(validate); | ||
13038 | } | ||
13039 | |||
13040 | function isNode(propValue) { | ||
13041 | switch (typeof propValue) { | ||
13042 | case 'number': | ||
13043 | case 'string': | ||
13044 | case 'undefined': | ||
13045 | return true; | ||
13046 | case 'boolean': | ||
13047 | return !propValue; | ||
13048 | case 'object': | ||
13049 | if (Array.isArray(propValue)) { | ||
13050 | return propValue.every(isNode); | ||
13051 | } | ||
13052 | if (propValue === null || ReactElement.isValidElement(propValue)) { | ||
13053 | return true; | ||
13054 | } | ||
13055 | |||
13056 | var iteratorFn = getIteratorFn(propValue); | ||
13057 | if (iteratorFn) { | ||
13058 | var iterator = iteratorFn.call(propValue); | ||
13059 | var step; | ||
13060 | if (iteratorFn !== propValue.entries) { | ||
13061 | while (!(step = iterator.next()).done) { | ||
13062 | if (!isNode(step.value)) { | ||
13063 | return false; | ||
13064 | } | ||
13065 | } | ||
13066 | } else { | ||
13067 | // Iterator will provide entry [k,v] tuples rather than values. | ||
13068 | while (!(step = iterator.next()).done) { | ||
13069 | var entry = step.value; | ||
13070 | if (entry) { | ||
13071 | if (!isNode(entry[1])) { | ||
13072 | return false; | ||
13073 | } | ||
13074 | } | ||
13075 | } | ||
13076 | } | ||
13077 | } else { | ||
13078 | return false; | ||
13079 | } | ||
13080 | |||
13081 | return true; | ||
13082 | default: | ||
13083 | return false; | ||
13084 | } | ||
13085 | } | ||
13086 | |||
13087 | // Equivalent of `typeof` but with special handling for array and regexp. | ||
13088 | function getPropType(propValue) { | ||
13089 | var propType = typeof propValue; | ||
13090 | if (Array.isArray(propValue)) { | ||
13091 | return 'array'; | ||
13092 | } | ||
13093 | if (propValue instanceof RegExp) { | ||
13094 | // Old webkits (at least until Android 4.0) return 'function' rather than | ||
13095 | // 'object' for typeof a RegExp. We'll normalize this here so that /bla/ | ||
13096 | // passes PropTypes.object. | ||
13097 | return 'object'; | ||
13098 | } | ||
13099 | return propType; | ||
13100 | } | ||
13101 | |||
13102 | // This handles more types than `getPropType`. Only used for error messages. | ||
13103 | // See `createPrimitiveTypeChecker`. | ||
13104 | function getPreciseType(propValue) { | ||
13105 | var propType = getPropType(propValue); | ||
13106 | if (propType === 'object') { | ||
13107 | if (propValue instanceof Date) { | ||
13108 | return 'date'; | ||
13109 | } else if (propValue instanceof RegExp) { | ||
13110 | return 'regexp'; | ||
13111 | } | ||
13112 | } | ||
13113 | return propType; | ||
13114 | } | ||
13115 | |||
13116 | // Returns class name of the object, if any. | ||
13117 | function getClassName(propValue) { | ||
13118 | if (!propValue.constructor || !propValue.constructor.name) { | ||
13119 | return '<<anonymous>>'; | ||
13120 | } | ||
13121 | return propValue.constructor.name; | ||
13122 | } | ||
13123 | |||
13124 | module.exports = ReactPropTypes; | ||
13125 | |||
13126 | /***/ }, | ||
13127 | /* 110 */ | ||
13128 | /***/ function(module, exports) { | ||
13129 | |||
13130 | /** | ||
13131 | * Copyright 2013-2015, Facebook, Inc. | ||
13132 | * All rights reserved. | ||
13133 | * | ||
13134 | * This source code is licensed under the BSD-style license found in the | ||
13135 | * LICENSE file in the root directory of this source tree. An additional grant | ||
13136 | * of patent rights can be found in the PATENTS file in the same directory. | ||
13137 | * | ||
13138 | * @providesModule getIteratorFn | ||
13139 | * @typechecks static-only | ||
13140 | */ | ||
13141 | |||
13142 | 'use strict'; | ||
13143 | |||
13144 | /* global Symbol */ | ||
13145 | var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; | ||
13146 | var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. | ||
13147 | 13932 | ||
13148 | /** | 13933 | return content; |
13149 | * Returns the iterator method function contained on the iterable object. | ||
13150 | * | ||
13151 | * Be sure to invoke the function with the iterable as context: | ||
13152 | * | ||
13153 | * var iteratorFn = getIteratorFn(myIterable); | ||
13154 | * if (iteratorFn) { | ||
13155 | * var iterator = iteratorFn.call(myIterable); | ||
13156 | * ... | ||
13157 | * } | ||
13158 | * | ||
13159 | * @param {?object} maybeIterable | ||
13160 | * @return {?function} | ||
13161 | */ | ||
13162 | function getIteratorFn(maybeIterable) { | ||
13163 | var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); | ||
13164 | if (typeof iteratorFn === 'function') { | ||
13165 | return iteratorFn; | ||
13166 | } | ||
13167 | } | 13934 | } |
13168 | 13935 | ||
13169 | module.exports = getIteratorFn; | ||
13170 | |||
13171 | /***/ }, | ||
13172 | /* 111 */ | ||
13173 | /***/ function(module, exports, __webpack_require__) { | ||
13174 | |||
13175 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
13176 | * Copyright 2013-2015, Facebook, Inc. | ||
13177 | * All rights reserved. | ||
13178 | * | ||
13179 | * This source code is licensed under the BSD-style license found in the | ||
13180 | * LICENSE file in the root directory of this source tree. An additional grant | ||
13181 | * of patent rights can be found in the PATENTS file in the same directory. | ||
13182 | * | ||
13183 | * @providesModule ReactDOMOption | ||
13184 | */ | ||
13185 | |||
13186 | 'use strict'; | ||
13187 | |||
13188 | var ReactChildren = __webpack_require__(112); | ||
13189 | var ReactDOMSelect = __webpack_require__(114); | ||
13190 | |||
13191 | var assign = __webpack_require__(41); | ||
13192 | var warning = __webpack_require__(27); | ||
13193 | |||
13194 | var valueContextKey = ReactDOMSelect.valueContextKey; | ||
13195 | |||
13196 | /** | 13936 | /** |
13197 | * Implements an <option> native component that warns when `selected` is set. | 13937 | * Implements an <option> host component that warns when `selected` is set. |
13198 | */ | 13938 | */ |
13199 | var ReactDOMOption = { | 13939 | var ReactDOMOption = { |
13200 | mountWrapper: function (inst, props, context) { | 13940 | mountWrapper: function (inst, props, hostParent) { |
13201 | // TODO (yungsters): Remove support for `selected` in <option>. | 13941 | // TODO (yungsters): Remove support for `selected` in <option>. |
13202 | if (process.env.NODE_ENV !== 'production') { | 13942 | if (process.env.NODE_ENV !== 'production') { |
13203 | process.env.NODE_ENV !== 'production' ? warning(props.selected == null, 'Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.') : undefined; | 13943 | 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; |
13204 | } | 13944 | } |
13205 | 13945 | ||
13206 | // Look up whether this option is 'selected' via context | 13946 | // Look up whether this option is 'selected' |
13207 | var selectValue = context[valueContextKey]; | 13947 | var selectValue = null; |
13948 | if (hostParent != null) { | ||
13949 | var selectParent = hostParent; | ||
13950 | |||
13951 | if (selectParent._tag === 'optgroup') { | ||
13952 | selectParent = selectParent._hostParent; | ||
13953 | } | ||
13954 | |||
13955 | if (selectParent != null && selectParent._tag === 'select') { | ||
13956 | selectValue = ReactDOMSelect.getSelectValueContext(selectParent); | ||
13957 | } | ||
13958 | } | ||
13208 | 13959 | ||
13209 | // If context key is null (e.g., no specified value or after initial mount) | 13960 | // If the value is null (e.g., no specified value or after initial mount) |
13210 | // or missing (e.g., for <datalist>), we don't change props.selected | 13961 | // or missing (e.g., for <datalist>), we don't change props.selected |
13211 | var selected = null; | 13962 | var selected = null; |
13212 | if (selectValue != null) { | 13963 | if (selectValue != null) { |
13964 | var value; | ||
13965 | if (props.value != null) { | ||
13966 | value = props.value + ''; | ||
13967 | } else { | ||
13968 | value = flattenChildren(props.children); | ||
13969 | } | ||
13213 | selected = false; | 13970 | selected = false; |
13214 | if (Array.isArray(selectValue)) { | 13971 | if (Array.isArray(selectValue)) { |
13215 | // multiple | 13972 | // multiple |
13216 | for (var i = 0; i < selectValue.length; i++) { | 13973 | for (var i = 0; i < selectValue.length; i++) { |
13217 | if ('' + selectValue[i] === '' + props.value) { | 13974 | if ('' + selectValue[i] === value) { |
13218 | selected = true; | 13975 | selected = true; |
13219 | break; | 13976 | break; |
13220 | } | 13977 | } |
13221 | } | 13978 | } |
13222 | } else { | 13979 | } else { |
13223 | selected = '' + selectValue === '' + props.value; | 13980 | selected = '' + selectValue === value; |
13224 | } | 13981 | } |
13225 | } | 13982 | } |
13226 | 13983 | ||
13227 | inst._wrapperState = { selected: selected }; | 13984 | inst._wrapperState = { selected: selected }; |
13228 | }, | 13985 | }, |
13229 | 13986 | ||
13230 | getNativeProps: function (inst, props, context) { | 13987 | postMountWrapper: function (inst) { |
13231 | var nativeProps = assign({ selected: undefined, children: undefined }, props); | 13988 | // value="" should make a value attribute (#6219) |
13989 | var props = inst._currentElement.props; | ||
13990 | if (props.value != null) { | ||
13991 | var node = ReactDOMComponentTree.getNodeFromInstance(inst); | ||
13992 | node.setAttribute('value', props.value); | ||
13993 | } | ||
13994 | }, | ||
13995 | |||
13996 | getHostProps: function (inst, props) { | ||
13997 | var hostProps = _assign({ selected: undefined, children: undefined }, props); | ||
13232 | 13998 | ||
13233 | // Read state only from initial mount because <select> updates value | 13999 | // Read state only from initial mount because <select> updates value |
13234 | // manually; we need the initial state only for server rendering | 14000 | // manually; we need the initial state only for server rendering |
13235 | if (inst._wrapperState.selected != null) { | 14001 | if (inst._wrapperState.selected != null) { |
13236 | nativeProps.selected = inst._wrapperState.selected; | 14002 | hostProps.selected = inst._wrapperState.selected; |
13237 | } | 14003 | } |
13238 | 14004 | ||
13239 | var content = ''; | 14005 | var content = flattenChildren(props.children); |
13240 | |||
13241 | // Flatten children and warn if they aren't strings or numbers; | ||
13242 | // invalid types are ignored. | ||
13243 | ReactChildren.forEach(props.children, function (child) { | ||
13244 | if (child == null) { | ||
13245 | return; | ||
13246 | } | ||
13247 | if (typeof child === 'string' || typeof child === 'number') { | ||
13248 | content += child; | ||
13249 | } else { | ||
13250 | process.env.NODE_ENV !== 'production' ? warning(false, 'Only strings and numbers are supported as <option> children.') : undefined; | ||
13251 | } | ||
13252 | }); | ||
13253 | |||
13254 | nativeProps.children = content; | ||
13255 | return nativeProps; | ||
13256 | } | ||
13257 | |||
13258 | }; | ||
13259 | |||
13260 | module.exports = ReactDOMOption; | ||
13261 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
13262 | |||
13263 | /***/ }, | ||
13264 | /* 112 */ | ||
13265 | /***/ function(module, exports, __webpack_require__) { | ||
13266 | |||
13267 | /** | ||
13268 | * Copyright 2013-2015, Facebook, Inc. | ||
13269 | * All rights reserved. | ||
13270 | * | ||
13271 | * This source code is licensed under the BSD-style license found in the | ||
13272 | * LICENSE file in the root directory of this source tree. An additional grant | ||
13273 | * of patent rights can be found in the PATENTS file in the same directory. | ||
13274 | * | ||
13275 | * @providesModule ReactChildren | ||
13276 | */ | ||
13277 | |||
13278 | 'use strict'; | ||
13279 | |||
13280 | var PooledClass = __webpack_require__(58); | ||
13281 | var ReactElement = __webpack_require__(44); | ||
13282 | |||
13283 | var emptyFunction = __webpack_require__(17); | ||
13284 | var traverseAllChildren = __webpack_require__(113); | ||
13285 | |||
13286 | var twoArgumentPooler = PooledClass.twoArgumentPooler; | ||
13287 | var fourArgumentPooler = PooledClass.fourArgumentPooler; | ||
13288 | |||
13289 | var userProvidedKeyEscapeRegex = /\/(?!\/)/g; | ||
13290 | function escapeUserProvidedKey(text) { | ||
13291 | return ('' + text).replace(userProvidedKeyEscapeRegex, '//'); | ||
13292 | } | ||
13293 | |||
13294 | /** | ||
13295 | * PooledClass representing the bookkeeping associated with performing a child | ||
13296 | * traversal. Allows avoiding binding callbacks. | ||
13297 | * | ||
13298 | * @constructor ForEachBookKeeping | ||
13299 | * @param {!function} forEachFunction Function to perform traversal with. | ||
13300 | * @param {?*} forEachContext Context to perform context with. | ||
13301 | */ | ||
13302 | function ForEachBookKeeping(forEachFunction, forEachContext) { | ||
13303 | this.func = forEachFunction; | ||
13304 | this.context = forEachContext; | ||
13305 | this.count = 0; | ||
13306 | } | ||
13307 | ForEachBookKeeping.prototype.destructor = function () { | ||
13308 | this.func = null; | ||
13309 | this.context = null; | ||
13310 | this.count = 0; | ||
13311 | }; | ||
13312 | PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler); | ||
13313 | |||
13314 | function forEachSingleChild(bookKeeping, child, name) { | ||
13315 | var func = bookKeeping.func; | ||
13316 | var context = bookKeeping.context; | ||
13317 | 14006 | ||
13318 | func.call(context, child, bookKeeping.count++); | 14007 | if (content) { |
13319 | } | 14008 | hostProps.children = content; |
13320 | |||
13321 | /** | ||
13322 | * Iterates through children that are typically specified as `props.children`. | ||
13323 | * | ||
13324 | * The provided forEachFunc(child, index) will be called for each | ||
13325 | * leaf child. | ||
13326 | * | ||
13327 | * @param {?*} children Children tree container. | ||
13328 | * @param {function(*, int)} forEachFunc | ||
13329 | * @param {*} forEachContext Context for forEachContext. | ||
13330 | */ | ||
13331 | function forEachChildren(children, forEachFunc, forEachContext) { | ||
13332 | if (children == null) { | ||
13333 | return children; | ||
13334 | } | ||
13335 | var traverseContext = ForEachBookKeeping.getPooled(forEachFunc, forEachContext); | ||
13336 | traverseAllChildren(children, forEachSingleChild, traverseContext); | ||
13337 | ForEachBookKeeping.release(traverseContext); | ||
13338 | } | ||
13339 | |||
13340 | /** | ||
13341 | * PooledClass representing the bookkeeping associated with performing a child | ||
13342 | * mapping. Allows avoiding binding callbacks. | ||
13343 | * | ||
13344 | * @constructor MapBookKeeping | ||
13345 | * @param {!*} mapResult Object containing the ordered map of results. | ||
13346 | * @param {!function} mapFunction Function to perform mapping with. | ||
13347 | * @param {?*} mapContext Context to perform mapping with. | ||
13348 | */ | ||
13349 | function MapBookKeeping(mapResult, keyPrefix, mapFunction, mapContext) { | ||
13350 | this.result = mapResult; | ||
13351 | this.keyPrefix = keyPrefix; | ||
13352 | this.func = mapFunction; | ||
13353 | this.context = mapContext; | ||
13354 | this.count = 0; | ||
13355 | } | ||
13356 | MapBookKeeping.prototype.destructor = function () { | ||
13357 | this.result = null; | ||
13358 | this.keyPrefix = null; | ||
13359 | this.func = null; | ||
13360 | this.context = null; | ||
13361 | this.count = 0; | ||
13362 | }; | ||
13363 | PooledClass.addPoolingTo(MapBookKeeping, fourArgumentPooler); | ||
13364 | |||
13365 | function mapSingleChildIntoContext(bookKeeping, child, childKey) { | ||
13366 | var result = bookKeeping.result; | ||
13367 | var keyPrefix = bookKeeping.keyPrefix; | ||
13368 | var func = bookKeeping.func; | ||
13369 | var context = bookKeeping.context; | ||
13370 | |||
13371 | var mappedChild = func.call(context, child, bookKeeping.count++); | ||
13372 | if (Array.isArray(mappedChild)) { | ||
13373 | mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument); | ||
13374 | } else if (mappedChild != null) { | ||
13375 | if (ReactElement.isValidElement(mappedChild)) { | ||
13376 | mappedChild = ReactElement.cloneAndReplaceKey(mappedChild, | ||
13377 | // Keep both the (mapped) and old keys if they differ, just as | ||
13378 | // traverseAllChildren used to do for objects as children | ||
13379 | keyPrefix + (mappedChild !== child ? escapeUserProvidedKey(mappedChild.key || '') + '/' : '') + childKey); | ||
13380 | } | 14009 | } |
13381 | result.push(mappedChild); | ||
13382 | } | ||
13383 | } | ||
13384 | 14010 | ||
13385 | function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) { | 14011 | return hostProps; |
13386 | var escapedPrefix = ''; | ||
13387 | if (prefix != null) { | ||
13388 | escapedPrefix = escapeUserProvidedKey(prefix) + '/'; | ||
13389 | } | ||
13390 | var traverseContext = MapBookKeeping.getPooled(array, escapedPrefix, func, context); | ||
13391 | traverseAllChildren(children, mapSingleChildIntoContext, traverseContext); | ||
13392 | MapBookKeeping.release(traverseContext); | ||
13393 | } | ||
13394 | |||
13395 | /** | ||
13396 | * Maps children that are typically specified as `props.children`. | ||
13397 | * | ||
13398 | * The provided mapFunction(child, key, index) will be called for each | ||
13399 | * leaf child. | ||
13400 | * | ||
13401 | * @param {?*} children Children tree container. | ||
13402 | * @param {function(*, int)} func The map function. | ||
13403 | * @param {*} context Context for mapFunction. | ||
13404 | * @return {object} Object containing the ordered map of results. | ||
13405 | */ | ||
13406 | function mapChildren(children, func, context) { | ||
13407 | if (children == null) { | ||
13408 | return children; | ||
13409 | } | 14012 | } |
13410 | var result = []; | ||
13411 | mapIntoWithKeyPrefixInternal(children, result, null, func, context); | ||
13412 | return result; | ||
13413 | } | ||
13414 | |||
13415 | function forEachSingleChildDummy(traverseContext, child, name) { | ||
13416 | return null; | ||
13417 | } | ||
13418 | |||
13419 | /** | ||
13420 | * Count the number of children that are typically specified as | ||
13421 | * `props.children`. | ||
13422 | * | ||
13423 | * @param {?*} children Children tree container. | ||
13424 | * @return {number} The number of children. | ||
13425 | */ | ||
13426 | function countChildren(children, context) { | ||
13427 | return traverseAllChildren(children, forEachSingleChildDummy, null); | ||
13428 | } | ||
13429 | |||
13430 | /** | ||
13431 | * Flatten a children object (typically specified as `props.children`) and | ||
13432 | * return an array with appropriately re-keyed children. | ||
13433 | */ | ||
13434 | function toArray(children) { | ||
13435 | var result = []; | ||
13436 | mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument); | ||
13437 | return result; | ||
13438 | } | ||
13439 | 14013 | ||
13440 | var ReactChildren = { | ||
13441 | forEach: forEachChildren, | ||
13442 | map: mapChildren, | ||
13443 | mapIntoWithKeyPrefixInternal: mapIntoWithKeyPrefixInternal, | ||
13444 | count: countChildren, | ||
13445 | toArray: toArray | ||
13446 | }; | ||
13447 | |||
13448 | module.exports = ReactChildren; | ||
13449 | |||
13450 | /***/ }, | ||
13451 | /* 113 */ | ||
13452 | /***/ function(module, exports, __webpack_require__) { | ||
13453 | |||
13454 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
13455 | * Copyright 2013-2015, Facebook, Inc. | ||
13456 | * All rights reserved. | ||
13457 | * | ||
13458 | * This source code is licensed under the BSD-style license found in the | ||
13459 | * LICENSE file in the root directory of this source tree. An additional grant | ||
13460 | * of patent rights can be found in the PATENTS file in the same directory. | ||
13461 | * | ||
13462 | * @providesModule traverseAllChildren | ||
13463 | */ | ||
13464 | |||
13465 | 'use strict'; | ||
13466 | |||
13467 | var ReactCurrentOwner = __webpack_require__(7); | ||
13468 | var ReactElement = __webpack_require__(44); | ||
13469 | var ReactInstanceHandles = __webpack_require__(47); | ||
13470 | |||
13471 | var getIteratorFn = __webpack_require__(110); | ||
13472 | var invariant = __webpack_require__(15); | ||
13473 | var warning = __webpack_require__(27); | ||
13474 | |||
13475 | var SEPARATOR = ReactInstanceHandles.SEPARATOR; | ||
13476 | var SUBSEPARATOR = ':'; | ||
13477 | |||
13478 | /** | ||
13479 | * TODO: Test that a single child and an array with one item have the same key | ||
13480 | * pattern. | ||
13481 | */ | ||
13482 | |||
13483 | var userProvidedKeyEscaperLookup = { | ||
13484 | '=': '=0', | ||
13485 | '.': '=1', | ||
13486 | ':': '=2' | ||
13487 | }; | 14014 | }; |
13488 | 14015 | ||
13489 | var userProvidedKeyEscapeRegex = /[=.:]/g; | 14016 | module.exports = ReactDOMOption; |
13490 | 14017 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | |
13491 | var didWarnAboutMaps = false; | ||
13492 | |||
13493 | function userProvidedKeyEscaper(match) { | ||
13494 | return userProvidedKeyEscaperLookup[match]; | ||
13495 | } | ||
13496 | |||
13497 | /** | ||
13498 | * Generate a key string that identifies a component within a set. | ||
13499 | * | ||
13500 | * @param {*} component A component that could contain a manual key. | ||
13501 | * @param {number} index Index that is used if a manual key is not provided. | ||
13502 | * @return {string} | ||
13503 | */ | ||
13504 | function getComponentKey(component, index) { | ||
13505 | if (component && component.key != null) { | ||
13506 | // Explicit key | ||
13507 | return wrapUserProvidedKey(component.key); | ||
13508 | } | ||
13509 | // Implicit key determined by the index in the set | ||
13510 | return index.toString(36); | ||
13511 | } | ||
13512 | |||
13513 | /** | ||
13514 | * Escape a component key so that it is safe to use in a reactid. | ||
13515 | * | ||
13516 | * @param {*} text Component key to be escaped. | ||
13517 | * @return {string} An escaped string. | ||
13518 | */ | ||
13519 | function escapeUserProvidedKey(text) { | ||
13520 | return ('' + text).replace(userProvidedKeyEscapeRegex, userProvidedKeyEscaper); | ||
13521 | } | ||
13522 | |||
13523 | /** | ||
13524 | * Wrap a `key` value explicitly provided by the user to distinguish it from | ||
13525 | * implicitly-generated keys generated by a component's index in its parent. | ||
13526 | * | ||
13527 | * @param {string} key Value of a user-provided `key` attribute | ||
13528 | * @return {string} | ||
13529 | */ | ||
13530 | function wrapUserProvidedKey(key) { | ||
13531 | return '$' + escapeUserProvidedKey(key); | ||
13532 | } | ||
13533 | |||
13534 | /** | ||
13535 | * @param {?*} children Children tree container. | ||
13536 | * @param {!string} nameSoFar Name of the key path so far. | ||
13537 | * @param {!function} callback Callback to invoke with each child found. | ||
13538 | * @param {?*} traverseContext Used to pass information throughout the traversal | ||
13539 | * process. | ||
13540 | * @return {!number} The number of children in this subtree. | ||
13541 | */ | ||
13542 | function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) { | ||
13543 | var type = typeof children; | ||
13544 | |||
13545 | if (type === 'undefined' || type === 'boolean') { | ||
13546 | // All of the above are perceived as null. | ||
13547 | children = null; | ||
13548 | } | ||
13549 | |||
13550 | if (children === null || type === 'string' || type === 'number' || ReactElement.isValidElement(children)) { | ||
13551 | callback(traverseContext, children, | ||
13552 | // If it's the only child, treat the name as if it was wrapped in an array | ||
13553 | // so that it's consistent if the number of children grows. | ||
13554 | nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar); | ||
13555 | return 1; | ||
13556 | } | ||
13557 | |||
13558 | var child; | ||
13559 | var nextName; | ||
13560 | var subtreeCount = 0; // Count of children found in the current subtree. | ||
13561 | var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR; | ||
13562 | |||
13563 | if (Array.isArray(children)) { | ||
13564 | for (var i = 0; i < children.length; i++) { | ||
13565 | child = children[i]; | ||
13566 | nextName = nextNamePrefix + getComponentKey(child, i); | ||
13567 | subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); | ||
13568 | } | ||
13569 | } else { | ||
13570 | var iteratorFn = getIteratorFn(children); | ||
13571 | if (iteratorFn) { | ||
13572 | var iterator = iteratorFn.call(children); | ||
13573 | var step; | ||
13574 | if (iteratorFn !== children.entries) { | ||
13575 | var ii = 0; | ||
13576 | while (!(step = iterator.next()).done) { | ||
13577 | child = step.value; | ||
13578 | nextName = nextNamePrefix + getComponentKey(child, ii++); | ||
13579 | subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); | ||
13580 | } | ||
13581 | } else { | ||
13582 | if (process.env.NODE_ENV !== 'production') { | ||
13583 | 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.') : undefined; | ||
13584 | didWarnAboutMaps = true; | ||
13585 | } | ||
13586 | // Iterator will provide entry [k,v] tuples rather than values. | ||
13587 | while (!(step = iterator.next()).done) { | ||
13588 | var entry = step.value; | ||
13589 | if (entry) { | ||
13590 | child = entry[1]; | ||
13591 | nextName = nextNamePrefix + wrapUserProvidedKey(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0); | ||
13592 | subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); | ||
13593 | } | ||
13594 | } | ||
13595 | } | ||
13596 | } else if (type === 'object') { | ||
13597 | var addendum = ''; | ||
13598 | if (process.env.NODE_ENV !== 'production') { | ||
13599 | 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.'; | ||
13600 | if (children._isReactElement) { | ||
13601 | 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.'; | ||
13602 | } | ||
13603 | if (ReactCurrentOwner.current) { | ||
13604 | var name = ReactCurrentOwner.current.getName(); | ||
13605 | if (name) { | ||
13606 | addendum += ' Check the render method of `' + name + '`.'; | ||
13607 | } | ||
13608 | } | ||
13609 | } | ||
13610 | var childrenString = String(children); | ||
13611 | 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) : invariant(false) : undefined; | ||
13612 | } | ||
13613 | } | ||
13614 | |||
13615 | return subtreeCount; | ||
13616 | } | ||
13617 | |||
13618 | /** | ||
13619 | * Traverses children that are typically specified as `props.children`, but | ||
13620 | * might also be specified through attributes: | ||
13621 | * | ||
13622 | * - `traverseAllChildren(this.props.children, ...)` | ||
13623 | * - `traverseAllChildren(this.props.leftPanelChildren, ...)` | ||
13624 | * | ||
13625 | * The `traverseContext` is an optional argument that is passed through the | ||
13626 | * entire traversal. It can be used to store accumulations or anything else that | ||
13627 | * the callback might find relevant. | ||
13628 | * | ||
13629 | * @param {?*} children Children tree object. | ||
13630 | * @param {!function} callback To invoke upon traversing each child. | ||
13631 | * @param {?*} traverseContext Context for traversal. | ||
13632 | * @return {!number} The number of children in this subtree. | ||
13633 | */ | ||
13634 | function traverseAllChildren(children, callback, traverseContext) { | ||
13635 | if (children == null) { | ||
13636 | return 0; | ||
13637 | } | ||
13638 | |||
13639 | return traverseAllChildrenImpl(children, '', callback, traverseContext); | ||
13640 | } | ||
13641 | |||
13642 | module.exports = traverseAllChildren; | ||
13643 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
13644 | 14018 | ||
13645 | /***/ }, | 14019 | /***/ }, |
13646 | /* 114 */ | 14020 | /* 122 */ |
13647 | /***/ function(module, exports, __webpack_require__) { | 14021 | /***/ function(module, exports, __webpack_require__) { |
13648 | 14022 | ||
13649 | /* WEBPACK VAR INJECTION */(function(process) {/** | 14023 | /* WEBPACK VAR INJECTION */(function(process) {/** |
13650 | * Copyright 2013-2015, Facebook, Inc. | 14024 | * Copyright 2013-present, Facebook, Inc. |
13651 | * All rights reserved. | 14025 | * All rights reserved. |
13652 | * | 14026 | * |
13653 | * This source code is licensed under the BSD-style license found in the | 14027 | * This source code is licensed under the BSD-style license found in the |
@@ -13659,14 +14033,17 @@ | |||
13659 | 14033 | ||
13660 | 'use strict'; | 14034 | 'use strict'; |
13661 | 14035 | ||
13662 | var LinkedValueUtils = __webpack_require__(108); | 14036 | var _assign = __webpack_require__(6); |
13663 | var ReactMount = __webpack_require__(30); | 14037 | |
13664 | var ReactUpdates = __webpack_require__(56); | 14038 | var DisabledInputUtils = __webpack_require__(118); |
14039 | var LinkedValueUtils = __webpack_require__(120); | ||
14040 | var ReactDOMComponentTree = __webpack_require__(39); | ||
14041 | var ReactUpdates = __webpack_require__(59); | ||
13665 | 14042 | ||
13666 | var assign = __webpack_require__(41); | 14043 | var warning = __webpack_require__(13); |
13667 | var warning = __webpack_require__(27); | ||
13668 | 14044 | ||
13669 | var valueContextKey = '__ReactDOMSelect_value$' + Math.random().toString(36).slice(2); | 14045 | var didWarnValueLink = false; |
14046 | var didWarnValueDefaultValue = false; | ||
13670 | 14047 | ||
13671 | function updateOptionsIfPendingUpdateAndMounted() { | 14048 | function updateOptionsIfPendingUpdateAndMounted() { |
13672 | if (this._rootNodeID && this._wrapperState.pendingUpdate) { | 14049 | if (this._rootNodeID && this._wrapperState.pendingUpdate) { |
@@ -13676,7 +14053,7 @@ | |||
13676 | var value = LinkedValueUtils.getValue(props); | 14053 | var value = LinkedValueUtils.getValue(props); |
13677 | 14054 | ||
13678 | if (value != null) { | 14055 | if (value != null) { |
13679 | updateOptions(this, props, value); | 14056 | updateOptions(this, Boolean(props.multiple), value); |
13680 | } | 14057 | } |
13681 | } | 14058 | } |
13682 | } | 14059 | } |
@@ -13701,15 +14078,20 @@ | |||
13701 | var owner = inst._currentElement._owner; | 14078 | var owner = inst._currentElement._owner; |
13702 | LinkedValueUtils.checkPropTypes('select', props, owner); | 14079 | LinkedValueUtils.checkPropTypes('select', props, owner); |
13703 | 14080 | ||
14081 | if (props.valueLink !== undefined && !didWarnValueLink) { | ||
14082 | process.env.NODE_ENV !== 'production' ? warning(false, '`valueLink` prop on `select` is deprecated; set `value` and `onChange` instead.') : void 0; | ||
14083 | didWarnValueLink = true; | ||
14084 | } | ||
14085 | |||
13704 | for (var i = 0; i < valuePropNames.length; i++) { | 14086 | for (var i = 0; i < valuePropNames.length; i++) { |
13705 | var propName = valuePropNames[i]; | 14087 | var propName = valuePropNames[i]; |
13706 | if (props[propName] == null) { | 14088 | if (props[propName] == null) { |
13707 | continue; | 14089 | continue; |
13708 | } | 14090 | } |
13709 | if (props.multiple) { | 14091 | if (props.multiple) { |
13710 | process.env.NODE_ENV !== 'production' ? warning(Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum(owner)) : undefined; | 14092 | process.env.NODE_ENV !== 'production' ? warning(Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum(owner)) : void 0; |
13711 | } else { | 14093 | } else { |
13712 | process.env.NODE_ENV !== 'production' ? warning(!Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum(owner)) : undefined; | 14094 | process.env.NODE_ENV !== 'production' ? warning(!Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum(owner)) : void 0; |
13713 | } | 14095 | } |
13714 | } | 14096 | } |
13715 | } | 14097 | } |
@@ -13722,7 +14104,7 @@ | |||
13722 | */ | 14104 | */ |
13723 | function updateOptions(inst, multiple, propValue) { | 14105 | function updateOptions(inst, multiple, propValue) { |
13724 | var selectedValue, i; | 14106 | var selectedValue, i; |
13725 | var options = ReactMount.getNode(inst._rootNodeID).options; | 14107 | var options = ReactDOMComponentTree.getNodeFromInstance(inst).options; |
13726 | 14108 | ||
13727 | if (multiple) { | 14109 | if (multiple) { |
13728 | selectedValue = {}; | 14110 | selectedValue = {}; |
@@ -13752,7 +14134,7 @@ | |||
13752 | } | 14134 | } |
13753 | 14135 | ||
13754 | /** | 14136 | /** |
13755 | * Implements a <select> native component that allows optionally setting the | 14137 | * Implements a <select> host component that allows optionally setting the |
13756 | * props `value` and `defaultValue`. If `multiple` is false, the prop must be a | 14138 | * props `value` and `defaultValue`. If `multiple` is false, the prop must be a |
13757 | * stringable. If `multiple` is true, the prop must be an array of stringables. | 14139 | * stringable. If `multiple` is true, the prop must be an array of stringables. |
13758 | * | 14140 | * |
@@ -13767,10 +14149,8 @@ | |||
13767 | * selected. | 14149 | * selected. |
13768 | */ | 14150 | */ |
13769 | var ReactDOMSelect = { | 14151 | var ReactDOMSelect = { |
13770 | valueContextKey: valueContextKey, | 14152 | getHostProps: function (inst, props) { |
13771 | 14153 | return _assign({}, DisabledInputUtils.getHostProps(inst, props), { | |
13772 | getNativeProps: function (inst, props, context) { | ||
13773 | return assign({}, props, { | ||
13774 | onChange: inst._wrapperState.onChange, | 14154 | onChange: inst._wrapperState.onChange, |
13775 | value: undefined | 14155 | value: undefined |
13776 | }); | 14156 | }); |
@@ -13785,24 +14165,28 @@ | |||
13785 | inst._wrapperState = { | 14165 | inst._wrapperState = { |
13786 | pendingUpdate: false, | 14166 | pendingUpdate: false, |
13787 | initialValue: value != null ? value : props.defaultValue, | 14167 | initialValue: value != null ? value : props.defaultValue, |
14168 | listeners: null, | ||
13788 | onChange: _handleChange.bind(inst), | 14169 | onChange: _handleChange.bind(inst), |
13789 | wasMultiple: Boolean(props.multiple) | 14170 | wasMultiple: Boolean(props.multiple) |
13790 | }; | 14171 | }; |
14172 | |||
14173 | if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) { | ||
14174 | 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; | ||
14175 | didWarnValueDefaultValue = true; | ||
14176 | } | ||
13791 | }, | 14177 | }, |
13792 | 14178 | ||
13793 | processChildContext: function (inst, props, context) { | 14179 | getSelectValueContext: function (inst) { |
13794 | // Pass down initial value so initial generated markup has correct | 14180 | // ReactDOMOption looks at this initial value so the initial generated |
13795 | // `selected` attributes | 14181 | // markup has correct `selected` attributes |
13796 | var childContext = assign({}, context); | 14182 | return inst._wrapperState.initialValue; |
13797 | childContext[valueContextKey] = inst._wrapperState.initialValue; | ||
13798 | return childContext; | ||
13799 | }, | 14183 | }, |
13800 | 14184 | ||
13801 | postUpdateWrapper: function (inst) { | 14185 | postUpdateWrapper: function (inst) { |
13802 | var props = inst._currentElement.props; | 14186 | var props = inst._currentElement.props; |
13803 | 14187 | ||
13804 | // After the initial mount, we control selected-ness manually so don't pass | 14188 | // After the initial mount, we control selected-ness manually so don't pass |
13805 | // the context value down | 14189 | // this value down |
13806 | inst._wrapperState.initialValue = undefined; | 14190 | inst._wrapperState.initialValue = undefined; |
13807 | 14191 | ||
13808 | var wasMultiple = inst._wrapperState.wasMultiple; | 14192 | var wasMultiple = inst._wrapperState.wasMultiple; |
@@ -13828,20 +14212,22 @@ | |||
13828 | var props = this._currentElement.props; | 14212 | var props = this._currentElement.props; |
13829 | var returnValue = LinkedValueUtils.executeOnChange(props, event); | 14213 | var returnValue = LinkedValueUtils.executeOnChange(props, event); |
13830 | 14214 | ||
13831 | this._wrapperState.pendingUpdate = true; | 14215 | if (this._rootNodeID) { |
14216 | this._wrapperState.pendingUpdate = true; | ||
14217 | } | ||
13832 | ReactUpdates.asap(updateOptionsIfPendingUpdateAndMounted, this); | 14218 | ReactUpdates.asap(updateOptionsIfPendingUpdateAndMounted, this); |
13833 | return returnValue; | 14219 | return returnValue; |
13834 | } | 14220 | } |
13835 | 14221 | ||
13836 | module.exports = ReactDOMSelect; | 14222 | module.exports = ReactDOMSelect; |
13837 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | 14223 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) |
13838 | 14224 | ||
13839 | /***/ }, | 14225 | /***/ }, |
13840 | /* 115 */ | 14226 | /* 123 */ |
13841 | /***/ function(module, exports, __webpack_require__) { | 14227 | /***/ function(module, exports, __webpack_require__) { |
13842 | 14228 | ||
13843 | /* WEBPACK VAR INJECTION */(function(process) {/** | 14229 | /* WEBPACK VAR INJECTION */(function(process) {/** |
13844 | * Copyright 2013-2015, Facebook, Inc. | 14230 | * Copyright 2013-present, Facebook, Inc. |
13845 | * All rights reserved. | 14231 | * All rights reserved. |
13846 | * | 14232 | * |
13847 | * This source code is licensed under the BSD-style license found in the | 14233 | * This source code is licensed under the BSD-style license found in the |
@@ -13853,13 +14239,19 @@ | |||
13853 | 14239 | ||
13854 | 'use strict'; | 14240 | 'use strict'; |
13855 | 14241 | ||
13856 | var LinkedValueUtils = __webpack_require__(108); | 14242 | var _prodInvariant = __webpack_require__(9), |
13857 | var ReactDOMIDOperations = __webpack_require__(29); | 14243 | _assign = __webpack_require__(6); |
13858 | var ReactUpdates = __webpack_require__(56); | 14244 | |
14245 | var DisabledInputUtils = __webpack_require__(118); | ||
14246 | var LinkedValueUtils = __webpack_require__(120); | ||
14247 | var ReactDOMComponentTree = __webpack_require__(39); | ||
14248 | var ReactUpdates = __webpack_require__(59); | ||
13859 | 14249 | ||
13860 | var assign = __webpack_require__(41); | 14250 | var invariant = __webpack_require__(10); |
13861 | var invariant = __webpack_require__(15); | 14251 | var warning = __webpack_require__(13); |
13862 | var warning = __webpack_require__(27); | 14252 | |
14253 | var didWarnValueLink = false; | ||
14254 | var didWarnValDefaultVal = false; | ||
13863 | 14255 | ||
13864 | function forceUpdateIfMounted() { | 14256 | function forceUpdateIfMounted() { |
13865 | if (this._rootNodeID) { | 14257 | if (this._rootNodeID) { |
@@ -13869,7 +14261,7 @@ | |||
13869 | } | 14261 | } |
13870 | 14262 | ||
13871 | /** | 14263 | /** |
13872 | * Implements a <textarea> native component that allows setting `value`, and | 14264 | * Implements a <textarea> host component that allows setting `value`, and |
13873 | * `defaultValue`. This differs from the traditional DOM API because value is | 14265 | * `defaultValue`. This differs from the traditional DOM API because value is |
13874 | * usually set as PCDATA children. | 14266 | * usually set as PCDATA children. |
13875 | * | 14267 | * |
@@ -13884,64 +14276,100 @@ | |||
13884 | * `defaultValue` if specified, or the children content (deprecated). | 14276 | * `defaultValue` if specified, or the children content (deprecated). |
13885 | */ | 14277 | */ |
13886 | var ReactDOMTextarea = { | 14278 | var ReactDOMTextarea = { |
13887 | getNativeProps: function (inst, props, context) { | 14279 | getHostProps: function (inst, props) { |
13888 | !(props.dangerouslySetInnerHTML == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, '`dangerouslySetInnerHTML` does not make sense on <textarea>.') : invariant(false) : undefined; | 14280 | !(props.dangerouslySetInnerHTML == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, '`dangerouslySetInnerHTML` does not make sense on <textarea>.') : _prodInvariant('91') : void 0; |
13889 | 14281 | ||
13890 | // Always set children to the same thing. In IE9, the selection range will | 14282 | // Always set children to the same thing. In IE9, the selection range will |
13891 | // get reset if `textContent` is mutated. | 14283 | // get reset if `textContent` is mutated. We could add a check in setTextContent |
13892 | var nativeProps = assign({}, props, { | 14284 | // to only set the value if/when the value differs from the node value (which would |
13893 | defaultValue: undefined, | 14285 | // completely solve this IE9 bug), but Sebastian+Ben seemed to like this solution. |
14286 | // The value can be a boolean or object so that's why it's forced to be a string. | ||
14287 | var hostProps = _assign({}, DisabledInputUtils.getHostProps(inst, props), { | ||
13894 | value: undefined, | 14288 | value: undefined, |
13895 | children: inst._wrapperState.initialValue, | 14289 | defaultValue: undefined, |
14290 | children: '' + inst._wrapperState.initialValue, | ||
13896 | onChange: inst._wrapperState.onChange | 14291 | onChange: inst._wrapperState.onChange |
13897 | }); | 14292 | }); |
13898 | 14293 | ||
13899 | return nativeProps; | 14294 | return hostProps; |
13900 | }, | 14295 | }, |
13901 | 14296 | ||
13902 | mountWrapper: function (inst, props) { | 14297 | mountWrapper: function (inst, props) { |
13903 | if (process.env.NODE_ENV !== 'production') { | 14298 | if (process.env.NODE_ENV !== 'production') { |
13904 | LinkedValueUtils.checkPropTypes('textarea', props, inst._currentElement._owner); | 14299 | LinkedValueUtils.checkPropTypes('textarea', props, inst._currentElement._owner); |
14300 | if (props.valueLink !== undefined && !didWarnValueLink) { | ||
14301 | process.env.NODE_ENV !== 'production' ? warning(false, '`valueLink` prop on `textarea` is deprecated; set `value` and `onChange` instead.') : void 0; | ||
14302 | didWarnValueLink = true; | ||
14303 | } | ||
14304 | if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValDefaultVal) { | ||
14305 | 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; | ||
14306 | didWarnValDefaultVal = true; | ||
14307 | } | ||
13905 | } | 14308 | } |
13906 | 14309 | ||
13907 | var defaultValue = props.defaultValue; | 14310 | var value = LinkedValueUtils.getValue(props); |
13908 | // TODO (yungsters): Remove support for children content in <textarea>. | 14311 | var initialValue = value; |
13909 | var children = props.children; | 14312 | |
13910 | if (children != null) { | 14313 | // Only bother fetching default value if we're going to use it |
13911 | if (process.env.NODE_ENV !== 'production') { | 14314 | if (value == null) { |
13912 | process.env.NODE_ENV !== 'production' ? warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.') : undefined; | 14315 | var defaultValue = props.defaultValue; |
14316 | // TODO (yungsters): Remove support for children content in <textarea>. | ||
14317 | var children = props.children; | ||
14318 | if (children != null) { | ||
14319 | if (process.env.NODE_ENV !== 'production') { | ||
14320 | process.env.NODE_ENV !== 'production' ? warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.') : void 0; | ||
14321 | } | ||
14322 | !(defaultValue == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : _prodInvariant('92') : void 0; | ||
14323 | if (Array.isArray(children)) { | ||
14324 | !(children.length <= 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, '<textarea> can only have at most one child.') : _prodInvariant('93') : void 0; | ||
14325 | children = children[0]; | ||
14326 | } | ||
14327 | |||
14328 | defaultValue = '' + children; | ||
13913 | } | 14329 | } |
13914 | !(defaultValue == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : invariant(false) : undefined; | 14330 | if (defaultValue == null) { |
13915 | if (Array.isArray(children)) { | 14331 | defaultValue = ''; |
13916 | !(children.length <= 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, '<textarea> can only have at most one child.') : invariant(false) : undefined; | ||
13917 | children = children[0]; | ||
13918 | } | 14332 | } |
13919 | 14333 | initialValue = defaultValue; | |
13920 | defaultValue = '' + children; | ||
13921 | } | ||
13922 | if (defaultValue == null) { | ||
13923 | defaultValue = ''; | ||
13924 | } | 14334 | } |
13925 | var value = LinkedValueUtils.getValue(props); | ||
13926 | 14335 | ||
13927 | inst._wrapperState = { | 14336 | inst._wrapperState = { |
13928 | // We save the initial value so that `ReactDOMComponent` doesn't update | 14337 | initialValue: '' + initialValue, |
13929 | // `textContent` (unnecessary since we update value). | 14338 | listeners: null, |
13930 | // The initial value can be a boolean or object so that's why it's | ||
13931 | // forced to be a string. | ||
13932 | initialValue: '' + (value != null ? value : defaultValue), | ||
13933 | onChange: _handleChange.bind(inst) | 14339 | onChange: _handleChange.bind(inst) |
13934 | }; | 14340 | }; |
13935 | }, | 14341 | }, |
13936 | 14342 | ||
13937 | updateWrapper: function (inst) { | 14343 | updateWrapper: function (inst) { |
13938 | var props = inst._currentElement.props; | 14344 | var props = inst._currentElement.props; |
14345 | |||
14346 | var node = ReactDOMComponentTree.getNodeFromInstance(inst); | ||
13939 | var value = LinkedValueUtils.getValue(props); | 14347 | var value = LinkedValueUtils.getValue(props); |
13940 | if (value != null) { | 14348 | if (value != null) { |
13941 | // Cast `value` to a string to ensure the value is set correctly. While | 14349 | // Cast `value` to a string to ensure the value is set correctly. While |
13942 | // browsers typically do this as necessary, jsdom doesn't. | 14350 | // browsers typically do this as necessary, jsdom doesn't. |
13943 | ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'value', '' + value); | 14351 | var newValue = '' + value; |
14352 | |||
14353 | // To avoid side effects (such as losing text selection), only set value if changed | ||
14354 | if (newValue !== node.value) { | ||
14355 | node.value = newValue; | ||
14356 | } | ||
14357 | if (props.defaultValue == null) { | ||
14358 | node.defaultValue = newValue; | ||
14359 | } | ||
14360 | } | ||
14361 | if (props.defaultValue != null) { | ||
14362 | node.defaultValue = props.defaultValue; | ||
13944 | } | 14363 | } |
14364 | }, | ||
14365 | |||
14366 | postMountWrapper: function (inst) { | ||
14367 | // This is in postMount because we need access to the DOM node, which is not | ||
14368 | // available until after the component has mounted. | ||
14369 | var node = ReactDOMComponentTree.getNodeFromInstance(inst); | ||
14370 | |||
14371 | // Warning: node.value may be the empty string at this point (IE11) if placeholder is set. | ||
14372 | node.value = node.textContent; // Detach value from defaultValue | ||
13945 | } | 14373 | } |
13946 | }; | 14374 | }; |
13947 | 14375 | ||
@@ -13953,14 +14381,14 @@ | |||
13953 | } | 14381 | } |
13954 | 14382 | ||
13955 | module.exports = ReactDOMTextarea; | 14383 | module.exports = ReactDOMTextarea; |
13956 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | 14384 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) |
13957 | 14385 | ||
13958 | /***/ }, | 14386 | /***/ }, |
13959 | /* 116 */ | 14387 | /* 124 */ |
13960 | /***/ function(module, exports, __webpack_require__) { | 14388 | /***/ function(module, exports, __webpack_require__) { |
13961 | 14389 | ||
13962 | /* WEBPACK VAR INJECTION */(function(process) {/** | 14390 | /* WEBPACK VAR INJECTION */(function(process) {/** |
13963 | * Copyright 2013-2015, Facebook, Inc. | 14391 | * Copyright 2013-present, Facebook, Inc. |
13964 | * All rights reserved. | 14392 | * All rights reserved. |
13965 | * | 14393 | * |
13966 | * This source code is licensed under the BSD-style license found in the | 14394 | * This source code is licensed under the BSD-style license found in the |
@@ -13968,169 +14396,166 @@ | |||
13968 | * of patent rights can be found in the PATENTS file in the same directory. | 14396 | * of patent rights can be found in the PATENTS file in the same directory. |
13969 | * | 14397 | * |
13970 | * @providesModule ReactMultiChild | 14398 | * @providesModule ReactMultiChild |
13971 | * @typechecks static-only | ||
13972 | */ | 14399 | */ |
13973 | 14400 | ||
13974 | 'use strict'; | 14401 | 'use strict'; |
13975 | 14402 | ||
13976 | var ReactComponentEnvironment = __webpack_require__(66); | 14403 | var _prodInvariant = __webpack_require__(9); |
13977 | var ReactMultiChildUpdateTypes = __webpack_require__(18); | ||
13978 | 14404 | ||
13979 | var ReactCurrentOwner = __webpack_require__(7); | 14405 | var ReactComponentEnvironment = __webpack_require__(125); |
13980 | var ReactReconciler = __webpack_require__(52); | 14406 | var ReactInstanceMap = __webpack_require__(126); |
13981 | var ReactChildReconciler = __webpack_require__(117); | 14407 | var ReactInstrumentation = __webpack_require__(65); |
14408 | var ReactMultiChildUpdateTypes = __webpack_require__(95); | ||
13982 | 14409 | ||
13983 | var flattenChildren = __webpack_require__(118); | 14410 | var ReactCurrentOwner = __webpack_require__(12); |
14411 | var ReactReconciler = __webpack_require__(62); | ||
14412 | var ReactChildReconciler = __webpack_require__(127); | ||
13984 | 14413 | ||
13985 | /** | 14414 | var emptyFunction = __webpack_require__(14); |
13986 | * Updating children of a component may trigger recursive updates. The depth is | 14415 | var flattenChildren = __webpack_require__(135); |
13987 | * used to batch recursive updates to render markup more efficiently. | 14416 | var invariant = __webpack_require__(10); |
13988 | * | ||
13989 | * @type {number} | ||
13990 | * @private | ||
13991 | */ | ||
13992 | var updateDepth = 0; | ||
13993 | |||
13994 | /** | ||
13995 | * Queue of update configuration objects. | ||
13996 | * | ||
13997 | * Each object has a `type` property that is in `ReactMultiChildUpdateTypes`. | ||
13998 | * | ||
13999 | * @type {array<object>} | ||
14000 | * @private | ||
14001 | */ | ||
14002 | var updateQueue = []; | ||
14003 | 14417 | ||
14004 | /** | 14418 | /** |
14005 | * Queue of markup to be rendered. | 14419 | * Make an update for markup to be rendered and inserted at a supplied index. |
14006 | * | 14420 | * |
14007 | * @type {array<string>} | ||
14008 | * @private | ||
14009 | */ | ||
14010 | var markupQueue = []; | ||
14011 | |||
14012 | /** | ||
14013 | * Enqueues markup to be rendered and inserted at a supplied index. | ||
14014 | * | ||
14015 | * @param {string} parentID ID of the parent component. | ||
14016 | * @param {string} markup Markup that renders into an element. | 14421 | * @param {string} markup Markup that renders into an element. |
14017 | * @param {number} toIndex Destination index. | 14422 | * @param {number} toIndex Destination index. |
14018 | * @private | 14423 | * @private |
14019 | */ | 14424 | */ |
14020 | function enqueueInsertMarkup(parentID, markup, toIndex) { | 14425 | function makeInsertMarkup(markup, afterNode, toIndex) { |
14021 | // NOTE: Null values reduce hidden classes. | 14426 | // NOTE: Null values reduce hidden classes. |
14022 | updateQueue.push({ | 14427 | return { |
14023 | parentID: parentID, | ||
14024 | parentNode: null, | ||
14025 | type: ReactMultiChildUpdateTypes.INSERT_MARKUP, | 14428 | type: ReactMultiChildUpdateTypes.INSERT_MARKUP, |
14026 | markupIndex: markupQueue.push(markup) - 1, | 14429 | content: markup, |
14027 | content: null, | ||
14028 | fromIndex: null, | 14430 | fromIndex: null, |
14029 | toIndex: toIndex | 14431 | fromNode: null, |
14030 | }); | 14432 | toIndex: toIndex, |
14433 | afterNode: afterNode | ||
14434 | }; | ||
14031 | } | 14435 | } |
14032 | 14436 | ||
14033 | /** | 14437 | /** |
14034 | * Enqueues moving an existing element to another index. | 14438 | * Make an update for moving an existing element to another index. |
14035 | * | 14439 | * |
14036 | * @param {string} parentID ID of the parent component. | ||
14037 | * @param {number} fromIndex Source index of the existing element. | 14440 | * @param {number} fromIndex Source index of the existing element. |
14038 | * @param {number} toIndex Destination index of the element. | 14441 | * @param {number} toIndex Destination index of the element. |
14039 | * @private | 14442 | * @private |
14040 | */ | 14443 | */ |
14041 | function enqueueMove(parentID, fromIndex, toIndex) { | 14444 | function makeMove(child, afterNode, toIndex) { |
14042 | // NOTE: Null values reduce hidden classes. | 14445 | // NOTE: Null values reduce hidden classes. |
14043 | updateQueue.push({ | 14446 | return { |
14044 | parentID: parentID, | ||
14045 | parentNode: null, | ||
14046 | type: ReactMultiChildUpdateTypes.MOVE_EXISTING, | 14447 | type: ReactMultiChildUpdateTypes.MOVE_EXISTING, |
14047 | markupIndex: null, | ||
14048 | content: null, | 14448 | content: null, |
14049 | fromIndex: fromIndex, | 14449 | fromIndex: child._mountIndex, |
14050 | toIndex: toIndex | 14450 | fromNode: ReactReconciler.getHostNode(child), |
14051 | }); | 14451 | toIndex: toIndex, |
14452 | afterNode: afterNode | ||
14453 | }; | ||
14052 | } | 14454 | } |
14053 | 14455 | ||
14054 | /** | 14456 | /** |
14055 | * Enqueues removing an element at an index. | 14457 | * Make an update for removing an element at an index. |
14056 | * | 14458 | * |
14057 | * @param {string} parentID ID of the parent component. | ||
14058 | * @param {number} fromIndex Index of the element to remove. | 14459 | * @param {number} fromIndex Index of the element to remove. |
14059 | * @private | 14460 | * @private |
14060 | */ | 14461 | */ |
14061 | function enqueueRemove(parentID, fromIndex) { | 14462 | function makeRemove(child, node) { |
14062 | // NOTE: Null values reduce hidden classes. | 14463 | // NOTE: Null values reduce hidden classes. |
14063 | updateQueue.push({ | 14464 | return { |
14064 | parentID: parentID, | ||
14065 | parentNode: null, | ||
14066 | type: ReactMultiChildUpdateTypes.REMOVE_NODE, | 14465 | type: ReactMultiChildUpdateTypes.REMOVE_NODE, |
14067 | markupIndex: null, | ||
14068 | content: null, | 14466 | content: null, |
14069 | fromIndex: fromIndex, | 14467 | fromIndex: child._mountIndex, |
14070 | toIndex: null | 14468 | fromNode: node, |
14071 | }); | 14469 | toIndex: null, |
14470 | afterNode: null | ||
14471 | }; | ||
14072 | } | 14472 | } |
14073 | 14473 | ||
14074 | /** | 14474 | /** |
14075 | * Enqueues setting the markup of a node. | 14475 | * Make an update for setting the markup of a node. |
14076 | * | 14476 | * |
14077 | * @param {string} parentID ID of the parent component. | ||
14078 | * @param {string} markup Markup that renders into an element. | 14477 | * @param {string} markup Markup that renders into an element. |
14079 | * @private | 14478 | * @private |
14080 | */ | 14479 | */ |
14081 | function enqueueSetMarkup(parentID, markup) { | 14480 | function makeSetMarkup(markup) { |
14082 | // NOTE: Null values reduce hidden classes. | 14481 | // NOTE: Null values reduce hidden classes. |
14083 | updateQueue.push({ | 14482 | return { |
14084 | parentID: parentID, | ||
14085 | parentNode: null, | ||
14086 | type: ReactMultiChildUpdateTypes.SET_MARKUP, | 14483 | type: ReactMultiChildUpdateTypes.SET_MARKUP, |
14087 | markupIndex: null, | ||
14088 | content: markup, | 14484 | content: markup, |
14089 | fromIndex: null, | 14485 | fromIndex: null, |
14090 | toIndex: null | 14486 | fromNode: null, |
14091 | }); | 14487 | toIndex: null, |
14488 | afterNode: null | ||
14489 | }; | ||
14092 | } | 14490 | } |
14093 | 14491 | ||
14094 | /** | 14492 | /** |
14095 | * Enqueues setting the text content. | 14493 | * Make an update for setting the text content. |
14096 | * | 14494 | * |
14097 | * @param {string} parentID ID of the parent component. | ||
14098 | * @param {string} textContent Text content to set. | 14495 | * @param {string} textContent Text content to set. |
14099 | * @private | 14496 | * @private |
14100 | */ | 14497 | */ |
14101 | function enqueueTextContent(parentID, textContent) { | 14498 | function makeTextContent(textContent) { |
14102 | // NOTE: Null values reduce hidden classes. | 14499 | // NOTE: Null values reduce hidden classes. |
14103 | updateQueue.push({ | 14500 | return { |
14104 | parentID: parentID, | ||
14105 | parentNode: null, | ||
14106 | type: ReactMultiChildUpdateTypes.TEXT_CONTENT, | 14501 | type: ReactMultiChildUpdateTypes.TEXT_CONTENT, |
14107 | markupIndex: null, | ||
14108 | content: textContent, | 14502 | content: textContent, |
14109 | fromIndex: null, | 14503 | fromIndex: null, |
14110 | toIndex: null | 14504 | fromNode: null, |
14111 | }); | 14505 | toIndex: null, |
14506 | afterNode: null | ||
14507 | }; | ||
14112 | } | 14508 | } |
14113 | 14509 | ||
14114 | /** | 14510 | /** |
14115 | * Processes any enqueued updates. | 14511 | * Push an update, if any, onto the queue. Creates a new queue if none is |
14116 | * | 14512 | * passed and always returns the queue. Mutative. |
14117 | * @private | ||
14118 | */ | 14513 | */ |
14119 | function processQueue() { | 14514 | function enqueue(queue, update) { |
14120 | if (updateQueue.length) { | 14515 | if (update) { |
14121 | ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue); | 14516 | queue = queue || []; |
14122 | clearQueue(); | 14517 | queue.push(update); |
14123 | } | 14518 | } |
14519 | return queue; | ||
14124 | } | 14520 | } |
14125 | 14521 | ||
14126 | /** | 14522 | /** |
14127 | * Clears any enqueued updates. | 14523 | * Processes any enqueued updates. |
14128 | * | 14524 | * |
14129 | * @private | 14525 | * @private |
14130 | */ | 14526 | */ |
14131 | function clearQueue() { | 14527 | function processQueue(inst, updateQueue) { |
14132 | updateQueue.length = 0; | 14528 | ReactComponentEnvironment.processChildrenUpdates(inst, updateQueue); |
14133 | markupQueue.length = 0; | 14529 | } |
14530 | |||
14531 | var setParentForInstrumentation = emptyFunction; | ||
14532 | var setChildrenForInstrumentation = emptyFunction; | ||
14533 | if (process.env.NODE_ENV !== 'production') { | ||
14534 | var getDebugID = function (inst) { | ||
14535 | if (!inst._debugID) { | ||
14536 | // Check for ART-like instances. TODO: This is silly/gross. | ||
14537 | var internal; | ||
14538 | if (internal = ReactInstanceMap.get(inst)) { | ||
14539 | inst = internal; | ||
14540 | } | ||
14541 | } | ||
14542 | return inst._debugID; | ||
14543 | }; | ||
14544 | setParentForInstrumentation = function (child) { | ||
14545 | if (child._debugID !== 0) { | ||
14546 | ReactInstrumentation.debugTool.onSetParent(child._debugID, getDebugID(this)); | ||
14547 | } | ||
14548 | }; | ||
14549 | setChildrenForInstrumentation = function (children) { | ||
14550 | var debugID = getDebugID(this); | ||
14551 | // TODO: React Native empty components are also multichild. | ||
14552 | // This means they still get into this method but don't have _debugID. | ||
14553 | if (debugID !== 0) { | ||
14554 | ReactInstrumentation.debugTool.onSetChildren(debugID, children ? Object.keys(children).map(function (key) { | ||
14555 | return children[key]._debugID; | ||
14556 | }) : []); | ||
14557 | } | ||
14558 | }; | ||
14134 | } | 14559 | } |
14135 | 14560 | ||
14136 | /** | 14561 | /** |
@@ -14155,7 +14580,7 @@ | |||
14155 | if (this._currentElement) { | 14580 | if (this._currentElement) { |
14156 | try { | 14581 | try { |
14157 | ReactCurrentOwner.current = this._currentElement._owner; | 14582 | ReactCurrentOwner.current = this._currentElement._owner; |
14158 | return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context); | 14583 | return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context, this._debugID); |
14159 | } finally { | 14584 | } finally { |
14160 | ReactCurrentOwner.current = null; | 14585 | ReactCurrentOwner.current = null; |
14161 | } | 14586 | } |
@@ -14164,21 +14589,23 @@ | |||
14164 | return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context); | 14589 | return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context); |
14165 | }, | 14590 | }, |
14166 | 14591 | ||
14167 | _reconcilerUpdateChildren: function (prevChildren, nextNestedChildrenElements, transaction, context) { | 14592 | _reconcilerUpdateChildren: function (prevChildren, nextNestedChildrenElements, mountImages, removedNodes, transaction, context) { |
14168 | var nextChildren; | 14593 | var nextChildren; |
14169 | if (process.env.NODE_ENV !== 'production') { | 14594 | if (process.env.NODE_ENV !== 'production') { |
14170 | if (this._currentElement) { | 14595 | if (this._currentElement) { |
14171 | try { | 14596 | try { |
14172 | ReactCurrentOwner.current = this._currentElement._owner; | 14597 | ReactCurrentOwner.current = this._currentElement._owner; |
14173 | nextChildren = flattenChildren(nextNestedChildrenElements); | 14598 | nextChildren = flattenChildren(nextNestedChildrenElements, this._debugID); |
14174 | } finally { | 14599 | } finally { |
14175 | ReactCurrentOwner.current = null; | 14600 | ReactCurrentOwner.current = null; |
14176 | } | 14601 | } |
14177 | return ReactChildReconciler.updateChildren(prevChildren, nextChildren, transaction, context); | 14602 | ReactChildReconciler.updateChildren(prevChildren, nextChildren, mountImages, removedNodes, transaction, this, this._hostContainerInfo, context); |
14603 | return nextChildren; | ||
14178 | } | 14604 | } |
14179 | } | 14605 | } |
14180 | nextChildren = flattenChildren(nextNestedChildrenElements); | 14606 | nextChildren = flattenChildren(nextNestedChildrenElements); |
14181 | return ReactChildReconciler.updateChildren(prevChildren, nextChildren, transaction, context); | 14607 | ReactChildReconciler.updateChildren(prevChildren, nextChildren, mountImages, removedNodes, transaction, this, this._hostContainerInfo, context); |
14608 | return nextChildren; | ||
14182 | }, | 14609 | }, |
14183 | 14610 | ||
14184 | /** | 14611 | /** |
@@ -14192,18 +14619,25 @@ | |||
14192 | mountChildren: function (nestedChildren, transaction, context) { | 14619 | mountChildren: function (nestedChildren, transaction, context) { |
14193 | var children = this._reconcilerInstantiateChildren(nestedChildren, transaction, context); | 14620 | var children = this._reconcilerInstantiateChildren(nestedChildren, transaction, context); |
14194 | this._renderedChildren = children; | 14621 | this._renderedChildren = children; |
14622 | |||
14195 | var mountImages = []; | 14623 | var mountImages = []; |
14196 | var index = 0; | 14624 | var index = 0; |
14197 | for (var name in children) { | 14625 | for (var name in children) { |
14198 | if (children.hasOwnProperty(name)) { | 14626 | if (children.hasOwnProperty(name)) { |
14199 | var child = children[name]; | 14627 | var child = children[name]; |
14200 | // Inlined for performance, see `ReactInstanceHandles.createReactID`. | 14628 | if (process.env.NODE_ENV !== 'production') { |
14201 | var rootID = this._rootNodeID + name; | 14629 | setParentForInstrumentation.call(this, child); |
14202 | var mountImage = ReactReconciler.mountComponent(child, rootID, transaction, context); | 14630 | } |
14631 | var mountImage = ReactReconciler.mountComponent(child, transaction, this, this._hostContainerInfo, context); | ||
14203 | child._mountIndex = index++; | 14632 | child._mountIndex = index++; |
14204 | mountImages.push(mountImage); | 14633 | mountImages.push(mountImage); |
14205 | } | 14634 | } |
14206 | } | 14635 | } |
14636 | |||
14637 | if (process.env.NODE_ENV !== 'production') { | ||
14638 | setChildrenForInstrumentation.call(this, children); | ||
14639 | } | ||
14640 | |||
14207 | return mountImages; | 14641 | return mountImages; |
14208 | }, | 14642 | }, |
14209 | 14643 | ||
@@ -14214,31 +14648,17 @@ | |||
14214 | * @internal | 14648 | * @internal |
14215 | */ | 14649 | */ |
14216 | updateTextContent: function (nextContent) { | 14650 | updateTextContent: function (nextContent) { |
14217 | updateDepth++; | 14651 | var prevChildren = this._renderedChildren; |
14218 | var errorThrown = true; | 14652 | // Remove any rendered children. |
14219 | try { | 14653 | ReactChildReconciler.unmountChildren(prevChildren, false); |
14220 | var prevChildren = this._renderedChildren; | 14654 | for (var name in prevChildren) { |
14221 | // Remove any rendered children. | 14655 | if (prevChildren.hasOwnProperty(name)) { |
14222 | ReactChildReconciler.unmountChildren(prevChildren); | 14656 | true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'updateTextContent called on non-empty component.') : _prodInvariant('118') : void 0; |
14223 | // TODO: The setTextContent operation should be enough | ||
14224 | for (var name in prevChildren) { | ||
14225 | if (prevChildren.hasOwnProperty(name)) { | ||
14226 | this._unmountChild(prevChildren[name]); | ||
14227 | } | ||
14228 | } | ||
14229 | // Set new text content. | ||
14230 | this.setTextContent(nextContent); | ||
14231 | errorThrown = false; | ||
14232 | } finally { | ||
14233 | updateDepth--; | ||
14234 | if (!updateDepth) { | ||
14235 | if (errorThrown) { | ||
14236 | clearQueue(); | ||
14237 | } else { | ||
14238 | processQueue(); | ||
14239 | } | ||
14240 | } | 14657 | } |
14241 | } | 14658 | } |
14659 | // Set new text content. | ||
14660 | var updates = [makeTextContent(nextContent)]; | ||
14661 | processQueue(this, updates); | ||
14242 | }, | 14662 | }, |
14243 | 14663 | ||
14244 | /** | 14664 | /** |
@@ -14248,29 +14668,16 @@ | |||
14248 | * @internal | 14668 | * @internal |
14249 | */ | 14669 | */ |
14250 | updateMarkup: function (nextMarkup) { | 14670 | updateMarkup: function (nextMarkup) { |
14251 | updateDepth++; | 14671 | var prevChildren = this._renderedChildren; |
14252 | var errorThrown = true; | 14672 | // Remove any rendered children. |
14253 | try { | 14673 | ReactChildReconciler.unmountChildren(prevChildren, false); |
14254 | var prevChildren = this._renderedChildren; | 14674 | for (var name in prevChildren) { |
14255 | // Remove any rendered children. | 14675 | if (prevChildren.hasOwnProperty(name)) { |
14256 | ReactChildReconciler.unmountChildren(prevChildren); | 14676 | true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'updateTextContent called on non-empty component.') : _prodInvariant('118') : void 0; |
14257 | for (var name in prevChildren) { | ||
14258 | if (prevChildren.hasOwnProperty(name)) { | ||
14259 | this._unmountChildByName(prevChildren[name], name); | ||
14260 | } | ||
14261 | } | ||
14262 | this.setMarkup(nextMarkup); | ||
14263 | errorThrown = false; | ||
14264 | } finally { | ||
14265 | updateDepth--; | ||
14266 | if (!updateDepth) { | ||
14267 | if (errorThrown) { | ||
14268 | clearQueue(); | ||
14269 | } else { | ||
14270 | processQueue(); | ||
14271 | } | ||
14272 | } | 14677 | } |
14273 | } | 14678 | } |
14679 | var updates = [makeSetMarkup(nextMarkup)]; | ||
14680 | processQueue(this, updates); | ||
14274 | }, | 14681 | }, |
14275 | 14682 | ||
14276 | /** | 14683 | /** |
@@ -14281,27 +14688,11 @@ | |||
14281 | * @internal | 14688 | * @internal |
14282 | */ | 14689 | */ |
14283 | updateChildren: function (nextNestedChildrenElements, transaction, context) { | 14690 | updateChildren: function (nextNestedChildrenElements, transaction, context) { |
14284 | updateDepth++; | 14691 | // Hook used by React ART |
14285 | var errorThrown = true; | 14692 | this._updateChildren(nextNestedChildrenElements, transaction, context); |
14286 | try { | ||
14287 | this._updateChildren(nextNestedChildrenElements, transaction, context); | ||
14288 | errorThrown = false; | ||
14289 | } finally { | ||
14290 | updateDepth--; | ||
14291 | if (!updateDepth) { | ||
14292 | if (errorThrown) { | ||
14293 | clearQueue(); | ||
14294 | } else { | ||
14295 | processQueue(); | ||
14296 | } | ||
14297 | } | ||
14298 | } | ||
14299 | }, | 14693 | }, |
14300 | 14694 | ||
14301 | /** | 14695 | /** |
14302 | * Improve performance by isolating this hot code path from the try/catch | ||
14303 | * block in `updateChildren`. | ||
14304 | * | ||
14305 | * @param {?object} nextNestedChildrenElements Nested child element maps. | 14696 | * @param {?object} nextNestedChildrenElements Nested child element maps. |
14306 | * @param {ReactReconcileTransaction} transaction | 14697 | * @param {ReactReconcileTransaction} transaction |
14307 | * @final | 14698 | * @final |
@@ -14309,16 +14700,21 @@ | |||
14309 | */ | 14700 | */ |
14310 | _updateChildren: function (nextNestedChildrenElements, transaction, context) { | 14701 | _updateChildren: function (nextNestedChildrenElements, transaction, context) { |
14311 | var prevChildren = this._renderedChildren; | 14702 | var prevChildren = this._renderedChildren; |
14312 | var nextChildren = this._reconcilerUpdateChildren(prevChildren, nextNestedChildrenElements, transaction, context); | 14703 | var removedNodes = {}; |
14313 | this._renderedChildren = nextChildren; | 14704 | var mountImages = []; |
14705 | var nextChildren = this._reconcilerUpdateChildren(prevChildren, nextNestedChildrenElements, mountImages, removedNodes, transaction, context); | ||
14314 | if (!nextChildren && !prevChildren) { | 14706 | if (!nextChildren && !prevChildren) { |
14315 | return; | 14707 | return; |
14316 | } | 14708 | } |
14709 | var updates = null; | ||
14317 | var name; | 14710 | var name; |
14318 | // `nextIndex` will increment for each child in `nextChildren`, but | 14711 | // `nextIndex` will increment for each child in `nextChildren`, but |
14319 | // `lastIndex` will be the last index visited in `prevChildren`. | 14712 | // `lastIndex` will be the last index visited in `prevChildren`. |
14320 | var lastIndex = 0; | ||
14321 | var nextIndex = 0; | 14713 | var nextIndex = 0; |
14714 | var lastIndex = 0; | ||
14715 | // `nextMountIndex` will increment for each newly mounted child. | ||
14716 | var nextMountIndex = 0; | ||
14717 | var lastPlacedNode = null; | ||
14322 | for (name in nextChildren) { | 14718 | for (name in nextChildren) { |
14323 | if (!nextChildren.hasOwnProperty(name)) { | 14719 | if (!nextChildren.hasOwnProperty(name)) { |
14324 | continue; | 14720 | continue; |
@@ -14326,37 +14722,48 @@ | |||
14326 | var prevChild = prevChildren && prevChildren[name]; | 14722 | var prevChild = prevChildren && prevChildren[name]; |
14327 | var nextChild = nextChildren[name]; | 14723 | var nextChild = nextChildren[name]; |
14328 | if (prevChild === nextChild) { | 14724 | if (prevChild === nextChild) { |
14329 | this.moveChild(prevChild, nextIndex, lastIndex); | 14725 | updates = enqueue(updates, this.moveChild(prevChild, lastPlacedNode, nextIndex, lastIndex)); |
14330 | lastIndex = Math.max(prevChild._mountIndex, lastIndex); | 14726 | lastIndex = Math.max(prevChild._mountIndex, lastIndex); |
14331 | prevChild._mountIndex = nextIndex; | 14727 | prevChild._mountIndex = nextIndex; |
14332 | } else { | 14728 | } else { |
14333 | if (prevChild) { | 14729 | if (prevChild) { |
14334 | // Update `lastIndex` before `_mountIndex` gets unset by unmounting. | 14730 | // Update `lastIndex` before `_mountIndex` gets unset by unmounting. |
14335 | lastIndex = Math.max(prevChild._mountIndex, lastIndex); | 14731 | lastIndex = Math.max(prevChild._mountIndex, lastIndex); |
14336 | this._unmountChild(prevChild); | 14732 | // The `removedNodes` loop below will actually remove the child. |
14337 | } | 14733 | } |
14338 | // The child must be instantiated before it's mounted. | 14734 | // The child must be instantiated before it's mounted. |
14339 | this._mountChildByNameAtIndex(nextChild, name, nextIndex, transaction, context); | 14735 | updates = enqueue(updates, this._mountChildAtIndex(nextChild, mountImages[nextMountIndex], lastPlacedNode, nextIndex, transaction, context)); |
14736 | nextMountIndex++; | ||
14340 | } | 14737 | } |
14341 | nextIndex++; | 14738 | nextIndex++; |
14739 | lastPlacedNode = ReactReconciler.getHostNode(nextChild); | ||
14342 | } | 14740 | } |
14343 | // Remove children that are no longer present. | 14741 | // Remove children that are no longer present. |
14344 | for (name in prevChildren) { | 14742 | for (name in removedNodes) { |
14345 | if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) { | 14743 | if (removedNodes.hasOwnProperty(name)) { |
14346 | this._unmountChild(prevChildren[name]); | 14744 | updates = enqueue(updates, this._unmountChild(prevChildren[name], removedNodes[name])); |
14347 | } | 14745 | } |
14348 | } | 14746 | } |
14747 | if (updates) { | ||
14748 | processQueue(this, updates); | ||
14749 | } | ||
14750 | this._renderedChildren = nextChildren; | ||
14751 | |||
14752 | if (process.env.NODE_ENV !== 'production') { | ||
14753 | setChildrenForInstrumentation.call(this, nextChildren); | ||
14754 | } | ||
14349 | }, | 14755 | }, |
14350 | 14756 | ||
14351 | /** | 14757 | /** |
14352 | * Unmounts all rendered children. This should be used to clean up children | 14758 | * Unmounts all rendered children. This should be used to clean up children |
14353 | * when this component is unmounted. | 14759 | * when this component is unmounted. It does not actually perform any |
14760 | * backend operations. | ||
14354 | * | 14761 | * |
14355 | * @internal | 14762 | * @internal |
14356 | */ | 14763 | */ |
14357 | unmountChildren: function () { | 14764 | unmountChildren: function (safely) { |
14358 | var renderedChildren = this._renderedChildren; | 14765 | var renderedChildren = this._renderedChildren; |
14359 | ReactChildReconciler.unmountChildren(renderedChildren); | 14766 | ReactChildReconciler.unmountChildren(renderedChildren, safely); |
14360 | this._renderedChildren = null; | 14767 | this._renderedChildren = null; |
14361 | }, | 14768 | }, |
14362 | 14769 | ||
@@ -14368,12 +14775,12 @@ | |||
14368 | * @param {number} lastIndex Last index visited of the siblings of `child`. | 14775 | * @param {number} lastIndex Last index visited of the siblings of `child`. |
14369 | * @protected | 14776 | * @protected |
14370 | */ | 14777 | */ |
14371 | moveChild: function (child, toIndex, lastIndex) { | 14778 | moveChild: function (child, afterNode, toIndex, lastIndex) { |
14372 | // If the index of `child` is less than `lastIndex`, then it needs to | 14779 | // If the index of `child` is less than `lastIndex`, then it needs to |
14373 | // be moved. Otherwise, we do not need to move it because a child will be | 14780 | // be moved. Otherwise, we do not need to move it because a child will be |
14374 | // inserted or moved before `child`. | 14781 | // inserted or moved before `child`. |
14375 | if (child._mountIndex < lastIndex) { | 14782 | if (child._mountIndex < lastIndex) { |
14376 | enqueueMove(this._rootNodeID, child._mountIndex, toIndex); | 14783 | return makeMove(child, afterNode, toIndex); |
14377 | } | 14784 | } |
14378 | }, | 14785 | }, |
14379 | 14786 | ||
@@ -14384,8 +14791,8 @@ | |||
14384 | * @param {string} mountImage Markup to insert. | 14791 | * @param {string} mountImage Markup to insert. |
14385 | * @protected | 14792 | * @protected |
14386 | */ | 14793 | */ |
14387 | createChild: function (child, mountImage) { | 14794 | createChild: function (child, afterNode, mountImage) { |
14388 | enqueueInsertMarkup(this._rootNodeID, mountImage, child._mountIndex); | 14795 | return makeInsertMarkup(mountImage, afterNode, child._mountIndex); |
14389 | }, | 14796 | }, |
14390 | 14797 | ||
14391 | /** | 14798 | /** |
@@ -14394,28 +14801,8 @@ | |||
14394 | * @param {ReactComponent} child Child to remove. | 14801 | * @param {ReactComponent} child Child to remove. |
14395 | * @protected | 14802 | * @protected |
14396 | */ | 14803 | */ |
14397 | removeChild: function (child) { | 14804 | removeChild: function (child, node) { |
14398 | enqueueRemove(this._rootNodeID, child._mountIndex); | 14805 | return makeRemove(child, node); |
14399 | }, | ||
14400 | |||
14401 | /** | ||
14402 | * Sets this text content string. | ||
14403 | * | ||
14404 | * @param {string} textContent Text content to set. | ||
14405 | * @protected | ||
14406 | */ | ||
14407 | setTextContent: function (textContent) { | ||
14408 | enqueueTextContent(this._rootNodeID, textContent); | ||
14409 | }, | ||
14410 | |||
14411 | /** | ||
14412 | * Sets this markup string. | ||
14413 | * | ||
14414 | * @param {string} markup Markup to set. | ||
14415 | * @protected | ||
14416 | */ | ||
14417 | setMarkup: function (markup) { | ||
14418 | enqueueSetMarkup(this._rootNodeID, markup); | ||
14419 | }, | 14806 | }, |
14420 | 14807 | ||
14421 | /** | 14808 | /** |
@@ -14429,12 +14816,9 @@ | |||
14429 | * @param {ReactReconcileTransaction} transaction | 14816 | * @param {ReactReconcileTransaction} transaction |
14430 | * @private | 14817 | * @private |
14431 | */ | 14818 | */ |
14432 | _mountChildByNameAtIndex: function (child, name, index, transaction, context) { | 14819 | _mountChildAtIndex: function (child, mountImage, afterNode, index, transaction, context) { |
14433 | // Inlined for performance, see `ReactInstanceHandles.createReactID`. | ||
14434 | var rootID = this._rootNodeID + name; | ||
14435 | var mountImage = ReactReconciler.mountComponent(child, rootID, transaction, context); | ||
14436 | child._mountIndex = index; | 14820 | child._mountIndex = index; |
14437 | this.createChild(child, mountImage); | 14821 | return this.createChild(child, afterNode, mountImage); |
14438 | }, | 14822 | }, |
14439 | 14823 | ||
14440 | /** | 14824 | /** |
@@ -14445,9 +14829,10 @@ | |||
14445 | * @param {ReactComponent} child Component to unmount. | 14829 | * @param {ReactComponent} child Component to unmount. |
14446 | * @private | 14830 | * @private |
14447 | */ | 14831 | */ |
14448 | _unmountChild: function (child) { | 14832 | _unmountChild: function (child, node) { |
14449 | this.removeChild(child); | 14833 | var update = this.removeChild(child, node); |
14450 | child._mountIndex = null; | 14834 | child._mountIndex = null; |
14835 | return update; | ||
14451 | } | 14836 | } |
14452 | 14837 | ||
14453 | } | 14838 | } |
@@ -14455,14 +14840,126 @@ | |||
14455 | }; | 14840 | }; |
14456 | 14841 | ||
14457 | module.exports = ReactMultiChild; | 14842 | module.exports = ReactMultiChild; |
14458 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | 14843 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) |
14459 | 14844 | ||
14460 | /***/ }, | 14845 | /***/ }, |
14461 | /* 117 */ | 14846 | /* 125 */ |
14462 | /***/ function(module, exports, __webpack_require__) { | 14847 | /***/ function(module, exports, __webpack_require__) { |
14463 | 14848 | ||
14464 | /* WEBPACK VAR INJECTION */(function(process) {/** | 14849 | /* WEBPACK VAR INJECTION */(function(process) {/** |
14465 | * Copyright 2014-2015, Facebook, Inc. | 14850 | * Copyright 2014-present, Facebook, Inc. |
14851 | * All rights reserved. | ||
14852 | * | ||
14853 | * This source code is licensed under the BSD-style license found in the | ||
14854 | * LICENSE file in the root directory of this source tree. An additional grant | ||
14855 | * of patent rights can be found in the PATENTS file in the same directory. | ||
14856 | * | ||
14857 | * @providesModule ReactComponentEnvironment | ||
14858 | */ | ||
14859 | |||
14860 | 'use strict'; | ||
14861 | |||
14862 | var _prodInvariant = __webpack_require__(9); | ||
14863 | |||
14864 | var invariant = __webpack_require__(10); | ||
14865 | |||
14866 | var injected = false; | ||
14867 | |||
14868 | var ReactComponentEnvironment = { | ||
14869 | |||
14870 | /** | ||
14871 | * Optionally injectable environment dependent cleanup hook. (server vs. | ||
14872 | * browser etc). Example: A browser system caches DOM nodes based on component | ||
14873 | * ID and must remove that cache entry when this instance is unmounted. | ||
14874 | */ | ||
14875 | unmountIDFromEnvironment: null, | ||
14876 | |||
14877 | /** | ||
14878 | * Optionally injectable hook for swapping out mount images in the middle of | ||
14879 | * the tree. | ||
14880 | */ | ||
14881 | replaceNodeWithMarkup: null, | ||
14882 | |||
14883 | /** | ||
14884 | * Optionally injectable hook for processing a queue of child updates. Will | ||
14885 | * later move into MultiChildComponents. | ||
14886 | */ | ||
14887 | processChildrenUpdates: null, | ||
14888 | |||
14889 | injection: { | ||
14890 | injectEnvironment: function (environment) { | ||
14891 | !!injected ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactCompositeComponent: injectEnvironment() can only be called once.') : _prodInvariant('104') : void 0; | ||
14892 | ReactComponentEnvironment.unmountIDFromEnvironment = environment.unmountIDFromEnvironment; | ||
14893 | ReactComponentEnvironment.replaceNodeWithMarkup = environment.replaceNodeWithMarkup; | ||
14894 | ReactComponentEnvironment.processChildrenUpdates = environment.processChildrenUpdates; | ||
14895 | injected = true; | ||
14896 | } | ||
14897 | } | ||
14898 | |||
14899 | }; | ||
14900 | |||
14901 | module.exports = ReactComponentEnvironment; | ||
14902 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
14903 | |||
14904 | /***/ }, | ||
14905 | /* 126 */ | ||
14906 | /***/ function(module, exports) { | ||
14907 | |||
14908 | /** | ||
14909 | * Copyright 2013-present, Facebook, Inc. | ||
14910 | * All rights reserved. | ||
14911 | * | ||
14912 | * This source code is licensed under the BSD-style license found in the | ||
14913 | * LICENSE file in the root directory of this source tree. An additional grant | ||
14914 | * of patent rights can be found in the PATENTS file in the same directory. | ||
14915 | * | ||
14916 | * @providesModule ReactInstanceMap | ||
14917 | */ | ||
14918 | |||
14919 | 'use strict'; | ||
14920 | |||
14921 | /** | ||
14922 | * `ReactInstanceMap` maintains a mapping from a public facing stateful | ||
14923 | * instance (key) and the internal representation (value). This allows public | ||
14924 | * methods to accept the user facing instance as an argument and map them back | ||
14925 | * to internal methods. | ||
14926 | */ | ||
14927 | |||
14928 | // TODO: Replace this with ES6: var ReactInstanceMap = new Map(); | ||
14929 | |||
14930 | var ReactInstanceMap = { | ||
14931 | |||
14932 | /** | ||
14933 | * This API should be called `delete` but we'd have to make sure to always | ||
14934 | * transform these to strings for IE support. When this transform is fully | ||
14935 | * supported we can rename it. | ||
14936 | */ | ||
14937 | remove: function (key) { | ||
14938 | key._reactInternalInstance = undefined; | ||
14939 | }, | ||
14940 | |||
14941 | get: function (key) { | ||
14942 | return key._reactInternalInstance; | ||
14943 | }, | ||
14944 | |||
14945 | has: function (key) { | ||
14946 | return key._reactInternalInstance !== undefined; | ||
14947 | }, | ||
14948 | |||
14949 | set: function (key, value) { | ||
14950 | key._reactInternalInstance = value; | ||
14951 | } | ||
14952 | |||
14953 | }; | ||
14954 | |||
14955 | module.exports = ReactInstanceMap; | ||
14956 | |||
14957 | /***/ }, | ||
14958 | /* 127 */ | ||
14959 | /***/ function(module, exports, __webpack_require__) { | ||
14960 | |||
14961 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
14962 | * Copyright 2014-present, Facebook, Inc. | ||
14466 | * All rights reserved. | 14963 | * All rights reserved. |
14467 | * | 14964 | * |
14468 | * This source code is licensed under the BSD-style license found in the | 14965 | * This source code is licensed under the BSD-style license found in the |
@@ -14470,26 +14967,40 @@ | |||
14470 | * of patent rights can be found in the PATENTS file in the same directory. | 14967 | * of patent rights can be found in the PATENTS file in the same directory. |
14471 | * | 14968 | * |
14472 | * @providesModule ReactChildReconciler | 14969 | * @providesModule ReactChildReconciler |
14473 | * @typechecks static-only | ||
14474 | */ | 14970 | */ |
14475 | 14971 | ||
14476 | 'use strict'; | 14972 | 'use strict'; |
14477 | 14973 | ||
14478 | var ReactReconciler = __webpack_require__(52); | 14974 | var ReactReconciler = __webpack_require__(62); |
14975 | |||
14976 | var instantiateReactComponent = __webpack_require__(128); | ||
14977 | var KeyEscapeUtils = __webpack_require__(18); | ||
14978 | var shouldUpdateReactComponent = __webpack_require__(132); | ||
14979 | var traverseAllChildren = __webpack_require__(16); | ||
14980 | var warning = __webpack_require__(13); | ||
14479 | 14981 | ||
14480 | var instantiateReactComponent = __webpack_require__(64); | 14982 | var ReactComponentTreeDevtool; |
14481 | var shouldUpdateReactComponent = __webpack_require__(69); | ||
14482 | var traverseAllChildren = __webpack_require__(113); | ||
14483 | var warning = __webpack_require__(27); | ||
14484 | 14983 | ||
14485 | function instantiateChild(childInstances, child, name) { | 14984 | if (typeof process !== 'undefined' && process.env && process.env.NODE_ENV === 'test') { |
14985 | // Temporary hack. | ||
14986 | // Inline requires don't work well with Jest: | ||
14987 | // https://github.com/facebook/react/issues/7240 | ||
14988 | // Remove the inline requires when we don't need them anymore: | ||
14989 | // https://github.com/facebook/react/pull/7178 | ||
14990 | ReactComponentTreeDevtool = __webpack_require__(31); | ||
14991 | } | ||
14992 | |||
14993 | function instantiateChild(childInstances, child, name, selfDebugID) { | ||
14486 | // We found a component instance. | 14994 | // We found a component instance. |
14487 | var keyUnique = childInstances[name] === undefined; | 14995 | var keyUnique = childInstances[name] === undefined; |
14488 | if (process.env.NODE_ENV !== 'production') { | 14996 | if (process.env.NODE_ENV !== 'production') { |
14489 | process.env.NODE_ENV !== 'production' ? warning(keyUnique, '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.', name) : undefined; | 14997 | if (!ReactComponentTreeDevtool) { |
14998 | ReactComponentTreeDevtool = __webpack_require__(31); | ||
14999 | } | ||
15000 | process.env.NODE_ENV !== 'production' ? warning(keyUnique, '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), ReactComponentTreeDevtool.getStackAddendumByID(selfDebugID)) : void 0; | ||
14490 | } | 15001 | } |
14491 | if (child != null && keyUnique) { | 15002 | if (child != null && keyUnique) { |
14492 | childInstances[name] = instantiateReactComponent(child, null); | 15003 | childInstances[name] = instantiateReactComponent(child, true); |
14493 | } | 15004 | } |
14494 | } | 15005 | } |
14495 | 15006 | ||
@@ -14507,12 +15018,20 @@ | |||
14507 | * @return {?object} A set of child instances. | 15018 | * @return {?object} A set of child instances. |
14508 | * @internal | 15019 | * @internal |
14509 | */ | 15020 | */ |
14510 | instantiateChildren: function (nestedChildNodes, transaction, context) { | 15021 | instantiateChildren: function (nestedChildNodes, transaction, context, selfDebugID // __DEV__ only |
15022 | ) { | ||
14511 | if (nestedChildNodes == null) { | 15023 | if (nestedChildNodes == null) { |
14512 | return null; | 15024 | return null; |
14513 | } | 15025 | } |
14514 | var childInstances = {}; | 15026 | var childInstances = {}; |
14515 | traverseAllChildren(nestedChildNodes, instantiateChild, childInstances); | 15027 | |
15028 | if (process.env.NODE_ENV !== 'production') { | ||
15029 | traverseAllChildren(nestedChildNodes, function (childInsts, child, name) { | ||
15030 | return instantiateChild(childInsts, child, name, selfDebugID); | ||
15031 | }, childInstances); | ||
15032 | } else { | ||
15033 | traverseAllChildren(nestedChildNodes, instantiateChild, childInstances); | ||
15034 | } | ||
14516 | return childInstances; | 15035 | return childInstances; |
14517 | }, | 15036 | }, |
14518 | 15037 | ||
@@ -14526,21 +15045,22 @@ | |||
14526 | * @return {?object} A new set of child instances. | 15045 | * @return {?object} A new set of child instances. |
14527 | * @internal | 15046 | * @internal |
14528 | */ | 15047 | */ |
14529 | updateChildren: function (prevChildren, nextChildren, transaction, context) { | 15048 | updateChildren: function (prevChildren, nextChildren, mountImages, removedNodes, transaction, hostParent, hostContainerInfo, context) { |
14530 | // We currently don't have a way to track moves here but if we use iterators | 15049 | // We currently don't have a way to track moves here but if we use iterators |
14531 | // instead of for..in we can zip the iterators and check if an item has | 15050 | // instead of for..in we can zip the iterators and check if an item has |
14532 | // moved. | 15051 | // moved. |
14533 | // TODO: If nothing has changed, return the prevChildren object so that we | 15052 | // TODO: If nothing has changed, return the prevChildren object so that we |
14534 | // can quickly bailout if nothing has changed. | 15053 | // can quickly bailout if nothing has changed. |
14535 | if (!nextChildren && !prevChildren) { | 15054 | if (!nextChildren && !prevChildren) { |
14536 | return null; | 15055 | return; |
14537 | } | 15056 | } |
14538 | var name; | 15057 | var name; |
15058 | var prevChild; | ||
14539 | for (name in nextChildren) { | 15059 | for (name in nextChildren) { |
14540 | if (!nextChildren.hasOwnProperty(name)) { | 15060 | if (!nextChildren.hasOwnProperty(name)) { |
14541 | continue; | 15061 | continue; |
14542 | } | 15062 | } |
14543 | var prevChild = prevChildren && prevChildren[name]; | 15063 | prevChild = prevChildren && prevChildren[name]; |
14544 | var prevElement = prevChild && prevChild._currentElement; | 15064 | var prevElement = prevChild && prevChild._currentElement; |
14545 | var nextElement = nextChildren[name]; | 15065 | var nextElement = nextChildren[name]; |
14546 | if (prevChild != null && shouldUpdateReactComponent(prevElement, nextElement)) { | 15066 | if (prevChild != null && shouldUpdateReactComponent(prevElement, nextElement)) { |
@@ -14548,20 +15068,26 @@ | |||
14548 | nextChildren[name] = prevChild; | 15068 | nextChildren[name] = prevChild; |
14549 | } else { | 15069 | } else { |
14550 | if (prevChild) { | 15070 | if (prevChild) { |
14551 | ReactReconciler.unmountComponent(prevChild, name); | 15071 | removedNodes[name] = ReactReconciler.getHostNode(prevChild); |
15072 | ReactReconciler.unmountComponent(prevChild, false); | ||
14552 | } | 15073 | } |
14553 | // The child must be instantiated before it's mounted. | 15074 | // The child must be instantiated before it's mounted. |
14554 | var nextChildInstance = instantiateReactComponent(nextElement, null); | 15075 | var nextChildInstance = instantiateReactComponent(nextElement, true); |
14555 | nextChildren[name] = nextChildInstance; | 15076 | nextChildren[name] = nextChildInstance; |
15077 | // Creating mount image now ensures refs are resolved in right order | ||
15078 | // (see https://github.com/facebook/react/pull/7101 for explanation). | ||
15079 | var nextChildMountImage = ReactReconciler.mountComponent(nextChildInstance, transaction, hostParent, hostContainerInfo, context); | ||
15080 | mountImages.push(nextChildMountImage); | ||
14556 | } | 15081 | } |
14557 | } | 15082 | } |
14558 | // Unmount children that are no longer present. | 15083 | // Unmount children that are no longer present. |
14559 | for (name in prevChildren) { | 15084 | for (name in prevChildren) { |
14560 | if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) { | 15085 | if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) { |
14561 | ReactReconciler.unmountComponent(prevChildren[name]); | 15086 | prevChild = prevChildren[name]; |
15087 | removedNodes[name] = ReactReconciler.getHostNode(prevChild); | ||
15088 | ReactReconciler.unmountComponent(prevChild, false); | ||
14562 | } | 15089 | } |
14563 | } | 15090 | } |
14564 | return nextChildren; | ||
14565 | }, | 15091 | }, |
14566 | 15092 | ||
14567 | /** | 15093 | /** |
@@ -14571,11 +15097,11 @@ | |||
14571 | * @param {?object} renderedChildren Previously initialized set of children. | 15097 | * @param {?object} renderedChildren Previously initialized set of children. |
14572 | * @internal | 15098 | * @internal |
14573 | */ | 15099 | */ |
14574 | unmountChildren: function (renderedChildren) { | 15100 | unmountChildren: function (renderedChildren, safely) { |
14575 | for (var name in renderedChildren) { | 15101 | for (var name in renderedChildren) { |
14576 | if (renderedChildren.hasOwnProperty(name)) { | 15102 | if (renderedChildren.hasOwnProperty(name)) { |
14577 | var renderedChild = renderedChildren[name]; | 15103 | var renderedChild = renderedChildren[name]; |
14578 | ReactReconciler.unmountComponent(renderedChild); | 15104 | ReactReconciler.unmountComponent(renderedChild, safely); |
14579 | } | 15105 | } |
14580 | } | 15106 | } |
14581 | } | 15107 | } |
@@ -14583,1544 +15109,3119 @@ | |||
14583 | }; | 15109 | }; |
14584 | 15110 | ||
14585 | module.exports = ReactChildReconciler; | 15111 | module.exports = ReactChildReconciler; |
14586 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | 15112 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) |
14587 | 15113 | ||
14588 | /***/ }, | 15114 | /***/ }, |
14589 | /* 118 */ | 15115 | /* 128 */ |
14590 | /***/ function(module, exports, __webpack_require__) { | 15116 | /***/ function(module, exports, __webpack_require__) { |
14591 | 15117 | ||
14592 | /* WEBPACK VAR INJECTION */(function(process) {/** | 15118 | /* WEBPACK VAR INJECTION */(function(process) {/** |
14593 | * Copyright 2013-2015, Facebook, Inc. | 15119 | * Copyright 2013-present, Facebook, Inc. |
14594 | * All rights reserved. | 15120 | * All rights reserved. |
14595 | * | 15121 | * |
14596 | * This source code is licensed under the BSD-style license found in the | 15122 | * This source code is licensed under the BSD-style license found in the |
14597 | * LICENSE file in the root directory of this source tree. An additional grant | 15123 | * LICENSE file in the root directory of this source tree. An additional grant |
14598 | * of patent rights can be found in the PATENTS file in the same directory. | 15124 | * of patent rights can be found in the PATENTS file in the same directory. |
14599 | * | 15125 | * |
14600 | * @providesModule flattenChildren | 15126 | * @providesModule instantiateReactComponent |
14601 | */ | 15127 | */ |
14602 | 15128 | ||
14603 | 'use strict'; | 15129 | 'use strict'; |
14604 | 15130 | ||
14605 | var traverseAllChildren = __webpack_require__(113); | 15131 | var _prodInvariant = __webpack_require__(9), |
14606 | var warning = __webpack_require__(27); | 15132 | _assign = __webpack_require__(6); |
14607 | 15133 | ||
14608 | /** | 15134 | var ReactCompositeComponent = __webpack_require__(129); |
14609 | * @param {function} traverseContext Context passed through traversal. | 15135 | var ReactEmptyComponent = __webpack_require__(133); |
14610 | * @param {?ReactComponent} child React child component. | 15136 | var ReactHostComponent = __webpack_require__(134); |
14611 | * @param {!string} name String name of key path to child. | 15137 | var ReactInstrumentation = __webpack_require__(65); |
14612 | */ | 15138 | |
14613 | function flattenSingleChildIntoContext(traverseContext, child, name) { | 15139 | var invariant = __webpack_require__(10); |
14614 | // We found a component instance. | 15140 | var warning = __webpack_require__(13); |
14615 | var result = traverseContext; | 15141 | |
14616 | var keyUnique = result[name] === undefined; | 15142 | // To avoid a cyclic dependency, we create the final class in this module |
14617 | if (process.env.NODE_ENV !== 'production') { | 15143 | var ReactCompositeComponentWrapper = function (element) { |
14618 | process.env.NODE_ENV !== 'production' ? warning(keyUnique, '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.', name) : undefined; | 15144 | this.construct(element); |
15145 | }; | ||
15146 | _assign(ReactCompositeComponentWrapper.prototype, ReactCompositeComponent.Mixin, { | ||
15147 | _instantiateReactComponent: instantiateReactComponent | ||
15148 | }); | ||
15149 | |||
15150 | function getDeclarationErrorAddendum(owner) { | ||
15151 | if (owner) { | ||
15152 | var name = owner.getName(); | ||
15153 | if (name) { | ||
15154 | return ' Check the render method of `' + name + '`.'; | ||
15155 | } | ||
14619 | } | 15156 | } |
14620 | if (keyUnique && child != null) { | 15157 | return ''; |
14621 | result[name] = child; | 15158 | } |
15159 | |||
15160 | function getDisplayName(instance) { | ||
15161 | var element = instance._currentElement; | ||
15162 | if (element == null) { | ||
15163 | return '#empty'; | ||
15164 | } else if (typeof element === 'string' || typeof element === 'number') { | ||
15165 | return '#text'; | ||
15166 | } else if (typeof element.type === 'string') { | ||
15167 | return element.type; | ||
15168 | } else if (instance.getName) { | ||
15169 | return instance.getName() || 'Unknown'; | ||
15170 | } else { | ||
15171 | return element.type.displayName || element.type.name || 'Unknown'; | ||
14622 | } | 15172 | } |
14623 | } | 15173 | } |
14624 | 15174 | ||
14625 | /** | 15175 | /** |
14626 | * Flattens children that are typically specified as `props.children`. Any null | 15176 | * Check if the type reference is a known internal type. I.e. not a user |
14627 | * children will not be included in the resulting object. | 15177 | * provided composite type. |
14628 | * @return {!object} flattened children keyed by name. | 15178 | * |
15179 | * @param {function} type | ||
15180 | * @return {boolean} Returns true if this is a valid internal type. | ||
14629 | */ | 15181 | */ |
14630 | function flattenChildren(children) { | 15182 | function isInternalComponentType(type) { |
14631 | if (children == null) { | 15183 | return typeof type === 'function' && typeof type.prototype !== 'undefined' && typeof type.prototype.mountComponent === 'function' && typeof type.prototype.receiveComponent === 'function'; |
14632 | return children; | ||
14633 | } | ||
14634 | var result = {}; | ||
14635 | traverseAllChildren(children, flattenSingleChildIntoContext, result); | ||
14636 | return result; | ||
14637 | } | 15184 | } |
14638 | 15185 | ||
14639 | module.exports = flattenChildren; | 15186 | var nextDebugID = 1; |
14640 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | 15187 | |
14641 | |||
14642 | /***/ }, | ||
14643 | /* 119 */ | ||
14644 | /***/ function(module, exports) { | ||
14645 | |||
14646 | /** | 15188 | /** |
14647 | * Copyright 2013-2015, Facebook, Inc. | 15189 | * Given a ReactNode, create an instance that will actually be mounted. |
14648 | * All rights reserved. | ||
14649 | * | ||
14650 | * This source code is licensed under the BSD-style license found in the | ||
14651 | * LICENSE file in the root directory of this source tree. An additional grant | ||
14652 | * of patent rights can be found in the PATENTS file in the same directory. | ||
14653 | * | 15190 | * |
14654 | * @providesModule shallowEqual | 15191 | * @param {ReactNode} node |
14655 | * @typechecks | 15192 | * @param {boolean} shouldHaveDebugID |
14656 | * | 15193 | * @return {object} A new instance of the element's constructor. |
15194 | * @protected | ||
14657 | */ | 15195 | */ |
15196 | function instantiateReactComponent(node, shouldHaveDebugID) { | ||
15197 | var instance; | ||
14658 | 15198 | ||
14659 | 'use strict'; | 15199 | if (node === null || node === false) { |
15200 | instance = ReactEmptyComponent.create(instantiateReactComponent); | ||
15201 | } else if (typeof node === 'object') { | ||
15202 | var element = node; | ||
15203 | !(element && (typeof element.type === 'function' || typeof element.type === 'string')) ? 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', element.type == null ? element.type : typeof element.type, getDeclarationErrorAddendum(element._owner)) : _prodInvariant('130', element.type == null ? element.type : typeof element.type, getDeclarationErrorAddendum(element._owner)) : void 0; | ||
14660 | 15204 | ||
14661 | var hasOwnProperty = Object.prototype.hasOwnProperty; | 15205 | // Special case string values |
15206 | if (typeof element.type === 'string') { | ||
15207 | instance = ReactHostComponent.createInternalComponent(element); | ||
15208 | } else if (isInternalComponentType(element.type)) { | ||
15209 | // This is temporarily available for custom components that are not string | ||
15210 | // representations. I.e. ART. Once those are updated to use the string | ||
15211 | // representation, we can drop this code path. | ||
15212 | instance = new element.type(element); | ||
14662 | 15213 | ||
14663 | /** | 15214 | // We renamed this. Allow the old name for compat. :( |
14664 | * Performs equality by iterating through keys on an object and returning false | 15215 | if (!instance.getHostNode) { |
14665 | * when any key has values which are not strictly equal between the arguments. | 15216 | instance.getHostNode = instance.getNativeNode; |
14666 | * Returns true when the values of all keys are strictly equal. | 15217 | } |
14667 | */ | 15218 | } else { |
14668 | function shallowEqual(objA, objB) { | 15219 | instance = new ReactCompositeComponentWrapper(element); |
14669 | if (objA === objB) { | 15220 | } |
14670 | return true; | 15221 | } else if (typeof node === 'string' || typeof node === 'number') { |
15222 | instance = ReactHostComponent.createInstanceForText(node); | ||
15223 | } else { | ||
15224 | true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Encountered invalid React node of type %s', typeof node) : _prodInvariant('131', typeof node) : void 0; | ||
14671 | } | 15225 | } |
14672 | 15226 | ||
14673 | if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) { | 15227 | if (process.env.NODE_ENV !== 'production') { |
14674 | return false; | 15228 | 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; |
14675 | } | 15229 | } |
14676 | 15230 | ||
14677 | var keysA = Object.keys(objA); | 15231 | // These two fields are used by the DOM and ART diffing algorithms |
14678 | var keysB = Object.keys(objB); | 15232 | // respectively. Instead of using expandos on components, we should be |
15233 | // storing the state needed by the diffing algorithms elsewhere. | ||
15234 | instance._mountIndex = 0; | ||
15235 | instance._mountImage = null; | ||
14679 | 15236 | ||
14680 | if (keysA.length !== keysB.length) { | 15237 | if (process.env.NODE_ENV !== 'production') { |
14681 | return false; | 15238 | if (shouldHaveDebugID) { |
15239 | var debugID = nextDebugID++; | ||
15240 | instance._debugID = debugID; | ||
15241 | var displayName = getDisplayName(instance); | ||
15242 | ReactInstrumentation.debugTool.onSetDisplayName(debugID, displayName); | ||
15243 | var owner = node && node._owner; | ||
15244 | if (owner) { | ||
15245 | ReactInstrumentation.debugTool.onSetOwner(debugID, owner._debugID); | ||
15246 | } | ||
15247 | } else { | ||
15248 | instance._debugID = 0; | ||
15249 | } | ||
14682 | } | 15250 | } |
14683 | 15251 | ||
14684 | // Test for A's keys different from B. | 15252 | // Internal instances should fully constructed at this point, so they should |
14685 | var bHasOwnProperty = hasOwnProperty.bind(objB); | 15253 | // not get any new fields added to them at this point. |
14686 | for (var i = 0; i < keysA.length; i++) { | 15254 | if (process.env.NODE_ENV !== 'production') { |
14687 | if (!bHasOwnProperty(keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) { | 15255 | if (Object.preventExtensions) { |
14688 | return false; | 15256 | Object.preventExtensions(instance); |
14689 | } | 15257 | } |
14690 | } | 15258 | } |
14691 | 15259 | ||
14692 | return true; | 15260 | return instance; |
14693 | } | 15261 | } |
14694 | 15262 | ||
14695 | module.exports = shallowEqual; | 15263 | module.exports = instantiateReactComponent; |
15264 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
14696 | 15265 | ||
14697 | /***/ }, | 15266 | /***/ }, |
14698 | /* 120 */ | 15267 | /* 129 */ |
14699 | /***/ function(module, exports, __webpack_require__) { | 15268 | /***/ function(module, exports, __webpack_require__) { |
14700 | 15269 | ||
14701 | /** | 15270 | /* WEBPACK VAR INJECTION */(function(process) {/** |
14702 | * Copyright 2013-2015, Facebook, Inc. | 15271 | * Copyright 2013-present, Facebook, Inc. |
14703 | * All rights reserved. | 15272 | * All rights reserved. |
14704 | * | 15273 | * |
14705 | * This source code is licensed under the BSD-style license found in the | 15274 | * This source code is licensed under the BSD-style license found in the |
14706 | * LICENSE file in the root directory of this source tree. An additional grant | 15275 | * LICENSE file in the root directory of this source tree. An additional grant |
14707 | * of patent rights can be found in the PATENTS file in the same directory. | 15276 | * of patent rights can be found in the PATENTS file in the same directory. |
14708 | * | 15277 | * |
14709 | * @providesModule ReactEventListener | 15278 | * @providesModule ReactCompositeComponent |
14710 | * @typechecks static-only | ||
14711 | */ | 15279 | */ |
14712 | 15280 | ||
14713 | 'use strict'; | 15281 | 'use strict'; |
14714 | 15282 | ||
14715 | var EventListener = __webpack_require__(121); | 15283 | var _prodInvariant = __webpack_require__(9), |
14716 | var ExecutionEnvironment = __webpack_require__(11); | 15284 | _assign = __webpack_require__(6); |
14717 | var PooledClass = __webpack_require__(58); | 15285 | |
14718 | var ReactInstanceHandles = __webpack_require__(47); | 15286 | var ReactComponentEnvironment = __webpack_require__(125); |
14719 | var ReactMount = __webpack_require__(30); | 15287 | var ReactCurrentOwner = __webpack_require__(12); |
14720 | var ReactUpdates = __webpack_require__(56); | 15288 | var ReactElement = __webpack_require__(11); |
14721 | 15289 | var ReactErrorUtils = __webpack_require__(49); | |
14722 | var assign = __webpack_require__(41); | 15290 | var ReactInstanceMap = __webpack_require__(126); |
14723 | var getEventTarget = __webpack_require__(83); | 15291 | var ReactInstrumentation = __webpack_require__(65); |
14724 | var getUnboundedScrollPosition = __webpack_require__(122); | 15292 | var ReactNodeTypes = __webpack_require__(130); |
15293 | var ReactPropTypeLocations = __webpack_require__(24); | ||
15294 | var ReactReconciler = __webpack_require__(62); | ||
15295 | |||
15296 | var checkReactTypeSpec = __webpack_require__(32); | ||
15297 | var emptyObject = __webpack_require__(21); | ||
15298 | var invariant = __webpack_require__(10); | ||
15299 | var shallowEqual = __webpack_require__(131); | ||
15300 | var shouldUpdateReactComponent = __webpack_require__(132); | ||
15301 | var warning = __webpack_require__(13); | ||
15302 | |||
15303 | var CompositeTypes = { | ||
15304 | ImpureClass: 0, | ||
15305 | PureClass: 1, | ||
15306 | StatelessFunctional: 2 | ||
15307 | }; | ||
14725 | 15308 | ||
14726 | var DOCUMENT_FRAGMENT_NODE_TYPE = 11; | 15309 | function StatelessComponent(Component) {} |
15310 | StatelessComponent.prototype.render = function () { | ||
15311 | var Component = ReactInstanceMap.get(this)._currentElement.type; | ||
15312 | var element = Component(this.props, this.context, this.updater); | ||
15313 | warnIfInvalidElement(Component, element); | ||
15314 | return element; | ||
15315 | }; | ||
14727 | 15316 | ||
14728 | /** | 15317 | function warnIfInvalidElement(Component, element) { |
14729 | * Finds the parent React component of `node`. | 15318 | if (process.env.NODE_ENV !== 'production') { |
14730 | * | 15319 | process.env.NODE_ENV !== 'production' ? warning(element === null || element === false || ReactElement.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; |
14731 | * @param {*} node | 15320 | process.env.NODE_ENV !== 'production' ? warning(!Component.childContextTypes, '%s(...): childContextTypes cannot be defined on a functional component.', Component.displayName || Component.name || 'Component') : void 0; |
14732 | * @return {?DOMEventTarget} Parent container, or `null` if the specified node | 15321 | } |
14733 | * is not nested. | ||
14734 | */ | ||
14735 | function findParent(node) { | ||
14736 | // TODO: It may be a good idea to cache this to prevent unnecessary DOM | ||
14737 | // traversal, but caching is difficult to do correctly without using a | ||
14738 | // mutation observer to listen for all DOM changes. | ||
14739 | var nodeID = ReactMount.getID(node); | ||
14740 | var rootID = ReactInstanceHandles.getReactRootIDFromNodeID(nodeID); | ||
14741 | var container = ReactMount.findReactContainerForID(rootID); | ||
14742 | var parent = ReactMount.getFirstReactDOM(container); | ||
14743 | return parent; | ||
14744 | } | 15322 | } |
14745 | 15323 | ||
14746 | // Used to store ancestor hierarchy in top level callback | 15324 | function invokeComponentDidMountWithTimer() { |
14747 | function TopLevelCallbackBookKeeping(topLevelType, nativeEvent) { | 15325 | var publicInstance = this._instance; |
14748 | this.topLevelType = topLevelType; | 15326 | if (this._debugID !== 0) { |
14749 | this.nativeEvent = nativeEvent; | 15327 | ReactInstrumentation.debugTool.onBeginLifeCycleTimer(this._debugID, 'componentDidMount'); |
14750 | this.ancestors = []; | 15328 | } |
15329 | publicInstance.componentDidMount(); | ||
15330 | if (this._debugID !== 0) { | ||
15331 | ReactInstrumentation.debugTool.onEndLifeCycleTimer(this._debugID, 'componentDidMount'); | ||
15332 | } | ||
14751 | } | 15333 | } |
14752 | assign(TopLevelCallbackBookKeeping.prototype, { | 15334 | |
14753 | destructor: function () { | 15335 | function invokeComponentDidUpdateWithTimer(prevProps, prevState, prevContext) { |
14754 | this.topLevelType = null; | 15336 | var publicInstance = this._instance; |
14755 | this.nativeEvent = null; | 15337 | if (this._debugID !== 0) { |
14756 | this.ancestors.length = 0; | 15338 | ReactInstrumentation.debugTool.onBeginLifeCycleTimer(this._debugID, 'componentDidUpdate'); |
14757 | } | 15339 | } |
14758 | }); | 15340 | publicInstance.componentDidUpdate(prevProps, prevState, prevContext); |
14759 | PooledClass.addPoolingTo(TopLevelCallbackBookKeeping, PooledClass.twoArgumentPooler); | 15341 | if (this._debugID !== 0) { |
15342 | ReactInstrumentation.debugTool.onEndLifeCycleTimer(this._debugID, 'componentDidUpdate'); | ||
15343 | } | ||
15344 | } | ||
14760 | 15345 | ||
14761 | function handleTopLevelImpl(bookKeeping) { | 15346 | function shouldConstruct(Component) { |
14762 | // TODO: Re-enable event.path handling | 15347 | return !!(Component.prototype && Component.prototype.isReactComponent); |
14763 | // | 15348 | } |
14764 | // if (bookKeeping.nativeEvent.path && bookKeeping.nativeEvent.path.length > 1) { | ||
14765 | // // New browsers have a path attribute on native events | ||
14766 | // handleTopLevelWithPath(bookKeeping); | ||
14767 | // } else { | ||
14768 | // // Legacy browsers don't have a path attribute on native events | ||
14769 | // handleTopLevelWithoutPath(bookKeeping); | ||
14770 | // } | ||
14771 | 15349 | ||
14772 | void handleTopLevelWithPath; // temporarily unused | 15350 | function isPureComponent(Component) { |
14773 | handleTopLevelWithoutPath(bookKeeping); | 15351 | return !!(Component.prototype && Component.prototype.isPureReactComponent); |
14774 | } | 15352 | } |
14775 | 15353 | ||
14776 | // Legacy browsers don't have a path attribute on native events | 15354 | /** |
14777 | function handleTopLevelWithoutPath(bookKeeping) { | 15355 | * ------------------ The Life-Cycle of a Composite Component ------------------ |
14778 | var topLevelTarget = ReactMount.getFirstReactDOM(getEventTarget(bookKeeping.nativeEvent)) || window; | 15356 | * |
15357 | * - constructor: Initialization of state. The instance is now retained. | ||
15358 | * - componentWillMount | ||
15359 | * - render | ||
15360 | * - [children's constructors] | ||
15361 | * - [children's componentWillMount and render] | ||
15362 | * - [children's componentDidMount] | ||
15363 | * - componentDidMount | ||
15364 | * | ||
15365 | * Update Phases: | ||
15366 | * - componentWillReceiveProps (only called if parent updated) | ||
15367 | * - shouldComponentUpdate | ||
15368 | * - componentWillUpdate | ||
15369 | * - render | ||
15370 | * - [children's constructors or receive props phases] | ||
15371 | * - componentDidUpdate | ||
15372 | * | ||
15373 | * - componentWillUnmount | ||
15374 | * - [children's componentWillUnmount] | ||
15375 | * - [children destroyed] | ||
15376 | * - (destroyed): The instance is now blank, released by React and ready for GC. | ||
15377 | * | ||
15378 | * ----------------------------------------------------------------------------- | ||
15379 | */ | ||
14779 | 15380 | ||
14780 | // Loop through the hierarchy, in case there's any nested components. | 15381 | /** |
14781 | // It's important that we build the array of ancestors before calling any | 15382 | * An incrementing ID assigned to each component when it is mounted. This is |
14782 | // event handlers, because event handlers can modify the DOM, leading to | 15383 | * used to enforce the order in which `ReactUpdates` updates dirty components. |
14783 | // inconsistencies with ReactMount's node cache. See #1105. | 15384 | * |
14784 | var ancestor = topLevelTarget; | 15385 | * @private |
14785 | while (ancestor) { | 15386 | */ |
14786 | bookKeeping.ancestors.push(ancestor); | 15387 | var nextMountID = 1; |
14787 | ancestor = findParent(ancestor); | ||
14788 | } | ||
14789 | 15388 | ||
14790 | for (var i = 0; i < bookKeeping.ancestors.length; i++) { | 15389 | /** |
14791 | topLevelTarget = bookKeeping.ancestors[i]; | 15390 | * @lends {ReactCompositeComponent.prototype} |
14792 | var topLevelTargetID = ReactMount.getID(topLevelTarget) || ''; | 15391 | */ |
14793 | ReactEventListener._handleTopLevel(bookKeeping.topLevelType, topLevelTarget, topLevelTargetID, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent)); | 15392 | var ReactCompositeComponentMixin = { |
14794 | } | 15393 | |
14795 | } | 15394 | /** |
15395 | * Base constructor for all composite component. | ||
15396 | * | ||
15397 | * @param {ReactElement} element | ||
15398 | * @final | ||
15399 | * @internal | ||
15400 | */ | ||
15401 | construct: function (element) { | ||
15402 | this._currentElement = element; | ||
15403 | this._rootNodeID = null; | ||
15404 | this._compositeType = null; | ||
15405 | this._instance = null; | ||
15406 | this._hostParent = null; | ||
15407 | this._hostContainerInfo = null; | ||
14796 | 15408 | ||
14797 | // New browsers have a path attribute on native events | 15409 | // See ReactUpdateQueue |
14798 | function handleTopLevelWithPath(bookKeeping) { | 15410 | this._updateBatchNumber = null; |
14799 | var path = bookKeeping.nativeEvent.path; | 15411 | this._pendingElement = null; |
14800 | var currentNativeTarget = path[0]; | 15412 | this._pendingStateQueue = null; |
14801 | var eventsFired = 0; | 15413 | this._pendingReplaceState = false; |
14802 | for (var i = 0; i < path.length; i++) { | 15414 | this._pendingForceUpdate = false; |
14803 | var currentPathElement = path[i]; | 15415 | |
14804 | if (currentPathElement.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE) { | 15416 | this._renderedNodeType = null; |
14805 | currentNativeTarget = path[i + 1]; | 15417 | this._renderedComponent = null; |
15418 | this._context = null; | ||
15419 | this._mountOrder = 0; | ||
15420 | this._topLevelWrapper = null; | ||
15421 | |||
15422 | // See ReactUpdates and ReactUpdateQueue. | ||
15423 | this._pendingCallbacks = null; | ||
15424 | |||
15425 | // ComponentWillUnmount shall only be called once | ||
15426 | this._calledComponentWillUnmount = false; | ||
15427 | |||
15428 | if (process.env.NODE_ENV !== 'production') { | ||
15429 | this._warnedAboutRefsInRender = false; | ||
14806 | } | 15430 | } |
14807 | // TODO: slow | 15431 | }, |
14808 | var reactParent = ReactMount.getFirstReactDOM(currentPathElement); | ||
14809 | if (reactParent === currentPathElement) { | ||
14810 | var currentPathElementID = ReactMount.getID(currentPathElement); | ||
14811 | var newRootID = ReactInstanceHandles.getReactRootIDFromNodeID(currentPathElementID); | ||
14812 | bookKeeping.ancestors.push(currentPathElement); | ||
14813 | 15432 | ||
14814 | var topLevelTargetID = ReactMount.getID(currentPathElement) || ''; | 15433 | /** |
14815 | eventsFired++; | 15434 | * Initializes the component, renders markup, and registers event listeners. |
14816 | ReactEventListener._handleTopLevel(bookKeeping.topLevelType, currentPathElement, topLevelTargetID, bookKeeping.nativeEvent, currentNativeTarget); | 15435 | * |
15436 | * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction | ||
15437 | * @param {?object} hostParent | ||
15438 | * @param {?object} hostContainerInfo | ||
15439 | * @param {?object} context | ||
15440 | * @return {?string} Rendered markup to be inserted into the DOM. | ||
15441 | * @final | ||
15442 | * @internal | ||
15443 | */ | ||
15444 | mountComponent: function (transaction, hostParent, hostContainerInfo, context) { | ||
15445 | var _this = this; | ||
15446 | |||
15447 | this._context = context; | ||
15448 | this._mountOrder = nextMountID++; | ||
15449 | this._hostParent = hostParent; | ||
15450 | this._hostContainerInfo = hostContainerInfo; | ||
15451 | |||
15452 | var publicProps = this._currentElement.props; | ||
15453 | var publicContext = this._processContext(context); | ||
15454 | |||
15455 | var Component = this._currentElement.type; | ||
15456 | |||
15457 | var updateQueue = transaction.getUpdateQueue(); | ||
15458 | |||
15459 | // Initialize the public class | ||
15460 | var doConstruct = shouldConstruct(Component); | ||
15461 | var inst = this._constructComponent(doConstruct, publicProps, publicContext, updateQueue); | ||
15462 | var renderedElement; | ||
14817 | 15463 | ||
14818 | // Jump to the root of this React render tree | 15464 | // Support functional components |
14819 | while (currentPathElementID !== newRootID) { | 15465 | if (!doConstruct && (inst == null || inst.render == null)) { |
14820 | i++; | 15466 | renderedElement = inst; |
14821 | currentPathElement = path[i]; | 15467 | warnIfInvalidElement(Component, renderedElement); |
14822 | currentPathElementID = ReactMount.getID(currentPathElement); | 15468 | !(inst === null || inst === false || ReactElement.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; |
15469 | inst = new StatelessComponent(Component); | ||
15470 | this._compositeType = CompositeTypes.StatelessFunctional; | ||
15471 | } else { | ||
15472 | if (isPureComponent(Component)) { | ||
15473 | this._compositeType = CompositeTypes.PureClass; | ||
15474 | } else { | ||
15475 | this._compositeType = CompositeTypes.ImpureClass; | ||
14823 | } | 15476 | } |
14824 | } | 15477 | } |
14825 | } | ||
14826 | if (eventsFired === 0) { | ||
14827 | ReactEventListener._handleTopLevel(bookKeeping.topLevelType, window, '', bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent)); | ||
14828 | } | ||
14829 | } | ||
14830 | 15478 | ||
14831 | function scrollValueMonitor(cb) { | 15479 | if (process.env.NODE_ENV !== 'production') { |
14832 | var scrollPosition = getUnboundedScrollPosition(window); | 15480 | // This will throw later in _renderValidatedComponent, but add an early |
14833 | cb(scrollPosition); | 15481 | // warning now to help debugging |
14834 | } | 15482 | if (inst.render == null) { |
15483 | 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; | ||
15484 | } | ||
14835 | 15485 | ||
14836 | var ReactEventListener = { | 15486 | var propsMutated = inst.props !== publicProps; |
14837 | _enabled: true, | 15487 | var componentName = Component.displayName || Component.name || 'Component'; |
14838 | _handleTopLevel: null, | ||
14839 | 15488 | ||
14840 | WINDOW_HANDLE: ExecutionEnvironment.canUseDOM ? window : null, | 15489 | 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; |
15490 | } | ||
14841 | 15491 | ||
14842 | setHandleTopLevel: function (handleTopLevel) { | 15492 | // These should be set up in the constructor, but as a convenience for |
14843 | ReactEventListener._handleTopLevel = handleTopLevel; | 15493 | // simpler class abstractions, we set them up after the fact. |
15494 | inst.props = publicProps; | ||
15495 | inst.context = publicContext; | ||
15496 | inst.refs = emptyObject; | ||
15497 | inst.updater = updateQueue; | ||
15498 | |||
15499 | this._instance = inst; | ||
15500 | |||
15501 | // Store a reference from the instance back to the internal representation | ||
15502 | ReactInstanceMap.set(inst, this); | ||
15503 | |||
15504 | if (process.env.NODE_ENV !== 'production') { | ||
15505 | // Since plain JS classes are defined without any special initialization | ||
15506 | // logic, we can not catch common errors early. Therefore, we have to | ||
15507 | // catch them here, at initialization time, instead. | ||
15508 | process.env.NODE_ENV !== 'production' ? warning(!inst.getInitialState || inst.getInitialState.isReactClassApproved, '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; | ||
15509 | 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; | ||
15510 | 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; | ||
15511 | 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; | ||
15512 | 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; | ||
15513 | 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; | ||
15514 | 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; | ||
15515 | } | ||
15516 | |||
15517 | var initialState = inst.state; | ||
15518 | if (initialState === undefined) { | ||
15519 | inst.state = initialState = null; | ||
15520 | } | ||
15521 | !(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; | ||
15522 | |||
15523 | this._pendingStateQueue = null; | ||
15524 | this._pendingReplaceState = false; | ||
15525 | this._pendingForceUpdate = false; | ||
15526 | |||
15527 | var markup; | ||
15528 | if (inst.unstable_handleError) { | ||
15529 | markup = this.performInitialMountWithErrorHandling(renderedElement, hostParent, hostContainerInfo, transaction, context); | ||
15530 | } else { | ||
15531 | markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context); | ||
15532 | } | ||
15533 | |||
15534 | if (inst.componentDidMount) { | ||
15535 | if (process.env.NODE_ENV !== 'production') { | ||
15536 | transaction.getReactMountReady().enqueue(invokeComponentDidMountWithTimer, this); | ||
15537 | } else { | ||
15538 | transaction.getReactMountReady().enqueue(inst.componentDidMount, inst); | ||
15539 | } | ||
15540 | } | ||
15541 | |||
15542 | if (process.env.NODE_ENV !== 'production') { | ||
15543 | if (this._debugID) { | ||
15544 | var callback = function (component) { | ||
15545 | return ReactInstrumentation.debugTool.onComponentHasMounted(_this._debugID); | ||
15546 | }; | ||
15547 | transaction.getReactMountReady().enqueue(callback, this); | ||
15548 | } | ||
15549 | } | ||
15550 | |||
15551 | return markup; | ||
14844 | }, | 15552 | }, |
14845 | 15553 | ||
14846 | setEnabled: function (enabled) { | 15554 | _constructComponent: function (doConstruct, publicProps, publicContext, updateQueue) { |
14847 | ReactEventListener._enabled = !!enabled; | 15555 | if (process.env.NODE_ENV !== 'production') { |
15556 | ReactCurrentOwner.current = this; | ||
15557 | try { | ||
15558 | return this._constructComponentWithoutOwner(doConstruct, publicProps, publicContext, updateQueue); | ||
15559 | } finally { | ||
15560 | ReactCurrentOwner.current = null; | ||
15561 | } | ||
15562 | } else { | ||
15563 | return this._constructComponentWithoutOwner(doConstruct, publicProps, publicContext, updateQueue); | ||
15564 | } | ||
14848 | }, | 15565 | }, |
14849 | 15566 | ||
14850 | isEnabled: function () { | 15567 | _constructComponentWithoutOwner: function (doConstruct, publicProps, publicContext, updateQueue) { |
14851 | return ReactEventListener._enabled; | 15568 | var Component = this._currentElement.type; |
15569 | var instanceOrElement; | ||
15570 | if (doConstruct) { | ||
15571 | if (process.env.NODE_ENV !== 'production') { | ||
15572 | if (this._debugID !== 0) { | ||
15573 | ReactInstrumentation.debugTool.onBeginLifeCycleTimer(this._debugID, 'ctor'); | ||
15574 | } | ||
15575 | } | ||
15576 | instanceOrElement = new Component(publicProps, publicContext, updateQueue); | ||
15577 | if (process.env.NODE_ENV !== 'production') { | ||
15578 | if (this._debugID !== 0) { | ||
15579 | ReactInstrumentation.debugTool.onEndLifeCycleTimer(this._debugID, 'ctor'); | ||
15580 | } | ||
15581 | } | ||
15582 | } else { | ||
15583 | // This can still be an instance in case of factory components | ||
15584 | // but we'll count this as time spent rendering as the more common case. | ||
15585 | if (process.env.NODE_ENV !== 'production') { | ||
15586 | if (this._debugID !== 0) { | ||
15587 | ReactInstrumentation.debugTool.onBeginLifeCycleTimer(this._debugID, 'render'); | ||
15588 | } | ||
15589 | } | ||
15590 | instanceOrElement = Component(publicProps, publicContext, updateQueue); | ||
15591 | if (process.env.NODE_ENV !== 'production') { | ||
15592 | if (this._debugID !== 0) { | ||
15593 | ReactInstrumentation.debugTool.onEndLifeCycleTimer(this._debugID, 'render'); | ||
15594 | } | ||
15595 | } | ||
15596 | } | ||
15597 | return instanceOrElement; | ||
15598 | }, | ||
15599 | |||
15600 | performInitialMountWithErrorHandling: function (renderedElement, hostParent, hostContainerInfo, transaction, context) { | ||
15601 | var markup; | ||
15602 | var checkpoint = transaction.checkpoint(); | ||
15603 | try { | ||
15604 | markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context); | ||
15605 | } catch (e) { | ||
15606 | if (process.env.NODE_ENV !== 'production') { | ||
15607 | if (this._debugID !== 0) { | ||
15608 | ReactInstrumentation.debugTool.onError(); | ||
15609 | } | ||
15610 | } | ||
15611 | // Roll back to checkpoint, handle error (which may add items to the transaction), and take a new checkpoint | ||
15612 | transaction.rollback(checkpoint); | ||
15613 | this._instance.unstable_handleError(e); | ||
15614 | if (this._pendingStateQueue) { | ||
15615 | this._instance.state = this._processPendingState(this._instance.props, this._instance.context); | ||
15616 | } | ||
15617 | checkpoint = transaction.checkpoint(); | ||
15618 | |||
15619 | this._renderedComponent.unmountComponent(true); | ||
15620 | transaction.rollback(checkpoint); | ||
15621 | |||
15622 | // Try again - we've informed the component about the error, so they can render an error message this time. | ||
15623 | // If this throws again, the error will bubble up (and can be caught by a higher error boundary). | ||
15624 | markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context); | ||
15625 | } | ||
15626 | return markup; | ||
15627 | }, | ||
15628 | |||
15629 | performInitialMount: function (renderedElement, hostParent, hostContainerInfo, transaction, context) { | ||
15630 | var inst = this._instance; | ||
15631 | if (inst.componentWillMount) { | ||
15632 | if (process.env.NODE_ENV !== 'production') { | ||
15633 | if (this._debugID !== 0) { | ||
15634 | ReactInstrumentation.debugTool.onBeginLifeCycleTimer(this._debugID, 'componentWillMount'); | ||
15635 | } | ||
15636 | } | ||
15637 | inst.componentWillMount(); | ||
15638 | if (process.env.NODE_ENV !== 'production') { | ||
15639 | if (this._debugID !== 0) { | ||
15640 | ReactInstrumentation.debugTool.onEndLifeCycleTimer(this._debugID, 'componentWillMount'); | ||
15641 | } | ||
15642 | } | ||
15643 | // When mounting, calls to `setState` by `componentWillMount` will set | ||
15644 | // `this._pendingStateQueue` without triggering a re-render. | ||
15645 | if (this._pendingStateQueue) { | ||
15646 | inst.state = this._processPendingState(inst.props, inst.context); | ||
15647 | } | ||
15648 | } | ||
15649 | |||
15650 | // If not a stateless component, we now render | ||
15651 | if (renderedElement === undefined) { | ||
15652 | renderedElement = this._renderValidatedComponent(); | ||
15653 | } | ||
15654 | |||
15655 | var nodeType = ReactNodeTypes.getType(renderedElement); | ||
15656 | this._renderedNodeType = nodeType; | ||
15657 | var child = this._instantiateReactComponent(renderedElement, nodeType !== ReactNodeTypes.EMPTY /* shouldHaveDebugID */ | ||
15658 | ); | ||
15659 | this._renderedComponent = child; | ||
15660 | if (process.env.NODE_ENV !== 'production') { | ||
15661 | if (child._debugID !== 0 && this._debugID !== 0) { | ||
15662 | ReactInstrumentation.debugTool.onSetParent(child._debugID, this._debugID); | ||
15663 | } | ||
15664 | } | ||
15665 | |||
15666 | var markup = ReactReconciler.mountComponent(child, transaction, hostParent, hostContainerInfo, this._processChildContext(context)); | ||
15667 | |||
15668 | if (process.env.NODE_ENV !== 'production') { | ||
15669 | if (this._debugID !== 0) { | ||
15670 | ReactInstrumentation.debugTool.onSetChildren(this._debugID, child._debugID !== 0 ? [child._debugID] : []); | ||
15671 | } | ||
15672 | } | ||
15673 | |||
15674 | return markup; | ||
15675 | }, | ||
15676 | |||
15677 | getHostNode: function () { | ||
15678 | return ReactReconciler.getHostNode(this._renderedComponent); | ||
14852 | }, | 15679 | }, |
14853 | 15680 | ||
14854 | /** | 15681 | /** |
14855 | * Traps top-level events by using event bubbling. | 15682 | * Releases any resources allocated by `mountComponent`. |
14856 | * | 15683 | * |
14857 | * @param {string} topLevelType Record from `EventConstants`. | 15684 | * @final |
14858 | * @param {string} handlerBaseName Event name (e.g. "click"). | ||
14859 | * @param {object} handle Element on which to attach listener. | ||
14860 | * @return {?object} An object with a remove function which will forcefully | ||
14861 | * remove the listener. | ||
14862 | * @internal | 15685 | * @internal |
14863 | */ | 15686 | */ |
14864 | trapBubbledEvent: function (topLevelType, handlerBaseName, handle) { | 15687 | unmountComponent: function (safely) { |
14865 | var element = handle; | 15688 | if (!this._renderedComponent) { |
14866 | if (!element) { | 15689 | return; |
14867 | return null; | ||
14868 | } | 15690 | } |
14869 | return EventListener.listen(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType)); | 15691 | var inst = this._instance; |
15692 | |||
15693 | if (inst.componentWillUnmount && !inst._calledComponentWillUnmount) { | ||
15694 | inst._calledComponentWillUnmount = true; | ||
15695 | if (process.env.NODE_ENV !== 'production') { | ||
15696 | if (this._debugID !== 0) { | ||
15697 | ReactInstrumentation.debugTool.onBeginLifeCycleTimer(this._debugID, 'componentWillUnmount'); | ||
15698 | } | ||
15699 | } | ||
15700 | if (safely) { | ||
15701 | var name = this.getName() + '.componentWillUnmount()'; | ||
15702 | ReactErrorUtils.invokeGuardedCallback(name, inst.componentWillUnmount.bind(inst)); | ||
15703 | } else { | ||
15704 | inst.componentWillUnmount(); | ||
15705 | } | ||
15706 | if (process.env.NODE_ENV !== 'production') { | ||
15707 | if (this._debugID !== 0) { | ||
15708 | ReactInstrumentation.debugTool.onEndLifeCycleTimer(this._debugID, 'componentWillUnmount'); | ||
15709 | } | ||
15710 | } | ||
15711 | } | ||
15712 | |||
15713 | if (this._renderedComponent) { | ||
15714 | ReactReconciler.unmountComponent(this._renderedComponent, safely); | ||
15715 | this._renderedNodeType = null; | ||
15716 | this._renderedComponent = null; | ||
15717 | this._instance = null; | ||
15718 | } | ||
15719 | |||
15720 | // Reset pending fields | ||
15721 | // Even if this component is scheduled for another update in ReactUpdates, | ||
15722 | // it would still be ignored because these fields are reset. | ||
15723 | this._pendingStateQueue = null; | ||
15724 | this._pendingReplaceState = false; | ||
15725 | this._pendingForceUpdate = false; | ||
15726 | this._pendingCallbacks = null; | ||
15727 | this._pendingElement = null; | ||
15728 | |||
15729 | // These fields do not really need to be reset since this object is no | ||
15730 | // longer accessible. | ||
15731 | this._context = null; | ||
15732 | this._rootNodeID = null; | ||
15733 | this._topLevelWrapper = null; | ||
15734 | |||
15735 | // Delete the reference from the instance to this internal representation | ||
15736 | // which allow the internals to be properly cleaned up even if the user | ||
15737 | // leaks a reference to the public instance. | ||
15738 | ReactInstanceMap.remove(inst); | ||
15739 | |||
15740 | // Some existing components rely on inst.props even after they've been | ||
15741 | // destroyed (in event handlers). | ||
15742 | // TODO: inst.props = null; | ||
15743 | // TODO: inst.state = null; | ||
15744 | // TODO: inst.context = null; | ||
14870 | }, | 15745 | }, |
14871 | 15746 | ||
14872 | /** | 15747 | /** |
14873 | * Traps a top-level event by using event capturing. | 15748 | * Filters the context object to only contain keys specified in |
15749 | * `contextTypes` | ||
14874 | * | 15750 | * |
14875 | * @param {string} topLevelType Record from `EventConstants`. | 15751 | * @param {object} context |
14876 | * @param {string} handlerBaseName Event name (e.g. "click"). | 15752 | * @return {?object} |
14877 | * @param {object} handle Element on which to attach listener. | 15753 | * @private |
14878 | * @return {?object} An object with a remove function which will forcefully | ||
14879 | * remove the listener. | ||
14880 | * @internal | ||
14881 | */ | 15754 | */ |
14882 | trapCapturedEvent: function (topLevelType, handlerBaseName, handle) { | 15755 | _maskContext: function (context) { |
14883 | var element = handle; | 15756 | var Component = this._currentElement.type; |
14884 | if (!element) { | 15757 | var contextTypes = Component.contextTypes; |
14885 | return null; | 15758 | if (!contextTypes) { |
15759 | return emptyObject; | ||
14886 | } | 15760 | } |
14887 | return EventListener.capture(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType)); | 15761 | var maskedContext = {}; |
15762 | for (var contextName in contextTypes) { | ||
15763 | maskedContext[contextName] = context[contextName]; | ||
15764 | } | ||
15765 | return maskedContext; | ||
14888 | }, | 15766 | }, |
14889 | 15767 | ||
14890 | monitorScrollValue: function (refresh) { | 15768 | /** |
14891 | var callback = scrollValueMonitor.bind(null, refresh); | 15769 | * Filters the context object to only contain keys specified in |
14892 | EventListener.listen(window, 'scroll', callback); | 15770 | * `contextTypes`, and asserts that they are valid. |
15771 | * | ||
15772 | * @param {object} context | ||
15773 | * @return {?object} | ||
15774 | * @private | ||
15775 | */ | ||
15776 | _processContext: function (context) { | ||
15777 | var maskedContext = this._maskContext(context); | ||
15778 | if (process.env.NODE_ENV !== 'production') { | ||
15779 | var Component = this._currentElement.type; | ||
15780 | if (Component.contextTypes) { | ||
15781 | this._checkContextTypes(Component.contextTypes, maskedContext, ReactPropTypeLocations.context); | ||
15782 | } | ||
15783 | } | ||
15784 | return maskedContext; | ||
14893 | }, | 15785 | }, |
14894 | 15786 | ||
14895 | dispatchEvent: function (topLevelType, nativeEvent) { | 15787 | /** |
14896 | if (!ReactEventListener._enabled) { | 15788 | * @param {object} currentContext |
14897 | return; | 15789 | * @return {object} |
15790 | * @private | ||
15791 | */ | ||
15792 | _processChildContext: function (currentContext) { | ||
15793 | var Component = this._currentElement.type; | ||
15794 | var inst = this._instance; | ||
15795 | if (process.env.NODE_ENV !== 'production') { | ||
15796 | ReactInstrumentation.debugTool.onBeginProcessingChildContext(); | ||
14898 | } | 15797 | } |
14899 | 15798 | var childContext = inst.getChildContext && inst.getChildContext(); | |
14900 | var bookKeeping = TopLevelCallbackBookKeeping.getPooled(topLevelType, nativeEvent); | 15799 | if (process.env.NODE_ENV !== 'production') { |
14901 | try { | 15800 | ReactInstrumentation.debugTool.onEndProcessingChildContext(); |
14902 | // Event queue being processed in the same cycle allows | ||
14903 | // `preventDefault`. | ||
14904 | ReactUpdates.batchedUpdates(handleTopLevelImpl, bookKeeping); | ||
14905 | } finally { | ||
14906 | TopLevelCallbackBookKeeping.release(bookKeeping); | ||
14907 | } | 15801 | } |
14908 | } | 15802 | if (childContext) { |
14909 | }; | 15803 | !(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; |
15804 | if (process.env.NODE_ENV !== 'production') { | ||
15805 | this._checkContextTypes(Component.childContextTypes, childContext, ReactPropTypeLocations.childContext); | ||
15806 | } | ||
15807 | for (var name in childContext) { | ||
15808 | !(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; | ||
15809 | } | ||
15810 | return _assign({}, currentContext, childContext); | ||
15811 | } | ||
15812 | return currentContext; | ||
15813 | }, | ||
14910 | 15814 | ||
14911 | module.exports = ReactEventListener; | 15815 | /** |
14912 | 15816 | * Assert that the context types are valid | |
14913 | /***/ }, | 15817 | * |
14914 | /* 121 */ | 15818 | * @param {object} typeSpecs Map of context field to a ReactPropType |
14915 | /***/ function(module, exports, __webpack_require__) { | 15819 | * @param {object} values Runtime values that need to be type-checked |
14916 | 15820 | * @param {string} location e.g. "prop", "context", "child context" | |
14917 | /* WEBPACK VAR INJECTION */(function(process) {/** | 15821 | * @private |
14918 | * Copyright 2013-2015, Facebook, Inc. | 15822 | */ |
14919 | * | 15823 | _checkContextTypes: function (typeSpecs, values, location) { |
14920 | * Licensed under the Apache License, Version 2.0 (the "License"); | 15824 | checkReactTypeSpec(typeSpecs, values, location, this.getName(), null, this._debugID); |
14921 | * you may not use this file except in compliance with the License. | 15825 | }, |
14922 | * You may obtain a copy of the License at | ||
14923 | * | ||
14924 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
14925 | * | ||
14926 | * Unless required by applicable law or agreed to in writing, software | ||
14927 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
14928 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14929 | * See the License for the specific language governing permissions and | ||
14930 | * limitations under the License. | ||
14931 | * | ||
14932 | * @providesModule EventListener | ||
14933 | * @typechecks | ||
14934 | */ | ||
14935 | 15826 | ||
14936 | 'use strict'; | 15827 | receiveComponent: function (nextElement, transaction, nextContext) { |
15828 | var prevElement = this._currentElement; | ||
15829 | var prevContext = this._context; | ||
14937 | 15830 | ||
14938 | var emptyFunction = __webpack_require__(17); | 15831 | this._pendingElement = null; |
15832 | |||
15833 | this.updateComponent(transaction, prevElement, nextElement, prevContext, nextContext); | ||
15834 | }, | ||
14939 | 15835 | ||
14940 | /** | ||
14941 | * Upstream version of event listener. Does not take into account specific | ||
14942 | * nature of platform. | ||
14943 | */ | ||
14944 | var EventListener = { | ||
14945 | /** | 15836 | /** |
14946 | * Listen to DOM events during the bubble phase. | 15837 | * If any of `_pendingElement`, `_pendingStateQueue`, or `_pendingForceUpdate` |
15838 | * is set, update the component. | ||
14947 | * | 15839 | * |
14948 | * @param {DOMEventTarget} target DOM element to register listener on. | 15840 | * @param {ReactReconcileTransaction} transaction |
14949 | * @param {string} eventType Event type, e.g. 'click' or 'mouseover'. | 15841 | * @internal |
14950 | * @param {function} callback Callback function. | ||
14951 | * @return {object} Object with a `remove` method. | ||
14952 | */ | 15842 | */ |
14953 | listen: function (target, eventType, callback) { | 15843 | performUpdateIfNecessary: function (transaction) { |
14954 | if (target.addEventListener) { | 15844 | if (this._pendingElement != null) { |
14955 | target.addEventListener(eventType, callback, false); | 15845 | ReactReconciler.receiveComponent(this, this._pendingElement, transaction, this._context); |
14956 | return { | 15846 | } else if (this._pendingStateQueue !== null || this._pendingForceUpdate) { |
14957 | remove: function () { | 15847 | this.updateComponent(transaction, this._currentElement, this._currentElement, this._context, this._context); |
14958 | target.removeEventListener(eventType, callback, false); | 15848 | } else { |
15849 | this._updateBatchNumber = null; | ||
15850 | } | ||
15851 | }, | ||
15852 | |||
15853 | /** | ||
15854 | * Perform an update to a mounted component. The componentWillReceiveProps and | ||
15855 | * shouldComponentUpdate methods are called, then (assuming the update isn't | ||
15856 | * skipped) the remaining update lifecycle methods are called and the DOM | ||
15857 | * representation is updated. | ||
15858 | * | ||
15859 | * By default, this implements React's rendering and reconciliation algorithm. | ||
15860 | * Sophisticated clients may wish to override this. | ||
15861 | * | ||
15862 | * @param {ReactReconcileTransaction} transaction | ||
15863 | * @param {ReactElement} prevParentElement | ||
15864 | * @param {ReactElement} nextParentElement | ||
15865 | * @internal | ||
15866 | * @overridable | ||
15867 | */ | ||
15868 | updateComponent: function (transaction, prevParentElement, nextParentElement, prevUnmaskedContext, nextUnmaskedContext) { | ||
15869 | var inst = this._instance; | ||
15870 | !(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; | ||
15871 | |||
15872 | var willReceive = false; | ||
15873 | var nextContext; | ||
15874 | |||
15875 | // Determine if the context has changed or not | ||
15876 | if (this._context === nextUnmaskedContext) { | ||
15877 | nextContext = inst.context; | ||
15878 | } else { | ||
15879 | nextContext = this._processContext(nextUnmaskedContext); | ||
15880 | willReceive = true; | ||
15881 | } | ||
15882 | |||
15883 | var prevProps = prevParentElement.props; | ||
15884 | var nextProps = nextParentElement.props; | ||
15885 | |||
15886 | // Not a simple state update but a props update | ||
15887 | if (prevParentElement !== nextParentElement) { | ||
15888 | willReceive = true; | ||
15889 | } | ||
15890 | |||
15891 | // An update here will schedule an update but immediately set | ||
15892 | // _pendingStateQueue which will ensure that any state updates gets | ||
15893 | // immediately reconciled instead of waiting for the next batch. | ||
15894 | if (willReceive && inst.componentWillReceiveProps) { | ||
15895 | if (process.env.NODE_ENV !== 'production') { | ||
15896 | if (this._debugID !== 0) { | ||
15897 | ReactInstrumentation.debugTool.onBeginLifeCycleTimer(this._debugID, 'componentWillReceiveProps'); | ||
14959 | } | 15898 | } |
14960 | }; | 15899 | } |
14961 | } else if (target.attachEvent) { | 15900 | inst.componentWillReceiveProps(nextProps, nextContext); |
14962 | target.attachEvent('on' + eventType, callback); | 15901 | if (process.env.NODE_ENV !== 'production') { |
14963 | return { | 15902 | if (this._debugID !== 0) { |
14964 | remove: function () { | 15903 | ReactInstrumentation.debugTool.onEndLifeCycleTimer(this._debugID, 'componentWillReceiveProps'); |
14965 | target.detachEvent('on' + eventType, callback); | ||
14966 | } | 15904 | } |
14967 | }; | 15905 | } |
15906 | } | ||
15907 | |||
15908 | var nextState = this._processPendingState(nextProps, nextContext); | ||
15909 | var shouldUpdate = true; | ||
15910 | |||
15911 | if (!this._pendingForceUpdate) { | ||
15912 | if (inst.shouldComponentUpdate) { | ||
15913 | if (process.env.NODE_ENV !== 'production') { | ||
15914 | if (this._debugID !== 0) { | ||
15915 | ReactInstrumentation.debugTool.onBeginLifeCycleTimer(this._debugID, 'shouldComponentUpdate'); | ||
15916 | } | ||
15917 | } | ||
15918 | shouldUpdate = inst.shouldComponentUpdate(nextProps, nextState, nextContext); | ||
15919 | if (process.env.NODE_ENV !== 'production') { | ||
15920 | if (this._debugID !== 0) { | ||
15921 | ReactInstrumentation.debugTool.onEndLifeCycleTimer(this._debugID, 'shouldComponentUpdate'); | ||
15922 | } | ||
15923 | } | ||
15924 | } else { | ||
15925 | if (this._compositeType === CompositeTypes.PureClass) { | ||
15926 | shouldUpdate = !shallowEqual(prevProps, nextProps) || !shallowEqual(inst.state, nextState); | ||
15927 | } | ||
15928 | } | ||
15929 | } | ||
15930 | |||
15931 | if (process.env.NODE_ENV !== 'production') { | ||
15932 | 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; | ||
15933 | } | ||
15934 | |||
15935 | this._updateBatchNumber = null; | ||
15936 | if (shouldUpdate) { | ||
15937 | this._pendingForceUpdate = false; | ||
15938 | // Will set `this.props`, `this.state` and `this.context`. | ||
15939 | this._performComponentUpdate(nextParentElement, nextProps, nextState, nextContext, transaction, nextUnmaskedContext); | ||
15940 | } else { | ||
15941 | // If it's determined that a component should not update, we still want | ||
15942 | // to set props and state but we shortcut the rest of the update. | ||
15943 | this._currentElement = nextParentElement; | ||
15944 | this._context = nextUnmaskedContext; | ||
15945 | inst.props = nextProps; | ||
15946 | inst.state = nextState; | ||
15947 | inst.context = nextContext; | ||
14968 | } | 15948 | } |
14969 | }, | 15949 | }, |
14970 | 15950 | ||
15951 | _processPendingState: function (props, context) { | ||
15952 | var inst = this._instance; | ||
15953 | var queue = this._pendingStateQueue; | ||
15954 | var replace = this._pendingReplaceState; | ||
15955 | this._pendingReplaceState = false; | ||
15956 | this._pendingStateQueue = null; | ||
15957 | |||
15958 | if (!queue) { | ||
15959 | return inst.state; | ||
15960 | } | ||
15961 | |||
15962 | if (replace && queue.length === 1) { | ||
15963 | return queue[0]; | ||
15964 | } | ||
15965 | |||
15966 | var nextState = _assign({}, replace ? queue[0] : inst.state); | ||
15967 | for (var i = replace ? 1 : 0; i < queue.length; i++) { | ||
15968 | var partial = queue[i]; | ||
15969 | _assign(nextState, typeof partial === 'function' ? partial.call(inst, nextState, props, context) : partial); | ||
15970 | } | ||
15971 | |||
15972 | return nextState; | ||
15973 | }, | ||
15974 | |||
14971 | /** | 15975 | /** |
14972 | * Listen to DOM events during the capture phase. | 15976 | * Merges new props and state, notifies delegate methods of update and |
15977 | * performs update. | ||
14973 | * | 15978 | * |
14974 | * @param {DOMEventTarget} target DOM element to register listener on. | 15979 | * @param {ReactElement} nextElement Next element |
14975 | * @param {string} eventType Event type, e.g. 'click' or 'mouseover'. | 15980 | * @param {object} nextProps Next public object to set as properties. |
14976 | * @param {function} callback Callback function. | 15981 | * @param {?object} nextState Next object to set as state. |
14977 | * @return {object} Object with a `remove` method. | 15982 | * @param {?object} nextContext Next public object to set as context. |
15983 | * @param {ReactReconcileTransaction} transaction | ||
15984 | * @param {?object} unmaskedContext | ||
15985 | * @private | ||
14978 | */ | 15986 | */ |
14979 | capture: function (target, eventType, callback) { | 15987 | _performComponentUpdate: function (nextElement, nextProps, nextState, nextContext, transaction, unmaskedContext) { |
14980 | if (target.addEventListener) { | 15988 | var _this2 = this; |
14981 | target.addEventListener(eventType, callback, true); | 15989 | |
14982 | return { | 15990 | var inst = this._instance; |
14983 | remove: function () { | 15991 | |
14984 | target.removeEventListener(eventType, callback, true); | 15992 | var hasComponentDidUpdate = Boolean(inst.componentDidUpdate); |
15993 | var prevProps; | ||
15994 | var prevState; | ||
15995 | var prevContext; | ||
15996 | if (hasComponentDidUpdate) { | ||
15997 | prevProps = inst.props; | ||
15998 | prevState = inst.state; | ||
15999 | prevContext = inst.context; | ||
16000 | } | ||
16001 | |||
16002 | if (inst.componentWillUpdate) { | ||
16003 | if (process.env.NODE_ENV !== 'production') { | ||
16004 | if (this._debugID !== 0) { | ||
16005 | ReactInstrumentation.debugTool.onBeginLifeCycleTimer(this._debugID, 'componentWillUpdate'); | ||
14985 | } | 16006 | } |
14986 | }; | 16007 | } |
16008 | inst.componentWillUpdate(nextProps, nextState, nextContext); | ||
16009 | if (process.env.NODE_ENV !== 'production') { | ||
16010 | if (this._debugID !== 0) { | ||
16011 | ReactInstrumentation.debugTool.onEndLifeCycleTimer(this._debugID, 'componentWillUpdate'); | ||
16012 | } | ||
16013 | } | ||
16014 | } | ||
16015 | |||
16016 | this._currentElement = nextElement; | ||
16017 | this._context = unmaskedContext; | ||
16018 | inst.props = nextProps; | ||
16019 | inst.state = nextState; | ||
16020 | inst.context = nextContext; | ||
16021 | |||
16022 | this._updateRenderedComponent(transaction, unmaskedContext); | ||
16023 | |||
16024 | if (hasComponentDidUpdate) { | ||
16025 | if (process.env.NODE_ENV !== 'production') { | ||
16026 | transaction.getReactMountReady().enqueue(invokeComponentDidUpdateWithTimer.bind(this, prevProps, prevState, prevContext), this); | ||
16027 | } else { | ||
16028 | transaction.getReactMountReady().enqueue(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), inst); | ||
16029 | } | ||
16030 | } | ||
16031 | |||
16032 | if (process.env.NODE_ENV !== 'production') { | ||
16033 | if (this._debugID) { | ||
16034 | var callback = function () { | ||
16035 | return ReactInstrumentation.debugTool.onComponentHasUpdated(_this2._debugID); | ||
16036 | }; | ||
16037 | transaction.getReactMountReady().enqueue(callback, this); | ||
16038 | } | ||
16039 | } | ||
16040 | }, | ||
16041 | |||
16042 | /** | ||
16043 | * Call the component's `render` method and update the DOM accordingly. | ||
16044 | * | ||
16045 | * @param {ReactReconcileTransaction} transaction | ||
16046 | * @internal | ||
16047 | */ | ||
16048 | _updateRenderedComponent: function (transaction, context) { | ||
16049 | var prevComponentInstance = this._renderedComponent; | ||
16050 | var prevRenderedElement = prevComponentInstance._currentElement; | ||
16051 | var nextRenderedElement = this._renderValidatedComponent(); | ||
16052 | if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) { | ||
16053 | ReactReconciler.receiveComponent(prevComponentInstance, nextRenderedElement, transaction, this._processChildContext(context)); | ||
14987 | } else { | 16054 | } else { |
16055 | var oldHostNode = ReactReconciler.getHostNode(prevComponentInstance); | ||
16056 | ReactReconciler.unmountComponent(prevComponentInstance, false); | ||
16057 | |||
16058 | var nodeType = ReactNodeTypes.getType(nextRenderedElement); | ||
16059 | this._renderedNodeType = nodeType; | ||
16060 | var child = this._instantiateReactComponent(nextRenderedElement, nodeType !== ReactNodeTypes.EMPTY /* shouldHaveDebugID */ | ||
16061 | ); | ||
16062 | this._renderedComponent = child; | ||
14988 | if (process.env.NODE_ENV !== 'production') { | 16063 | if (process.env.NODE_ENV !== 'production') { |
14989 | 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.'); | 16064 | if (child._debugID !== 0 && this._debugID !== 0) { |
16065 | ReactInstrumentation.debugTool.onSetParent(child._debugID, this._debugID); | ||
16066 | } | ||
16067 | } | ||
16068 | |||
16069 | var nextMarkup = ReactReconciler.mountComponent(child, transaction, this._hostParent, this._hostContainerInfo, this._processChildContext(context)); | ||
16070 | |||
16071 | if (process.env.NODE_ENV !== 'production') { | ||
16072 | if (this._debugID !== 0) { | ||
16073 | ReactInstrumentation.debugTool.onSetChildren(this._debugID, child._debugID !== 0 ? [child._debugID] : []); | ||
16074 | } | ||
16075 | } | ||
16076 | |||
16077 | this._replaceNodeWithMarkup(oldHostNode, nextMarkup, prevComponentInstance); | ||
16078 | } | ||
16079 | }, | ||
16080 | |||
16081 | /** | ||
16082 | * Overridden in shallow rendering. | ||
16083 | * | ||
16084 | * @protected | ||
16085 | */ | ||
16086 | _replaceNodeWithMarkup: function (oldHostNode, nextMarkup, prevInstance) { | ||
16087 | ReactComponentEnvironment.replaceNodeWithMarkup(oldHostNode, nextMarkup, prevInstance); | ||
16088 | }, | ||
16089 | |||
16090 | /** | ||
16091 | * @protected | ||
16092 | */ | ||
16093 | _renderValidatedComponentWithoutOwnerOrContext: function () { | ||
16094 | var inst = this._instance; | ||
16095 | |||
16096 | if (process.env.NODE_ENV !== 'production') { | ||
16097 | if (this._debugID !== 0) { | ||
16098 | ReactInstrumentation.debugTool.onBeginLifeCycleTimer(this._debugID, 'render'); | ||
16099 | } | ||
16100 | } | ||
16101 | var renderedComponent = inst.render(); | ||
16102 | if (process.env.NODE_ENV !== 'production') { | ||
16103 | if (this._debugID !== 0) { | ||
16104 | ReactInstrumentation.debugTool.onEndLifeCycleTimer(this._debugID, 'render'); | ||
16105 | } | ||
16106 | } | ||
16107 | |||
16108 | if (process.env.NODE_ENV !== 'production') { | ||
16109 | // We allow auto-mocks to proceed as if they're returning null. | ||
16110 | if (renderedComponent === undefined && inst.render._isMockFunction) { | ||
16111 | // This is probably bad practice. Consider warning here and | ||
16112 | // deprecating this convenience. | ||
16113 | renderedComponent = null; | ||
14990 | } | 16114 | } |
14991 | return { | ||
14992 | remove: emptyFunction | ||
14993 | }; | ||
14994 | } | 16115 | } |
16116 | |||
16117 | return renderedComponent; | ||
16118 | }, | ||
16119 | |||
16120 | /** | ||
16121 | * @private | ||
16122 | */ | ||
16123 | _renderValidatedComponent: function () { | ||
16124 | var renderedComponent; | ||
16125 | if (process.env.NODE_ENV !== 'production' || this._compositeType !== CompositeTypes.StatelessFunctional) { | ||
16126 | ReactCurrentOwner.current = this; | ||
16127 | try { | ||
16128 | renderedComponent = this._renderValidatedComponentWithoutOwnerOrContext(); | ||
16129 | } finally { | ||
16130 | ReactCurrentOwner.current = null; | ||
16131 | } | ||
16132 | } else { | ||
16133 | renderedComponent = this._renderValidatedComponentWithoutOwnerOrContext(); | ||
16134 | } | ||
16135 | !( | ||
16136 | // TODO: An `isValidNode` function would probably be more appropriate | ||
16137 | renderedComponent === null || renderedComponent === false || ReactElement.isValidElement(renderedComponent)) ? 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; | ||
16138 | |||
16139 | return renderedComponent; | ||
14995 | }, | 16140 | }, |
14996 | 16141 | ||
14997 | registerDefault: function () {} | 16142 | /** |
16143 | * Lazily allocates the refs object and stores `component` as `ref`. | ||
16144 | * | ||
16145 | * @param {string} ref Reference name. | ||
16146 | * @param {component} component Component to store as `ref`. | ||
16147 | * @final | ||
16148 | * @private | ||
16149 | */ | ||
16150 | attachRef: function (ref, component) { | ||
16151 | var inst = this.getPublicInstance(); | ||
16152 | !(inst != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Stateless function components cannot have refs.') : _prodInvariant('110') : void 0; | ||
16153 | var publicComponentInstance = component.getPublicInstance(); | ||
16154 | if (process.env.NODE_ENV !== 'production') { | ||
16155 | var componentName = component && component.getName ? component.getName() : 'a component'; | ||
16156 | process.env.NODE_ENV !== 'production' ? warning(publicComponentInstance != null, '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; | ||
16157 | } | ||
16158 | var refs = inst.refs === emptyObject ? inst.refs = {} : inst.refs; | ||
16159 | refs[ref] = publicComponentInstance; | ||
16160 | }, | ||
16161 | |||
16162 | /** | ||
16163 | * Detaches a reference name. | ||
16164 | * | ||
16165 | * @param {string} ref Name to dereference. | ||
16166 | * @final | ||
16167 | * @private | ||
16168 | */ | ||
16169 | detachRef: function (ref) { | ||
16170 | var refs = this.getPublicInstance().refs; | ||
16171 | delete refs[ref]; | ||
16172 | }, | ||
16173 | |||
16174 | /** | ||
16175 | * Get a text description of the component that can be used to identify it | ||
16176 | * in error messages. | ||
16177 | * @return {string} The name or null. | ||
16178 | * @internal | ||
16179 | */ | ||
16180 | getName: function () { | ||
16181 | var type = this._currentElement.type; | ||
16182 | var constructor = this._instance && this._instance.constructor; | ||
16183 | return type.displayName || constructor && constructor.displayName || type.name || constructor && constructor.name || null; | ||
16184 | }, | ||
16185 | |||
16186 | /** | ||
16187 | * Get the publicly accessible representation of this component - i.e. what | ||
16188 | * is exposed by refs and returned by render. Can be null for stateless | ||
16189 | * components. | ||
16190 | * | ||
16191 | * @return {ReactComponent} the public component instance. | ||
16192 | * @internal | ||
16193 | */ | ||
16194 | getPublicInstance: function () { | ||
16195 | var inst = this._instance; | ||
16196 | if (this._compositeType === CompositeTypes.StatelessFunctional) { | ||
16197 | return null; | ||
16198 | } | ||
16199 | return inst; | ||
16200 | }, | ||
16201 | |||
16202 | // Stub | ||
16203 | _instantiateReactComponent: null | ||
16204 | |||
14998 | }; | 16205 | }; |
14999 | 16206 | ||
15000 | module.exports = EventListener; | 16207 | var ReactCompositeComponent = { |
15001 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | 16208 | |
16209 | Mixin: ReactCompositeComponentMixin | ||
16210 | |||
16211 | }; | ||
16212 | |||
16213 | module.exports = ReactCompositeComponent; | ||
16214 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
15002 | 16215 | ||
15003 | /***/ }, | 16216 | /***/ }, |
15004 | /* 122 */ | 16217 | /* 130 */ |
16218 | /***/ function(module, exports, __webpack_require__) { | ||
16219 | |||
16220 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
16221 | * Copyright 2013-present, Facebook, Inc. | ||
16222 | * All rights reserved. | ||
16223 | * | ||
16224 | * This source code is licensed under the BSD-style license found in the | ||
16225 | * LICENSE file in the root directory of this source tree. An additional grant | ||
16226 | * of patent rights can be found in the PATENTS file in the same directory. | ||
16227 | * | ||
16228 | * @providesModule ReactNodeTypes | ||
16229 | * | ||
16230 | */ | ||
16231 | |||
16232 | 'use strict'; | ||
16233 | |||
16234 | var _prodInvariant = __webpack_require__(9); | ||
16235 | |||
16236 | var ReactElement = __webpack_require__(11); | ||
16237 | |||
16238 | var invariant = __webpack_require__(10); | ||
16239 | |||
16240 | var ReactNodeTypes = { | ||
16241 | HOST: 0, | ||
16242 | COMPOSITE: 1, | ||
16243 | EMPTY: 2, | ||
16244 | |||
16245 | getType: function (node) { | ||
16246 | if (node === null || node === false) { | ||
16247 | return ReactNodeTypes.EMPTY; | ||
16248 | } else if (ReactElement.isValidElement(node)) { | ||
16249 | if (typeof node.type === 'function') { | ||
16250 | return ReactNodeTypes.COMPOSITE; | ||
16251 | } else { | ||
16252 | return ReactNodeTypes.HOST; | ||
16253 | } | ||
16254 | } | ||
16255 | true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Unexpected node: %s', node) : _prodInvariant('26', node) : void 0; | ||
16256 | } | ||
16257 | }; | ||
16258 | |||
16259 | module.exports = ReactNodeTypes; | ||
16260 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
16261 | |||
16262 | /***/ }, | ||
16263 | /* 131 */ | ||
15005 | /***/ function(module, exports) { | 16264 | /***/ function(module, exports) { |
15006 | 16265 | ||
15007 | /** | 16266 | /** |
15008 | * Copyright 2013-2015, Facebook, Inc. | 16267 | * Copyright (c) 2013-present, Facebook, Inc. |
15009 | * All rights reserved. | 16268 | * All rights reserved. |
15010 | * | 16269 | * |
15011 | * This source code is licensed under the BSD-style license found in the | 16270 | * This source code is licensed under the BSD-style license found in the |
15012 | * LICENSE file in the root directory of this source tree. An additional grant | 16271 | * LICENSE file in the root directory of this source tree. An additional grant |
15013 | * of patent rights can be found in the PATENTS file in the same directory. | 16272 | * of patent rights can be found in the PATENTS file in the same directory. |
15014 | * | 16273 | * |
15015 | * @providesModule getUnboundedScrollPosition | ||
15016 | * @typechecks | 16274 | * @typechecks |
16275 | * | ||
15017 | */ | 16276 | */ |
15018 | 16277 | ||
16278 | /*eslint-disable no-self-compare */ | ||
16279 | |||
15019 | 'use strict'; | 16280 | 'use strict'; |
15020 | 16281 | ||
16282 | var hasOwnProperty = Object.prototype.hasOwnProperty; | ||
16283 | |||
15021 | /** | 16284 | /** |
15022 | * Gets the scroll position of the supplied element or window. | 16285 | * inlined Object.is polyfill to avoid requiring consumers ship their own |
16286 | * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is | ||
16287 | */ | ||
16288 | function is(x, y) { | ||
16289 | // SameValue algorithm | ||
16290 | if (x === y) { | ||
16291 | // Steps 1-5, 7-10 | ||
16292 | // Steps 6.b-6.e: +0 != -0 | ||
16293 | return x !== 0 || 1 / x === 1 / y; | ||
16294 | } else { | ||
16295 | // Step 6.a: NaN == NaN | ||
16296 | return x !== x && y !== y; | ||
16297 | } | ||
16298 | } | ||
16299 | |||
16300 | /** | ||
16301 | * Performs equality by iterating through keys on an object and returning false | ||
16302 | * when any key has values which are not strictly equal between the arguments. | ||
16303 | * Returns true when the values of all keys are strictly equal. | ||
16304 | */ | ||
16305 | function shallowEqual(objA, objB) { | ||
16306 | if (is(objA, objB)) { | ||
16307 | return true; | ||
16308 | } | ||
16309 | |||
16310 | if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) { | ||
16311 | return false; | ||
16312 | } | ||
16313 | |||
16314 | var keysA = Object.keys(objA); | ||
16315 | var keysB = Object.keys(objB); | ||
16316 | |||
16317 | if (keysA.length !== keysB.length) { | ||
16318 | return false; | ||
16319 | } | ||
16320 | |||
16321 | // Test for A's keys different from B. | ||
16322 | for (var i = 0; i < keysA.length; i++) { | ||
16323 | if (!hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) { | ||
16324 | return false; | ||
16325 | } | ||
16326 | } | ||
16327 | |||
16328 | return true; | ||
16329 | } | ||
16330 | |||
16331 | module.exports = shallowEqual; | ||
16332 | |||
16333 | /***/ }, | ||
16334 | /* 132 */ | ||
16335 | /***/ function(module, exports) { | ||
16336 | |||
16337 | /** | ||
16338 | * Copyright 2013-present, Facebook, Inc. | ||
16339 | * All rights reserved. | ||
15023 | * | 16340 | * |
15024 | * The return values are unbounded, unlike `getScrollPosition`. This means they | 16341 | * This source code is licensed under the BSD-style license found in the |
15025 | * may be negative or exceed the element boundaries (which is possible using | 16342 | * LICENSE file in the root directory of this source tree. An additional grant |
15026 | * inertial scrolling). | 16343 | * of patent rights can be found in the PATENTS file in the same directory. |
15027 | * | 16344 | * |
15028 | * @param {DOMWindow|DOMElement} scrollable | 16345 | * @providesModule shouldUpdateReactComponent |
15029 | * @return {object} Map with `x` and `y` keys. | ||
15030 | */ | 16346 | */ |
15031 | function getUnboundedScrollPosition(scrollable) { | 16347 | |
15032 | if (scrollable === window) { | 16348 | 'use strict'; |
15033 | return { | 16349 | |
15034 | x: window.pageXOffset || document.documentElement.scrollLeft, | 16350 | /** |
15035 | y: window.pageYOffset || document.documentElement.scrollTop | 16351 | * Given a `prevElement` and `nextElement`, determines if the existing |
15036 | }; | 16352 | * instance should be updated as opposed to being destroyed or replaced by a new |
16353 | * instance. Both arguments are elements. This ensures that this logic can | ||
16354 | * operate on stateless trees without any backing instance. | ||
16355 | * | ||
16356 | * @param {?object} prevElement | ||
16357 | * @param {?object} nextElement | ||
16358 | * @return {boolean} True if the existing instance should be updated. | ||
16359 | * @protected | ||
16360 | */ | ||
16361 | |||
16362 | function shouldUpdateReactComponent(prevElement, nextElement) { | ||
16363 | var prevEmpty = prevElement === null || prevElement === false; | ||
16364 | var nextEmpty = nextElement === null || nextElement === false; | ||
16365 | if (prevEmpty || nextEmpty) { | ||
16366 | return prevEmpty === nextEmpty; | ||
16367 | } | ||
16368 | |||
16369 | var prevType = typeof prevElement; | ||
16370 | var nextType = typeof nextElement; | ||
16371 | if (prevType === 'string' || prevType === 'number') { | ||
16372 | return nextType === 'string' || nextType === 'number'; | ||
16373 | } else { | ||
16374 | return nextType === 'object' && prevElement.type === nextElement.type && prevElement.key === nextElement.key; | ||
15037 | } | 16375 | } |
15038 | return { | ||
15039 | x: scrollable.scrollLeft, | ||
15040 | y: scrollable.scrollTop | ||
15041 | }; | ||
15042 | } | 16376 | } |
15043 | 16377 | ||
15044 | module.exports = getUnboundedScrollPosition; | 16378 | module.exports = shouldUpdateReactComponent; |
15045 | 16379 | ||
15046 | /***/ }, | 16380 | /***/ }, |
15047 | /* 123 */ | 16381 | /* 133 */ |
15048 | /***/ function(module, exports, __webpack_require__) { | 16382 | /***/ function(module, exports) { |
15049 | 16383 | ||
15050 | /** | 16384 | /** |
15051 | * Copyright 2013-2015, Facebook, Inc. | 16385 | * Copyright 2014-present, Facebook, Inc. |
15052 | * All rights reserved. | 16386 | * All rights reserved. |
15053 | * | 16387 | * |
15054 | * This source code is licensed under the BSD-style license found in the | 16388 | * This source code is licensed under the BSD-style license found in the |
15055 | * LICENSE file in the root directory of this source tree. An additional grant | 16389 | * LICENSE file in the root directory of this source tree. An additional grant |
15056 | * of patent rights can be found in the PATENTS file in the same directory. | 16390 | * of patent rights can be found in the PATENTS file in the same directory. |
15057 | * | 16391 | * |
15058 | * @providesModule ReactInjection | 16392 | * @providesModule ReactEmptyComponent |
15059 | */ | 16393 | */ |
15060 | 16394 | ||
15061 | 'use strict'; | 16395 | 'use strict'; |
15062 | 16396 | ||
15063 | var DOMProperty = __webpack_require__(25); | 16397 | var emptyComponentFactory; |
15064 | var EventPluginHub = __webpack_require__(33); | ||
15065 | var ReactComponentEnvironment = __webpack_require__(66); | ||
15066 | var ReactClass = __webpack_require__(124); | ||
15067 | var ReactEmptyComponent = __webpack_require__(70); | ||
15068 | var ReactBrowserEventEmitter = __webpack_require__(31); | ||
15069 | var ReactNativeComponent = __webpack_require__(71); | ||
15070 | var ReactPerf = __webpack_require__(20); | ||
15071 | var ReactRootIndex = __webpack_require__(48); | ||
15072 | var ReactUpdates = __webpack_require__(56); | ||
15073 | 16398 | ||
15074 | var ReactInjection = { | 16399 | var ReactEmptyComponentInjection = { |
15075 | Component: ReactComponentEnvironment.injection, | 16400 | injectEmptyComponentFactory: function (factory) { |
15076 | Class: ReactClass.injection, | 16401 | emptyComponentFactory = factory; |
15077 | DOMProperty: DOMProperty.injection, | 16402 | } |
15078 | EmptyComponent: ReactEmptyComponent.injection, | ||
15079 | EventPluginHub: EventPluginHub.injection, | ||
15080 | EventEmitter: ReactBrowserEventEmitter.injection, | ||
15081 | NativeComponent: ReactNativeComponent.injection, | ||
15082 | Perf: ReactPerf.injection, | ||
15083 | RootIndex: ReactRootIndex.injection, | ||
15084 | Updates: ReactUpdates.injection | ||
15085 | }; | 16403 | }; |
15086 | 16404 | ||
15087 | module.exports = ReactInjection; | 16405 | var ReactEmptyComponent = { |
16406 | create: function (instantiate) { | ||
16407 | return emptyComponentFactory(instantiate); | ||
16408 | } | ||
16409 | }; | ||
16410 | |||
16411 | ReactEmptyComponent.injection = ReactEmptyComponentInjection; | ||
16412 | |||
16413 | module.exports = ReactEmptyComponent; | ||
15088 | 16414 | ||
15089 | /***/ }, | 16415 | /***/ }, |
15090 | /* 124 */ | 16416 | /* 134 */ |
15091 | /***/ function(module, exports, __webpack_require__) { | 16417 | /***/ function(module, exports, __webpack_require__) { |
15092 | 16418 | ||
15093 | /* WEBPACK VAR INJECTION */(function(process) {/** | 16419 | /* WEBPACK VAR INJECTION */(function(process) {/** |
15094 | * Copyright 2013-2015, Facebook, Inc. | 16420 | * Copyright 2014-present, Facebook, Inc. |
15095 | * All rights reserved. | 16421 | * All rights reserved. |
15096 | * | 16422 | * |
15097 | * This source code is licensed under the BSD-style license found in the | 16423 | * This source code is licensed under the BSD-style license found in the |
15098 | * LICENSE file in the root directory of this source tree. An additional grant | 16424 | * LICENSE file in the root directory of this source tree. An additional grant |
15099 | * of patent rights can be found in the PATENTS file in the same directory. | 16425 | * of patent rights can be found in the PATENTS file in the same directory. |
15100 | * | 16426 | * |
15101 | * @providesModule ReactClass | 16427 | * @providesModule ReactHostComponent |
15102 | */ | 16428 | */ |
15103 | 16429 | ||
15104 | 'use strict'; | 16430 | 'use strict'; |
15105 | 16431 | ||
15106 | var ReactComponent = __webpack_require__(125); | 16432 | var _prodInvariant = __webpack_require__(9), |
15107 | var ReactElement = __webpack_require__(44); | 16433 | _assign = __webpack_require__(6); |
15108 | var ReactPropTypeLocations = __webpack_require__(67); | ||
15109 | var ReactPropTypeLocationNames = __webpack_require__(68); | ||
15110 | var ReactNoopUpdateQueue = __webpack_require__(126); | ||
15111 | 16434 | ||
15112 | var assign = __webpack_require__(41); | 16435 | var invariant = __webpack_require__(10); |
15113 | var emptyObject = __webpack_require__(60); | ||
15114 | var invariant = __webpack_require__(15); | ||
15115 | var keyMirror = __webpack_require__(19); | ||
15116 | var keyOf = __webpack_require__(81); | ||
15117 | var warning = __webpack_require__(27); | ||
15118 | 16436 | ||
15119 | var MIXINS_KEY = keyOf({ mixins: null }); | 16437 | var genericComponentClass = null; |
16438 | // This registry keeps track of wrapper classes around host tags. | ||
16439 | var tagToComponentClass = {}; | ||
16440 | var textComponentClass = null; | ||
16441 | |||
16442 | var ReactHostComponentInjection = { | ||
16443 | // This accepts a class that receives the tag string. This is a catch all | ||
16444 | // that can render any kind of tag. | ||
16445 | injectGenericComponentClass: function (componentClass) { | ||
16446 | genericComponentClass = componentClass; | ||
16447 | }, | ||
16448 | // This accepts a text component class that takes the text string to be | ||
16449 | // rendered as props. | ||
16450 | injectTextComponentClass: function (componentClass) { | ||
16451 | textComponentClass = componentClass; | ||
16452 | }, | ||
16453 | // This accepts a keyed object with classes as values. Each key represents a | ||
16454 | // tag. That particular tag will use this class instead of the generic one. | ||
16455 | injectComponentClasses: function (componentClasses) { | ||
16456 | _assign(tagToComponentClass, componentClasses); | ||
16457 | } | ||
16458 | }; | ||
15120 | 16459 | ||
15121 | /** | 16460 | /** |
15122 | * Policies that describe methods in `ReactClassInterface`. | 16461 | * Get a host internal component class for a specific tag. |
16462 | * | ||
16463 | * @param {ReactElement} element The element to create. | ||
16464 | * @return {function} The internal class constructor function. | ||
15123 | */ | 16465 | */ |
15124 | var SpecPolicy = keyMirror({ | 16466 | function createInternalComponent(element) { |
15125 | /** | 16467 | !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; |
15126 | * These methods may be defined only once by the class specification or mixin. | 16468 | return new genericComponentClass(element); |
15127 | */ | 16469 | } |
15128 | DEFINE_ONCE: null, | ||
15129 | /** | ||
15130 | * These methods may be defined by both the class specification and mixins. | ||
15131 | * Subsequent definitions will be chained. These methods must return void. | ||
15132 | */ | ||
15133 | DEFINE_MANY: null, | ||
15134 | /** | ||
15135 | * These methods are overriding the base class. | ||
15136 | */ | ||
15137 | OVERRIDE_BASE: null, | ||
15138 | /** | ||
15139 | * These methods are similar to DEFINE_MANY, except we assume they return | ||
15140 | * objects. We try to merge the keys of the return values of all the mixed in | ||
15141 | * functions. If there is a key conflict we throw. | ||
15142 | */ | ||
15143 | DEFINE_MANY_MERGED: null | ||
15144 | }); | ||
15145 | |||
15146 | var injectedMixins = []; | ||
15147 | 16470 | ||
15148 | var warnedSetProps = false; | 16471 | /** |
15149 | function warnSetProps() { | 16472 | * @param {ReactText} text |
15150 | if (!warnedSetProps) { | 16473 | * @return {ReactComponent} |
15151 | warnedSetProps = true; | 16474 | */ |
15152 | process.env.NODE_ENV !== 'production' ? warning(false, 'setProps(...) and replaceProps(...) are deprecated. ' + 'Instead, call render again at the top level.') : undefined; | 16475 | function createInstanceForText(text) { |
15153 | } | 16476 | return new textComponentClass(text); |
15154 | } | 16477 | } |
15155 | 16478 | ||
15156 | /** | 16479 | /** |
15157 | * Composite components are higher-level components that compose other composite | 16480 | * @param {ReactComponent} component |
15158 | * or native components. | 16481 | * @return {boolean} |
16482 | */ | ||
16483 | function isTextComponent(component) { | ||
16484 | return component instanceof textComponentClass; | ||
16485 | } | ||
16486 | |||
16487 | var ReactHostComponent = { | ||
16488 | createInternalComponent: createInternalComponent, | ||
16489 | createInstanceForText: createInstanceForText, | ||
16490 | isTextComponent: isTextComponent, | ||
16491 | injection: ReactHostComponentInjection | ||
16492 | }; | ||
16493 | |||
16494 | module.exports = ReactHostComponent; | ||
16495 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
16496 | |||
16497 | /***/ }, | ||
16498 | /* 135 */ | ||
16499 | /***/ function(module, exports, __webpack_require__) { | ||
16500 | |||
16501 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
16502 | * Copyright 2013-present, Facebook, Inc. | ||
16503 | * All rights reserved. | ||
15159 | * | 16504 | * |
15160 | * To create a new type of `ReactClass`, pass a specification of | 16505 | * This source code is licensed under the BSD-style license found in the |
15161 | * your new class to `React.createClass`. The only requirement of your class | 16506 | * LICENSE file in the root directory of this source tree. An additional grant |
15162 | * specification is that you implement a `render` method. | 16507 | * of patent rights can be found in the PATENTS file in the same directory. |
15163 | * | 16508 | * |
15164 | * var MyComponent = React.createClass({ | 16509 | * @providesModule flattenChildren |
15165 | * render: function() { | 16510 | * |
15166 | * return <div>Hello World</div>; | 16511 | */ |
15167 | * } | 16512 | |
15168 | * }); | 16513 | 'use strict'; |
16514 | |||
16515 | var KeyEscapeUtils = __webpack_require__(18); | ||
16516 | var traverseAllChildren = __webpack_require__(16); | ||
16517 | var warning = __webpack_require__(13); | ||
16518 | |||
16519 | var ReactComponentTreeDevtool; | ||
16520 | |||
16521 | if (typeof process !== 'undefined' && process.env && process.env.NODE_ENV === 'test') { | ||
16522 | // Temporary hack. | ||
16523 | // Inline requires don't work well with Jest: | ||
16524 | // https://github.com/facebook/react/issues/7240 | ||
16525 | // Remove the inline requires when we don't need them anymore: | ||
16526 | // https://github.com/facebook/react/pull/7178 | ||
16527 | ReactComponentTreeDevtool = __webpack_require__(31); | ||
16528 | } | ||
16529 | |||
16530 | /** | ||
16531 | * @param {function} traverseContext Context passed through traversal. | ||
16532 | * @param {?ReactComponent} child React child component. | ||
16533 | * @param {!string} name String name of key path to child. | ||
16534 | * @param {number=} selfDebugID Optional debugID of the current internal instance. | ||
16535 | */ | ||
16536 | function flattenSingleChildIntoContext(traverseContext, child, name, selfDebugID) { | ||
16537 | // We found a component instance. | ||
16538 | if (traverseContext && typeof traverseContext === 'object') { | ||
16539 | var result = traverseContext; | ||
16540 | var keyUnique = result[name] === undefined; | ||
16541 | if (process.env.NODE_ENV !== 'production') { | ||
16542 | if (!ReactComponentTreeDevtool) { | ||
16543 | ReactComponentTreeDevtool = __webpack_require__(31); | ||
16544 | } | ||
16545 | process.env.NODE_ENV !== 'production' ? warning(keyUnique, '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), ReactComponentTreeDevtool.getStackAddendumByID(selfDebugID)) : void 0; | ||
16546 | } | ||
16547 | if (keyUnique && child != null) { | ||
16548 | result[name] = child; | ||
16549 | } | ||
16550 | } | ||
16551 | } | ||
16552 | |||
16553 | /** | ||
16554 | * Flattens children that are typically specified as `props.children`. Any null | ||
16555 | * children will not be included in the resulting object. | ||
16556 | * @return {!object} flattened children keyed by name. | ||
16557 | */ | ||
16558 | function flattenChildren(children, selfDebugID) { | ||
16559 | if (children == null) { | ||
16560 | return children; | ||
16561 | } | ||
16562 | var result = {}; | ||
16563 | |||
16564 | if (process.env.NODE_ENV !== 'production') { | ||
16565 | traverseAllChildren(children, function (traverseContext, child, name) { | ||
16566 | return flattenSingleChildIntoContext(traverseContext, child, name, selfDebugID); | ||
16567 | }, result); | ||
16568 | } else { | ||
16569 | traverseAllChildren(children, flattenSingleChildIntoContext, result); | ||
16570 | } | ||
16571 | return result; | ||
16572 | } | ||
16573 | |||
16574 | module.exports = flattenChildren; | ||
16575 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
16576 | |||
16577 | /***/ }, | ||
16578 | /* 136 */ | ||
16579 | /***/ function(module, exports, __webpack_require__) { | ||
16580 | |||
16581 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
16582 | * Copyright 2014-present, Facebook, Inc. | ||
16583 | * All rights reserved. | ||
15169 | * | 16584 | * |
15170 | * The class specification supports a specific protocol of methods that have | 16585 | * This source code is licensed under the BSD-style license found in the |
15171 | * special meaning (e.g. `render`). See `ReactClassInterface` for | 16586 | * LICENSE file in the root directory of this source tree. An additional grant |
15172 | * more the comprehensive protocol. Any other properties and methods in the | 16587 | * of patent rights can be found in the PATENTS file in the same directory. |
15173 | * class specification will be available on the prototype. | ||
15174 | * | 16588 | * |
15175 | * @interface ReactClassInterface | 16589 | * @providesModule ReactServerRenderingTransaction |
15176 | * @internal | ||
15177 | */ | 16590 | */ |
15178 | var ReactClassInterface = { | ||
15179 | 16591 | ||
15180 | /** | 16592 | 'use strict'; |
15181 | * An array of Mixin objects to include when defining your component. | 16593 | |
15182 | * | 16594 | var _assign = __webpack_require__(6); |
15183 | * @type {array} | 16595 | |
15184 | * @optional | 16596 | var PooledClass = __webpack_require__(8); |
15185 | */ | 16597 | var Transaction = __webpack_require__(72); |
15186 | mixins: SpecPolicy.DEFINE_MANY, | 16598 | var ReactInstrumentation = __webpack_require__(65); |
16599 | var ReactServerUpdateQueue = __webpack_require__(137); | ||
15187 | 16600 | ||
16601 | /** | ||
16602 | * Executed within the scope of the `Transaction` instance. Consider these as | ||
16603 | * being member methods, but with an implied ordering while being isolated from | ||
16604 | * each other. | ||
16605 | */ | ||
16606 | var TRANSACTION_WRAPPERS = []; | ||
16607 | |||
16608 | if (process.env.NODE_ENV !== 'production') { | ||
16609 | TRANSACTION_WRAPPERS.push({ | ||
16610 | initialize: ReactInstrumentation.debugTool.onBeginFlush, | ||
16611 | close: ReactInstrumentation.debugTool.onEndFlush | ||
16612 | }); | ||
16613 | } | ||
16614 | |||
16615 | var noopCallbackQueue = { | ||
16616 | enqueue: function () {} | ||
16617 | }; | ||
16618 | |||
16619 | /** | ||
16620 | * @class ReactServerRenderingTransaction | ||
16621 | * @param {boolean} renderToStaticMarkup | ||
16622 | */ | ||
16623 | function ReactServerRenderingTransaction(renderToStaticMarkup) { | ||
16624 | this.reinitializeTransaction(); | ||
16625 | this.renderToStaticMarkup = renderToStaticMarkup; | ||
16626 | this.useCreateElement = false; | ||
16627 | this.updateQueue = new ReactServerUpdateQueue(this); | ||
16628 | } | ||
16629 | |||
16630 | var Mixin = { | ||
15188 | /** | 16631 | /** |
15189 | * An object containing properties and methods that should be defined on | 16632 | * @see Transaction |
15190 | * the component's constructor instead of its prototype (static methods). | 16633 | * @abstract |
15191 | * | 16634 | * @final |
15192 | * @type {object} | 16635 | * @return {array} Empty list of operation wrap procedures. |
15193 | * @optional | ||
15194 | */ | 16636 | */ |
15195 | statics: SpecPolicy.DEFINE_MANY, | 16637 | getTransactionWrappers: function () { |
16638 | return TRANSACTION_WRAPPERS; | ||
16639 | }, | ||
15196 | 16640 | ||
15197 | /** | 16641 | /** |
15198 | * Definition of prop types for this component. | 16642 | * @return {object} The queue to collect `onDOMReady` callbacks with. |
15199 | * | ||
15200 | * @type {object} | ||
15201 | * @optional | ||
15202 | */ | 16643 | */ |
15203 | propTypes: SpecPolicy.DEFINE_MANY, | 16644 | getReactMountReady: function () { |
16645 | return noopCallbackQueue; | ||
16646 | }, | ||
15204 | 16647 | ||
15205 | /** | 16648 | /** |
15206 | * Definition of context types for this component. | 16649 | * @return {object} The queue to collect React async events. |
15207 | * | ||
15208 | * @type {object} | ||
15209 | * @optional | ||
15210 | */ | 16650 | */ |
15211 | contextTypes: SpecPolicy.DEFINE_MANY, | 16651 | getUpdateQueue: function () { |
16652 | return this.updateQueue; | ||
16653 | }, | ||
15212 | 16654 | ||
15213 | /** | 16655 | /** |
15214 | * Definition of context types this component sets for its children. | 16656 | * `PooledClass` looks for this, and will invoke this before allowing this |
15215 | * | 16657 | * instance to be reused. |
15216 | * @type {object} | ||
15217 | * @optional | ||
15218 | */ | 16658 | */ |
15219 | childContextTypes: SpecPolicy.DEFINE_MANY, | 16659 | destructor: function () {}, |
15220 | 16660 | ||
15221 | // ==== Definition methods ==== | 16661 | checkpoint: function () {}, |
16662 | |||
16663 | rollback: function () {} | ||
16664 | }; | ||
16665 | |||
16666 | _assign(ReactServerRenderingTransaction.prototype, Transaction.Mixin, Mixin); | ||
16667 | |||
16668 | PooledClass.addPoolingTo(ReactServerRenderingTransaction); | ||
16669 | |||
16670 | module.exports = ReactServerRenderingTransaction; | ||
16671 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
16672 | |||
16673 | /***/ }, | ||
16674 | /* 137 */ | ||
16675 | /***/ function(module, exports, __webpack_require__) { | ||
16676 | |||
16677 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
16678 | * Copyright 2015-present, Facebook, Inc. | ||
16679 | * All rights reserved. | ||
16680 | * | ||
16681 | * This source code is licensed under the BSD-style license found in the | ||
16682 | * LICENSE file in the root directory of this source tree. An additional grant | ||
16683 | * of patent rights can be found in the PATENTS file in the same directory. | ||
16684 | * | ||
16685 | * @providesModule ReactServerUpdateQueue | ||
16686 | * | ||
16687 | */ | ||
16688 | |||
16689 | 'use strict'; | ||
16690 | |||
16691 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
16692 | |||
16693 | var ReactUpdateQueue = __webpack_require__(138); | ||
16694 | var Transaction = __webpack_require__(72); | ||
16695 | var warning = __webpack_require__(13); | ||
16696 | |||
16697 | function warnNoop(publicInstance, callerName) { | ||
16698 | if (process.env.NODE_ENV !== 'production') { | ||
16699 | var constructor = publicInstance.constructor; | ||
16700 | 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; | ||
16701 | } | ||
16702 | } | ||
16703 | |||
16704 | /** | ||
16705 | * This is the update queue used for server rendering. | ||
16706 | * It delegates to ReactUpdateQueue while server rendering is in progress and | ||
16707 | * switches to ReactNoopUpdateQueue after the transaction has completed. | ||
16708 | * @class ReactServerUpdateQueue | ||
16709 | * @param {Transaction} transaction | ||
16710 | */ | ||
16711 | |||
16712 | var ReactServerUpdateQueue = function () { | ||
16713 | /* :: transaction: Transaction; */ | ||
16714 | |||
16715 | function ReactServerUpdateQueue(transaction) { | ||
16716 | _classCallCheck(this, ReactServerUpdateQueue); | ||
16717 | |||
16718 | this.transaction = transaction; | ||
16719 | } | ||
15222 | 16720 | ||
15223 | /** | 16721 | /** |
15224 | * Invoked when the component is mounted. Values in the mapping will be set on | 16722 | * Checks whether or not this composite component is mounted. |
15225 | * `this.props` if that prop is not specified (i.e. using an `in` check). | 16723 | * @param {ReactClass} publicInstance The instance we want to test. |
15226 | * | 16724 | * @return {boolean} True if mounted, false otherwise. |
15227 | * This method is invoked before `getInitialState` and therefore cannot rely | 16725 | * @protected |
15228 | * on `this.state` or use `this.setState`. | 16726 | * @final |
15229 | * | ||
15230 | * @return {object} | ||
15231 | * @optional | ||
15232 | */ | 16727 | */ |
15233 | getDefaultProps: SpecPolicy.DEFINE_MANY_MERGED, | 16728 | |
16729 | |||
16730 | ReactServerUpdateQueue.prototype.isMounted = function isMounted(publicInstance) { | ||
16731 | return false; | ||
16732 | }; | ||
15234 | 16733 | ||
15235 | /** | 16734 | /** |
15236 | * Invoked once before the component is mounted. The return value will be used | 16735 | * Enqueue a callback that will be executed after all the pending updates |
15237 | * as the initial value of `this.state`. | 16736 | * have processed. |
15238 | * | ||
15239 | * getInitialState: function() { | ||
15240 | * return { | ||
15241 | * isOn: false, | ||
15242 | * fooBaz: new BazFoo() | ||
15243 | * } | ||
15244 | * } | ||
15245 | * | 16737 | * |
15246 | * @return {object} | 16738 | * @param {ReactClass} publicInstance The instance to use as `this` context. |
15247 | * @optional | 16739 | * @param {?function} callback Called after state is updated. |
16740 | * @internal | ||
15248 | */ | 16741 | */ |
15249 | getInitialState: SpecPolicy.DEFINE_MANY_MERGED, | ||
15250 | 16742 | ||
15251 | /** | 16743 | |
15252 | * @return {object} | 16744 | ReactServerUpdateQueue.prototype.enqueueCallback = function enqueueCallback(publicInstance, callback, callerName) { |
15253 | * @optional | 16745 | if (this.transaction.isInTransaction()) { |
15254 | */ | 16746 | ReactUpdateQueue.enqueueCallback(publicInstance, callback, callerName); |
15255 | getChildContext: SpecPolicy.DEFINE_MANY_MERGED, | 16747 | } |
16748 | }; | ||
15256 | 16749 | ||
15257 | /** | 16750 | /** |
15258 | * Uses props from `this.props` and state from `this.state` to render the | 16751 | * Forces an update. This should only be invoked when it is known with |
15259 | * structure of the component. | 16752 | * certainty that we are **not** in a DOM transaction. |
15260 | * | 16753 | * |
15261 | * No guarantees are made about when or how often this method is invoked, so | 16754 | * You may want to call this when you know that some deeper aspect of the |
15262 | * it must not have side effects. | 16755 | * component's state has changed but `setState` was not called. |
15263 | * | 16756 | * |
15264 | * render: function() { | 16757 | * This will not invoke `shouldComponentUpdate`, but it will invoke |
15265 | * var name = this.props.name; | 16758 | * `componentWillUpdate` and `componentDidUpdate`. |
15266 | * return <div>Hello, {name}!</div>; | ||
15267 | * } | ||
15268 | * | 16759 | * |
15269 | * @return {ReactComponent} | 16760 | * @param {ReactClass} publicInstance The instance that should rerender. |
15270 | * @nosideeffects | 16761 | * @internal |
15271 | * @required | ||
15272 | */ | 16762 | */ |
15273 | render: SpecPolicy.DEFINE_ONCE, | ||
15274 | 16763 | ||
15275 | // ==== Delegate methods ==== | ||
15276 | 16764 | ||
15277 | /** | 16765 | ReactServerUpdateQueue.prototype.enqueueForceUpdate = function enqueueForceUpdate(publicInstance) { |
15278 | * Invoked when the component is initially created and about to be mounted. | 16766 | if (this.transaction.isInTransaction()) { |
15279 | * This may have side effects, but any external subscriptions or data created | 16767 | ReactUpdateQueue.enqueueForceUpdate(publicInstance); |
15280 | * by this method must be cleaned up in `componentWillUnmount`. | 16768 | } else { |
15281 | * | 16769 | warnNoop(publicInstance, 'forceUpdate'); |
15282 | * @optional | 16770 | } |
15283 | */ | 16771 | }; |
15284 | componentWillMount: SpecPolicy.DEFINE_MANY, | ||
15285 | 16772 | ||
15286 | /** | 16773 | /** |
15287 | * Invoked when the component has been mounted and has a DOM representation. | 16774 | * Replaces all of the state. Always use this or `setState` to mutate state. |
15288 | * However, there is no guarantee that the DOM node is in the document. | 16775 | * You should treat `this.state` as immutable. |
15289 | * | 16776 | * |
15290 | * Use this as an opportunity to operate on the DOM when the component has | 16777 | * There is no guarantee that `this.state` will be immediately updated, so |
15291 | * been mounted (initialized and rendered) for the first time. | 16778 | * accessing `this.state` after calling this method may return the old value. |
15292 | * | 16779 | * |
15293 | * @param {DOMElement} rootNode DOM element representing the component. | 16780 | * @param {ReactClass} publicInstance The instance that should rerender. |
15294 | * @optional | 16781 | * @param {object|function} completeState Next state. |
16782 | * @internal | ||
15295 | */ | 16783 | */ |
15296 | componentDidMount: SpecPolicy.DEFINE_MANY, | 16784 | |
16785 | |||
16786 | ReactServerUpdateQueue.prototype.enqueueReplaceState = function enqueueReplaceState(publicInstance, completeState) { | ||
16787 | if (this.transaction.isInTransaction()) { | ||
16788 | ReactUpdateQueue.enqueueReplaceState(publicInstance, completeState); | ||
16789 | } else { | ||
16790 | warnNoop(publicInstance, 'replaceState'); | ||
16791 | } | ||
16792 | }; | ||
15297 | 16793 | ||
15298 | /** | 16794 | /** |
15299 | * Invoked before the component receives new props. | 16795 | * Sets a subset of the state. This only exists because _pendingState is |
15300 | * | 16796 | * internal. This provides a merging strategy that is not available to deep |
15301 | * Use this as an opportunity to react to a prop transition by updating the | 16797 | * properties which is confusing. TODO: Expose pendingState or don't use it |
15302 | * state using `this.setState`. Current props are accessed via `this.props`. | 16798 | * during the merge. |
15303 | * | ||
15304 | * componentWillReceiveProps: function(nextProps, nextContext) { | ||
15305 | * this.setState({ | ||
15306 | * likesIncreasing: nextProps.likeCount > this.props.likeCount | ||
15307 | * }); | ||
15308 | * } | ||
15309 | * | ||
15310 | * NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop | ||
15311 | * transition may cause a state change, but the opposite is not true. If you | ||
15312 | * need it, you are probably looking for `componentWillUpdate`. | ||
15313 | * | 16799 | * |
15314 | * @param {object} nextProps | 16800 | * @param {ReactClass} publicInstance The instance that should rerender. |
15315 | * @optional | 16801 | * @param {object|function} partialState Next partial state to be merged with state. |
16802 | * @internal | ||
15316 | */ | 16803 | */ |
15317 | componentWillReceiveProps: SpecPolicy.DEFINE_MANY, | 16804 | |
16805 | |||
16806 | ReactServerUpdateQueue.prototype.enqueueSetState = function enqueueSetState(publicInstance, partialState) { | ||
16807 | if (this.transaction.isInTransaction()) { | ||
16808 | ReactUpdateQueue.enqueueSetState(publicInstance, partialState); | ||
16809 | } else { | ||
16810 | warnNoop(publicInstance, 'setState'); | ||
16811 | } | ||
16812 | }; | ||
16813 | |||
16814 | return ReactServerUpdateQueue; | ||
16815 | }(); | ||
16816 | |||
16817 | module.exports = ReactServerUpdateQueue; | ||
16818 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
16819 | |||
16820 | /***/ }, | ||
16821 | /* 138 */ | ||
16822 | /***/ function(module, exports, __webpack_require__) { | ||
16823 | |||
16824 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
16825 | * Copyright 2015-present, Facebook, Inc. | ||
16826 | * All rights reserved. | ||
16827 | * | ||
16828 | * This source code is licensed under the BSD-style license found in the | ||
16829 | * LICENSE file in the root directory of this source tree. An additional grant | ||
16830 | * of patent rights can be found in the PATENTS file in the same directory. | ||
16831 | * | ||
16832 | * @providesModule ReactUpdateQueue | ||
16833 | */ | ||
16834 | |||
16835 | 'use strict'; | ||
16836 | |||
16837 | var _prodInvariant = __webpack_require__(9); | ||
16838 | |||
16839 | var ReactCurrentOwner = __webpack_require__(12); | ||
16840 | var ReactInstanceMap = __webpack_require__(126); | ||
16841 | var ReactInstrumentation = __webpack_require__(65); | ||
16842 | var ReactUpdates = __webpack_require__(59); | ||
16843 | |||
16844 | var invariant = __webpack_require__(10); | ||
16845 | var warning = __webpack_require__(13); | ||
16846 | |||
16847 | function enqueueUpdate(internalInstance) { | ||
16848 | ReactUpdates.enqueueUpdate(internalInstance); | ||
16849 | } | ||
16850 | |||
16851 | function formatUnexpectedArgument(arg) { | ||
16852 | var type = typeof arg; | ||
16853 | if (type !== 'object') { | ||
16854 | return type; | ||
16855 | } | ||
16856 | var displayName = arg.constructor && arg.constructor.name || type; | ||
16857 | var keys = Object.keys(arg); | ||
16858 | if (keys.length > 0 && keys.length < 20) { | ||
16859 | return displayName + ' (keys: ' + keys.join(', ') + ')'; | ||
16860 | } | ||
16861 | return displayName; | ||
16862 | } | ||
16863 | |||
16864 | function getInternalInstanceReadyForUpdate(publicInstance, callerName) { | ||
16865 | var internalInstance = ReactInstanceMap.get(publicInstance); | ||
16866 | if (!internalInstance) { | ||
16867 | if (process.env.NODE_ENV !== 'production') { | ||
16868 | var ctor = publicInstance.constructor; | ||
16869 | // Only warn when we have a callerName. Otherwise we should be silent. | ||
16870 | // We're probably calling from enqueueCallback. We don't want to warn | ||
16871 | // there because we already warned for the corresponding lifecycle method. | ||
16872 | 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; | ||
16873 | } | ||
16874 | return null; | ||
16875 | } | ||
16876 | |||
16877 | if (process.env.NODE_ENV !== 'production') { | ||
16878 | 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; | ||
16879 | } | ||
16880 | |||
16881 | return internalInstance; | ||
16882 | } | ||
16883 | |||
16884 | /** | ||
16885 | * ReactUpdateQueue allows for state updates to be scheduled into a later | ||
16886 | * reconciliation step. | ||
16887 | */ | ||
16888 | var ReactUpdateQueue = { | ||
15318 | 16889 | ||
15319 | /** | 16890 | /** |
15320 | * Invoked while deciding if the component should be updated as a result of | 16891 | * Checks whether or not this composite component is mounted. |
15321 | * receiving new props, state and/or context. | 16892 | * @param {ReactClass} publicInstance The instance we want to test. |
15322 | * | 16893 | * @return {boolean} True if mounted, false otherwise. |
15323 | * Use this as an opportunity to `return false` when you're certain that the | 16894 | * @protected |
15324 | * transition to the new props/state/context will not require a component | 16895 | * @final |
15325 | * update. | ||
15326 | * | ||
15327 | * shouldComponentUpdate: function(nextProps, nextState, nextContext) { | ||
15328 | * return !equal(nextProps, this.props) || | ||
15329 | * !equal(nextState, this.state) || | ||
15330 | * !equal(nextContext, this.context); | ||
15331 | * } | ||
15332 | * | ||
15333 | * @param {object} nextProps | ||
15334 | * @param {?object} nextState | ||
15335 | * @param {?object} nextContext | ||
15336 | * @return {boolean} True if the component should update. | ||
15337 | * @optional | ||
15338 | */ | 16896 | */ |
15339 | shouldComponentUpdate: SpecPolicy.DEFINE_ONCE, | 16897 | isMounted: function (publicInstance) { |
16898 | if (process.env.NODE_ENV !== 'production') { | ||
16899 | var owner = ReactCurrentOwner.current; | ||
16900 | if (owner !== null) { | ||
16901 | 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; | ||
16902 | owner._warnedAboutRefsInRender = true; | ||
16903 | } | ||
16904 | } | ||
16905 | var internalInstance = ReactInstanceMap.get(publicInstance); | ||
16906 | if (internalInstance) { | ||
16907 | // During componentWillMount and render this will still be null but after | ||
16908 | // that will always render to something. At least for now. So we can use | ||
16909 | // this hack. | ||
16910 | return !!internalInstance._renderedComponent; | ||
16911 | } else { | ||
16912 | return false; | ||
16913 | } | ||
16914 | }, | ||
15340 | 16915 | ||
15341 | /** | 16916 | /** |
15342 | * Invoked when the component is about to update due to a transition from | 16917 | * Enqueue a callback that will be executed after all the pending updates |
15343 | * `this.props`, `this.state` and `this.context` to `nextProps`, `nextState` | 16918 | * have processed. |
15344 | * and `nextContext`. | ||
15345 | * | ||
15346 | * Use this as an opportunity to perform preparation before an update occurs. | ||
15347 | * | ||
15348 | * NOTE: You **cannot** use `this.setState()` in this method. | ||
15349 | * | 16919 | * |
15350 | * @param {object} nextProps | 16920 | * @param {ReactClass} publicInstance The instance to use as `this` context. |
15351 | * @param {?object} nextState | 16921 | * @param {?function} callback Called after state is updated. |
15352 | * @param {?object} nextContext | 16922 | * @param {string} callerName Name of the calling function in the public API. |
15353 | * @param {ReactReconcileTransaction} transaction | 16923 | * @internal |
15354 | * @optional | ||
15355 | */ | 16924 | */ |
15356 | componentWillUpdate: SpecPolicy.DEFINE_MANY, | 16925 | enqueueCallback: function (publicInstance, callback, callerName) { |
16926 | ReactUpdateQueue.validateCallback(callback, callerName); | ||
16927 | var internalInstance = getInternalInstanceReadyForUpdate(publicInstance); | ||
16928 | |||
16929 | // Previously we would throw an error if we didn't have an internal | ||
16930 | // instance. Since we want to make it a no-op instead, we mirror the same | ||
16931 | // behavior we have in other enqueue* methods. | ||
16932 | // We also need to ignore callbacks in componentWillMount. See | ||
16933 | // enqueueUpdates. | ||
16934 | if (!internalInstance) { | ||
16935 | return null; | ||
16936 | } | ||
16937 | |||
16938 | if (internalInstance._pendingCallbacks) { | ||
16939 | internalInstance._pendingCallbacks.push(callback); | ||
16940 | } else { | ||
16941 | internalInstance._pendingCallbacks = [callback]; | ||
16942 | } | ||
16943 | // TODO: The callback here is ignored when setState is called from | ||
16944 | // componentWillMount. Either fix it or disallow doing so completely in | ||
16945 | // favor of getInitialState. Alternatively, we can disallow | ||
16946 | // componentWillMount during server-side rendering. | ||
16947 | enqueueUpdate(internalInstance); | ||
16948 | }, | ||
16949 | |||
16950 | enqueueCallbackInternal: function (internalInstance, callback) { | ||
16951 | if (internalInstance._pendingCallbacks) { | ||
16952 | internalInstance._pendingCallbacks.push(callback); | ||
16953 | } else { | ||
16954 | internalInstance._pendingCallbacks = [callback]; | ||
16955 | } | ||
16956 | enqueueUpdate(internalInstance); | ||
16957 | }, | ||
15357 | 16958 | ||
15358 | /** | 16959 | /** |
15359 | * Invoked when the component's DOM representation has been updated. | 16960 | * Forces an update. This should only be invoked when it is known with |
16961 | * certainty that we are **not** in a DOM transaction. | ||
15360 | * | 16962 | * |
15361 | * Use this as an opportunity to operate on the DOM when the component has | 16963 | * You may want to call this when you know that some deeper aspect of the |
15362 | * been updated. | 16964 | * component's state has changed but `setState` was not called. |
15363 | * | 16965 | * |
15364 | * @param {object} prevProps | 16966 | * This will not invoke `shouldComponentUpdate`, but it will invoke |
15365 | * @param {?object} prevState | 16967 | * `componentWillUpdate` and `componentDidUpdate`. |
15366 | * @param {?object} prevContext | 16968 | * |
15367 | * @param {DOMElement} rootNode DOM element representing the component. | 16969 | * @param {ReactClass} publicInstance The instance that should rerender. |
15368 | * @optional | 16970 | * @internal |
15369 | */ | 16971 | */ |
15370 | componentDidUpdate: SpecPolicy.DEFINE_MANY, | 16972 | enqueueForceUpdate: function (publicInstance) { |
16973 | var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'forceUpdate'); | ||
16974 | |||
16975 | if (!internalInstance) { | ||
16976 | return; | ||
16977 | } | ||
16978 | |||
16979 | internalInstance._pendingForceUpdate = true; | ||
16980 | |||
16981 | enqueueUpdate(internalInstance); | ||
16982 | }, | ||
15371 | 16983 | ||
15372 | /** | 16984 | /** |
15373 | * Invoked when the component is about to be removed from its parent and have | 16985 | * Replaces all of the state. Always use this or `setState` to mutate state. |
15374 | * its DOM representation destroyed. | 16986 | * You should treat `this.state` as immutable. |
15375 | * | ||
15376 | * Use this as an opportunity to deallocate any external resources. | ||
15377 | * | 16987 | * |
15378 | * NOTE: There is no `componentDidUnmount` since your component will have been | 16988 | * There is no guarantee that `this.state` will be immediately updated, so |
15379 | * destroyed by that point. | 16989 | * accessing `this.state` after calling this method may return the old value. |
15380 | * | 16990 | * |
15381 | * @optional | 16991 | * @param {ReactClass} publicInstance The instance that should rerender. |
16992 | * @param {object} completeState Next state. | ||
16993 | * @internal | ||
15382 | */ | 16994 | */ |
15383 | componentWillUnmount: SpecPolicy.DEFINE_MANY, | 16995 | enqueueReplaceState: function (publicInstance, completeState) { |
16996 | var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceState'); | ||
15384 | 16997 | ||
15385 | // ==== Advanced methods ==== | 16998 | if (!internalInstance) { |
16999 | return; | ||
17000 | } | ||
17001 | |||
17002 | internalInstance._pendingStateQueue = [completeState]; | ||
17003 | internalInstance._pendingReplaceState = true; | ||
17004 | |||
17005 | enqueueUpdate(internalInstance); | ||
17006 | }, | ||
15386 | 17007 | ||
15387 | /** | 17008 | /** |
15388 | * Updates the component's currently mounted DOM representation. | 17009 | * Sets a subset of the state. This only exists because _pendingState is |
15389 | * | 17010 | * internal. This provides a merging strategy that is not available to deep |
15390 | * By default, this implements React's rendering and reconciliation algorithm. | 17011 | * properties which is confusing. TODO: Expose pendingState or don't use it |
15391 | * Sophisticated clients may wish to override this. | 17012 | * during the merge. |
15392 | * | 17013 | * |
15393 | * @param {ReactReconcileTransaction} transaction | 17014 | * @param {ReactClass} publicInstance The instance that should rerender. |
17015 | * @param {object} partialState Next partial state to be merged with state. | ||
15394 | * @internal | 17016 | * @internal |
15395 | * @overridable | ||
15396 | */ | 17017 | */ |
15397 | updateComponent: SpecPolicy.OVERRIDE_BASE | 17018 | enqueueSetState: function (publicInstance, partialState) { |
17019 | if (process.env.NODE_ENV !== 'production') { | ||
17020 | ReactInstrumentation.debugTool.onSetState(); | ||
17021 | process.env.NODE_ENV !== 'production' ? warning(partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().') : void 0; | ||
17022 | } | ||
17023 | |||
17024 | var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setState'); | ||
17025 | |||
17026 | if (!internalInstance) { | ||
17027 | return; | ||
17028 | } | ||
17029 | |||
17030 | var queue = internalInstance._pendingStateQueue || (internalInstance._pendingStateQueue = []); | ||
17031 | queue.push(partialState); | ||
17032 | |||
17033 | enqueueUpdate(internalInstance); | ||
17034 | }, | ||
17035 | |||
17036 | enqueueElementInternal: function (internalInstance, nextElement, nextContext) { | ||
17037 | internalInstance._pendingElement = nextElement; | ||
17038 | // TODO: introduce _pendingContext instead of setting it directly. | ||
17039 | internalInstance._context = nextContext; | ||
17040 | enqueueUpdate(internalInstance); | ||
17041 | }, | ||
17042 | |||
17043 | validateCallback: function (callback, callerName) { | ||
17044 | !(!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; | ||
17045 | } | ||
15398 | 17046 | ||
15399 | }; | 17047 | }; |
15400 | 17048 | ||
15401 | /** | 17049 | module.exports = ReactUpdateQueue; |
15402 | * Mapping from class specification keys to special processing functions. | 17050 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) |
17051 | |||
17052 | /***/ }, | ||
17053 | /* 139 */ | ||
17054 | /***/ function(module, exports, __webpack_require__) { | ||
17055 | |||
17056 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
17057 | * Copyright 2015-present, Facebook, Inc. | ||
17058 | * All rights reserved. | ||
15403 | * | 17059 | * |
15404 | * Although these are declared like instance properties in the specification | 17060 | * This source code is licensed under the BSD-style license found in the |
15405 | * when defining classes using `React.createClass`, they are actually static | 17061 | * LICENSE file in the root directory of this source tree. An additional grant |
15406 | * and are accessible on the constructor instead of the prototype. Despite | 17062 | * of patent rights can be found in the PATENTS file in the same directory. |
15407 | * being static, they must be defined outside of the "statics" key under | 17063 | * |
15408 | * which all other static methods are defined. | 17064 | * @providesModule validateDOMNesting |
15409 | */ | 17065 | */ |
15410 | var RESERVED_SPEC_KEYS = { | 17066 | |
15411 | displayName: function (Constructor, displayName) { | 17067 | 'use strict'; |
15412 | Constructor.displayName = displayName; | 17068 | |
15413 | }, | 17069 | var _assign = __webpack_require__(6); |
15414 | mixins: function (Constructor, mixins) { | 17070 | |
15415 | if (mixins) { | 17071 | var emptyFunction = __webpack_require__(14); |
15416 | for (var i = 0; i < mixins.length; i++) { | 17072 | var warning = __webpack_require__(13); |
15417 | mixSpecIntoComponent(Constructor, mixins[i]); | 17073 | |
15418 | } | 17074 | var validateDOMNesting = emptyFunction; |
17075 | |||
17076 | if (process.env.NODE_ENV !== 'production') { | ||
17077 | // This validation code was written based on the HTML5 parsing spec: | ||
17078 | // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope | ||
17079 | // | ||
17080 | // Note: this does not catch all invalid nesting, nor does it try to (as it's | ||
17081 | // not clear what practical benefit doing so provides); instead, we warn only | ||
17082 | // for cases where the parser will give a parse tree differing from what React | ||
17083 | // intended. For example, <b><div></div></b> is invalid but we don't warn | ||
17084 | // because it still parses correctly; we do warn for other cases like nested | ||
17085 | // <p> tags where the beginning of the second element implicitly closes the | ||
17086 | // first, causing a confusing mess. | ||
17087 | |||
17088 | // https://html.spec.whatwg.org/multipage/syntax.html#special | ||
17089 | 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']; | ||
17090 | |||
17091 | // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope | ||
17092 | var inScopeTags = ['applet', 'caption', 'html', 'table', 'td', 'th', 'marquee', 'object', 'template', | ||
17093 | |||
17094 | // https://html.spec.whatwg.org/multipage/syntax.html#html-integration-point | ||
17095 | // TODO: Distinguish by namespace here -- for <title>, including it here | ||
17096 | // errs on the side of fewer warnings | ||
17097 | 'foreignObject', 'desc', 'title']; | ||
17098 | |||
17099 | // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-button-scope | ||
17100 | var buttonScopeTags = inScopeTags.concat(['button']); | ||
17101 | |||
17102 | // https://html.spec.whatwg.org/multipage/syntax.html#generate-implied-end-tags | ||
17103 | var impliedEndTags = ['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt']; | ||
17104 | |||
17105 | var emptyAncestorInfo = { | ||
17106 | current: null, | ||
17107 | |||
17108 | formTag: null, | ||
17109 | aTagInScope: null, | ||
17110 | buttonTagInScope: null, | ||
17111 | nobrTagInScope: null, | ||
17112 | pTagInButtonScope: null, | ||
17113 | |||
17114 | listItemTagAutoclosing: null, | ||
17115 | dlItemTagAutoclosing: null | ||
17116 | }; | ||
17117 | |||
17118 | var updatedAncestorInfo = function (oldInfo, tag, instance) { | ||
17119 | var ancestorInfo = _assign({}, oldInfo || emptyAncestorInfo); | ||
17120 | var info = { tag: tag, instance: instance }; | ||
17121 | |||
17122 | if (inScopeTags.indexOf(tag) !== -1) { | ||
17123 | ancestorInfo.aTagInScope = null; | ||
17124 | ancestorInfo.buttonTagInScope = null; | ||
17125 | ancestorInfo.nobrTagInScope = null; | ||
15419 | } | 17126 | } |
15420 | }, | 17127 | if (buttonScopeTags.indexOf(tag) !== -1) { |
15421 | childContextTypes: function (Constructor, childContextTypes) { | 17128 | ancestorInfo.pTagInButtonScope = null; |
15422 | if (process.env.NODE_ENV !== 'production') { | ||
15423 | validateTypeDef(Constructor, childContextTypes, ReactPropTypeLocations.childContext); | ||
15424 | } | 17129 | } |
15425 | Constructor.childContextTypes = assign({}, Constructor.childContextTypes, childContextTypes); | 17130 | |
15426 | }, | 17131 | // See rules for 'li', 'dd', 'dt' start tags in |
15427 | contextTypes: function (Constructor, contextTypes) { | 17132 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody |
15428 | if (process.env.NODE_ENV !== 'production') { | 17133 | if (specialTags.indexOf(tag) !== -1 && tag !== 'address' && tag !== 'div' && tag !== 'p') { |
15429 | validateTypeDef(Constructor, contextTypes, ReactPropTypeLocations.context); | 17134 | ancestorInfo.listItemTagAutoclosing = null; |
17135 | ancestorInfo.dlItemTagAutoclosing = null; | ||
15430 | } | 17136 | } |
15431 | Constructor.contextTypes = assign({}, Constructor.contextTypes, contextTypes); | 17137 | |
15432 | }, | 17138 | ancestorInfo.current = info; |
17139 | |||
17140 | if (tag === 'form') { | ||
17141 | ancestorInfo.formTag = info; | ||
17142 | } | ||
17143 | if (tag === 'a') { | ||
17144 | ancestorInfo.aTagInScope = info; | ||
17145 | } | ||
17146 | if (tag === 'button') { | ||
17147 | ancestorInfo.buttonTagInScope = info; | ||
17148 | } | ||
17149 | if (tag === 'nobr') { | ||
17150 | ancestorInfo.nobrTagInScope = info; | ||
17151 | } | ||
17152 | if (tag === 'p') { | ||
17153 | ancestorInfo.pTagInButtonScope = info; | ||
17154 | } | ||
17155 | if (tag === 'li') { | ||
17156 | ancestorInfo.listItemTagAutoclosing = info; | ||
17157 | } | ||
17158 | if (tag === 'dd' || tag === 'dt') { | ||
17159 | ancestorInfo.dlItemTagAutoclosing = info; | ||
17160 | } | ||
17161 | |||
17162 | return ancestorInfo; | ||
17163 | }; | ||
17164 | |||
15433 | /** | 17165 | /** |
15434 | * Special case getDefaultProps which should move into statics but requires | 17166 | * Returns whether |
15435 | * automatic merging. | ||
15436 | */ | 17167 | */ |
15437 | getDefaultProps: function (Constructor, getDefaultProps) { | 17168 | var isTagValidWithParent = function (tag, parentTag) { |
15438 | if (Constructor.getDefaultProps) { | 17169 | // First, let's check if we're in an unusual parsing mode... |
15439 | Constructor.getDefaultProps = createMergedResultFunction(Constructor.getDefaultProps, getDefaultProps); | 17170 | switch (parentTag) { |
15440 | } else { | 17171 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inselect |
15441 | Constructor.getDefaultProps = getDefaultProps; | 17172 | case 'select': |
15442 | } | 17173 | return tag === 'option' || tag === 'optgroup' || tag === '#text'; |
15443 | }, | 17174 | case 'optgroup': |
15444 | propTypes: function (Constructor, propTypes) { | 17175 | return tag === 'option' || tag === '#text'; |
15445 | if (process.env.NODE_ENV !== 'production') { | 17176 | // Strictly speaking, seeing an <option> doesn't mean we're in a <select> |
15446 | validateTypeDef(Constructor, propTypes, ReactPropTypeLocations.prop); | 17177 | // but |
17178 | case 'option': | ||
17179 | return tag === '#text'; | ||
17180 | |||
17181 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intd | ||
17182 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incaption | ||
17183 | // No special behavior since these rules fall back to "in body" mode for | ||
17184 | // all except special table nodes which cause bad parsing behavior anyway. | ||
17185 | |||
17186 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intr | ||
17187 | case 'tr': | ||
17188 | return tag === 'th' || tag === 'td' || tag === 'style' || tag === 'script' || tag === 'template'; | ||
17189 | |||
17190 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intbody | ||
17191 | case 'tbody': | ||
17192 | case 'thead': | ||
17193 | case 'tfoot': | ||
17194 | return tag === 'tr' || tag === 'style' || tag === 'script' || tag === 'template'; | ||
17195 | |||
17196 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incolgroup | ||
17197 | case 'colgroup': | ||
17198 | return tag === 'col' || tag === 'template'; | ||
17199 | |||
17200 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intable | ||
17201 | case 'table': | ||
17202 | return tag === 'caption' || tag === 'colgroup' || tag === 'tbody' || tag === 'tfoot' || tag === 'thead' || tag === 'style' || tag === 'script' || tag === 'template'; | ||
17203 | |||
17204 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inhead | ||
17205 | case 'head': | ||
17206 | return tag === 'base' || tag === 'basefont' || tag === 'bgsound' || tag === 'link' || tag === 'meta' || tag === 'title' || tag === 'noscript' || tag === 'noframes' || tag === 'style' || tag === 'script' || tag === 'template'; | ||
17207 | |||
17208 | // https://html.spec.whatwg.org/multipage/semantics.html#the-html-element | ||
17209 | case 'html': | ||
17210 | return tag === 'head' || tag === 'body'; | ||
17211 | case '#document': | ||
17212 | return tag === 'html'; | ||
15447 | } | 17213 | } |
15448 | Constructor.propTypes = assign({}, Constructor.propTypes, propTypes); | ||
15449 | }, | ||
15450 | statics: function (Constructor, statics) { | ||
15451 | mixStaticSpecIntoComponent(Constructor, statics); | ||
15452 | }, | ||
15453 | autobind: function () {} }; | ||
15454 | 17214 | ||
15455 | // noop | 17215 | // Probably in the "in body" parsing mode, so we outlaw only tag combos |
15456 | function validateTypeDef(Constructor, typeDef, location) { | 17216 | // where the parsing rules cause implicit opens or closes to be added. |
15457 | for (var propName in typeDef) { | 17217 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody |
15458 | if (typeDef.hasOwnProperty(propName)) { | 17218 | switch (tag) { |
15459 | // use a warning instead of an invariant so components | 17219 | case 'h1': |
15460 | // don't show up in prod but not in __DEV__ | 17220 | case 'h2': |
15461 | 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) : undefined; | 17221 | case 'h3': |
17222 | case 'h4': | ||
17223 | case 'h5': | ||
17224 | case 'h6': | ||
17225 | return parentTag !== 'h1' && parentTag !== 'h2' && parentTag !== 'h3' && parentTag !== 'h4' && parentTag !== 'h5' && parentTag !== 'h6'; | ||
17226 | |||
17227 | case 'rp': | ||
17228 | case 'rt': | ||
17229 | return impliedEndTags.indexOf(parentTag) === -1; | ||
17230 | |||
17231 | case 'body': | ||
17232 | case 'caption': | ||
17233 | case 'col': | ||
17234 | case 'colgroup': | ||
17235 | case 'frame': | ||
17236 | case 'head': | ||
17237 | case 'html': | ||
17238 | case 'tbody': | ||
17239 | case 'td': | ||
17240 | case 'tfoot': | ||
17241 | case 'th': | ||
17242 | case 'thead': | ||
17243 | case 'tr': | ||
17244 | // These tags are only valid with a few parents that have special child | ||
17245 | // parsing rules -- if we're down here, then none of those matched and | ||
17246 | // so we allow it only if we don't know what the parent is, as all other | ||
17247 | // cases are invalid. | ||
17248 | return parentTag == null; | ||
15462 | } | 17249 | } |
15463 | } | ||
15464 | } | ||
15465 | 17250 | ||
15466 | function validateMethodOverride(proto, name) { | 17251 | return true; |
15467 | var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null; | 17252 | }; |
15468 | 17253 | ||
15469 | // Disallow overriding of base class methods unless explicitly allowed. | 17254 | /** |
15470 | if (ReactClassMixin.hasOwnProperty(name)) { | 17255 | * Returns whether |
15471 | !(specPolicy === 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) : invariant(false) : undefined; | 17256 | */ |
15472 | } | 17257 | var findInvalidAncestorForTag = function (tag, ancestorInfo) { |
17258 | switch (tag) { | ||
17259 | case 'address': | ||
17260 | case 'article': | ||
17261 | case 'aside': | ||
17262 | case 'blockquote': | ||
17263 | case 'center': | ||
17264 | case 'details': | ||
17265 | case 'dialog': | ||
17266 | case 'dir': | ||
17267 | case 'div': | ||
17268 | case 'dl': | ||
17269 | case 'fieldset': | ||
17270 | case 'figcaption': | ||
17271 | case 'figure': | ||
17272 | case 'footer': | ||
17273 | case 'header': | ||
17274 | case 'hgroup': | ||
17275 | case 'main': | ||
17276 | case 'menu': | ||
17277 | case 'nav': | ||
17278 | case 'ol': | ||
17279 | case 'p': | ||
17280 | case 'section': | ||
17281 | case 'summary': | ||
17282 | case 'ul': | ||
15473 | 17283 | ||
15474 | // Disallow defining methods more than once unless explicitly allowed. | 17284 | case 'pre': |
15475 | if (proto.hasOwnProperty(name)) { | 17285 | case 'listing': |
15476 | !(specPolicy === SpecPolicy.DEFINE_MANY || specPolicy === 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) : invariant(false) : undefined; | ||
15477 | } | ||
15478 | } | ||
15479 | 17286 | ||
15480 | /** | 17287 | case 'table': |
15481 | * Mixin helper which handles policy validation and reserved | ||
15482 | * specification keys when building React classses. | ||
15483 | */ | ||
15484 | function mixSpecIntoComponent(Constructor, spec) { | ||
15485 | if (!spec) { | ||
15486 | return; | ||
15487 | } | ||
15488 | 17288 | ||
15489 | !(typeof spec !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component class as a mixin. Instead, just use a regular object.') : invariant(false) : undefined; | 17289 | case 'hr': |
15490 | !!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.') : invariant(false) : undefined; | ||
15491 | 17290 | ||
15492 | var proto = Constructor.prototype; | 17291 | case 'xmp': |
15493 | 17292 | ||
15494 | // By handling mixins before any other properties, we ensure the same | 17293 | case 'h1': |
15495 | // chaining order is applied to methods with DEFINE_MANY policy, whether | 17294 | case 'h2': |
15496 | // mixins are listed before or after these methods in the spec. | 17295 | case 'h3': |
15497 | if (spec.hasOwnProperty(MIXINS_KEY)) { | 17296 | case 'h4': |
15498 | RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins); | 17297 | case 'h5': |
15499 | } | 17298 | case 'h6': |
17299 | return ancestorInfo.pTagInButtonScope; | ||
15500 | 17300 | ||
15501 | for (var name in spec) { | 17301 | case 'form': |
15502 | if (!spec.hasOwnProperty(name)) { | 17302 | return ancestorInfo.formTag || ancestorInfo.pTagInButtonScope; |
15503 | continue; | 17303 | |
17304 | case 'li': | ||
17305 | return ancestorInfo.listItemTagAutoclosing; | ||
17306 | |||
17307 | case 'dd': | ||
17308 | case 'dt': | ||
17309 | return ancestorInfo.dlItemTagAutoclosing; | ||
17310 | |||
17311 | case 'button': | ||
17312 | return ancestorInfo.buttonTagInScope; | ||
17313 | |||
17314 | case 'a': | ||
17315 | // Spec says something about storing a list of markers, but it sounds | ||
17316 | // equivalent to this check. | ||
17317 | return ancestorInfo.aTagInScope; | ||
17318 | |||
17319 | case 'nobr': | ||
17320 | return ancestorInfo.nobrTagInScope; | ||
15504 | } | 17321 | } |
15505 | 17322 | ||
15506 | if (name === MIXINS_KEY) { | 17323 | return null; |
15507 | // We have already handled mixins in a special case above. | 17324 | }; |
15508 | continue; | 17325 | |
17326 | /** | ||
17327 | * Given a ReactCompositeComponent instance, return a list of its recursive | ||
17328 | * owners, starting at the root and ending with the instance itself. | ||
17329 | */ | ||
17330 | var findOwnerStack = function (instance) { | ||
17331 | if (!instance) { | ||
17332 | return []; | ||
15509 | } | 17333 | } |
15510 | 17334 | ||
15511 | var property = spec[name]; | 17335 | var stack = []; |
15512 | validateMethodOverride(proto, name); | 17336 | do { |
17337 | stack.push(instance); | ||
17338 | } while (instance = instance._currentElement._owner); | ||
17339 | stack.reverse(); | ||
17340 | return stack; | ||
17341 | }; | ||
15513 | 17342 | ||
15514 | if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) { | 17343 | var didWarn = {}; |
15515 | RESERVED_SPEC_KEYS[name](Constructor, property); | ||
15516 | } else { | ||
15517 | // Setup methods on prototype: | ||
15518 | // The following member methods should not be automatically bound: | ||
15519 | // 1. Expected ReactClass methods (in the "interface"). | ||
15520 | // 2. Overridden methods (that were mixed in). | ||
15521 | var isReactClassMethod = ReactClassInterface.hasOwnProperty(name); | ||
15522 | var isAlreadyDefined = proto.hasOwnProperty(name); | ||
15523 | var isFunction = typeof property === 'function'; | ||
15524 | var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false; | ||
15525 | 17344 | ||
15526 | if (shouldAutoBind) { | 17345 | validateDOMNesting = function (childTag, childInstance, ancestorInfo) { |
15527 | if (!proto.__reactAutoBindMap) { | 17346 | ancestorInfo = ancestorInfo || emptyAncestorInfo; |
15528 | proto.__reactAutoBindMap = {}; | 17347 | var parentInfo = ancestorInfo.current; |
15529 | } | 17348 | var parentTag = parentInfo && parentInfo.tag; |
15530 | proto.__reactAutoBindMap[name] = property; | ||
15531 | proto[name] = property; | ||
15532 | } else { | ||
15533 | if (isAlreadyDefined) { | ||
15534 | var specPolicy = ReactClassInterface[name]; | ||
15535 | 17349 | ||
15536 | // These cases should already be caught by validateMethodOverride. | 17350 | var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo; |
15537 | !(isReactClassMethod && (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === 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) : invariant(false) : undefined; | 17351 | var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo); |
17352 | var problematic = invalidParent || invalidAncestor; | ||
15538 | 17353 | ||
15539 | // For methods which are defined more than once, call the existing | 17354 | if (problematic) { |
15540 | // methods before calling the new property, merging if appropriate. | 17355 | var ancestorTag = problematic.tag; |
15541 | if (specPolicy === SpecPolicy.DEFINE_MANY_MERGED) { | 17356 | var ancestorInstance = problematic.instance; |
15542 | proto[name] = createMergedResultFunction(proto[name], property); | 17357 | |
15543 | } else if (specPolicy === SpecPolicy.DEFINE_MANY) { | 17358 | var childOwner = childInstance && childInstance._currentElement._owner; |
15544 | proto[name] = createChainedFunction(proto[name], property); | 17359 | var ancestorOwner = ancestorInstance && ancestorInstance._currentElement._owner; |
15545 | } | 17360 | |
17361 | var childOwners = findOwnerStack(childOwner); | ||
17362 | var ancestorOwners = findOwnerStack(ancestorOwner); | ||
17363 | |||
17364 | var minStackLen = Math.min(childOwners.length, ancestorOwners.length); | ||
17365 | var i; | ||
17366 | |||
17367 | var deepestCommon = -1; | ||
17368 | for (i = 0; i < minStackLen; i++) { | ||
17369 | if (childOwners[i] === ancestorOwners[i]) { | ||
17370 | deepestCommon = i; | ||
15546 | } else { | 17371 | } else { |
15547 | proto[name] = property; | 17372 | break; |
15548 | if (process.env.NODE_ENV !== 'production') { | ||
15549 | // Add verbose displayName to the function, which helps when looking | ||
15550 | // at profiling tools. | ||
15551 | if (typeof property === 'function' && spec.displayName) { | ||
15552 | proto[name].displayName = spec.displayName + '_' + name; | ||
15553 | } | ||
15554 | } | ||
15555 | } | 17373 | } |
15556 | } | 17374 | } |
15557 | } | ||
15558 | } | ||
15559 | } | ||
15560 | 17375 | ||
15561 | function mixStaticSpecIntoComponent(Constructor, statics) { | 17376 | var UNKNOWN = '(unknown)'; |
15562 | if (!statics) { | 17377 | var childOwnerNames = childOwners.slice(deepestCommon + 1).map(function (inst) { |
15563 | return; | 17378 | return inst.getName() || UNKNOWN; |
15564 | } | 17379 | }); |
15565 | for (var name in statics) { | 17380 | var ancestorOwnerNames = ancestorOwners.slice(deepestCommon + 1).map(function (inst) { |
15566 | var property = statics[name]; | 17381 | return inst.getName() || UNKNOWN; |
15567 | if (!statics.hasOwnProperty(name)) { | 17382 | }); |
15568 | continue; | 17383 | var ownerInfo = [].concat( |
17384 | // If the parent and child instances have a common owner ancestor, start | ||
17385 | // with that -- otherwise we just start with the parent's owners. | ||
17386 | deepestCommon !== -1 ? childOwners[deepestCommon].getName() || UNKNOWN : [], ancestorOwnerNames, ancestorTag, | ||
17387 | // If we're warning about an invalid (non-parent) ancestry, add '...' | ||
17388 | invalidAncestor ? ['...'] : [], childOwnerNames, childTag).join(' > '); | ||
17389 | |||
17390 | var warnKey = !!invalidParent + '|' + childTag + '|' + ancestorTag + '|' + ownerInfo; | ||
17391 | if (didWarn[warnKey]) { | ||
17392 | return; | ||
17393 | } | ||
17394 | didWarn[warnKey] = true; | ||
17395 | |||
17396 | var tagDisplayName = childTag; | ||
17397 | if (childTag !== '#text') { | ||
17398 | tagDisplayName = '<' + childTag + '>'; | ||
17399 | } | ||
17400 | |||
17401 | if (invalidParent) { | ||
17402 | var info = ''; | ||
17403 | if (ancestorTag === 'table' && childTag === 'tr') { | ||
17404 | info += ' Add a <tbody> to your code to match the DOM tree generated by ' + 'the browser.'; | ||
17405 | } | ||
17406 | process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...): %s cannot appear as a child of <%s>. ' + 'See %s.%s', tagDisplayName, ancestorTag, ownerInfo, info) : void 0; | ||
17407 | } else { | ||
17408 | process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...): %s cannot appear as a descendant of ' + '<%s>. See %s.', tagDisplayName, ancestorTag, ownerInfo) : void 0; | ||
17409 | } | ||
15569 | } | 17410 | } |
17411 | }; | ||
15570 | 17412 | ||
15571 | var isReserved = (name in RESERVED_SPEC_KEYS); | 17413 | validateDOMNesting.updatedAncestorInfo = updatedAncestorInfo; |
15572 | !!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) : invariant(false) : undefined; | ||
15573 | 17414 | ||
15574 | var isInherited = (name in Constructor); | 17415 | // For testing |
15575 | !!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) : invariant(false) : undefined; | 17416 | validateDOMNesting.isTagValidInContext = function (tag, ancestorInfo) { |
15576 | Constructor[name] = property; | 17417 | ancestorInfo = ancestorInfo || emptyAncestorInfo; |
15577 | } | 17418 | var parentInfo = ancestorInfo.current; |
17419 | var parentTag = parentInfo && parentInfo.tag; | ||
17420 | return isTagValidWithParent(tag, parentTag) && !findInvalidAncestorForTag(tag, ancestorInfo); | ||
17421 | }; | ||
15578 | } | 17422 | } |
15579 | 17423 | ||
17424 | module.exports = validateDOMNesting; | ||
17425 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
17426 | |||
17427 | /***/ }, | ||
17428 | /* 140 */ | ||
17429 | /***/ function(module, exports, __webpack_require__) { | ||
17430 | |||
15580 | /** | 17431 | /** |
15581 | * Merge two objects, but throw if both contain the same key. | 17432 | * Copyright 2014-present, Facebook, Inc. |
17433 | * All rights reserved. | ||
15582 | * | 17434 | * |
15583 | * @param {object} one The first object, which is mutated. | 17435 | * This source code is licensed under the BSD-style license found in the |
15584 | * @param {object} two The second object | 17436 | * LICENSE file in the root directory of this source tree. An additional grant |
15585 | * @return {object} one after it has been mutated to contain everything in two. | 17437 | * of patent rights can be found in the PATENTS file in the same directory. |
17438 | * | ||
17439 | * @providesModule ReactDOMEmptyComponent | ||
15586 | */ | 17440 | */ |
15587 | function mergeIntoWithNoDuplicateKeys(one, two) { | ||
15588 | !(one && two && typeof one === 'object' && typeof two === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : invariant(false) : undefined; | ||
15589 | 17441 | ||
15590 | for (var key in two) { | 17442 | 'use strict'; |
15591 | if (two.hasOwnProperty(key)) { | 17443 | |
15592 | !(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) : invariant(false) : undefined; | 17444 | var _assign = __webpack_require__(6); |
15593 | one[key] = two[key]; | 17445 | |
17446 | var DOMLazyTree = __webpack_require__(85); | ||
17447 | var ReactDOMComponentTree = __webpack_require__(39); | ||
17448 | |||
17449 | var ReactDOMEmptyComponent = function (instantiate) { | ||
17450 | // ReactCompositeComponent uses this: | ||
17451 | this._currentElement = null; | ||
17452 | // ReactDOMComponentTree uses these: | ||
17453 | this._hostNode = null; | ||
17454 | this._hostParent = null; | ||
17455 | this._hostContainerInfo = null; | ||
17456 | this._domID = null; | ||
17457 | }; | ||
17458 | _assign(ReactDOMEmptyComponent.prototype, { | ||
17459 | mountComponent: function (transaction, hostParent, hostContainerInfo, context) { | ||
17460 | var domID = hostContainerInfo._idCounter++; | ||
17461 | this._domID = domID; | ||
17462 | this._hostParent = hostParent; | ||
17463 | this._hostContainerInfo = hostContainerInfo; | ||
17464 | |||
17465 | var nodeValue = ' react-empty: ' + this._domID + ' '; | ||
17466 | if (transaction.useCreateElement) { | ||
17467 | var ownerDocument = hostContainerInfo._ownerDocument; | ||
17468 | var node = ownerDocument.createComment(nodeValue); | ||
17469 | ReactDOMComponentTree.precacheNode(this, node); | ||
17470 | return DOMLazyTree(node); | ||
17471 | } else { | ||
17472 | if (transaction.renderToStaticMarkup) { | ||
17473 | // Normally we'd insert a comment node, but since this is a situation | ||
17474 | // where React won't take over (static pages), we can simply return | ||
17475 | // nothing. | ||
17476 | return ''; | ||
17477 | } | ||
17478 | return '<!--' + nodeValue + '-->'; | ||
15594 | } | 17479 | } |
17480 | }, | ||
17481 | receiveComponent: function () {}, | ||
17482 | getHostNode: function () { | ||
17483 | return ReactDOMComponentTree.getNodeFromInstance(this); | ||
17484 | }, | ||
17485 | unmountComponent: function () { | ||
17486 | ReactDOMComponentTree.uncacheNode(this); | ||
15595 | } | 17487 | } |
15596 | return one; | 17488 | }); |
15597 | } | ||
15598 | 17489 | ||
15599 | /** | 17490 | module.exports = ReactDOMEmptyComponent; |
15600 | * Creates a function that invokes two functions and merges their return values. | 17491 | |
17492 | /***/ }, | ||
17493 | /* 141 */ | ||
17494 | /***/ function(module, exports, __webpack_require__) { | ||
17495 | |||
17496 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
17497 | * Copyright 2015-present, Facebook, Inc. | ||
17498 | * All rights reserved. | ||
15601 | * | 17499 | * |
15602 | * @param {function} one Function to invoke first. | 17500 | * This source code is licensed under the BSD-style license found in the |
15603 | * @param {function} two Function to invoke second. | 17501 | * LICENSE file in the root directory of this source tree. An additional grant |
15604 | * @return {function} Function that invokes the two argument functions. | 17502 | * of patent rights can be found in the PATENTS file in the same directory. |
15605 | * @private | 17503 | * |
17504 | * @providesModule ReactDOMTreeTraversal | ||
15606 | */ | 17505 | */ |
15607 | function createMergedResultFunction(one, two) { | 17506 | |
15608 | return function mergedResult() { | 17507 | 'use strict'; |
15609 | var a = one.apply(this, arguments); | 17508 | |
15610 | var b = two.apply(this, arguments); | 17509 | var _prodInvariant = __webpack_require__(9); |
15611 | if (a == null) { | 17510 | |
15612 | return b; | 17511 | var invariant = __webpack_require__(10); |
15613 | } else if (b == null) { | 17512 | |
15614 | return a; | 17513 | /** |
17514 | * Return the lowest common ancestor of A and B, or null if they are in | ||
17515 | * different trees. | ||
17516 | */ | ||
17517 | function getLowestCommonAncestor(instA, instB) { | ||
17518 | !('_hostNode' in instA) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0; | ||
17519 | !('_hostNode' in instB) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0; | ||
17520 | |||
17521 | var depthA = 0; | ||
17522 | for (var tempA = instA; tempA; tempA = tempA._hostParent) { | ||
17523 | depthA++; | ||
17524 | } | ||
17525 | var depthB = 0; | ||
17526 | for (var tempB = instB; tempB; tempB = tempB._hostParent) { | ||
17527 | depthB++; | ||
17528 | } | ||
17529 | |||
17530 | // If A is deeper, crawl up. | ||
17531 | while (depthA - depthB > 0) { | ||
17532 | instA = instA._hostParent; | ||
17533 | depthA--; | ||
17534 | } | ||
17535 | |||
17536 | // If B is deeper, crawl up. | ||
17537 | while (depthB - depthA > 0) { | ||
17538 | instB = instB._hostParent; | ||
17539 | depthB--; | ||
17540 | } | ||
17541 | |||
17542 | // Walk in lockstep until we find a match. | ||
17543 | var depth = depthA; | ||
17544 | while (depth--) { | ||
17545 | if (instA === instB) { | ||
17546 | return instA; | ||
15615 | } | 17547 | } |
15616 | var c = {}; | 17548 | instA = instA._hostParent; |
15617 | mergeIntoWithNoDuplicateKeys(c, a); | 17549 | instB = instB._hostParent; |
15618 | mergeIntoWithNoDuplicateKeys(c, b); | 17550 | } |
15619 | return c; | 17551 | return null; |
15620 | }; | ||
15621 | } | 17552 | } |
15622 | 17553 | ||
15623 | /** | 17554 | /** |
15624 | * Creates a function that invokes two functions and ignores their return vales. | 17555 | * Return if A is an ancestor of B. |
15625 | * | ||
15626 | * @param {function} one Function to invoke first. | ||
15627 | * @param {function} two Function to invoke second. | ||
15628 | * @return {function} Function that invokes the two argument functions. | ||
15629 | * @private | ||
15630 | */ | 17556 | */ |
15631 | function createChainedFunction(one, two) { | 17557 | function isAncestor(instA, instB) { |
15632 | return function chainedFunction() { | 17558 | !('_hostNode' in instA) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'isAncestor: Invalid argument.') : _prodInvariant('35') : void 0; |
15633 | one.apply(this, arguments); | 17559 | !('_hostNode' in instB) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'isAncestor: Invalid argument.') : _prodInvariant('35') : void 0; |
15634 | two.apply(this, arguments); | 17560 | |
15635 | }; | 17561 | while (instB) { |
17562 | if (instB === instA) { | ||
17563 | return true; | ||
17564 | } | ||
17565 | instB = instB._hostParent; | ||
17566 | } | ||
17567 | return false; | ||
15636 | } | 17568 | } |
15637 | 17569 | ||
15638 | /** | 17570 | /** |
15639 | * Binds a method to the component. | 17571 | * Return the parent instance of the passed-in instance. |
15640 | * | ||
15641 | * @param {object} component Component whose method is going to be bound. | ||
15642 | * @param {function} method Method to be bound. | ||
15643 | * @return {function} The bound method. | ||
15644 | */ | 17572 | */ |
15645 | function bindAutoBindMethod(component, method) { | 17573 | function getParentInstance(inst) { |
15646 | var boundMethod = method.bind(component); | 17574 | !('_hostNode' in inst) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getParentInstance: Invalid argument.') : _prodInvariant('36') : void 0; |
15647 | if (process.env.NODE_ENV !== 'production') { | ||
15648 | boundMethod.__reactBoundContext = component; | ||
15649 | boundMethod.__reactBoundMethod = method; | ||
15650 | boundMethod.__reactBoundArguments = null; | ||
15651 | var componentName = component.constructor.displayName; | ||
15652 | var _bind = boundMethod.bind; | ||
15653 | /* eslint-disable block-scoped-var, no-undef */ | ||
15654 | boundMethod.bind = function (newThis) { | ||
15655 | for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
15656 | args[_key - 1] = arguments[_key]; | ||
15657 | } | ||
15658 | 17575 | ||
15659 | // User is trying to bind() an autobound method; we effectively will | 17576 | return inst._hostParent; |
15660 | // ignore the value of "this" that the user is trying to use, so | ||
15661 | // let's warn. | ||
15662 | if (newThis !== component && newThis !== null) { | ||
15663 | process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : undefined; | ||
15664 | } else if (!args.length) { | ||
15665 | 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) : undefined; | ||
15666 | return boundMethod; | ||
15667 | } | ||
15668 | var reboundMethod = _bind.apply(boundMethod, arguments); | ||
15669 | reboundMethod.__reactBoundContext = component; | ||
15670 | reboundMethod.__reactBoundMethod = method; | ||
15671 | reboundMethod.__reactBoundArguments = args; | ||
15672 | return reboundMethod; | ||
15673 | /* eslint-enable */ | ||
15674 | }; | ||
15675 | } | ||
15676 | return boundMethod; | ||
15677 | } | 17577 | } |
15678 | 17578 | ||
15679 | /** | 17579 | /** |
15680 | * Binds all auto-bound methods in a component. | 17580 | * Simulates the traversal of a two-phase, capture/bubble event dispatch. |
15681 | * | ||
15682 | * @param {object} component Component whose method is going to be bound. | ||
15683 | */ | 17581 | */ |
15684 | function bindAutoBindMethods(component) { | 17582 | function traverseTwoPhase(inst, fn, arg) { |
15685 | for (var autoBindKey in component.__reactAutoBindMap) { | 17583 | var path = []; |
15686 | if (component.__reactAutoBindMap.hasOwnProperty(autoBindKey)) { | 17584 | while (inst) { |
15687 | var method = component.__reactAutoBindMap[autoBindKey]; | 17585 | path.push(inst); |
15688 | component[autoBindKey] = bindAutoBindMethod(component, method); | 17586 | inst = inst._hostParent; |
15689 | } | 17587 | } |
17588 | var i; | ||
17589 | for (i = path.length; i-- > 0;) { | ||
17590 | fn(path[i], false, arg); | ||
17591 | } | ||
17592 | for (i = 0; i < path.length; i++) { | ||
17593 | fn(path[i], true, arg); | ||
15690 | } | 17594 | } |
15691 | } | 17595 | } |
15692 | 17596 | ||
15693 | /** | 17597 | /** |
15694 | * Add more to the ReactClass base class. These are all legacy features and | 17598 | * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that |
15695 | * therefore not already part of the modern ReactComponent. | 17599 | * should would receive a `mouseEnter` or `mouseLeave` event. |
17600 | * | ||
17601 | * Does not invoke the callback on the nearest common ancestor because nothing | ||
17602 | * "entered" or "left" that element. | ||
15696 | */ | 17603 | */ |
15697 | var ReactClassMixin = { | 17604 | function traverseEnterLeave(from, to, fn, argFrom, argTo) { |
17605 | var common = from && to ? getLowestCommonAncestor(from, to) : null; | ||
17606 | var pathFrom = []; | ||
17607 | while (from && from !== common) { | ||
17608 | pathFrom.push(from); | ||
17609 | from = from._hostParent; | ||
17610 | } | ||
17611 | var pathTo = []; | ||
17612 | while (to && to !== common) { | ||
17613 | pathTo.push(to); | ||
17614 | to = to._hostParent; | ||
17615 | } | ||
17616 | var i; | ||
17617 | for (i = 0; i < pathFrom.length; i++) { | ||
17618 | fn(pathFrom[i], true, argFrom); | ||
17619 | } | ||
17620 | for (i = pathTo.length; i-- > 0;) { | ||
17621 | fn(pathTo[i], false, argTo); | ||
17622 | } | ||
17623 | } | ||
15698 | 17624 | ||
15699 | /** | 17625 | module.exports = { |
15700 | * TODO: This will be deprecated because state should always keep a consistent | 17626 | isAncestor: isAncestor, |
15701 | * type signature and the only use case for this, is to avoid that. | 17627 | getLowestCommonAncestor: getLowestCommonAncestor, |
15702 | */ | 17628 | getParentInstance: getParentInstance, |
15703 | replaceState: function (newState, callback) { | 17629 | traverseTwoPhase: traverseTwoPhase, |
15704 | this.updater.enqueueReplaceState(this, newState); | 17630 | traverseEnterLeave: traverseEnterLeave |
15705 | if (callback) { | 17631 | }; |
15706 | this.updater.enqueueCallback(this, callback); | 17632 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) |
15707 | } | 17633 | |
15708 | }, | 17634 | /***/ }, |
17635 | /* 142 */ | ||
17636 | /***/ function(module, exports, __webpack_require__) { | ||
17637 | |||
17638 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
17639 | * Copyright 2013-present, Facebook, Inc. | ||
17640 | * All rights reserved. | ||
17641 | * | ||
17642 | * This source code is licensed under the BSD-style license found in the | ||
17643 | * LICENSE file in the root directory of this source tree. An additional grant | ||
17644 | * of patent rights can be found in the PATENTS file in the same directory. | ||
17645 | * | ||
17646 | * @providesModule ReactDOMTextComponent | ||
17647 | */ | ||
15709 | 17648 | ||
15710 | /** | 17649 | 'use strict'; |
15711 | * Checks whether or not this composite component is mounted. | ||
15712 | * @return {boolean} True if mounted, false otherwise. | ||
15713 | * @protected | ||
15714 | * @final | ||
15715 | */ | ||
15716 | isMounted: function () { | ||
15717 | return this.updater.isMounted(this); | ||
15718 | }, | ||
15719 | 17650 | ||
15720 | /** | 17651 | var _prodInvariant = __webpack_require__(9), |
15721 | * Sets a subset of the props. | 17652 | _assign = __webpack_require__(6); |
15722 | * | ||
15723 | * @param {object} partialProps Subset of the next props. | ||
15724 | * @param {?function} callback Called after props are updated. | ||
15725 | * @final | ||
15726 | * @public | ||
15727 | * @deprecated | ||
15728 | */ | ||
15729 | setProps: function (partialProps, callback) { | ||
15730 | if (process.env.NODE_ENV !== 'production') { | ||
15731 | warnSetProps(); | ||
15732 | } | ||
15733 | this.updater.enqueueSetProps(this, partialProps); | ||
15734 | if (callback) { | ||
15735 | this.updater.enqueueCallback(this, callback); | ||
15736 | } | ||
15737 | }, | ||
15738 | 17653 | ||
15739 | /** | 17654 | var DOMChildrenOperations = __webpack_require__(84); |
15740 | * Replace all the props. | 17655 | var DOMLazyTree = __webpack_require__(85); |
15741 | * | 17656 | var ReactDOMComponentTree = __webpack_require__(39); |
15742 | * @param {object} newProps Subset of the next props. | 17657 | var ReactInstrumentation = __webpack_require__(65); |
15743 | * @param {?function} callback Called after props are updated. | ||
15744 | * @final | ||
15745 | * @public | ||
15746 | * @deprecated | ||
15747 | */ | ||
15748 | replaceProps: function (newProps, callback) { | ||
15749 | if (process.env.NODE_ENV !== 'production') { | ||
15750 | warnSetProps(); | ||
15751 | } | ||
15752 | this.updater.enqueueReplaceProps(this, newProps); | ||
15753 | if (callback) { | ||
15754 | this.updater.enqueueCallback(this, callback); | ||
15755 | } | ||
15756 | } | ||
15757 | }; | ||
15758 | 17658 | ||
15759 | var ReactClassComponent = function () {}; | 17659 | var escapeTextContentForBrowser = __webpack_require__(90); |
15760 | assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin); | 17660 | var invariant = __webpack_require__(10); |
17661 | var validateDOMNesting = __webpack_require__(139); | ||
15761 | 17662 | ||
15762 | /** | 17663 | /** |
15763 | * Module for creating composite components. | 17664 | * Text nodes violate a couple assumptions that React makes about components: |
15764 | * | 17665 | * |
15765 | * @class ReactClass | 17666 | * - When mounting text into the DOM, adjacent text nodes are merged. |
17667 | * - Text nodes cannot be assigned a React root ID. | ||
17668 | * | ||
17669 | * This component is used to wrap strings between comment nodes so that they | ||
17670 | * can undergo the same reconciliation that is applied to elements. | ||
17671 | * | ||
17672 | * TODO: Investigate representing React components in the DOM with text nodes. | ||
17673 | * | ||
17674 | * @class ReactDOMTextComponent | ||
17675 | * @extends ReactComponent | ||
17676 | * @internal | ||
15766 | */ | 17677 | */ |
15767 | var ReactClass = { | 17678 | var ReactDOMTextComponent = function (text) { |
17679 | // TODO: This is really a ReactText (ReactNode), not a ReactElement | ||
17680 | this._currentElement = text; | ||
17681 | this._stringText = '' + text; | ||
17682 | // ReactDOMComponentTree uses these: | ||
17683 | this._hostNode = null; | ||
17684 | this._hostParent = null; | ||
17685 | |||
17686 | // Properties | ||
17687 | this._domID = null; | ||
17688 | this._mountIndex = 0; | ||
17689 | this._closingComment = null; | ||
17690 | this._commentNodes = null; | ||
17691 | }; | ||
17692 | |||
17693 | _assign(ReactDOMTextComponent.prototype, { | ||
15768 | 17694 | ||
15769 | /** | 17695 | /** |
15770 | * Creates a composite component class given a class specification. | 17696 | * Creates the markup for this text node. This node is not intended to have |
17697 | * any features besides containing text content. | ||
15771 | * | 17698 | * |
15772 | * @param {object} spec Class specification (which must define `render`). | 17699 | * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction |
15773 | * @return {function} Component constructor function. | 17700 | * @return {string} Markup for this text node. |
15774 | * @public | 17701 | * @internal |
15775 | */ | 17702 | */ |
15776 | createClass: function (spec) { | 17703 | mountComponent: function (transaction, hostParent, hostContainerInfo, context) { |
15777 | var Constructor = function (props, context, updater) { | 17704 | if (process.env.NODE_ENV !== 'production') { |
15778 | // This constructor is overridden by mocks. The argument is used | 17705 | ReactInstrumentation.debugTool.onSetText(this._debugID, this._stringText); |
15779 | // by mocks to assert on what gets mounted. | ||
15780 | 17706 | ||
15781 | if (process.env.NODE_ENV !== 'production') { | 17707 | var parentInfo; |
15782 | 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') : undefined; | 17708 | if (hostParent != null) { |
17709 | parentInfo = hostParent._ancestorInfo; | ||
17710 | } else if (hostContainerInfo != null) { | ||
17711 | parentInfo = hostContainerInfo._ancestorInfo; | ||
15783 | } | 17712 | } |
15784 | 17713 | if (parentInfo) { | |
15785 | // Wire up auto-binding | 17714 | // parentInfo should always be present except for the top-level |
15786 | if (this.__reactAutoBindMap) { | 17715 | // component when server rendering |
15787 | bindAutoBindMethods(this); | 17716 | validateDOMNesting('#text', this, parentInfo); |
15788 | } | 17717 | } |
17718 | } | ||
15789 | 17719 | ||
15790 | this.props = props; | 17720 | var domID = hostContainerInfo._idCounter++; |
15791 | this.context = context; | 17721 | var openingValue = ' react-text: ' + domID + ' '; |
15792 | this.refs = emptyObject; | 17722 | var closingValue = ' /react-text '; |
15793 | this.updater = updater || ReactNoopUpdateQueue; | 17723 | this._domID = domID; |
15794 | 17724 | this._hostParent = hostParent; | |
15795 | this.state = null; | 17725 | if (transaction.useCreateElement) { |
15796 | 17726 | var ownerDocument = hostContainerInfo._ownerDocument; | |
15797 | // ReactClasses doesn't have constructors. Instead, they use the | 17727 | var openingComment = ownerDocument.createComment(openingValue); |
15798 | // getInitialState and componentWillMount methods for initialization. | 17728 | var closingComment = ownerDocument.createComment(closingValue); |
17729 | var lazyTree = DOMLazyTree(ownerDocument.createDocumentFragment()); | ||
17730 | DOMLazyTree.queueChild(lazyTree, DOMLazyTree(openingComment)); | ||
17731 | if (this._stringText) { | ||
17732 | DOMLazyTree.queueChild(lazyTree, DOMLazyTree(ownerDocument.createTextNode(this._stringText))); | ||
17733 | } | ||
17734 | DOMLazyTree.queueChild(lazyTree, DOMLazyTree(closingComment)); | ||
17735 | ReactDOMComponentTree.precacheNode(this, openingComment); | ||
17736 | this._closingComment = closingComment; | ||
17737 | return lazyTree; | ||
17738 | } else { | ||
17739 | var escapedText = escapeTextContentForBrowser(this._stringText); | ||
15799 | 17740 | ||
15800 | var initialState = this.getInitialState ? this.getInitialState() : null; | 17741 | if (transaction.renderToStaticMarkup) { |
15801 | if (process.env.NODE_ENV !== 'production') { | 17742 | // Normally we'd wrap this between comment nodes for the reasons stated |
15802 | // We allow auto-mocks to proceed as if they're returning null. | 17743 | // above, but since this is a situation where React won't take over |
15803 | if (typeof initialState === 'undefined' && this.getInitialState._isMockFunction) { | 17744 | // (static pages), we can simply return the text as it is. |
15804 | // This is probably bad practice. Consider warning here and | 17745 | return escapedText; |
15805 | // deprecating this convenience. | ||
15806 | initialState = null; | ||
15807 | } | ||
15808 | } | 17746 | } |
15809 | !(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : invariant(false) : undefined; | ||
15810 | |||
15811 | this.state = initialState; | ||
15812 | }; | ||
15813 | Constructor.prototype = new ReactClassComponent(); | ||
15814 | Constructor.prototype.constructor = Constructor; | ||
15815 | |||
15816 | injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor)); | ||
15817 | 17747 | ||
15818 | mixSpecIntoComponent(Constructor, spec); | 17748 | return '<!--' + openingValue + '-->' + escapedText + '<!--' + closingValue + '-->'; |
15819 | |||
15820 | // Initialize the defaultProps property after all mixins have been merged. | ||
15821 | if (Constructor.getDefaultProps) { | ||
15822 | Constructor.defaultProps = Constructor.getDefaultProps(); | ||
15823 | } | 17749 | } |
17750 | }, | ||
15824 | 17751 | ||
15825 | if (process.env.NODE_ENV !== 'production') { | 17752 | /** |
15826 | // This is a tag to indicate that the use of these method names is ok, | 17753 | * Updates this component by updating the text content. |
15827 | // since it's used with createClass. If it's not, then it's likely a | 17754 | * |
15828 | // mistake so we'll warn you to use the static property, property | 17755 | * @param {ReactText} nextText The next text content |
15829 | // initializer or constructor respectively. | 17756 | * @param {ReactReconcileTransaction} transaction |
15830 | if (Constructor.getDefaultProps) { | 17757 | * @internal |
15831 | Constructor.getDefaultProps.isReactClassApproved = {}; | 17758 | */ |
15832 | } | 17759 | receiveComponent: function (nextText, transaction) { |
15833 | if (Constructor.prototype.getInitialState) { | 17760 | if (nextText !== this._currentElement) { |
15834 | Constructor.prototype.getInitialState.isReactClassApproved = {}; | 17761 | this._currentElement = nextText; |
17762 | var nextStringText = '' + nextText; | ||
17763 | if (nextStringText !== this._stringText) { | ||
17764 | // TODO: Save this as pending props and use performUpdateIfNecessary | ||
17765 | // and/or updateComponent to do the actual update for consistency with | ||
17766 | // other component types? | ||
17767 | this._stringText = nextStringText; | ||
17768 | var commentNodes = this.getHostNode(); | ||
17769 | DOMChildrenOperations.replaceDelimitedText(commentNodes[0], commentNodes[1], nextStringText); | ||
17770 | |||
17771 | if (process.env.NODE_ENV !== 'production') { | ||
17772 | ReactInstrumentation.debugTool.onSetText(this._debugID, nextStringText); | ||
17773 | } | ||
15835 | } | 17774 | } |
15836 | } | 17775 | } |
17776 | }, | ||
15837 | 17777 | ||
15838 | !Constructor.prototype.render ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : invariant(false) : undefined; | 17778 | getHostNode: function () { |
15839 | 17779 | var hostNode = this._commentNodes; | |
15840 | if (process.env.NODE_ENV !== 'production') { | 17780 | if (hostNode) { |
15841 | 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') : undefined; | 17781 | return hostNode; |
15842 | process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component') : undefined; | ||
15843 | } | 17782 | } |
15844 | 17783 | if (!this._closingComment) { | |
15845 | // Reduce time spent doing lookups by setting these on the prototype. | 17784 | var openingComment = ReactDOMComponentTree.getNodeFromInstance(this); |
15846 | for (var methodName in ReactClassInterface) { | 17785 | var node = openingComment.nextSibling; |
15847 | if (!Constructor.prototype[methodName]) { | 17786 | while (true) { |
15848 | Constructor.prototype[methodName] = null; | 17787 | !(node != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Missing closing comment for text component %s', this._domID) : _prodInvariant('67', this._domID) : void 0; |
17788 | if (node.nodeType === 8 && node.nodeValue === ' /react-text ') { | ||
17789 | this._closingComment = node; | ||
17790 | break; | ||
17791 | } | ||
17792 | node = node.nextSibling; | ||
15849 | } | 17793 | } |
15850 | } | 17794 | } |
15851 | 17795 | hostNode = [this._hostNode, this._closingComment]; | |
15852 | return Constructor; | 17796 | this._commentNodes = hostNode; |
17797 | return hostNode; | ||
15853 | }, | 17798 | }, |
15854 | 17799 | ||
15855 | injection: { | 17800 | unmountComponent: function () { |
15856 | injectMixin: function (mixin) { | 17801 | this._closingComment = null; |
15857 | injectedMixins.push(mixin); | 17802 | this._commentNodes = null; |
15858 | } | 17803 | ReactDOMComponentTree.uncacheNode(this); |
15859 | } | 17804 | } |
15860 | 17805 | ||
15861 | }; | 17806 | }); |
15862 | 17807 | ||
15863 | module.exports = ReactClass; | 17808 | module.exports = ReactDOMTextComponent; |
15864 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | 17809 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) |
15865 | 17810 | ||
15866 | /***/ }, | 17811 | /***/ }, |
15867 | /* 125 */ | 17812 | /* 143 */ |
15868 | /***/ function(module, exports, __webpack_require__) { | 17813 | /***/ function(module, exports, __webpack_require__) { |
15869 | 17814 | ||
15870 | /* WEBPACK VAR INJECTION */(function(process) {/** | 17815 | /** |
15871 | * Copyright 2013-2015, Facebook, Inc. | 17816 | * Copyright 2013-present, Facebook, Inc. |
15872 | * All rights reserved. | 17817 | * All rights reserved. |
15873 | * | 17818 | * |
15874 | * This source code is licensed under the BSD-style license found in the | 17819 | * This source code is licensed under the BSD-style license found in the |
15875 | * LICENSE file in the root directory of this source tree. An additional grant | 17820 | * LICENSE file in the root directory of this source tree. An additional grant |
15876 | * of patent rights can be found in the PATENTS file in the same directory. | 17821 | * of patent rights can be found in the PATENTS file in the same directory. |
15877 | * | 17822 | * |
15878 | * @providesModule ReactComponent | 17823 | * @providesModule ReactDefaultBatchingStrategy |
15879 | */ | 17824 | */ |
15880 | 17825 | ||
15881 | 'use strict'; | 17826 | 'use strict'; |
15882 | 17827 | ||
15883 | var ReactNoopUpdateQueue = __webpack_require__(126); | 17828 | var _assign = __webpack_require__(6); |
15884 | |||
15885 | var canDefineProperty = __webpack_require__(45); | ||
15886 | var emptyObject = __webpack_require__(60); | ||
15887 | var invariant = __webpack_require__(15); | ||
15888 | var warning = __webpack_require__(27); | ||
15889 | 17829 | ||
15890 | /** | 17830 | var ReactUpdates = __webpack_require__(59); |
15891 | * Base class helpers for the updating state of a component. | 17831 | var Transaction = __webpack_require__(72); |
15892 | */ | ||
15893 | function ReactComponent(props, context, updater) { | ||
15894 | this.props = props; | ||
15895 | this.context = context; | ||
15896 | this.refs = emptyObject; | ||
15897 | // We initialize the default updater but the real one gets injected by the | ||
15898 | // renderer. | ||
15899 | this.updater = updater || ReactNoopUpdateQueue; | ||
15900 | } | ||
15901 | 17832 | ||
15902 | ReactComponent.prototype.isReactComponent = {}; | 17833 | var emptyFunction = __webpack_require__(14); |
15903 | 17834 | ||
15904 | /** | 17835 | var RESET_BATCHED_UPDATES = { |
15905 | * Sets a subset of the state. Always use this to mutate | 17836 | initialize: emptyFunction, |
15906 | * state. You should treat `this.state` as immutable. | 17837 | close: function () { |
15907 | * | 17838 | ReactDefaultBatchingStrategy.isBatchingUpdates = false; |
15908 | * There is no guarantee that `this.state` will be immediately updated, so | ||
15909 | * accessing `this.state` after calling this method may return the old value. | ||
15910 | * | ||
15911 | * There is no guarantee that calls to `setState` will run synchronously, | ||
15912 | * as they may eventually be batched together. You can provide an optional | ||
15913 | * callback that will be executed when the call to setState is actually | ||
15914 | * completed. | ||
15915 | * | ||
15916 | * When a function is provided to setState, it will be called at some point in | ||
15917 | * the future (not synchronously). It will be called with the up to date | ||
15918 | * component arguments (state, props, context). These values can be different | ||
15919 | * from this.* because your function may be called after receiveProps but before | ||
15920 | * shouldComponentUpdate, and this new state, props, and context will not yet be | ||
15921 | * assigned to this. | ||
15922 | * | ||
15923 | * @param {object|function} partialState Next partial state or function to | ||
15924 | * produce next partial state to be merged with current state. | ||
15925 | * @param {?function} callback Called after state is updated. | ||
15926 | * @final | ||
15927 | * @protected | ||
15928 | */ | ||
15929 | ReactComponent.prototype.setState = function (partialState, callback) { | ||
15930 | !(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.') : invariant(false) : undefined; | ||
15931 | if (process.env.NODE_ENV !== 'production') { | ||
15932 | process.env.NODE_ENV !== 'production' ? warning(partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().') : undefined; | ||
15933 | } | ||
15934 | this.updater.enqueueSetState(this, partialState); | ||
15935 | if (callback) { | ||
15936 | this.updater.enqueueCallback(this, callback); | ||
15937 | } | 17839 | } |
15938 | }; | 17840 | }; |
15939 | 17841 | ||
15940 | /** | 17842 | var FLUSH_BATCHED_UPDATES = { |
15941 | * Forces an update. This should only be invoked when it is known with | 17843 | initialize: emptyFunction, |
15942 | * certainty that we are **not** in a DOM transaction. | 17844 | close: ReactUpdates.flushBatchedUpdates.bind(ReactUpdates) |
15943 | * | ||
15944 | * You may want to call this when you know that some deeper aspect of the | ||
15945 | * component's state has changed but `setState` was not called. | ||
15946 | * | ||
15947 | * This will not invoke `shouldComponentUpdate`, but it will invoke | ||
15948 | * `componentWillUpdate` and `componentDidUpdate`. | ||
15949 | * | ||
15950 | * @param {?function} callback Called after update is complete. | ||
15951 | * @final | ||
15952 | * @protected | ||
15953 | */ | ||
15954 | ReactComponent.prototype.forceUpdate = function (callback) { | ||
15955 | this.updater.enqueueForceUpdate(this); | ||
15956 | if (callback) { | ||
15957 | this.updater.enqueueCallback(this, callback); | ||
15958 | } | ||
15959 | }; | 17845 | }; |
15960 | 17846 | ||
15961 | /** | 17847 | var TRANSACTION_WRAPPERS = [FLUSH_BATCHED_UPDATES, RESET_BATCHED_UPDATES]; |
15962 | * Deprecated APIs. These APIs used to exist on classic React classes but since | 17848 | |
15963 | * we would like to deprecate them, we're not going to move them over to this | 17849 | function ReactDefaultBatchingStrategyTransaction() { |
15964 | * modern base class. Instead, we define a getter that warns if it's accessed. | 17850 | this.reinitializeTransaction(); |
15965 | */ | 17851 | } |
15966 | if (process.env.NODE_ENV !== 'production') { | 17852 | |
15967 | var deprecatedAPIs = { | 17853 | _assign(ReactDefaultBatchingStrategyTransaction.prototype, Transaction.Mixin, { |
15968 | getDOMNode: ['getDOMNode', 'Use ReactDOM.findDOMNode(component) instead.'], | 17854 | getTransactionWrappers: function () { |
15969 | isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'], | 17855 | return TRANSACTION_WRAPPERS; |
15970 | replaceProps: ['replaceProps', 'Instead, call render again at the top level.'], | 17856 | } |
15971 | replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).'], | 17857 | }); |
15972 | setProps: ['setProps', 'Instead, call render again at the top level.'] | 17858 | |
15973 | }; | 17859 | var transaction = new ReactDefaultBatchingStrategyTransaction(); |
15974 | var defineDeprecationWarning = function (methodName, info) { | 17860 | |
15975 | if (canDefineProperty) { | 17861 | var ReactDefaultBatchingStrategy = { |
15976 | Object.defineProperty(ReactComponent.prototype, methodName, { | 17862 | isBatchingUpdates: false, |
15977 | get: function () { | 17863 | |
15978 | process.env.NODE_ENV !== 'production' ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) : undefined; | 17864 | /** |
15979 | return undefined; | 17865 | * Call the provided function in a context within which calls to `setState` |
15980 | } | 17866 | * and friends are batched such that components aren't updated unnecessarily. |
15981 | }); | 17867 | */ |
15982 | } | 17868 | batchedUpdates: function (callback, a, b, c, d, e) { |
15983 | }; | 17869 | var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates; |
15984 | for (var fnName in deprecatedAPIs) { | 17870 | |
15985 | if (deprecatedAPIs.hasOwnProperty(fnName)) { | 17871 | ReactDefaultBatchingStrategy.isBatchingUpdates = true; |
15986 | defineDeprecationWarning(fnName, deprecatedAPIs[fnName]); | 17872 | |
17873 | // The code is written this way to avoid extra allocations | ||
17874 | if (alreadyBatchingUpdates) { | ||
17875 | callback(a, b, c, d, e); | ||
17876 | } else { | ||
17877 | transaction.perform(callback, null, a, b, c, d, e); | ||
15987 | } | 17878 | } |
15988 | } | 17879 | } |
15989 | } | 17880 | }; |
15990 | 17881 | ||
15991 | module.exports = ReactComponent; | 17882 | module.exports = ReactDefaultBatchingStrategy; |
15992 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
15993 | 17883 | ||
15994 | /***/ }, | 17884 | /***/ }, |
15995 | /* 126 */ | 17885 | /* 144 */ |
15996 | /***/ function(module, exports, __webpack_require__) { | 17886 | /***/ function(module, exports, __webpack_require__) { |
15997 | 17887 | ||
15998 | /* WEBPACK VAR INJECTION */(function(process) {/** | 17888 | /** |
15999 | * Copyright 2015, Facebook, Inc. | 17889 | * Copyright 2013-present, Facebook, Inc. |
16000 | * All rights reserved. | 17890 | * All rights reserved. |
16001 | * | 17891 | * |
16002 | * This source code is licensed under the BSD-style license found in the | 17892 | * This source code is licensed under the BSD-style license found in the |
16003 | * LICENSE file in the root directory of this source tree. An additional grant | 17893 | * LICENSE file in the root directory of this source tree. An additional grant |
16004 | * of patent rights can be found in the PATENTS file in the same directory. | 17894 | * of patent rights can be found in the PATENTS file in the same directory. |
16005 | * | 17895 | * |
16006 | * @providesModule ReactNoopUpdateQueue | 17896 | * @providesModule ReactEventListener |
16007 | */ | 17897 | */ |
16008 | 17898 | ||
16009 | 'use strict'; | 17899 | 'use strict'; |
16010 | 17900 | ||
16011 | var warning = __webpack_require__(27); | 17901 | var _assign = __webpack_require__(6); |
16012 | 17902 | ||
16013 | function warnTDZ(publicInstance, callerName) { | 17903 | var EventListener = __webpack_require__(145); |
16014 | if (process.env.NODE_ENV !== 'production') { | 17904 | var ExecutionEnvironment = __webpack_require__(52); |
16015 | 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, publicInstance.constructor && publicInstance.constructor.displayName || '') : undefined; | 17905 | var PooledClass = __webpack_require__(8); |
16016 | } | 17906 | var ReactDOMComponentTree = __webpack_require__(39); |
16017 | } | 17907 | var ReactUpdates = __webpack_require__(59); |
17908 | |||
17909 | var getEventTarget = __webpack_require__(73); | ||
17910 | var getUnboundedScrollPosition = __webpack_require__(146); | ||
16018 | 17911 | ||
16019 | /** | 17912 | /** |
16020 | * This is the abstract API for an update queue. | 17913 | * Find the deepest React component completely containing the root of the |
17914 | * passed-in instance (for use when entire React trees are nested within each | ||
17915 | * other). If React trees are not nested, returns null. | ||
16021 | */ | 17916 | */ |
16022 | var ReactNoopUpdateQueue = { | 17917 | function findParent(inst) { |
17918 | // TODO: It may be a good idea to cache this to prevent unnecessary DOM | ||
17919 | // traversal, but caching is difficult to do correctly without using a | ||
17920 | // mutation observer to listen for all DOM changes. | ||
17921 | while (inst._hostParent) { | ||
17922 | inst = inst._hostParent; | ||
17923 | } | ||
17924 | var rootNode = ReactDOMComponentTree.getNodeFromInstance(inst); | ||
17925 | var container = rootNode.parentNode; | ||
17926 | return ReactDOMComponentTree.getClosestInstanceFromNode(container); | ||
17927 | } | ||
16023 | 17928 | ||
16024 | /** | 17929 | // Used to store ancestor hierarchy in top level callback |
16025 | * Checks whether or not this composite component is mounted. | 17930 | function TopLevelCallbackBookKeeping(topLevelType, nativeEvent) { |
16026 | * @param {ReactClass} publicInstance The instance we want to test. | 17931 | this.topLevelType = topLevelType; |
16027 | * @return {boolean} True if mounted, false otherwise. | 17932 | this.nativeEvent = nativeEvent; |
16028 | * @protected | 17933 | this.ancestors = []; |
16029 | * @final | 17934 | } |
16030 | */ | 17935 | _assign(TopLevelCallbackBookKeeping.prototype, { |
16031 | isMounted: function (publicInstance) { | 17936 | destructor: function () { |
16032 | return false; | 17937 | this.topLevelType = null; |
17938 | this.nativeEvent = null; | ||
17939 | this.ancestors.length = 0; | ||
17940 | } | ||
17941 | }); | ||
17942 | PooledClass.addPoolingTo(TopLevelCallbackBookKeeping, PooledClass.twoArgumentPooler); | ||
17943 | |||
17944 | function handleTopLevelImpl(bookKeeping) { | ||
17945 | var nativeEventTarget = getEventTarget(bookKeeping.nativeEvent); | ||
17946 | var targetInst = ReactDOMComponentTree.getClosestInstanceFromNode(nativeEventTarget); | ||
17947 | |||
17948 | // Loop through the hierarchy, in case there's any nested components. | ||
17949 | // It's important that we build the array of ancestors before calling any | ||
17950 | // event handlers, because event handlers can modify the DOM, leading to | ||
17951 | // inconsistencies with ReactMount's node cache. See #1105. | ||
17952 | var ancestor = targetInst; | ||
17953 | do { | ||
17954 | bookKeeping.ancestors.push(ancestor); | ||
17955 | ancestor = ancestor && findParent(ancestor); | ||
17956 | } while (ancestor); | ||
17957 | |||
17958 | for (var i = 0; i < bookKeeping.ancestors.length; i++) { | ||
17959 | targetInst = bookKeeping.ancestors[i]; | ||
17960 | ReactEventListener._handleTopLevel(bookKeeping.topLevelType, targetInst, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent)); | ||
17961 | } | ||
17962 | } | ||
17963 | |||
17964 | function scrollValueMonitor(cb) { | ||
17965 | var scrollPosition = getUnboundedScrollPosition(window); | ||
17966 | cb(scrollPosition); | ||
17967 | } | ||
17968 | |||
17969 | var ReactEventListener = { | ||
17970 | _enabled: true, | ||
17971 | _handleTopLevel: null, | ||
17972 | |||
17973 | WINDOW_HANDLE: ExecutionEnvironment.canUseDOM ? window : null, | ||
17974 | |||
17975 | setHandleTopLevel: function (handleTopLevel) { | ||
17976 | ReactEventListener._handleTopLevel = handleTopLevel; | ||
16033 | }, | 17977 | }, |
16034 | 17978 | ||
16035 | /** | 17979 | setEnabled: function (enabled) { |
16036 | * Enqueue a callback that will be executed after all the pending updates | 17980 | ReactEventListener._enabled = !!enabled; |
16037 | * have processed. | 17981 | }, |
16038 | * | ||
16039 | * @param {ReactClass} publicInstance The instance to use as `this` context. | ||
16040 | * @param {?function} callback Called after state is updated. | ||
16041 | * @internal | ||
16042 | */ | ||
16043 | enqueueCallback: function (publicInstance, callback) {}, | ||
16044 | 17982 | ||
16045 | /** | 17983 | isEnabled: function () { |
16046 | * Forces an update. This should only be invoked when it is known with | 17984 | return ReactEventListener._enabled; |
16047 | * certainty that we are **not** in a DOM transaction. | ||
16048 | * | ||
16049 | * You may want to call this when you know that some deeper aspect of the | ||
16050 | * component's state has changed but `setState` was not called. | ||
16051 | * | ||
16052 | * This will not invoke `shouldComponentUpdate`, but it will invoke | ||
16053 | * `componentWillUpdate` and `componentDidUpdate`. | ||
16054 | * | ||
16055 | * @param {ReactClass} publicInstance The instance that should rerender. | ||
16056 | * @internal | ||
16057 | */ | ||
16058 | enqueueForceUpdate: function (publicInstance) { | ||
16059 | warnTDZ(publicInstance, 'forceUpdate'); | ||
16060 | }, | 17985 | }, |
16061 | 17986 | ||
16062 | /** | 17987 | /** |
16063 | * Replaces all of the state. Always use this or `setState` to mutate state. | 17988 | * Traps top-level events by using event bubbling. |
16064 | * You should treat `this.state` as immutable. | ||
16065 | * | ||
16066 | * There is no guarantee that `this.state` will be immediately updated, so | ||
16067 | * accessing `this.state` after calling this method may return the old value. | ||
16068 | * | 17989 | * |
16069 | * @param {ReactClass} publicInstance The instance that should rerender. | 17990 | * @param {string} topLevelType Record from `EventConstants`. |
16070 | * @param {object} completeState Next state. | 17991 | * @param {string} handlerBaseName Event name (e.g. "click"). |
17992 | * @param {object} handle Element on which to attach listener. | ||
17993 | * @return {?object} An object with a remove function which will forcefully | ||
17994 | * remove the listener. | ||
16071 | * @internal | 17995 | * @internal |
16072 | */ | 17996 | */ |
16073 | enqueueReplaceState: function (publicInstance, completeState) { | 17997 | trapBubbledEvent: function (topLevelType, handlerBaseName, handle) { |
16074 | warnTDZ(publicInstance, 'replaceState'); | 17998 | var element = handle; |
17999 | if (!element) { | ||
18000 | return null; | ||
18001 | } | ||
18002 | return EventListener.listen(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType)); | ||
16075 | }, | 18003 | }, |
16076 | 18004 | ||
16077 | /** | 18005 | /** |
16078 | * Sets a subset of the state. This only exists because _pendingState is | 18006 | * Traps a top-level event by using event capturing. |
16079 | * internal. This provides a merging strategy that is not available to deep | ||
16080 | * properties which is confusing. TODO: Expose pendingState or don't use it | ||
16081 | * during the merge. | ||
16082 | * | 18007 | * |
16083 | * @param {ReactClass} publicInstance The instance that should rerender. | 18008 | * @param {string} topLevelType Record from `EventConstants`. |
16084 | * @param {object} partialState Next partial state to be merged with state. | 18009 | * @param {string} handlerBaseName Event name (e.g. "click"). |
18010 | * @param {object} handle Element on which to attach listener. | ||
18011 | * @return {?object} An object with a remove function which will forcefully | ||
18012 | * remove the listener. | ||
16085 | * @internal | 18013 | * @internal |
16086 | */ | 18014 | */ |
16087 | enqueueSetState: function (publicInstance, partialState) { | 18015 | trapCapturedEvent: function (topLevelType, handlerBaseName, handle) { |
16088 | warnTDZ(publicInstance, 'setState'); | 18016 | var element = handle; |
18017 | if (!element) { | ||
18018 | return null; | ||
18019 | } | ||
18020 | return EventListener.capture(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType)); | ||
18021 | }, | ||
18022 | |||
18023 | monitorScrollValue: function (refresh) { | ||
18024 | var callback = scrollValueMonitor.bind(null, refresh); | ||
18025 | EventListener.listen(window, 'scroll', callback); | ||
16089 | }, | 18026 | }, |
16090 | 18027 | ||
18028 | dispatchEvent: function (topLevelType, nativeEvent) { | ||
18029 | if (!ReactEventListener._enabled) { | ||
18030 | return; | ||
18031 | } | ||
18032 | |||
18033 | var bookKeeping = TopLevelCallbackBookKeeping.getPooled(topLevelType, nativeEvent); | ||
18034 | try { | ||
18035 | // Event queue being processed in the same cycle allows | ||
18036 | // `preventDefault`. | ||
18037 | ReactUpdates.batchedUpdates(handleTopLevelImpl, bookKeeping); | ||
18038 | } finally { | ||
18039 | TopLevelCallbackBookKeeping.release(bookKeeping); | ||
18040 | } | ||
18041 | } | ||
18042 | }; | ||
18043 | |||
18044 | module.exports = ReactEventListener; | ||
18045 | |||
18046 | /***/ }, | ||
18047 | /* 145 */ | ||
18048 | /***/ function(module, exports, __webpack_require__) { | ||
18049 | |||
18050 | /* WEBPACK VAR INJECTION */(function(process) {'use strict'; | ||
18051 | |||
18052 | /** | ||
18053 | * Copyright (c) 2013-present, Facebook, Inc. | ||
18054 | * | ||
18055 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
18056 | * you may not use this file except in compliance with the License. | ||
18057 | * You may obtain a copy of the License at | ||
18058 | * | ||
18059 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
18060 | * | ||
18061 | * Unless required by applicable law or agreed to in writing, software | ||
18062 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
18063 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
18064 | * See the License for the specific language governing permissions and | ||
18065 | * limitations under the License. | ||
18066 | * | ||
18067 | * @typechecks | ||
18068 | */ | ||
18069 | |||
18070 | var emptyFunction = __webpack_require__(14); | ||
18071 | |||
18072 | /** | ||
18073 | * Upstream version of event listener. Does not take into account specific | ||
18074 | * nature of platform. | ||
18075 | */ | ||
18076 | var EventListener = { | ||
16091 | /** | 18077 | /** |
16092 | * Sets a subset of the props. | 18078 | * Listen to DOM events during the bubble phase. |
16093 | * | 18079 | * |
16094 | * @param {ReactClass} publicInstance The instance that should rerender. | 18080 | * @param {DOMEventTarget} target DOM element to register listener on. |
16095 | * @param {object} partialProps Subset of the next props. | 18081 | * @param {string} eventType Event type, e.g. 'click' or 'mouseover'. |
16096 | * @internal | 18082 | * @param {function} callback Callback function. |
18083 | * @return {object} Object with a `remove` method. | ||
16097 | */ | 18084 | */ |
16098 | enqueueSetProps: function (publicInstance, partialProps) { | 18085 | listen: function listen(target, eventType, callback) { |
16099 | warnTDZ(publicInstance, 'setProps'); | 18086 | if (target.addEventListener) { |
18087 | target.addEventListener(eventType, callback, false); | ||
18088 | return { | ||
18089 | remove: function remove() { | ||
18090 | target.removeEventListener(eventType, callback, false); | ||
18091 | } | ||
18092 | }; | ||
18093 | } else if (target.attachEvent) { | ||
18094 | target.attachEvent('on' + eventType, callback); | ||
18095 | return { | ||
18096 | remove: function remove() { | ||
18097 | target.detachEvent('on' + eventType, callback); | ||
18098 | } | ||
18099 | }; | ||
18100 | } | ||
16100 | }, | 18101 | }, |
16101 | 18102 | ||
16102 | /** | 18103 | /** |
16103 | * Replaces all of the props. | 18104 | * Listen to DOM events during the capture phase. |
16104 | * | 18105 | * |
16105 | * @param {ReactClass} publicInstance The instance that should rerender. | 18106 | * @param {DOMEventTarget} target DOM element to register listener on. |
16106 | * @param {object} props New props. | 18107 | * @param {string} eventType Event type, e.g. 'click' or 'mouseover'. |
16107 | * @internal | 18108 | * @param {function} callback Callback function. |
18109 | * @return {object} Object with a `remove` method. | ||
16108 | */ | 18110 | */ |
16109 | enqueueReplaceProps: function (publicInstance, props) { | 18111 | capture: function capture(target, eventType, callback) { |
16110 | warnTDZ(publicInstance, 'replaceProps'); | 18112 | if (target.addEventListener) { |
16111 | } | 18113 | target.addEventListener(eventType, callback, true); |
18114 | return { | ||
18115 | remove: function remove() { | ||
18116 | target.removeEventListener(eventType, callback, true); | ||
18117 | } | ||
18118 | }; | ||
18119 | } else { | ||
18120 | if (process.env.NODE_ENV !== 'production') { | ||
18121 | 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.'); | ||
18122 | } | ||
18123 | return { | ||
18124 | remove: emptyFunction | ||
18125 | }; | ||
18126 | } | ||
18127 | }, | ||
16112 | 18128 | ||
18129 | registerDefault: function registerDefault() {} | ||
16113 | }; | 18130 | }; |
16114 | 18131 | ||
16115 | module.exports = ReactNoopUpdateQueue; | 18132 | module.exports = EventListener; |
16116 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | 18133 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) |
16117 | 18134 | ||
16118 | /***/ }, | 18135 | /***/ }, |
16119 | /* 127 */ | 18136 | /* 146 */ |
18137 | /***/ function(module, exports) { | ||
18138 | |||
18139 | /** | ||
18140 | * Copyright (c) 2013-present, Facebook, Inc. | ||
18141 | * All rights reserved. | ||
18142 | * | ||
18143 | * This source code is licensed under the BSD-style license found in the | ||
18144 | * LICENSE file in the root directory of this source tree. An additional grant | ||
18145 | * of patent rights can be found in the PATENTS file in the same directory. | ||
18146 | * | ||
18147 | * @typechecks | ||
18148 | */ | ||
18149 | |||
18150 | 'use strict'; | ||
18151 | |||
18152 | /** | ||
18153 | * Gets the scroll position of the supplied element or window. | ||
18154 | * | ||
18155 | * The return values are unbounded, unlike `getScrollPosition`. This means they | ||
18156 | * may be negative or exceed the element boundaries (which is possible using | ||
18157 | * inertial scrolling). | ||
18158 | * | ||
18159 | * @param {DOMWindow|DOMElement} scrollable | ||
18160 | * @return {object} Map with `x` and `y` keys. | ||
18161 | */ | ||
18162 | |||
18163 | function getUnboundedScrollPosition(scrollable) { | ||
18164 | if (scrollable === window) { | ||
18165 | return { | ||
18166 | x: window.pageXOffset || document.documentElement.scrollLeft, | ||
18167 | y: window.pageYOffset || document.documentElement.scrollTop | ||
18168 | }; | ||
18169 | } | ||
18170 | return { | ||
18171 | x: scrollable.scrollLeft, | ||
18172 | y: scrollable.scrollTop | ||
18173 | }; | ||
18174 | } | ||
18175 | |||
18176 | module.exports = getUnboundedScrollPosition; | ||
18177 | |||
18178 | /***/ }, | ||
18179 | /* 147 */ | ||
16120 | /***/ function(module, exports, __webpack_require__) { | 18180 | /***/ function(module, exports, __webpack_require__) { |
16121 | 18181 | ||
16122 | /** | 18182 | /** |
16123 | * Copyright 2013-2015, Facebook, Inc. | 18183 | * Copyright 2013-present, Facebook, Inc. |
18184 | * All rights reserved. | ||
18185 | * | ||
18186 | * This source code is licensed under the BSD-style license found in the | ||
18187 | * LICENSE file in the root directory of this source tree. An additional grant | ||
18188 | * of patent rights can be found in the PATENTS file in the same directory. | ||
18189 | * | ||
18190 | * @providesModule ReactInjection | ||
18191 | */ | ||
18192 | |||
18193 | 'use strict'; | ||
18194 | |||
18195 | var DOMProperty = __webpack_require__(40); | ||
18196 | var EventPluginHub = __webpack_require__(46); | ||
18197 | var EventPluginUtils = __webpack_require__(48); | ||
18198 | var ReactComponentEnvironment = __webpack_require__(125); | ||
18199 | var ReactClass = __webpack_require__(23); | ||
18200 | var ReactEmptyComponent = __webpack_require__(133); | ||
18201 | var ReactBrowserEventEmitter = __webpack_require__(114); | ||
18202 | var ReactHostComponent = __webpack_require__(134); | ||
18203 | var ReactUpdates = __webpack_require__(59); | ||
18204 | |||
18205 | var ReactInjection = { | ||
18206 | Component: ReactComponentEnvironment.injection, | ||
18207 | Class: ReactClass.injection, | ||
18208 | DOMProperty: DOMProperty.injection, | ||
18209 | EmptyComponent: ReactEmptyComponent.injection, | ||
18210 | EventPluginHub: EventPluginHub.injection, | ||
18211 | EventPluginUtils: EventPluginUtils.injection, | ||
18212 | EventEmitter: ReactBrowserEventEmitter.injection, | ||
18213 | HostComponent: ReactHostComponent.injection, | ||
18214 | Updates: ReactUpdates.injection | ||
18215 | }; | ||
18216 | |||
18217 | module.exports = ReactInjection; | ||
18218 | |||
18219 | /***/ }, | ||
18220 | /* 148 */ | ||
18221 | /***/ function(module, exports, __webpack_require__) { | ||
18222 | |||
18223 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
18224 | * Copyright 2013-present, Facebook, Inc. | ||
16124 | * All rights reserved. | 18225 | * All rights reserved. |
16125 | * | 18226 | * |
16126 | * This source code is licensed under the BSD-style license found in the | 18227 | * This source code is licensed under the BSD-style license found in the |
@@ -16128,19 +18229,19 @@ | |||
16128 | * of patent rights can be found in the PATENTS file in the same directory. | 18229 | * of patent rights can be found in the PATENTS file in the same directory. |
16129 | * | 18230 | * |
16130 | * @providesModule ReactReconcileTransaction | 18231 | * @providesModule ReactReconcileTransaction |
16131 | * @typechecks static-only | ||
16132 | */ | 18232 | */ |
16133 | 18233 | ||
16134 | 'use strict'; | 18234 | 'use strict'; |
16135 | 18235 | ||
16136 | var CallbackQueue = __webpack_require__(57); | 18236 | var _assign = __webpack_require__(6); |
16137 | var PooledClass = __webpack_require__(58); | ||
16138 | var ReactBrowserEventEmitter = __webpack_require__(31); | ||
16139 | var ReactDOMFeatureFlags = __webpack_require__(43); | ||
16140 | var ReactInputSelection = __webpack_require__(128); | ||
16141 | var Transaction = __webpack_require__(59); | ||
16142 | 18237 | ||
16143 | var assign = __webpack_require__(41); | 18238 | var CallbackQueue = __webpack_require__(60); |
18239 | var PooledClass = __webpack_require__(8); | ||
18240 | var ReactBrowserEventEmitter = __webpack_require__(114); | ||
18241 | var ReactInputSelection = __webpack_require__(149); | ||
18242 | var ReactInstrumentation = __webpack_require__(65); | ||
18243 | var Transaction = __webpack_require__(72); | ||
18244 | var ReactUpdateQueue = __webpack_require__(138); | ||
16144 | 18245 | ||
16145 | /** | 18246 | /** |
16146 | * Ensures that, when possible, the selection range (currently selected text | 18247 | * Ensures that, when possible, the selection range (currently selected text |
@@ -16185,7 +18286,7 @@ | |||
16185 | 18286 | ||
16186 | /** | 18287 | /** |
16187 | * Provides a queue for collecting `componentDidMount` and | 18288 | * Provides a queue for collecting `componentDidMount` and |
16188 | * `componentDidUpdate` callbacks during the the transaction. | 18289 | * `componentDidUpdate` callbacks during the transaction. |
16189 | */ | 18290 | */ |
16190 | var ON_DOM_READY_QUEUEING = { | 18291 | var ON_DOM_READY_QUEUEING = { |
16191 | /** | 18292 | /** |
@@ -16210,6 +18311,13 @@ | |||
16210 | */ | 18311 | */ |
16211 | var TRANSACTION_WRAPPERS = [SELECTION_RESTORATION, EVENT_SUPPRESSION, ON_DOM_READY_QUEUEING]; | 18312 | var TRANSACTION_WRAPPERS = [SELECTION_RESTORATION, EVENT_SUPPRESSION, ON_DOM_READY_QUEUEING]; |
16212 | 18313 | ||
18314 | if (process.env.NODE_ENV !== 'production') { | ||
18315 | TRANSACTION_WRAPPERS.push({ | ||
18316 | initialize: ReactInstrumentation.debugTool.onBeginFlush, | ||
18317 | close: ReactInstrumentation.debugTool.onEndFlush | ||
18318 | }); | ||
18319 | } | ||
18320 | |||
16213 | /** | 18321 | /** |
16214 | * Currently: | 18322 | * Currently: |
16215 | * - The order that these are listed in the transaction is critical: | 18323 | * - The order that these are listed in the transaction is critical: |
@@ -16224,16 +18332,16 @@ | |||
16224 | * | 18332 | * |
16225 | * @class ReactReconcileTransaction | 18333 | * @class ReactReconcileTransaction |
16226 | */ | 18334 | */ |
16227 | function ReactReconcileTransaction(forceHTML) { | 18335 | function ReactReconcileTransaction(useCreateElement) { |
16228 | this.reinitializeTransaction(); | 18336 | this.reinitializeTransaction(); |
16229 | // Only server-side rendering really needs this option (see | 18337 | // Only server-side rendering really needs this option (see |
16230 | // `ReactServerRendering`), but server-side uses | 18338 | // `ReactServerRendering`), but server-side uses |
16231 | // `ReactServerRenderingTransaction` instead. This option is here so that it's | 18339 | // `ReactServerRenderingTransaction` instead. This option is here so that it's |
16232 | // accessible and defaults to false when `ReactDOMComponent` and | 18340 | // accessible and defaults to false when `ReactDOMComponent` and |
16233 | // `ReactTextComponent` checks it in `mountComponent`.` | 18341 | // `ReactDOMTextComponent` checks it in `mountComponent`.` |
16234 | this.renderToStaticMarkup = false; | 18342 | this.renderToStaticMarkup = false; |
16235 | this.reactMountReady = CallbackQueue.getPooled(null); | 18343 | this.reactMountReady = CallbackQueue.getPooled(null); |
16236 | this.useCreateElement = !forceHTML && ReactDOMFeatureFlags.useCreateElement; | 18344 | this.useCreateElement = useCreateElement; |
16237 | } | 18345 | } |
16238 | 18346 | ||
16239 | var Mixin = { | 18347 | var Mixin = { |
@@ -16256,6 +18364,26 @@ | |||
16256 | }, | 18364 | }, |
16257 | 18365 | ||
16258 | /** | 18366 | /** |
18367 | * @return {object} The queue to collect React async events. | ||
18368 | */ | ||
18369 | getUpdateQueue: function () { | ||
18370 | return ReactUpdateQueue; | ||
18371 | }, | ||
18372 | |||
18373 | /** | ||
18374 | * Save current transaction state -- if the return value from this method is | ||
18375 | * passed to `rollback`, the transaction will be reset to that state. | ||
18376 | */ | ||
18377 | checkpoint: function () { | ||
18378 | // reactMountReady is the our only stateful wrapper | ||
18379 | return this.reactMountReady.checkpoint(); | ||
18380 | }, | ||
18381 | |||
18382 | rollback: function (checkpoint) { | ||
18383 | this.reactMountReady.rollback(checkpoint); | ||
18384 | }, | ||
18385 | |||
18386 | /** | ||
16259 | * `PooledClass` looks for this, and will invoke this before allowing this | 18387 | * `PooledClass` looks for this, and will invoke this before allowing this |
16260 | * instance to be reused. | 18388 | * instance to be reused. |
16261 | */ | 18389 | */ |
@@ -16265,18 +18393,19 @@ | |||
16265 | } | 18393 | } |
16266 | }; | 18394 | }; |
16267 | 18395 | ||
16268 | assign(ReactReconcileTransaction.prototype, Transaction.Mixin, Mixin); | 18396 | _assign(ReactReconcileTransaction.prototype, Transaction.Mixin, Mixin); |
16269 | 18397 | ||
16270 | PooledClass.addPoolingTo(ReactReconcileTransaction); | 18398 | PooledClass.addPoolingTo(ReactReconcileTransaction); |
16271 | 18399 | ||
16272 | module.exports = ReactReconcileTransaction; | 18400 | module.exports = ReactReconcileTransaction; |
18401 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
16273 | 18402 | ||
16274 | /***/ }, | 18403 | /***/ }, |
16275 | /* 128 */ | 18404 | /* 149 */ |
16276 | /***/ function(module, exports, __webpack_require__) { | 18405 | /***/ function(module, exports, __webpack_require__) { |
16277 | 18406 | ||
16278 | /** | 18407 | /** |
16279 | * Copyright 2013-2015, Facebook, Inc. | 18408 | * Copyright 2013-present, Facebook, Inc. |
16280 | * All rights reserved. | 18409 | * All rights reserved. |
16281 | * | 18410 | * |
16282 | * This source code is licensed under the BSD-style license found in the | 18411 | * This source code is licensed under the BSD-style license found in the |
@@ -16288,11 +18417,11 @@ | |||
16288 | 18417 | ||
16289 | 'use strict'; | 18418 | 'use strict'; |
16290 | 18419 | ||
16291 | var ReactDOMSelection = __webpack_require__(129); | 18420 | var ReactDOMSelection = __webpack_require__(150); |
16292 | 18421 | ||
16293 | var containsNode = __webpack_require__(61); | 18422 | var containsNode = __webpack_require__(152); |
16294 | var focusNode = __webpack_require__(97); | 18423 | var focusNode = __webpack_require__(99); |
16295 | var getActiveElement = __webpack_require__(131); | 18424 | var getActiveElement = __webpack_require__(155); |
16296 | 18425 | ||
16297 | function isInDocument(node) { | 18426 | function isInDocument(node) { |
16298 | return containsNode(document.documentElement, node); | 18427 | return containsNode(document.documentElement, node); |
@@ -16351,7 +18480,7 @@ | |||
16351 | start: input.selectionStart, | 18480 | start: input.selectionStart, |
16352 | end: input.selectionEnd | 18481 | end: input.selectionEnd |
16353 | }; | 18482 | }; |
16354 | } else if (document.selection && (input.nodeName && input.nodeName.toLowerCase() === 'input')) { | 18483 | } else if (document.selection && input.nodeName && input.nodeName.toLowerCase() === 'input') { |
16355 | // IE8 input. | 18484 | // IE8 input. |
16356 | var range = document.selection.createRange(); | 18485 | var range = document.selection.createRange(); |
16357 | // There can only be one selection per document in IE, so it must | 18486 | // There can only be one selection per document in IE, so it must |
@@ -16379,14 +18508,14 @@ | |||
16379 | setSelection: function (input, offsets) { | 18508 | setSelection: function (input, offsets) { |
16380 | var start = offsets.start; | 18509 | var start = offsets.start; |
16381 | var end = offsets.end; | 18510 | var end = offsets.end; |
16382 | if (typeof end === 'undefined') { | 18511 | if (end === undefined) { |
16383 | end = start; | 18512 | end = start; |
16384 | } | 18513 | } |
16385 | 18514 | ||
16386 | if ('selectionStart' in input) { | 18515 | if ('selectionStart' in input) { |
16387 | input.selectionStart = start; | 18516 | input.selectionStart = start; |
16388 | input.selectionEnd = Math.min(end, input.value.length); | 18517 | input.selectionEnd = Math.min(end, input.value.length); |
16389 | } else if (document.selection && (input.nodeName && input.nodeName.toLowerCase() === 'input')) { | 18518 | } else if (document.selection && input.nodeName && input.nodeName.toLowerCase() === 'input') { |
16390 | var range = input.createTextRange(); | 18519 | var range = input.createTextRange(); |
16391 | range.collapse(true); | 18520 | range.collapse(true); |
16392 | range.moveStart('character', start); | 18521 | range.moveStart('character', start); |
@@ -16401,11 +18530,11 @@ | |||
16401 | module.exports = ReactInputSelection; | 18530 | module.exports = ReactInputSelection; |
16402 | 18531 | ||
16403 | /***/ }, | 18532 | /***/ }, |
16404 | /* 129 */ | 18533 | /* 150 */ |
16405 | /***/ function(module, exports, __webpack_require__) { | 18534 | /***/ function(module, exports, __webpack_require__) { |
16406 | 18535 | ||
16407 | /** | 18536 | /** |
16408 | * Copyright 2013-2015, Facebook, Inc. | 18537 | * Copyright 2013-present, Facebook, Inc. |
16409 | * All rights reserved. | 18538 | * All rights reserved. |
16410 | * | 18539 | * |
16411 | * This source code is licensed under the BSD-style license found in the | 18540 | * This source code is licensed under the BSD-style license found in the |
@@ -16417,10 +18546,10 @@ | |||
16417 | 18546 | ||
16418 | 'use strict'; | 18547 | 'use strict'; |
16419 | 18548 | ||
16420 | var ExecutionEnvironment = __webpack_require__(11); | 18549 | var ExecutionEnvironment = __webpack_require__(52); |
16421 | 18550 | ||
16422 | var getNodeForCharacterOffset = __webpack_require__(130); | 18551 | var getNodeForCharacterOffset = __webpack_require__(151); |
16423 | var getTextContentAccessor = __webpack_require__(77); | 18552 | var getTextContentAccessor = __webpack_require__(54); |
16424 | 18553 | ||
16425 | /** | 18554 | /** |
16426 | * While `isCollapsed` is available on the Selection object and `collapsed` | 18555 | * While `isCollapsed` is available on the Selection object and `collapsed` |
@@ -16534,7 +18663,7 @@ | |||
16534 | var range = document.selection.createRange().duplicate(); | 18663 | var range = document.selection.createRange().duplicate(); |
16535 | var start, end; | 18664 | var start, end; |
16536 | 18665 | ||
16537 | if (typeof offsets.end === 'undefined') { | 18666 | if (offsets.end === undefined) { |
16538 | start = offsets.start; | 18667 | start = offsets.start; |
16539 | end = start; | 18668 | end = start; |
16540 | } else if (offsets.start > offsets.end) { | 18669 | } else if (offsets.start > offsets.end) { |
@@ -16558,7 +18687,7 @@ | |||
16558 | * | 18687 | * |
16559 | * Note: IE10+ supports the Selection object, but it does not support | 18688 | * Note: IE10+ supports the Selection object, but it does not support |
16560 | * the `extend` method, which means that even in modern IE, it's not possible | 18689 | * the `extend` method, which means that even in modern IE, it's not possible |
16561 | * to programatically create a backward selection. Thus, for all IE | 18690 | * to programmatically create a backward selection. Thus, for all IE |
16562 | * versions, we use the old IE API to create our selections. | 18691 | * versions, we use the old IE API to create our selections. |
16563 | * | 18692 | * |
16564 | * @param {DOMElement|DOMTextNode} node | 18693 | * @param {DOMElement|DOMTextNode} node |
@@ -16572,7 +18701,7 @@ | |||
16572 | var selection = window.getSelection(); | 18701 | var selection = window.getSelection(); |
16573 | var length = node[getTextContentAccessor()].length; | 18702 | var length = node[getTextContentAccessor()].length; |
16574 | var start = Math.min(offsets.start, length); | 18703 | var start = Math.min(offsets.start, length); |
16575 | var end = typeof offsets.end === 'undefined' ? start : Math.min(offsets.end, length); | 18704 | var end = offsets.end === undefined ? start : Math.min(offsets.end, length); |
16576 | 18705 | ||
16577 | // IE 11 uses modern selection, but doesn't support the extend method. | 18706 | // IE 11 uses modern selection, but doesn't support the extend method. |
16578 | // Flip backward selections, so we can set with a single range. | 18707 | // Flip backward selections, so we can set with a single range. |
@@ -16618,11 +18747,11 @@ | |||
16618 | module.exports = ReactDOMSelection; | 18747 | module.exports = ReactDOMSelection; |
16619 | 18748 | ||
16620 | /***/ }, | 18749 | /***/ }, |
16621 | /* 130 */ | 18750 | /* 151 */ |
16622 | /***/ function(module, exports) { | 18751 | /***/ function(module, exports) { |
16623 | 18752 | ||
16624 | /** | 18753 | /** |
16625 | * Copyright 2013-2015, Facebook, Inc. | 18754 | * Copyright 2013-present, Facebook, Inc. |
16626 | * All rights reserved. | 18755 | * All rights reserved. |
16627 | * | 18756 | * |
16628 | * This source code is licensed under the BSD-style license found in the | 18757 | * This source code is licensed under the BSD-style license found in the |
@@ -16640,6 +18769,7 @@ | |||
16640 | * @param {DOMElement|DOMTextNode} node | 18769 | * @param {DOMElement|DOMTextNode} node |
16641 | * @return {DOMElement|DOMTextNode} | 18770 | * @return {DOMElement|DOMTextNode} |
16642 | */ | 18771 | */ |
18772 | |||
16643 | function getLeafNode(node) { | 18773 | function getLeafNode(node) { |
16644 | while (node && node.firstChild) { | 18774 | while (node && node.firstChild) { |
16645 | node = node.firstChild; | 18775 | node = node.firstChild; |
@@ -16696,34 +18826,135 @@ | |||
16696 | module.exports = getNodeForCharacterOffset; | 18826 | module.exports = getNodeForCharacterOffset; |
16697 | 18827 | ||
16698 | /***/ }, | 18828 | /***/ }, |
16699 | /* 131 */ | 18829 | /* 152 */ |
18830 | /***/ function(module, exports, __webpack_require__) { | ||
18831 | |||
18832 | 'use strict'; | ||
18833 | |||
18834 | /** | ||
18835 | * Copyright (c) 2013-present, Facebook, Inc. | ||
18836 | * All rights reserved. | ||
18837 | * | ||
18838 | * This source code is licensed under the BSD-style license found in the | ||
18839 | * LICENSE file in the root directory of this source tree. An additional grant | ||
18840 | * of patent rights can be found in the PATENTS file in the same directory. | ||
18841 | * | ||
18842 | * | ||
18843 | */ | ||
18844 | |||
18845 | var isTextNode = __webpack_require__(153); | ||
18846 | |||
18847 | /*eslint-disable no-bitwise */ | ||
18848 | |||
18849 | /** | ||
18850 | * Checks if a given DOM node contains or is another DOM node. | ||
18851 | */ | ||
18852 | function containsNode(outerNode, innerNode) { | ||
18853 | if (!outerNode || !innerNode) { | ||
18854 | return false; | ||
18855 | } else if (outerNode === innerNode) { | ||
18856 | return true; | ||
18857 | } else if (isTextNode(outerNode)) { | ||
18858 | return false; | ||
18859 | } else if (isTextNode(innerNode)) { | ||
18860 | return containsNode(outerNode, innerNode.parentNode); | ||
18861 | } else if ('contains' in outerNode) { | ||
18862 | return outerNode.contains(innerNode); | ||
18863 | } else if (outerNode.compareDocumentPosition) { | ||
18864 | return !!(outerNode.compareDocumentPosition(innerNode) & 16); | ||
18865 | } else { | ||
18866 | return false; | ||
18867 | } | ||
18868 | } | ||
18869 | |||
18870 | module.exports = containsNode; | ||
18871 | |||
18872 | /***/ }, | ||
18873 | /* 153 */ | ||
18874 | /***/ function(module, exports, __webpack_require__) { | ||
18875 | |||
18876 | 'use strict'; | ||
18877 | |||
18878 | /** | ||
18879 | * Copyright (c) 2013-present, Facebook, Inc. | ||
18880 | * All rights reserved. | ||
18881 | * | ||
18882 | * This source code is licensed under the BSD-style license found in the | ||
18883 | * LICENSE file in the root directory of this source tree. An additional grant | ||
18884 | * of patent rights can be found in the PATENTS file in the same directory. | ||
18885 | * | ||
18886 | * @typechecks | ||
18887 | */ | ||
18888 | |||
18889 | var isNode = __webpack_require__(154); | ||
18890 | |||
18891 | /** | ||
18892 | * @param {*} object The object to check. | ||
18893 | * @return {boolean} Whether or not the object is a DOM text node. | ||
18894 | */ | ||
18895 | function isTextNode(object) { | ||
18896 | return isNode(object) && object.nodeType == 3; | ||
18897 | } | ||
18898 | |||
18899 | module.exports = isTextNode; | ||
18900 | |||
18901 | /***/ }, | ||
18902 | /* 154 */ | ||
16700 | /***/ function(module, exports) { | 18903 | /***/ function(module, exports) { |
16701 | 18904 | ||
18905 | 'use strict'; | ||
18906 | |||
16702 | /** | 18907 | /** |
16703 | * Copyright 2013-2015, Facebook, Inc. | 18908 | * Copyright (c) 2013-present, Facebook, Inc. |
16704 | * All rights reserved. | 18909 | * All rights reserved. |
16705 | * | 18910 | * |
16706 | * This source code is licensed under the BSD-style license found in the | 18911 | * This source code is licensed under the BSD-style license found in the |
16707 | * LICENSE file in the root directory of this source tree. An additional grant | 18912 | * LICENSE file in the root directory of this source tree. An additional grant |
16708 | * of patent rights can be found in the PATENTS file in the same directory. | 18913 | * of patent rights can be found in the PATENTS file in the same directory. |
16709 | * | 18914 | * |
16710 | * @providesModule getActiveElement | ||
16711 | * @typechecks | 18915 | * @typechecks |
16712 | */ | 18916 | */ |
16713 | 18917 | ||
16714 | /** | 18918 | /** |
18919 | * @param {*} object The object to check. | ||
18920 | * @return {boolean} Whether or not the object is a DOM node. | ||
18921 | */ | ||
18922 | function isNode(object) { | ||
18923 | return !!(object && (typeof Node === 'function' ? object instanceof Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string')); | ||
18924 | } | ||
18925 | |||
18926 | module.exports = isNode; | ||
18927 | |||
18928 | /***/ }, | ||
18929 | /* 155 */ | ||
18930 | /***/ function(module, exports) { | ||
18931 | |||
18932 | 'use strict'; | ||
18933 | |||
18934 | /** | ||
18935 | * Copyright (c) 2013-present, Facebook, Inc. | ||
18936 | * All rights reserved. | ||
18937 | * | ||
18938 | * This source code is licensed under the BSD-style license found in the | ||
18939 | * LICENSE file in the root directory of this source tree. An additional grant | ||
18940 | * of patent rights can be found in the PATENTS file in the same directory. | ||
18941 | * | ||
18942 | * @typechecks | ||
18943 | */ | ||
18944 | |||
18945 | /* eslint-disable fb-www/typeof-undefined */ | ||
18946 | |||
18947 | /** | ||
16715 | * Same as document.activeElement but wraps in a try-catch block. In IE it is | 18948 | * Same as document.activeElement but wraps in a try-catch block. In IE it is |
16716 | * not safe to call document.activeElement if there is nothing focused. | 18949 | * not safe to call document.activeElement if there is nothing focused. |
16717 | * | 18950 | * |
16718 | * The activeElement will be null only if the document or document body is not yet defined. | 18951 | * The activeElement will be null only if the document or document body is not |
18952 | * yet defined. | ||
16719 | */ | 18953 | */ |
16720 | 'use strict'; | ||
16721 | |||
16722 | function getActiveElement() /*?DOMElement*/{ | 18954 | function getActiveElement() /*?DOMElement*/{ |
16723 | if (typeof document === 'undefined') { | 18955 | if (typeof document === 'undefined') { |
16724 | return null; | 18956 | return null; |
16725 | } | 18957 | } |
16726 | |||
16727 | try { | 18958 | try { |
16728 | return document.activeElement || document.body; | 18959 | return document.activeElement || document.body; |
16729 | } catch (e) { | 18960 | } catch (e) { |
@@ -16734,11 +18965,318 @@ | |||
16734 | module.exports = getActiveElement; | 18965 | module.exports = getActiveElement; |
16735 | 18966 | ||
16736 | /***/ }, | 18967 | /***/ }, |
16737 | /* 132 */ | 18968 | /* 156 */ |
18969 | /***/ function(module, exports) { | ||
18970 | |||
18971 | /** | ||
18972 | * Copyright 2013-present, Facebook, Inc. | ||
18973 | * All rights reserved. | ||
18974 | * | ||
18975 | * This source code is licensed under the BSD-style license found in the | ||
18976 | * LICENSE file in the root directory of this source tree. An additional grant | ||
18977 | * of patent rights can be found in the PATENTS file in the same directory. | ||
18978 | * | ||
18979 | * @providesModule SVGDOMPropertyConfig | ||
18980 | */ | ||
18981 | |||
18982 | 'use strict'; | ||
18983 | |||
18984 | var NS = { | ||
18985 | xlink: 'http://www.w3.org/1999/xlink', | ||
18986 | xml: 'http://www.w3.org/XML/1998/namespace' | ||
18987 | }; | ||
18988 | |||
18989 | // We use attributes for everything SVG so let's avoid some duplication and run | ||
18990 | // code instead. | ||
18991 | // The following are all specified in the HTML config already so we exclude here. | ||
18992 | // - class (as className) | ||
18993 | // - color | ||
18994 | // - height | ||
18995 | // - id | ||
18996 | // - lang | ||
18997 | // - max | ||
18998 | // - media | ||
18999 | // - method | ||
19000 | // - min | ||
19001 | // - name | ||
19002 | // - style | ||
19003 | // - target | ||
19004 | // - type | ||
19005 | // - width | ||
19006 | var ATTRS = { | ||
19007 | accentHeight: 'accent-height', | ||
19008 | accumulate: 0, | ||
19009 | additive: 0, | ||
19010 | alignmentBaseline: 'alignment-baseline', | ||
19011 | allowReorder: 'allowReorder', | ||
19012 | alphabetic: 0, | ||
19013 | amplitude: 0, | ||
19014 | arabicForm: 'arabic-form', | ||
19015 | ascent: 0, | ||
19016 | attributeName: 'attributeName', | ||
19017 | attributeType: 'attributeType', | ||
19018 | autoReverse: 'autoReverse', | ||
19019 | azimuth: 0, | ||
19020 | baseFrequency: 'baseFrequency', | ||
19021 | baseProfile: 'baseProfile', | ||
19022 | baselineShift: 'baseline-shift', | ||
19023 | bbox: 0, | ||
19024 | begin: 0, | ||
19025 | bias: 0, | ||
19026 | by: 0, | ||
19027 | calcMode: 'calcMode', | ||
19028 | capHeight: 'cap-height', | ||
19029 | clip: 0, | ||
19030 | clipPath: 'clip-path', | ||
19031 | clipRule: 'clip-rule', | ||
19032 | clipPathUnits: 'clipPathUnits', | ||
19033 | colorInterpolation: 'color-interpolation', | ||
19034 | colorInterpolationFilters: 'color-interpolation-filters', | ||
19035 | colorProfile: 'color-profile', | ||
19036 | colorRendering: 'color-rendering', | ||
19037 | contentScriptType: 'contentScriptType', | ||
19038 | contentStyleType: 'contentStyleType', | ||
19039 | cursor: 0, | ||
19040 | cx: 0, | ||
19041 | cy: 0, | ||
19042 | d: 0, | ||
19043 | decelerate: 0, | ||
19044 | descent: 0, | ||
19045 | diffuseConstant: 'diffuseConstant', | ||
19046 | direction: 0, | ||
19047 | display: 0, | ||
19048 | divisor: 0, | ||
19049 | dominantBaseline: 'dominant-baseline', | ||
19050 | dur: 0, | ||
19051 | dx: 0, | ||
19052 | dy: 0, | ||
19053 | edgeMode: 'edgeMode', | ||
19054 | elevation: 0, | ||
19055 | enableBackground: 'enable-background', | ||
19056 | end: 0, | ||
19057 | exponent: 0, | ||
19058 | externalResourcesRequired: 'externalResourcesRequired', | ||
19059 | fill: 0, | ||
19060 | fillOpacity: 'fill-opacity', | ||
19061 | fillRule: 'fill-rule', | ||
19062 | filter: 0, | ||
19063 | filterRes: 'filterRes', | ||
19064 | filterUnits: 'filterUnits', | ||
19065 | floodColor: 'flood-color', | ||
19066 | floodOpacity: 'flood-opacity', | ||
19067 | focusable: 0, | ||
19068 | fontFamily: 'font-family', | ||
19069 | fontSize: 'font-size', | ||
19070 | fontSizeAdjust: 'font-size-adjust', | ||
19071 | fontStretch: 'font-stretch', | ||
19072 | fontStyle: 'font-style', | ||
19073 | fontVariant: 'font-variant', | ||
19074 | fontWeight: 'font-weight', | ||
19075 | format: 0, | ||
19076 | from: 0, | ||
19077 | fx: 0, | ||
19078 | fy: 0, | ||
19079 | g1: 0, | ||
19080 | g2: 0, | ||
19081 | glyphName: 'glyph-name', | ||
19082 | glyphOrientationHorizontal: 'glyph-orientation-horizontal', | ||
19083 | glyphOrientationVertical: 'glyph-orientation-vertical', | ||
19084 | glyphRef: 'glyphRef', | ||
19085 | gradientTransform: 'gradientTransform', | ||
19086 | gradientUnits: 'gradientUnits', | ||
19087 | hanging: 0, | ||
19088 | horizAdvX: 'horiz-adv-x', | ||
19089 | horizOriginX: 'horiz-origin-x', | ||
19090 | ideographic: 0, | ||
19091 | imageRendering: 'image-rendering', | ||
19092 | 'in': 0, | ||
19093 | in2: 0, | ||
19094 | intercept: 0, | ||
19095 | k: 0, | ||
19096 | k1: 0, | ||
19097 | k2: 0, | ||
19098 | k3: 0, | ||
19099 | k4: 0, | ||
19100 | kernelMatrix: 'kernelMatrix', | ||
19101 | kernelUnitLength: 'kernelUnitLength', | ||
19102 | kerning: 0, | ||
19103 | keyPoints: 'keyPoints', | ||
19104 | keySplines: 'keySplines', | ||
19105 | keyTimes: 'keyTimes', | ||
19106 | lengthAdjust: 'lengthAdjust', | ||
19107 | letterSpacing: 'letter-spacing', | ||
19108 | lightingColor: 'lighting-color', | ||
19109 | limitingConeAngle: 'limitingConeAngle', | ||
19110 | local: 0, | ||
19111 | markerEnd: 'marker-end', | ||
19112 | markerMid: 'marker-mid', | ||
19113 | markerStart: 'marker-start', | ||
19114 | markerHeight: 'markerHeight', | ||
19115 | markerUnits: 'markerUnits', | ||
19116 | markerWidth: 'markerWidth', | ||
19117 | mask: 0, | ||
19118 | maskContentUnits: 'maskContentUnits', | ||
19119 | maskUnits: 'maskUnits', | ||
19120 | mathematical: 0, | ||
19121 | mode: 0, | ||
19122 | numOctaves: 'numOctaves', | ||
19123 | offset: 0, | ||
19124 | opacity: 0, | ||
19125 | operator: 0, | ||
19126 | order: 0, | ||
19127 | orient: 0, | ||
19128 | orientation: 0, | ||
19129 | origin: 0, | ||
19130 | overflow: 0, | ||
19131 | overlinePosition: 'overline-position', | ||
19132 | overlineThickness: 'overline-thickness', | ||
19133 | paintOrder: 'paint-order', | ||
19134 | panose1: 'panose-1', | ||
19135 | pathLength: 'pathLength', | ||
19136 | patternContentUnits: 'patternContentUnits', | ||
19137 | patternTransform: 'patternTransform', | ||
19138 | patternUnits: 'patternUnits', | ||
19139 | pointerEvents: 'pointer-events', | ||
19140 | points: 0, | ||
19141 | pointsAtX: 'pointsAtX', | ||
19142 | pointsAtY: 'pointsAtY', | ||
19143 | pointsAtZ: 'pointsAtZ', | ||
19144 | preserveAlpha: 'preserveAlpha', | ||
19145 | preserveAspectRatio: 'preserveAspectRatio', | ||
19146 | primitiveUnits: 'primitiveUnits', | ||
19147 | r: 0, | ||
19148 | radius: 0, | ||
19149 | refX: 'refX', | ||
19150 | refY: 'refY', | ||
19151 | renderingIntent: 'rendering-intent', | ||
19152 | repeatCount: 'repeatCount', | ||
19153 | repeatDur: 'repeatDur', | ||
19154 | requiredExtensions: 'requiredExtensions', | ||
19155 | requiredFeatures: 'requiredFeatures', | ||
19156 | restart: 0, | ||
19157 | result: 0, | ||
19158 | rotate: 0, | ||
19159 | rx: 0, | ||
19160 | ry: 0, | ||
19161 | scale: 0, | ||
19162 | seed: 0, | ||
19163 | shapeRendering: 'shape-rendering', | ||
19164 | slope: 0, | ||
19165 | spacing: 0, | ||
19166 | specularConstant: 'specularConstant', | ||
19167 | specularExponent: 'specularExponent', | ||
19168 | speed: 0, | ||
19169 | spreadMethod: 'spreadMethod', | ||
19170 | startOffset: 'startOffset', | ||
19171 | stdDeviation: 'stdDeviation', | ||
19172 | stemh: 0, | ||
19173 | stemv: 0, | ||
19174 | stitchTiles: 'stitchTiles', | ||
19175 | stopColor: 'stop-color', | ||
19176 | stopOpacity: 'stop-opacity', | ||
19177 | strikethroughPosition: 'strikethrough-position', | ||
19178 | strikethroughThickness: 'strikethrough-thickness', | ||
19179 | string: 0, | ||
19180 | stroke: 0, | ||
19181 | strokeDasharray: 'stroke-dasharray', | ||
19182 | strokeDashoffset: 'stroke-dashoffset', | ||
19183 | strokeLinecap: 'stroke-linecap', | ||
19184 | strokeLinejoin: 'stroke-linejoin', | ||
19185 | strokeMiterlimit: 'stroke-miterlimit', | ||
19186 | strokeOpacity: 'stroke-opacity', | ||
19187 | strokeWidth: 'stroke-width', | ||
19188 | surfaceScale: 'surfaceScale', | ||
19189 | systemLanguage: 'systemLanguage', | ||
19190 | tableValues: 'tableValues', | ||
19191 | targetX: 'targetX', | ||
19192 | targetY: 'targetY', | ||
19193 | textAnchor: 'text-anchor', | ||
19194 | textDecoration: 'text-decoration', | ||
19195 | textRendering: 'text-rendering', | ||
19196 | textLength: 'textLength', | ||
19197 | to: 0, | ||
19198 | transform: 0, | ||
19199 | u1: 0, | ||
19200 | u2: 0, | ||
19201 | underlinePosition: 'underline-position', | ||
19202 | underlineThickness: 'underline-thickness', | ||
19203 | unicode: 0, | ||
19204 | unicodeBidi: 'unicode-bidi', | ||
19205 | unicodeRange: 'unicode-range', | ||
19206 | unitsPerEm: 'units-per-em', | ||
19207 | vAlphabetic: 'v-alphabetic', | ||
19208 | vHanging: 'v-hanging', | ||
19209 | vIdeographic: 'v-ideographic', | ||
19210 | vMathematical: 'v-mathematical', | ||
19211 | values: 0, | ||
19212 | vectorEffect: 'vector-effect', | ||
19213 | version: 0, | ||
19214 | vertAdvY: 'vert-adv-y', | ||
19215 | vertOriginX: 'vert-origin-x', | ||
19216 | vertOriginY: 'vert-origin-y', | ||
19217 | viewBox: 'viewBox', | ||
19218 | viewTarget: 'viewTarget', | ||
19219 | visibility: 0, | ||
19220 | widths: 0, | ||
19221 | wordSpacing: 'word-spacing', | ||
19222 | writingMode: 'writing-mode', | ||
19223 | x: 0, | ||
19224 | xHeight: 'x-height', | ||
19225 | x1: 0, | ||
19226 | x2: 0, | ||
19227 | xChannelSelector: 'xChannelSelector', | ||
19228 | xlinkActuate: 'xlink:actuate', | ||
19229 | xlinkArcrole: 'xlink:arcrole', | ||
19230 | xlinkHref: 'xlink:href', | ||
19231 | xlinkRole: 'xlink:role', | ||
19232 | xlinkShow: 'xlink:show', | ||
19233 | xlinkTitle: 'xlink:title', | ||
19234 | xlinkType: 'xlink:type', | ||
19235 | xmlBase: 'xml:base', | ||
19236 | xmlns: 0, | ||
19237 | xmlnsXlink: 'xmlns:xlink', | ||
19238 | xmlLang: 'xml:lang', | ||
19239 | xmlSpace: 'xml:space', | ||
19240 | y: 0, | ||
19241 | y1: 0, | ||
19242 | y2: 0, | ||
19243 | yChannelSelector: 'yChannelSelector', | ||
19244 | z: 0, | ||
19245 | zoomAndPan: 'zoomAndPan' | ||
19246 | }; | ||
19247 | |||
19248 | var SVGDOMPropertyConfig = { | ||
19249 | Properties: {}, | ||
19250 | DOMAttributeNamespaces: { | ||
19251 | xlinkActuate: NS.xlink, | ||
19252 | xlinkArcrole: NS.xlink, | ||
19253 | xlinkHref: NS.xlink, | ||
19254 | xlinkRole: NS.xlink, | ||
19255 | xlinkShow: NS.xlink, | ||
19256 | xlinkTitle: NS.xlink, | ||
19257 | xlinkType: NS.xlink, | ||
19258 | xmlBase: NS.xml, | ||
19259 | xmlLang: NS.xml, | ||
19260 | xmlSpace: NS.xml | ||
19261 | }, | ||
19262 | DOMAttributeNames: {} | ||
19263 | }; | ||
19264 | |||
19265 | Object.keys(ATTRS).forEach(function (key) { | ||
19266 | SVGDOMPropertyConfig.Properties[key] = 0; | ||
19267 | if (ATTRS[key]) { | ||
19268 | SVGDOMPropertyConfig.DOMAttributeNames[key] = ATTRS[key]; | ||
19269 | } | ||
19270 | }); | ||
19271 | |||
19272 | module.exports = SVGDOMPropertyConfig; | ||
19273 | |||
19274 | /***/ }, | ||
19275 | /* 157 */ | ||
16738 | /***/ function(module, exports, __webpack_require__) { | 19276 | /***/ function(module, exports, __webpack_require__) { |
16739 | 19277 | ||
16740 | /** | 19278 | /** |
16741 | * Copyright 2013-2015, Facebook, Inc. | 19279 | * Copyright 2013-present, Facebook, Inc. |
16742 | * All rights reserved. | 19280 | * All rights reserved. |
16743 | * | 19281 | * |
16744 | * This source code is licensed under the BSD-style license found in the | 19282 | * This source code is licensed under the BSD-style license found in the |
@@ -16750,16 +19288,17 @@ | |||
16750 | 19288 | ||
16751 | 'use strict'; | 19289 | 'use strict'; |
16752 | 19290 | ||
16753 | var EventConstants = __webpack_require__(32); | 19291 | var EventConstants = __webpack_require__(44); |
16754 | var EventPropagators = __webpack_require__(75); | 19292 | var EventPropagators = __webpack_require__(45); |
16755 | var ExecutionEnvironment = __webpack_require__(11); | 19293 | var ExecutionEnvironment = __webpack_require__(52); |
16756 | var ReactInputSelection = __webpack_require__(128); | 19294 | var ReactDOMComponentTree = __webpack_require__(39); |
16757 | var SyntheticEvent = __webpack_require__(79); | 19295 | var ReactInputSelection = __webpack_require__(149); |
19296 | var SyntheticEvent = __webpack_require__(56); | ||
16758 | 19297 | ||
16759 | var getActiveElement = __webpack_require__(131); | 19298 | var getActiveElement = __webpack_require__(155); |
16760 | var isTextInputElement = __webpack_require__(84); | 19299 | var isTextInputElement = __webpack_require__(75); |
16761 | var keyOf = __webpack_require__(81); | 19300 | var keyOf = __webpack_require__(27); |
16762 | var shallowEqual = __webpack_require__(119); | 19301 | var shallowEqual = __webpack_require__(131); |
16763 | 19302 | ||
16764 | var topLevelTypes = EventConstants.topLevelTypes; | 19303 | var topLevelTypes = EventConstants.topLevelTypes; |
16765 | 19304 | ||
@@ -16776,12 +19315,12 @@ | |||
16776 | }; | 19315 | }; |
16777 | 19316 | ||
16778 | var activeElement = null; | 19317 | var activeElement = null; |
16779 | var activeElementID = null; | 19318 | var activeElementInst = null; |
16780 | var lastSelection = null; | 19319 | var lastSelection = null; |
16781 | var mouseDown = false; | 19320 | var mouseDown = false; |
16782 | 19321 | ||
16783 | // Track whether a listener exists for this plugin. If none exist, we do | 19322 | // Track whether a listener exists for this plugin. If none exist, we do |
16784 | // not extract events. | 19323 | // not extract events. See #3639. |
16785 | var hasListener = false; | 19324 | var hasListener = false; |
16786 | var ON_SELECT_KEY = keyOf({ onSelect: null }); | 19325 | var ON_SELECT_KEY = keyOf({ onSelect: null }); |
16787 | 19326 | ||
@@ -16839,7 +19378,7 @@ | |||
16839 | if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) { | 19378 | if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) { |
16840 | lastSelection = currentSelection; | 19379 | lastSelection = currentSelection; |
16841 | 19380 | ||
16842 | var syntheticEvent = SyntheticEvent.getPooled(eventTypes.select, activeElementID, nativeEvent, nativeEventTarget); | 19381 | var syntheticEvent = SyntheticEvent.getPooled(eventTypes.select, activeElementInst, nativeEvent, nativeEventTarget); |
16843 | 19382 | ||
16844 | syntheticEvent.type = 'select'; | 19383 | syntheticEvent.type = 'select'; |
16845 | syntheticEvent.target = activeElement; | 19384 | syntheticEvent.target = activeElement; |
@@ -16870,31 +19409,25 @@ | |||
16870 | 19409 | ||
16871 | eventTypes: eventTypes, | 19410 | eventTypes: eventTypes, |
16872 | 19411 | ||
16873 | /** | 19412 | extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { |
16874 | * @param {string} topLevelType Record from `EventConstants`. | ||
16875 | * @param {DOMEventTarget} topLevelTarget The listening component root node. | ||
16876 | * @param {string} topLevelTargetID ID of `topLevelTarget`. | ||
16877 | * @param {object} nativeEvent Native browser event. | ||
16878 | * @return {*} An accumulation of synthetic events. | ||
16879 | * @see {EventPluginHub.extractEvents} | ||
16880 | */ | ||
16881 | extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) { | ||
16882 | if (!hasListener) { | 19413 | if (!hasListener) { |
16883 | return null; | 19414 | return null; |
16884 | } | 19415 | } |
16885 | 19416 | ||
19417 | var targetNode = targetInst ? ReactDOMComponentTree.getNodeFromInstance(targetInst) : window; | ||
19418 | |||
16886 | switch (topLevelType) { | 19419 | switch (topLevelType) { |
16887 | // Track the input node that has focus. | 19420 | // Track the input node that has focus. |
16888 | case topLevelTypes.topFocus: | 19421 | case topLevelTypes.topFocus: |
16889 | if (isTextInputElement(topLevelTarget) || topLevelTarget.contentEditable === 'true') { | 19422 | if (isTextInputElement(targetNode) || targetNode.contentEditable === 'true') { |
16890 | activeElement = topLevelTarget; | 19423 | activeElement = targetNode; |
16891 | activeElementID = topLevelTargetID; | 19424 | activeElementInst = targetInst; |
16892 | lastSelection = null; | 19425 | lastSelection = null; |
16893 | } | 19426 | } |
16894 | break; | 19427 | break; |
16895 | case topLevelTypes.topBlur: | 19428 | case topLevelTypes.topBlur: |
16896 | activeElement = null; | 19429 | activeElement = null; |
16897 | activeElementID = null; | 19430 | activeElementInst = null; |
16898 | lastSelection = null; | 19431 | lastSelection = null; |
16899 | break; | 19432 | break; |
16900 | 19433 | ||
@@ -16930,7 +19463,7 @@ | |||
16930 | return null; | 19463 | return null; |
16931 | }, | 19464 | }, |
16932 | 19465 | ||
16933 | didPutListener: function (id, registrationName, listener) { | 19466 | didPutListener: function (inst, registrationName, listener) { |
16934 | if (registrationName === ON_SELECT_KEY) { | 19467 | if (registrationName === ON_SELECT_KEY) { |
16935 | hasListener = true; | 19468 | hasListener = true; |
16936 | } | 19469 | } |
@@ -16940,45 +19473,11 @@ | |||
16940 | module.exports = SelectEventPlugin; | 19473 | module.exports = SelectEventPlugin; |
16941 | 19474 | ||
16942 | /***/ }, | 19475 | /***/ }, |
16943 | /* 133 */ | 19476 | /* 158 */ |
16944 | /***/ function(module, exports) { | ||
16945 | |||
16946 | /** | ||
16947 | * Copyright 2013-2015, Facebook, Inc. | ||
16948 | * All rights reserved. | ||
16949 | * | ||
16950 | * This source code is licensed under the BSD-style license found in the | ||
16951 | * LICENSE file in the root directory of this source tree. An additional grant | ||
16952 | * of patent rights can be found in the PATENTS file in the same directory. | ||
16953 | * | ||
16954 | * @providesModule ServerReactRootIndex | ||
16955 | * @typechecks | ||
16956 | */ | ||
16957 | |||
16958 | 'use strict'; | ||
16959 | |||
16960 | /** | ||
16961 | * Size of the reactRoot ID space. We generate random numbers for React root | ||
16962 | * IDs and if there's a collision the events and DOM update system will | ||
16963 | * get confused. In the future we need a way to generate GUIDs but for | ||
16964 | * now this will work on a smaller scale. | ||
16965 | */ | ||
16966 | var GLOBAL_MOUNT_POINT_MAX = Math.pow(2, 53); | ||
16967 | |||
16968 | var ServerReactRootIndex = { | ||
16969 | createReactRootIndex: function () { | ||
16970 | return Math.ceil(Math.random() * GLOBAL_MOUNT_POINT_MAX); | ||
16971 | } | ||
16972 | }; | ||
16973 | |||
16974 | module.exports = ServerReactRootIndex; | ||
16975 | |||
16976 | /***/ }, | ||
16977 | /* 134 */ | ||
16978 | /***/ function(module, exports, __webpack_require__) { | 19477 | /***/ function(module, exports, __webpack_require__) { |
16979 | 19478 | ||
16980 | /* WEBPACK VAR INJECTION */(function(process) {/** | 19479 | /* WEBPACK VAR INJECTION */(function(process) {/** |
16981 | * Copyright 2013-2015, Facebook, Inc. | 19480 | * Copyright 2013-present, Facebook, Inc. |
16982 | * All rights reserved. | 19481 | * All rights reserved. |
16983 | * | 19482 | * |
16984 | * This source code is licensed under the BSD-style license found in the | 19483 | * This source code is licensed under the BSD-style license found in the |
@@ -16990,24 +19489,28 @@ | |||
16990 | 19489 | ||
16991 | 'use strict'; | 19490 | 'use strict'; |
16992 | 19491 | ||
16993 | var EventConstants = __webpack_require__(32); | 19492 | var _prodInvariant = __webpack_require__(9); |
16994 | var EventListener = __webpack_require__(121); | 19493 | |
16995 | var EventPropagators = __webpack_require__(75); | 19494 | var EventConstants = __webpack_require__(44); |
16996 | var ReactMount = __webpack_require__(30); | 19495 | var EventListener = __webpack_require__(145); |
16997 | var SyntheticClipboardEvent = __webpack_require__(135); | 19496 | var EventPropagators = __webpack_require__(45); |
16998 | var SyntheticEvent = __webpack_require__(79); | 19497 | var ReactDOMComponentTree = __webpack_require__(39); |
16999 | var SyntheticFocusEvent = __webpack_require__(136); | 19498 | var SyntheticAnimationEvent = __webpack_require__(159); |
17000 | var SyntheticKeyboardEvent = __webpack_require__(137); | 19499 | var SyntheticClipboardEvent = __webpack_require__(160); |
17001 | var SyntheticMouseEvent = __webpack_require__(88); | 19500 | var SyntheticEvent = __webpack_require__(56); |
17002 | var SyntheticDragEvent = __webpack_require__(140); | 19501 | var SyntheticFocusEvent = __webpack_require__(161); |
17003 | var SyntheticTouchEvent = __webpack_require__(141); | 19502 | var SyntheticKeyboardEvent = __webpack_require__(162); |
17004 | var SyntheticUIEvent = __webpack_require__(89); | 19503 | var SyntheticMouseEvent = __webpack_require__(78); |
17005 | var SyntheticWheelEvent = __webpack_require__(142); | 19504 | var SyntheticDragEvent = __webpack_require__(165); |
17006 | 19505 | var SyntheticTouchEvent = __webpack_require__(166); | |
17007 | var emptyFunction = __webpack_require__(17); | 19506 | var SyntheticTransitionEvent = __webpack_require__(167); |
17008 | var getEventCharCode = __webpack_require__(138); | 19507 | var SyntheticUIEvent = __webpack_require__(79); |
17009 | var invariant = __webpack_require__(15); | 19508 | var SyntheticWheelEvent = __webpack_require__(168); |
17010 | var keyOf = __webpack_require__(81); | 19509 | |
19510 | var emptyFunction = __webpack_require__(14); | ||
19511 | var getEventCharCode = __webpack_require__(163); | ||
19512 | var invariant = __webpack_require__(10); | ||
19513 | var keyOf = __webpack_require__(27); | ||
17011 | 19514 | ||
17012 | var topLevelTypes = EventConstants.topLevelTypes; | 19515 | var topLevelTypes = EventConstants.topLevelTypes; |
17013 | 19516 | ||
@@ -17018,6 +19521,24 @@ | |||
17018 | captured: keyOf({ onAbortCapture: true }) | 19521 | captured: keyOf({ onAbortCapture: true }) |
17019 | } | 19522 | } |
17020 | }, | 19523 | }, |
19524 | animationEnd: { | ||
19525 | phasedRegistrationNames: { | ||
19526 | bubbled: keyOf({ onAnimationEnd: true }), | ||
19527 | captured: keyOf({ onAnimationEndCapture: true }) | ||
19528 | } | ||
19529 | }, | ||
19530 | animationIteration: { | ||
19531 | phasedRegistrationNames: { | ||
19532 | bubbled: keyOf({ onAnimationIteration: true }), | ||
19533 | captured: keyOf({ onAnimationIterationCapture: true }) | ||
19534 | } | ||
19535 | }, | ||
19536 | animationStart: { | ||
19537 | phasedRegistrationNames: { | ||
19538 | bubbled: keyOf({ onAnimationStart: true }), | ||
19539 | captured: keyOf({ onAnimationStartCapture: true }) | ||
19540 | } | ||
19541 | }, | ||
17021 | blur: { | 19542 | blur: { |
17022 | phasedRegistrationNames: { | 19543 | phasedRegistrationNames: { |
17023 | bubbled: keyOf({ onBlur: true }), | 19544 | bubbled: keyOf({ onBlur: true }), |
@@ -17156,6 +19677,12 @@ | |||
17156 | captured: keyOf({ onInputCapture: true }) | 19677 | captured: keyOf({ onInputCapture: true }) |
17157 | } | 19678 | } |
17158 | }, | 19679 | }, |
19680 | invalid: { | ||
19681 | phasedRegistrationNames: { | ||
19682 | bubbled: keyOf({ onInvalid: true }), | ||
19683 | captured: keyOf({ onInvalidCapture: true }) | ||
19684 | } | ||
19685 | }, | ||
17159 | keyDown: { | 19686 | keyDown: { |
17160 | phasedRegistrationNames: { | 19687 | phasedRegistrationNames: { |
17161 | bubbled: keyOf({ onKeyDown: true }), | 19688 | bubbled: keyOf({ onKeyDown: true }), |
@@ -17338,6 +19865,12 @@ | |||
17338 | captured: keyOf({ onTouchStartCapture: true }) | 19865 | captured: keyOf({ onTouchStartCapture: true }) |
17339 | } | 19866 | } |
17340 | }, | 19867 | }, |
19868 | transitionEnd: { | ||
19869 | phasedRegistrationNames: { | ||
19870 | bubbled: keyOf({ onTransitionEnd: true }), | ||
19871 | captured: keyOf({ onTransitionEndCapture: true }) | ||
19872 | } | ||
19873 | }, | ||
17341 | volumeChange: { | 19874 | volumeChange: { |
17342 | phasedRegistrationNames: { | 19875 | phasedRegistrationNames: { |
17343 | bubbled: keyOf({ onVolumeChange: true }), | 19876 | bubbled: keyOf({ onVolumeChange: true }), |
@@ -17360,6 +19893,9 @@ | |||
17360 | 19893 | ||
17361 | var topLevelEventsToDispatchConfig = { | 19894 | var topLevelEventsToDispatchConfig = { |
17362 | topAbort: eventTypes.abort, | 19895 | topAbort: eventTypes.abort, |
19896 | topAnimationEnd: eventTypes.animationEnd, | ||
19897 | topAnimationIteration: eventTypes.animationIteration, | ||
19898 | topAnimationStart: eventTypes.animationStart, | ||
17363 | topBlur: eventTypes.blur, | 19899 | topBlur: eventTypes.blur, |
17364 | topCanPlay: eventTypes.canPlay, | 19900 | topCanPlay: eventTypes.canPlay, |
17365 | topCanPlayThrough: eventTypes.canPlayThrough, | 19901 | topCanPlayThrough: eventTypes.canPlayThrough, |
@@ -17383,6 +19919,7 @@ | |||
17383 | topError: eventTypes.error, | 19919 | topError: eventTypes.error, |
17384 | topFocus: eventTypes.focus, | 19920 | topFocus: eventTypes.focus, |
17385 | topInput: eventTypes.input, | 19921 | topInput: eventTypes.input, |
19922 | topInvalid: eventTypes.invalid, | ||
17386 | topKeyDown: eventTypes.keyDown, | 19923 | topKeyDown: eventTypes.keyDown, |
17387 | topKeyPress: eventTypes.keyPress, | 19924 | topKeyPress: eventTypes.keyPress, |
17388 | topKeyUp: eventTypes.keyUp, | 19925 | topKeyUp: eventTypes.keyUp, |
@@ -17413,6 +19950,7 @@ | |||
17413 | topTouchEnd: eventTypes.touchEnd, | 19950 | topTouchEnd: eventTypes.touchEnd, |
17414 | topTouchMove: eventTypes.touchMove, | 19951 | topTouchMove: eventTypes.touchMove, |
17415 | topTouchStart: eventTypes.touchStart, | 19952 | topTouchStart: eventTypes.touchStart, |
19953 | topTransitionEnd: eventTypes.transitionEnd, | ||
17416 | topVolumeChange: eventTypes.volumeChange, | 19954 | topVolumeChange: eventTypes.volumeChange, |
17417 | topWaiting: eventTypes.waiting, | 19955 | topWaiting: eventTypes.waiting, |
17418 | topWheel: eventTypes.wheel | 19956 | topWheel: eventTypes.wheel |
@@ -17425,19 +19963,15 @@ | |||
17425 | var ON_CLICK_KEY = keyOf({ onClick: null }); | 19963 | var ON_CLICK_KEY = keyOf({ onClick: null }); |
17426 | var onClickListeners = {}; | 19964 | var onClickListeners = {}; |
17427 | 19965 | ||
19966 | function getDictionaryKey(inst) { | ||
19967 | return '.' + inst._rootNodeID; | ||
19968 | } | ||
19969 | |||
17428 | var SimpleEventPlugin = { | 19970 | var SimpleEventPlugin = { |
17429 | 19971 | ||
17430 | eventTypes: eventTypes, | 19972 | eventTypes: eventTypes, |
17431 | 19973 | ||
17432 | /** | 19974 | extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { |
17433 | * @param {string} topLevelType Record from `EventConstants`. | ||
17434 | * @param {DOMEventTarget} topLevelTarget The listening component root node. | ||
17435 | * @param {string} topLevelTargetID ID of `topLevelTarget`. | ||
17436 | * @param {object} nativeEvent Native browser event. | ||
17437 | * @return {*} An accumulation of synthetic events. | ||
17438 | * @see {EventPluginHub.extractEvents} | ||
17439 | */ | ||
17440 | extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) { | ||
17441 | var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType]; | 19975 | var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType]; |
17442 | if (!dispatchConfig) { | 19976 | if (!dispatchConfig) { |
17443 | return null; | 19977 | return null; |
@@ -17453,6 +19987,7 @@ | |||
17453 | case topLevelTypes.topEnded: | 19987 | case topLevelTypes.topEnded: |
17454 | case topLevelTypes.topError: | 19988 | case topLevelTypes.topError: |
17455 | case topLevelTypes.topInput: | 19989 | case topLevelTypes.topInput: |
19990 | case topLevelTypes.topInvalid: | ||
17456 | case topLevelTypes.topLoad: | 19991 | case topLevelTypes.topLoad: |
17457 | case topLevelTypes.topLoadedData: | 19992 | case topLevelTypes.topLoadedData: |
17458 | case topLevelTypes.topLoadedMetadata: | 19993 | case topLevelTypes.topLoadedMetadata: |
@@ -17476,7 +20011,7 @@ | |||
17476 | EventConstructor = SyntheticEvent; | 20011 | EventConstructor = SyntheticEvent; |
17477 | break; | 20012 | break; |
17478 | case topLevelTypes.topKeyPress: | 20013 | case topLevelTypes.topKeyPress: |
17479 | // FireFox creates a keypress event for function keys too. This removes | 20014 | // Firefox creates a keypress event for function keys too. This removes |
17480 | // the unwanted keypress events. Enter is however both printable and | 20015 | // the unwanted keypress events. Enter is however both printable and |
17481 | // non-printable. One would expect Tab to be as well (but it isn't). | 20016 | // non-printable. One would expect Tab to be as well (but it isn't). |
17482 | if (getEventCharCode(nativeEvent) === 0) { | 20017 | if (getEventCharCode(nativeEvent) === 0) { |
@@ -17523,6 +20058,14 @@ | |||
17523 | case topLevelTypes.topTouchStart: | 20058 | case topLevelTypes.topTouchStart: |
17524 | EventConstructor = SyntheticTouchEvent; | 20059 | EventConstructor = SyntheticTouchEvent; |
17525 | break; | 20060 | break; |
20061 | case topLevelTypes.topAnimationEnd: | ||
20062 | case topLevelTypes.topAnimationIteration: | ||
20063 | case topLevelTypes.topAnimationStart: | ||
20064 | EventConstructor = SyntheticAnimationEvent; | ||
20065 | break; | ||
20066 | case topLevelTypes.topTransitionEnd: | ||
20067 | EventConstructor = SyntheticTransitionEvent; | ||
20068 | break; | ||
17526 | case topLevelTypes.topScroll: | 20069 | case topLevelTypes.topScroll: |
17527 | EventConstructor = SyntheticUIEvent; | 20070 | EventConstructor = SyntheticUIEvent; |
17528 | break; | 20071 | break; |
@@ -17535,43 +20078,89 @@ | |||
17535 | EventConstructor = SyntheticClipboardEvent; | 20078 | EventConstructor = SyntheticClipboardEvent; |
17536 | break; | 20079 | break; |
17537 | } | 20080 | } |
17538 | !EventConstructor ? process.env.NODE_ENV !== 'production' ? invariant(false, 'SimpleEventPlugin: Unhandled event type, `%s`.', topLevelType) : invariant(false) : undefined; | 20081 | !EventConstructor ? process.env.NODE_ENV !== 'production' ? invariant(false, 'SimpleEventPlugin: Unhandled event type, `%s`.', topLevelType) : _prodInvariant('86', topLevelType) : void 0; |
17539 | var event = EventConstructor.getPooled(dispatchConfig, topLevelTargetID, nativeEvent, nativeEventTarget); | 20082 | var event = EventConstructor.getPooled(dispatchConfig, targetInst, nativeEvent, nativeEventTarget); |
17540 | EventPropagators.accumulateTwoPhaseDispatches(event); | 20083 | EventPropagators.accumulateTwoPhaseDispatches(event); |
17541 | return event; | 20084 | return event; |
17542 | }, | 20085 | }, |
17543 | 20086 | ||
17544 | didPutListener: function (id, registrationName, listener) { | 20087 | didPutListener: function (inst, registrationName, listener) { |
17545 | // Mobile Safari does not fire properly bubble click events on | 20088 | // Mobile Safari does not fire properly bubble click events on |
17546 | // non-interactive elements, which means delegated click listeners do not | 20089 | // non-interactive elements, which means delegated click listeners do not |
17547 | // fire. The workaround for this bug involves attaching an empty click | 20090 | // fire. The workaround for this bug involves attaching an empty click |
17548 | // listener on the target node. | 20091 | // listener on the target node. |
17549 | if (registrationName === ON_CLICK_KEY) { | 20092 | if (registrationName === ON_CLICK_KEY) { |
17550 | var node = ReactMount.getNode(id); | 20093 | var key = getDictionaryKey(inst); |
17551 | if (!onClickListeners[id]) { | 20094 | var node = ReactDOMComponentTree.getNodeFromInstance(inst); |
17552 | onClickListeners[id] = EventListener.listen(node, 'click', emptyFunction); | 20095 | if (!onClickListeners[key]) { |
20096 | onClickListeners[key] = EventListener.listen(node, 'click', emptyFunction); | ||
17553 | } | 20097 | } |
17554 | } | 20098 | } |
17555 | }, | 20099 | }, |
17556 | 20100 | ||
17557 | willDeleteListener: function (id, registrationName) { | 20101 | willDeleteListener: function (inst, registrationName) { |
17558 | if (registrationName === ON_CLICK_KEY) { | 20102 | if (registrationName === ON_CLICK_KEY) { |
17559 | onClickListeners[id].remove(); | 20103 | var key = getDictionaryKey(inst); |
17560 | delete onClickListeners[id]; | 20104 | onClickListeners[key].remove(); |
20105 | delete onClickListeners[key]; | ||
17561 | } | 20106 | } |
17562 | } | 20107 | } |
17563 | 20108 | ||
17564 | }; | 20109 | }; |
17565 | 20110 | ||
17566 | module.exports = SimpleEventPlugin; | 20111 | module.exports = SimpleEventPlugin; |
17567 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | 20112 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) |
17568 | 20113 | ||
17569 | /***/ }, | 20114 | /***/ }, |
17570 | /* 135 */ | 20115 | /* 159 */ |
17571 | /***/ function(module, exports, __webpack_require__) { | 20116 | /***/ function(module, exports, __webpack_require__) { |
17572 | 20117 | ||
17573 | /** | 20118 | /** |
17574 | * Copyright 2013-2015, Facebook, Inc. | 20119 | * Copyright 2013-present, Facebook, Inc. |
20120 | * All rights reserved. | ||
20121 | * | ||
20122 | * This source code is licensed under the BSD-style license found in the | ||
20123 | * LICENSE file in the root directory of this source tree. An additional grant | ||
20124 | * of patent rights can be found in the PATENTS file in the same directory. | ||
20125 | * | ||
20126 | * @providesModule SyntheticAnimationEvent | ||
20127 | */ | ||
20128 | |||
20129 | 'use strict'; | ||
20130 | |||
20131 | var SyntheticEvent = __webpack_require__(56); | ||
20132 | |||
20133 | /** | ||
20134 | * @interface Event | ||
20135 | * @see http://www.w3.org/TR/css3-animations/#AnimationEvent-interface | ||
20136 | * @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent | ||
20137 | */ | ||
20138 | var AnimationEventInterface = { | ||
20139 | animationName: null, | ||
20140 | elapsedTime: null, | ||
20141 | pseudoElement: null | ||
20142 | }; | ||
20143 | |||
20144 | /** | ||
20145 | * @param {object} dispatchConfig Configuration used to dispatch this event. | ||
20146 | * @param {string} dispatchMarker Marker identifying the event target. | ||
20147 | * @param {object} nativeEvent Native browser event. | ||
20148 | * @extends {SyntheticEvent} | ||
20149 | */ | ||
20150 | function SyntheticAnimationEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | ||
20151 | return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | ||
20152 | } | ||
20153 | |||
20154 | SyntheticEvent.augmentClass(SyntheticAnimationEvent, AnimationEventInterface); | ||
20155 | |||
20156 | module.exports = SyntheticAnimationEvent; | ||
20157 | |||
20158 | /***/ }, | ||
20159 | /* 160 */ | ||
20160 | /***/ function(module, exports, __webpack_require__) { | ||
20161 | |||
20162 | /** | ||
20163 | * Copyright 2013-present, Facebook, Inc. | ||
17575 | * All rights reserved. | 20164 | * All rights reserved. |
17576 | * | 20165 | * |
17577 | * This source code is licensed under the BSD-style license found in the | 20166 | * This source code is licensed under the BSD-style license found in the |
@@ -17579,12 +20168,11 @@ | |||
17579 | * of patent rights can be found in the PATENTS file in the same directory. | 20168 | * of patent rights can be found in the PATENTS file in the same directory. |
17580 | * | 20169 | * |
17581 | * @providesModule SyntheticClipboardEvent | 20170 | * @providesModule SyntheticClipboardEvent |
17582 | * @typechecks static-only | ||
17583 | */ | 20171 | */ |
17584 | 20172 | ||
17585 | 'use strict'; | 20173 | 'use strict'; |
17586 | 20174 | ||
17587 | var SyntheticEvent = __webpack_require__(79); | 20175 | var SyntheticEvent = __webpack_require__(56); |
17588 | 20176 | ||
17589 | /** | 20177 | /** |
17590 | * @interface Event | 20178 | * @interface Event |
@@ -17603,7 +20191,7 @@ | |||
17603 | * @extends {SyntheticUIEvent} | 20191 | * @extends {SyntheticUIEvent} |
17604 | */ | 20192 | */ |
17605 | function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | 20193 | function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { |
17606 | SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | 20194 | return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); |
17607 | } | 20195 | } |
17608 | 20196 | ||
17609 | SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface); | 20197 | SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface); |
@@ -17611,11 +20199,11 @@ | |||
17611 | module.exports = SyntheticClipboardEvent; | 20199 | module.exports = SyntheticClipboardEvent; |
17612 | 20200 | ||
17613 | /***/ }, | 20201 | /***/ }, |
17614 | /* 136 */ | 20202 | /* 161 */ |
17615 | /***/ function(module, exports, __webpack_require__) { | 20203 | /***/ function(module, exports, __webpack_require__) { |
17616 | 20204 | ||
17617 | /** | 20205 | /** |
17618 | * Copyright 2013-2015, Facebook, Inc. | 20206 | * Copyright 2013-present, Facebook, Inc. |
17619 | * All rights reserved. | 20207 | * All rights reserved. |
17620 | * | 20208 | * |
17621 | * This source code is licensed under the BSD-style license found in the | 20209 | * This source code is licensed under the BSD-style license found in the |
@@ -17623,12 +20211,11 @@ | |||
17623 | * of patent rights can be found in the PATENTS file in the same directory. | 20211 | * of patent rights can be found in the PATENTS file in the same directory. |
17624 | * | 20212 | * |
17625 | * @providesModule SyntheticFocusEvent | 20213 | * @providesModule SyntheticFocusEvent |
17626 | * @typechecks static-only | ||
17627 | */ | 20214 | */ |
17628 | 20215 | ||
17629 | 'use strict'; | 20216 | 'use strict'; |
17630 | 20217 | ||
17631 | var SyntheticUIEvent = __webpack_require__(89); | 20218 | var SyntheticUIEvent = __webpack_require__(79); |
17632 | 20219 | ||
17633 | /** | 20220 | /** |
17634 | * @interface FocusEvent | 20221 | * @interface FocusEvent |
@@ -17645,7 +20232,7 @@ | |||
17645 | * @extends {SyntheticUIEvent} | 20232 | * @extends {SyntheticUIEvent} |
17646 | */ | 20233 | */ |
17647 | function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | 20234 | function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { |
17648 | SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | 20235 | return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); |
17649 | } | 20236 | } |
17650 | 20237 | ||
17651 | SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface); | 20238 | SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface); |
@@ -17653,11 +20240,11 @@ | |||
17653 | module.exports = SyntheticFocusEvent; | 20240 | module.exports = SyntheticFocusEvent; |
17654 | 20241 | ||
17655 | /***/ }, | 20242 | /***/ }, |
17656 | /* 137 */ | 20243 | /* 162 */ |
17657 | /***/ function(module, exports, __webpack_require__) { | 20244 | /***/ function(module, exports, __webpack_require__) { |
17658 | 20245 | ||
17659 | /** | 20246 | /** |
17660 | * Copyright 2013-2015, Facebook, Inc. | 20247 | * Copyright 2013-present, Facebook, Inc. |
17661 | * All rights reserved. | 20248 | * All rights reserved. |
17662 | * | 20249 | * |
17663 | * This source code is licensed under the BSD-style license found in the | 20250 | * This source code is licensed under the BSD-style license found in the |
@@ -17665,16 +20252,15 @@ | |||
17665 | * of patent rights can be found in the PATENTS file in the same directory. | 20252 | * of patent rights can be found in the PATENTS file in the same directory. |
17666 | * | 20253 | * |
17667 | * @providesModule SyntheticKeyboardEvent | 20254 | * @providesModule SyntheticKeyboardEvent |
17668 | * @typechecks static-only | ||
17669 | */ | 20255 | */ |
17670 | 20256 | ||
17671 | 'use strict'; | 20257 | 'use strict'; |
17672 | 20258 | ||
17673 | var SyntheticUIEvent = __webpack_require__(89); | 20259 | var SyntheticUIEvent = __webpack_require__(79); |
17674 | 20260 | ||
17675 | var getEventCharCode = __webpack_require__(138); | 20261 | var getEventCharCode = __webpack_require__(163); |
17676 | var getEventKey = __webpack_require__(139); | 20262 | var getEventKey = __webpack_require__(164); |
17677 | var getEventModifierState = __webpack_require__(90); | 20263 | var getEventModifierState = __webpack_require__(81); |
17678 | 20264 | ||
17679 | /** | 20265 | /** |
17680 | * @interface KeyboardEvent | 20266 | * @interface KeyboardEvent |
@@ -17735,7 +20321,7 @@ | |||
17735 | * @extends {SyntheticUIEvent} | 20321 | * @extends {SyntheticUIEvent} |
17736 | */ | 20322 | */ |
17737 | function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | 20323 | function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { |
17738 | SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | 20324 | return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); |
17739 | } | 20325 | } |
17740 | 20326 | ||
17741 | SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface); | 20327 | SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface); |
@@ -17743,11 +20329,11 @@ | |||
17743 | module.exports = SyntheticKeyboardEvent; | 20329 | module.exports = SyntheticKeyboardEvent; |
17744 | 20330 | ||
17745 | /***/ }, | 20331 | /***/ }, |
17746 | /* 138 */ | 20332 | /* 163 */ |
17747 | /***/ function(module, exports) { | 20333 | /***/ function(module, exports) { |
17748 | 20334 | ||
17749 | /** | 20335 | /** |
17750 | * Copyright 2013-2015, Facebook, Inc. | 20336 | * Copyright 2013-present, Facebook, Inc. |
17751 | * All rights reserved. | 20337 | * All rights reserved. |
17752 | * | 20338 | * |
17753 | * This source code is licensed under the BSD-style license found in the | 20339 | * This source code is licensed under the BSD-style license found in the |
@@ -17755,7 +20341,6 @@ | |||
17755 | * of patent rights can be found in the PATENTS file in the same directory. | 20341 | * of patent rights can be found in the PATENTS file in the same directory. |
17756 | * | 20342 | * |
17757 | * @providesModule getEventCharCode | 20343 | * @providesModule getEventCharCode |
17758 | * @typechecks static-only | ||
17759 | */ | 20344 | */ |
17760 | 20345 | ||
17761 | 'use strict'; | 20346 | 'use strict'; |
@@ -17770,6 +20355,7 @@ | |||
17770 | * @param {object} nativeEvent Native browser event. | 20355 | * @param {object} nativeEvent Native browser event. |
17771 | * @return {number} Normalized `charCode` property. | 20356 | * @return {number} Normalized `charCode` property. |
17772 | */ | 20357 | */ |
20358 | |||
17773 | function getEventCharCode(nativeEvent) { | 20359 | function getEventCharCode(nativeEvent) { |
17774 | var charCode; | 20360 | var charCode; |
17775 | var keyCode = nativeEvent.keyCode; | 20361 | var keyCode = nativeEvent.keyCode; |
@@ -17798,11 +20384,11 @@ | |||
17798 | module.exports = getEventCharCode; | 20384 | module.exports = getEventCharCode; |
17799 | 20385 | ||
17800 | /***/ }, | 20386 | /***/ }, |
17801 | /* 139 */ | 20387 | /* 164 */ |
17802 | /***/ function(module, exports, __webpack_require__) { | 20388 | /***/ function(module, exports, __webpack_require__) { |
17803 | 20389 | ||
17804 | /** | 20390 | /** |
17805 | * Copyright 2013-2015, Facebook, Inc. | 20391 | * Copyright 2013-present, Facebook, Inc. |
17806 | * All rights reserved. | 20392 | * All rights reserved. |
17807 | * | 20393 | * |
17808 | * This source code is licensed under the BSD-style license found in the | 20394 | * This source code is licensed under the BSD-style license found in the |
@@ -17810,12 +20396,11 @@ | |||
17810 | * of patent rights can be found in the PATENTS file in the same directory. | 20396 | * of patent rights can be found in the PATENTS file in the same directory. |
17811 | * | 20397 | * |
17812 | * @providesModule getEventKey | 20398 | * @providesModule getEventKey |
17813 | * @typechecks static-only | ||
17814 | */ | 20399 | */ |
17815 | 20400 | ||
17816 | 'use strict'; | 20401 | 'use strict'; |
17817 | 20402 | ||
17818 | var getEventCharCode = __webpack_require__(138); | 20403 | var getEventCharCode = __webpack_require__(163); |
17819 | 20404 | ||
17820 | /** | 20405 | /** |
17821 | * Normalization of deprecated HTML5 `key` values | 20406 | * Normalization of deprecated HTML5 `key` values |
@@ -17906,11 +20491,11 @@ | |||
17906 | module.exports = getEventKey; | 20491 | module.exports = getEventKey; |
17907 | 20492 | ||
17908 | /***/ }, | 20493 | /***/ }, |
17909 | /* 140 */ | 20494 | /* 165 */ |
17910 | /***/ function(module, exports, __webpack_require__) { | 20495 | /***/ function(module, exports, __webpack_require__) { |
17911 | 20496 | ||
17912 | /** | 20497 | /** |
17913 | * Copyright 2013-2015, Facebook, Inc. | 20498 | * Copyright 2013-present, Facebook, Inc. |
17914 | * All rights reserved. | 20499 | * All rights reserved. |
17915 | * | 20500 | * |
17916 | * This source code is licensed under the BSD-style license found in the | 20501 | * This source code is licensed under the BSD-style license found in the |
@@ -17918,12 +20503,11 @@ | |||
17918 | * of patent rights can be found in the PATENTS file in the same directory. | 20503 | * of patent rights can be found in the PATENTS file in the same directory. |
17919 | * | 20504 | * |
17920 | * @providesModule SyntheticDragEvent | 20505 | * @providesModule SyntheticDragEvent |
17921 | * @typechecks static-only | ||
17922 | */ | 20506 | */ |
17923 | 20507 | ||
17924 | 'use strict'; | 20508 | 'use strict'; |
17925 | 20509 | ||
17926 | var SyntheticMouseEvent = __webpack_require__(88); | 20510 | var SyntheticMouseEvent = __webpack_require__(78); |
17927 | 20511 | ||
17928 | /** | 20512 | /** |
17929 | * @interface DragEvent | 20513 | * @interface DragEvent |
@@ -17940,7 +20524,7 @@ | |||
17940 | * @extends {SyntheticUIEvent} | 20524 | * @extends {SyntheticUIEvent} |
17941 | */ | 20525 | */ |
17942 | function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | 20526 | function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { |
17943 | SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | 20527 | return SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); |
17944 | } | 20528 | } |
17945 | 20529 | ||
17946 | SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface); | 20530 | SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface); |
@@ -17948,11 +20532,11 @@ | |||
17948 | module.exports = SyntheticDragEvent; | 20532 | module.exports = SyntheticDragEvent; |
17949 | 20533 | ||
17950 | /***/ }, | 20534 | /***/ }, |
17951 | /* 141 */ | 20535 | /* 166 */ |
17952 | /***/ function(module, exports, __webpack_require__) { | 20536 | /***/ function(module, exports, __webpack_require__) { |
17953 | 20537 | ||
17954 | /** | 20538 | /** |
17955 | * Copyright 2013-2015, Facebook, Inc. | 20539 | * Copyright 2013-present, Facebook, Inc. |
17956 | * All rights reserved. | 20540 | * All rights reserved. |
17957 | * | 20541 | * |
17958 | * This source code is licensed under the BSD-style license found in the | 20542 | * This source code is licensed under the BSD-style license found in the |
@@ -17960,14 +20544,13 @@ | |||
17960 | * of patent rights can be found in the PATENTS file in the same directory. | 20544 | * of patent rights can be found in the PATENTS file in the same directory. |
17961 | * | 20545 | * |
17962 | * @providesModule SyntheticTouchEvent | 20546 | * @providesModule SyntheticTouchEvent |
17963 | * @typechecks static-only | ||
17964 | */ | 20547 | */ |
17965 | 20548 | ||
17966 | 'use strict'; | 20549 | 'use strict'; |
17967 | 20550 | ||
17968 | var SyntheticUIEvent = __webpack_require__(89); | 20551 | var SyntheticUIEvent = __webpack_require__(79); |
17969 | 20552 | ||
17970 | var getEventModifierState = __webpack_require__(90); | 20553 | var getEventModifierState = __webpack_require__(81); |
17971 | 20554 | ||
17972 | /** | 20555 | /** |
17973 | * @interface TouchEvent | 20556 | * @interface TouchEvent |
@@ -17991,7 +20574,7 @@ | |||
17991 | * @extends {SyntheticUIEvent} | 20574 | * @extends {SyntheticUIEvent} |
17992 | */ | 20575 | */ |
17993 | function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | 20576 | function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { |
17994 | SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | 20577 | return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); |
17995 | } | 20578 | } |
17996 | 20579 | ||
17997 | SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface); | 20580 | SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface); |
@@ -17999,11 +20582,55 @@ | |||
17999 | module.exports = SyntheticTouchEvent; | 20582 | module.exports = SyntheticTouchEvent; |
18000 | 20583 | ||
18001 | /***/ }, | 20584 | /***/ }, |
18002 | /* 142 */ | 20585 | /* 167 */ |
18003 | /***/ function(module, exports, __webpack_require__) { | 20586 | /***/ function(module, exports, __webpack_require__) { |
18004 | 20587 | ||
18005 | /** | 20588 | /** |
18006 | * Copyright 2013-2015, Facebook, Inc. | 20589 | * Copyright 2013-present, Facebook, Inc. |
20590 | * All rights reserved. | ||
20591 | * | ||
20592 | * This source code is licensed under the BSD-style license found in the | ||
20593 | * LICENSE file in the root directory of this source tree. An additional grant | ||
20594 | * of patent rights can be found in the PATENTS file in the same directory. | ||
20595 | * | ||
20596 | * @providesModule SyntheticTransitionEvent | ||
20597 | */ | ||
20598 | |||
20599 | 'use strict'; | ||
20600 | |||
20601 | var SyntheticEvent = __webpack_require__(56); | ||
20602 | |||
20603 | /** | ||
20604 | * @interface Event | ||
20605 | * @see http://www.w3.org/TR/2009/WD-css3-transitions-20090320/#transition-events- | ||
20606 | * @see https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent | ||
20607 | */ | ||
20608 | var TransitionEventInterface = { | ||
20609 | propertyName: null, | ||
20610 | elapsedTime: null, | ||
20611 | pseudoElement: null | ||
20612 | }; | ||
20613 | |||
20614 | /** | ||
20615 | * @param {object} dispatchConfig Configuration used to dispatch this event. | ||
20616 | * @param {string} dispatchMarker Marker identifying the event target. | ||
20617 | * @param {object} nativeEvent Native browser event. | ||
20618 | * @extends {SyntheticEvent} | ||
20619 | */ | ||
20620 | function SyntheticTransitionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | ||
20621 | return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | ||
20622 | } | ||
20623 | |||
20624 | SyntheticEvent.augmentClass(SyntheticTransitionEvent, TransitionEventInterface); | ||
20625 | |||
20626 | module.exports = SyntheticTransitionEvent; | ||
20627 | |||
20628 | /***/ }, | ||
20629 | /* 168 */ | ||
20630 | /***/ function(module, exports, __webpack_require__) { | ||
20631 | |||
20632 | /** | ||
20633 | * Copyright 2013-present, Facebook, Inc. | ||
18007 | * All rights reserved. | 20634 | * All rights reserved. |
18008 | * | 20635 | * |
18009 | * This source code is licensed under the BSD-style license found in the | 20636 | * This source code is licensed under the BSD-style license found in the |
@@ -18011,12 +20638,11 @@ | |||
18011 | * of patent rights can be found in the PATENTS file in the same directory. | 20638 | * of patent rights can be found in the PATENTS file in the same directory. |
18012 | * | 20639 | * |
18013 | * @providesModule SyntheticWheelEvent | 20640 | * @providesModule SyntheticWheelEvent |
18014 | * @typechecks static-only | ||
18015 | */ | 20641 | */ |
18016 | 20642 | ||
18017 | 'use strict'; | 20643 | 'use strict'; |
18018 | 20644 | ||
18019 | var SyntheticMouseEvent = __webpack_require__(88); | 20645 | var SyntheticMouseEvent = __webpack_require__(78); |
18020 | 20646 | ||
18021 | /** | 20647 | /** |
18022 | * @interface WheelEvent | 20648 | * @interface WheelEvent |
@@ -18051,7 +20677,7 @@ | |||
18051 | * @extends {SyntheticMouseEvent} | 20677 | * @extends {SyntheticMouseEvent} |
18052 | */ | 20678 | */ |
18053 | function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | 20679 | function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { |
18054 | SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | 20680 | return SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); |
18055 | } | 20681 | } |
18056 | 20682 | ||
18057 | SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface); | 20683 | SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface); |
@@ -18059,4235 +20685,5067 @@ | |||
18059 | module.exports = SyntheticWheelEvent; | 20685 | module.exports = SyntheticWheelEvent; |
18060 | 20686 | ||
18061 | /***/ }, | 20687 | /***/ }, |
18062 | /* 143 */ | 20688 | /* 169 */ |
18063 | /***/ function(module, exports, __webpack_require__) { | 20689 | /***/ function(module, exports, __webpack_require__) { |
18064 | 20690 | ||
18065 | /** | 20691 | /* WEBPACK VAR INJECTION */(function(process) {/** |
18066 | * Copyright 2013-2015, Facebook, Inc. | 20692 | * Copyright 2013-present, Facebook, Inc. |
18067 | * All rights reserved. | 20693 | * All rights reserved. |
18068 | * | 20694 | * |
18069 | * This source code is licensed under the BSD-style license found in the | 20695 | * This source code is licensed under the BSD-style license found in the |
18070 | * LICENSE file in the root directory of this source tree. An additional grant | 20696 | * LICENSE file in the root directory of this source tree. An additional grant |
18071 | * of patent rights can be found in the PATENTS file in the same directory. | 20697 | * of patent rights can be found in the PATENTS file in the same directory. |
18072 | * | 20698 | * |
18073 | * @providesModule SVGDOMPropertyConfig | 20699 | * @providesModule ReactMount |
18074 | */ | 20700 | */ |
18075 | 20701 | ||
18076 | 'use strict'; | 20702 | 'use strict'; |
18077 | 20703 | ||
18078 | var DOMProperty = __webpack_require__(25); | 20704 | var _prodInvariant = __webpack_require__(9); |
20705 | |||
20706 | var DOMLazyTree = __webpack_require__(85); | ||
20707 | var DOMProperty = __webpack_require__(40); | ||
20708 | var ReactBrowserEventEmitter = __webpack_require__(114); | ||
20709 | var ReactCurrentOwner = __webpack_require__(12); | ||
20710 | var ReactDOMComponentTree = __webpack_require__(39); | ||
20711 | var ReactDOMContainerInfo = __webpack_require__(170); | ||
20712 | var ReactDOMFeatureFlags = __webpack_require__(171); | ||
20713 | var ReactElement = __webpack_require__(11); | ||
20714 | var ReactFeatureFlags = __webpack_require__(61); | ||
20715 | var ReactInstanceMap = __webpack_require__(126); | ||
20716 | var ReactInstrumentation = __webpack_require__(65); | ||
20717 | var ReactMarkupChecksum = __webpack_require__(172); | ||
20718 | var ReactReconciler = __webpack_require__(62); | ||
20719 | var ReactUpdateQueue = __webpack_require__(138); | ||
20720 | var ReactUpdates = __webpack_require__(59); | ||
20721 | |||
20722 | var emptyObject = __webpack_require__(21); | ||
20723 | var instantiateReactComponent = __webpack_require__(128); | ||
20724 | var invariant = __webpack_require__(10); | ||
20725 | var setInnerHTML = __webpack_require__(87); | ||
20726 | var shouldUpdateReactComponent = __webpack_require__(132); | ||
20727 | var warning = __webpack_require__(13); | ||
18079 | 20728 | ||
18080 | var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE; | 20729 | var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME; |
20730 | var ROOT_ATTR_NAME = DOMProperty.ROOT_ATTRIBUTE_NAME; | ||
18081 | 20731 | ||
18082 | var NS = { | 20732 | var ELEMENT_NODE_TYPE = 1; |
18083 | xlink: 'http://www.w3.org/1999/xlink', | 20733 | var DOC_NODE_TYPE = 9; |
18084 | xml: 'http://www.w3.org/XML/1998/namespace' | 20734 | var DOCUMENT_FRAGMENT_NODE_TYPE = 11; |
18085 | }; | ||
18086 | 20735 | ||
18087 | var SVGDOMPropertyConfig = { | 20736 | var instancesByReactRootID = {}; |
18088 | Properties: { | ||
18089 | clipPath: MUST_USE_ATTRIBUTE, | ||
18090 | cx: MUST_USE_ATTRIBUTE, | ||
18091 | cy: MUST_USE_ATTRIBUTE, | ||
18092 | d: MUST_USE_ATTRIBUTE, | ||
18093 | dx: MUST_USE_ATTRIBUTE, | ||
18094 | dy: MUST_USE_ATTRIBUTE, | ||
18095 | fill: MUST_USE_ATTRIBUTE, | ||
18096 | fillOpacity: MUST_USE_ATTRIBUTE, | ||
18097 | fontFamily: MUST_USE_ATTRIBUTE, | ||
18098 | fontSize: MUST_USE_ATTRIBUTE, | ||
18099 | fx: MUST_USE_ATTRIBUTE, | ||
18100 | fy: MUST_USE_ATTRIBUTE, | ||
18101 | gradientTransform: MUST_USE_ATTRIBUTE, | ||
18102 | gradientUnits: MUST_USE_ATTRIBUTE, | ||
18103 | markerEnd: MUST_USE_ATTRIBUTE, | ||
18104 | markerMid: MUST_USE_ATTRIBUTE, | ||
18105 | markerStart: MUST_USE_ATTRIBUTE, | ||
18106 | offset: MUST_USE_ATTRIBUTE, | ||
18107 | opacity: MUST_USE_ATTRIBUTE, | ||
18108 | patternContentUnits: MUST_USE_ATTRIBUTE, | ||
18109 | patternUnits: MUST_USE_ATTRIBUTE, | ||
18110 | points: MUST_USE_ATTRIBUTE, | ||
18111 | preserveAspectRatio: MUST_USE_ATTRIBUTE, | ||
18112 | r: MUST_USE_ATTRIBUTE, | ||
18113 | rx: MUST_USE_ATTRIBUTE, | ||
18114 | ry: MUST_USE_ATTRIBUTE, | ||
18115 | spreadMethod: MUST_USE_ATTRIBUTE, | ||
18116 | stopColor: MUST_USE_ATTRIBUTE, | ||
18117 | stopOpacity: MUST_USE_ATTRIBUTE, | ||
18118 | stroke: MUST_USE_ATTRIBUTE, | ||
18119 | strokeDasharray: MUST_USE_ATTRIBUTE, | ||
18120 | strokeLinecap: MUST_USE_ATTRIBUTE, | ||
18121 | strokeOpacity: MUST_USE_ATTRIBUTE, | ||
18122 | strokeWidth: MUST_USE_ATTRIBUTE, | ||
18123 | textAnchor: MUST_USE_ATTRIBUTE, | ||
18124 | transform: MUST_USE_ATTRIBUTE, | ||
18125 | version: MUST_USE_ATTRIBUTE, | ||
18126 | viewBox: MUST_USE_ATTRIBUTE, | ||
18127 | x1: MUST_USE_ATTRIBUTE, | ||
18128 | x2: MUST_USE_ATTRIBUTE, | ||
18129 | x: MUST_USE_ATTRIBUTE, | ||
18130 | xlinkActuate: MUST_USE_ATTRIBUTE, | ||
18131 | xlinkArcrole: MUST_USE_ATTRIBUTE, | ||
18132 | xlinkHref: MUST_USE_ATTRIBUTE, | ||
18133 | xlinkRole: MUST_USE_ATTRIBUTE, | ||
18134 | xlinkShow: MUST_USE_ATTRIBUTE, | ||
18135 | xlinkTitle: MUST_USE_ATTRIBUTE, | ||
18136 | xlinkType: MUST_USE_ATTRIBUTE, | ||
18137 | xmlBase: MUST_USE_ATTRIBUTE, | ||
18138 | xmlLang: MUST_USE_ATTRIBUTE, | ||
18139 | xmlSpace: MUST_USE_ATTRIBUTE, | ||
18140 | y1: MUST_USE_ATTRIBUTE, | ||
18141 | y2: MUST_USE_ATTRIBUTE, | ||
18142 | y: MUST_USE_ATTRIBUTE | ||
18143 | }, | ||
18144 | DOMAttributeNamespaces: { | ||
18145 | xlinkActuate: NS.xlink, | ||
18146 | xlinkArcrole: NS.xlink, | ||
18147 | xlinkHref: NS.xlink, | ||
18148 | xlinkRole: NS.xlink, | ||
18149 | xlinkShow: NS.xlink, | ||
18150 | xlinkTitle: NS.xlink, | ||
18151 | xlinkType: NS.xlink, | ||
18152 | xmlBase: NS.xml, | ||
18153 | xmlLang: NS.xml, | ||
18154 | xmlSpace: NS.xml | ||
18155 | }, | ||
18156 | DOMAttributeNames: { | ||
18157 | clipPath: 'clip-path', | ||
18158 | fillOpacity: 'fill-opacity', | ||
18159 | fontFamily: 'font-family', | ||
18160 | fontSize: 'font-size', | ||
18161 | gradientTransform: 'gradientTransform', | ||
18162 | gradientUnits: 'gradientUnits', | ||
18163 | markerEnd: 'marker-end', | ||
18164 | markerMid: 'marker-mid', | ||
18165 | markerStart: 'marker-start', | ||
18166 | patternContentUnits: 'patternContentUnits', | ||
18167 | patternUnits: 'patternUnits', | ||
18168 | preserveAspectRatio: 'preserveAspectRatio', | ||
18169 | spreadMethod: 'spreadMethod', | ||
18170 | stopColor: 'stop-color', | ||
18171 | stopOpacity: 'stop-opacity', | ||
18172 | strokeDasharray: 'stroke-dasharray', | ||
18173 | strokeLinecap: 'stroke-linecap', | ||
18174 | strokeOpacity: 'stroke-opacity', | ||
18175 | strokeWidth: 'stroke-width', | ||
18176 | textAnchor: 'text-anchor', | ||
18177 | viewBox: 'viewBox', | ||
18178 | xlinkActuate: 'xlink:actuate', | ||
18179 | xlinkArcrole: 'xlink:arcrole', | ||
18180 | xlinkHref: 'xlink:href', | ||
18181 | xlinkRole: 'xlink:role', | ||
18182 | xlinkShow: 'xlink:show', | ||
18183 | xlinkTitle: 'xlink:title', | ||
18184 | xlinkType: 'xlink:type', | ||
18185 | xmlBase: 'xml:base', | ||
18186 | xmlLang: 'xml:lang', | ||
18187 | xmlSpace: 'xml:space' | ||
18188 | } | ||
18189 | }; | ||
18190 | 20737 | ||
18191 | module.exports = SVGDOMPropertyConfig; | ||
18192 | |||
18193 | /***/ }, | ||
18194 | /* 144 */ | ||
18195 | /***/ function(module, exports, __webpack_require__) { | ||
18196 | |||
18197 | /** | 20738 | /** |
18198 | * Copyright 2013-2015, Facebook, Inc. | 20739 | * Finds the index of the first character |
18199 | * All rights reserved. | 20740 | * that's not common between the two given strings. |
18200 | * | ||
18201 | * This source code is licensed under the BSD-style license found in the | ||
18202 | * LICENSE file in the root directory of this source tree. An additional grant | ||
18203 | * of patent rights can be found in the PATENTS file in the same directory. | ||
18204 | * | 20741 | * |
18205 | * @providesModule ReactDefaultPerf | 20742 | * @return {number} the index of the character where the strings diverge |
18206 | * @typechecks static-only | ||
18207 | */ | 20743 | */ |
20744 | function firstDifferenceIndex(string1, string2) { | ||
20745 | var minLen = Math.min(string1.length, string2.length); | ||
20746 | for (var i = 0; i < minLen; i++) { | ||
20747 | if (string1.charAt(i) !== string2.charAt(i)) { | ||
20748 | return i; | ||
20749 | } | ||
20750 | } | ||
20751 | return string1.length === string2.length ? -1 : minLen; | ||
20752 | } | ||
18208 | 20753 | ||
18209 | 'use strict'; | 20754 | /** |
20755 | * @param {DOMElement|DOMDocument} container DOM element that may contain | ||
20756 | * a React component | ||
20757 | * @return {?*} DOM element that may have the reactRoot ID, or null. | ||
20758 | */ | ||
20759 | function getReactRootElementInContainer(container) { | ||
20760 | if (!container) { | ||
20761 | return null; | ||
20762 | } | ||
20763 | |||
20764 | if (container.nodeType === DOC_NODE_TYPE) { | ||
20765 | return container.documentElement; | ||
20766 | } else { | ||
20767 | return container.firstChild; | ||
20768 | } | ||
20769 | } | ||
20770 | |||
20771 | function internalGetID(node) { | ||
20772 | // If node is something like a window, document, or text node, none of | ||
20773 | // which support attributes or a .getAttribute method, gracefully return | ||
20774 | // the empty string, as if the attribute were missing. | ||
20775 | return node.getAttribute && node.getAttribute(ATTR_NAME) || ''; | ||
20776 | } | ||
20777 | |||
20778 | /** | ||
20779 | * Mounts this component and inserts it into the DOM. | ||
20780 | * | ||
20781 | * @param {ReactComponent} componentInstance The instance to mount. | ||
20782 | * @param {DOMElement} container DOM element to mount into. | ||
20783 | * @param {ReactReconcileTransaction} transaction | ||
20784 | * @param {boolean} shouldReuseMarkup If true, do not insert markup | ||
20785 | */ | ||
20786 | function mountComponentIntoNode(wrapperInstance, container, transaction, shouldReuseMarkup, context) { | ||
20787 | var markerName; | ||
20788 | if (ReactFeatureFlags.logTopLevelRenders) { | ||
20789 | var wrappedElement = wrapperInstance._currentElement.props; | ||
20790 | var type = wrappedElement.type; | ||
20791 | markerName = 'React mount: ' + (typeof type === 'string' ? type : type.displayName || type.name); | ||
20792 | console.time(markerName); | ||
20793 | } | ||
18210 | 20794 | ||
18211 | var DOMProperty = __webpack_require__(25); | 20795 | var markup = ReactReconciler.mountComponent(wrapperInstance, transaction, null, ReactDOMContainerInfo(wrapperInstance, container), context); |
18212 | var ReactDefaultPerfAnalysis = __webpack_require__(145); | ||
18213 | var ReactMount = __webpack_require__(30); | ||
18214 | var ReactPerf = __webpack_require__(20); | ||
18215 | 20796 | ||
18216 | var performanceNow = __webpack_require__(146); | 20797 | if (markerName) { |
20798 | console.timeEnd(markerName); | ||
20799 | } | ||
18217 | 20800 | ||
18218 | function roundFloat(val) { | 20801 | wrapperInstance._renderedComponent._topLevelWrapper = wrapperInstance; |
18219 | return Math.floor(val * 100) / 100; | 20802 | ReactMount._mountImageIntoNode(markup, container, wrapperInstance, shouldReuseMarkup, transaction); |
18220 | } | 20803 | } |
18221 | 20804 | ||
18222 | function addValue(obj, key, val) { | 20805 | /** |
18223 | obj[key] = (obj[key] || 0) + val; | 20806 | * Batched mount. |
20807 | * | ||
20808 | * @param {ReactComponent} componentInstance The instance to mount. | ||
20809 | * @param {DOMElement} container DOM element to mount into. | ||
20810 | * @param {boolean} shouldReuseMarkup If true, do not insert markup | ||
20811 | */ | ||
20812 | function batchedMountComponentIntoNode(componentInstance, container, shouldReuseMarkup, context) { | ||
20813 | var transaction = ReactUpdates.ReactReconcileTransaction.getPooled( | ||
20814 | /* useCreateElement */ | ||
20815 | !shouldReuseMarkup && ReactDOMFeatureFlags.useCreateElement); | ||
20816 | transaction.perform(mountComponentIntoNode, null, componentInstance, container, transaction, shouldReuseMarkup, context); | ||
20817 | ReactUpdates.ReactReconcileTransaction.release(transaction); | ||
18224 | } | 20818 | } |
18225 | 20819 | ||
18226 | var ReactDefaultPerf = { | 20820 | /** |
18227 | _allMeasurements: [], // last item in the list is the current one | 20821 | * Unmounts a component and removes it from the DOM. |
18228 | _mountStack: [0], | 20822 | * |
18229 | _injected: false, | 20823 | * @param {ReactComponent} instance React component instance. |
20824 | * @param {DOMElement} container DOM element to unmount from. | ||
20825 | * @final | ||
20826 | * @internal | ||
20827 | * @see {ReactMount.unmountComponentAtNode} | ||
20828 | */ | ||
20829 | function unmountComponentFromNode(instance, container, safely) { | ||
20830 | if (process.env.NODE_ENV !== 'production') { | ||
20831 | ReactInstrumentation.debugTool.onBeginFlush(); | ||
20832 | } | ||
20833 | ReactReconciler.unmountComponent(instance, safely); | ||
20834 | if (process.env.NODE_ENV !== 'production') { | ||
20835 | ReactInstrumentation.debugTool.onEndFlush(); | ||
20836 | } | ||
18230 | 20837 | ||
18231 | start: function () { | 20838 | if (container.nodeType === DOC_NODE_TYPE) { |
18232 | if (!ReactDefaultPerf._injected) { | 20839 | container = container.documentElement; |
18233 | ReactPerf.injection.injectMeasure(ReactDefaultPerf.measure); | 20840 | } |
18234 | } | ||
18235 | 20841 | ||
18236 | ReactDefaultPerf._allMeasurements.length = 0; | 20842 | // http://jsperf.com/emptying-a-node |
18237 | ReactPerf.enableMeasure = true; | 20843 | while (container.lastChild) { |
18238 | }, | 20844 | container.removeChild(container.lastChild); |
20845 | } | ||
20846 | } | ||
18239 | 20847 | ||
18240 | stop: function () { | 20848 | /** |
18241 | ReactPerf.enableMeasure = false; | 20849 | * True if the supplied DOM node has a direct React-rendered child that is |
18242 | }, | 20850 | * not a React root element. Useful for warning in `render`, |
20851 | * `unmountComponentAtNode`, etc. | ||
20852 | * | ||
20853 | * @param {?DOMElement} node The candidate DOM node. | ||
20854 | * @return {boolean} True if the DOM element contains a direct child that was | ||
20855 | * rendered by React but is not a root element. | ||
20856 | * @internal | ||
20857 | */ | ||
20858 | function hasNonRootReactChild(container) { | ||
20859 | var rootEl = getReactRootElementInContainer(container); | ||
20860 | if (rootEl) { | ||
20861 | var inst = ReactDOMComponentTree.getInstanceFromNode(rootEl); | ||
20862 | return !!(inst && inst._hostParent); | ||
20863 | } | ||
20864 | } | ||
18243 | 20865 | ||
18244 | getLastMeasurements: function () { | 20866 | function getHostRootInstanceInContainer(container) { |
18245 | return ReactDefaultPerf._allMeasurements; | 20867 | var rootEl = getReactRootElementInContainer(container); |
18246 | }, | 20868 | var prevHostInstance = rootEl && ReactDOMComponentTree.getInstanceFromNode(rootEl); |
20869 | return prevHostInstance && !prevHostInstance._hostParent ? prevHostInstance : null; | ||
20870 | } | ||
18247 | 20871 | ||
18248 | printExclusive: function (measurements) { | 20872 | function getTopLevelWrapperInContainer(container) { |
18249 | measurements = measurements || ReactDefaultPerf._allMeasurements; | 20873 | var root = getHostRootInstanceInContainer(container); |
18250 | var summary = ReactDefaultPerfAnalysis.getExclusiveSummary(measurements); | 20874 | return root ? root._hostContainerInfo._topLevelWrapper : null; |
18251 | console.table(summary.map(function (item) { | 20875 | } |
18252 | return { | ||
18253 | 'Component class name': item.componentName, | ||
18254 | 'Total inclusive time (ms)': roundFloat(item.inclusive), | ||
18255 | 'Exclusive mount time (ms)': roundFloat(item.exclusive), | ||
18256 | 'Exclusive render time (ms)': roundFloat(item.render), | ||
18257 | 'Mount time per instance (ms)': roundFloat(item.exclusive / item.count), | ||
18258 | 'Render time per instance (ms)': roundFloat(item.render / item.count), | ||
18259 | 'Instances': item.count | ||
18260 | }; | ||
18261 | })); | ||
18262 | // TODO: ReactDefaultPerfAnalysis.getTotalTime() does not return the correct | ||
18263 | // number. | ||
18264 | }, | ||
18265 | 20876 | ||
18266 | printInclusive: function (measurements) { | 20877 | /** |
18267 | measurements = measurements || ReactDefaultPerf._allMeasurements; | 20878 | * Temporary (?) hack so that we can store all top-level pending updates on |
18268 | var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements); | 20879 | * composites instead of having to worry about different types of components |
18269 | console.table(summary.map(function (item) { | 20880 | * here. |
18270 | return { | 20881 | */ |
18271 | 'Owner > component': item.componentName, | 20882 | var topLevelRootCounter = 1; |
18272 | 'Inclusive time (ms)': roundFloat(item.time), | 20883 | var TopLevelWrapper = function () { |
18273 | 'Instances': item.count | 20884 | this.rootID = topLevelRootCounter++; |
18274 | }; | 20885 | }; |
18275 | })); | 20886 | TopLevelWrapper.prototype.isReactComponent = {}; |
18276 | console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'); | 20887 | if (process.env.NODE_ENV !== 'production') { |
18277 | }, | 20888 | TopLevelWrapper.displayName = 'TopLevelWrapper'; |
20889 | } | ||
20890 | TopLevelWrapper.prototype.render = function () { | ||
20891 | // this.props is actually a ReactElement | ||
20892 | return this.props; | ||
20893 | }; | ||
18278 | 20894 | ||
18279 | getMeasurementsSummaryMap: function (measurements) { | 20895 | /** |
18280 | var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements, true); | 20896 | * Mounting is the process of initializing a React component by creating its |
18281 | return summary.map(function (item) { | 20897 | * representative DOM elements and inserting them into a supplied `container`. |
18282 | return { | 20898 | * Any prior content inside `container` is destroyed in the process. |
18283 | 'Owner > component': item.componentName, | 20899 | * |
18284 | 'Wasted time (ms)': item.time, | 20900 | * ReactMount.render( |
18285 | 'Instances': item.count | 20901 | * component, |
18286 | }; | 20902 | * document.getElementById('container') |
18287 | }); | 20903 | * ); |
18288 | }, | 20904 | * |
20905 | * <div id="container"> <-- Supplied `container`. | ||
20906 | * <div data-reactid=".3"> <-- Rendered reactRoot of React | ||
20907 | * // ... component. | ||
20908 | * </div> | ||
20909 | * </div> | ||
20910 | * | ||
20911 | * Inside of `container`, the first element rendered is the "reactRoot". | ||
20912 | */ | ||
20913 | var ReactMount = { | ||
18289 | 20914 | ||
18290 | printWasted: function (measurements) { | 20915 | TopLevelWrapper: TopLevelWrapper, |
18291 | measurements = measurements || ReactDefaultPerf._allMeasurements; | ||
18292 | console.table(ReactDefaultPerf.getMeasurementsSummaryMap(measurements)); | ||
18293 | console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'); | ||
18294 | }, | ||
18295 | 20916 | ||
18296 | printDOM: function (measurements) { | 20917 | /** |
18297 | measurements = measurements || ReactDefaultPerf._allMeasurements; | 20918 | * Used by devtools. The keys are not important. |
18298 | var summary = ReactDefaultPerfAnalysis.getDOMSummary(measurements); | 20919 | */ |
18299 | console.table(summary.map(function (item) { | 20920 | _instancesByReactRootID: instancesByReactRootID, |
18300 | var result = {}; | 20921 | |
18301 | result[DOMProperty.ID_ATTRIBUTE_NAME] = item.id; | 20922 | /** |
18302 | result.type = item.type; | 20923 | * This is a hook provided to support rendering React components while |
18303 | result.args = JSON.stringify(item.args); | 20924 | * ensuring that the apparent scroll position of its `container` does not |
18304 | return result; | 20925 | * change. |
18305 | })); | 20926 | * |
18306 | console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'); | 20927 | * @param {DOMElement} container The `container` being rendered into. |
20928 | * @param {function} renderCallback This must be called once to do the render. | ||
20929 | */ | ||
20930 | scrollMonitor: function (container, renderCallback) { | ||
20931 | renderCallback(); | ||
18307 | }, | 20932 | }, |
18308 | 20933 | ||
18309 | _recordWrite: function (id, fnName, totalTime, args) { | 20934 | /** |
18310 | // TODO: totalTime isn't that useful since it doesn't count paints/reflows | 20935 | * Take a component that's already mounted into the DOM and replace its props |
18311 | var writes = ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1].writes; | 20936 | * @param {ReactComponent} prevComponent component instance already in the DOM |
18312 | writes[id] = writes[id] || []; | 20937 | * @param {ReactElement} nextElement component instance to render |
18313 | writes[id].push({ | 20938 | * @param {DOMElement} container container to render into |
18314 | type: fnName, | 20939 | * @param {?function} callback function triggered on completion |
18315 | time: totalTime, | 20940 | */ |
18316 | args: args | 20941 | _updateRootComponent: function (prevComponent, nextElement, nextContext, container, callback) { |
20942 | ReactMount.scrollMonitor(container, function () { | ||
20943 | ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement, nextContext); | ||
20944 | if (callback) { | ||
20945 | ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback); | ||
20946 | } | ||
18317 | }); | 20947 | }); |
20948 | |||
20949 | return prevComponent; | ||
18318 | }, | 20950 | }, |
18319 | 20951 | ||
18320 | measure: function (moduleName, fnName, func) { | 20952 | /** |
18321 | return function () { | 20953 | * Render a new component into the DOM. Hooked by devtools! |
18322 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | 20954 | * |
18323 | args[_key] = arguments[_key]; | 20955 | * @param {ReactElement} nextElement element to render |
18324 | } | 20956 | * @param {DOMElement} container container to render into |
18325 | 20957 | * @param {boolean} shouldReuseMarkup if we should skip the markup insertion | |
18326 | var totalTime; | 20958 | * @return {ReactComponent} nextComponent |
18327 | var rv; | 20959 | */ |
18328 | var start; | 20960 | _renderNewRootComponent: function (nextElement, container, shouldReuseMarkup, context) { |
18329 | 20961 | // Various parts of our code (such as ReactCompositeComponent's | |
18330 | if (fnName === '_renderNewRootComponent' || fnName === 'flushBatchedUpdates') { | 20962 | // _renderValidatedComponent) assume that calls to render aren't nested; |
18331 | // A "measurement" is a set of metrics recorded for each flush. We want | 20963 | // verify that that's the case. |
18332 | // to group the metrics for a given flush together so we can look at the | 20964 | 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; |
18333 | // components that rendered and the DOM operations that actually | ||
18334 | // happened to determine the amount of "wasted work" performed. | ||
18335 | ReactDefaultPerf._allMeasurements.push({ | ||
18336 | exclusive: {}, | ||
18337 | inclusive: {}, | ||
18338 | render: {}, | ||
18339 | counts: {}, | ||
18340 | writes: {}, | ||
18341 | displayNames: {}, | ||
18342 | totalTime: 0, | ||
18343 | created: {} | ||
18344 | }); | ||
18345 | start = performanceNow(); | ||
18346 | rv = func.apply(this, args); | ||
18347 | ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1].totalTime = performanceNow() - start; | ||
18348 | return rv; | ||
18349 | } else if (fnName === '_mountImageIntoNode' || moduleName === 'ReactBrowserEventEmitter' || moduleName === 'ReactDOMIDOperations' || moduleName === 'CSSPropertyOperations' || moduleName === 'DOMChildrenOperations' || moduleName === 'DOMPropertyOperations') { | ||
18350 | start = performanceNow(); | ||
18351 | rv = func.apply(this, args); | ||
18352 | totalTime = performanceNow() - start; | ||
18353 | |||
18354 | if (fnName === '_mountImageIntoNode') { | ||
18355 | var mountID = ReactMount.getID(args[1]); | ||
18356 | ReactDefaultPerf._recordWrite(mountID, fnName, totalTime, args[0]); | ||
18357 | } else if (fnName === 'dangerouslyProcessChildrenUpdates') { | ||
18358 | // special format | ||
18359 | args[0].forEach(function (update) { | ||
18360 | var writeArgs = {}; | ||
18361 | if (update.fromIndex !== null) { | ||
18362 | writeArgs.fromIndex = update.fromIndex; | ||
18363 | } | ||
18364 | if (update.toIndex !== null) { | ||
18365 | writeArgs.toIndex = update.toIndex; | ||
18366 | } | ||
18367 | if (update.textContent !== null) { | ||
18368 | writeArgs.textContent = update.textContent; | ||
18369 | } | ||
18370 | if (update.markupIndex !== null) { | ||
18371 | writeArgs.markup = args[1][update.markupIndex]; | ||
18372 | } | ||
18373 | ReactDefaultPerf._recordWrite(update.parentID, update.type, totalTime, writeArgs); | ||
18374 | }); | ||
18375 | } else { | ||
18376 | // basic format | ||
18377 | var id = args[0]; | ||
18378 | if (typeof id === 'object') { | ||
18379 | id = ReactMount.getID(args[0]); | ||
18380 | } | ||
18381 | ReactDefaultPerf._recordWrite(id, fnName, totalTime, Array.prototype.slice.call(args, 1)); | ||
18382 | } | ||
18383 | return rv; | ||
18384 | } else if (moduleName === 'ReactCompositeComponent' && (fnName === 'mountComponent' || fnName === 'updateComponent' || // TODO: receiveComponent()? | ||
18385 | fnName === '_renderValidatedComponent')) { | ||
18386 | 20965 | ||
18387 | if (this._currentElement.type === ReactMount.TopLevelWrapper) { | 20966 | !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '_registerComponent(...): Target container is not a DOM element.') : _prodInvariant('37') : void 0; |
18388 | return func.apply(this, args); | ||
18389 | } | ||
18390 | 20967 | ||
18391 | var rootNodeID = fnName === 'mountComponent' ? args[0] : this._rootNodeID; | 20968 | ReactBrowserEventEmitter.ensureScrollValueMonitoring(); |
18392 | var isRender = fnName === '_renderValidatedComponent'; | 20969 | var componentInstance = instantiateReactComponent(nextElement, false); |
18393 | var isMount = fnName === 'mountComponent'; | ||
18394 | 20970 | ||
18395 | var mountStack = ReactDefaultPerf._mountStack; | 20971 | // The initial render is synchronous but any updates that happen during |
18396 | var entry = ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1]; | 20972 | // rendering, in componentWillMount or componentDidMount, will be batched |
20973 | // according to the current batching strategy. | ||
18397 | 20974 | ||
18398 | if (isRender) { | 20975 | ReactUpdates.batchedUpdates(batchedMountComponentIntoNode, componentInstance, container, shouldReuseMarkup, context); |
18399 | addValue(entry.counts, rootNodeID, 1); | ||
18400 | } else if (isMount) { | ||
18401 | entry.created[rootNodeID] = true; | ||
18402 | mountStack.push(0); | ||
18403 | } | ||
18404 | 20976 | ||
18405 | start = performanceNow(); | 20977 | var wrapperID = componentInstance._instance.rootID; |
18406 | rv = func.apply(this, args); | 20978 | instancesByReactRootID[wrapperID] = componentInstance; |
18407 | totalTime = performanceNow() - start; | ||
18408 | 20979 | ||
18409 | if (isRender) { | 20980 | if (process.env.NODE_ENV !== 'production') { |
18410 | addValue(entry.render, rootNodeID, totalTime); | 20981 | // The instance here is TopLevelWrapper so we report mount for its child. |
18411 | } else if (isMount) { | 20982 | ReactInstrumentation.debugTool.onMountRootComponent(componentInstance._renderedComponent._debugID); |
18412 | var subMountTime = mountStack.pop(); | 20983 | } |
18413 | mountStack[mountStack.length - 1] += totalTime; | ||
18414 | addValue(entry.exclusive, rootNodeID, totalTime - subMountTime); | ||
18415 | addValue(entry.inclusive, rootNodeID, totalTime); | ||
18416 | } else { | ||
18417 | addValue(entry.inclusive, rootNodeID, totalTime); | ||
18418 | } | ||
18419 | 20984 | ||
18420 | entry.displayNames[rootNodeID] = { | 20985 | return componentInstance; |
18421 | current: this.getName(), | 20986 | }, |
18422 | owner: this._currentElement._owner ? this._currentElement._owner.getName() : '<root>' | ||
18423 | }; | ||
18424 | 20987 | ||
18425 | return rv; | 20988 | /** |
18426 | } else { | 20989 | * Renders a React component into the DOM in the supplied `container`. |
18427 | return func.apply(this, args); | 20990 | * |
18428 | } | 20991 | * If the React component was previously rendered into `container`, this will |
18429 | }; | 20992 | * perform an update on it and only mutate the DOM as necessary to reflect the |
18430 | } | 20993 | * latest React component. |
18431 | }; | 20994 | * |
20995 | * @param {ReactComponent} parentComponent The conceptual parent of this render tree. | ||
20996 | * @param {ReactElement} nextElement Component element to render. | ||
20997 | * @param {DOMElement} container DOM element to render into. | ||
20998 | * @param {?function} callback function triggered on completion | ||
20999 | * @return {ReactComponent} Component instance rendered in `container`. | ||
21000 | */ | ||
21001 | renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) { | ||
21002 | !(parentComponent != null && ReactInstanceMap.has(parentComponent)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'parentComponent must be a valid React Component') : _prodInvariant('38') : void 0; | ||
21003 | return ReactMount._renderSubtreeIntoContainer(parentComponent, nextElement, container, callback); | ||
21004 | }, | ||
18432 | 21005 | ||
18433 | module.exports = ReactDefaultPerf; | 21006 | _renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) { |
18434 | 21007 | ReactUpdateQueue.validateCallback(callback, 'ReactDOM.render'); | |
18435 | /***/ }, | 21008 | !ReactElement.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 />.' : |
18436 | /* 145 */ | 21009 | // Check if it quacks like an element |
18437 | /***/ function(module, exports, __webpack_require__) { | 21010 | 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; |
18438 | |||
18439 | /** | ||
18440 | * Copyright 2013-2015, Facebook, Inc. | ||
18441 | * All rights reserved. | ||
18442 | * | ||
18443 | * This source code is licensed under the BSD-style license found in the | ||
18444 | * LICENSE file in the root directory of this source tree. An additional grant | ||
18445 | * of patent rights can be found in the PATENTS file in the same directory. | ||
18446 | * | ||
18447 | * @providesModule ReactDefaultPerfAnalysis | ||
18448 | */ | ||
18449 | 21011 | ||
18450 | 'use strict'; | 21012 | 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; |
18451 | 21013 | ||
18452 | var assign = __webpack_require__(41); | 21014 | var nextWrappedElement = ReactElement(TopLevelWrapper, null, null, null, null, null, nextElement); |
18453 | |||
18454 | // Don't try to save users less than 1.2ms (a number I made up) | ||
18455 | var DONT_CARE_THRESHOLD = 1.2; | ||
18456 | var DOM_OPERATION_TYPES = { | ||
18457 | '_mountImageIntoNode': 'set innerHTML', | ||
18458 | INSERT_MARKUP: 'set innerHTML', | ||
18459 | MOVE_EXISTING: 'move', | ||
18460 | REMOVE_NODE: 'remove', | ||
18461 | SET_MARKUP: 'set innerHTML', | ||
18462 | TEXT_CONTENT: 'set textContent', | ||
18463 | 'setValueForProperty': 'update attribute', | ||
18464 | 'setValueForAttribute': 'update attribute', | ||
18465 | 'deleteValueForProperty': 'remove attribute', | ||
18466 | 'dangerouslyReplaceNodeWithMarkupByID': 'replace' | ||
18467 | }; | ||
18468 | 21015 | ||
18469 | function getTotalTime(measurements) { | 21016 | var nextContext; |
18470 | // TODO: return number of DOM ops? could be misleading. | 21017 | if (parentComponent) { |
18471 | // TODO: measure dropped frames after reconcile? | 21018 | var parentInst = ReactInstanceMap.get(parentComponent); |
18472 | // TODO: log total time of each reconcile and the top-level component | 21019 | nextContext = parentInst._processChildContext(parentInst._context); |
18473 | // class that triggered it. | 21020 | } else { |
18474 | var totalTime = 0; | 21021 | nextContext = emptyObject; |
18475 | for (var i = 0; i < measurements.length; i++) { | 21022 | } |
18476 | var measurement = measurements[i]; | ||
18477 | totalTime += measurement.totalTime; | ||
18478 | } | ||
18479 | return totalTime; | ||
18480 | } | ||
18481 | |||
18482 | function getDOMSummary(measurements) { | ||
18483 | var items = []; | ||
18484 | measurements.forEach(function (measurement) { | ||
18485 | Object.keys(measurement.writes).forEach(function (id) { | ||
18486 | measurement.writes[id].forEach(function (write) { | ||
18487 | items.push({ | ||
18488 | id: id, | ||
18489 | type: DOM_OPERATION_TYPES[write.type] || write.type, | ||
18490 | args: write.args | ||
18491 | }); | ||
18492 | }); | ||
18493 | }); | ||
18494 | }); | ||
18495 | return items; | ||
18496 | } | ||
18497 | 21023 | ||
18498 | function getExclusiveSummary(measurements) { | 21024 | var prevComponent = getTopLevelWrapperInContainer(container); |
18499 | var candidates = {}; | ||
18500 | var displayName; | ||
18501 | 21025 | ||
18502 | for (var i = 0; i < measurements.length; i++) { | 21026 | if (prevComponent) { |
18503 | var measurement = measurements[i]; | 21027 | var prevWrappedElement = prevComponent._currentElement; |
18504 | var allIDs = assign({}, measurement.exclusive, measurement.inclusive); | 21028 | var prevElement = prevWrappedElement.props; |
21029 | if (shouldUpdateReactComponent(prevElement, nextElement)) { | ||
21030 | var publicInst = prevComponent._renderedComponent.getPublicInstance(); | ||
21031 | var updatedCallback = callback && function () { | ||
21032 | callback.call(publicInst); | ||
21033 | }; | ||
21034 | ReactMount._updateRootComponent(prevComponent, nextWrappedElement, nextContext, container, updatedCallback); | ||
21035 | return publicInst; | ||
21036 | } else { | ||
21037 | ReactMount.unmountComponentAtNode(container); | ||
21038 | } | ||
21039 | } | ||
18505 | 21040 | ||
18506 | for (var id in allIDs) { | 21041 | var reactRootElement = getReactRootElementInContainer(container); |
18507 | displayName = measurement.displayNames[id].current; | 21042 | var containerHasReactMarkup = reactRootElement && !!internalGetID(reactRootElement); |
21043 | var containerHasNonRootReactChild = hasNonRootReactChild(container); | ||
18508 | 21044 | ||
18509 | candidates[displayName] = candidates[displayName] || { | 21045 | if (process.env.NODE_ENV !== 'production') { |
18510 | componentName: displayName, | 21046 | 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; |
18511 | inclusive: 0, | 21047 | |
18512 | exclusive: 0, | 21048 | if (!containerHasReactMarkup || reactRootElement.nextSibling) { |
18513 | render: 0, | 21049 | var rootElementSibling = reactRootElement; |
18514 | count: 0 | 21050 | while (rootElementSibling) { |
18515 | }; | 21051 | if (internalGetID(rootElementSibling)) { |
18516 | if (measurement.render[id]) { | 21052 | 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; |
18517 | candidates[displayName].render += measurement.render[id]; | 21053 | break; |
18518 | } | 21054 | } |
18519 | if (measurement.exclusive[id]) { | 21055 | rootElementSibling = rootElementSibling.nextSibling; |
18520 | candidates[displayName].exclusive += measurement.exclusive[id]; | 21056 | } |
18521 | } | ||
18522 | if (measurement.inclusive[id]) { | ||
18523 | candidates[displayName].inclusive += measurement.inclusive[id]; | ||
18524 | } | ||
18525 | if (measurement.counts[id]) { | ||
18526 | candidates[displayName].count += measurement.counts[id]; | ||
18527 | } | 21057 | } |
18528 | } | 21058 | } |
18529 | } | ||
18530 | 21059 | ||
18531 | // Now make a sorted array with the results. | 21060 | var shouldReuseMarkup = containerHasReactMarkup && !prevComponent && !containerHasNonRootReactChild; |
18532 | var arr = []; | 21061 | var component = ReactMount._renderNewRootComponent(nextWrappedElement, container, shouldReuseMarkup, nextContext)._renderedComponent.getPublicInstance(); |
18533 | for (displayName in candidates) { | 21062 | if (callback) { |
18534 | if (candidates[displayName].exclusive >= DONT_CARE_THRESHOLD) { | 21063 | callback.call(component); |
18535 | arr.push(candidates[displayName]); | ||
18536 | } | 21064 | } |
18537 | } | 21065 | return component; |
21066 | }, | ||
18538 | 21067 | ||
18539 | arr.sort(function (a, b) { | 21068 | /** |
18540 | return b.exclusive - a.exclusive; | 21069 | * Renders a React component into the DOM in the supplied `container`. |
18541 | }); | 21070 | * See https://facebook.github.io/react/docs/top-level-api.html#reactdom.render |
21071 | * | ||
21072 | * If the React component was previously rendered into `container`, this will | ||
21073 | * perform an update on it and only mutate the DOM as necessary to reflect the | ||
21074 | * latest React component. | ||
21075 | * | ||
21076 | * @param {ReactElement} nextElement Component element to render. | ||
21077 | * @param {DOMElement} container DOM element to render into. | ||
21078 | * @param {?function} callback function triggered on completion | ||
21079 | * @return {ReactComponent} Component instance rendered in `container`. | ||
21080 | */ | ||
21081 | render: function (nextElement, container, callback) { | ||
21082 | return ReactMount._renderSubtreeIntoContainer(null, nextElement, container, callback); | ||
21083 | }, | ||
18542 | 21084 | ||
18543 | return arr; | 21085 | /** |
18544 | } | 21086 | * Unmounts and destroys the React component rendered in the `container`. |
21087 | * See https://facebook.github.io/react/docs/top-level-api.html#reactdom.unmountcomponentatnode | ||
21088 | * | ||
21089 | * @param {DOMElement} container DOM element containing a React component. | ||
21090 | * @return {boolean} True if a component was found in and unmounted from | ||
21091 | * `container` | ||
21092 | */ | ||
21093 | unmountComponentAtNode: function (container) { | ||
21094 | // Various parts of our code (such as ReactCompositeComponent's | ||
21095 | // _renderValidatedComponent) assume that calls to render aren't nested; | ||
21096 | // verify that that's the case. (Strictly speaking, unmounting won't cause a | ||
21097 | // render but we still don't expect to be in a render call here.) | ||
21098 | 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; | ||
18545 | 21099 | ||
18546 | function getInclusiveSummary(measurements, onlyClean) { | 21100 | !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'unmountComponentAtNode(...): Target container is not a DOM element.') : _prodInvariant('40') : void 0; |
18547 | var candidates = {}; | ||
18548 | var inclusiveKey; | ||
18549 | 21101 | ||
18550 | for (var i = 0; i < measurements.length; i++) { | 21102 | var prevComponent = getTopLevelWrapperInContainer(container); |
18551 | var measurement = measurements[i]; | 21103 | if (!prevComponent) { |
18552 | var allIDs = assign({}, measurement.exclusive, measurement.inclusive); | 21104 | // Check if the node being unmounted was rendered by React, but isn't a |
18553 | var cleanComponents; | 21105 | // root node. |
21106 | var containerHasNonRootReactChild = hasNonRootReactChild(container); | ||
18554 | 21107 | ||
18555 | if (onlyClean) { | 21108 | // Check if the container itself is a React root node. |
18556 | cleanComponents = getUnchangedComponents(measurement); | 21109 | var isContainerReactRoot = container.nodeType === 1 && container.hasAttribute(ROOT_ATTR_NAME); |
18557 | } | ||
18558 | 21110 | ||
18559 | for (var id in allIDs) { | 21111 | if (process.env.NODE_ENV !== 'production') { |
18560 | if (onlyClean && !cleanComponents[id]) { | 21112 | 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; |
18561 | continue; | ||
18562 | } | 21113 | } |
18563 | 21114 | ||
18564 | var displayName = measurement.displayNames[id]; | 21115 | return false; |
21116 | } | ||
21117 | delete instancesByReactRootID[prevComponent._instance.rootID]; | ||
21118 | ReactUpdates.batchedUpdates(unmountComponentFromNode, prevComponent, container, false); | ||
21119 | return true; | ||
21120 | }, | ||
18565 | 21121 | ||
18566 | // Inclusive time is not useful for many components without knowing where | 21122 | _mountImageIntoNode: function (markup, container, instance, shouldReuseMarkup, transaction) { |
18567 | // they are instantiated. So we aggregate inclusive time with both the | 21123 | !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mountComponentIntoNode(...): Target container is not valid.') : _prodInvariant('41') : void 0; |
18568 | // owner and current displayName as the key. | ||
18569 | inclusiveKey = displayName.owner + ' > ' + displayName.current; | ||
18570 | 21124 | ||
18571 | candidates[inclusiveKey] = candidates[inclusiveKey] || { | 21125 | if (shouldReuseMarkup) { |
18572 | componentName: inclusiveKey, | 21126 | var rootElement = getReactRootElementInContainer(container); |
18573 | time: 0, | 21127 | if (ReactMarkupChecksum.canReuseMarkup(markup, rootElement)) { |
18574 | count: 0 | 21128 | ReactDOMComponentTree.precacheNode(instance, rootElement); |
18575 | }; | 21129 | return; |
21130 | } else { | ||
21131 | var checksum = rootElement.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME); | ||
21132 | rootElement.removeAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME); | ||
18576 | 21133 | ||
18577 | if (measurement.inclusive[id]) { | 21134 | var rootMarkup = rootElement.outerHTML; |
18578 | candidates[inclusiveKey].time += measurement.inclusive[id]; | 21135 | rootElement.setAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME, checksum); |
18579 | } | ||
18580 | if (measurement.counts[id]) { | ||
18581 | candidates[inclusiveKey].count += measurement.counts[id]; | ||
18582 | } | ||
18583 | } | ||
18584 | } | ||
18585 | 21136 | ||
18586 | // Now make a sorted array with the results. | 21137 | var normalizedMarkup = markup; |
18587 | var arr = []; | 21138 | if (process.env.NODE_ENV !== 'production') { |
18588 | for (inclusiveKey in candidates) { | 21139 | // because rootMarkup is retrieved from the DOM, various normalizations |
18589 | if (candidates[inclusiveKey].time >= DONT_CARE_THRESHOLD) { | 21140 | // will have occurred which will not be present in `markup`. Here, |
18590 | arr.push(candidates[inclusiveKey]); | 21141 | // insert markup into a <div> or <iframe> depending on the container |
18591 | } | 21142 | // type to perform the same normalizations before comparing. |
18592 | } | 21143 | var normalizer; |
21144 | if (container.nodeType === ELEMENT_NODE_TYPE) { | ||
21145 | normalizer = document.createElement('div'); | ||
21146 | normalizer.innerHTML = markup; | ||
21147 | normalizedMarkup = normalizer.innerHTML; | ||
21148 | } else { | ||
21149 | normalizer = document.createElement('iframe'); | ||
21150 | document.body.appendChild(normalizer); | ||
21151 | normalizer.contentDocument.write(markup); | ||
21152 | normalizedMarkup = normalizer.contentDocument.documentElement.outerHTML; | ||
21153 | document.body.removeChild(normalizer); | ||
21154 | } | ||
21155 | } | ||
18593 | 21156 | ||
18594 | arr.sort(function (a, b) { | 21157 | var diffIndex = firstDifferenceIndex(normalizedMarkup, rootMarkup); |
18595 | return b.time - a.time; | 21158 | var difference = ' (client) ' + normalizedMarkup.substring(diffIndex - 20, diffIndex + 20) + '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20); |
18596 | }); | ||
18597 | 21159 | ||
18598 | return arr; | 21160 | !(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; |
18599 | } | ||
18600 | 21161 | ||
18601 | function getUnchangedComponents(measurement) { | 21162 | if (process.env.NODE_ENV !== 'production') { |
18602 | // For a given reconcile, look at which components did not actually | 21163 | 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; |
18603 | // render anything to the DOM and return a mapping of their ID to | 21164 | } |
18604 | // the amount of time it took to render the entire subtree. | ||
18605 | var cleanComponents = {}; | ||
18606 | var dirtyLeafIDs = Object.keys(measurement.writes); | ||
18607 | var allIDs = assign({}, measurement.exclusive, measurement.inclusive); | ||
18608 | |||
18609 | for (var id in allIDs) { | ||
18610 | var isDirty = false; | ||
18611 | // For each component that rendered, see if a component that triggered | ||
18612 | // a DOM op is in its subtree. | ||
18613 | for (var i = 0; i < dirtyLeafIDs.length; i++) { | ||
18614 | if (dirtyLeafIDs[i].indexOf(id) === 0) { | ||
18615 | isDirty = true; | ||
18616 | break; | ||
18617 | } | 21165 | } |
18618 | } | 21166 | } |
18619 | // check if component newly created | 21167 | |
18620 | if (measurement.created[id]) { | 21168 | !(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; |
18621 | isDirty = true; | 21169 | |
21170 | if (transaction.useCreateElement) { | ||
21171 | while (container.lastChild) { | ||
21172 | container.removeChild(container.lastChild); | ||
21173 | } | ||
21174 | DOMLazyTree.insertTreeBefore(container, markup, null); | ||
21175 | } else { | ||
21176 | setInnerHTML(container, markup); | ||
21177 | ReactDOMComponentTree.precacheNode(instance, container.firstChild); | ||
18622 | } | 21178 | } |
18623 | if (!isDirty && measurement.counts[id] > 0) { | 21179 | |
18624 | cleanComponents[id] = true; | 21180 | if (process.env.NODE_ENV !== 'production') { |
21181 | var hostNode = ReactDOMComponentTree.getInstanceFromNode(container.firstChild); | ||
21182 | if (hostNode._debugID !== 0) { | ||
21183 | ReactInstrumentation.debugTool.onHostOperation(hostNode._debugID, 'mount', markup.toString()); | ||
21184 | } | ||
18625 | } | 21185 | } |
18626 | } | 21186 | } |
18627 | return cleanComponents; | ||
18628 | } | ||
18629 | |||
18630 | var ReactDefaultPerfAnalysis = { | ||
18631 | getExclusiveSummary: getExclusiveSummary, | ||
18632 | getInclusiveSummary: getInclusiveSummary, | ||
18633 | getDOMSummary: getDOMSummary, | ||
18634 | getTotalTime: getTotalTime | ||
18635 | }; | 21187 | }; |
18636 | 21188 | ||
18637 | module.exports = ReactDefaultPerfAnalysis; | 21189 | module.exports = ReactMount; |
21190 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
18638 | 21191 | ||
18639 | /***/ }, | 21192 | /***/ }, |
18640 | /* 146 */ | 21193 | /* 170 */ |
18641 | /***/ function(module, exports, __webpack_require__) { | 21194 | /***/ function(module, exports, __webpack_require__) { |
18642 | 21195 | ||
18643 | /** | 21196 | /* WEBPACK VAR INJECTION */(function(process) {/** |
18644 | * Copyright 2013-2015, Facebook, Inc. | 21197 | * Copyright 2013-present, Facebook, Inc. |
18645 | * All rights reserved. | 21198 | * All rights reserved. |
18646 | * | 21199 | * |
18647 | * This source code is licensed under the BSD-style license found in the | 21200 | * This source code is licensed under the BSD-style license found in the |
18648 | * LICENSE file in the root directory of this source tree. An additional grant | 21201 | * LICENSE file in the root directory of this source tree. An additional grant |
18649 | * of patent rights can be found in the PATENTS file in the same directory. | 21202 | * of patent rights can be found in the PATENTS file in the same directory. |
18650 | * | 21203 | * |
18651 | * @providesModule performanceNow | 21204 | * @providesModule ReactDOMContainerInfo |
18652 | * @typechecks | ||
18653 | */ | 21205 | */ |
18654 | 21206 | ||
18655 | 'use strict'; | 21207 | 'use strict'; |
18656 | 21208 | ||
18657 | var performance = __webpack_require__(147); | 21209 | var validateDOMNesting = __webpack_require__(139); |
18658 | var curPerformance = performance; | ||
18659 | 21210 | ||
18660 | /** | 21211 | var DOC_NODE_TYPE = 9; |
18661 | * Detect if we can use `window.performance.now()` and gracefully fallback to | ||
18662 | * `Date.now()` if it doesn't exist. We need to support Firefox < 15 for now | ||
18663 | * because of Facebook's testing infrastructure. | ||
18664 | */ | ||
18665 | if (!curPerformance || !curPerformance.now) { | ||
18666 | curPerformance = Date; | ||
18667 | } | ||
18668 | 21212 | ||
18669 | var performanceNow = curPerformance.now.bind(curPerformance); | 21213 | function ReactDOMContainerInfo(topLevelWrapper, node) { |
21214 | var info = { | ||
21215 | _topLevelWrapper: topLevelWrapper, | ||
21216 | _idCounter: 1, | ||
21217 | _ownerDocument: node ? node.nodeType === DOC_NODE_TYPE ? node : node.ownerDocument : null, | ||
21218 | _node: node, | ||
21219 | _tag: node ? node.nodeName.toLowerCase() : null, | ||
21220 | _namespaceURI: node ? node.namespaceURI : null | ||
21221 | }; | ||
21222 | if (process.env.NODE_ENV !== 'production') { | ||
21223 | info._ancestorInfo = node ? validateDOMNesting.updatedAncestorInfo(null, info._tag, null) : null; | ||
21224 | } | ||
21225 | return info; | ||
21226 | } | ||
18670 | 21227 | ||
18671 | module.exports = performanceNow; | 21228 | module.exports = ReactDOMContainerInfo; |
21229 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) | ||
18672 | 21230 | ||
18673 | /***/ }, | 21231 | /***/ }, |
18674 | /* 147 */ | 21232 | /* 171 */ |
18675 | /***/ function(module, exports, __webpack_require__) { | 21233 | /***/ function(module, exports) { |
18676 | 21234 | ||
18677 | /** | 21235 | /** |
18678 | * Copyright 2013-2015, Facebook, Inc. | 21236 | * Copyright 2013-present, Facebook, Inc. |
18679 | * All rights reserved. | 21237 | * All rights reserved. |
18680 | * | 21238 | * |
18681 | * This source code is licensed under the BSD-style license found in the | 21239 | * This source code is licensed under the BSD-style license found in the |
18682 | * LICENSE file in the root directory of this source tree. An additional grant | 21240 | * LICENSE file in the root directory of this source tree. An additional grant |
18683 | * of patent rights can be found in the PATENTS file in the same directory. | 21241 | * of patent rights can be found in the PATENTS file in the same directory. |
18684 | * | 21242 | * |
18685 | * @providesModule performance | 21243 | * @providesModule ReactDOMFeatureFlags |
18686 | * @typechecks | ||
18687 | */ | 21244 | */ |
18688 | 21245 | ||
18689 | 'use strict'; | 21246 | 'use strict'; |
18690 | 21247 | ||
18691 | var ExecutionEnvironment = __webpack_require__(11); | 21248 | var ReactDOMFeatureFlags = { |
18692 | 21249 | useCreateElement: true | |
18693 | var performance; | 21250 | }; |
18694 | |||
18695 | if (ExecutionEnvironment.canUseDOM) { | ||
18696 | performance = window.performance || window.msPerformance || window.webkitPerformance; | ||
18697 | } | ||
18698 | 21251 | ||
18699 | module.exports = performance || {}; | 21252 | module.exports = ReactDOMFeatureFlags; |
18700 | 21253 | ||
18701 | /***/ }, | 21254 | /***/ }, |
18702 | /* 148 */ | 21255 | /* 172 */ |
18703 | /***/ function(module, exports) { | 21256 | /***/ function(module, exports, __webpack_require__) { |
18704 | 21257 | ||
18705 | /** | 21258 | /** |
18706 | * Copyright 2013-2015, Facebook, Inc. | 21259 | * Copyright 2013-present, Facebook, Inc. |
18707 | * All rights reserved. | 21260 | * All rights reserved. |
18708 | * | 21261 | * |
18709 | * This source code is licensed under the BSD-style license found in the | 21262 | * This source code is licensed under the BSD-style license found in the |
18710 | * LICENSE file in the root directory of this source tree. An additional grant | 21263 | * LICENSE file in the root directory of this source tree. An additional grant |
18711 | * of patent rights can be found in the PATENTS file in the same directory. | 21264 | * of patent rights can be found in the PATENTS file in the same directory. |
18712 | * | 21265 | * |
18713 | * @providesModule ReactVersion | 21266 | * @providesModule ReactMarkupChecksum |
18714 | */ | 21267 | */ |
18715 | 21268 | ||
18716 | 'use strict'; | 21269 | 'use strict'; |
18717 | 21270 | ||
18718 | module.exports = '0.14.3'; | 21271 | var adler32 = __webpack_require__(173); |
18719 | |||
18720 | /***/ }, | ||
18721 | /* 149 */ | ||
18722 | /***/ function(module, exports, __webpack_require__) { | ||
18723 | |||
18724 | /** | ||
18725 | * Copyright 2013-2015, Facebook, Inc. | ||
18726 | * All rights reserved. | ||
18727 | * | ||
18728 | * This source code is licensed under the BSD-style license found in the | ||
18729 | * LICENSE file in the root directory of this source tree. An additional grant | ||
18730 | * of patent rights can be found in the PATENTS file in the same directory. | ||
18731 | * | ||
18732 | * @providesModule renderSubtreeIntoContainer | ||
18733 | */ | ||
18734 | 21272 | ||
18735 | 'use strict'; | 21273 | var TAG_END = /\/?>/; |
21274 | var COMMENT_START = /^<\!\-\-/; | ||
18736 | 21275 | ||
18737 | var ReactMount = __webpack_require__(30); | 21276 | var ReactMarkupChecksum = { |
21277 | CHECKSUM_ATTR_NAME: 'data-react-checksum', | ||
18738 | 21278 | ||
18739 | module.exports = ReactMount.renderSubtreeIntoContainer; | 21279 | /** |
21280 | * @param {string} markup Markup string | ||
21281 | * @return {string} Markup string with checksum attribute attached | ||
21282 | */ | ||
21283 | addChecksumToMarkup: function (markup) { | ||
21284 | var checksum = adler32(markup); | ||
21285 | |||
21286 | // Add checksum (handle both parent tags, comments and self-closing tags) | ||
21287 | if (COMMENT_START.test(markup)) { | ||
21288 | return markup; | ||
21289 | } else { | ||
21290 | return markup.replace(TAG_END, ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '"$&'); | ||
21291 | } | ||
21292 | }, | ||
21293 | |||
21294 | /** | ||
21295 | * @param {string} markup to use | ||
21296 | * @param {DOMElement} element root React element | ||
21297 | * @returns {boolean} whether or not the markup is the same | ||
21298 | */ | ||
21299 | canReuseMarkup: function (markup, element) { | ||
21300 | var existingChecksum = element.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME); | ||
21301 | existingChecksum = existingChecksum && parseInt(existingChecksum, 10); | ||
21302 | var markupChecksum = adler32(markup); | ||
21303 | return markupChecksum === existingChecksum; | ||
21304 | } | ||
21305 | }; | ||
21306 | |||
21307 | module.exports = ReactMarkupChecksum; | ||
18740 | 21308 | ||
18741 | /***/ }, | 21309 | /***/ }, |
18742 | /* 150 */ | 21310 | /* 173 */ |
18743 | /***/ function(module, exports, __webpack_require__) { | 21311 | /***/ function(module, exports) { |
18744 | 21312 | ||
18745 | /** | 21313 | /** |
18746 | * Copyright 2013-2015, Facebook, Inc. | 21314 | * Copyright 2013-present, Facebook, Inc. |
18747 | * All rights reserved. | 21315 | * All rights reserved. |
18748 | * | 21316 | * |
18749 | * This source code is licensed under the BSD-style license found in the | 21317 | * This source code is licensed under the BSD-style license found in the |
18750 | * LICENSE file in the root directory of this source tree. An additional grant | 21318 | * LICENSE file in the root directory of this source tree. An additional grant |
18751 | * of patent rights can be found in the PATENTS file in the same directory. | 21319 | * of patent rights can be found in the PATENTS file in the same directory. |
18752 | * | 21320 | * |
18753 | * @providesModule ReactDOMServer | 21321 | * @providesModule adler32 |
21322 | * | ||
18754 | */ | 21323 | */ |
18755 | 21324 | ||
18756 | 'use strict'; | 21325 | 'use strict'; |
18757 | 21326 | ||
18758 | var ReactDefaultInjection = __webpack_require__(73); | 21327 | var MOD = 65521; |
18759 | var ReactServerRendering = __webpack_require__(151); | ||
18760 | var ReactVersion = __webpack_require__(148); | ||
18761 | |||
18762 | ReactDefaultInjection.inject(); | ||
18763 | 21328 | ||
18764 | var ReactDOMServer = { | 21329 | // adler32 is not cryptographically strong, and is only used to sanity check that |
18765 | renderToString: ReactServerRendering.renderToString, | 21330 | // markup generated on the server matches the markup generated on the client. |
18766 | renderToStaticMarkup: ReactServerRendering.renderToStaticMarkup, | 21331 | // This implementation (a modified version of the SheetJS version) has been optimized |
18767 | version: ReactVersion | 21332 | // for our use case, at the expense of conforming to the adler32 specification |
18768 | }; | 21333 | // for non-ascii inputs. |
21334 | function adler32(data) { | ||
21335 | var a = 1; | ||
21336 | var b = 0; | ||
21337 | var i = 0; | ||
21338 | var l = data.length; | ||
21339 | var m = l & ~0x3; | ||
21340 | while (i < m) { | ||
21341 | var n = Math.min(i + 4096, m); | ||
21342 | for (; i < n; i += 4) { | ||
21343 | b += (a += data.charCodeAt(i)) + (a += data.charCodeAt(i + 1)) + (a += data.charCodeAt(i + 2)) + (a += data.charCodeAt(i + 3)); | ||
21344 | } | ||
21345 | a %= MOD; | ||
21346 | b %= MOD; | ||
21347 | } | ||
21348 | for (; i < l; i++) { | ||
21349 | b += a += data.charCodeAt(i); | ||
21350 | } | ||
21351 | a %= MOD; | ||
21352 | b %= MOD; | ||
21353 | return a | b << 16; | ||
21354 | } | ||
18769 | 21355 | ||
18770 | module.exports = ReactDOMServer; | 21356 | module.exports = adler32; |
18771 | 21357 | ||
18772 | /***/ }, | 21358 | /***/ }, |
18773 | /* 151 */ | 21359 | /* 174 */ |
18774 | /***/ function(module, exports, __webpack_require__) { | 21360 | /***/ function(module, exports, __webpack_require__) { |
18775 | 21361 | ||
18776 | /* WEBPACK VAR INJECTION */(function(process) {/** | 21362 | /* WEBPACK VAR INJECTION */(function(process) {/** |
18777 | * Copyright 2013-2015, Facebook, Inc. | 21363 | * Copyright 2013-present, Facebook, Inc. |
18778 | * All rights reserved. | 21364 | * All rights reserved. |
18779 | * | 21365 | * |
18780 | * This source code is licensed under the BSD-style license found in the | 21366 | * This source code is licensed under the BSD-style license found in the |
18781 | * LICENSE file in the root directory of this source tree. An additional grant | 21367 | * LICENSE file in the root directory of this source tree. An additional grant |
18782 | * of patent rights can be found in the PATENTS file in the same directory. | 21368 | * of patent rights can be found in the PATENTS file in the same directory. |
18783 | * | 21369 | * |
18784 | * @typechecks static-only | 21370 | * @providesModule findDOMNode |
18785 | * @providesModule ReactServerRendering | ||
18786 | */ | 21371 | */ |
18787 | 'use strict'; | ||
18788 | |||
18789 | var ReactDefaultBatchingStrategy = __webpack_require__(94); | ||
18790 | var ReactElement = __webpack_require__(44); | ||
18791 | var ReactInstanceHandles = __webpack_require__(47); | ||
18792 | var ReactMarkupChecksum = __webpack_require__(50); | ||
18793 | var ReactServerBatchingStrategy = __webpack_require__(152); | ||
18794 | var ReactServerRenderingTransaction = __webpack_require__(153); | ||
18795 | var ReactUpdates = __webpack_require__(56); | ||
18796 | 21372 | ||
18797 | var emptyObject = __webpack_require__(60); | 21373 | 'use strict'; |
18798 | var instantiateReactComponent = __webpack_require__(64); | ||
18799 | var invariant = __webpack_require__(15); | ||
18800 | |||
18801 | /** | ||
18802 | * @param {ReactElement} element | ||
18803 | * @return {string} the HTML markup | ||
18804 | */ | ||
18805 | function renderToString(element) { | ||
18806 | !ReactElement.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'renderToString(): You must pass a valid ReactElement.') : invariant(false) : undefined; | ||
18807 | 21374 | ||
18808 | var transaction; | 21375 | var _prodInvariant = __webpack_require__(9); |
18809 | try { | ||
18810 | ReactUpdates.injection.injectBatchingStrategy(ReactServerBatchingStrategy); | ||
18811 | 21376 | ||
18812 | var id = ReactInstanceHandles.createReactRootID(); | 21377 | var ReactCurrentOwner = __webpack_require__(12); |
18813 | transaction = ReactServerRenderingTransaction.getPooled(false); | 21378 | var ReactDOMComponentTree = __webpack_require__(39); |
21379 | var ReactInstanceMap = __webpack_require__(126); | ||
18814 | 21380 | ||
18815 | return transaction.perform(function () { | 21381 | var getHostComponentFromComposite = __webpack_require__(175); |
18816 | var componentInstance = instantiateReactComponent(element, null); | 21382 | var invariant = __webpack_require__(10); |
18817 | var markup = componentInstance.mountComponent(id, transaction, emptyObject); | 21383 | var warning = __webpack_require__(13); |
18818 | return ReactMarkupChecksum.addChecksumToMarkup(markup); | ||
18819 | }, null); | ||
18820 | } finally { | ||
18821 | ReactServerRenderingTransaction.release(transaction); | ||
18822 | // Revert to the DOM batching strategy since these two renderers | ||
18823 | // currently share these stateful modules. | ||
18824 | ReactUpdates.injection.injectBatchingStrategy(ReactDefaultBatchingStrategy); | ||
18825 | } | ||
18826 | } | ||
18827 | 21384 | ||
18828 | /** | 21385 | /** |
18829 | * @param {ReactElement} element | 21386 | * Returns the DOM node rendered by this element. |
18830 | * @return {string} the HTML markup, without the extra React ID and checksum | 21387 | * |
18831 | * (for generating static pages) | 21388 | * See https://facebook.github.io/react/docs/top-level-api.html#reactdom.finddomnode |
21389 | * | ||
21390 | * @param {ReactComponent|DOMElement} componentOrElement | ||
21391 | * @return {?DOMElement} The root node of this element. | ||
18832 | */ | 21392 | */ |
18833 | function renderToStaticMarkup(element) { | 21393 | function findDOMNode(componentOrElement) { |
18834 | !ReactElement.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'renderToStaticMarkup(): You must pass a valid ReactElement.') : invariant(false) : undefined; | 21394 | if (process.env.NODE_ENV !== 'production') { |
18835 | 21395 | var owner = ReactCurrentOwner.current; | |
18836 | var transaction; | 21396 | if (owner !== null) { |
18837 | try { | 21397 | 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; |
18838 | ReactUpdates.injection.injectBatchingStrategy(ReactServerBatchingStrategy); | 21398 | owner._warnedAboutRefsInRender = true; |
21399 | } | ||
21400 | } | ||
21401 | if (componentOrElement == null) { | ||
21402 | return null; | ||
21403 | } | ||
21404 | if (componentOrElement.nodeType === 1) { | ||
21405 | return componentOrElement; | ||
21406 | } | ||
18839 | 21407 | ||
18840 | var id = ReactInstanceHandles.createReactRootID(); | 21408 | var inst = ReactInstanceMap.get(componentOrElement); |
18841 | transaction = ReactServerRenderingTransaction.getPooled(true); | 21409 | if (inst) { |
21410 | inst = getHostComponentFromComposite(inst); | ||
21411 | return inst ? ReactDOMComponentTree.getNodeFromInstance(inst) : null; | ||
21412 | } | ||
18842 | 21413 | ||
18843 | return transaction.perform(function () { | 21414 | if (typeof componentOrElement.render === 'function') { |
18844 | var componentInstance = instantiateReactComponent(element, null); | 21415 | true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findDOMNode was called on an unmounted component.') : _prodInvariant('44') : void 0; |
18845 | return componentInstance.mountComponent(id, transaction, emptyObject); | 21416 | } else { |
18846 | }, null); | 21417 | 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; |
18847 | } finally { | ||
18848 | ReactServerRenderingTransaction.release(transaction); | ||
18849 | // Revert to the DOM batching strategy since these two renderers | ||
18850 | // currently share these stateful modules. | ||
18851 | ReactUpdates.injection.injectBatchingStrategy(ReactDefaultBatchingStrategy); | ||
18852 | } | 21418 | } |
18853 | } | 21419 | } |
18854 | 21420 | ||
18855 | module.exports = { | 21421 | module.exports = findDOMNode; |
18856 | renderToString: renderToString, | 21422 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) |
18857 | renderToStaticMarkup: renderToStaticMarkup | ||
18858 | }; | ||
18859 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
18860 | 21423 | ||
18861 | /***/ }, | 21424 | /***/ }, |
18862 | /* 152 */ | 21425 | /* 175 */ |
18863 | /***/ function(module, exports) { | 21426 | /***/ function(module, exports, __webpack_require__) { |
18864 | 21427 | ||
18865 | /** | 21428 | /** |
18866 | * Copyright 2014-2015, Facebook, Inc. | 21429 | * Copyright 2013-present, Facebook, Inc. |
18867 | * All rights reserved. | 21430 | * All rights reserved. |
18868 | * | 21431 | * |
18869 | * This source code is licensed under the BSD-style license found in the | 21432 | * This source code is licensed under the BSD-style license found in the |
18870 | * LICENSE file in the root directory of this source tree. An additional grant | 21433 | * LICENSE file in the root directory of this source tree. An additional grant |
18871 | * of patent rights can be found in the PATENTS file in the same directory. | 21434 | * of patent rights can be found in the PATENTS file in the same directory. |
18872 | * | 21435 | * |
18873 | * @providesModule ReactServerBatchingStrategy | 21436 | * @providesModule getHostComponentFromComposite |
18874 | * @typechecks | ||
18875 | */ | 21437 | */ |
18876 | 21438 | ||
18877 | 'use strict'; | 21439 | 'use strict'; |
18878 | 21440 | ||
18879 | var ReactServerBatchingStrategy = { | 21441 | var ReactNodeTypes = __webpack_require__(130); |
18880 | isBatchingUpdates: false, | 21442 | |
18881 | batchedUpdates: function (callback) { | 21443 | function getHostComponentFromComposite(inst) { |
18882 | // Don't do anything here. During the server rendering we don't want to | 21444 | var type; |
18883 | // schedule any updates. We will simply ignore them. | 21445 | |
21446 | while ((type = inst._renderedNodeType) === ReactNodeTypes.COMPOSITE) { | ||
21447 | inst = inst._renderedComponent; | ||
18884 | } | 21448 | } |
18885 | }; | ||
18886 | 21449 | ||
18887 | module.exports = ReactServerBatchingStrategy; | 21450 | if (type === ReactNodeTypes.HOST) { |
21451 | return inst._renderedComponent; | ||
21452 | } else if (type === ReactNodeTypes.EMPTY) { | ||
21453 | return null; | ||
21454 | } | ||
21455 | } | ||
21456 | |||
21457 | module.exports = getHostComponentFromComposite; | ||
18888 | 21458 | ||
18889 | /***/ }, | 21459 | /***/ }, |
18890 | /* 153 */ | 21460 | /* 176 */ |
18891 | /***/ function(module, exports, __webpack_require__) { | 21461 | /***/ function(module, exports, __webpack_require__) { |
18892 | 21462 | ||
18893 | /** | 21463 | /** |
18894 | * Copyright 2014-2015, Facebook, Inc. | 21464 | * Copyright 2013-present, Facebook, Inc. |
18895 | * All rights reserved. | 21465 | * All rights reserved. |
18896 | * | 21466 | * |
18897 | * This source code is licensed under the BSD-style license found in the | 21467 | * This source code is licensed under the BSD-style license found in the |
18898 | * LICENSE file in the root directory of this source tree. An additional grant | 21468 | * LICENSE file in the root directory of this source tree. An additional grant |
18899 | * of patent rights can be found in the PATENTS file in the same directory. | 21469 | * of patent rights can be found in the PATENTS file in the same directory. |
18900 | * | 21470 | * |
18901 | * @providesModule ReactServerRenderingTransaction | 21471 | * @providesModule renderSubtreeIntoContainer |
18902 | * @typechecks | 21472 | */ |
18903 | */ | ||
18904 | 21473 | ||
18905 | 'use strict'; | 21474 | 'use strict'; |
18906 | 21475 | ||
18907 | var PooledClass = __webpack_require__(58); | 21476 | var ReactMount = __webpack_require__(169); |
18908 | var CallbackQueue = __webpack_require__(57); | ||
18909 | var Transaction = __webpack_require__(59); | ||
18910 | 21477 | ||
18911 | var assign = __webpack_require__(41); | 21478 | module.exports = ReactMount.renderSubtreeIntoContainer; |
18912 | var emptyFunction = __webpack_require__(17); | 21479 | |
21480 | /***/ }, | ||
21481 | /* 177 */ | ||
21482 | /***/ function(module, exports) { | ||
21483 | |||
21484 | //! moment.js | ||
21485 | //! version : 2.14.1 | ||
21486 | //! authors : Tim Wood, Iskren Chernev, Moment.js contributors | ||
21487 | //! license : MIT | ||
21488 | //! momentjs.com | ||
18913 | 21489 | ||
18914 | /** | 21490 | ;(function (global, factory) { |
18915 | * Provides a `CallbackQueue` queue for collecting `onDOMReady` callbacks | 21491 | typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : |
18916 | * during the performing of the transaction. | 21492 | typeof define === 'function' && define.amd ? define(factory) : |
18917 | */ | 21493 | global.moment = factory() |
18918 | var ON_DOM_READY_QUEUEING = { | 21494 | }(this, function () { 'use strict'; |
18919 | /** | ||
18920 | * Initializes the internal `onDOMReady` queue. | ||
18921 | */ | ||
18922 | initialize: function () { | ||
18923 | this.reactMountReady.reset(); | ||
18924 | }, | ||
18925 | 21495 | ||
18926 | close: emptyFunction | 21496 | var hookCallback; |
18927 | }; | ||
18928 | 21497 | ||
18929 | /** | 21498 | function utils_hooks__hooks () { |
18930 | * Executed within the scope of the `Transaction` instance. Consider these as | 21499 | return hookCallback.apply(null, arguments); |
18931 | * being member methods, but with an implied ordering while being isolated from | 21500 | } |
18932 | * each other. | ||
18933 | */ | ||
18934 | var TRANSACTION_WRAPPERS = [ON_DOM_READY_QUEUEING]; | ||
18935 | 21501 | ||
18936 | /** | 21502 | // This is done to register the method called with moment() |
18937 | * @class ReactServerRenderingTransaction | 21503 | // without creating circular dependencies. |
18938 | * @param {boolean} renderToStaticMarkup | 21504 | function setHookCallback (callback) { |
18939 | */ | 21505 | hookCallback = callback; |
18940 | function ReactServerRenderingTransaction(renderToStaticMarkup) { | 21506 | } |
18941 | this.reinitializeTransaction(); | ||
18942 | this.renderToStaticMarkup = renderToStaticMarkup; | ||
18943 | this.reactMountReady = CallbackQueue.getPooled(null); | ||
18944 | this.useCreateElement = false; | ||
18945 | } | ||
18946 | 21507 | ||
18947 | var Mixin = { | 21508 | function isArray(input) { |
18948 | /** | 21509 | return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]'; |
18949 | * @see Transaction | 21510 | } |
18950 | * @abstract | ||
18951 | * @final | ||
18952 | * @return {array} Empty list of operation wrap procedures. | ||
18953 | */ | ||
18954 | getTransactionWrappers: function () { | ||
18955 | return TRANSACTION_WRAPPERS; | ||
18956 | }, | ||
18957 | 21511 | ||
18958 | /** | 21512 | function isObject(input) { |
18959 | * @return {object} The queue to collect `onDOMReady` callbacks with. | 21513 | return Object.prototype.toString.call(input) === '[object Object]'; |
18960 | */ | 21514 | } |
18961 | getReactMountReady: function () { | ||
18962 | return this.reactMountReady; | ||
18963 | }, | ||
18964 | 21515 | ||
18965 | /** | 21516 | function isObjectEmpty(obj) { |
18966 | * `PooledClass` looks for this, and will invoke this before allowing this | 21517 | var k; |
18967 | * instance to be reused. | 21518 | for (k in obj) { |
18968 | */ | 21519 | // even if its not own property I'd still call it non-empty |
18969 | destructor: function () { | 21520 | return false; |
18970 | CallbackQueue.release(this.reactMountReady); | 21521 | } |
18971 | this.reactMountReady = null; | 21522 | return true; |
18972 | } | 21523 | } |
18973 | }; | ||
18974 | 21524 | ||
18975 | assign(ReactServerRenderingTransaction.prototype, Transaction.Mixin, Mixin); | 21525 | function isDate(input) { |
21526 | return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]'; | ||
21527 | } | ||
18976 | 21528 | ||
18977 | PooledClass.addPoolingTo(ReactServerRenderingTransaction); | 21529 | function map(arr, fn) { |
21530 | var res = [], i; | ||
21531 | for (i = 0; i < arr.length; ++i) { | ||
21532 | res.push(fn(arr[i], i)); | ||
21533 | } | ||
21534 | return res; | ||
21535 | } | ||
18978 | 21536 | ||
18979 | module.exports = ReactServerRenderingTransaction; | 21537 | function hasOwnProp(a, b) { |
18980 | 21538 | return Object.prototype.hasOwnProperty.call(a, b); | |
18981 | /***/ }, | 21539 | } |
18982 | /* 154 */ | ||
18983 | /***/ function(module, exports, __webpack_require__) { | ||
18984 | |||
18985 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
18986 | * Copyright 2013-2015, Facebook, Inc. | ||
18987 | * All rights reserved. | ||
18988 | * | ||
18989 | * This source code is licensed under the BSD-style license found in the | ||
18990 | * LICENSE file in the root directory of this source tree. An additional grant | ||
18991 | * of patent rights can be found in the PATENTS file in the same directory. | ||
18992 | * | ||
18993 | * @providesModule ReactIsomorphic | ||
18994 | */ | ||
18995 | 21540 | ||
18996 | 'use strict'; | 21541 | function extend(a, b) { |
21542 | for (var i in b) { | ||
21543 | if (hasOwnProp(b, i)) { | ||
21544 | a[i] = b[i]; | ||
21545 | } | ||
21546 | } | ||
18997 | 21547 | ||
18998 | var ReactChildren = __webpack_require__(112); | 21548 | if (hasOwnProp(b, 'toString')) { |
18999 | var ReactComponent = __webpack_require__(125); | 21549 | a.toString = b.toString; |
19000 | var ReactClass = __webpack_require__(124); | 21550 | } |
19001 | var ReactDOMFactories = __webpack_require__(155); | ||
19002 | var ReactElement = __webpack_require__(44); | ||
19003 | var ReactElementValidator = __webpack_require__(156); | ||
19004 | var ReactPropTypes = __webpack_require__(109); | ||
19005 | var ReactVersion = __webpack_require__(148); | ||
19006 | 21551 | ||
19007 | var assign = __webpack_require__(41); | 21552 | if (hasOwnProp(b, 'valueOf')) { |
19008 | var onlyChild = __webpack_require__(158); | 21553 | a.valueOf = b.valueOf; |
21554 | } | ||
19009 | 21555 | ||
19010 | var createElement = ReactElement.createElement; | 21556 | return a; |
19011 | var createFactory = ReactElement.createFactory; | 21557 | } |
19012 | var cloneElement = ReactElement.cloneElement; | ||
19013 | 21558 | ||
19014 | if (process.env.NODE_ENV !== 'production') { | 21559 | function create_utc__createUTC (input, format, locale, strict) { |
19015 | createElement = ReactElementValidator.createElement; | 21560 | return createLocalOrUTC(input, format, locale, strict, true).utc(); |
19016 | createFactory = ReactElementValidator.createFactory; | 21561 | } |
19017 | cloneElement = ReactElementValidator.cloneElement; | ||
19018 | } | ||
19019 | 21562 | ||
19020 | var React = { | 21563 | function defaultParsingFlags() { |
21564 | // We need to deep clone this object. | ||
21565 | return { | ||
21566 | empty : false, | ||
21567 | unusedTokens : [], | ||
21568 | unusedInput : [], | ||
21569 | overflow : -2, | ||
21570 | charsLeftOver : 0, | ||
21571 | nullInput : false, | ||
21572 | invalidMonth : null, | ||
21573 | invalidFormat : false, | ||
21574 | userInvalidated : false, | ||
21575 | iso : false, | ||
21576 | parsedDateParts : [], | ||
21577 | meridiem : null | ||
21578 | }; | ||
21579 | } | ||
19021 | 21580 | ||
19022 | // Modern | 21581 | function getParsingFlags(m) { |
21582 | if (m._pf == null) { | ||
21583 | m._pf = defaultParsingFlags(); | ||
21584 | } | ||
21585 | return m._pf; | ||
21586 | } | ||
19023 | 21587 | ||
19024 | Children: { | 21588 | var some; |
19025 | map: ReactChildren.map, | 21589 | if (Array.prototype.some) { |
19026 | forEach: ReactChildren.forEach, | 21590 | some = Array.prototype.some; |
19027 | count: ReactChildren.count, | 21591 | } else { |
19028 | toArray: ReactChildren.toArray, | 21592 | some = function (fun) { |
19029 | only: onlyChild | 21593 | var t = Object(this); |
19030 | }, | 21594 | var len = t.length >>> 0; |
19031 | 21595 | ||
19032 | Component: ReactComponent, | 21596 | for (var i = 0; i < len; i++) { |
21597 | if (i in t && fun.call(this, t[i], i, t)) { | ||
21598 | return true; | ||
21599 | } | ||
21600 | } | ||
19033 | 21601 | ||
19034 | createElement: createElement, | 21602 | return false; |
19035 | cloneElement: cloneElement, | 21603 | }; |
19036 | isValidElement: ReactElement.isValidElement, | 21604 | } |
19037 | 21605 | ||
19038 | // Classic | 21606 | function valid__isValid(m) { |
21607 | if (m._isValid == null) { | ||
21608 | var flags = getParsingFlags(m); | ||
21609 | var parsedParts = some.call(flags.parsedDateParts, function (i) { | ||
21610 | return i != null; | ||
21611 | }); | ||
21612 | m._isValid = !isNaN(m._d.getTime()) && | ||
21613 | flags.overflow < 0 && | ||
21614 | !flags.empty && | ||
21615 | !flags.invalidMonth && | ||
21616 | !flags.invalidWeekday && | ||
21617 | !flags.nullInput && | ||
21618 | !flags.invalidFormat && | ||
21619 | !flags.userInvalidated && | ||
21620 | (!flags.meridiem || (flags.meridiem && parsedParts)); | ||
21621 | |||
21622 | if (m._strict) { | ||
21623 | m._isValid = m._isValid && | ||
21624 | flags.charsLeftOver === 0 && | ||
21625 | flags.unusedTokens.length === 0 && | ||
21626 | flags.bigHour === undefined; | ||
21627 | } | ||
21628 | } | ||
21629 | return m._isValid; | ||
21630 | } | ||
19039 | 21631 | ||
19040 | PropTypes: ReactPropTypes, | 21632 | function valid__createInvalid (flags) { |
19041 | createClass: ReactClass.createClass, | 21633 | var m = create_utc__createUTC(NaN); |
19042 | createFactory: createFactory, | 21634 | if (flags != null) { |
19043 | createMixin: function (mixin) { | 21635 | extend(getParsingFlags(m), flags); |
19044 | // Currently a noop. Will be used to validate and trace mixins. | 21636 | } |
19045 | return mixin; | 21637 | else { |
19046 | }, | 21638 | getParsingFlags(m).userInvalidated = true; |
21639 | } | ||
19047 | 21640 | ||
19048 | // This looks DOM specific but these are actually isomorphic helpers | 21641 | return m; |
19049 | // since they are just generating DOM strings. | 21642 | } |
19050 | DOM: ReactDOMFactories, | ||
19051 | 21643 | ||
19052 | version: ReactVersion, | 21644 | function isUndefined(input) { |
21645 | return input === void 0; | ||
21646 | } | ||
19053 | 21647 | ||
19054 | // Hook for JSX spread, don't use this for anything else. | 21648 | // Plugins that add properties should also add the key here (null value), |
19055 | __spread: assign | 21649 | // so we can properly clone ourselves. |
19056 | }; | 21650 | var momentProperties = utils_hooks__hooks.momentProperties = []; |
19057 | 21651 | ||
19058 | module.exports = React; | 21652 | function copyConfig(to, from) { |
19059 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | 21653 | var i, prop, val; |
19060 | |||
19061 | /***/ }, | ||
19062 | /* 155 */ | ||
19063 | /***/ function(module, exports, __webpack_require__) { | ||
19064 | |||
19065 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
19066 | * Copyright 2013-2015, Facebook, Inc. | ||
19067 | * All rights reserved. | ||
19068 | * | ||
19069 | * This source code is licensed under the BSD-style license found in the | ||
19070 | * LICENSE file in the root directory of this source tree. An additional grant | ||
19071 | * of patent rights can be found in the PATENTS file in the same directory. | ||
19072 | * | ||
19073 | * @providesModule ReactDOMFactories | ||
19074 | * @typechecks static-only | ||
19075 | */ | ||
19076 | 21654 | ||
19077 | 'use strict'; | 21655 | if (!isUndefined(from._isAMomentObject)) { |
21656 | to._isAMomentObject = from._isAMomentObject; | ||
21657 | } | ||
21658 | if (!isUndefined(from._i)) { | ||
21659 | to._i = from._i; | ||
21660 | } | ||
21661 | if (!isUndefined(from._f)) { | ||
21662 | to._f = from._f; | ||
21663 | } | ||
21664 | if (!isUndefined(from._l)) { | ||
21665 | to._l = from._l; | ||
21666 | } | ||
21667 | if (!isUndefined(from._strict)) { | ||
21668 | to._strict = from._strict; | ||
21669 | } | ||
21670 | if (!isUndefined(from._tzm)) { | ||
21671 | to._tzm = from._tzm; | ||
21672 | } | ||
21673 | if (!isUndefined(from._isUTC)) { | ||
21674 | to._isUTC = from._isUTC; | ||
21675 | } | ||
21676 | if (!isUndefined(from._offset)) { | ||
21677 | to._offset = from._offset; | ||
21678 | } | ||
21679 | if (!isUndefined(from._pf)) { | ||
21680 | to._pf = getParsingFlags(from); | ||
21681 | } | ||
21682 | if (!isUndefined(from._locale)) { | ||
21683 | to._locale = from._locale; | ||
21684 | } | ||
19078 | 21685 | ||
19079 | var ReactElement = __webpack_require__(44); | 21686 | if (momentProperties.length > 0) { |
19080 | var ReactElementValidator = __webpack_require__(156); | 21687 | for (i in momentProperties) { |
21688 | prop = momentProperties[i]; | ||
21689 | val = from[prop]; | ||
21690 | if (!isUndefined(val)) { | ||
21691 | to[prop] = val; | ||
21692 | } | ||
21693 | } | ||
21694 | } | ||
19081 | 21695 | ||
19082 | var mapObject = __webpack_require__(157); | 21696 | return to; |
21697 | } | ||
19083 | 21698 | ||
19084 | /** | 21699 | var updateInProgress = false; |
19085 | * Create a factory that creates HTML tag elements. | ||
19086 | * | ||
19087 | * @param {string} tag Tag name (e.g. `div`). | ||
19088 | * @private | ||
19089 | */ | ||
19090 | function createDOMFactory(tag) { | ||
19091 | if (process.env.NODE_ENV !== 'production') { | ||
19092 | return ReactElementValidator.createFactory(tag); | ||
19093 | } | ||
19094 | return ReactElement.createFactory(tag); | ||
19095 | } | ||
19096 | 21700 | ||
19097 | /** | 21701 | // Moment prototype object |
19098 | * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes. | 21702 | function Moment(config) { |
19099 | * This is also accessible via `React.DOM`. | 21703 | copyConfig(this, config); |
19100 | * | 21704 | this._d = new Date(config._d != null ? config._d.getTime() : NaN); |
19101 | * @public | 21705 | // Prevent infinite loop in case updateOffset creates new moment |
19102 | */ | 21706 | // objects. |
19103 | var ReactDOMFactories = mapObject({ | 21707 | if (updateInProgress === false) { |
19104 | a: 'a', | 21708 | updateInProgress = true; |
19105 | abbr: 'abbr', | 21709 | utils_hooks__hooks.updateOffset(this); |
19106 | address: 'address', | 21710 | updateInProgress = false; |
19107 | area: 'area', | 21711 | } |
19108 | article: 'article', | 21712 | } |
19109 | aside: 'aside', | ||
19110 | audio: 'audio', | ||
19111 | b: 'b', | ||
19112 | base: 'base', | ||
19113 | bdi: 'bdi', | ||
19114 | bdo: 'bdo', | ||
19115 | big: 'big', | ||
19116 | blockquote: 'blockquote', | ||
19117 | body: 'body', | ||
19118 | br: 'br', | ||
19119 | button: 'button', | ||
19120 | canvas: 'canvas', | ||
19121 | caption: 'caption', | ||
19122 | cite: 'cite', | ||
19123 | code: 'code', | ||
19124 | col: 'col', | ||
19125 | colgroup: 'colgroup', | ||
19126 | data: 'data', | ||
19127 | datalist: 'datalist', | ||
19128 | dd: 'dd', | ||
19129 | del: 'del', | ||
19130 | details: 'details', | ||
19131 | dfn: 'dfn', | ||
19132 | dialog: 'dialog', | ||
19133 | div: 'div', | ||
19134 | dl: 'dl', | ||
19135 | dt: 'dt', | ||
19136 | em: 'em', | ||
19137 | embed: 'embed', | ||
19138 | fieldset: 'fieldset', | ||
19139 | figcaption: 'figcaption', | ||
19140 | figure: 'figure', | ||
19141 | footer: 'footer', | ||
19142 | form: 'form', | ||
19143 | h1: 'h1', | ||
19144 | h2: 'h2', | ||
19145 | h3: 'h3', | ||
19146 | h4: 'h4', | ||
19147 | h5: 'h5', | ||
19148 | h6: 'h6', | ||
19149 | head: 'head', | ||
19150 | header: 'header', | ||
19151 | hgroup: 'hgroup', | ||
19152 | hr: 'hr', | ||
19153 | html: 'html', | ||
19154 | i: 'i', | ||
19155 | iframe: 'iframe', | ||
19156 | img: 'img', | ||
19157 | input: 'input', | ||
19158 | ins: 'ins', | ||
19159 | kbd: 'kbd', | ||
19160 | keygen: 'keygen', | ||
19161 | label: 'label', | ||
19162 | legend: 'legend', | ||
19163 | li: 'li', | ||
19164 | link: 'link', | ||
19165 | main: 'main', | ||
19166 | map: 'map', | ||
19167 | mark: 'mark', | ||
19168 | menu: 'menu', | ||
19169 | menuitem: 'menuitem', | ||
19170 | meta: 'meta', | ||
19171 | meter: 'meter', | ||
19172 | nav: 'nav', | ||
19173 | noscript: 'noscript', | ||
19174 | object: 'object', | ||
19175 | ol: 'ol', | ||
19176 | optgroup: 'optgroup', | ||
19177 | option: 'option', | ||
19178 | output: 'output', | ||
19179 | p: 'p', | ||
19180 | param: 'param', | ||
19181 | picture: 'picture', | ||
19182 | pre: 'pre', | ||
19183 | progress: 'progress', | ||
19184 | q: 'q', | ||
19185 | rp: 'rp', | ||
19186 | rt: 'rt', | ||
19187 | ruby: 'ruby', | ||
19188 | s: 's', | ||
19189 | samp: 'samp', | ||
19190 | script: 'script', | ||
19191 | section: 'section', | ||
19192 | select: 'select', | ||
19193 | small: 'small', | ||
19194 | source: 'source', | ||
19195 | span: 'span', | ||
19196 | strong: 'strong', | ||
19197 | style: 'style', | ||
19198 | sub: 'sub', | ||
19199 | summary: 'summary', | ||
19200 | sup: 'sup', | ||
19201 | table: 'table', | ||
19202 | tbody: 'tbody', | ||
19203 | td: 'td', | ||
19204 | textarea: 'textarea', | ||
19205 | tfoot: 'tfoot', | ||
19206 | th: 'th', | ||
19207 | thead: 'thead', | ||
19208 | time: 'time', | ||
19209 | title: 'title', | ||
19210 | tr: 'tr', | ||
19211 | track: 'track', | ||
19212 | u: 'u', | ||
19213 | ul: 'ul', | ||
19214 | 'var': 'var', | ||
19215 | video: 'video', | ||
19216 | wbr: 'wbr', | ||
19217 | 21713 | ||
19218 | // SVG | 21714 | function isMoment (obj) { |
19219 | circle: 'circle', | 21715 | return obj instanceof Moment || (obj != null && obj._isAMomentObject != null); |
19220 | clipPath: 'clipPath', | 21716 | } |
19221 | defs: 'defs', | ||
19222 | ellipse: 'ellipse', | ||
19223 | g: 'g', | ||
19224 | image: 'image', | ||
19225 | line: 'line', | ||
19226 | linearGradient: 'linearGradient', | ||
19227 | mask: 'mask', | ||
19228 | path: 'path', | ||
19229 | pattern: 'pattern', | ||
19230 | polygon: 'polygon', | ||
19231 | polyline: 'polyline', | ||
19232 | radialGradient: 'radialGradient', | ||
19233 | rect: 'rect', | ||
19234 | stop: 'stop', | ||
19235 | svg: 'svg', | ||
19236 | text: 'text', | ||
19237 | tspan: 'tspan' | ||
19238 | 21717 | ||
19239 | }, createDOMFactory); | 21718 | function absFloor (number) { |
21719 | if (number < 0) { | ||
21720 | // -0 -> 0 | ||
21721 | return Math.ceil(number) || 0; | ||
21722 | } else { | ||
21723 | return Math.floor(number); | ||
21724 | } | ||
21725 | } | ||
19240 | 21726 | ||
19241 | module.exports = ReactDOMFactories; | 21727 | function toInt(argumentForCoercion) { |
19242 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | 21728 | var coercedNumber = +argumentForCoercion, |
19243 | 21729 | value = 0; | |
19244 | /***/ }, | ||
19245 | /* 156 */ | ||
19246 | /***/ function(module, exports, __webpack_require__) { | ||
19247 | |||
19248 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
19249 | * Copyright 2014-2015, Facebook, Inc. | ||
19250 | * All rights reserved. | ||
19251 | * | ||
19252 | * This source code is licensed under the BSD-style license found in the | ||
19253 | * LICENSE file in the root directory of this source tree. An additional grant | ||
19254 | * of patent rights can be found in the PATENTS file in the same directory. | ||
19255 | * | ||
19256 | * @providesModule ReactElementValidator | ||
19257 | */ | ||
19258 | 21730 | ||
19259 | /** | 21731 | if (coercedNumber !== 0 && isFinite(coercedNumber)) { |
19260 | * ReactElementValidator provides a wrapper around a element factory | 21732 | value = absFloor(coercedNumber); |
19261 | * which validates the props passed to the element. This is intended to be | 21733 | } |
19262 | * used only in DEV and could be replaced by a static type checker for languages | ||
19263 | * that support it. | ||
19264 | */ | ||
19265 | 21734 | ||
19266 | 'use strict'; | 21735 | return value; |
21736 | } | ||
19267 | 21737 | ||
19268 | var ReactElement = __webpack_require__(44); | 21738 | // compare two arrays, return the number of differences |
19269 | var ReactPropTypeLocations = __webpack_require__(67); | 21739 | function compareArrays(array1, array2, dontConvert) { |
19270 | var ReactPropTypeLocationNames = __webpack_require__(68); | 21740 | var len = Math.min(array1.length, array2.length), |
19271 | var ReactCurrentOwner = __webpack_require__(7); | 21741 | lengthDiff = Math.abs(array1.length - array2.length), |
21742 | diffs = 0, | ||
21743 | i; | ||
21744 | for (i = 0; i < len; i++) { | ||
21745 | if ((dontConvert && array1[i] !== array2[i]) || | ||
21746 | (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) { | ||
21747 | diffs++; | ||
21748 | } | ||
21749 | } | ||
21750 | return diffs + lengthDiff; | ||
21751 | } | ||
19272 | 21752 | ||
19273 | var canDefineProperty = __webpack_require__(45); | 21753 | function warn(msg) { |
19274 | var getIteratorFn = __webpack_require__(110); | 21754 | if (utils_hooks__hooks.suppressDeprecationWarnings === false && |
19275 | var invariant = __webpack_require__(15); | 21755 | (typeof console !== 'undefined') && console.warn) { |
19276 | var warning = __webpack_require__(27); | 21756 | console.warn('Deprecation warning: ' + msg); |
21757 | } | ||
21758 | } | ||
19277 | 21759 | ||
19278 | function getDeclarationErrorAddendum() { | 21760 | function deprecate(msg, fn) { |
19279 | if (ReactCurrentOwner.current) { | 21761 | var firstTime = true; |
19280 | var name = ReactCurrentOwner.current.getName(); | 21762 | |
19281 | if (name) { | 21763 | return extend(function () { |
19282 | return ' Check the render method of `' + name + '`.'; | 21764 | if (utils_hooks__hooks.deprecationHandler != null) { |
21765 | utils_hooks__hooks.deprecationHandler(null, msg); | ||
21766 | } | ||
21767 | if (firstTime) { | ||
21768 | warn(msg + '\nArguments: ' + Array.prototype.slice.call(arguments).join(', ') + '\n' + (new Error()).stack); | ||
21769 | firstTime = false; | ||
21770 | } | ||
21771 | return fn.apply(this, arguments); | ||
21772 | }, fn); | ||
19283 | } | 21773 | } |
19284 | } | ||
19285 | return ''; | ||
19286 | } | ||
19287 | 21774 | ||
19288 | /** | 21775 | var deprecations = {}; |
19289 | * Warn if there's no key explicitly set on dynamic arrays of children or | ||
19290 | * object keys are not valid. This allows us to keep track of children between | ||
19291 | * updates. | ||
19292 | */ | ||
19293 | var ownerHasKeyUseWarning = {}; | ||
19294 | 21776 | ||
19295 | var loggedTypeFailures = {}; | 21777 | function deprecateSimple(name, msg) { |
21778 | if (utils_hooks__hooks.deprecationHandler != null) { | ||
21779 | utils_hooks__hooks.deprecationHandler(name, msg); | ||
21780 | } | ||
21781 | if (!deprecations[name]) { | ||
21782 | warn(msg); | ||
21783 | deprecations[name] = true; | ||
21784 | } | ||
21785 | } | ||
19296 | 21786 | ||
19297 | /** | 21787 | utils_hooks__hooks.suppressDeprecationWarnings = false; |
19298 | * Warn if the element doesn't have an explicit key assigned to it. | 21788 | utils_hooks__hooks.deprecationHandler = null; |
19299 | * This element is in an array. The array could grow and shrink or be | ||
19300 | * reordered. All children that haven't already been validated are required to | ||
19301 | * have a "key" property assigned to it. | ||
19302 | * | ||
19303 | * @internal | ||
19304 | * @param {ReactElement} element Element that requires a key. | ||
19305 | * @param {*} parentType element's parent's type. | ||
19306 | */ | ||
19307 | function validateExplicitKey(element, parentType) { | ||
19308 | if (!element._store || element._store.validated || element.key != null) { | ||
19309 | return; | ||
19310 | } | ||
19311 | element._store.validated = true; | ||
19312 | 21789 | ||
19313 | var addenda = getAddendaForKeyUse('uniqueKey', element, parentType); | 21790 | function isFunction(input) { |
19314 | if (addenda === null) { | 21791 | return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]'; |
19315 | // we already showed the warning | 21792 | } |
19316 | return; | ||
19317 | } | ||
19318 | process.env.NODE_ENV !== 'production' ? warning(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s%s', addenda.parentOrOwner || '', addenda.childOwner || '', addenda.url || '') : undefined; | ||
19319 | } | ||
19320 | 21793 | ||
19321 | /** | 21794 | function locale_set__set (config) { |
19322 | * Shared warning and monitoring code for the key warnings. | 21795 | var prop, i; |
19323 | * | 21796 | for (i in config) { |
19324 | * @internal | 21797 | prop = config[i]; |
19325 | * @param {string} messageType A key used for de-duping warnings. | 21798 | if (isFunction(prop)) { |
19326 | * @param {ReactElement} element Component that requires a key. | 21799 | this[i] = prop; |
19327 | * @param {*} parentType element's parent's type. | 21800 | } else { |
19328 | * @returns {?object} A set of addenda to use in the warning message, or null | 21801 | this['_' + i] = prop; |
19329 | * if the warning has already been shown before (and shouldn't be shown again). | 21802 | } |
19330 | */ | 21803 | } |
19331 | function getAddendaForKeyUse(messageType, element, parentType) { | 21804 | this._config = config; |
19332 | var addendum = getDeclarationErrorAddendum(); | 21805 | // Lenient ordinal parsing accepts just a number in addition to |
19333 | if (!addendum) { | 21806 | // number + (possibly) stuff coming from _ordinalParseLenient. |
19334 | var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name; | 21807 | this._ordinalParseLenient = new RegExp(this._ordinalParse.source + '|' + (/\d{1,2}/).source); |
19335 | if (parentName) { | 21808 | } |
19336 | addendum = ' Check the top-level render call using <' + parentName + '>.'; | 21809 | |
21810 | function mergeConfigs(parentConfig, childConfig) { | ||
21811 | var res = extend({}, parentConfig), prop; | ||
21812 | for (prop in childConfig) { | ||
21813 | if (hasOwnProp(childConfig, prop)) { | ||
21814 | if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) { | ||
21815 | res[prop] = {}; | ||
21816 | extend(res[prop], parentConfig[prop]); | ||
21817 | extend(res[prop], childConfig[prop]); | ||
21818 | } else if (childConfig[prop] != null) { | ||
21819 | res[prop] = childConfig[prop]; | ||
21820 | } else { | ||
21821 | delete res[prop]; | ||
21822 | } | ||
21823 | } | ||
21824 | } | ||
21825 | for (prop in parentConfig) { | ||
21826 | if (hasOwnProp(parentConfig, prop) && | ||
21827 | !hasOwnProp(childConfig, prop) && | ||
21828 | isObject(parentConfig[prop])) { | ||
21829 | // make sure changes to properties don't modify parent config | ||
21830 | res[prop] = extend({}, res[prop]); | ||
21831 | } | ||
21832 | } | ||
21833 | return res; | ||
19337 | } | 21834 | } |
19338 | } | ||
19339 | 21835 | ||
19340 | var memoizer = ownerHasKeyUseWarning[messageType] || (ownerHasKeyUseWarning[messageType] = {}); | 21836 | function Locale(config) { |
19341 | if (memoizer[addendum]) { | 21837 | if (config != null) { |
19342 | return null; | 21838 | this.set(config); |
19343 | } | 21839 | } |
19344 | memoizer[addendum] = true; | 21840 | } |
19345 | 21841 | ||
19346 | var addenda = { | 21842 | var keys; |
19347 | parentOrOwner: addendum, | ||
19348 | url: ' See https://fb.me/react-warning-keys for more information.', | ||
19349 | childOwner: null | ||
19350 | }; | ||
19351 | 21843 | ||
19352 | // Usually the current owner is the offender, but if it accepts children as a | 21844 | if (Object.keys) { |
19353 | // property, it may be the creator of the child that's responsible for | 21845 | keys = Object.keys; |
19354 | // assigning it a key. | 21846 | } else { |
19355 | if (element && element._owner && element._owner !== ReactCurrentOwner.current) { | 21847 | keys = function (obj) { |
19356 | // Give the component that originally created this child. | 21848 | var i, res = []; |
19357 | addenda.childOwner = ' It was passed a child from ' + element._owner.getName() + '.'; | 21849 | for (i in obj) { |
19358 | } | 21850 | if (hasOwnProp(obj, i)) { |
21851 | res.push(i); | ||
21852 | } | ||
21853 | } | ||
21854 | return res; | ||
21855 | }; | ||
21856 | } | ||
19359 | 21857 | ||
19360 | return addenda; | 21858 | var defaultCalendar = { |
19361 | } | 21859 | sameDay : '[Today at] LT', |
21860 | nextDay : '[Tomorrow at] LT', | ||
21861 | nextWeek : 'dddd [at] LT', | ||
21862 | lastDay : '[Yesterday at] LT', | ||
21863 | lastWeek : '[Last] dddd [at] LT', | ||
21864 | sameElse : 'L' | ||
21865 | }; | ||
19362 | 21866 | ||
19363 | /** | 21867 | function locale_calendar__calendar (key, mom, now) { |
19364 | * Ensure that every element either is passed in a static location, in an | 21868 | var output = this._calendar[key] || this._calendar['sameElse']; |
19365 | * array with an explicit keys property defined, or in an object literal | 21869 | return isFunction(output) ? output.call(mom, now) : output; |
19366 | * with valid key property. | ||
19367 | * | ||
19368 | * @internal | ||
19369 | * @param {ReactNode} node Statically passed child of any type. | ||
19370 | * @param {*} parentType node's parent's type. | ||
19371 | */ | ||
19372 | function validateChildKeys(node, parentType) { | ||
19373 | if (typeof node !== 'object') { | ||
19374 | return; | ||
19375 | } | ||
19376 | if (Array.isArray(node)) { | ||
19377 | for (var i = 0; i < node.length; i++) { | ||
19378 | var child = node[i]; | ||
19379 | if (ReactElement.isValidElement(child)) { | ||
19380 | validateExplicitKey(child, parentType); | ||
19381 | } | ||
19382 | } | ||
19383 | } else if (ReactElement.isValidElement(node)) { | ||
19384 | // This element was passed in a valid location. | ||
19385 | if (node._store) { | ||
19386 | node._store.validated = true; | ||
19387 | } | 21870 | } |
19388 | } else if (node) { | 21871 | |
19389 | var iteratorFn = getIteratorFn(node); | 21872 | var defaultLongDateFormat = { |
19390 | // Entry iterators provide implicit keys. | 21873 | LTS : 'h:mm:ss A', |
19391 | if (iteratorFn) { | 21874 | LT : 'h:mm A', |
19392 | if (iteratorFn !== node.entries) { | 21875 | L : 'MM/DD/YYYY', |
19393 | var iterator = iteratorFn.call(node); | 21876 | LL : 'MMMM D, YYYY', |
19394 | var step; | 21877 | LLL : 'MMMM D, YYYY h:mm A', |
19395 | while (!(step = iterator.next()).done) { | 21878 | LLLL : 'dddd, MMMM D, YYYY h:mm A' |
19396 | if (ReactElement.isValidElement(step.value)) { | 21879 | }; |
19397 | validateExplicitKey(step.value, parentType); | 21880 | |
19398 | } | 21881 | function longDateFormat (key) { |
21882 | var format = this._longDateFormat[key], | ||
21883 | formatUpper = this._longDateFormat[key.toUpperCase()]; | ||
21884 | |||
21885 | if (format || !formatUpper) { | ||
21886 | return format; | ||
19399 | } | 21887 | } |
19400 | } | 21888 | |
21889 | this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) { | ||
21890 | return val.slice(1); | ||
21891 | }); | ||
21892 | |||
21893 | return this._longDateFormat[key]; | ||
19401 | } | 21894 | } |
19402 | } | ||
19403 | } | ||
19404 | 21895 | ||
19405 | /** | 21896 | var defaultInvalidDate = 'Invalid date'; |
19406 | * Assert that the props are valid | ||
19407 | * | ||
19408 | * @param {string} componentName Name of the component for error messages. | ||
19409 | * @param {object} propTypes Map of prop name to a ReactPropType | ||
19410 | * @param {object} props | ||
19411 | * @param {string} location e.g. "prop", "context", "child context" | ||
19412 | * @private | ||
19413 | */ | ||
19414 | function checkPropTypes(componentName, propTypes, props, location) { | ||
19415 | for (var propName in propTypes) { | ||
19416 | if (propTypes.hasOwnProperty(propName)) { | ||
19417 | var error; | ||
19418 | // Prop type validation may throw. In case they do, we don't want to | ||
19419 | // fail the render phase where it didn't fail before. So we log it. | ||
19420 | // After these have been cleaned up, we'll let them throw. | ||
19421 | try { | ||
19422 | // This is intentionally an invariant that gets caught. It's the same | ||
19423 | // behavior as without this statement except with a better message. | ||
19424 | !(typeof propTypes[propName] === '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], propName) : invariant(false) : undefined; | ||
19425 | error = propTypes[propName](props, propName, componentName, location); | ||
19426 | } catch (ex) { | ||
19427 | error = ex; | ||
19428 | } | ||
19429 | 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], propName, typeof error) : undefined; | ||
19430 | if (error instanceof Error && !(error.message in loggedTypeFailures)) { | ||
19431 | // Only monitor this failure once because there tends to be a lot of the | ||
19432 | // same error. | ||
19433 | loggedTypeFailures[error.message] = true; | ||
19434 | 21897 | ||
19435 | var addendum = getDeclarationErrorAddendum(); | 21898 | function invalidDate () { |
19436 | process.env.NODE_ENV !== 'production' ? warning(false, 'Failed propType: %s%s', error.message, addendum) : undefined; | 21899 | return this._invalidDate; |
19437 | } | ||
19438 | } | 21900 | } |
19439 | } | ||
19440 | } | ||
19441 | 21901 | ||
19442 | /** | 21902 | var defaultOrdinal = '%d'; |
19443 | * Given an element, validate that its props follow the propTypes definition, | 21903 | var defaultOrdinalParse = /\d{1,2}/; |
19444 | * provided by the type. | ||
19445 | * | ||
19446 | * @param {ReactElement} element | ||
19447 | */ | ||
19448 | function validatePropTypes(element) { | ||
19449 | var componentClass = element.type; | ||
19450 | if (typeof componentClass !== 'function') { | ||
19451 | return; | ||
19452 | } | ||
19453 | var name = componentClass.displayName || componentClass.name; | ||
19454 | if (componentClass.propTypes) { | ||
19455 | checkPropTypes(name, componentClass.propTypes, element.props, ReactPropTypeLocations.prop); | ||
19456 | } | ||
19457 | if (typeof componentClass.getDefaultProps === 'function') { | ||
19458 | 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.') : undefined; | ||
19459 | } | ||
19460 | } | ||
19461 | 21904 | ||
19462 | var ReactElementValidator = { | 21905 | function ordinal (number) { |
21906 | return this._ordinal.replace('%d', number); | ||
21907 | } | ||
19463 | 21908 | ||
19464 | createElement: function (type, props, children) { | 21909 | var defaultRelativeTime = { |
19465 | var validType = typeof type === 'string' || typeof type === 'function'; | 21910 | future : 'in %s', |
19466 | // We warn in this case but don't throw. We expect the element creation to | 21911 | past : '%s ago', |
19467 | // succeed and there will likely be errors in render. | 21912 | s : 'a few seconds', |
19468 | process.env.NODE_ENV !== 'production' ? warning(validType, 'React.createElement: type should not be null, undefined, boolean, or ' + 'number. It should be a string (for DOM elements) or a ReactClass ' + '(for composite components).%s', getDeclarationErrorAddendum()) : undefined; | 21913 | m : 'a minute', |
21914 | mm : '%d minutes', | ||
21915 | h : 'an hour', | ||
21916 | hh : '%d hours', | ||
21917 | d : 'a day', | ||
21918 | dd : '%d days', | ||
21919 | M : 'a month', | ||
21920 | MM : '%d months', | ||
21921 | y : 'a year', | ||
21922 | yy : '%d years' | ||
21923 | }; | ||
19469 | 21924 | ||
19470 | var element = ReactElement.createElement.apply(this, arguments); | 21925 | function relative__relativeTime (number, withoutSuffix, string, isFuture) { |
21926 | var output = this._relativeTime[string]; | ||
21927 | return (isFunction(output)) ? | ||
21928 | output(number, withoutSuffix, string, isFuture) : | ||
21929 | output.replace(/%d/i, number); | ||
21930 | } | ||
19471 | 21931 | ||
19472 | // The result can be nullish if a mock or a custom function is used. | 21932 | function pastFuture (diff, output) { |
19473 | // TODO: Drop this when these are no longer allowed as the type argument. | 21933 | var format = this._relativeTime[diff > 0 ? 'future' : 'past']; |
19474 | if (element == null) { | 21934 | return isFunction(format) ? format(output) : format.replace(/%s/i, output); |
19475 | return element; | ||
19476 | } | 21935 | } |
19477 | 21936 | ||
19478 | // Skip key warning if the type isn't valid since our key validation logic | 21937 | var aliases = {}; |
19479 | // doesn't expect a non-string/function type and can throw confusing errors. | 21938 | |
19480 | // We don't want exception behavior to differ between dev and prod. | 21939 | function addUnitAlias (unit, shorthand) { |
19481 | // (Rendering will throw with a helpful message and as soon as the type is | 21940 | var lowerCase = unit.toLowerCase(); |
19482 | // fixed, the key warnings will appear.) | 21941 | aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit; |
19483 | if (validType) { | ||
19484 | for (var i = 2; i < arguments.length; i++) { | ||
19485 | validateChildKeys(arguments[i], type); | ||
19486 | } | ||
19487 | } | 21942 | } |
19488 | 21943 | ||
19489 | validatePropTypes(element); | 21944 | function normalizeUnits(units) { |
21945 | return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined; | ||
21946 | } | ||
19490 | 21947 | ||
19491 | return element; | 21948 | function normalizeObjectUnits(inputObject) { |
19492 | }, | 21949 | var normalizedInput = {}, |
21950 | normalizedProp, | ||
21951 | prop; | ||
19493 | 21952 | ||
19494 | createFactory: function (type) { | 21953 | for (prop in inputObject) { |
19495 | var validatedFactory = ReactElementValidator.createElement.bind(null, type); | 21954 | if (hasOwnProp(inputObject, prop)) { |
19496 | // Legacy hook TODO: Warn if this is accessed | 21955 | normalizedProp = normalizeUnits(prop); |
19497 | validatedFactory.type = type; | 21956 | if (normalizedProp) { |
21957 | normalizedInput[normalizedProp] = inputObject[prop]; | ||
21958 | } | ||
21959 | } | ||
21960 | } | ||
19498 | 21961 | ||
19499 | if (process.env.NODE_ENV !== 'production') { | 21962 | return normalizedInput; |
19500 | if (canDefineProperty) { | 21963 | } |
19501 | Object.defineProperty(validatedFactory, 'type', { | 21964 | |
19502 | enumerable: false, | 21965 | var priorities = {}; |
19503 | get: function () { | 21966 | |
19504 | process.env.NODE_ENV !== 'production' ? warning(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.') : undefined; | 21967 | function addUnitPriority(unit, priority) { |
19505 | Object.defineProperty(this, 'type', { | 21968 | priorities[unit] = priority; |
19506 | value: type | 21969 | } |
19507 | }); | 21970 | |
19508 | return type; | 21971 | function getPrioritizedUnits(unitsObj) { |
19509 | } | 21972 | var units = []; |
21973 | for (var u in unitsObj) { | ||
21974 | units.push({unit: u, priority: priorities[u]}); | ||
21975 | } | ||
21976 | units.sort(function (a, b) { | ||
21977 | return a.priority - b.priority; | ||
19510 | }); | 21978 | }); |
19511 | } | 21979 | return units; |
19512 | } | 21980 | } |
19513 | 21981 | ||
19514 | return validatedFactory; | 21982 | function makeGetSet (unit, keepTime) { |
19515 | }, | 21983 | return function (value) { |
21984 | if (value != null) { | ||
21985 | get_set__set(this, unit, value); | ||
21986 | utils_hooks__hooks.updateOffset(this, keepTime); | ||
21987 | return this; | ||
21988 | } else { | ||
21989 | return get_set__get(this, unit); | ||
21990 | } | ||
21991 | }; | ||
21992 | } | ||
19516 | 21993 | ||
19517 | cloneElement: function (element, props, children) { | 21994 | function get_set__get (mom, unit) { |
19518 | var newElement = ReactElement.cloneElement.apply(this, arguments); | 21995 | return mom.isValid() ? |
19519 | for (var i = 2; i < arguments.length; i++) { | 21996 | mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN; |
19520 | validateChildKeys(arguments[i], newElement.type); | ||
19521 | } | 21997 | } |
19522 | validatePropTypes(newElement); | ||
19523 | return newElement; | ||
19524 | } | ||
19525 | 21998 | ||
19526 | }; | 21999 | function get_set__set (mom, unit, value) { |
22000 | if (mom.isValid()) { | ||
22001 | mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value); | ||
22002 | } | ||
22003 | } | ||
19527 | 22004 | ||
19528 | module.exports = ReactElementValidator; | 22005 | // MOMENTS |
19529 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
19530 | |||
19531 | /***/ }, | ||
19532 | /* 157 */ | ||
19533 | /***/ function(module, exports) { | ||
19534 | |||
19535 | /** | ||
19536 | * Copyright 2013-2015, Facebook, Inc. | ||
19537 | * All rights reserved. | ||
19538 | * | ||
19539 | * This source code is licensed under the BSD-style license found in the | ||
19540 | * LICENSE file in the root directory of this source tree. An additional grant | ||
19541 | * of patent rights can be found in the PATENTS file in the same directory. | ||
19542 | * | ||
19543 | * @providesModule mapObject | ||
19544 | */ | ||
19545 | 22006 | ||
19546 | 'use strict'; | 22007 | function stringGet (units) { |
22008 | units = normalizeUnits(units); | ||
22009 | if (isFunction(this[units])) { | ||
22010 | return this[units](); | ||
22011 | } | ||
22012 | return this; | ||
22013 | } | ||
19547 | 22014 | ||
19548 | var hasOwnProperty = Object.prototype.hasOwnProperty; | ||
19549 | 22015 | ||
19550 | /** | 22016 | function stringSet (units, value) { |
19551 | * Executes the provided `callback` once for each enumerable own property in the | 22017 | if (typeof units === 'object') { |
19552 | * object and constructs a new object from the results. The `callback` is | 22018 | units = normalizeObjectUnits(units); |
19553 | * invoked with three arguments: | 22019 | var prioritized = getPrioritizedUnits(units); |
19554 | * | 22020 | for (var i = 0; i < prioritized.length; i++) { |
19555 | * - the property value | 22021 | this[prioritized[i].unit](units[prioritized[i].unit]); |
19556 | * - the property name | 22022 | } |
19557 | * - the object being traversed | 22023 | } else { |
19558 | * | 22024 | units = normalizeUnits(units); |
19559 | * Properties that are added after the call to `mapObject` will not be visited | 22025 | if (isFunction(this[units])) { |
19560 | * by `callback`. If the values of existing properties are changed, the value | 22026 | return this[units](value); |
19561 | * passed to `callback` will be the value at the time `mapObject` visits them. | 22027 | } |
19562 | * Properties that are deleted before being visited are not visited. | 22028 | } |
19563 | * | 22029 | return this; |
19564 | * @grep function objectMap() | ||
19565 | * @grep function objMap() | ||
19566 | * | ||
19567 | * @param {?object} object | ||
19568 | * @param {function} callback | ||
19569 | * @param {*} context | ||
19570 | * @return {?object} | ||
19571 | */ | ||
19572 | function mapObject(object, callback, context) { | ||
19573 | if (!object) { | ||
19574 | return null; | ||
19575 | } | ||
19576 | var result = {}; | ||
19577 | for (var name in object) { | ||
19578 | if (hasOwnProperty.call(object, name)) { | ||
19579 | result[name] = callback.call(context, object[name], name, object); | ||
19580 | } | 22030 | } |
19581 | } | ||
19582 | return result; | ||
19583 | } | ||
19584 | 22031 | ||
19585 | module.exports = mapObject; | 22032 | function zeroFill(number, targetLength, forceSign) { |
19586 | 22033 | var absNumber = '' + Math.abs(number), | |
19587 | /***/ }, | 22034 | zerosToFill = targetLength - absNumber.length, |
19588 | /* 158 */ | 22035 | sign = number >= 0; |
19589 | /***/ function(module, exports, __webpack_require__) { | 22036 | return (sign ? (forceSign ? '+' : '') : '-') + |
19590 | 22037 | Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber; | |
19591 | /* WEBPACK VAR INJECTION */(function(process) {/** | 22038 | } |
19592 | * Copyright 2013-2015, Facebook, Inc. | ||
19593 | * All rights reserved. | ||
19594 | * | ||
19595 | * This source code is licensed under the BSD-style license found in the | ||
19596 | * LICENSE file in the root directory of this source tree. An additional grant | ||
19597 | * of patent rights can be found in the PATENTS file in the same directory. | ||
19598 | * | ||
19599 | * @providesModule onlyChild | ||
19600 | */ | ||
19601 | 'use strict'; | ||
19602 | 22039 | ||
19603 | var ReactElement = __webpack_require__(44); | 22040 | 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; |
19604 | 22041 | ||
19605 | var invariant = __webpack_require__(15); | 22042 | var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g; |
19606 | 22043 | ||
19607 | /** | 22044 | var formatFunctions = {}; |
19608 | * Returns the first child in a collection of children and verifies that there | ||
19609 | * is only one child in the collection. The current implementation of this | ||
19610 | * function assumes that a single child gets passed without a wrapper, but the | ||
19611 | * purpose of this helper function is to abstract away the particular structure | ||
19612 | * of children. | ||
19613 | * | ||
19614 | * @param {?object} children Child collection structure. | ||
19615 | * @return {ReactComponent} The first and only `ReactComponent` contained in the | ||
19616 | * structure. | ||
19617 | */ | ||
19618 | function onlyChild(children) { | ||
19619 | !ReactElement.isValidElement(children) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'onlyChild must be passed a children with exactly one child.') : invariant(false) : undefined; | ||
19620 | return children; | ||
19621 | } | ||
19622 | 22045 | ||
19623 | module.exports = onlyChild; | 22046 | var formatTokenFunctions = {}; |
19624 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
19625 | |||
19626 | /***/ }, | ||
19627 | /* 159 */ | ||
19628 | /***/ function(module, exports, __webpack_require__) { | ||
19629 | |||
19630 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
19631 | * Copyright 2013-2015, Facebook, Inc. | ||
19632 | * All rights reserved. | ||
19633 | * | ||
19634 | * This source code is licensed under the BSD-style license found in the | ||
19635 | * LICENSE file in the root directory of this source tree. An additional grant | ||
19636 | * of patent rights can be found in the PATENTS file in the same directory. | ||
19637 | * | ||
19638 | * @providesModule deprecated | ||
19639 | */ | ||
19640 | 22047 | ||
19641 | 'use strict'; | 22048 | // token: 'M' |
22049 | // padded: ['MM', 2] | ||
22050 | // ordinal: 'Mo' | ||
22051 | // callback: function () { this.month() + 1 } | ||
22052 | function addFormatToken (token, padded, ordinal, callback) { | ||
22053 | var func = callback; | ||
22054 | if (typeof callback === 'string') { | ||
22055 | func = function () { | ||
22056 | return this[callback](); | ||
22057 | }; | ||
22058 | } | ||
22059 | if (token) { | ||
22060 | formatTokenFunctions[token] = func; | ||
22061 | } | ||
22062 | if (padded) { | ||
22063 | formatTokenFunctions[padded[0]] = function () { | ||
22064 | return zeroFill(func.apply(this, arguments), padded[1], padded[2]); | ||
22065 | }; | ||
22066 | } | ||
22067 | if (ordinal) { | ||
22068 | formatTokenFunctions[ordinal] = function () { | ||
22069 | return this.localeData().ordinal(func.apply(this, arguments), token); | ||
22070 | }; | ||
22071 | } | ||
22072 | } | ||
19642 | 22073 | ||
19643 | var assign = __webpack_require__(41); | 22074 | function removeFormattingTokens(input) { |
19644 | var warning = __webpack_require__(27); | 22075 | if (input.match(/\[[\s\S]/)) { |
22076 | return input.replace(/^\[|\]$/g, ''); | ||
22077 | } | ||
22078 | return input.replace(/\\/g, ''); | ||
22079 | } | ||
19645 | 22080 | ||
19646 | /** | 22081 | function makeFormatFunction(format) { |
19647 | * This will log a single deprecation notice per function and forward the call | 22082 | var array = format.match(formattingTokens), i, length; |
19648 | * on to the new API. | ||
19649 | * | ||
19650 | * @param {string} fnName The name of the function | ||
19651 | * @param {string} newModule The module that fn will exist in | ||
19652 | * @param {string} newPackage The module that fn will exist in | ||
19653 | * @param {*} ctx The context this forwarded call should run in | ||
19654 | * @param {function} fn The function to forward on to | ||
19655 | * @return {function} The function that will warn once and then call fn | ||
19656 | */ | ||
19657 | function deprecated(fnName, newModule, newPackage, ctx, fn) { | ||
19658 | var warned = false; | ||
19659 | if (process.env.NODE_ENV !== 'production') { | ||
19660 | var newFn = function () { | ||
19661 | process.env.NODE_ENV !== 'production' ? warning(warned, | ||
19662 | // Require examples in this string must be split to prevent React's | ||
19663 | // build tools from mistaking them for real requires. | ||
19664 | // Otherwise the build tools will attempt to build a '%s' module. | ||
19665 | 'React.%s is deprecated. Please use %s.%s from require' + '(\'%s\') ' + 'instead.', fnName, newModule, fnName, newPackage) : undefined; | ||
19666 | warned = true; | ||
19667 | return fn.apply(ctx, arguments); | ||
19668 | }; | ||
19669 | // We need to make sure all properties of the original fn are copied over. | ||
19670 | // In particular, this is needed to support PropTypes | ||
19671 | return assign(newFn, fn); | ||
19672 | } | ||
19673 | 22083 | ||
19674 | return fn; | 22084 | for (i = 0, length = array.length; i < length; i++) { |
19675 | } | 22085 | if (formatTokenFunctions[array[i]]) { |
22086 | array[i] = formatTokenFunctions[array[i]]; | ||
22087 | } else { | ||
22088 | array[i] = removeFormattingTokens(array[i]); | ||
22089 | } | ||
22090 | } | ||
19676 | 22091 | ||
19677 | module.exports = deprecated; | 22092 | return function (mom) { |
19678 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | 22093 | var output = '', i; |
19679 | 22094 | for (i = 0; i < length; i++) { | |
19680 | /***/ }, | 22095 | output += array[i] instanceof Function ? array[i].call(mom, format) : array[i]; |
19681 | /* 160 */ | 22096 | } |
19682 | /***/ function(module, exports, __webpack_require__) { | 22097 | return output; |
19683 | 22098 | }; | |
19684 | 'use strict'; | 22099 | } |
19685 | 22100 | ||
19686 | module.exports = __webpack_require__(5); | 22101 | // format date using native date object |
19687 | 22102 | function formatMoment(m, format) { | |
19688 | 22103 | if (!m.isValid()) { | |
19689 | /***/ }, | 22104 | return m.localeData().invalidDate(); |
19690 | /* 161 */ | 22105 | } |
19691 | /***/ function(module, exports, __webpack_require__) { | ||
19692 | |||
19693 | /* | ||
19694 | * GregorianCalendar class | ||
19695 | * @ignore | ||
19696 | * @author yiminghe@gmail.com | ||
19697 | */ | ||
19698 | 'use strict'; | ||
19699 | 22106 | ||
19700 | var toInt = parseInt; | 22107 | format = expandFormat(format, m.localeData()); |
19701 | var Utils = __webpack_require__(162); | 22108 | formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format); |
19702 | var defaultLocale = __webpack_require__(164); | ||
19703 | var Const = __webpack_require__(163); | ||
19704 | 22109 | ||
19705 | /* | 22110 | return formatFunctions[format](m); |
19706 | * GregorianCalendar class. | 22111 | } |
19707 | * | ||
19708 | * - no arguments: | ||
19709 | * Constructs a default GregorianCalendar using the current time | ||
19710 | * in the default time zone with the default locale. | ||
19711 | * - one argument locale: | ||
19712 | * Constructs a GregorianCalendar | ||
19713 | * based on the current time in the default time zone with the given locale. | ||
19714 | * | ||
19715 | * @class Date.Gregorian | ||
19716 | */ | ||
19717 | function GregorianCalendar(loc) { | ||
19718 | var locale = loc || defaultLocale; | ||
19719 | 22112 | ||
19720 | this.locale = locale; | 22113 | function expandFormat(format, locale) { |
22114 | var i = 5; | ||
19721 | 22115 | ||
19722 | this.fields = []; | 22116 | function replaceLongDateFormatTokens(input) { |
22117 | return locale.longDateFormat(input) || input; | ||
22118 | } | ||
19723 | 22119 | ||
19724 | /* | 22120 | localFormattingTokens.lastIndex = 0; |
19725 | * The currently set time for this date. | 22121 | while (i >= 0 && localFormattingTokens.test(format)) { |
19726 | * @protected | 22122 | format = format.replace(localFormattingTokens, replaceLongDateFormatTokens); |
19727 | * @type Number|undefined | 22123 | localFormattingTokens.lastIndex = 0; |
19728 | */ | 22124 | i -= 1; |
19729 | this.time = undefined; | 22125 | } |
19730 | /* | ||
19731 | * The timezoneOffset in minutes used by this date. | ||
19732 | * @type Number | ||
19733 | * @protected | ||
19734 | */ | ||
19735 | 22126 | ||
19736 | this.timezoneOffset = locale.timezoneOffset; | 22127 | return format; |
22128 | } | ||
19737 | 22129 | ||
19738 | /* | 22130 | var match1 = /\d/; // 0 - 9 |
19739 | * The first day of the week | 22131 | var match2 = /\d\d/; // 00 - 99 |
19740 | * @type Number | 22132 | var match3 = /\d{3}/; // 000 - 999 |
19741 | * @protected | 22133 | var match4 = /\d{4}/; // 0000 - 9999 |
19742 | */ | 22134 | var match6 = /[+-]?\d{6}/; // -999999 - 999999 |
19743 | this.firstDayOfWeek = locale.firstDayOfWeek; | 22135 | var match1to2 = /\d\d?/; // 0 - 99 |
22136 | var match3to4 = /\d\d\d\d?/; // 999 - 9999 | ||
22137 | var match5to6 = /\d\d\d\d\d\d?/; // 99999 - 999999 | ||
22138 | var match1to3 = /\d{1,3}/; // 0 - 999 | ||
22139 | var match1to4 = /\d{1,4}/; // 0 - 9999 | ||
22140 | var match1to6 = /[+-]?\d{1,6}/; // -999999 - 999999 | ||
19744 | 22141 | ||
19745 | /* | 22142 | var matchUnsigned = /\d+/; // 0 - inf |
19746 | * The number of days required for the first week in a month or year, | 22143 | var matchSigned = /[+-]?\d+/; // -inf - inf |
19747 | * with possible values from 1 to 7. | ||
19748 | * @@protected | ||
19749 | * @type Number | ||
19750 | */ | ||
19751 | this.minimalDaysInFirstWeek = locale.minimalDaysInFirstWeek; | ||
19752 | 22144 | ||
19753 | this.fieldsComputed = false; | 22145 | var matchOffset = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z |
19754 | } | 22146 | var matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi; // +00 -00 +00:00 -00:00 +0000 -0000 or Z |
19755 | 22147 | ||
19756 | Utils.mix(GregorianCalendar, Const); | 22148 | var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123 |
19757 | 22149 | ||
19758 | Utils.mix(GregorianCalendar, { | 22150 | // any word (or two) characters or numbers including two/three word month in arabic. |
19759 | Utils: Utils, | 22151 | // includes scottish gaelic two word and hyphenated months |
22152 | var matchWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i; | ||
19760 | 22153 | ||
19761 | defaultLocale: defaultLocale, | ||
19762 | 22154 | ||
19763 | /* | 22155 | var regexes = {}; |
19764 | * Determines if the given year is a leap year. | ||
19765 | * Returns true if the given year is a leap year. To specify BC year numbers, | ||
19766 | * 1 - year number must be given. For example, year BC 4 is specified as -3. | ||
19767 | * @param {Number} year the given year. | ||
19768 | * @returns {Boolean} true if the given year is a leap year; false otherwise. | ||
19769 | * @static | ||
19770 | * @method | ||
19771 | */ | ||
19772 | isLeapYear: Utils.isLeapYear, | ||
19773 | 22156 | ||
19774 | /* | 22157 | function addRegexToken (token, regex, strictRegex) { |
19775 | * Enum indicating year field of date | 22158 | regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) { |
19776 | * @type Number | 22159 | return (isStrict && strictRegex) ? strictRegex : regex; |
19777 | */ | 22160 | }; |
19778 | YEAR: 1, | 22161 | } |
19779 | /* | ||
19780 | * Enum indicating month field of date | ||
19781 | * @type Number | ||
19782 | */ | ||
19783 | MONTH: 2, | ||
19784 | /* | ||
19785 | * Enum indicating the day of the month | ||
19786 | * @type Number | ||
19787 | */ | ||
19788 | DAY_OF_MONTH: 3, | ||
19789 | /* | ||
19790 | * Enum indicating the hour (24). | ||
19791 | * @type Number | ||
19792 | */ | ||
19793 | HOUR_OF_DAY: 4, | ||
19794 | /* | ||
19795 | * Enum indicating the minute of the day | ||
19796 | * @type Number | ||
19797 | */ | ||
19798 | MINUTES: 5, | ||
19799 | /* | ||
19800 | * Enum indicating the second of the day | ||
19801 | * @type Number | ||
19802 | */ | ||
19803 | SECONDS: 6, | ||
19804 | /* | ||
19805 | * Enum indicating the millisecond of the day | ||
19806 | * @type Number | ||
19807 | */ | ||
19808 | MILLISECONDS: 7, | ||
19809 | /* | ||
19810 | * Enum indicating the week number within the current year | ||
19811 | * @type Number | ||
19812 | */ | ||
19813 | WEEK_OF_YEAR: 8, | ||
19814 | /* | ||
19815 | * Enum indicating the week number within the current month | ||
19816 | * @type Number | ||
19817 | */ | ||
19818 | WEEK_OF_MONTH: 9, | ||
19819 | 22162 | ||
19820 | /* | 22163 | function getParseRegexForToken (token, config) { |
19821 | * Enum indicating the day of the day number within the current year | 22164 | if (!hasOwnProp(regexes, token)) { |
19822 | * @type Number | 22165 | return new RegExp(unescapeFormat(token)); |
19823 | */ | 22166 | } |
19824 | DAY_OF_YEAR: 10, | ||
19825 | /* | ||
19826 | * Enum indicating the day of the week | ||
19827 | * @type Number | ||
19828 | */ | ||
19829 | DAY_OF_WEEK: 11, | ||
19830 | /* | ||
19831 | * Enum indicating the day of the ordinal number of the day of the week | ||
19832 | * @type Number | ||
19833 | */ | ||
19834 | DAY_OF_WEEK_IN_MONTH: 12, | ||
19835 | 22167 | ||
19836 | /* | 22168 | return regexes[token](config._strict, config._locale); |
19837 | * Enum indicating am | 22169 | } |
19838 | * @type Number | ||
19839 | */ | ||
19840 | AM: 0, | ||
19841 | /* | ||
19842 | * Enum indicating pm | ||
19843 | * @type Number | ||
19844 | */ | ||
19845 | PM: 1 | ||
19846 | }); | ||
19847 | 22170 | ||
19848 | var FIELDS = ['', 'Year', 'Month', 'DayOfMonth', 'HourOfDay', 'Minutes', 'Seconds', 'Milliseconds', 'WeekOfYear', 'WeekOfMonth', 'DayOfYear', 'DayOfWeek', 'DayOfWeekInMonth']; | 22171 | // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript |
22172 | function unescapeFormat(s) { | ||
22173 | return regexEscape(s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) { | ||
22174 | return p1 || p2 || p3 || p4; | ||
22175 | })); | ||
22176 | } | ||
19849 | 22177 | ||
19850 | var YEAR = GregorianCalendar.YEAR; | 22178 | function regexEscape(s) { |
19851 | var MONTH = GregorianCalendar.MONTH; | 22179 | return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); |
19852 | var DAY_OF_MONTH = GregorianCalendar.DAY_OF_MONTH; | 22180 | } |
19853 | var HOUR_OF_DAY = GregorianCalendar.HOUR_OF_DAY; | ||
19854 | var MINUTE = GregorianCalendar.MINUTES; | ||
19855 | var SECONDS = GregorianCalendar.SECONDS; | ||
19856 | 22181 | ||
19857 | var MILLISECONDS = GregorianCalendar.MILLISECONDS; | 22182 | var tokens = {}; |
19858 | var DAY_OF_WEEK_IN_MONTH = GregorianCalendar.DAY_OF_WEEK_IN_MONTH; | ||
19859 | var DAY_OF_YEAR = GregorianCalendar.DAY_OF_YEAR; | ||
19860 | var DAY_OF_WEEK = GregorianCalendar.DAY_OF_WEEK; | ||
19861 | 22183 | ||
19862 | var WEEK_OF_MONTH = GregorianCalendar.WEEK_OF_MONTH; | 22184 | function addParseToken (token, callback) { |
19863 | var WEEK_OF_YEAR = GregorianCalendar.WEEK_OF_YEAR; | 22185 | var i, func = callback; |
22186 | if (typeof token === 'string') { | ||
22187 | token = [token]; | ||
22188 | } | ||
22189 | if (typeof callback === 'number') { | ||
22190 | func = function (input, array) { | ||
22191 | array[callback] = toInt(input); | ||
22192 | }; | ||
22193 | } | ||
22194 | for (i = 0; i < token.length; i++) { | ||
22195 | tokens[token[i]] = func; | ||
22196 | } | ||
22197 | } | ||
19864 | 22198 | ||
19865 | var MONTH_LENGTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; // 0-based | 22199 | function addWeekParseToken (token, callback) { |
19866 | var LEAP_MONTH_LENGTH = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; // 0-based | 22200 | addParseToken(token, function (input, array, config, token) { |
22201 | config._w = config._w || {}; | ||
22202 | callback(input, config._w, config, token); | ||
22203 | }); | ||
22204 | } | ||
19867 | 22205 | ||
19868 | var ONE_SECOND = 1000; | 22206 | function addTimeToArrayFromToken(token, input, config) { |
19869 | var ONE_MINUTE = 60 * ONE_SECOND; | 22207 | if (input != null && hasOwnProp(tokens, token)) { |
19870 | var ONE_HOUR = 60 * ONE_MINUTE; | 22208 | tokens[token](input, config._a, config, token); |
19871 | var ONE_DAY = 24 * ONE_HOUR; | 22209 | } |
19872 | var ONE_WEEK = ONE_DAY * 7; | 22210 | } |
19873 | 22211 | ||
19874 | var EPOCH_OFFSET = 719163; // Fixed date of January 1, 1970 (Gregorian) | 22212 | var YEAR = 0; |
22213 | var MONTH = 1; | ||
22214 | var DATE = 2; | ||
22215 | var HOUR = 3; | ||
22216 | var MINUTE = 4; | ||
22217 | var SECOND = 5; | ||
22218 | var MILLISECOND = 6; | ||
22219 | var WEEK = 7; | ||
22220 | var WEEKDAY = 8; | ||
19875 | 22221 | ||
19876 | var mod = Utils.mod; | 22222 | var indexOf; |
19877 | var _isLeapYear = Utils.isLeapYear; | ||
19878 | var floorDivide = Math.floor; | ||
19879 | 22223 | ||
19880 | var MIN_VALUES = [undefined, 1, // YEAR | 22224 | if (Array.prototype.indexOf) { |
19881 | GregorianCalendar.JANUARY, // MONTH | 22225 | indexOf = Array.prototype.indexOf; |
19882 | 1, // DAY_OF_MONTH | 22226 | } else { |
19883 | 0, // HOUR_OF_DAY | 22227 | indexOf = function (o) { |
19884 | 0, // MINUTE | 22228 | // I know |
19885 | 0, // SECONDS | 22229 | var i; |
19886 | 0, // MILLISECONDS | 22230 | for (i = 0; i < this.length; ++i) { |
22231 | if (this[i] === o) { | ||
22232 | return i; | ||
22233 | } | ||
22234 | } | ||
22235 | return -1; | ||
22236 | }; | ||
22237 | } | ||
19887 | 22238 | ||
19888 | 1, // WEEK_OF_YEAR | 22239 | function daysInMonth(year, month) { |
19889 | undefined, // WEEK_OF_MONTH | 22240 | return new Date(Date.UTC(year, month + 1, 0)).getUTCDate(); |
22241 | } | ||
19890 | 22242 | ||
19891 | 1, // DAY_OF_YEAR | 22243 | // FORMATTING |
19892 | GregorianCalendar.SUNDAY, // DAY_OF_WEEK | ||
19893 | 1]; | ||
19894 | 22244 | ||
19895 | // DAY_OF_WEEK_IN_MONTH | 22245 | addFormatToken('M', ['MM', 2], 'Mo', function () { |
19896 | var MAX_VALUES = [undefined, 292278994, // YEAR | 22246 | return this.month() + 1; |
19897 | GregorianCalendar.DECEMBER, // MONTH | 22247 | }); |
19898 | undefined, // DAY_OF_MONTH | ||
19899 | 23, // HOUR_OF_DAY | ||
19900 | 59, // MINUTE | ||
19901 | 59, // SECONDS | ||
19902 | 999, // MILLISECONDS | ||
19903 | undefined, // WEEK_OF_YEAR | ||
19904 | undefined, // WEEK_OF_MONTH | ||
19905 | undefined, // DAY_OF_YEAR | ||
19906 | GregorianCalendar.SATURDAY, // DAY_OF_WEEK | ||
19907 | undefined]; | ||
19908 | 22248 | ||
19909 | // ------------------- private start | 22249 | addFormatToken('MMM', 0, 0, function (format) { |
22250 | return this.localeData().monthsShort(this, format); | ||
22251 | }); | ||
19910 | 22252 | ||
19911 | // DAY_OF_WEEK_IN_MONTH | 22253 | addFormatToken('MMMM', 0, 0, function (format) { |
19912 | function getMonthLength(year, month) { | 22254 | return this.localeData().months(this, format); |
19913 | return _isLeapYear(year) ? LEAP_MONTH_LENGTH[month] : MONTH_LENGTH[month]; | 22255 | }); |
19914 | } | ||
19915 | 22256 | ||
19916 | function getYearLength(year) { | 22257 | // ALIASES |
19917 | return _isLeapYear(year) ? 366 : 365; | ||
19918 | } | ||
19919 | 22258 | ||
19920 | function adjustDayOfMonth(self) { | 22259 | addUnitAlias('month', 'M'); |
19921 | var fields = self.fields; | ||
19922 | var year = fields[YEAR]; | ||
19923 | var month = fields[MONTH]; | ||
19924 | var monthLen = getMonthLength(year, month); | ||
19925 | var dayOfMonth = fields[DAY_OF_MONTH]; | ||
19926 | if (dayOfMonth > monthLen) { | ||
19927 | self.set(DAY_OF_MONTH, monthLen); | ||
19928 | } | ||
19929 | } | ||
19930 | 22260 | ||
19931 | function getDayOfWeekDateOnOrBefore(fixedDate, dayOfWeek) { | 22261 | // PRIORITY |
19932 | // 1.1.1 is monday | ||
19933 | // one week has 7 days | ||
19934 | return fixedDate - mod(fixedDate - dayOfWeek, 7); | ||
19935 | } | ||
19936 | 22262 | ||
19937 | function getWeekNumber(self, fixedDay1, fixedDate) { | 22263 | addUnitPriority('month', 8); |
19938 | var fixedDay1st = getDayOfWeekDateOnOrBefore(fixedDay1 + 6, self.firstDayOfWeek); | ||
19939 | var nDays = fixedDay1st - fixedDay1; | ||
19940 | if (nDays >= self.minimalDaysInFirstWeek) { | ||
19941 | fixedDay1st -= 7; | ||
19942 | } | ||
19943 | var normalizedDayOfPeriod = fixedDate - fixedDay1st; | ||
19944 | return floorDivide(normalizedDayOfPeriod / 7) + 1; | ||
19945 | } | ||
19946 | 22264 | ||
19947 | // ------------------- private end | 22265 | // PARSING |
19948 | 22266 | ||
19949 | GregorianCalendar.prototype = { | 22267 | addRegexToken('M', match1to2); |
19950 | constructor: GregorianCalendar, | 22268 | addRegexToken('MM', match1to2, match2); |
22269 | addRegexToken('MMM', function (isStrict, locale) { | ||
22270 | return locale.monthsShortRegex(isStrict); | ||
22271 | }); | ||
22272 | addRegexToken('MMMM', function (isStrict, locale) { | ||
22273 | return locale.monthsRegex(isStrict); | ||
22274 | }); | ||
19951 | 22275 | ||
19952 | isGregorianCalendar: 1, | 22276 | addParseToken(['M', 'MM'], function (input, array) { |
22277 | array[MONTH] = toInt(input) - 1; | ||
22278 | }); | ||
19953 | 22279 | ||
19954 | /* | 22280 | addParseToken(['MMM', 'MMMM'], function (input, array, config, token) { |
19955 | * Determines if current year is a leap year. | 22281 | var month = config._locale.monthsParse(input, token, config._strict); |
19956 | * Returns true if the given year is a leap year. To specify BC year numbers, | 22282 | // if we didn't find a month name, mark the date as invalid. |
19957 | * 1 - year number must be given. For example, year BC 4 is specified as -3. | 22283 | if (month != null) { |
19958 | * @returns {Boolean} true if the given year is a leap year; false otherwise. | 22284 | array[MONTH] = month; |
19959 | * @method | 22285 | } else { |
19960 | * @member Date.Gregorian | 22286 | getParsingFlags(config).invalidMonth = input; |
19961 | */ | 22287 | } |
19962 | isLeapYear: function isLeapYear() { | 22288 | }); |
19963 | return _isLeapYear(this.getYear()); | ||
19964 | }, | ||
19965 | 22289 | ||
19966 | /* | 22290 | // LOCALES |
19967 | * Return local info for current date instance | ||
19968 | * @returns {Object} | ||
19969 | */ | ||
19970 | getLocale: function getLocale() { | ||
19971 | return this.locale; | ||
19972 | }, | ||
19973 | 22291 | ||
19974 | /* | 22292 | var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/; |
19975 | * Returns the minimum value for | 22293 | var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'); |
19976 | * the given calendar field of this GregorianCalendar instance. | 22294 | function localeMonths (m, format) { |
19977 | * The minimum value is defined as the smallest value | 22295 | return isArray(this._months) ? this._months[m.month()] : |
19978 | * returned by the get method for any possible time value, | 22296 | this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format) ? 'format' : 'standalone'][m.month()]; |
19979 | * taking into consideration the current values of the getFirstDayOfWeek, | ||
19980 | * getMinimalDaysInFirstWeek. | ||
19981 | * @param field the calendar field. | ||
19982 | * @returns {Number} the minimum value for the given calendar field. | ||
19983 | */ | ||
19984 | getActualMinimum: function getActualMinimum(field) { | ||
19985 | if (MIN_VALUES[field] !== undefined) { | ||
19986 | return MIN_VALUES[field]; | ||
19987 | } | 22297 | } |
19988 | if (field === WEEK_OF_MONTH) { | 22298 | |
19989 | var cal = this.clone(); | 22299 | var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'); |
19990 | cal.clear(); | 22300 | function localeMonthsShort (m, format) { |
19991 | cal.set(this.fields[YEAR], this.fields[MONTH], 1); | 22301 | return isArray(this._monthsShort) ? this._monthsShort[m.month()] : |
19992 | return cal.get(WEEK_OF_MONTH); | 22302 | this._monthsShort[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()]; |
19993 | } | 22303 | } |
19994 | 22304 | ||
19995 | throw new Error('minimum value not defined!'); | 22305 | function units_month__handleStrictParse(monthName, format, strict) { |
19996 | }, | 22306 | var i, ii, mom, llc = monthName.toLocaleLowerCase(); |
22307 | if (!this._monthsParse) { | ||
22308 | // this is not used | ||
22309 | this._monthsParse = []; | ||
22310 | this._longMonthsParse = []; | ||
22311 | this._shortMonthsParse = []; | ||
22312 | for (i = 0; i < 12; ++i) { | ||
22313 | mom = create_utc__createUTC([2000, i]); | ||
22314 | this._shortMonthsParse[i] = this.monthsShort(mom, '').toLocaleLowerCase(); | ||
22315 | this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase(); | ||
22316 | } | ||
22317 | } | ||
19997 | 22318 | ||
19998 | /* | 22319 | if (strict) { |
19999 | * Returns the maximum value for the given calendar field | 22320 | if (format === 'MMM') { |
20000 | * of this GregorianCalendar instance. | 22321 | ii = indexOf.call(this._shortMonthsParse, llc); |
20001 | * The maximum value is defined as the largest value returned | 22322 | return ii !== -1 ? ii : null; |
20002 | * by the get method for any possible time value, taking into consideration | 22323 | } else { |
20003 | * the current values of the getFirstDayOfWeek, getMinimalDaysInFirstWeek methods. | 22324 | ii = indexOf.call(this._longMonthsParse, llc); |
20004 | * @param field the calendar field. | 22325 | return ii !== -1 ? ii : null; |
20005 | * @returns {Number} the maximum value for the given calendar field. | 22326 | } |
20006 | */ | 22327 | } else { |
20007 | getActualMaximum: function getActualMaximum(field) { | 22328 | if (format === 'MMM') { |
20008 | if (MAX_VALUES[field] !== undefined) { | 22329 | ii = indexOf.call(this._shortMonthsParse, llc); |
20009 | return MAX_VALUES[field]; | 22330 | if (ii !== -1) { |
20010 | } | 22331 | return ii; |
20011 | var value = undefined; | 22332 | } |
20012 | var fields = this.fields; | 22333 | ii = indexOf.call(this._longMonthsParse, llc); |
20013 | switch (field) { | 22334 | return ii !== -1 ? ii : null; |
20014 | case DAY_OF_MONTH: | 22335 | } else { |
20015 | value = getMonthLength(fields[YEAR], fields[MONTH]); | 22336 | ii = indexOf.call(this._longMonthsParse, llc); |
20016 | break; | 22337 | if (ii !== -1) { |
22338 | return ii; | ||
22339 | } | ||
22340 | ii = indexOf.call(this._shortMonthsParse, llc); | ||
22341 | return ii !== -1 ? ii : null; | ||
22342 | } | ||
22343 | } | ||
22344 | } | ||
20017 | 22345 | ||
20018 | case WEEK_OF_YEAR: | 22346 | function localeMonthsParse (monthName, format, strict) { |
20019 | var endOfYear = this.clone(); | 22347 | var i, mom, regex; |
20020 | endOfYear.clear(); | 22348 | |
20021 | endOfYear.set(fields[YEAR], GregorianCalendar.DECEMBER, 31); | 22349 | if (this._monthsParseExact) { |
20022 | value = endOfYear.get(WEEK_OF_YEAR); | 22350 | return units_month__handleStrictParse.call(this, monthName, format, strict); |
20023 | if (value === 1) { | ||
20024 | value = 52; | ||
20025 | } | 22351 | } |
20026 | break; | ||
20027 | 22352 | ||
20028 | case WEEK_OF_MONTH: | 22353 | if (!this._monthsParse) { |
20029 | var endOfMonth = this.clone(); | 22354 | this._monthsParse = []; |
20030 | endOfMonth.clear(); | 22355 | this._longMonthsParse = []; |
20031 | endOfMonth.set(fields[YEAR], fields[MONTH], getMonthLength(fields[YEAR], fields[MONTH])); | 22356 | this._shortMonthsParse = []; |
20032 | value = endOfMonth.get(WEEK_OF_MONTH); | 22357 | } |
20033 | break; | ||
20034 | 22358 | ||
20035 | case DAY_OF_YEAR: | 22359 | // TODO: add sorting |
20036 | value = getYearLength(fields[YEAR]); | 22360 | // Sorting makes sure if one month (or abbr) is a prefix of another |
20037 | break; | 22361 | // see sorting in computeMonthsParse |
22362 | for (i = 0; i < 12; i++) { | ||
22363 | // make the regex if we don't have it already | ||
22364 | mom = create_utc__createUTC([2000, i]); | ||
22365 | if (strict && !this._longMonthsParse[i]) { | ||
22366 | this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i'); | ||
22367 | this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i'); | ||
22368 | } | ||
22369 | if (!strict && !this._monthsParse[i]) { | ||
22370 | regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, ''); | ||
22371 | this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i'); | ||
22372 | } | ||
22373 | // test the regex | ||
22374 | if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) { | ||
22375 | return i; | ||
22376 | } else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) { | ||
22377 | return i; | ||
22378 | } else if (!strict && this._monthsParse[i].test(monthName)) { | ||
22379 | return i; | ||
22380 | } | ||
22381 | } | ||
22382 | } | ||
20038 | 22383 | ||
20039 | case DAY_OF_WEEK_IN_MONTH: | 22384 | // MOMENTS |
20040 | value = toInt((getMonthLength(fields[YEAR], fields[MONTH]) - 1) / 7) + 1; | 22385 | |
20041 | break; | 22386 | function setMonth (mom, value) { |
20042 | default: | 22387 | var dayOfMonth; |
20043 | break; | 22388 | |
22389 | if (!mom.isValid()) { | ||
22390 | // No op | ||
22391 | return mom; | ||
22392 | } | ||
22393 | |||
22394 | if (typeof value === 'string') { | ||
22395 | if (/^\d+$/.test(value)) { | ||
22396 | value = toInt(value); | ||
22397 | } else { | ||
22398 | value = mom.localeData().monthsParse(value); | ||
22399 | // TODO: Another silent failure? | ||
22400 | if (typeof value !== 'number') { | ||
22401 | return mom; | ||
22402 | } | ||
22403 | } | ||
22404 | } | ||
22405 | |||
22406 | dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value)); | ||
22407 | mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth); | ||
22408 | return mom; | ||
20044 | } | 22409 | } |
20045 | if (value === undefined) { | 22410 | |
20046 | throw new Error('maximum value not defined!'); | 22411 | function getSetMonth (value) { |
22412 | if (value != null) { | ||
22413 | setMonth(this, value); | ||
22414 | utils_hooks__hooks.updateOffset(this, true); | ||
22415 | return this; | ||
22416 | } else { | ||
22417 | return get_set__get(this, 'Month'); | ||
22418 | } | ||
20047 | } | 22419 | } |
20048 | return value; | ||
20049 | }, | ||
20050 | 22420 | ||
20051 | /* | 22421 | function getDaysInMonth () { |
20052 | * Determines if the given calendar field has a value set, | 22422 | return daysInMonth(this.year(), this.month()); |
20053 | * including cases that the value has been set by internal fields calculations | 22423 | } |
20054 | * triggered by a get method call. | ||
20055 | * @param field the calendar field to be cleared. | ||
20056 | * @returns {boolean} true if the given calendar field has a value set; false otherwise. | ||
20057 | */ | ||
20058 | isSet: function isSet(field) { | ||
20059 | return this.fields[field] !== undefined; | ||
20060 | }, | ||
20061 | 22424 | ||
20062 | /* | 22425 | var defaultMonthsShortRegex = matchWord; |
20063 | * Converts the time value (millisecond offset from the Epoch) | 22426 | function monthsShortRegex (isStrict) { |
20064 | * to calendar field values. | 22427 | if (this._monthsParseExact) { |
20065 | * @protected | 22428 | if (!hasOwnProp(this, '_monthsRegex')) { |
20066 | */ | 22429 | computeMonthsParse.call(this); |
20067 | computeFields: function computeFields() { | 22430 | } |
20068 | var time = this.time; | 22431 | if (isStrict) { |
20069 | var timezoneOffset = this.timezoneOffset * ONE_MINUTE; | 22432 | return this._monthsShortStrictRegex; |
20070 | var fixedDate = toInt(timezoneOffset / ONE_DAY); | 22433 | } else { |
20071 | var timeOfDay = timezoneOffset % ONE_DAY; | 22434 | return this._monthsShortRegex; |
20072 | fixedDate += toInt(time / ONE_DAY); | 22435 | } |
20073 | timeOfDay += time % ONE_DAY; | 22436 | } else { |
20074 | if (timeOfDay >= ONE_DAY) { | 22437 | if (!hasOwnProp(this, '_monthsShortRegex')) { |
20075 | timeOfDay -= ONE_DAY; | 22438 | this._monthsShortRegex = defaultMonthsShortRegex; |
20076 | fixedDate++; | 22439 | } |
20077 | } else { | 22440 | return this._monthsShortStrictRegex && isStrict ? |
20078 | while (timeOfDay < 0) { | 22441 | this._monthsShortStrictRegex : this._monthsShortRegex; |
20079 | timeOfDay += ONE_DAY; | 22442 | } |
20080 | fixedDate--; | 22443 | } |
20081 | } | 22444 | |
22445 | var defaultMonthsRegex = matchWord; | ||
22446 | function monthsRegex (isStrict) { | ||
22447 | if (this._monthsParseExact) { | ||
22448 | if (!hasOwnProp(this, '_monthsRegex')) { | ||
22449 | computeMonthsParse.call(this); | ||
22450 | } | ||
22451 | if (isStrict) { | ||
22452 | return this._monthsStrictRegex; | ||
22453 | } else { | ||
22454 | return this._monthsRegex; | ||
22455 | } | ||
22456 | } else { | ||
22457 | if (!hasOwnProp(this, '_monthsRegex')) { | ||
22458 | this._monthsRegex = defaultMonthsRegex; | ||
22459 | } | ||
22460 | return this._monthsStrictRegex && isStrict ? | ||
22461 | this._monthsStrictRegex : this._monthsRegex; | ||
22462 | } | ||
22463 | } | ||
22464 | |||
22465 | function computeMonthsParse () { | ||
22466 | function cmpLenRev(a, b) { | ||
22467 | return b.length - a.length; | ||
22468 | } | ||
22469 | |||
22470 | var shortPieces = [], longPieces = [], mixedPieces = [], | ||
22471 | i, mom; | ||
22472 | for (i = 0; i < 12; i++) { | ||
22473 | // make the regex if we don't have it already | ||
22474 | mom = create_utc__createUTC([2000, i]); | ||
22475 | shortPieces.push(this.monthsShort(mom, '')); | ||
22476 | longPieces.push(this.months(mom, '')); | ||
22477 | mixedPieces.push(this.months(mom, '')); | ||
22478 | mixedPieces.push(this.monthsShort(mom, '')); | ||
22479 | } | ||
22480 | // Sorting makes sure if one month (or abbr) is a prefix of another it | ||
22481 | // will match the longer piece. | ||
22482 | shortPieces.sort(cmpLenRev); | ||
22483 | longPieces.sort(cmpLenRev); | ||
22484 | mixedPieces.sort(cmpLenRev); | ||
22485 | for (i = 0; i < 12; i++) { | ||
22486 | shortPieces[i] = regexEscape(shortPieces[i]); | ||
22487 | longPieces[i] = regexEscape(longPieces[i]); | ||
22488 | } | ||
22489 | for (i = 0; i < 24; i++) { | ||
22490 | mixedPieces[i] = regexEscape(mixedPieces[i]); | ||
22491 | } | ||
22492 | |||
22493 | this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); | ||
22494 | this._monthsShortRegex = this._monthsRegex; | ||
22495 | this._monthsStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i'); | ||
22496 | this._monthsShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i'); | ||
20082 | } | 22497 | } |
20083 | 22498 | ||
20084 | fixedDate += EPOCH_OFFSET; | 22499 | // FORMATTING |
20085 | 22500 | ||
20086 | var date = Utils.getGregorianDateFromFixedDate(fixedDate); | 22501 | addFormatToken('Y', 0, 0, function () { |
22502 | var y = this.year(); | ||
22503 | return y <= 9999 ? '' + y : '+' + y; | ||
22504 | }); | ||
20087 | 22505 | ||
20088 | var year = date.year; | 22506 | addFormatToken(0, ['YY', 2], 0, function () { |
22507 | return this.year() % 100; | ||
22508 | }); | ||
20089 | 22509 | ||
20090 | var fields = this.fields; | 22510 | addFormatToken(0, ['YYYY', 4], 0, 'year'); |
20091 | fields[YEAR] = year; | 22511 | addFormatToken(0, ['YYYYY', 5], 0, 'year'); |
20092 | fields[MONTH] = date.month; | 22512 | addFormatToken(0, ['YYYYYY', 6, true], 0, 'year'); |
20093 | fields[DAY_OF_MONTH] = date.dayOfMonth; | ||
20094 | fields[DAY_OF_WEEK] = date.dayOfWeek; | ||
20095 | 22513 | ||
20096 | if (timeOfDay !== 0) { | 22514 | // ALIASES |
20097 | fields[HOUR_OF_DAY] = toInt(timeOfDay / ONE_HOUR); | 22515 | |
20098 | var r = timeOfDay % ONE_HOUR; | 22516 | addUnitAlias('year', 'y'); |
20099 | fields[MINUTE] = toInt(r / ONE_MINUTE); | 22517 | |
20100 | r %= ONE_MINUTE; | 22518 | // PRIORITIES |
20101 | fields[SECONDS] = toInt(r / ONE_SECOND); | 22519 | |
20102 | fields[MILLISECONDS] = r % ONE_SECOND; | 22520 | addUnitPriority('year', 1); |
20103 | } else { | 22521 | |
20104 | fields[HOUR_OF_DAY] = fields[MINUTE] = fields[SECONDS] = fields[MILLISECONDS] = 0; | 22522 | // PARSING |
22523 | |||
22524 | addRegexToken('Y', matchSigned); | ||
22525 | addRegexToken('YY', match1to2, match2); | ||
22526 | addRegexToken('YYYY', match1to4, match4); | ||
22527 | addRegexToken('YYYYY', match1to6, match6); | ||
22528 | addRegexToken('YYYYYY', match1to6, match6); | ||
22529 | |||
22530 | addParseToken(['YYYYY', 'YYYYYY'], YEAR); | ||
22531 | addParseToken('YYYY', function (input, array) { | ||
22532 | array[YEAR] = input.length === 2 ? utils_hooks__hooks.parseTwoDigitYear(input) : toInt(input); | ||
22533 | }); | ||
22534 | addParseToken('YY', function (input, array) { | ||
22535 | array[YEAR] = utils_hooks__hooks.parseTwoDigitYear(input); | ||
22536 | }); | ||
22537 | addParseToken('Y', function (input, array) { | ||
22538 | array[YEAR] = parseInt(input, 10); | ||
22539 | }); | ||
22540 | |||
22541 | // HELPERS | ||
22542 | |||
22543 | function daysInYear(year) { | ||
22544 | return isLeapYear(year) ? 366 : 365; | ||
20105 | } | 22545 | } |
20106 | 22546 | ||
20107 | var fixedDateJan1 = Utils.getFixedDate(year, GregorianCalendar.JANUARY, 1); | 22547 | function isLeapYear(year) { |
20108 | var dayOfYear = fixedDate - fixedDateJan1 + 1; | 22548 | return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; |
20109 | var fixDateMonth1 = fixedDate - date.dayOfMonth + 1; | 22549 | } |
20110 | 22550 | ||
20111 | fields[DAY_OF_YEAR] = dayOfYear; | 22551 | // HOOKS |
20112 | fields[DAY_OF_WEEK_IN_MONTH] = toInt((date.dayOfMonth - 1) / 7) + 1; | ||
20113 | 22552 | ||
20114 | var weekOfYear = getWeekNumber(this, fixedDateJan1, fixedDate); | 22553 | utils_hooks__hooks.parseTwoDigitYear = function (input) { |
22554 | return toInt(input) + (toInt(input) > 68 ? 1900 : 2000); | ||
22555 | }; | ||
22556 | |||
22557 | // MOMENTS | ||
22558 | |||
22559 | var getSetYear = makeGetSet('FullYear', true); | ||
22560 | |||
22561 | function getIsLeapYear () { | ||
22562 | return isLeapYear(this.year()); | ||
22563 | } | ||
20115 | 22564 | ||
20116 | // 本周没有足够的时间在当前年 | 22565 | function createDate (y, m, d, h, M, s, ms) { |
20117 | if (weekOfYear === 0) { | 22566 | //can't just apply() to create a date: |
20118 | // If the date belongs to the last week of the | 22567 | //http://stackoverflow.com/questions/181348/instantiating-a-javascript-object-by-calling-prototype-constructor-apply |
20119 | // previous year, use the week number of "12/31" of | 22568 | var date = new Date(y, m, d, h, M, s, ms); |
20120 | // the "previous" year. | 22569 | |
20121 | var fixedDec31 = fixedDateJan1 - 1; | 22570 | //the date constructor remaps years 0-99 to 1900-1999 |
20122 | var prevJan1 = fixedDateJan1 - getYearLength(year - 1); | 22571 | if (y < 100 && y >= 0 && isFinite(date.getFullYear())) { |
20123 | weekOfYear = getWeekNumber(this, prevJan1, fixedDec31); | 22572 | date.setFullYear(y); |
20124 | } else | ||
20125 | // 本周是年末最后一周,可能有足够的时间在新的一年 | ||
20126 | if (weekOfYear >= 52) { | ||
20127 | var nextJan1 = fixedDateJan1 + getYearLength(year); | ||
20128 | var nextJan1st = getDayOfWeekDateOnOrBefore(nextJan1 + 6, this.firstDayOfWeek); | ||
20129 | var nDays = nextJan1st - nextJan1; | ||
20130 | // 本周有足够天数在新的一年 | ||
20131 | if (nDays >= this.minimalDaysInFirstWeek && | ||
20132 | // 当天确实在本周,weekOfYear === 53 时是不需要这个判断 | ||
20133 | fixedDate >= nextJan1st - 7) { | ||
20134 | weekOfYear = 1; | ||
20135 | } | 22573 | } |
20136 | } | 22574 | return date; |
22575 | } | ||
20137 | 22576 | ||
20138 | fields[WEEK_OF_YEAR] = weekOfYear; | 22577 | function createUTCDate (y) { |
20139 | fields[WEEK_OF_MONTH] = getWeekNumber(this, fixDateMonth1, fixedDate); | 22578 | var date = new Date(Date.UTC.apply(null, arguments)); |
20140 | 22579 | ||
20141 | this.fieldsComputed = true; | 22580 | //the Date.UTC function remaps years 0-99 to 1900-1999 |
20142 | }, | 22581 | if (y < 100 && y >= 0 && isFinite(date.getUTCFullYear())) { |
22582 | date.setUTCFullYear(y); | ||
22583 | } | ||
22584 | return date; | ||
22585 | } | ||
20143 | 22586 | ||
20144 | /* | 22587 | // start-of-first-week - start-of-year |
20145 | * Converts calendar field values to the time value | 22588 | function firstWeekOffset(year, dow, doy) { |
20146 | * (millisecond offset from the Epoch). | 22589 | var // first-week day -- which january is always in the first week (4 for iso, 1 for other) |
20147 | * @protected | 22590 | fwd = 7 + dow - doy, |
20148 | */ | 22591 | // first-week day local weekday -- which local weekday is fwd |
20149 | computeTime: function computeTime() { | 22592 | fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7; |
20150 | var year = undefined; | ||
20151 | var fields = this.fields; | ||
20152 | if (this.isSet(YEAR)) { | ||
20153 | year = fields[YEAR]; | ||
20154 | } else { | ||
20155 | year = new Date().getFullYear(); | ||
20156 | } | ||
20157 | var timeOfDay = 0; | ||
20158 | if (this.isSet(HOUR_OF_DAY)) { | ||
20159 | timeOfDay += fields[HOUR_OF_DAY]; | ||
20160 | } | ||
20161 | timeOfDay *= 60; | ||
20162 | timeOfDay += fields[MINUTE] || 0; | ||
20163 | timeOfDay *= 60; | ||
20164 | timeOfDay += fields[SECONDS] || 0; | ||
20165 | timeOfDay *= 1000; | ||
20166 | timeOfDay += fields[MILLISECONDS] || 0; | ||
20167 | var fixedDate = 0; | ||
20168 | fields[YEAR] = year; | ||
20169 | fixedDate = fixedDate + this.getFixedDate(); | ||
20170 | // millis represents local wall-clock time in milliseconds. | ||
20171 | var millis = (fixedDate - EPOCH_OFFSET) * ONE_DAY + timeOfDay; | ||
20172 | millis -= this.timezoneOffset * ONE_MINUTE; | ||
20173 | this.time = millis; | ||
20174 | this.computeFields(); | ||
20175 | }, | ||
20176 | 22593 | ||
20177 | /* | 22594 | return -fwdlw + fwd - 1; |
20178 | * Fills in any unset fields in the calendar fields. First, | ||
20179 | * the computeTime() method is called if the time value (millisecond offset from the Epoch) | ||
20180 | * has not been calculated from calendar field values. | ||
20181 | * Then, the computeFields() method is called to calculate all calendar field values. | ||
20182 | * @protected | ||
20183 | */ | ||
20184 | complete: function complete() { | ||
20185 | if (this.time === undefined) { | ||
20186 | this.computeTime(); | ||
20187 | } | 22595 | } |
20188 | if (!this.fieldsComputed) { | 22596 | |
20189 | this.computeFields(); | 22597 | //http://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday |
22598 | function dayOfYearFromWeeks(year, week, weekday, dow, doy) { | ||
22599 | var localWeekday = (7 + weekday - dow) % 7, | ||
22600 | weekOffset = firstWeekOffset(year, dow, doy), | ||
22601 | dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset, | ||
22602 | resYear, resDayOfYear; | ||
22603 | |||
22604 | if (dayOfYear <= 0) { | ||
22605 | resYear = year - 1; | ||
22606 | resDayOfYear = daysInYear(resYear) + dayOfYear; | ||
22607 | } else if (dayOfYear > daysInYear(year)) { | ||
22608 | resYear = year + 1; | ||
22609 | resDayOfYear = dayOfYear - daysInYear(year); | ||
22610 | } else { | ||
22611 | resYear = year; | ||
22612 | resDayOfYear = dayOfYear; | ||
22613 | } | ||
22614 | |||
22615 | return { | ||
22616 | year: resYear, | ||
22617 | dayOfYear: resDayOfYear | ||
22618 | }; | ||
20190 | } | 22619 | } |
20191 | }, | ||
20192 | 22620 | ||
20193 | getFixedDate: function getFixedDate() { | 22621 | function weekOfYear(mom, dow, doy) { |
20194 | var self = this; | 22622 | var weekOffset = firstWeekOffset(mom.year(), dow, doy), |
22623 | week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1, | ||
22624 | resWeek, resYear; | ||
20195 | 22625 | ||
20196 | var fields = self.fields; | 22626 | if (week < 1) { |
22627 | resYear = mom.year() - 1; | ||
22628 | resWeek = week + weeksInYear(resYear, dow, doy); | ||
22629 | } else if (week > weeksInYear(mom.year(), dow, doy)) { | ||
22630 | resWeek = week - weeksInYear(mom.year(), dow, doy); | ||
22631 | resYear = mom.year() + 1; | ||
22632 | } else { | ||
22633 | resYear = mom.year(); | ||
22634 | resWeek = week; | ||
22635 | } | ||
20197 | 22636 | ||
20198 | var firstDayOfWeekCfg = self.firstDayOfWeek; | 22637 | return { |
22638 | week: resWeek, | ||
22639 | year: resYear | ||
22640 | }; | ||
22641 | } | ||
20199 | 22642 | ||
20200 | var year = fields[YEAR]; | 22643 | function weeksInYear(year, dow, doy) { |
22644 | var weekOffset = firstWeekOffset(year, dow, doy), | ||
22645 | weekOffsetNext = firstWeekOffset(year + 1, dow, doy); | ||
22646 | return (daysInYear(year) - weekOffset + weekOffsetNext) / 7; | ||
22647 | } | ||
20201 | 22648 | ||
20202 | var month = GregorianCalendar.JANUARY; | 22649 | // FORMATTING |
20203 | 22650 | ||
20204 | if (self.isSet(MONTH)) { | 22651 | addFormatToken('w', ['ww', 2], 'wo', 'week'); |
20205 | month = fields[MONTH]; | 22652 | addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek'); |
20206 | if (month > GregorianCalendar.DECEMBER) { | 22653 | |
20207 | year += toInt(month / 12); | 22654 | // ALIASES |
20208 | month %= 12; | 22655 | |
20209 | } else if (month < GregorianCalendar.JANUARY) { | 22656 | addUnitAlias('week', 'w'); |
20210 | year += floorDivide(month / 12); | 22657 | addUnitAlias('isoWeek', 'W'); |
20211 | month = mod(month, 12); | 22658 | |
20212 | } | 22659 | // PRIORITIES |
22660 | |||
22661 | addUnitPriority('week', 5); | ||
22662 | addUnitPriority('isoWeek', 5); | ||
22663 | |||
22664 | // PARSING | ||
22665 | |||
22666 | addRegexToken('w', match1to2); | ||
22667 | addRegexToken('ww', match1to2, match2); | ||
22668 | addRegexToken('W', match1to2); | ||
22669 | addRegexToken('WW', match1to2, match2); | ||
22670 | |||
22671 | addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) { | ||
22672 | week[token.substr(0, 1)] = toInt(input); | ||
22673 | }); | ||
22674 | |||
22675 | // HELPERS | ||
22676 | |||
22677 | // LOCALES | ||
22678 | |||
22679 | function localeWeek (mom) { | ||
22680 | return weekOfYear(mom, this._week.dow, this._week.doy).week; | ||
20213 | } | 22681 | } |
20214 | 22682 | ||
20215 | // Get the fixed date since Jan 1, 1 (Gregorian). We are on | 22683 | var defaultLocaleWeek = { |
20216 | // the first day of either `month' or January in 'year'. | 22684 | dow : 0, // Sunday is the first day of the week. |
20217 | var fixedDate = Utils.getFixedDate(year, month, 1); | 22685 | doy : 6 // The week that contains Jan 1st is the first week of the year. |
20218 | var firstDayOfWeek = undefined; | 22686 | }; |
20219 | var dayOfWeek = self.firstDayOfWeek; | ||
20220 | 22687 | ||
20221 | if (self.isSet(DAY_OF_WEEK)) { | 22688 | function localeFirstDayOfWeek () { |
20222 | dayOfWeek = fields[DAY_OF_WEEK]; | 22689 | return this._week.dow; |
20223 | } | 22690 | } |
20224 | 22691 | ||
20225 | if (self.isSet(MONTH)) { | 22692 | function localeFirstDayOfYear () { |
20226 | if (self.isSet(DAY_OF_MONTH)) { | 22693 | return this._week.doy; |
20227 | fixedDate += fields[DAY_OF_MONTH] - 1; | 22694 | } |
20228 | } else { | ||
20229 | if (self.isSet(WEEK_OF_MONTH)) { | ||
20230 | firstDayOfWeek = getDayOfWeekDateOnOrBefore(fixedDate + 6, firstDayOfWeekCfg); | ||
20231 | 22695 | ||
20232 | // If we have enough days in the first week, then | 22696 | // MOMENTS |
20233 | // move to the previous week. | ||
20234 | if (firstDayOfWeek - fixedDate >= self.minimalDaysInFirstWeek) { | ||
20235 | firstDayOfWeek -= 7; | ||
20236 | } | ||
20237 | 22697 | ||
20238 | if (dayOfWeek !== firstDayOfWeekCfg) { | 22698 | function getSetWeek (input) { |
20239 | firstDayOfWeek = getDayOfWeekDateOnOrBefore(firstDayOfWeek + 6, dayOfWeek); | 22699 | var week = this.localeData().week(this); |
20240 | } | 22700 | return input == null ? week : this.add((input - week) * 7, 'd'); |
22701 | } | ||
22702 | |||
22703 | function getSetISOWeek (input) { | ||
22704 | var week = weekOfYear(this, 1, 4).week; | ||
22705 | return input == null ? week : this.add((input - week) * 7, 'd'); | ||
22706 | } | ||
22707 | |||
22708 | // FORMATTING | ||
22709 | |||
22710 | addFormatToken('d', 0, 'do', 'day'); | ||
22711 | |||
22712 | addFormatToken('dd', 0, 0, function (format) { | ||
22713 | return this.localeData().weekdaysMin(this, format); | ||
22714 | }); | ||
22715 | |||
22716 | addFormatToken('ddd', 0, 0, function (format) { | ||
22717 | return this.localeData().weekdaysShort(this, format); | ||
22718 | }); | ||
20241 | 22719 | ||
20242 | fixedDate = firstDayOfWeek + 7 * (fields[WEEK_OF_MONTH] - 1); | 22720 | addFormatToken('dddd', 0, 0, function (format) { |
22721 | return this.localeData().weekdays(this, format); | ||
22722 | }); | ||
22723 | |||
22724 | addFormatToken('e', 0, 0, 'weekday'); | ||
22725 | addFormatToken('E', 0, 0, 'isoWeekday'); | ||
22726 | |||
22727 | // ALIASES | ||
22728 | |||
22729 | addUnitAlias('day', 'd'); | ||
22730 | addUnitAlias('weekday', 'e'); | ||
22731 | addUnitAlias('isoWeekday', 'E'); | ||
22732 | |||
22733 | // PRIORITY | ||
22734 | addUnitPriority('day', 11); | ||
22735 | addUnitPriority('weekday', 11); | ||
22736 | addUnitPriority('isoWeekday', 11); | ||
22737 | |||
22738 | // PARSING | ||
22739 | |||
22740 | addRegexToken('d', match1to2); | ||
22741 | addRegexToken('e', match1to2); | ||
22742 | addRegexToken('E', match1to2); | ||
22743 | addRegexToken('dd', function (isStrict, locale) { | ||
22744 | return locale.weekdaysMinRegex(isStrict); | ||
22745 | }); | ||
22746 | addRegexToken('ddd', function (isStrict, locale) { | ||
22747 | return locale.weekdaysShortRegex(isStrict); | ||
22748 | }); | ||
22749 | addRegexToken('dddd', function (isStrict, locale) { | ||
22750 | return locale.weekdaysRegex(isStrict); | ||
22751 | }); | ||
22752 | |||
22753 | addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) { | ||
22754 | var weekday = config._locale.weekdaysParse(input, token, config._strict); | ||
22755 | // if we didn't get a weekday name, mark the date as invalid | ||
22756 | if (weekday != null) { | ||
22757 | week.d = weekday; | ||
20243 | } else { | 22758 | } else { |
20244 | var dowim = undefined; | 22759 | getParsingFlags(config).invalidWeekday = input; |
20245 | if (self.isSet(DAY_OF_WEEK_IN_MONTH)) { | ||
20246 | dowim = fields[DAY_OF_WEEK_IN_MONTH]; | ||
20247 | } else { | ||
20248 | dowim = 1; | ||
20249 | } | ||
20250 | var lastDate = 7 * dowim; | ||
20251 | if (dowim < 0) { | ||
20252 | lastDate = getMonthLength(year, month) + 7 * (dowim + 1); | ||
20253 | } | ||
20254 | fixedDate = getDayOfWeekDateOnOrBefore(fixedDate + lastDate - 1, dayOfWeek); | ||
20255 | } | 22760 | } |
20256 | } | 22761 | }); |
20257 | } else { | 22762 | |
20258 | // We are on the first day of the year. | 22763 | addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) { |
20259 | if (self.isSet(DAY_OF_YEAR)) { | 22764 | week[token] = toInt(input); |
20260 | fixedDate += fields[DAY_OF_YEAR] - 1; | 22765 | }); |
20261 | } else if (self.isSet(WEEK_OF_YEAR)) { | 22766 | |
20262 | firstDayOfWeek = getDayOfWeekDateOnOrBefore(fixedDate + 6, firstDayOfWeekCfg); | 22767 | // HELPERS |
20263 | // If we have enough days in the first week, then move | 22768 | |
20264 | // to the previous week. | 22769 | function parseWeekday(input, locale) { |
20265 | if (firstDayOfWeek - fixedDate >= self.minimalDaysInFirstWeek) { | 22770 | if (typeof input !== 'string') { |
20266 | firstDayOfWeek -= 7; | 22771 | return input; |
20267 | } | 22772 | } |
20268 | if (dayOfWeek !== firstDayOfWeekCfg) { | 22773 | |
20269 | firstDayOfWeek = getDayOfWeekDateOnOrBefore(firstDayOfWeek + 6, dayOfWeek); | 22774 | if (!isNaN(input)) { |
22775 | return parseInt(input, 10); | ||
20270 | } | 22776 | } |
20271 | fixedDate = firstDayOfWeek + 7 * (fields[WEEK_OF_YEAR] - 1); | 22777 | |
20272 | } | 22778 | input = locale.weekdaysParse(input); |
22779 | if (typeof input === 'number') { | ||
22780 | return input; | ||
22781 | } | ||
22782 | |||
22783 | return null; | ||
20273 | } | 22784 | } |
20274 | 22785 | ||
20275 | return fixedDate; | 22786 | function parseIsoWeekday(input, locale) { |
20276 | }, | 22787 | if (typeof input === 'string') { |
22788 | return locale.weekdaysParse(input) % 7 || 7; | ||
22789 | } | ||
22790 | return isNaN(input) ? null : input; | ||
22791 | } | ||
20277 | 22792 | ||
20278 | /* | 22793 | // LOCALES |
20279 | * Returns this Calendar's time value in milliseconds | 22794 | |
20280 | * @member Date.Gregorian | 22795 | var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'); |
20281 | * @returns {Number} the current time as UTC milliseconds from the epoch. | 22796 | function localeWeekdays (m, format) { |
20282 | */ | 22797 | return isArray(this._weekdays) ? this._weekdays[m.day()] : |
20283 | getTime: function getTime() { | 22798 | this._weekdays[this._weekdays.isFormat.test(format) ? 'format' : 'standalone'][m.day()]; |
20284 | if (this.time === undefined) { | ||
20285 | this.computeTime(); | ||
20286 | } | 22799 | } |
20287 | return this.time; | ||
20288 | }, | ||
20289 | 22800 | ||
20290 | /* | 22801 | var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'); |
20291 | * Sets this Calendar's current time from the given long value. | 22802 | function localeWeekdaysShort (m) { |
20292 | * @param time the new time in UTC milliseconds from the epoch. | 22803 | return this._weekdaysShort[m.day()]; |
20293 | */ | 22804 | } |
20294 | setTime: function setTime(time) { | ||
20295 | this.time = time; | ||
20296 | this.fieldsComputed = false; | ||
20297 | this.complete(); | ||
20298 | }, | ||
20299 | 22805 | ||
20300 | /* | 22806 | var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'); |
20301 | * Returns the value of the given calendar field. | 22807 | function localeWeekdaysMin (m) { |
20302 | * @param field the given calendar field. | 22808 | return this._weekdaysMin[m.day()]; |
20303 | * @returns {Number} the value for the given calendar field. | 22809 | } |
20304 | */ | ||
20305 | get: function get(field) { | ||
20306 | this.complete(); | ||
20307 | return this.fields[field]; | ||
20308 | }, | ||
20309 | 22810 | ||
20310 | /* | 22811 | function day_of_week__handleStrictParse(weekdayName, format, strict) { |
20311 | * Returns the year of the given calendar field. | 22812 | var i, ii, mom, llc = weekdayName.toLocaleLowerCase(); |
20312 | * @method getYear | 22813 | if (!this._weekdaysParse) { |
20313 | * @returns {Number} the year for the given calendar field. | 22814 | this._weekdaysParse = []; |
20314 | */ | 22815 | this._shortWeekdaysParse = []; |
22816 | this._minWeekdaysParse = []; | ||
20315 | 22817 | ||
20316 | /* | 22818 | for (i = 0; i < 7; ++i) { |
20317 | * Returns the month of the given calendar field. | 22819 | mom = create_utc__createUTC([2000, 1]).day(i); |
20318 | * @method getMonth | 22820 | this._minWeekdaysParse[i] = this.weekdaysMin(mom, '').toLocaleLowerCase(); |
20319 | * @returns {Number} the month for the given calendar field. | 22821 | this._shortWeekdaysParse[i] = this.weekdaysShort(mom, '').toLocaleLowerCase(); |
20320 | */ | 22822 | this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase(); |
22823 | } | ||
22824 | } | ||
20321 | 22825 | ||
20322 | /* | 22826 | if (strict) { |
20323 | * Returns the day of month of the given calendar field. | 22827 | if (format === 'dddd') { |
20324 | * @method getDayOfMonth | 22828 | ii = indexOf.call(this._weekdaysParse, llc); |
20325 | * @returns {Number} the day of month for the given calendar field. | 22829 | return ii !== -1 ? ii : null; |
20326 | */ | 22830 | } else if (format === 'ddd') { |
22831 | ii = indexOf.call(this._shortWeekdaysParse, llc); | ||
22832 | return ii !== -1 ? ii : null; | ||
22833 | } else { | ||
22834 | ii = indexOf.call(this._minWeekdaysParse, llc); | ||
22835 | return ii !== -1 ? ii : null; | ||
22836 | } | ||
22837 | } else { | ||
22838 | if (format === 'dddd') { | ||
22839 | ii = indexOf.call(this._weekdaysParse, llc); | ||
22840 | if (ii !== -1) { | ||
22841 | return ii; | ||
22842 | } | ||
22843 | ii = indexOf.call(this._shortWeekdaysParse, llc); | ||
22844 | if (ii !== -1) { | ||
22845 | return ii; | ||
22846 | } | ||
22847 | ii = indexOf.call(this._minWeekdaysParse, llc); | ||
22848 | return ii !== -1 ? ii : null; | ||
22849 | } else if (format === 'ddd') { | ||
22850 | ii = indexOf.call(this._shortWeekdaysParse, llc); | ||
22851 | if (ii !== -1) { | ||
22852 | return ii; | ||
22853 | } | ||
22854 | ii = indexOf.call(this._weekdaysParse, llc); | ||
22855 | if (ii !== -1) { | ||
22856 | return ii; | ||
22857 | } | ||
22858 | ii = indexOf.call(this._minWeekdaysParse, llc); | ||
22859 | return ii !== -1 ? ii : null; | ||
22860 | } else { | ||
22861 | ii = indexOf.call(this._minWeekdaysParse, llc); | ||
22862 | if (ii !== -1) { | ||
22863 | return ii; | ||
22864 | } | ||
22865 | ii = indexOf.call(this._weekdaysParse, llc); | ||
22866 | if (ii !== -1) { | ||
22867 | return ii; | ||
22868 | } | ||
22869 | ii = indexOf.call(this._shortWeekdaysParse, llc); | ||
22870 | return ii !== -1 ? ii : null; | ||
22871 | } | ||
22872 | } | ||
22873 | } | ||
20327 | 22874 | ||
20328 | /* | 22875 | function localeWeekdaysParse (weekdayName, format, strict) { |
20329 | * Returns the hour of day of the given calendar field. | 22876 | var i, mom, regex; |
20330 | * @method getHourOfDay | ||
20331 | * @returns {Number} the hour of day for the given calendar field. | ||
20332 | */ | ||
20333 | 22877 | ||
20334 | /* | 22878 | if (this._weekdaysParseExact) { |
20335 | * Returns the minute of the given calendar field. | 22879 | return day_of_week__handleStrictParse.call(this, weekdayName, format, strict); |
20336 | * @method getMinute | 22880 | } |
20337 | * @returns {Number} the minute for the given calendar field. | ||
20338 | */ | ||
20339 | 22881 | ||
20340 | /* | 22882 | if (!this._weekdaysParse) { |
20341 | * Returns the second of the given calendar field. | 22883 | this._weekdaysParse = []; |
20342 | * @method getSecond | 22884 | this._minWeekdaysParse = []; |
20343 | * @returns {Number} the second for the given calendar field. | 22885 | this._shortWeekdaysParse = []; |
20344 | */ | 22886 | this._fullWeekdaysParse = []; |
22887 | } | ||
20345 | 22888 | ||
20346 | /* | 22889 | for (i = 0; i < 7; i++) { |
20347 | * Returns the millisecond of the given calendar field. | 22890 | // make the regex if we don't have it already |
20348 | * @method getMilliSecond | ||
20349 | * @returns {Number} the millisecond for the given calendar field. | ||
20350 | */ | ||
20351 | 22891 | ||
20352 | /* | 22892 | mom = create_utc__createUTC([2000, 1]).day(i); |
20353 | * Returns the week of year of the given calendar field. | 22893 | if (strict && !this._fullWeekdaysParse[i]) { |
20354 | * @method getWeekOfYear | 22894 | this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\.?') + '$', 'i'); |
20355 | * @returns {Number} the week of year for the given calendar field. | 22895 | this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\.?') + '$', 'i'); |
20356 | */ | 22896 | this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\.?') + '$', 'i'); |
22897 | } | ||
22898 | if (!this._weekdaysParse[i]) { | ||
22899 | regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, ''); | ||
22900 | this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i'); | ||
22901 | } | ||
22902 | // test the regex | ||
22903 | if (strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName)) { | ||
22904 | return i; | ||
22905 | } else if (strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName)) { | ||
22906 | return i; | ||
22907 | } else if (strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName)) { | ||
22908 | return i; | ||
22909 | } else if (!strict && this._weekdaysParse[i].test(weekdayName)) { | ||
22910 | return i; | ||
22911 | } | ||
22912 | } | ||
22913 | } | ||
20357 | 22914 | ||
20358 | /* | 22915 | // MOMENTS |
20359 | * Returns the week of month of the given calendar field. | ||
20360 | * @method getWeekOfMonth | ||
20361 | * @returns {Number} the week of month for the given calendar field. | ||
20362 | */ | ||
20363 | 22916 | ||
20364 | /* | 22917 | function getSetDayOfWeek (input) { |
20365 | * Returns the day of year of the given calendar field. | 22918 | if (!this.isValid()) { |
20366 | * @method getDayOfYear | 22919 | return input != null ? this : NaN; |
20367 | * @returns {Number} the day of year for the given calendar field. | 22920 | } |
20368 | */ | 22921 | var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay(); |
22922 | if (input != null) { | ||
22923 | input = parseWeekday(input, this.localeData()); | ||
22924 | return this.add(input - day, 'd'); | ||
22925 | } else { | ||
22926 | return day; | ||
22927 | } | ||
22928 | } | ||
20369 | 22929 | ||
20370 | /* | 22930 | function getSetLocaleDayOfWeek (input) { |
20371 | * Returns the day of week of the given calendar field. | 22931 | if (!this.isValid()) { |
20372 | * @method getDayOfWeek | 22932 | return input != null ? this : NaN; |
20373 | * @returns {Number} the day of week for the given calendar field. | 22933 | } |
20374 | */ | 22934 | var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7; |
22935 | return input == null ? weekday : this.add(input - weekday, 'd'); | ||
22936 | } | ||
20375 | 22937 | ||
20376 | /* | 22938 | function getSetISODayOfWeek (input) { |
20377 | * Returns the day of week in month of the given calendar field. | 22939 | if (!this.isValid()) { |
20378 | * @method getDayOfWeekInMonth | 22940 | return input != null ? this : NaN; |
20379 | * @returns {Number} the day of week in month for the given calendar field. | 22941 | } |
20380 | */ | ||
20381 | 22942 | ||
20382 | /* | 22943 | // behaves the same as moment#day except |
20383 | * Sets the given calendar field to the given value. | 22944 | // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6) |
20384 | * @param field the given calendar field. | 22945 | // as a setter, sunday should belong to the previous week. |
20385 | * @param v the value to be set for the given calendar field. | 22946 | |
20386 | */ | 22947 | if (input != null) { |
20387 | set: function set(field, v) { | 22948 | var weekday = parseIsoWeekday(input, this.localeData()); |
20388 | var len = arguments.length; | 22949 | return this.day(this.day() % 7 ? weekday : weekday - 7); |
20389 | if (len === 2) { | 22950 | } else { |
20390 | this.fields[field] = v; | 22951 | return this.day() || 7; |
20391 | } else if (len < MILLISECONDS + 1) { | 22952 | } |
20392 | for (var i = 0; i < len; i++) { | ||
20393 | this.fields[YEAR + i] = arguments[i]; | ||
20394 | } | ||
20395 | } else { | ||
20396 | throw new Error('illegal arguments for GregorianCalendar set'); | ||
20397 | } | 22953 | } |
20398 | this.time = undefined; | ||
20399 | }, | ||
20400 | 22954 | ||
20401 | /* | 22955 | var defaultWeekdaysRegex = matchWord; |
20402 | * Set the year of the given calendar field. | 22956 | function weekdaysRegex (isStrict) { |
20403 | * @method setYear | 22957 | if (this._weekdaysParseExact) { |
20404 | */ | 22958 | if (!hasOwnProp(this, '_weekdaysRegex')) { |
22959 | computeWeekdaysParse.call(this); | ||
22960 | } | ||
22961 | if (isStrict) { | ||
22962 | return this._weekdaysStrictRegex; | ||
22963 | } else { | ||
22964 | return this._weekdaysRegex; | ||
22965 | } | ||
22966 | } else { | ||
22967 | if (!hasOwnProp(this, '_weekdaysRegex')) { | ||
22968 | this._weekdaysRegex = defaultWeekdaysRegex; | ||
22969 | } | ||
22970 | return this._weekdaysStrictRegex && isStrict ? | ||
22971 | this._weekdaysStrictRegex : this._weekdaysRegex; | ||
22972 | } | ||
22973 | } | ||
20405 | 22974 | ||
20406 | /* | 22975 | var defaultWeekdaysShortRegex = matchWord; |
20407 | * Set the month of the given calendar field. | 22976 | function weekdaysShortRegex (isStrict) { |
20408 | * @method setMonth | 22977 | if (this._weekdaysParseExact) { |
20409 | */ | 22978 | if (!hasOwnProp(this, '_weekdaysRegex')) { |
22979 | computeWeekdaysParse.call(this); | ||
22980 | } | ||
22981 | if (isStrict) { | ||
22982 | return this._weekdaysShortStrictRegex; | ||
22983 | } else { | ||
22984 | return this._weekdaysShortRegex; | ||
22985 | } | ||
22986 | } else { | ||
22987 | if (!hasOwnProp(this, '_weekdaysShortRegex')) { | ||
22988 | this._weekdaysShortRegex = defaultWeekdaysShortRegex; | ||
22989 | } | ||
22990 | return this._weekdaysShortStrictRegex && isStrict ? | ||
22991 | this._weekdaysShortStrictRegex : this._weekdaysShortRegex; | ||
22992 | } | ||
22993 | } | ||
20410 | 22994 | ||
20411 | /* | 22995 | var defaultWeekdaysMinRegex = matchWord; |
20412 | * Set the day of month of the given calendar field. | 22996 | function weekdaysMinRegex (isStrict) { |
20413 | * @method setDayOfMonth | 22997 | if (this._weekdaysParseExact) { |
20414 | */ | 22998 | if (!hasOwnProp(this, '_weekdaysRegex')) { |
22999 | computeWeekdaysParse.call(this); | ||
23000 | } | ||
23001 | if (isStrict) { | ||
23002 | return this._weekdaysMinStrictRegex; | ||
23003 | } else { | ||
23004 | return this._weekdaysMinRegex; | ||
23005 | } | ||
23006 | } else { | ||
23007 | if (!hasOwnProp(this, '_weekdaysMinRegex')) { | ||
23008 | this._weekdaysMinRegex = defaultWeekdaysMinRegex; | ||
23009 | } | ||
23010 | return this._weekdaysMinStrictRegex && isStrict ? | ||
23011 | this._weekdaysMinStrictRegex : this._weekdaysMinRegex; | ||
23012 | } | ||
23013 | } | ||
20415 | 23014 | ||
20416 | /* | ||
20417 | * Set the hour of day of the given calendar field. | ||
20418 | * @method setHourOfDay | ||
20419 | */ | ||
20420 | 23015 | ||
20421 | /* | 23016 | function computeWeekdaysParse () { |
20422 | * Set the minute of the given calendar field. | 23017 | function cmpLenRev(a, b) { |
20423 | * @method setMinute | 23018 | return b.length - a.length; |
20424 | */ | 23019 | } |
20425 | 23020 | ||
20426 | /* | 23021 | var minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [], |
20427 | * Set the second of the given calendar field. | 23022 | i, mom, minp, shortp, longp; |
20428 | * @method setSecond | 23023 | for (i = 0; i < 7; i++) { |
20429 | */ | 23024 | // make the regex if we don't have it already |
23025 | mom = create_utc__createUTC([2000, 1]).day(i); | ||
23026 | minp = this.weekdaysMin(mom, ''); | ||
23027 | shortp = this.weekdaysShort(mom, ''); | ||
23028 | longp = this.weekdays(mom, ''); | ||
23029 | minPieces.push(minp); | ||
23030 | shortPieces.push(shortp); | ||
23031 | longPieces.push(longp); | ||
23032 | mixedPieces.push(minp); | ||
23033 | mixedPieces.push(shortp); | ||
23034 | mixedPieces.push(longp); | ||
23035 | } | ||
23036 | // Sorting makes sure if one weekday (or abbr) is a prefix of another it | ||
23037 | // will match the longer piece. | ||
23038 | minPieces.sort(cmpLenRev); | ||
23039 | shortPieces.sort(cmpLenRev); | ||
23040 | longPieces.sort(cmpLenRev); | ||
23041 | mixedPieces.sort(cmpLenRev); | ||
23042 | for (i = 0; i < 7; i++) { | ||
23043 | shortPieces[i] = regexEscape(shortPieces[i]); | ||
23044 | longPieces[i] = regexEscape(longPieces[i]); | ||
23045 | mixedPieces[i] = regexEscape(mixedPieces[i]); | ||
23046 | } | ||
20430 | 23047 | ||
20431 | /* | 23048 | this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); |
20432 | * Set the millisecond of the given calendar field. | 23049 | this._weekdaysShortRegex = this._weekdaysRegex; |
20433 | * @method setMilliSecond | 23050 | this._weekdaysMinRegex = this._weekdaysRegex; |
20434 | */ | ||
20435 | 23051 | ||
20436 | /* | 23052 | this._weekdaysStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i'); |
20437 | * Set the week of year of the given calendar field. | 23053 | this._weekdaysShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i'); |
20438 | * @method setWeekOfYear | 23054 | this._weekdaysMinStrictRegex = new RegExp('^(' + minPieces.join('|') + ')', 'i'); |
20439 | */ | 23055 | } |
20440 | 23056 | ||
20441 | /* | 23057 | // FORMATTING |
20442 | * Set the week of month of the given calendar field. | ||
20443 | * @method setWeekOfMonth | ||
20444 | */ | ||
20445 | 23058 | ||
20446 | /* | 23059 | function hFormat() { |
20447 | * Set the day of year of the given calendar field. | 23060 | return this.hours() % 12 || 12; |
20448 | * @method setDayOfYear | 23061 | } |
20449 | */ | ||
20450 | 23062 | ||
20451 | /* | 23063 | function kFormat() { |
20452 | * Set the day of week of the given calendar field. | 23064 | return this.hours() || 24; |
20453 | * @method setDayOfWeek | 23065 | } |
20454 | */ | ||
20455 | 23066 | ||
20456 | /* | 23067 | addFormatToken('H', ['HH', 2], 0, 'hour'); |
20457 | * Set the day of week in month of the given calendar field. | 23068 | addFormatToken('h', ['hh', 2], 0, hFormat); |
20458 | * @method setDayOfWeekInMonth | 23069 | addFormatToken('k', ['kk', 2], 0, kFormat); |
20459 | */ | ||
20460 | 23070 | ||
20461 | /* | 23071 | addFormatToken('hmm', 0, 0, function () { |
20462 | * add for specified field based on two rules: | 23072 | return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2); |
20463 | * | 23073 | }); |
20464 | * - Add rule 1. The value of field after the call minus the value of field before the | 23074 | |
20465 | * call is amount, modulo any overflow that has occurred in field | 23075 | addFormatToken('hmmss', 0, 0, function () { |
20466 | * Overflow occurs when a field value exceeds its range and, | 23076 | return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) + |
20467 | * as a result, the next larger field is incremented or | 23077 | zeroFill(this.seconds(), 2); |
20468 | * decremented and the field value is adjusted back into its range. | 23078 | }); |
20469 | * | 23079 | |
20470 | * - Add rule 2. If a smaller field is expected to be invariant, | 23080 | addFormatToken('Hmm', 0, 0, function () { |
20471 | * but it is impossible for it to be equal to its | 23081 | return '' + this.hours() + zeroFill(this.minutes(), 2); |
20472 | * prior value because of changes in its minimum or maximum after | 23082 | }); |
20473 | * field is changed, then its value is adjusted to be as close | 23083 | |
20474 | * as possible to its expected value. A smaller field represents a | 23084 | addFormatToken('Hmmss', 0, 0, function () { |
20475 | * smaller unit of time. HOUR_OF_DAY is a smaller field than | 23085 | return '' + this.hours() + zeroFill(this.minutes(), 2) + |
20476 | * DAY_OF_MONTH. No adjustment is made to smaller fields | 23086 | zeroFill(this.seconds(), 2); |
20477 | * that are not expected to be invariant. The calendar system | 23087 | }); |
20478 | * determines what fields are expected to be invariant. | 23088 | |
20479 | * | 23089 | function meridiem (token, lowercase) { |
20480 | * | 23090 | addFormatToken(token, 0, 0, function () { |
20481 | * @example | 23091 | return this.localeData().meridiem(this.hours(), this.minutes(), lowercase); |
20482 | * use('date/gregorian',function(S, GregorianCalendar){ | 23092 | }); |
20483 | * const d = new GregorianCalendar(); | ||
20484 | * d.set(2012, GregorianCalendar.JANUARY, 31); | ||
20485 | * d.add(Gregorian.MONTH,1); | ||
20486 | * // 2012-2-29 | ||
20487 | * document.writeln('<p>'+d.getYear()+'-'+d.getMonth()+'-'+d.getDayOfWeek()) | ||
20488 | * d.add(Gregorian.MONTH,12); | ||
20489 | * // 2013-2-28 | ||
20490 | * document.writeln('<p>'+d.getYear()+'-'+d.getMonth()+'-'+d.getDayOfWeek()) | ||
20491 | * }); | ||
20492 | * | ||
20493 | * @param field the calendar field. | ||
20494 | * @param {Number} amount he amount of date or time to be added to the field. | ||
20495 | */ | ||
20496 | add: function add(field, a) { | ||
20497 | if (!a) { | ||
20498 | return; | ||
20499 | } | 23093 | } |
20500 | var amount = a; | 23094 | |
20501 | var self = this; | 23095 | meridiem('a', true); |
20502 | var fields = self.fields; | 23096 | meridiem('A', false); |
20503 | // computer and retrieve original value | 23097 | |
20504 | var value = self.get(field); | 23098 | // ALIASES |
20505 | if (field === YEAR) { | 23099 | |
20506 | value += amount; | 23100 | addUnitAlias('hour', 'h'); |
20507 | self.set(YEAR, value); | 23101 | |
20508 | adjustDayOfMonth(self); | 23102 | // PRIORITY |
20509 | } else if (field === MONTH) { | 23103 | addUnitPriority('hour', 13); |
20510 | value += amount; | 23104 | |
20511 | var yearAmount = floorDivide(value / 12); | 23105 | // PARSING |
20512 | value = mod(value, 12); | 23106 | |
20513 | if (yearAmount) { | 23107 | function matchMeridiem (isStrict, locale) { |
20514 | self.set(YEAR, fields[YEAR] + yearAmount); | 23108 | return locale._meridiemParse; |
20515 | } | ||
20516 | self.set(MONTH, value); | ||
20517 | adjustDayOfMonth(self); | ||
20518 | } else { | ||
20519 | switch (field) { | ||
20520 | case HOUR_OF_DAY: | ||
20521 | amount *= ONE_HOUR; | ||
20522 | break; | ||
20523 | case MINUTE: | ||
20524 | amount *= ONE_MINUTE; | ||
20525 | break; | ||
20526 | case SECONDS: | ||
20527 | amount *= ONE_SECOND; | ||
20528 | break; | ||
20529 | case MILLISECONDS: | ||
20530 | break; | ||
20531 | case WEEK_OF_MONTH: | ||
20532 | case WEEK_OF_YEAR: | ||
20533 | case DAY_OF_WEEK_IN_MONTH: | ||
20534 | amount *= ONE_WEEK; | ||
20535 | break; | ||
20536 | case DAY_OF_WEEK: | ||
20537 | case DAY_OF_YEAR: | ||
20538 | case DAY_OF_MONTH: | ||
20539 | amount *= ONE_DAY; | ||
20540 | break; | ||
20541 | default: | ||
20542 | throw new Error('illegal field for add'); | ||
20543 | } | ||
20544 | self.setTime(self.time + amount); | ||
20545 | } | 23109 | } |
20546 | }, | ||
20547 | 23110 | ||
20548 | /* | 23111 | addRegexToken('a', matchMeridiem); |
20549 | * add the year of the given calendar field. | 23112 | addRegexToken('A', matchMeridiem); |
20550 | * @method addYear | 23113 | addRegexToken('H', match1to2); |
20551 | * @param {Number} amount the signed amount to add to field. | 23114 | addRegexToken('h', match1to2); |
20552 | */ | 23115 | addRegexToken('HH', match1to2, match2); |
23116 | addRegexToken('hh', match1to2, match2); | ||
20553 | 23117 | ||
20554 | /* | 23118 | addRegexToken('hmm', match3to4); |
20555 | * add the month of the given calendar field. | 23119 | addRegexToken('hmmss', match5to6); |
20556 | * @method addMonth | 23120 | addRegexToken('Hmm', match3to4); |
20557 | * @param {Number} amount the signed amount to add to field. | 23121 | addRegexToken('Hmmss', match5to6); |
20558 | */ | ||
20559 | 23122 | ||
20560 | /* | 23123 | addParseToken(['H', 'HH'], HOUR); |
20561 | * add the day of month of the given calendar field. | 23124 | addParseToken(['a', 'A'], function (input, array, config) { |
20562 | * @method addDayOfMonth | 23125 | config._isPm = config._locale.isPM(input); |
20563 | * @param {Number} amount the signed amount to add to field. | 23126 | config._meridiem = input; |
20564 | */ | 23127 | }); |
23128 | addParseToken(['h', 'hh'], function (input, array, config) { | ||
23129 | array[HOUR] = toInt(input); | ||
23130 | getParsingFlags(config).bigHour = true; | ||
23131 | }); | ||
23132 | addParseToken('hmm', function (input, array, config) { | ||
23133 | var pos = input.length - 2; | ||
23134 | array[HOUR] = toInt(input.substr(0, pos)); | ||
23135 | array[MINUTE] = toInt(input.substr(pos)); | ||
23136 | getParsingFlags(config).bigHour = true; | ||
23137 | }); | ||
23138 | addParseToken('hmmss', function (input, array, config) { | ||
23139 | var pos1 = input.length - 4; | ||
23140 | var pos2 = input.length - 2; | ||
23141 | array[HOUR] = toInt(input.substr(0, pos1)); | ||
23142 | array[MINUTE] = toInt(input.substr(pos1, 2)); | ||
23143 | array[SECOND] = toInt(input.substr(pos2)); | ||
23144 | getParsingFlags(config).bigHour = true; | ||
23145 | }); | ||
23146 | addParseToken('Hmm', function (input, array, config) { | ||
23147 | var pos = input.length - 2; | ||
23148 | array[HOUR] = toInt(input.substr(0, pos)); | ||
23149 | array[MINUTE] = toInt(input.substr(pos)); | ||
23150 | }); | ||
23151 | addParseToken('Hmmss', function (input, array, config) { | ||
23152 | var pos1 = input.length - 4; | ||
23153 | var pos2 = input.length - 2; | ||
23154 | array[HOUR] = toInt(input.substr(0, pos1)); | ||
23155 | array[MINUTE] = toInt(input.substr(pos1, 2)); | ||
23156 | array[SECOND] = toInt(input.substr(pos2)); | ||
23157 | }); | ||
20565 | 23158 | ||
20566 | /* | 23159 | // LOCALES |
20567 | * add the hour of day of the given calendar field. | ||
20568 | * @method addHourOfDay | ||
20569 | * @param {Number} amount the signed amount to add to field. | ||
20570 | */ | ||
20571 | 23160 | ||
20572 | /* | 23161 | function localeIsPM (input) { |
20573 | * add the minute of the given calendar field. | 23162 | // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays |
20574 | * @method addMinute | 23163 | // Using charAt should be more compatible. |
20575 | * @param {Number} amount the signed amount to add to field. | 23164 | return ((input + '').toLowerCase().charAt(0) === 'p'); |
20576 | */ | 23165 | } |
20577 | 23166 | ||
20578 | /* | 23167 | var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i; |
20579 | * add the second of the given calendar field. | 23168 | function localeMeridiem (hours, minutes, isLower) { |
20580 | * @method addSecond | 23169 | if (hours > 11) { |
20581 | * @param {Number} amount the signed amount to add to field. | 23170 | return isLower ? 'pm' : 'PM'; |
20582 | */ | 23171 | } else { |
23172 | return isLower ? 'am' : 'AM'; | ||
23173 | } | ||
23174 | } | ||
20583 | 23175 | ||
20584 | /* | ||
20585 | * add the millisecond of the given calendar field. | ||
20586 | * @method addMilliSecond | ||
20587 | * @param {Number} amount the signed amount to add to field. | ||
20588 | */ | ||
20589 | 23176 | ||
20590 | /* | 23177 | // MOMENTS |
20591 | * add the week of year of the given calendar field. | ||
20592 | * @method addWeekOfYear | ||
20593 | * @param {Number} amount the signed amount to add to field. | ||
20594 | */ | ||
20595 | 23178 | ||
20596 | /* | 23179 | // Setting the hour should keep the time, because the user explicitly |
20597 | * add the week of month of the given calendar field. | 23180 | // specified which hour he wants. So trying to maintain the same hour (in |
20598 | * @method addWeekOfMonth | 23181 | // a new timezone) makes sense. Adding/subtracting hours does not follow |
20599 | * @param {Number} amount the signed amount to add to field. | 23182 | // this rule. |
20600 | */ | 23183 | var getSetHour = makeGetSet('Hours', true); |
20601 | 23184 | ||
20602 | /* | 23185 | var baseConfig = { |
20603 | * add the day of year of the given calendar field. | 23186 | calendar: defaultCalendar, |
20604 | * @method addDayOfYear | 23187 | longDateFormat: defaultLongDateFormat, |
20605 | * @param {Number} amount the signed amount to add to field. | 23188 | invalidDate: defaultInvalidDate, |
20606 | */ | 23189 | ordinal: defaultOrdinal, |
23190 | ordinalParse: defaultOrdinalParse, | ||
23191 | relativeTime: defaultRelativeTime, | ||
20607 | 23192 | ||
20608 | /* | 23193 | months: defaultLocaleMonths, |
20609 | * add the day of week of the given calendar field. | 23194 | monthsShort: defaultLocaleMonthsShort, |
20610 | * @method addDayOfWeek | ||
20611 | * @param {Number} amount the signed amount to add to field. | ||
20612 | */ | ||
20613 | 23195 | ||
20614 | /* | 23196 | week: defaultLocaleWeek, |
20615 | * add the day of week in month of the given calendar field. | ||
20616 | * @method addDayOfWeekInMonth | ||
20617 | * @param {Number} amount the signed amount to add to field. | ||
20618 | */ | ||
20619 | 23197 | ||
20620 | /* | 23198 | weekdays: defaultLocaleWeekdays, |
20621 | * Get rolled value for the field | 23199 | weekdaysMin: defaultLocaleWeekdaysMin, |
20622 | * @protected | 23200 | weekdaysShort: defaultLocaleWeekdaysShort, |
20623 | */ | ||
20624 | getRolledValue: function getRolledValue(value, a, min, max) { | ||
20625 | var amount = a; | ||
20626 | var diff = value - min; | ||
20627 | var range = max - min + 1; | ||
20628 | amount %= range; | ||
20629 | return min + (diff + amount + range) % range; | ||
20630 | }, | ||
20631 | 23201 | ||
20632 | /* | 23202 | meridiemParse: defaultLocaleMeridiemParse |
20633 | * Adds a signed amount to the specified calendar field without changing larger fields. | 23203 | }; |
20634 | * A negative roll amount means to subtract from field without changing | 23204 | |
20635 | * larger fields. If the specified amount is 0, this method performs nothing. | 23205 | // internal storage for locale config files |
20636 | * | 23206 | var locales = {}; |
20637 | * | 23207 | var globalLocale; |
20638 | * | 23208 | |
20639 | * @example | 23209 | function normalizeLocale(key) { |
20640 | * const d = new GregorianCalendar(); | 23210 | return key ? key.toLowerCase().replace('_', '-') : key; |
20641 | * d.set(1999, GregorianCalendar.AUGUST, 31); | 23211 | } |
20642 | * // 1999-4-30 | 23212 | |
20643 | * // Tuesday June 1, 1999 | 23213 | // pick the locale from the array |
20644 | * d.set(1999, GregorianCalendar.JUNE, 1); | 23214 | // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each |
20645 | * d.add(Gregorian.WEEK_OF_MONTH,-1); // === d.add(Gregorian.WEEK_OF_MONTH, | 23215 | // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root |
20646 | * d.get(Gregorian.WEEK_OF_MONTH)); | 23216 | function chooseLocale(names) { |
20647 | * // 1999-06-29 | 23217 | var i = 0, j, next, locale, split; |
20648 | * | 23218 | |
20649 | * | 23219 | while (i < names.length) { |
20650 | * @param field the calendar field. | 23220 | split = normalizeLocale(names[i]).split('-'); |
20651 | * @param {Number} amount the signed amount to add to field. | 23221 | j = split.length; |
20652 | */ | 23222 | next = normalizeLocale(names[i + 1]); |
20653 | roll: function roll(field, amount) { | 23223 | next = next ? next.split('-') : null; |
20654 | if (!amount) { | 23224 | while (j > 0) { |
20655 | return; | 23225 | locale = loadLocale(split.slice(0, j).join('-')); |
23226 | if (locale) { | ||
23227 | return locale; | ||
23228 | } | ||
23229 | if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) { | ||
23230 | //the next array item is better than a shallower substring of this one | ||
23231 | break; | ||
23232 | } | ||
23233 | j--; | ||
23234 | } | ||
23235 | i++; | ||
23236 | } | ||
23237 | return null; | ||
23238 | } | ||
23239 | |||
23240 | function loadLocale(name) { | ||
23241 | var oldLocale = null; | ||
23242 | // TODO: Find a better way to register and load all the locales in Node | ||
23243 | if (!locales[name] && (typeof module !== 'undefined') && | ||
23244 | module && module.exports) { | ||
23245 | try { | ||
23246 | oldLocale = globalLocale._abbr; | ||
23247 | require('./locale/' + name); | ||
23248 | // because defineLocale currently also sets the global locale, we | ||
23249 | // want to undo that for lazy loaded locales | ||
23250 | locale_locales__getSetGlobalLocale(oldLocale); | ||
23251 | } catch (e) { } | ||
23252 | } | ||
23253 | return locales[name]; | ||
20656 | } | 23254 | } |
20657 | var self = this; | ||
20658 | // computer and retrieve original value | ||
20659 | var value = self.get(field); | ||
20660 | var min = self.getActualMinimum(field); | ||
20661 | var max = self.getActualMaximum(field); | ||
20662 | value = self.getRolledValue(value, amount, min, max); | ||
20663 | 23255 | ||
20664 | self.set(field, value); | 23256 | // This function will load locale and then set the global locale. If |
23257 | // no arguments are passed in, it will simply return the current global | ||
23258 | // locale key. | ||
23259 | function locale_locales__getSetGlobalLocale (key, values) { | ||
23260 | var data; | ||
23261 | if (key) { | ||
23262 | if (isUndefined(values)) { | ||
23263 | data = locale_locales__getLocale(key); | ||
23264 | } | ||
23265 | else { | ||
23266 | data = defineLocale(key, values); | ||
23267 | } | ||
20665 | 23268 | ||
20666 | // consider compute time priority | 23269 | if (data) { |
20667 | switch (field) { | 23270 | // moment.duration._locale = moment._locale = data; |
20668 | case MONTH: | 23271 | globalLocale = data; |
20669 | adjustDayOfMonth(self); | 23272 | } |
20670 | break; | 23273 | } |
20671 | default: | 23274 | |
20672 | // other fields are set already when get | 23275 | return globalLocale._abbr; |
20673 | self.updateFieldsBySet(field); | 23276 | } |
20674 | break; | 23277 | |
23278 | function defineLocale (name, config) { | ||
23279 | if (config !== null) { | ||
23280 | var parentConfig = baseConfig; | ||
23281 | config.abbr = name; | ||
23282 | if (locales[name] != null) { | ||
23283 | deprecateSimple('defineLocaleOverride', | ||
23284 | 'use moment.updateLocale(localeName, config) to change ' + | ||
23285 | 'an existing locale. moment.defineLocale(localeName, ' + | ||
23286 | 'config) should only be used for creating a new locale ' + | ||
23287 | 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.'); | ||
23288 | parentConfig = locales[name]._config; | ||
23289 | } else if (config.parentLocale != null) { | ||
23290 | if (locales[config.parentLocale] != null) { | ||
23291 | parentConfig = locales[config.parentLocale]._config; | ||
23292 | } else { | ||
23293 | // treat as if there is no base config | ||
23294 | deprecateSimple('parentLocaleUndefined', | ||
23295 | 'specified parentLocale is not defined yet. See http://momentjs.com/guides/#/warnings/parent-locale/'); | ||
23296 | } | ||
23297 | } | ||
23298 | locales[name] = new Locale(mergeConfigs(parentConfig, config)); | ||
23299 | |||
23300 | // backwards compat for now: also set the locale | ||
23301 | locale_locales__getSetGlobalLocale(name); | ||
23302 | |||
23303 | return locales[name]; | ||
23304 | } else { | ||
23305 | // useful for testing | ||
23306 | delete locales[name]; | ||
23307 | return null; | ||
23308 | } | ||
20675 | } | 23309 | } |
20676 | }, | ||
20677 | 23310 | ||
20678 | /* | 23311 | function updateLocale(name, config) { |
20679 | * keep field stable. | 23312 | if (config != null) { |
20680 | * | 23313 | var locale, parentConfig = baseConfig; |
20681 | * 2015-09-29 setMonth 2 vs rollSetMonth 2 | 23314 | // MERGE |
20682 | * | 23315 | if (locales[name] != null) { |
20683 | */ | 23316 | parentConfig = locales[name]._config; |
20684 | rollSet: function rollSet(field, v) { | 23317 | } |
20685 | this.set(field, v); | 23318 | config = mergeConfigs(parentConfig, config); |
20686 | switch (field) { | 23319 | locale = new Locale(config); |
20687 | case MONTH: | 23320 | locale.parentLocale = locales[name]; |
20688 | adjustDayOfMonth(this); | 23321 | locales[name] = locale; |
20689 | break; | 23322 | |
20690 | default: | 23323 | // backwards compat for now: also set the locale |
20691 | // other fields are set already when get | 23324 | locale_locales__getSetGlobalLocale(name); |
20692 | this.updateFieldsBySet(field); | 23325 | } else { |
20693 | break; | 23326 | // pass null for config to unupdate, useful for tests |
23327 | if (locales[name] != null) { | ||
23328 | if (locales[name].parentLocale != null) { | ||
23329 | locales[name] = locales[name].parentLocale; | ||
23330 | } else if (locales[name] != null) { | ||
23331 | delete locales[name]; | ||
23332 | } | ||
23333 | } | ||
23334 | } | ||
23335 | return locales[name]; | ||
20694 | } | 23336 | } |
20695 | }, | ||
20696 | 23337 | ||
20697 | /* | 23338 | // returns locale data |
20698 | * roll the year of the given calendar field. | 23339 | function locale_locales__getLocale (key) { |
20699 | * @method rollYear | 23340 | var locale; |
20700 | * @param {Number} amount the signed amount to add to field. | ||
20701 | */ | ||
20702 | 23341 | ||
20703 | /* | 23342 | if (key && key._locale && key._locale._abbr) { |
20704 | * roll the month of the given calendar field. | 23343 | key = key._locale._abbr; |
20705 | * @param {Number} amount the signed amount to add to field. | 23344 | } |
20706 | * @method rollMonth | ||
20707 | */ | ||
20708 | 23345 | ||
20709 | /* | 23346 | if (!key) { |
20710 | * roll the day of month of the given calendar field. | 23347 | return globalLocale; |
20711 | * @method rollDayOfMonth | 23348 | } |
20712 | * @param {Number} amount the signed amount to add to field. | ||
20713 | */ | ||
20714 | 23349 | ||
20715 | /* | 23350 | if (!isArray(key)) { |
20716 | * roll the hour of day of the given calendar field. | 23351 | //short-circuit everything else |
20717 | * @method rollHourOfDay | 23352 | locale = loadLocale(key); |
20718 | * @param {Number} amount the signed amount to add to field. | 23353 | if (locale) { |
20719 | */ | 23354 | return locale; |
23355 | } | ||
23356 | key = [key]; | ||
23357 | } | ||
20720 | 23358 | ||
20721 | /* | 23359 | return chooseLocale(key); |
20722 | * roll the minute of the given calendar field. | 23360 | } |
20723 | * @method rollMinute | ||
20724 | * @param {Number} amount the signed amount to add to field. | ||
20725 | */ | ||
20726 | 23361 | ||
20727 | /* | 23362 | function locale_locales__listLocales() { |
20728 | * roll the second of the given calendar field. | 23363 | return keys(locales); |
20729 | * @method rollSecond | 23364 | } |
20730 | * @param {Number} amount the signed amount to add to field. | ||
20731 | */ | ||
20732 | 23365 | ||
20733 | /* | 23366 | function checkOverflow (m) { |
20734 | * roll the millisecond of the given calendar field. | 23367 | var overflow; |
20735 | * @method rollMilliSecond | 23368 | var a = m._a; |
20736 | * @param {Number} amount the signed amount to add to field. | ||
20737 | */ | ||
20738 | 23369 | ||
20739 | /* | 23370 | if (a && getParsingFlags(m).overflow === -2) { |
20740 | * roll the week of year of the given calendar field. | 23371 | overflow = |
20741 | * @method rollWeekOfYear | 23372 | a[MONTH] < 0 || a[MONTH] > 11 ? MONTH : |
20742 | * @param {Number} amount the signed amount to add to field. | 23373 | a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE : |
20743 | */ | 23374 | a[HOUR] < 0 || a[HOUR] > 24 || (a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0)) ? HOUR : |
23375 | a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE : | ||
23376 | a[SECOND] < 0 || a[SECOND] > 59 ? SECOND : | ||
23377 | a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND : | ||
23378 | -1; | ||
20744 | 23379 | ||
20745 | /* | 23380 | if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) { |
20746 | * roll the week of month of the given calendar field. | 23381 | overflow = DATE; |
20747 | * @method rollWeekOfMonth | 23382 | } |
20748 | * @param {Number} amount the signed amount to add to field. | 23383 | if (getParsingFlags(m)._overflowWeeks && overflow === -1) { |
20749 | */ | 23384 | overflow = WEEK; |
23385 | } | ||
23386 | if (getParsingFlags(m)._overflowWeekday && overflow === -1) { | ||
23387 | overflow = WEEKDAY; | ||
23388 | } | ||
20750 | 23389 | ||
20751 | /* | 23390 | getParsingFlags(m).overflow = overflow; |
20752 | * roll the day of year of the given calendar field. | 23391 | } |
20753 | * @method rollDayOfYear | ||
20754 | * @param {Number} amount the signed amount to add to field. | ||
20755 | */ | ||
20756 | 23392 | ||
20757 | /* | 23393 | return m; |
20758 | * roll the day of week of the given calendar field. | 23394 | } |
20759 | * @method rollDayOfWeek | 23395 | |
20760 | * @param {Number} amount the signed amount to add to field. | 23396 | // iso 8601 regex |
20761 | */ | 23397 | // 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) |
23398 | 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)?)?/; | ||
23399 | 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)?)?/; | ||
23400 | |||
23401 | var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/; | ||
23402 | |||
23403 | var isoDates = [ | ||
23404 | ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/], | ||
23405 | ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/], | ||
23406 | ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/], | ||
23407 | ['GGGG-[W]WW', /\d{4}-W\d\d/, false], | ||
23408 | ['YYYY-DDD', /\d{4}-\d{3}/], | ||
23409 | ['YYYY-MM', /\d{4}-\d\d/, false], | ||
23410 | ['YYYYYYMMDD', /[+-]\d{10}/], | ||
23411 | ['YYYYMMDD', /\d{8}/], | ||
23412 | // YYYYMM is NOT allowed by the standard | ||
23413 | ['GGGG[W]WWE', /\d{4}W\d{3}/], | ||
23414 | ['GGGG[W]WW', /\d{4}W\d{2}/, false], | ||
23415 | ['YYYYDDD', /\d{7}/] | ||
23416 | ]; | ||
23417 | |||
23418 | // iso time formats and regexes | ||
23419 | var isoTimes = [ | ||
23420 | ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/], | ||
23421 | ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/], | ||
23422 | ['HH:mm:ss', /\d\d:\d\d:\d\d/], | ||
23423 | ['HH:mm', /\d\d:\d\d/], | ||
23424 | ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/], | ||
23425 | ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/], | ||
23426 | ['HHmmss', /\d\d\d\d\d\d/], | ||
23427 | ['HHmm', /\d\d\d\d/], | ||
23428 | ['HH', /\d\d/] | ||
23429 | ]; | ||
23430 | |||
23431 | var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i; | ||
23432 | |||
23433 | // date from iso format | ||
23434 | function configFromISO(config) { | ||
23435 | var i, l, | ||
23436 | string = config._i, | ||
23437 | match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string), | ||
23438 | allowTime, dateFormat, timeFormat, tzFormat; | ||
20762 | 23439 | ||
20763 | /* | 23440 | if (match) { |
20764 | * remove other priority fields when call getFixedDate | 23441 | getParsingFlags(config).iso = true; |
20765 | * precondition: other fields are all set or computed | 23442 | |
20766 | * @protected | 23443 | for (i = 0, l = isoDates.length; i < l; i++) { |
20767 | */ | 23444 | if (isoDates[i][1].exec(match[1])) { |
20768 | updateFieldsBySet: function updateFieldsBySet(field) { | 23445 | dateFormat = isoDates[i][0]; |
20769 | var fields = this.fields; | 23446 | allowTime = isoDates[i][2] !== false; |
20770 | switch (field) { | 23447 | break; |
20771 | case WEEK_OF_MONTH: | 23448 | } |
20772 | fields[DAY_OF_MONTH] = undefined; | 23449 | } |
20773 | break; | 23450 | if (dateFormat == null) { |
20774 | case DAY_OF_YEAR: | 23451 | config._isValid = false; |
20775 | fields[MONTH] = undefined; | 23452 | return; |
20776 | break; | 23453 | } |
20777 | case DAY_OF_WEEK: | 23454 | if (match[3]) { |
20778 | fields[DAY_OF_MONTH] = undefined; | 23455 | for (i = 0, l = isoTimes.length; i < l; i++) { |
20779 | break; | 23456 | if (isoTimes[i][1].exec(match[3])) { |
20780 | case WEEK_OF_YEAR: | 23457 | // match[2] should be 'T' or space |
20781 | fields[DAY_OF_YEAR] = undefined; | 23458 | timeFormat = (match[2] || ' ') + isoTimes[i][0]; |
20782 | fields[MONTH] = undefined; | 23459 | break; |
20783 | break; | 23460 | } |
20784 | default: | 23461 | } |
20785 | break; | 23462 | if (timeFormat == null) { |
23463 | config._isValid = false; | ||
23464 | return; | ||
23465 | } | ||
23466 | } | ||
23467 | if (!allowTime && timeFormat != null) { | ||
23468 | config._isValid = false; | ||
23469 | return; | ||
23470 | } | ||
23471 | if (match[4]) { | ||
23472 | if (tzRegex.exec(match[4])) { | ||
23473 | tzFormat = 'Z'; | ||
23474 | } else { | ||
23475 | config._isValid = false; | ||
23476 | return; | ||
23477 | } | ||
23478 | } | ||
23479 | config._f = dateFormat + (timeFormat || '') + (tzFormat || ''); | ||
23480 | configFromStringAndFormat(config); | ||
23481 | } else { | ||
23482 | config._isValid = false; | ||
23483 | } | ||
20786 | } | 23484 | } |
20787 | }, | ||
20788 | 23485 | ||
20789 | /* | 23486 | // date from iso format or fallback |
20790 | * get current date instance's timezone offset | 23487 | function configFromString(config) { |
20791 | * @returns {Number} | 23488 | var matched = aspNetJsonRegex.exec(config._i); |
20792 | */ | ||
20793 | getTimezoneOffset: function getTimezoneOffset() { | ||
20794 | return this.timezoneOffset; | ||
20795 | }, | ||
20796 | 23489 | ||
20797 | /* | 23490 | if (matched !== null) { |
20798 | * set current date instance's timezone offset | 23491 | config._d = new Date(+matched[1]); |
20799 | */ | 23492 | return; |
20800 | setTimezoneOffset: function setTimezoneOffset(timezoneOffset) { | 23493 | } |
20801 | if (this.timezoneOffset !== timezoneOffset) { | 23494 | |
20802 | this.fieldsComputed = undefined; | 23495 | configFromISO(config); |
20803 | this.timezoneOffset = timezoneOffset; | 23496 | if (config._isValid === false) { |
23497 | delete config._isValid; | ||
23498 | utils_hooks__hooks.createFromInputFallback(config); | ||
23499 | } | ||
20804 | } | 23500 | } |
20805 | }, | ||
20806 | 23501 | ||
20807 | /* | 23502 | utils_hooks__hooks.createFromInputFallback = deprecate( |
20808 | * set first day of week for current date instance | 23503 | 'moment construction falls back to js Date. This is ' + |
20809 | */ | 23504 | 'discouraged and will be removed in upcoming major ' + |
20810 | setFirstDayOfWeek: function setFirstDayOfWeek(firstDayOfWeek) { | 23505 | 'release. Please refer to ' + |
20811 | if (this.firstDayOfWeek !== firstDayOfWeek) { | 23506 | 'http://momentjs.com/guides/#/warnings/js-date/ for more info.', |
20812 | this.firstDayOfWeek = firstDayOfWeek; | 23507 | function (config) { |
20813 | this.fieldsComputed = false; | 23508 | config._d = new Date(config._i + (config._useUTC ? ' UTC' : '')); |
23509 | } | ||
23510 | ); | ||
23511 | |||
23512 | // Pick the first defined of two or three arguments. | ||
23513 | function defaults(a, b, c) { | ||
23514 | if (a != null) { | ||
23515 | return a; | ||
23516 | } | ||
23517 | if (b != null) { | ||
23518 | return b; | ||
23519 | } | ||
23520 | return c; | ||
20814 | } | 23521 | } |
20815 | }, | ||
20816 | 23522 | ||
20817 | /* | 23523 | function currentDateArray(config) { |
20818 | * Gets what the first day of the week is; e.g., SUNDAY in the U.S., MONDAY in France. | 23524 | // hooks is actually the exported moment object |
20819 | * @returns {Number} the first day of the week. | 23525 | var nowValue = new Date(utils_hooks__hooks.now()); |
20820 | */ | 23526 | if (config._useUTC) { |
20821 | getFirstDayOfWeek: function getFirstDayOfWeek() { | 23527 | return [nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate()]; |
20822 | return this.firstDayOfWeek; | 23528 | } |
20823 | }, | 23529 | return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()]; |
23530 | } | ||
20824 | 23531 | ||
20825 | /* | 23532 | // convert an array to a date. |
20826 | * Sets what the minimal days required in the first week of the year are; For example, | 23533 | // the array should mirror the parameters below |
20827 | * if the first week is defined as one that contains the first day of the first month of a year, | 23534 | // note: all values past the year are optional and will default to the lowest possible value. |
20828 | * call this method with value 1. | 23535 | // [year, month, day , hour, minute, second, millisecond] |
20829 | * If it must be a full week, use value 7. | 23536 | function configFromArray (config) { |
20830 | * @param minimalDaysInFirstWeek the given minimal days required in the first week of the year. | 23537 | var i, date, input = [], currentDate, yearToUse; |
20831 | */ | 23538 | |
20832 | setMinimalDaysInFirstWeek: function setMinimalDaysInFirstWeek(minimalDaysInFirstWeek) { | 23539 | if (config._d) { |
20833 | if (this.minimalDaysInFirstWeek !== minimalDaysInFirstWeek) { | 23540 | return; |
20834 | this.minimalDaysInFirstWeek = minimalDaysInFirstWeek; | 23541 | } |
20835 | this.fieldsComputed = false; | 23542 | |
23543 | currentDate = currentDateArray(config); | ||
23544 | |||
23545 | //compute day of the year from weeks and weekdays | ||
23546 | if (config._w && config._a[DATE] == null && config._a[MONTH] == null) { | ||
23547 | dayOfYearFromWeekInfo(config); | ||
23548 | } | ||
23549 | |||
23550 | //if the day of the year is set, figure out what it is | ||
23551 | if (config._dayOfYear) { | ||
23552 | yearToUse = defaults(config._a[YEAR], currentDate[YEAR]); | ||
23553 | |||
23554 | if (config._dayOfYear > daysInYear(yearToUse)) { | ||
23555 | getParsingFlags(config)._overflowDayOfYear = true; | ||
23556 | } | ||
23557 | |||
23558 | date = createUTCDate(yearToUse, 0, config._dayOfYear); | ||
23559 | config._a[MONTH] = date.getUTCMonth(); | ||
23560 | config._a[DATE] = date.getUTCDate(); | ||
23561 | } | ||
23562 | |||
23563 | // Default to current date. | ||
23564 | // * if no year, month, day of month are given, default to today | ||
23565 | // * if day of month is given, default month and year | ||
23566 | // * if month is given, default only year | ||
23567 | // * if year is given, don't default anything | ||
23568 | for (i = 0; i < 3 && config._a[i] == null; ++i) { | ||
23569 | config._a[i] = input[i] = currentDate[i]; | ||
23570 | } | ||
23571 | |||
23572 | // Zero out whatever was not defaulted, including time | ||
23573 | for (; i < 7; i++) { | ||
23574 | config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i]; | ||
23575 | } | ||
23576 | |||
23577 | // Check for 24:00:00.000 | ||
23578 | if (config._a[HOUR] === 24 && | ||
23579 | config._a[MINUTE] === 0 && | ||
23580 | config._a[SECOND] === 0 && | ||
23581 | config._a[MILLISECOND] === 0) { | ||
23582 | config._nextDay = true; | ||
23583 | config._a[HOUR] = 0; | ||
23584 | } | ||
23585 | |||
23586 | config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input); | ||
23587 | // Apply timezone offset from input. The actual utcOffset can be changed | ||
23588 | // with parseZone. | ||
23589 | if (config._tzm != null) { | ||
23590 | config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); | ||
23591 | } | ||
23592 | |||
23593 | if (config._nextDay) { | ||
23594 | config._a[HOUR] = 24; | ||
23595 | } | ||
20836 | } | 23596 | } |
20837 | }, | ||
20838 | 23597 | ||
20839 | /* | 23598 | function dayOfYearFromWeekInfo(config) { |
20840 | * Gets what the minimal days required in the first week of the year are; e.g., | 23599 | var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow; |
20841 | * if the first week is defined as one that contains the first day of the first month of a year, | ||
20842 | * this method returns 1. | ||
20843 | * If the minimal days required must be a full week, this method returns 7. | ||
20844 | * @returns {Number} the minimal days required in the first week of the year. | ||
20845 | */ | ||
20846 | getMinimalDaysInFirstWeek: function getMinimalDaysInFirstWeek() { | ||
20847 | return this.minimalDaysInFirstWeek; | ||
20848 | }, | ||
20849 | 23600 | ||
20850 | /* | 23601 | w = config._w; |
20851 | * Returns the number of weeks in the week year | 23602 | if (w.GG != null || w.W != null || w.E != null) { |
20852 | * represented by this GregorianCalendar. | 23603 | dow = 1; |
20853 | * | 23604 | doy = 4; |
20854 | * For example, if this GregorianCalendar's date is | 23605 | |
20855 | * December 31, 2008 with the ISO | 23606 | // TODO: We need to take the current isoWeekYear, but that depends on |
20856 | * 8601 compatible setting, this method will return 53 for the | 23607 | // how we interpret now (local, utc, fixed offset). So create |
20857 | * period: December 29, 2008 to January 3, 2010 | 23608 | // a now version of current config (take local/utc/offset flags, and |
20858 | * while getActualMaximum(WEEK_OF_YEAR) will return | 23609 | // create now). |
20859 | * 52 for the period: December 31, 2007 to December 28, 2008. | 23610 | weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(local__createLocal(), 1, 4).year); |
20860 | * | 23611 | week = defaults(w.W, 1); |
20861 | * @return {Number} the number of weeks in the week year. | 23612 | weekday = defaults(w.E, 1); |
20862 | */ | 23613 | if (weekday < 1 || weekday > 7) { |
20863 | getWeeksInWeekYear: function getWeeksInWeekYear() { | 23614 | weekdayOverflow = true; |
20864 | var weekYear = this.getWeekYear(); | 23615 | } |
20865 | if (weekYear === this.get(YEAR)) { | 23616 | } else { |
20866 | return this.getActualMaximum(WEEK_OF_YEAR); | 23617 | dow = config._locale._week.dow; |
23618 | doy = config._locale._week.doy; | ||
23619 | |||
23620 | weekYear = defaults(w.gg, config._a[YEAR], weekOfYear(local__createLocal(), dow, doy).year); | ||
23621 | week = defaults(w.w, 1); | ||
23622 | |||
23623 | if (w.d != null) { | ||
23624 | // weekday -- low day numbers are considered next week | ||
23625 | weekday = w.d; | ||
23626 | if (weekday < 0 || weekday > 6) { | ||
23627 | weekdayOverflow = true; | ||
23628 | } | ||
23629 | } else if (w.e != null) { | ||
23630 | // local weekday -- counting starts from begining of week | ||
23631 | weekday = w.e + dow; | ||
23632 | if (w.e < 0 || w.e > 6) { | ||
23633 | weekdayOverflow = true; | ||
23634 | } | ||
23635 | } else { | ||
23636 | // default to begining of week | ||
23637 | weekday = dow; | ||
23638 | } | ||
23639 | } | ||
23640 | if (week < 1 || week > weeksInYear(weekYear, dow, doy)) { | ||
23641 | getParsingFlags(config)._overflowWeeks = true; | ||
23642 | } else if (weekdayOverflow != null) { | ||
23643 | getParsingFlags(config)._overflowWeekday = true; | ||
23644 | } else { | ||
23645 | temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy); | ||
23646 | config._a[YEAR] = temp.year; | ||
23647 | config._dayOfYear = temp.dayOfYear; | ||
23648 | } | ||
20867 | } | 23649 | } |
20868 | // Use the 2nd week for calculating the max of WEEK_OF_YEAR | ||
20869 | var gc = this.clone(); | ||
20870 | gc.clear(); | ||
20871 | gc.setWeekDate(weekYear, 2, this.get(DAY_OF_WEEK)); | ||
20872 | return gc.getActualMaximum(WEEK_OF_YEAR); | ||
20873 | }, | ||
20874 | 23650 | ||
20875 | /* | 23651 | // constant that refers to the ISO standard |
20876 | * Returns the week year represented by this GregorianCalendar. | 23652 | utils_hooks__hooks.ISO_8601 = function () {}; |
20877 | * The dates in the weeks between 1 and the | 23653 | |
20878 | * maximum week number of the week year have the same week year value | 23654 | // date from string and format string |
20879 | * that may be one year before or after the calendar year value. | 23655 | function configFromStringAndFormat(config) { |
20880 | * | 23656 | // TODO: Move this to another part of the creation flow to prevent circular deps |
20881 | * @return {Number} the week year represented by this GregorianCalendar. | 23657 | if (config._f === utils_hooks__hooks.ISO_8601) { |
20882 | */ | 23658 | configFromISO(config); |
20883 | getWeekYear: function getWeekYear() { | 23659 | return; |
20884 | var year = this.get(YEAR); // implicitly complete | 23660 | } |
20885 | var weekOfYear = this.get(WEEK_OF_YEAR); | 23661 | |
20886 | var month = this.get(MONTH); | 23662 | config._a = []; |
20887 | if (month === GregorianCalendar.JANUARY) { | 23663 | getParsingFlags(config).empty = true; |
20888 | if (weekOfYear >= 52) { | 23664 | |
20889 | --year; | 23665 | // This array is used to make a Date, either with `new Date` or `Date.UTC` |
20890 | } | 23666 | var string = '' + config._i, |
20891 | } else if (month === GregorianCalendar.DECEMBER) { | 23667 | i, parsedInput, tokens, token, skipped, |
20892 | if (weekOfYear === 1) { | 23668 | stringLength = string.length, |
20893 | ++year; | 23669 | totalParsedInputLength = 0; |
20894 | } | 23670 | |
23671 | tokens = expandFormat(config._f, config._locale).match(formattingTokens) || []; | ||
23672 | |||
23673 | for (i = 0; i < tokens.length; i++) { | ||
23674 | token = tokens[i]; | ||
23675 | parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0]; | ||
23676 | // console.log('token', token, 'parsedInput', parsedInput, | ||
23677 | // 'regex', getParseRegexForToken(token, config)); | ||
23678 | if (parsedInput) { | ||
23679 | skipped = string.substr(0, string.indexOf(parsedInput)); | ||
23680 | if (skipped.length > 0) { | ||
23681 | getParsingFlags(config).unusedInput.push(skipped); | ||
23682 | } | ||
23683 | string = string.slice(string.indexOf(parsedInput) + parsedInput.length); | ||
23684 | totalParsedInputLength += parsedInput.length; | ||
23685 | } | ||
23686 | // don't parse if it's not a known token | ||
23687 | if (formatTokenFunctions[token]) { | ||
23688 | if (parsedInput) { | ||
23689 | getParsingFlags(config).empty = false; | ||
23690 | } | ||
23691 | else { | ||
23692 | getParsingFlags(config).unusedTokens.push(token); | ||
23693 | } | ||
23694 | addTimeToArrayFromToken(token, parsedInput, config); | ||
23695 | } | ||
23696 | else if (config._strict && !parsedInput) { | ||
23697 | getParsingFlags(config).unusedTokens.push(token); | ||
23698 | } | ||
23699 | } | ||
23700 | |||
23701 | // add remaining unparsed input length to the string | ||
23702 | getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength; | ||
23703 | if (string.length > 0) { | ||
23704 | getParsingFlags(config).unusedInput.push(string); | ||
23705 | } | ||
23706 | |||
23707 | // clear _12h flag if hour is <= 12 | ||
23708 | if (config._a[HOUR] <= 12 && | ||
23709 | getParsingFlags(config).bigHour === true && | ||
23710 | config._a[HOUR] > 0) { | ||
23711 | getParsingFlags(config).bigHour = undefined; | ||
23712 | } | ||
23713 | |||
23714 | getParsingFlags(config).parsedDateParts = config._a.slice(0); | ||
23715 | getParsingFlags(config).meridiem = config._meridiem; | ||
23716 | // handle meridiem | ||
23717 | config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem); | ||
23718 | |||
23719 | configFromArray(config); | ||
23720 | checkOverflow(config); | ||
20895 | } | 23721 | } |
20896 | return year; | 23722 | |
20897 | }, | 23723 | |
20898 | /* | 23724 | function meridiemFixWrap (locale, hour, meridiem) { |
20899 | * Sets this GregorianCalendar to the date given by the date specifiers - weekYear, | 23725 | var isPm; |
20900 | * weekOfYear, and dayOfWeek. weekOfYear follows the WEEK_OF_YEAR numbering. | 23726 | |
20901 | * The dayOfWeek value must be one of the DAY_OF_WEEK values: SUNDAY to SATURDAY. | 23727 | if (meridiem == null) { |
20902 | * | 23728 | // nothing to do |
20903 | * @param weekYear the week year | 23729 | return hour; |
20904 | * @param weekOfYear the week number based on weekYear | 23730 | } |
20905 | * @param dayOfWeek the day of week value | 23731 | if (locale.meridiemHour != null) { |
20906 | */ | 23732 | return locale.meridiemHour(hour, meridiem); |
20907 | setWeekDate: function setWeekDate(weekYear, weekOfYear, dayOfWeek) { | 23733 | } else if (locale.isPM != null) { |
20908 | if (dayOfWeek < GregorianCalendar.SUNDAY || dayOfWeek > GregorianCalendar.SATURDAY) { | 23734 | // Fallback |
20909 | throw new Error('invalid dayOfWeek: ' + dayOfWeek); | 23735 | isPm = locale.isPM(meridiem); |
20910 | } | 23736 | if (isPm && hour < 12) { |
20911 | var fields = this.fields; | 23737 | hour += 12; |
20912 | // To avoid changing the time of day fields by date | 23738 | } |
20913 | // calculations, use a clone with the GMT time zone. | 23739 | if (!isPm && hour === 12) { |
20914 | var gc = this.clone(); | 23740 | hour = 0; |
20915 | gc.clear(); | 23741 | } |
20916 | gc.setTimezoneOffset(0); | 23742 | return hour; |
20917 | gc.set(YEAR, weekYear); | 23743 | } else { |
20918 | gc.set(WEEK_OF_YEAR, 1); | 23744 | // this is not supposed to happen |
20919 | gc.set(DAY_OF_WEEK, this.getFirstDayOfWeek()); | 23745 | return hour; |
20920 | var days = dayOfWeek - this.getFirstDayOfWeek(); | 23746 | } |
20921 | if (days < 0) { | ||
20922 | days += 7; | ||
20923 | } | ||
20924 | days += 7 * (weekOfYear - 1); | ||
20925 | if (days !== 0) { | ||
20926 | gc.add(DAY_OF_YEAR, days); | ||
20927 | } else { | ||
20928 | gc.complete(); | ||
20929 | } | 23747 | } |
20930 | fields[YEAR] = gc.get(YEAR); | 23748 | |
20931 | fields[MONTH] = gc.get(MONTH); | 23749 | // date from string and array of format strings |
20932 | fields[DAY_OF_MONTH] = gc.get(DAY_OF_MONTH); | 23750 | function configFromStringAndArray(config) { |
20933 | this.complete(); | 23751 | var tempConfig, |
20934 | }, | 23752 | bestMoment, |
20935 | /* | 23753 | |
20936 | * Creates and returns a copy of this object. | 23754 | scoreToBeat, |
20937 | * @returns {Date.Gregorian} | 23755 | i, |
20938 | */ | 23756 | currentScore; |
20939 | clone: function clone() { | 23757 | |
20940 | if (this.time === undefined) { | 23758 | if (config._f.length === 0) { |
20941 | this.computeTime(); | 23759 | getParsingFlags(config).invalidFormat = true; |
23760 | config._d = new Date(NaN); | ||
23761 | return; | ||
23762 | } | ||
23763 | |||
23764 | for (i = 0; i < config._f.length; i++) { | ||
23765 | currentScore = 0; | ||
23766 | tempConfig = copyConfig({}, config); | ||
23767 | if (config._useUTC != null) { | ||
23768 | tempConfig._useUTC = config._useUTC; | ||
23769 | } | ||
23770 | tempConfig._f = config._f[i]; | ||
23771 | configFromStringAndFormat(tempConfig); | ||
23772 | |||
23773 | if (!valid__isValid(tempConfig)) { | ||
23774 | continue; | ||
23775 | } | ||
23776 | |||
23777 | // if there is any input that was not parsed add a penalty for that format | ||
23778 | currentScore += getParsingFlags(tempConfig).charsLeftOver; | ||
23779 | |||
23780 | //or tokens | ||
23781 | currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10; | ||
23782 | |||
23783 | getParsingFlags(tempConfig).score = currentScore; | ||
23784 | |||
23785 | if (scoreToBeat == null || currentScore < scoreToBeat) { | ||
23786 | scoreToBeat = currentScore; | ||
23787 | bestMoment = tempConfig; | ||
23788 | } | ||
23789 | } | ||
23790 | |||
23791 | extend(config, bestMoment || tempConfig); | ||
20942 | } | 23792 | } |
20943 | var cal = new GregorianCalendar(this.locale); | ||
20944 | cal.setTimezoneOffset(cal.getTimezoneOffset()); | ||
20945 | cal.setFirstDayOfWeek(cal.getFirstDayOfWeek()); | ||
20946 | cal.setMinimalDaysInFirstWeek(cal.getMinimalDaysInFirstWeek()); | ||
20947 | cal.setTime(this.time); | ||
20948 | return cal; | ||
20949 | }, | ||
20950 | 23793 | ||
20951 | /* | 23794 | function configFromObject(config) { |
20952 | * Compares this GregorianCalendar to the specified Object. | 23795 | if (config._d) { |
20953 | * The result is true if and only if the argument is a GregorianCalendar object | 23796 | return; |
20954 | * that represents the same time value (millisecond offset from the Epoch) | 23797 | } |
20955 | * under the same Calendar parameters and Gregorian change date as this object. | ||
20956 | * @param {Date.Gregorian} obj the object to compare with. | ||
20957 | * @returns {boolean} true if this object is equal to obj; false otherwise. | ||
20958 | */ | ||
20959 | equals: function equals(obj) { | ||
20960 | return this.getTime() === obj.getTime() && this.firstDayOfWeek === obj.firstDayOfWeek && this.timezoneOffset === obj.timezoneOffset && this.minimalDaysInFirstWeek === obj.minimalDaysInFirstWeek; | ||
20961 | }, | ||
20962 | 23798 | ||
20963 | /* | 23799 | var i = normalizeObjectUnits(config._i); |
20964 | * Sets all the calendar field values or specified field and the time value | 23800 | config._a = map([i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond], function (obj) { |
20965 | * (millisecond offset from the Epoch) of this Calendar undefined. | 23801 | return obj && parseInt(obj, 10); |
20966 | * This means that isSet() will return false for all the calendar fields, | 23802 | }); |
20967 | * and the date and time calculations will treat the fields as if they had never been set. | 23803 | |
20968 | * @param [field] the calendar field to be cleared. | 23804 | configFromArray(config); |
20969 | */ | ||
20970 | clear: function clear(field) { | ||
20971 | if (field === undefined) { | ||
20972 | this.field = []; | ||
20973 | } else { | ||
20974 | this.fields[field] = undefined; | ||
20975 | } | 23805 | } |
20976 | this.time = undefined; | ||
20977 | this.fieldsComputed = false; | ||
20978 | } | ||
20979 | }; | ||
20980 | 23806 | ||
20981 | var GregorianCalendarProto = GregorianCalendar.prototype; | 23807 | function createFromConfig (config) { |
23808 | var res = new Moment(checkOverflow(prepareConfig(config))); | ||
23809 | if (res._nextDay) { | ||
23810 | // Adding is smart enough around DST | ||
23811 | res.add(1, 'd'); | ||
23812 | res._nextDay = undefined; | ||
23813 | } | ||
20982 | 23814 | ||
20983 | Utils.each(FIELDS, function (f, index) { | 23815 | return res; |
20984 | if (f) { | 23816 | } |
20985 | GregorianCalendarProto['get' + f] = function get() { | ||
20986 | return this.get(index); | ||
20987 | }; | ||
20988 | 23817 | ||
20989 | GregorianCalendarProto['isSet' + f] = function isSet() { | 23818 | function prepareConfig (config) { |
20990 | return this.isSet(index); | 23819 | var input = config._i, |
20991 | }; | 23820 | format = config._f; |
20992 | 23821 | ||
20993 | GregorianCalendarProto['set' + f] = function set(v) { | 23822 | config._locale = config._locale || locale_locales__getLocale(config._l); |
20994 | return this.set(index, v); | ||
20995 | }; | ||
20996 | 23823 | ||
20997 | GregorianCalendarProto['add' + f] = function add(v) { | 23824 | if (input === null || (format === undefined && input === '')) { |
20998 | return this.add(index, v); | 23825 | return valid__createInvalid({nullInput: true}); |
20999 | }; | 23826 | } |
21000 | 23827 | ||
21001 | GregorianCalendarProto['roll' + f] = function roll(v) { | 23828 | if (typeof input === 'string') { |
21002 | return this.roll(index, v); | 23829 | config._i = input = config._locale.preparse(input); |
21003 | }; | 23830 | } |
23831 | |||
23832 | if (isMoment(input)) { | ||
23833 | return new Moment(checkOverflow(input)); | ||
23834 | } else if (isArray(format)) { | ||
23835 | configFromStringAndArray(config); | ||
23836 | } else if (isDate(input)) { | ||
23837 | config._d = input; | ||
23838 | } else if (format) { | ||
23839 | configFromStringAndFormat(config); | ||
23840 | } else { | ||
23841 | configFromInput(config); | ||
23842 | } | ||
23843 | |||
23844 | if (!valid__isValid(config)) { | ||
23845 | config._d = null; | ||
23846 | } | ||
23847 | |||
23848 | return config; | ||
23849 | } | ||
23850 | |||
23851 | function configFromInput(config) { | ||
23852 | var input = config._i; | ||
23853 | if (input === undefined) { | ||
23854 | config._d = new Date(utils_hooks__hooks.now()); | ||
23855 | } else if (isDate(input)) { | ||
23856 | config._d = new Date(input.valueOf()); | ||
23857 | } else if (typeof input === 'string') { | ||
23858 | configFromString(config); | ||
23859 | } else if (isArray(input)) { | ||
23860 | config._a = map(input.slice(0), function (obj) { | ||
23861 | return parseInt(obj, 10); | ||
23862 | }); | ||
23863 | configFromArray(config); | ||
23864 | } else if (typeof(input) === 'object') { | ||
23865 | configFromObject(config); | ||
23866 | } else if (typeof(input) === 'number') { | ||
23867 | // from milliseconds | ||
23868 | config._d = new Date(input); | ||
23869 | } else { | ||
23870 | utils_hooks__hooks.createFromInputFallback(config); | ||
23871 | } | ||
23872 | } | ||
23873 | |||
23874 | function createLocalOrUTC (input, format, locale, strict, isUTC) { | ||
23875 | var c = {}; | ||
23876 | |||
23877 | if (typeof(locale) === 'boolean') { | ||
23878 | strict = locale; | ||
23879 | locale = undefined; | ||
23880 | } | ||
23881 | |||
23882 | if ((isObject(input) && isObjectEmpty(input)) || | ||
23883 | (isArray(input) && input.length === 0)) { | ||
23884 | input = undefined; | ||
23885 | } | ||
23886 | // object construction must be done this way. | ||
23887 | // https://github.com/moment/moment/issues/1423 | ||
23888 | c._isAMomentObject = true; | ||
23889 | c._useUTC = c._isUTC = isUTC; | ||
23890 | c._l = locale; | ||
23891 | c._i = input; | ||
23892 | c._f = format; | ||
23893 | c._strict = strict; | ||
23894 | |||
23895 | return createFromConfig(c); | ||
23896 | } | ||
23897 | |||
23898 | function local__createLocal (input, format, locale, strict) { | ||
23899 | return createLocalOrUTC(input, format, locale, strict, false); | ||
23900 | } | ||
23901 | |||
23902 | var prototypeMin = deprecate( | ||
23903 | 'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/', | ||
23904 | function () { | ||
23905 | var other = local__createLocal.apply(null, arguments); | ||
23906 | if (this.isValid() && other.isValid()) { | ||
23907 | return other < this ? this : other; | ||
23908 | } else { | ||
23909 | return valid__createInvalid(); | ||
23910 | } | ||
23911 | } | ||
23912 | ); | ||
23913 | |||
23914 | var prototypeMax = deprecate( | ||
23915 | 'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/', | ||
23916 | function () { | ||
23917 | var other = local__createLocal.apply(null, arguments); | ||
23918 | if (this.isValid() && other.isValid()) { | ||
23919 | return other > this ? this : other; | ||
23920 | } else { | ||
23921 | return valid__createInvalid(); | ||
23922 | } | ||
23923 | } | ||
23924 | ); | ||
23925 | |||
23926 | // Pick a moment m from moments so that m[fn](other) is true for all | ||
23927 | // other. This relies on the function fn to be transitive. | ||
23928 | // | ||
23929 | // moments should either be an array of moment objects or an array, whose | ||
23930 | // first element is an array of moment objects. | ||
23931 | function pickBy(fn, moments) { | ||
23932 | var res, i; | ||
23933 | if (moments.length === 1 && isArray(moments[0])) { | ||
23934 | moments = moments[0]; | ||
23935 | } | ||
23936 | if (!moments.length) { | ||
23937 | return local__createLocal(); | ||
23938 | } | ||
23939 | res = moments[0]; | ||
23940 | for (i = 1; i < moments.length; ++i) { | ||
23941 | if (!moments[i].isValid() || moments[i][fn](res)) { | ||
23942 | res = moments[i]; | ||
23943 | } | ||
23944 | } | ||
23945 | return res; | ||
23946 | } | ||
23947 | |||
23948 | // TODO: Use [].sort instead? | ||
23949 | function min () { | ||
23950 | var args = [].slice.call(arguments, 0); | ||
23951 | |||
23952 | return pickBy('isBefore', args); | ||
23953 | } | ||
23954 | |||
23955 | function max () { | ||
23956 | var args = [].slice.call(arguments, 0); | ||
21004 | 23957 | ||
21005 | GregorianCalendarProto['rollSet' + f] = function rollSet(v) { | 23958 | return pickBy('isAfter', args); |
21006 | return this.rollSet(index, v); | 23959 | } |
23960 | |||
23961 | var now = function () { | ||
23962 | return Date.now ? Date.now() : +(new Date()); | ||
21007 | }; | 23963 | }; |
21008 | } | ||
21009 | }); | ||
21010 | 23964 | ||
21011 | module.exports = GregorianCalendar; | 23965 | function Duration (duration) { |
21012 | /* | 23966 | var normalizedInput = normalizeObjectUnits(duration), |
21013 | http://docs.oracle.com/javase/7/docs/api/java/util/GregorianCalendar.html | 23967 | years = normalizedInput.year || 0, |
23968 | quarters = normalizedInput.quarter || 0, | ||
23969 | months = normalizedInput.month || 0, | ||
23970 | weeks = normalizedInput.week || 0, | ||
23971 | days = normalizedInput.day || 0, | ||
23972 | hours = normalizedInput.hour || 0, | ||
23973 | minutes = normalizedInput.minute || 0, | ||
23974 | seconds = normalizedInput.second || 0, | ||
23975 | milliseconds = normalizedInput.millisecond || 0; | ||
23976 | |||
23977 | // representation for dateAddRemove | ||
23978 | this._milliseconds = +milliseconds + | ||
23979 | seconds * 1e3 + // 1000 | ||
23980 | minutes * 6e4 + // 1000 * 60 | ||
23981 | hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978 | ||
23982 | // Because of dateAddRemove treats 24 hours as different from a | ||
23983 | // day when working around DST, we need to store them separately | ||
23984 | this._days = +days + | ||
23985 | weeks * 7; | ||
23986 | // It is impossible translate months into days without knowing | ||
23987 | // which months you are are talking about, so we have to store | ||
23988 | // it separately. | ||
23989 | this._months = +months + | ||
23990 | quarters * 3 + | ||
23991 | years * 12; | ||
23992 | |||
23993 | this._data = {}; | ||
23994 | |||
23995 | this._locale = locale_locales__getLocale(); | ||
23996 | |||
23997 | this._bubble(); | ||
23998 | } | ||
23999 | |||
24000 | function isDuration (obj) { | ||
24001 | return obj instanceof Duration; | ||
24002 | } | ||
24003 | |||
24004 | // FORMATTING | ||
24005 | |||
24006 | function offset (token, separator) { | ||
24007 | addFormatToken(token, 0, 0, function () { | ||
24008 | var offset = this.utcOffset(); | ||
24009 | var sign = '+'; | ||
24010 | if (offset < 0) { | ||
24011 | offset = -offset; | ||
24012 | sign = '-'; | ||
24013 | } | ||
24014 | return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~(offset) % 60, 2); | ||
24015 | }); | ||
24016 | } | ||
21014 | 24017 | ||
21015 | TODO | 24018 | offset('Z', ':'); |
21016 | - day saving time | 24019 | offset('ZZ', ''); |
21017 | - i18n | ||
21018 | - julian calendar | ||
21019 | */ | ||
21020 | |||
21021 | /***/ }, | ||
21022 | /* 162 */ | ||
21023 | /***/ function(module, exports, __webpack_require__) { | ||
21024 | |||
21025 | /* | ||
21026 | * utils for gregorian date | ||
21027 | * @ignore | ||
21028 | * @author yiminghe@gmail.com | ||
21029 | */ | ||
21030 | 24020 | ||
21031 | 'use strict'; | 24021 | // PARSING |
21032 | 24022 | ||
21033 | var Const = __webpack_require__(163); | 24023 | addRegexToken('Z', matchShortOffset); |
21034 | var floor = Math.floor; | 24024 | addRegexToken('ZZ', matchShortOffset); |
21035 | var ACCUMULATED_DAYS_IN_MONTH | 24025 | addParseToken(['Z', 'ZZ'], function (input, array, config) { |
21036 | // 1/1 2/1 3/1 4/1 5/1 6/1 7/1 8/1 9/1 10/1 11/1 12/1 | 24026 | config._useUTC = true; |
21037 | = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]; | 24027 | config._tzm = offsetFromString(matchShortOffset, input); |
24028 | }); | ||
21038 | 24029 | ||
21039 | var ACCUMULATED_DAYS_IN_MONTH_LEAP | 24030 | // HELPERS |
21040 | // 1/1 2/1 3/1 4/1 5/1 6/1 7/1 8/1 9/1 | ||
21041 | // 10/1 11/1 12/1 | ||
21042 | = [0, 31, 59 + 1, 90 + 1, 120 + 1, 151 + 1, 181 + 1, 212 + 1, 243 + 1, 273 + 1, 304 + 1, 334 + 1]; | ||
21043 | 24031 | ||
21044 | var DAYS_OF_YEAR = 365; | 24032 | // timezone chunker |
21045 | var DAYS_OF_4YEAR = 365 * 4 + 1; | 24033 | // '+10:00' > ['10', '00'] |
21046 | var DAYS_OF_100YEAR = DAYS_OF_4YEAR * 25 - 1; | 24034 | // '-1530' > ['-15', '30'] |
21047 | var DAYS_OF_400YEAR = DAYS_OF_100YEAR * 4 + 1; | 24035 | var chunkOffset = /([\+\-]|\d\d)/gi; |
21048 | var _exports = {}; | ||
21049 | 24036 | ||
21050 | function getDayOfYear(year, month, dayOfMonth) { | 24037 | function offsetFromString(matcher, string) { |
21051 | return dayOfMonth + (_exports.isLeapYear(year) ? ACCUMULATED_DAYS_IN_MONTH_LEAP[month] : ACCUMULATED_DAYS_IN_MONTH[month]); | 24038 | var matches = ((string || '').match(matcher) || []); |
21052 | } | 24039 | var chunk = matches[matches.length - 1] || []; |
24040 | var parts = (chunk + '').match(chunkOffset) || ['-', 0, 0]; | ||
24041 | var minutes = +(parts[1] * 60) + toInt(parts[2]); | ||
21053 | 24042 | ||
21054 | function getDayOfWeekFromFixedDate(fixedDate) { | 24043 | return parts[0] === '+' ? minutes : -minutes; |
21055 | // The fixed day 1 (January 1, 1 Gregorian) is Monday. | 24044 | } |
21056 | if (fixedDate >= 0) { | ||
21057 | return fixedDate % 7; | ||
21058 | } | ||
21059 | return _exports.mod(fixedDate, 7); | ||
21060 | } | ||
21061 | 24045 | ||
21062 | function getGregorianYearFromFixedDate(fixedDate) { | 24046 | // Return a moment from input, that is local/utc/zone equivalent to model. |
21063 | var d0 = undefined; | 24047 | function cloneWithOffset(input, model) { |
21064 | var d1 = undefined; | 24048 | var res, diff; |
21065 | var d2 = undefined; | 24049 | if (model._isUTC) { |
21066 | var d3 = undefined; | 24050 | res = model.clone(); |
21067 | var n400 = undefined; | 24051 | diff = (isMoment(input) || isDate(input) ? input.valueOf() : local__createLocal(input).valueOf()) - res.valueOf(); |
21068 | var n100 = undefined; | 24052 | // Use low-level api, because this fn is low-level api. |
21069 | var n4 = undefined; | 24053 | res._d.setTime(res._d.valueOf() + diff); |
21070 | var n1 = undefined; | 24054 | utils_hooks__hooks.updateOffset(res, false); |
21071 | var year = undefined; | 24055 | return res; |
21072 | d0 = fixedDate - 1; | 24056 | } else { |
24057 | return local__createLocal(input).local(); | ||
24058 | } | ||
24059 | } | ||
21073 | 24060 | ||
21074 | n400 = floor(d0 / DAYS_OF_400YEAR); | 24061 | function getDateOffset (m) { |
21075 | d1 = _exports.mod(d0, DAYS_OF_400YEAR); | 24062 | // On Firefox.24 Date#getTimezoneOffset returns a floating point. |
21076 | n100 = floor(d1 / DAYS_OF_100YEAR); | 24063 | // https://github.com/moment/moment/pull/1871 |
21077 | d2 = _exports.mod(d1, DAYS_OF_100YEAR); | 24064 | return -Math.round(m._d.getTimezoneOffset() / 15) * 15; |
21078 | n4 = floor(d2 / DAYS_OF_4YEAR); | 24065 | } |
21079 | d3 = _exports.mod(d2, DAYS_OF_4YEAR); | ||
21080 | n1 = floor(d3 / DAYS_OF_YEAR); | ||
21081 | 24066 | ||
21082 | year = 400 * n400 + 100 * n100 + 4 * n4 + n1; | 24067 | // HOOKS |
21083 | 24068 | ||
21084 | // ? | 24069 | // This function will be called whenever a moment is mutated. |
21085 | if (!(n100 === 4 || n1 === 4)) { | 24070 | // It is intended to keep the offset in sync with the timezone. |
21086 | ++year; | 24071 | utils_hooks__hooks.updateOffset = function () {}; |
21087 | } | ||
21088 | 24072 | ||
21089 | return year; | 24073 | // MOMENTS |
21090 | } | ||
21091 | 24074 | ||
21092 | _exports = module.exports = { | 24075 | // keepLocalTime = true means only change the timezone, without |
21093 | each: function each(arr, fn) { | 24076 | // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]--> |
21094 | for (var i = 0, len = arr.length; i < len; i++) { | 24077 | // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset |
21095 | if (fn(arr[i], i, arr) === false) { | 24078 | // +0200, so we adjust the time as needed, to be valid. |
21096 | break; | 24079 | // |
21097 | } | 24080 | // Keeping the time actually adds/subtracts (one hour) |
24081 | // from the actual represented time. That is why we call updateOffset | ||
24082 | // a second time. In case it wants us to change the offset again | ||
24083 | // _changeInProgress == true case, then we have to adjust, because | ||
24084 | // there is no such time in the given timezone. | ||
24085 | function getSetOffset (input, keepLocalTime) { | ||
24086 | var offset = this._offset || 0, | ||
24087 | localAdjust; | ||
24088 | if (!this.isValid()) { | ||
24089 | return input != null ? this : NaN; | ||
24090 | } | ||
24091 | if (input != null) { | ||
24092 | if (typeof input === 'string') { | ||
24093 | input = offsetFromString(matchShortOffset, input); | ||
24094 | } else if (Math.abs(input) < 16) { | ||
24095 | input = input * 60; | ||
24096 | } | ||
24097 | if (!this._isUTC && keepLocalTime) { | ||
24098 | localAdjust = getDateOffset(this); | ||
24099 | } | ||
24100 | this._offset = input; | ||
24101 | this._isUTC = true; | ||
24102 | if (localAdjust != null) { | ||
24103 | this.add(localAdjust, 'm'); | ||
24104 | } | ||
24105 | if (offset !== input) { | ||
24106 | if (!keepLocalTime || this._changeInProgress) { | ||
24107 | add_subtract__addSubtract(this, create__createDuration(input - offset, 'm'), 1, false); | ||
24108 | } else if (!this._changeInProgress) { | ||
24109 | this._changeInProgress = true; | ||
24110 | utils_hooks__hooks.updateOffset(this, true); | ||
24111 | this._changeInProgress = null; | ||
24112 | } | ||
24113 | } | ||
24114 | return this; | ||
24115 | } else { | ||
24116 | return this._isUTC ? offset : getDateOffset(this); | ||
24117 | } | ||
21098 | } | 24118 | } |
21099 | }, | ||
21100 | 24119 | ||
21101 | mix: function mix(t, s) { | 24120 | function getSetZone (input, keepLocalTime) { |
21102 | for (var p in s) { | 24121 | if (input != null) { |
21103 | if (s.hasOwnProperty(p)) { | 24122 | if (typeof input !== 'string') { |
21104 | t[p] = s[p]; | 24123 | input = -input; |
21105 | } | 24124 | } |
24125 | |||
24126 | this.utcOffset(input, keepLocalTime); | ||
24127 | |||
24128 | return this; | ||
24129 | } else { | ||
24130 | return -this.utcOffset(); | ||
24131 | } | ||
21106 | } | 24132 | } |
21107 | }, | ||
21108 | 24133 | ||
21109 | isLeapYear: function isLeapYear(year) { | 24134 | function setOffsetToUTC (keepLocalTime) { |
21110 | if ((year & 3) !== 0) { | 24135 | return this.utcOffset(0, keepLocalTime); |
21111 | return false; | ||
21112 | } | 24136 | } |
21113 | return year % 100 !== 0 || year % 400 === 0; | ||
21114 | }, | ||
21115 | 24137 | ||
21116 | mod: function mod(x, y) { | 24138 | function setOffsetToLocal (keepLocalTime) { |
21117 | // 负数时不是镜像关系 | 24139 | if (this._isUTC) { |
21118 | return x - y * floor(x / y); | 24140 | this.utcOffset(0, keepLocalTime); |
21119 | }, | 24141 | this._isUTC = false; |
21120 | 24142 | ||
21121 | // month: 0 based | 24143 | if (keepLocalTime) { |
21122 | getFixedDate: function getFixedDate(year, month, dayOfMonth) { | 24144 | this.subtract(getDateOffset(this), 'm'); |
21123 | var prevYear = year - 1; | 24145 | } |
21124 | // 考虑公元前 | 24146 | } |
21125 | return DAYS_OF_YEAR * prevYear + floor(prevYear / 4) - floor(prevYear / 100) + floor(prevYear / 400) + getDayOfYear(year, month, dayOfMonth); | 24147 | return this; |
21126 | }, | 24148 | } |
24149 | |||
24150 | function setOffsetToParsedOffset () { | ||
24151 | if (this._tzm) { | ||
24152 | this.utcOffset(this._tzm); | ||
24153 | } else if (typeof this._i === 'string') { | ||
24154 | this.utcOffset(offsetFromString(matchOffset, this._i)); | ||
24155 | } | ||
24156 | return this; | ||
24157 | } | ||
21127 | 24158 | ||
21128 | getGregorianDateFromFixedDate: function getGregorianDateFromFixedDate(fixedDate) { | 24159 | function hasAlignedHourOffset (input) { |
21129 | var year = getGregorianYearFromFixedDate(fixedDate); | 24160 | if (!this.isValid()) { |
21130 | var jan1 = _exports.getFixedDate(year, Const.JANUARY, 1); | 24161 | return false; |
21131 | var isLeap = _exports.isLeapYear(year); | 24162 | } |
21132 | var ACCUMULATED_DAYS = isLeap ? ACCUMULATED_DAYS_IN_MONTH_LEAP : ACCUMULATED_DAYS_IN_MONTH; | 24163 | input = input ? local__createLocal(input).utcOffset() : 0; |
21133 | var daysDiff = fixedDate - jan1; | ||
21134 | var month = undefined; | ||
21135 | 24164 | ||
21136 | for (var i = 0; i < ACCUMULATED_DAYS.length; i++) { | 24165 | return (this.utcOffset() - input) % 60 === 0; |
21137 | if (ACCUMULATED_DAYS[i] <= daysDiff) { | ||
21138 | month = i; | ||
21139 | } else { | ||
21140 | break; | ||
21141 | } | ||
21142 | } | 24166 | } |
21143 | 24167 | ||
21144 | var dayOfMonth = fixedDate - jan1 - ACCUMULATED_DAYS[month] + 1; | 24168 | function isDaylightSavingTime () { |
21145 | var dayOfWeek = getDayOfWeekFromFixedDate(fixedDate); | 24169 | return ( |
24170 | this.utcOffset() > this.clone().month(0).utcOffset() || | ||
24171 | this.utcOffset() > this.clone().month(5).utcOffset() | ||
24172 | ); | ||
24173 | } | ||
21146 | 24174 | ||
21147 | return { | 24175 | function isDaylightSavingTimeShifted () { |
21148 | year: year, | 24176 | if (!isUndefined(this._isDSTShifted)) { |
21149 | month: month, | 24177 | return this._isDSTShifted; |
21150 | dayOfMonth: dayOfMonth, | 24178 | } |
21151 | dayOfWeek: dayOfWeek, | ||
21152 | isLeap: isLeap | ||
21153 | }; | ||
21154 | } | ||
21155 | }; | ||
21156 | |||
21157 | /***/ }, | ||
21158 | /* 163 */ | ||
21159 | /***/ function(module, exports) { | ||
21160 | |||
21161 | /* | ||
21162 | * @ignore | ||
21163 | * const for gregorian date | ||
21164 | * @author yiminghe@gmail.com | ||
21165 | */ | ||
21166 | 24179 | ||
21167 | "use strict"; | 24180 | var c = {}; |
21168 | 24181 | ||
21169 | module.exports = { | 24182 | copyConfig(c, this); |
21170 | /* | 24183 | c = prepareConfig(c); |
21171 | * Enum indicating sunday | ||
21172 | * @type Number | ||
21173 | * @member Date.Gregorian | ||
21174 | */ | ||
21175 | SUNDAY: 0, | ||
21176 | /* | ||
21177 | * Enum indicating monday | ||
21178 | * @type Number | ||
21179 | * @member Date.Gregorian | ||
21180 | */ | ||
21181 | MONDAY: 1, | ||
21182 | /* | ||
21183 | * Enum indicating tuesday | ||
21184 | * @type Number | ||
21185 | * @member Date.Gregorian | ||
21186 | */ | ||
21187 | TUESDAY: 2, | ||
21188 | /* | ||
21189 | * Enum indicating wednesday | ||
21190 | * @type Number | ||
21191 | * @member Date.Gregorian | ||
21192 | */ | ||
21193 | WEDNESDAY: 3, | ||
21194 | /* | ||
21195 | * Enum indicating thursday | ||
21196 | * @type Number | ||
21197 | * @member Date.Gregorian | ||
21198 | */ | ||
21199 | THURSDAY: 4, | ||
21200 | /* | ||
21201 | * Enum indicating friday | ||
21202 | * @type Number | ||
21203 | * @member Date.Gregorian | ||
21204 | */ | ||
21205 | FRIDAY: 5, | ||
21206 | /* | ||
21207 | * Enum indicating saturday | ||
21208 | * @type Number | ||
21209 | * @member Date.Gregorian | ||
21210 | */ | ||
21211 | SATURDAY: 6, | ||
21212 | /* | ||
21213 | * Enum indicating january | ||
21214 | * @type Number | ||
21215 | * @member Date.Gregorian | ||
21216 | */ | ||
21217 | JANUARY: 0, | ||
21218 | /* | ||
21219 | * Enum indicating february | ||
21220 | * @type Number | ||
21221 | * @member Date.Gregorian | ||
21222 | */ | ||
21223 | FEBRUARY: 1, | ||
21224 | /* | ||
21225 | * Enum indicating march | ||
21226 | * @type Number | ||
21227 | * @member Date.Gregorian | ||
21228 | */ | ||
21229 | MARCH: 2, | ||
21230 | /* | ||
21231 | * Enum indicating april | ||
21232 | * @type Number | ||
21233 | * @member Date.Gregorian | ||
21234 | */ | ||
21235 | APRIL: 3, | ||
21236 | /* | ||
21237 | * Enum indicating may | ||
21238 | * @type Number | ||
21239 | * @member Date.Gregorian | ||
21240 | */ | ||
21241 | MAY: 4, | ||
21242 | /* | ||
21243 | * Enum indicating june | ||
21244 | * @type Number | ||
21245 | * @member Date.Gregorian | ||
21246 | */ | ||
21247 | JUNE: 5, | ||
21248 | /* | ||
21249 | * Enum indicating july | ||
21250 | * @type Number | ||
21251 | * @member Date.Gregorian | ||
21252 | */ | ||
21253 | JULY: 6, | ||
21254 | /* | ||
21255 | * Enum indicating august | ||
21256 | * @type Number | ||
21257 | * @member Date.Gregorian | ||
21258 | */ | ||
21259 | AUGUST: 7, | ||
21260 | /* | ||
21261 | * Enum indicating september | ||
21262 | * @type Number | ||
21263 | * @member Date.Gregorian | ||
21264 | */ | ||
21265 | SEPTEMBER: 8, | ||
21266 | /* | ||
21267 | * Enum indicating october | ||
21268 | * @type Number | ||
21269 | * @member Date.Gregorian | ||
21270 | */ | ||
21271 | OCTOBER: 9, | ||
21272 | /* | ||
21273 | * Enum indicating november | ||
21274 | * @type Number | ||
21275 | * @member Date.Gregorian | ||
21276 | */ | ||
21277 | NOVEMBER: 10, | ||
21278 | /* | ||
21279 | * Enum indicating december | ||
21280 | * @type Number | ||
21281 | * @member Date.Gregorian | ||
21282 | */ | ||
21283 | DECEMBER: 11 | ||
21284 | }; | ||
21285 | |||
21286 | /***/ }, | ||
21287 | /* 164 */ | ||
21288 | /***/ function(module, exports) { | ||
21289 | |||
21290 | /* | ||
21291 | * en-us locale | ||
21292 | * @ignore | ||
21293 | * @author yiminghe@gmail.com | ||
21294 | */ | ||
21295 | "use strict"; | ||
21296 | 24184 | ||
21297 | module.exports = { | 24185 | if (c._a) { |
21298 | // in minutes | 24186 | var other = c._isUTC ? create_utc__createUTC(c._a) : local__createLocal(c._a); |
21299 | timezoneOffset: -8 * 60, | 24187 | this._isDSTShifted = this.isValid() && |
21300 | firstDayOfWeek: 0, | 24188 | compareArrays(c._a, other.toArray()) > 0; |
21301 | minimalDaysInFirstWeek: 1 | 24189 | } else { |
21302 | }; | 24190 | this._isDSTShifted = false; |
21303 | 24191 | } | |
21304 | /***/ }, | ||
21305 | /* 165 */ | ||
21306 | /***/ function(module, exports, __webpack_require__) { | ||
21307 | |||
21308 | /** | ||
21309 | * @ignore | ||
21310 | * DateTimeFormat for | ||
21311 | * Inspired by DateTimeFormat from JDK. | ||
21312 | * @author yiminghe@gmail.com | ||
21313 | */ | ||
21314 | 24192 | ||
21315 | 'use strict'; | 24193 | return this._isDSTShifted; |
24194 | } | ||
21316 | 24195 | ||
21317 | var GregorianCalendar = __webpack_require__(161); | 24196 | function isLocal () { |
21318 | var enUsLocale = __webpack_require__(166); | 24197 | return this.isValid() ? !this._isUTC : false; |
21319 | var MAX_VALUE = Number.MAX_VALUE; | 24198 | } |
21320 | var warning = __webpack_require__(167); | ||
21321 | 24199 | ||
21322 | /** | 24200 | function isUtcOffset () { |
21323 | * date or time style enum | 24201 | return this.isValid() ? this._isUTC : false; |
21324 | * @enum {Number} Date.Formatter.Style | 24202 | } |
21325 | */ | ||
21326 | var DateTimeStyle = { | ||
21327 | /** | ||
21328 | * full style | ||
21329 | */ | ||
21330 | FULL: 0, | ||
21331 | /** | ||
21332 | * long style | ||
21333 | */ | ||
21334 | LONG: 1, | ||
21335 | /** | ||
21336 | * medium style | ||
21337 | */ | ||
21338 | MEDIUM: 2, | ||
21339 | /** | ||
21340 | * short style | ||
21341 | */ | ||
21342 | SHORT: 3 | ||
21343 | }; | ||
21344 | 24203 | ||
21345 | /* | 24204 | function isUtc () { |
21346 | Letter Date or Time Component Presentation Examples | 24205 | return this.isValid() ? this._isUTC && this._offset === 0 : false; |
21347 | G Era designator Text AD | 24206 | } |
21348 | y Year Year 1996; 96 | 24207 | |
21349 | M Month in year Month July; Jul; 07 | 24208 | // ASP.NET json date format regex |
21350 | w Week in year Number 27 | 24209 | var aspNetRegex = /^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?\d*)?$/; |
21351 | W Week in month Number 2 | 24210 | |
21352 | D Day in year Number 189 | 24211 | // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html |
21353 | d Day in month Number 10 | 24212 | // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere |
21354 | F Day of week in month Number 2 | 24213 | // and further modified to allow for strings containing both week and day |
21355 | E Day in week Text Tuesday; Tue | 24214 | 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)?)?$/; |
21356 | a Am/pm marker Text PM | 24215 | |
21357 | H Hour in day (0-23) Number 0 | 24216 | function create__createDuration (input, key) { |
21358 | k Hour in day (1-24) Number 24 | 24217 | var duration = input, |
21359 | K Hour in am/pm (0-11) Number 0 | 24218 | // matching against regexp is expensive, do it on demand |
21360 | h Hour in am/pm (1-12) Number 12 | 24219 | match = null, |
21361 | m Minute in hour Number 30 | 24220 | sign, |
21362 | s Second in minute Number 55 | 24221 | ret, |
21363 | S Millisecond Number 978 | 24222 | diffRes; |
21364 | x z Time zone General time zone Pacific Standard Time; PST; GMT-08:00 | ||
21365 | Z Time zone RFC 822 time zone -0800 | ||
21366 | */ | ||
21367 | |||
21368 | var patternChars = new Array(GregorianCalendar.DAY_OF_WEEK_IN_MONTH + 2).join('1'); | ||
21369 | var ERA = 0; | ||
21370 | var calendarIndexMap = {}; | ||
21371 | |||
21372 | patternChars = patternChars.split(''); | ||
21373 | patternChars[ERA] = 'G'; | ||
21374 | patternChars[GregorianCalendar.YEAR] = 'y'; | ||
21375 | patternChars[GregorianCalendar.MONTH] = 'M'; | ||
21376 | patternChars[GregorianCalendar.DAY_OF_MONTH] = 'd'; | ||
21377 | patternChars[GregorianCalendar.HOUR_OF_DAY] = 'H'; | ||
21378 | patternChars[GregorianCalendar.MINUTES] = 'm'; | ||
21379 | patternChars[GregorianCalendar.SECONDS] = 's'; | ||
21380 | patternChars[GregorianCalendar.MILLISECONDS] = 'S'; | ||
21381 | patternChars[GregorianCalendar.WEEK_OF_YEAR] = 'w'; | ||
21382 | patternChars[GregorianCalendar.WEEK_OF_MONTH] = 'W'; | ||
21383 | patternChars[GregorianCalendar.DAY_OF_YEAR] = 'D'; | ||
21384 | patternChars[GregorianCalendar.DAY_OF_WEEK_IN_MONTH] = 'F'; | ||
21385 | |||
21386 | (function init() { | ||
21387 | for (var index in patternChars) { | ||
21388 | if (patternChars.hasOwnProperty(index)) { | ||
21389 | calendarIndexMap[patternChars[index]] = index; | ||
21390 | } | ||
21391 | } | ||
21392 | })(); | ||
21393 | |||
21394 | function mix(t, s) { | ||
21395 | for (var p in s) { | ||
21396 | if (s.hasOwnProperty(p)) { | ||
21397 | t[p] = s[p]; | ||
21398 | } | ||
21399 | } | ||
21400 | } | ||
21401 | |||
21402 | var SUBSTITUTE_REG = /\\?\{([^{}]+)\}/g; | ||
21403 | var EMPTY = ''; | ||
21404 | |||
21405 | function substitute(str, o, regexp) { | ||
21406 | if (typeof str !== 'string' || !o) { | ||
21407 | return str; | ||
21408 | } | ||
21409 | 24223 | ||
21410 | return str.replace(regexp || SUBSTITUTE_REG, function (match, name) { | 24224 | if (isDuration(input)) { |
21411 | if (match.charAt(0) === '\\') { | 24225 | duration = { |
21412 | return match.slice(1); | 24226 | ms : input._milliseconds, |
24227 | d : input._days, | ||
24228 | M : input._months | ||
24229 | }; | ||
24230 | } else if (typeof input === 'number') { | ||
24231 | duration = {}; | ||
24232 | if (key) { | ||
24233 | duration[key] = input; | ||
24234 | } else { | ||
24235 | duration.milliseconds = input; | ||
24236 | } | ||
24237 | } else if (!!(match = aspNetRegex.exec(input))) { | ||
24238 | sign = (match[1] === '-') ? -1 : 1; | ||
24239 | duration = { | ||
24240 | y : 0, | ||
24241 | d : toInt(match[DATE]) * sign, | ||
24242 | h : toInt(match[HOUR]) * sign, | ||
24243 | m : toInt(match[MINUTE]) * sign, | ||
24244 | s : toInt(match[SECOND]) * sign, | ||
24245 | ms : toInt(match[MILLISECOND]) * sign | ||
24246 | }; | ||
24247 | } else if (!!(match = isoRegex.exec(input))) { | ||
24248 | sign = (match[1] === '-') ? -1 : 1; | ||
24249 | duration = { | ||
24250 | y : parseIso(match[2], sign), | ||
24251 | M : parseIso(match[3], sign), | ||
24252 | w : parseIso(match[4], sign), | ||
24253 | d : parseIso(match[5], sign), | ||
24254 | h : parseIso(match[6], sign), | ||
24255 | m : parseIso(match[7], sign), | ||
24256 | s : parseIso(match[8], sign) | ||
24257 | }; | ||
24258 | } else if (duration == null) {// checks for null or undefined | ||
24259 | duration = {}; | ||
24260 | } else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) { | ||
24261 | diffRes = momentsDifference(local__createLocal(duration.from), local__createLocal(duration.to)); | ||
24262 | |||
24263 | duration = {}; | ||
24264 | duration.ms = diffRes.milliseconds; | ||
24265 | duration.M = diffRes.months; | ||
24266 | } | ||
24267 | |||
24268 | ret = new Duration(duration); | ||
24269 | |||
24270 | if (isDuration(input) && hasOwnProp(input, '_locale')) { | ||
24271 | ret._locale = input._locale; | ||
24272 | } | ||
24273 | |||
24274 | return ret; | ||
21413 | } | 24275 | } |
21414 | return o[name] === undefined ? EMPTY : o[name]; | ||
21415 | }); | ||
21416 | } | ||
21417 | 24276 | ||
21418 | patternChars = patternChars.join('') + 'ahkKZE'; | 24277 | create__createDuration.fn = Duration.prototype; |
21419 | 24278 | ||
21420 | function encode(lastField, count, compiledPattern) { | 24279 | function parseIso (inp, sign) { |
21421 | compiledPattern.push({ | 24280 | // We'd normally use ~~inp for this, but unfortunately it also |
21422 | field: lastField, | 24281 | // converts floats to ints. |
21423 | count: count | 24282 | // inp may be undefined, so careful calling replace on it. |
21424 | }); | 24283 | var res = inp && parseFloat(inp.replace(',', '.')); |
21425 | } | 24284 | // apply sign while we're at it |
24285 | return (isNaN(res) ? 0 : res) * sign; | ||
24286 | } | ||
21426 | 24287 | ||
21427 | function compile(pattern) { | 24288 | function positiveMomentsDifference(base, other) { |
21428 | var length = pattern.length; | 24289 | var res = {milliseconds: 0, months: 0}; |
21429 | var inQuote = false; | 24290 | |
21430 | var compiledPattern = []; | 24291 | res.months = other.month() - base.month() + |
21431 | var tmpBuffer = null; | 24292 | (other.year() - base.year()) * 12; |
21432 | var count = 0; | 24293 | if (base.clone().add(res.months, 'M').isAfter(other)) { |
21433 | var lastField = -1; | 24294 | --res.months; |
21434 | |||
21435 | for (var i = 0; i < length; i++) { | ||
21436 | var c = pattern.charAt(i); | ||
21437 | |||
21438 | if (c === '\'') { | ||
21439 | // '' is treated as a single quote regardless of being | ||
21440 | // in a quoted section. | ||
21441 | if (i + 1 < length) { | ||
21442 | c = pattern.charAt(i + 1); | ||
21443 | if (c === '\'') { | ||
21444 | i++; | ||
21445 | if (count !== 0) { | ||
21446 | encode(lastField, count, compiledPattern); | ||
21447 | lastField = -1; | ||
21448 | count = 0; | ||
21449 | } | ||
21450 | if (inQuote) { | ||
21451 | tmpBuffer += c; | ||
21452 | } | ||
21453 | continue; | ||
21454 | } | 24295 | } |
21455 | } | 24296 | |
21456 | if (!inQuote) { | 24297 | res.milliseconds = +other - +(base.clone().add(res.months, 'M')); |
21457 | if (count !== 0) { | 24298 | |
21458 | encode(lastField, count, compiledPattern); | 24299 | return res; |
21459 | lastField = -1; | 24300 | } |
21460 | count = 0; | 24301 | |
24302 | function momentsDifference(base, other) { | ||
24303 | var res; | ||
24304 | if (!(base.isValid() && other.isValid())) { | ||
24305 | return {milliseconds: 0, months: 0}; | ||
21461 | } | 24306 | } |
21462 | tmpBuffer = ''; | 24307 | |
21463 | inQuote = true; | 24308 | other = cloneWithOffset(other, base); |
21464 | } else { | 24309 | if (base.isBefore(other)) { |
21465 | compiledPattern.push({ | 24310 | res = positiveMomentsDifference(base, other); |
21466 | text: tmpBuffer | 24311 | } else { |
21467 | }); | 24312 | res = positiveMomentsDifference(other, base); |
21468 | inQuote = false; | 24313 | res.milliseconds = -res.milliseconds; |
21469 | } | 24314 | res.months = -res.months; |
21470 | continue; | 24315 | } |
24316 | |||
24317 | return res; | ||
21471 | } | 24318 | } |
21472 | if (inQuote) { | 24319 | |
21473 | tmpBuffer += c; | 24320 | function absRound (number) { |
21474 | continue; | 24321 | if (number < 0) { |
24322 | return Math.round(-1 * number) * -1; | ||
24323 | } else { | ||
24324 | return Math.round(number); | ||
24325 | } | ||
21475 | } | 24326 | } |
21476 | if (!(c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z')) { | 24327 | |
21477 | if (count !== 0) { | 24328 | // TODO: remove 'name' arg after deprecation is removed |
21478 | encode(lastField, count, compiledPattern); | 24329 | function createAdder(direction, name) { |
21479 | lastField = -1; | 24330 | return function (val, period) { |
21480 | count = 0; | 24331 | var dur, tmp; |
21481 | } | 24332 | //invert the arguments, but complain about it |
21482 | compiledPattern.push({ | 24333 | if (period !== null && !isNaN(+period)) { |
21483 | text: c | 24334 | deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period). ' + |
21484 | }); | 24335 | 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.'); |
21485 | continue; | 24336 | tmp = val; val = period; period = tmp; |
24337 | } | ||
24338 | |||
24339 | val = typeof val === 'string' ? +val : val; | ||
24340 | dur = create__createDuration(val, period); | ||
24341 | add_subtract__addSubtract(this, dur, direction); | ||
24342 | return this; | ||
24343 | }; | ||
21486 | } | 24344 | } |
21487 | 24345 | ||
21488 | if (patternChars.indexOf(c) === -1) { | 24346 | function add_subtract__addSubtract (mom, duration, isAdding, updateOffset) { |
21489 | throw new Error('Illegal pattern character "' + c + '"'); | 24347 | var milliseconds = duration._milliseconds, |
24348 | days = absRound(duration._days), | ||
24349 | months = absRound(duration._months); | ||
24350 | |||
24351 | if (!mom.isValid()) { | ||
24352 | // No op | ||
24353 | return; | ||
24354 | } | ||
24355 | |||
24356 | updateOffset = updateOffset == null ? true : updateOffset; | ||
24357 | |||
24358 | if (milliseconds) { | ||
24359 | mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding); | ||
24360 | } | ||
24361 | if (days) { | ||
24362 | get_set__set(mom, 'Date', get_set__get(mom, 'Date') + days * isAdding); | ||
24363 | } | ||
24364 | if (months) { | ||
24365 | setMonth(mom, get_set__get(mom, 'Month') + months * isAdding); | ||
24366 | } | ||
24367 | if (updateOffset) { | ||
24368 | utils_hooks__hooks.updateOffset(mom, days || months); | ||
24369 | } | ||
21490 | } | 24370 | } |
21491 | 24371 | ||
21492 | if (lastField === -1 || lastField === c) { | 24372 | var add_subtract__add = createAdder(1, 'add'); |
21493 | lastField = c; | 24373 | var add_subtract__subtract = createAdder(-1, 'subtract'); |
21494 | count++; | 24374 | |
21495 | continue; | 24375 | function getCalendarFormat(myMoment, now) { |
24376 | var diff = myMoment.diff(now, 'days', true); | ||
24377 | return diff < -6 ? 'sameElse' : | ||
24378 | diff < -1 ? 'lastWeek' : | ||
24379 | diff < 0 ? 'lastDay' : | ||
24380 | diff < 1 ? 'sameDay' : | ||
24381 | diff < 2 ? 'nextDay' : | ||
24382 | diff < 7 ? 'nextWeek' : 'sameElse'; | ||
21496 | } | 24383 | } |
21497 | encode(lastField, count, compiledPattern); | ||
21498 | lastField = c; | ||
21499 | count = 1; | ||
21500 | } | ||
21501 | 24384 | ||
21502 | if (inQuote) { | 24385 | function moment_calendar__calendar (time, formats) { |
21503 | throw new Error('Unterminated quote'); | 24386 | // We want to compare the start of today, vs this. |
21504 | } | 24387 | // Getting start-of-today depends on whether we're local/utc/offset or not. |
21505 | 24388 | var now = time || local__createLocal(), | |
21506 | if (count !== 0) { | 24389 | sod = cloneWithOffset(now, this).startOf('day'), |
21507 | encode(lastField, count, compiledPattern); | 24390 | format = utils_hooks__hooks.calendarFormat(this, sod) || 'sameElse'; |
21508 | } | 24391 | |
21509 | 24392 | var output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]); | |
21510 | return compiledPattern; | 24393 | |
21511 | } | 24394 | return this.format(output || this.localeData().calendar(format, this, local__createLocal(now))); |
21512 | |||
21513 | var zeroDigit = '0'; | ||
21514 | |||
21515 | // TODO zeroDigit localization?? | ||
21516 | function zeroPaddingNumber(_x, _x2, _x3, _x4) { | ||
21517 | var _again = true; | ||
21518 | |||
21519 | _function: while (_again) { | ||
21520 | var value = _x, | ||
21521 | minDigits = _x2, | ||
21522 | maxDigits_ = _x3, | ||
21523 | b = _x4; | ||
21524 | _again = false; | ||
21525 | |||
21526 | // Optimization for 1, 2 and 4 digit numbers. This should | ||
21527 | // cover most cases of formatting date/time related items. | ||
21528 | // Note: This optimization code assumes that maxDigits is | ||
21529 | // either 2 or Integer.MAX_VALUE (maxIntCount in format()). | ||
21530 | var buffer = b || []; | ||
21531 | var maxDigits = maxDigits_ || MAX_VALUE; | ||
21532 | if (value >= 0) { | ||
21533 | if (value < 100 && minDigits >= 1 && minDigits <= 2) { | ||
21534 | if (value < 10 && minDigits === 2) { | ||
21535 | buffer.push(zeroDigit); | ||
21536 | } | ||
21537 | buffer.push(value); | ||
21538 | return buffer.join(''); | ||
21539 | } else if (value >= 1000 && value < 10000) { | ||
21540 | if (minDigits === 4) { | ||
21541 | buffer.push(value); | ||
21542 | return buffer.join(''); | ||
21543 | } | ||
21544 | if (minDigits === 2 && maxDigits === 2) { | ||
21545 | _x = value % 100; | ||
21546 | _x2 = 2; | ||
21547 | _x3 = 2; | ||
21548 | _x4 = buffer; | ||
21549 | _again = true; | ||
21550 | buffer = maxDigits = undefined; | ||
21551 | continue _function; | ||
21552 | } | ||
21553 | } | ||
21554 | } | ||
21555 | buffer.push(value + ''); | ||
21556 | return buffer.join(''); | ||
21557 | } | ||
21558 | } | ||
21559 | |||
21560 | /** | ||
21561 | * | ||
21562 | * date time formatter for GregorianCalendar | ||
21563 | * | ||
21564 | * @example | ||
21565 | * | ||
21566 | * const calendar = new GregorianCalendar(2013,9,24); | ||
21567 | * // ' to escape | ||
21568 | * const formatter = new GregorianCalendarFormat("'today is' ''yyyy/MM/dd a''"); | ||
21569 | * document.write(formatter.format(calendar)); | ||
21570 | * | ||
21571 | * @class GregorianCalendarFormat | ||
21572 | * @param {String} pattern patter string of date formatter | ||
21573 | * | ||
21574 | * <table border="1"> | ||
21575 | * <thead valign="bottom"> | ||
21576 | * <tr><th class="head">Letter</th> | ||
21577 | * <th class="head">Date or Time Component</th> | ||
21578 | * <th class="head">Presentation</th> | ||
21579 | * <th class="head">Examples</th> | ||
21580 | * </tr> | ||
21581 | * </thead> | ||
21582 | * <tbody valign="top"> | ||
21583 | * <tr><td>G</td> | ||
21584 | * <td>Era designator</td> | ||
21585 | * <td>Text</td> | ||
21586 | * <td>AD</td> | ||
21587 | * </tr> | ||
21588 | * <tr><td>y</td> | ||
21589 | * <td>Year</td> | ||
21590 | * <td>Year</td> | ||
21591 | * <td>1996; 96</td> | ||
21592 | * </tr> | ||
21593 | * <tr><td>M</td> | ||
21594 | * <td>Month in year</td> | ||
21595 | * <td>Month</td> | ||
21596 | * <td>July; Jul; 07</td> | ||
21597 | * </tr> | ||
21598 | * <tr><td>w</td> | ||
21599 | * <td>Week in year</td> | ||
21600 | * <td>Number</td> | ||
21601 | * <td>27</td> | ||
21602 | * </tr> | ||
21603 | * <tr><td>W</td> | ||
21604 | * <td>Week in month</td> | ||
21605 | * <td>Number</td> | ||
21606 | * <td>2</td> | ||
21607 | * </tr> | ||
21608 | * <tr><td>D</td> | ||
21609 | * <td>Day in year</td> | ||
21610 | * <td>Number</td> | ||
21611 | * <td>189</td> | ||
21612 | * </tr> | ||
21613 | * <tr><td>d</td> | ||
21614 | * <td>Day in month</td> | ||
21615 | * <td>Number</td> | ||
21616 | * <td>10</td> | ||
21617 | * </tr> | ||
21618 | * <tr><td>F</td> | ||
21619 | * <td>Day of week in month</td> | ||
21620 | * <td>Number</td> | ||
21621 | * <td>2</td> | ||
21622 | * </tr> | ||
21623 | * <tr><td>E</td> | ||
21624 | * <td>Day in week</td> | ||
21625 | * <td>Text</td> | ||
21626 | * <td>Tuesday; Tue</td> | ||
21627 | * </tr> | ||
21628 | * <tr><td>a</td> | ||
21629 | * <td>Am/pm marker</td> | ||
21630 | * <td>Text</td> | ||
21631 | * <td>PM</td> | ||
21632 | * </tr> | ||
21633 | * <tr><td>H</td> | ||
21634 | * <td>Hour in day (0-23)</td> | ||
21635 | * <td>Number</td> | ||
21636 | * <td>0</td> | ||
21637 | * </tr> | ||
21638 | * <tr><td>k</td> | ||
21639 | * <td>Hour in day (1-24)</td> | ||
21640 | * <td>Number</td> | ||
21641 | * <td>24</td> | ||
21642 | * </tr> | ||
21643 | * <tr><td>K</td> | ||
21644 | * <td>Hour in am/pm (0-11)</td> | ||
21645 | * <td>Number</td> | ||
21646 | * <td>0</td> | ||
21647 | * </tr> | ||
21648 | * <tr><td>h</td> | ||
21649 | * <td>Hour in am/pm (1-12)</td> | ||
21650 | * <td>Number</td> | ||
21651 | * <td>12</td> | ||
21652 | * </tr> | ||
21653 | * <tr><td>m</td> | ||
21654 | * <td>Minute in hour</td> | ||
21655 | * <td>Number</td> | ||
21656 | * <td>30</td> | ||
21657 | * </tr> | ||
21658 | * <tr><td>s</td> | ||
21659 | * <td>Second in minute</td> | ||
21660 | * <td>Number</td> | ||
21661 | * <td>55</td> | ||
21662 | * </tr> | ||
21663 | * <tr><td>S</td> | ||
21664 | * <td>Millisecond</td> | ||
21665 | * <td>Number</td> | ||
21666 | * <td>978</td> | ||
21667 | * </tr> | ||
21668 | * <tr><td>x/z</td> | ||
21669 | * <td>Time zone</td> | ||
21670 | * <td>General time zone</td> | ||
21671 | * <td>Pacific Standard Time; PST; GMT-08:00</td> | ||
21672 | * </tr> | ||
21673 | * <tr><td>Z</td> | ||
21674 | * <td>Time zone</td> | ||
21675 | * <td>RFC 822 time zone</td> | ||
21676 | * <td>-0800</td> | ||
21677 | * </tr> | ||
21678 | * </tbody> | ||
21679 | * </table> | ||
21680 | |||
21681 | * @param {Object} locale format locale | ||
21682 | */ | ||
21683 | function DateTimeFormat(pattern, locale) { | ||
21684 | this.locale = locale || enUsLocale; | ||
21685 | this.originalPattern = pattern; | ||
21686 | this.pattern = compile(pattern); | ||
21687 | } | ||
21688 | |||
21689 | function formatField(field, count, locale, calendar) { | ||
21690 | var current = undefined; | ||
21691 | var value = undefined; | ||
21692 | switch (field) { | ||
21693 | case 'G': | ||
21694 | value = calendar.getYear() > 0 ? 1 : 0; | ||
21695 | current = locale.eras[value]; | ||
21696 | break; | ||
21697 | case 'y': | ||
21698 | value = calendar.getYear(); | ||
21699 | if (value <= 0) { | ||
21700 | value = 1 - value; | ||
21701 | } | ||
21702 | current = zeroPaddingNumber(value, 2, count !== 2 ? MAX_VALUE : 2); | ||
21703 | break; | ||
21704 | case 'M': | ||
21705 | value = calendar.getMonth(); | ||
21706 | if (count >= 4) { | ||
21707 | current = locale.months[value]; | ||
21708 | } else if (count === 3) { | ||
21709 | current = locale.shortMonths[value]; | ||
21710 | } else { | ||
21711 | current = zeroPaddingNumber(value + 1, count); | ||
21712 | } | ||
21713 | break; | ||
21714 | case 'k': | ||
21715 | current = zeroPaddingNumber(calendar.getHourOfDay() || 24, count); | ||
21716 | break; | ||
21717 | case 'E': | ||
21718 | value = calendar.getDayOfWeek(); | ||
21719 | current = count >= 4 ? locale.weekdays[value] : locale.shortWeekdays[value]; | ||
21720 | break; | ||
21721 | case 'a': | ||
21722 | current = locale.ampms[calendar.getHourOfDay() >= 12 ? 1 : 0]; | ||
21723 | break; | ||
21724 | case 'h': | ||
21725 | current = zeroPaddingNumber(calendar.getHourOfDay() % 12 || 12, count); | ||
21726 | break; | ||
21727 | case 'K': | ||
21728 | current = zeroPaddingNumber(calendar.getHourOfDay() % 12, count); | ||
21729 | break; | ||
21730 | case 'Z': | ||
21731 | var offset = calendar.getTimezoneOffset(); | ||
21732 | var parts = [offset < 0 ? '-' : '+']; | ||
21733 | offset = Math.abs(offset); | ||
21734 | parts.push(zeroPaddingNumber(Math.floor(offset / 60) % 100, 2), zeroPaddingNumber(offset % 60, 2)); | ||
21735 | current = parts.join(''); | ||
21736 | break; | ||
21737 | default: | ||
21738 | // case 'd': | ||
21739 | // case 'H': | ||
21740 | // case 'm': | ||
21741 | // case 's': | ||
21742 | // case 'S': | ||
21743 | // case 'D': | ||
21744 | // case 'F': | ||
21745 | // case 'w': | ||
21746 | // case 'W': | ||
21747 | var index = calendarIndexMap[field]; | ||
21748 | value = calendar.get(index); | ||
21749 | current = zeroPaddingNumber(value, count); | ||
21750 | } | ||
21751 | return current; | ||
21752 | } | ||
21753 | |||
21754 | function matchPartString(dateStr, startIndex, match, mLen) { | ||
21755 | for (var i = 0; i < mLen; i++) { | ||
21756 | if (dateStr.charAt(startIndex + i) !== match.charAt(i)) { | ||
21757 | return false; | ||
21758 | } | 24395 | } |
21759 | } | ||
21760 | return true; | ||
21761 | } | ||
21762 | 24396 | ||
21763 | function matchField(dateStr, startIndex, matches) { | 24397 | function clone () { |
21764 | var matchedLen = -1; | 24398 | return new Moment(this); |
21765 | var index = -1; | ||
21766 | var i = undefined; | ||
21767 | var len = matches.length; | ||
21768 | for (i = 0; i < len; i++) { | ||
21769 | var m = matches[i]; | ||
21770 | var mLen = m.length; | ||
21771 | if (mLen > matchedLen && matchPartString(dateStr, startIndex, m, mLen)) { | ||
21772 | matchedLen = mLen; | ||
21773 | index = i; | ||
21774 | } | 24399 | } |
21775 | } | ||
21776 | return index >= 0 ? { | ||
21777 | value: index, | ||
21778 | startIndex: startIndex + matchedLen | ||
21779 | } : null; | ||
21780 | } | ||
21781 | 24400 | ||
21782 | function getLeadingNumberLen(str) { | 24401 | function isAfter (input, units) { |
21783 | var i = undefined; | 24402 | var localInput = isMoment(input) ? input : local__createLocal(input); |
21784 | var c = undefined; | 24403 | if (!(this.isValid() && localInput.isValid())) { |
21785 | var len = str.length; | 24404 | return false; |
21786 | for (i = 0; i < len; i++) { | 24405 | } |
21787 | c = str.charAt(i); | 24406 | units = normalizeUnits(!isUndefined(units) ? units : 'millisecond'); |
21788 | if (c < '0' || c > '9') { | 24407 | if (units === 'millisecond') { |
21789 | break; | 24408 | return this.valueOf() > localInput.valueOf(); |
24409 | } else { | ||
24410 | return localInput.valueOf() < this.clone().startOf(units).valueOf(); | ||
24411 | } | ||
21790 | } | 24412 | } |
21791 | } | ||
21792 | return i; | ||
21793 | } | ||
21794 | 24413 | ||
21795 | function matchNumber(dateStr, startIndex, count, obeyCount) { | 24414 | function isBefore (input, units) { |
21796 | var str = dateStr; | 24415 | var localInput = isMoment(input) ? input : local__createLocal(input); |
21797 | var n = undefined; | 24416 | if (!(this.isValid() && localInput.isValid())) { |
21798 | if (obeyCount) { | 24417 | return false; |
21799 | if (dateStr.length < startIndex + count) { | 24418 | } |
21800 | return null; | 24419 | units = normalizeUnits(!isUndefined(units) ? units : 'millisecond'); |
24420 | if (units === 'millisecond') { | ||
24421 | return this.valueOf() < localInput.valueOf(); | ||
24422 | } else { | ||
24423 | return this.clone().endOf(units).valueOf() < localInput.valueOf(); | ||
24424 | } | ||
21801 | } | 24425 | } |
21802 | str = dateStr.slice(startIndex, startIndex + count); | 24426 | |
21803 | if (!str.match(/^\d+$/)) { | 24427 | function isBetween (from, to, units, inclusivity) { |
21804 | throw new Error('GregorianCalendarFormat parse error, dateStr: ' + dateStr + ', patter: ' + this.originalPattern); | 24428 | inclusivity = inclusivity || '()'; |
24429 | return (inclusivity[0] === '(' ? this.isAfter(from, units) : !this.isBefore(from, units)) && | ||
24430 | (inclusivity[1] === ')' ? this.isBefore(to, units) : !this.isAfter(to, units)); | ||
21805 | } | 24431 | } |
21806 | } else { | ||
21807 | str = str.slice(startIndex); | ||
21808 | } | ||
21809 | n = parseInt(str, 10); | ||
21810 | if (isNaN(n)) { | ||
21811 | throw new Error('GregorianCalendarFormat parse error, dateStr: ' + dateStr + ', patter: ' + this.originalPattern); | ||
21812 | } | ||
21813 | return { | ||
21814 | value: n, | ||
21815 | startIndex: startIndex + getLeadingNumberLen(str) | ||
21816 | }; | ||
21817 | } | ||
21818 | 24432 | ||
21819 | function parseField(calendar, dateStr, startIndex_, field, count, obeyCount, tmp) { | 24433 | function isSame (input, units) { |
21820 | var match = undefined; | 24434 | var localInput = isMoment(input) ? input : local__createLocal(input), |
21821 | var year = undefined; | 24435 | inputMs; |
21822 | var hour = undefined; | 24436 | if (!(this.isValid() && localInput.isValid())) { |
21823 | var startIndex = startIndex_; | 24437 | return false; |
21824 | if (dateStr.length <= startIndex) { | 24438 | } |
21825 | return startIndex; | 24439 | units = normalizeUnits(units || 'millisecond'); |
21826 | } | 24440 | if (units === 'millisecond') { |
21827 | var locale = this.locale; | 24441 | return this.valueOf() === localInput.valueOf(); |
21828 | switch (field) { | ||
21829 | case 'G': | ||
21830 | match = matchField(dateStr, startIndex, locale.eras); | ||
21831 | if (match) { | ||
21832 | if (calendar.isSetYear()) { | ||
21833 | if (match.value === 0) { | ||
21834 | year = calendar.getYear(); | ||
21835 | calendar.setYear(1 - year); | ||
21836 | } | ||
21837 | } else { | 24442 | } else { |
21838 | tmp.era = match.value; | 24443 | inputMs = localInput.valueOf(); |
24444 | return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf(); | ||
21839 | } | 24445 | } |
21840 | } | 24446 | } |
21841 | break; | 24447 | |
21842 | case 'y': | 24448 | function isSameOrAfter (input, units) { |
21843 | match = matchNumber.call(this, dateStr, startIndex, count, obeyCount); | 24449 | return this.isSame(input, units) || this.isAfter(input,units); |
21844 | if (match) { | 24450 | } |
21845 | year = match.value; | 24451 | |
21846 | if ('era' in tmp) { | 24452 | function isSameOrBefore (input, units) { |
21847 | if (tmp.era === 0) { | 24453 | return this.isSame(input, units) || this.isBefore(input,units); |
21848 | year = 1 - year; | 24454 | } |
21849 | } | 24455 | |
24456 | function diff (input, units, asFloat) { | ||
24457 | var that, | ||
24458 | zoneDelta, | ||
24459 | delta, output; | ||
24460 | |||
24461 | if (!this.isValid()) { | ||
24462 | return NaN; | ||
21850 | } | 24463 | } |
21851 | calendar.setYear(year); | 24464 | |
21852 | } | 24465 | that = cloneWithOffset(input, this); |
21853 | break; | 24466 | |
21854 | case 'M': | 24467 | if (!that.isValid()) { |
21855 | var month = undefined; | 24468 | return NaN; |
21856 | if (count >= 3) { | ||
21857 | match = matchField(dateStr, startIndex, locale[count === 3 ? 'shortMonths' : 'months']); | ||
21858 | if (match) { | ||
21859 | month = match.value; | ||
21860 | } | 24469 | } |
21861 | } else { | 24470 | |
21862 | match = matchNumber.call(this, dateStr, startIndex, count, obeyCount); | 24471 | zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4; |
21863 | if (match) { | 24472 | |
21864 | month = match.value - 1; | 24473 | units = normalizeUnits(units); |
24474 | |||
24475 | if (units === 'year' || units === 'month' || units === 'quarter') { | ||
24476 | output = monthDiff(this, that); | ||
24477 | if (units === 'quarter') { | ||
24478 | output = output / 3; | ||
24479 | } else if (units === 'year') { | ||
24480 | output = output / 12; | ||
24481 | } | ||
24482 | } else { | ||
24483 | delta = this - that; | ||
24484 | output = units === 'second' ? delta / 1e3 : // 1000 | ||
24485 | units === 'minute' ? delta / 6e4 : // 1000 * 60 | ||
24486 | units === 'hour' ? delta / 36e5 : // 1000 * 60 * 60 | ||
24487 | units === 'day' ? (delta - zoneDelta) / 864e5 : // 1000 * 60 * 60 * 24, negate dst | ||
24488 | units === 'week' ? (delta - zoneDelta) / 6048e5 : // 1000 * 60 * 60 * 24 * 7, negate dst | ||
24489 | delta; | ||
21865 | } | 24490 | } |
21866 | } | 24491 | return asFloat ? output : absFloor(output); |
21867 | if (match) { | 24492 | } |
21868 | calendar.setMonth(month); | 24493 | |
21869 | } | 24494 | function monthDiff (a, b) { |
21870 | break; | 24495 | // difference in months |
21871 | case 'k': | 24496 | var wholeMonthDiff = ((b.year() - a.year()) * 12) + (b.month() - a.month()), |
21872 | match = matchNumber.call(this, dateStr, startIndex, count, obeyCount); | 24497 | // b is in (anchor - 1 month, anchor + 1 month) |
21873 | if (match) { | 24498 | anchor = a.clone().add(wholeMonthDiff, 'months'), |
21874 | calendar.setHourOfDay(match.value % 24); | 24499 | anchor2, adjust; |
21875 | } | 24500 | |
21876 | break; | 24501 | if (b - anchor < 0) { |
21877 | case 'E': | 24502 | anchor2 = a.clone().add(wholeMonthDiff - 1, 'months'); |
21878 | match = matchField(dateStr, startIndex, locale[count > 3 ? 'weekdays' : 'shortWeekdays']); | 24503 | // linear across the month |
21879 | if (match) { | 24504 | adjust = (b - anchor) / (anchor - anchor2); |
21880 | calendar.setDayOfWeek(match.value); | 24505 | } else { |
21881 | } | 24506 | anchor2 = a.clone().add(wholeMonthDiff + 1, 'months'); |
21882 | break; | 24507 | // linear across the month |
21883 | case 'a': | 24508 | adjust = (b - anchor) / (anchor2 - anchor); |
21884 | match = matchField(dateStr, startIndex, locale.ampms); | 24509 | } |
21885 | if (match) { | 24510 | |
21886 | if (calendar.isSetHourOfDay()) { | 24511 | //check for negative zero, return zero if negative zero |
21887 | if (match.value) { | 24512 | return -(wholeMonthDiff + adjust) || 0; |
21888 | hour = calendar.getHourOfDay(); | 24513 | } |
21889 | if (hour < 12) { | 24514 | |
21890 | calendar.setHourOfDay((hour + 12) % 24); | 24515 | utils_hooks__hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ'; |
24516 | utils_hooks__hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]'; | ||
24517 | |||
24518 | function toString () { | ||
24519 | return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ'); | ||
24520 | } | ||
24521 | |||
24522 | function moment_format__toISOString () { | ||
24523 | var m = this.clone().utc(); | ||
24524 | if (0 < m.year() && m.year() <= 9999) { | ||
24525 | if (isFunction(Date.prototype.toISOString)) { | ||
24526 | // native implementation is ~50x faster, use it when we can | ||
24527 | return this.toDate().toISOString(); | ||
24528 | } else { | ||
24529 | return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]'); | ||
21891 | } | 24530 | } |
21892 | } | ||
21893 | } else { | 24531 | } else { |
21894 | tmp.ampm = match.value; | 24532 | return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]'); |
21895 | } | 24533 | } |
21896 | } | 24534 | } |
21897 | break; | 24535 | |
21898 | case 'h': | 24536 | function format (inputString) { |
21899 | match = matchNumber.call(this, dateStr, startIndex, count, obeyCount); | 24537 | if (!inputString) { |
21900 | if (match) { | 24538 | inputString = this.isUtc() ? utils_hooks__hooks.defaultFormatUtc : utils_hooks__hooks.defaultFormat; |
21901 | hour = match.value %= 12; | ||
21902 | if (tmp.ampm) { | ||
21903 | hour += 12; | ||
21904 | } | 24539 | } |
21905 | calendar.setHourOfDay(hour); | 24540 | var output = formatMoment(this, inputString); |
21906 | } | 24541 | return this.localeData().postformat(output); |
21907 | break; | 24542 | } |
21908 | case 'K': | 24543 | |
21909 | match = matchNumber.call(this, dateStr, startIndex, count, obeyCount); | 24544 | function from (time, withoutSuffix) { |
21910 | if (match) { | 24545 | if (this.isValid() && |
21911 | hour = match.value; | 24546 | ((isMoment(time) && time.isValid()) || |
21912 | if (tmp.ampm) { | 24547 | local__createLocal(time).isValid())) { |
21913 | hour += 12; | 24548 | return create__createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix); |
24549 | } else { | ||
24550 | return this.localeData().invalidDate(); | ||
21914 | } | 24551 | } |
21915 | calendar.setHourOfDay(hour); | 24552 | } |
21916 | } | 24553 | |
21917 | break; | 24554 | function fromNow (withoutSuffix) { |
21918 | case 'Z': | 24555 | return this.from(local__createLocal(), withoutSuffix); |
21919 | // let sign = 1; | 24556 | } |
21920 | var zoneChar = dateStr.charAt(startIndex); | 24557 | |
21921 | if (zoneChar === '-') { | 24558 | function to (time, withoutSuffix) { |
21922 | // sign = -1; | 24559 | if (this.isValid() && |
21923 | startIndex++; | 24560 | ((isMoment(time) && time.isValid()) || |
21924 | } else if (zoneChar === '+') { | 24561 | local__createLocal(time).isValid())) { |
21925 | startIndex++; | 24562 | return create__createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix); |
21926 | } else { | 24563 | } else { |
21927 | break; | 24564 | return this.localeData().invalidDate(); |
21928 | } | ||
21929 | match = matchNumber.call(this, dateStr, startIndex, 2, true); | ||
21930 | if (match) { | ||
21931 | var zoneOffset = match.value * 60; | ||
21932 | startIndex = match.startIndex; | ||
21933 | match = matchNumber.call(this, dateStr, startIndex, 2, true); | ||
21934 | if (match) { | ||
21935 | zoneOffset += match.value; | ||
21936 | } | 24565 | } |
21937 | calendar.setTimezoneOffset(zoneOffset); | 24566 | } |
21938 | } | ||
21939 | break; | ||
21940 | default: | ||
21941 | // case 'd': | ||
21942 | // case 'H': | ||
21943 | // case 'm': | ||
21944 | // case 's': | ||
21945 | // case 'S': | ||
21946 | // case 'D': | ||
21947 | // case 'F': | ||
21948 | // case 'w': | ||
21949 | // case 'W' | ||
21950 | match = matchNumber.call(this, dateStr, startIndex, count, obeyCount); | ||
21951 | if (match) { | ||
21952 | var index = calendarIndexMap[field]; | ||
21953 | calendar.set(index, match.value); | ||
21954 | } | ||
21955 | } | ||
21956 | if (match) { | ||
21957 | startIndex = match.startIndex; | ||
21958 | } | ||
21959 | return startIndex; | ||
21960 | } | ||
21961 | 24567 | ||
21962 | mix(DateTimeFormat.prototype, { | 24568 | function toNow (withoutSuffix) { |
21963 | /* | 24569 | return this.to(local__createLocal(), withoutSuffix); |
21964 | * format a GregorianDate instance according to specified pattern | ||
21965 | * @param {GregorianCalendar} calendar GregorianDate instance | ||
21966 | * @returns {string} formatted string of GregorianDate instance | ||
21967 | */ | ||
21968 | format: function format(calendar) { | ||
21969 | if (!calendar.isGregorianCalendar) { | ||
21970 | throw new Error('calendar must be type of GregorianCalendar'); | ||
21971 | } | 24570 | } |
21972 | var i = undefined; | 24571 | |
21973 | var ret = []; | 24572 | // If passed a locale key, it will set the locale for this |
21974 | var pattern = this.pattern; | 24573 | // instance. Otherwise, it will return the locale configuration |
21975 | var len = pattern.length; | 24574 | // variables for this instance. |
21976 | for (i = 0; i < len; i++) { | 24575 | function locale (key) { |
21977 | var comp = pattern[i]; | 24576 | var newLocaleData; |
21978 | if (comp.text) { | 24577 | |
21979 | ret.push(comp.text); | 24578 | if (key === undefined) { |
21980 | } else if ('field' in comp) { | 24579 | return this._locale._abbr; |
21981 | ret.push(formatField(comp.field, comp.count, this.locale, calendar)); | 24580 | } else { |
21982 | } | 24581 | newLocaleData = locale_locales__getLocale(key); |
24582 | if (newLocaleData != null) { | ||
24583 | this._locale = newLocaleData; | ||
24584 | } | ||
24585 | return this; | ||
24586 | } | ||
21983 | } | 24587 | } |
21984 | return ret.join(''); | ||
21985 | }, | ||
21986 | 24588 | ||
21987 | /* | 24589 | var lang = deprecate( |
21988 | * parse a formatted string of GregorianDate instance according to specified pattern | 24590 | 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.', |
21989 | * @param {String} dateStr formatted string of GregorianDate | 24591 | function (key) { |
21990 | * @returns {GregorianCalendar} | 24592 | if (key === undefined) { |
21991 | */ | 24593 | return this.localeData(); |
21992 | parse: function parse(dateStr, option_) { | 24594 | } else { |
21993 | var option = option_ || {}; | 24595 | return this.locale(key); |
21994 | var calendarLocale = option.locale; | ||
21995 | var calendar = new GregorianCalendar(calendarLocale); | ||
21996 | var i = undefined; | ||
21997 | var j = undefined; | ||
21998 | var tmp = {}; | ||
21999 | var obeyCount = option.obeyCount || false; | ||
22000 | var dateStrLen = dateStr.length; | ||
22001 | var errorIndex = -1; | ||
22002 | var startIndex = 0; | ||
22003 | var oldStartIndex = 0; | ||
22004 | var pattern = this.pattern; | ||
22005 | var len = pattern.length; | ||
22006 | /* eslint no-labels: 0 no-empty-label:0 */ | ||
22007 | loopPattern: { | ||
22008 | for (i = 0; errorIndex < 0 && i < len; i++) { | ||
22009 | var comp = pattern[i]; | ||
22010 | var text = undefined; | ||
22011 | var textLen = undefined; | ||
22012 | oldStartIndex = startIndex; | ||
22013 | text = comp.text; | ||
22014 | if (text) { | ||
22015 | textLen = text.length; | ||
22016 | if (textLen + startIndex > dateStrLen) { | ||
22017 | errorIndex = startIndex; | ||
22018 | } else { | ||
22019 | for (j = 0; j < textLen; j++) { | ||
22020 | if (text.charAt(j) !== dateStr.charAt(j + startIndex)) { | ||
22021 | errorIndex = startIndex; | ||
22022 | break loopPattern; | ||
22023 | } | ||
22024 | } | 24596 | } |
22025 | startIndex += textLen; | 24597 | } |
22026 | } | 24598 | ); |
22027 | } else if ('field' in comp) { | 24599 | |
22028 | if (!option.obeyCount) { | 24600 | function localeData () { |
22029 | var nextComp = pattern[i + 1]; | 24601 | return this._locale; |
22030 | obeyCount = false; | 24602 | } |
22031 | if (nextComp) { | 24603 | |
22032 | if ('field' in nextComp) { | 24604 | function startOf (units) { |
22033 | obeyCount = true; | 24605 | units = normalizeUnits(units); |
22034 | } else { | 24606 | // the following switch intentionally omits break keywords |
22035 | var c = nextComp.text.charAt(0); | 24607 | // to utilize falling through the cases. |
22036 | if (c >= '0' && c <= '9') { | 24608 | switch (units) { |
22037 | obeyCount = true; | 24609 | case 'year': |
22038 | } | 24610 | this.month(0); |
22039 | } | 24611 | /* falls through */ |
24612 | case 'quarter': | ||
24613 | case 'month': | ||
24614 | this.date(1); | ||
24615 | /* falls through */ | ||
24616 | case 'week': | ||
24617 | case 'isoWeek': | ||
24618 | case 'day': | ||
24619 | case 'date': | ||
24620 | this.hours(0); | ||
24621 | /* falls through */ | ||
24622 | case 'hour': | ||
24623 | this.minutes(0); | ||
24624 | /* falls through */ | ||
24625 | case 'minute': | ||
24626 | this.seconds(0); | ||
24627 | /* falls through */ | ||
24628 | case 'second': | ||
24629 | this.milliseconds(0); | ||
24630 | } | ||
24631 | |||
24632 | // weeks are a special case | ||
24633 | if (units === 'week') { | ||
24634 | this.weekday(0); | ||
24635 | } | ||
24636 | if (units === 'isoWeek') { | ||
24637 | this.isoWeekday(1); | ||
24638 | } | ||
24639 | |||
24640 | // quarters are also special | ||
24641 | if (units === 'quarter') { | ||
24642 | this.month(Math.floor(this.month() / 3) * 3); | ||
24643 | } | ||
24644 | |||
24645 | return this; | ||
24646 | } | ||
24647 | |||
24648 | function endOf (units) { | ||
24649 | units = normalizeUnits(units); | ||
24650 | if (units === undefined || units === 'millisecond') { | ||
24651 | return this; | ||
24652 | } | ||
24653 | |||
24654 | // 'date' is an alias for 'day', so it should be considered as such. | ||
24655 | if (units === 'date') { | ||
24656 | units = 'day'; | ||
24657 | } | ||
24658 | |||
24659 | return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms'); | ||
24660 | } | ||
24661 | |||
24662 | function to_type__valueOf () { | ||
24663 | return this._d.valueOf() - ((this._offset || 0) * 60000); | ||
24664 | } | ||
24665 | |||
24666 | function unix () { | ||
24667 | return Math.floor(this.valueOf() / 1000); | ||
24668 | } | ||
24669 | |||
24670 | function toDate () { | ||
24671 | return new Date(this.valueOf()); | ||
24672 | } | ||
24673 | |||
24674 | function toArray () { | ||
24675 | var m = this; | ||
24676 | return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()]; | ||
24677 | } | ||
24678 | |||
24679 | function toObject () { | ||
24680 | var m = this; | ||
24681 | return { | ||
24682 | years: m.year(), | ||
24683 | months: m.month(), | ||
24684 | date: m.date(), | ||
24685 | hours: m.hours(), | ||
24686 | minutes: m.minutes(), | ||
24687 | seconds: m.seconds(), | ||
24688 | milliseconds: m.milliseconds() | ||
24689 | }; | ||
24690 | } | ||
24691 | |||
24692 | function toJSON () { | ||
24693 | // new Date(NaN).toJSON() === null | ||
24694 | return this.isValid() ? this.toISOString() : null; | ||
24695 | } | ||
24696 | |||
24697 | function moment_valid__isValid () { | ||
24698 | return valid__isValid(this); | ||
24699 | } | ||
24700 | |||
24701 | function parsingFlags () { | ||
24702 | return extend({}, getParsingFlags(this)); | ||
24703 | } | ||
24704 | |||
24705 | function invalidAt () { | ||
24706 | return getParsingFlags(this).overflow; | ||
24707 | } | ||
24708 | |||
24709 | function creationData() { | ||
24710 | return { | ||
24711 | input: this._i, | ||
24712 | format: this._f, | ||
24713 | locale: this._locale, | ||
24714 | isUTC: this._isUTC, | ||
24715 | strict: this._strict | ||
24716 | }; | ||
24717 | } | ||
24718 | |||
24719 | // FORMATTING | ||
24720 | |||
24721 | addFormatToken(0, ['gg', 2], 0, function () { | ||
24722 | return this.weekYear() % 100; | ||
24723 | }); | ||
24724 | |||
24725 | addFormatToken(0, ['GG', 2], 0, function () { | ||
24726 | return this.isoWeekYear() % 100; | ||
24727 | }); | ||
24728 | |||
24729 | function addWeekYearFormatToken (token, getter) { | ||
24730 | addFormatToken(0, [token, token.length], 0, getter); | ||
24731 | } | ||
24732 | |||
24733 | addWeekYearFormatToken('gggg', 'weekYear'); | ||
24734 | addWeekYearFormatToken('ggggg', 'weekYear'); | ||
24735 | addWeekYearFormatToken('GGGG', 'isoWeekYear'); | ||
24736 | addWeekYearFormatToken('GGGGG', 'isoWeekYear'); | ||
24737 | |||
24738 | // ALIASES | ||
24739 | |||
24740 | addUnitAlias('weekYear', 'gg'); | ||
24741 | addUnitAlias('isoWeekYear', 'GG'); | ||
24742 | |||
24743 | // PRIORITY | ||
24744 | |||
24745 | addUnitPriority('weekYear', 1); | ||
24746 | addUnitPriority('isoWeekYear', 1); | ||
24747 | |||
24748 | |||
24749 | // PARSING | ||
24750 | |||
24751 | addRegexToken('G', matchSigned); | ||
24752 | addRegexToken('g', matchSigned); | ||
24753 | addRegexToken('GG', match1to2, match2); | ||
24754 | addRegexToken('gg', match1to2, match2); | ||
24755 | addRegexToken('GGGG', match1to4, match4); | ||
24756 | addRegexToken('gggg', match1to4, match4); | ||
24757 | addRegexToken('GGGGG', match1to6, match6); | ||
24758 | addRegexToken('ggggg', match1to6, match6); | ||
24759 | |||
24760 | addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) { | ||
24761 | week[token.substr(0, 2)] = toInt(input); | ||
24762 | }); | ||
24763 | |||
24764 | addWeekParseToken(['gg', 'GG'], function (input, week, config, token) { | ||
24765 | week[token] = utils_hooks__hooks.parseTwoDigitYear(input); | ||
24766 | }); | ||
24767 | |||
24768 | // MOMENTS | ||
24769 | |||
24770 | function getSetWeekYear (input) { | ||
24771 | return getSetWeekYearHelper.call(this, | ||
24772 | input, | ||
24773 | this.week(), | ||
24774 | this.weekday(), | ||
24775 | this.localeData()._week.dow, | ||
24776 | this.localeData()._week.doy); | ||
24777 | } | ||
24778 | |||
24779 | function getSetISOWeekYear (input) { | ||
24780 | return getSetWeekYearHelper.call(this, | ||
24781 | input, this.isoWeek(), this.isoWeekday(), 1, 4); | ||
24782 | } | ||
24783 | |||
24784 | function getISOWeeksInYear () { | ||
24785 | return weeksInYear(this.year(), 1, 4); | ||
24786 | } | ||
24787 | |||
24788 | function getWeeksInYear () { | ||
24789 | var weekInfo = this.localeData()._week; | ||
24790 | return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy); | ||
24791 | } | ||
24792 | |||
24793 | function getSetWeekYearHelper(input, week, weekday, dow, doy) { | ||
24794 | var weeksTarget; | ||
24795 | if (input == null) { | ||
24796 | return weekOfYear(this, dow, doy).year; | ||
24797 | } else { | ||
24798 | weeksTarget = weeksInYear(input, dow, doy); | ||
24799 | if (week > weeksTarget) { | ||
24800 | week = weeksTarget; | ||
22040 | } | 24801 | } |
22041 | } | 24802 | return setWeekAll.call(this, input, week, weekday, dow, doy); |
22042 | startIndex = parseField.call(this, calendar, dateStr, startIndex, comp.field, comp.count, obeyCount, tmp); | ||
22043 | if (startIndex === oldStartIndex) { | ||
22044 | errorIndex = startIndex; | ||
22045 | } | ||
22046 | } | 24803 | } |
22047 | } | ||
22048 | } | 24804 | } |
22049 | 24805 | ||
22050 | if (errorIndex >= 0) { | 24806 | function setWeekAll(weekYear, week, weekday, dow, doy) { |
22051 | warning(false, 'error when parsing date: ' + dateStr + ', position: ' + dateStr.slice(0, errorIndex) + '^'); | 24807 | var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy), |
22052 | return undefined; | 24808 | date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear); |
24809 | |||
24810 | this.year(date.getUTCFullYear()); | ||
24811 | this.month(date.getUTCMonth()); | ||
24812 | this.date(date.getUTCDate()); | ||
24813 | return this; | ||
22053 | } | 24814 | } |
22054 | return calendar; | ||
22055 | } | ||
22056 | }); | ||
22057 | 24815 | ||
22058 | mix(DateTimeFormat, { | 24816 | // FORMATTING |
22059 | Style: DateTimeStyle, | ||
22060 | 24817 | ||
22061 | /* | 24818 | addFormatToken('Q', 0, 'Qo', 'quarter'); |
22062 | * get a formatter instance of short style pattern. | ||
22063 | * en-us: M/d/yy h:mm a | ||
22064 | * zh-cn: yy-M-d ah:mm | ||
22065 | * @param {Object} locale locale object | ||
22066 | * @returns {GregorianCalendar} | ||
22067 | * @static | ||
22068 | */ | ||
22069 | getInstance: function getInstance(locale) { | ||
22070 | return this.getDateTimeInstance(DateTimeStyle.SHORT, DateTimeStyle.SHORT, locale); | ||
22071 | }, | ||
22072 | 24819 | ||
22073 | /* | 24820 | // ALIASES |
22074 | * get a formatter instance of specified date style. | ||
22075 | * @param {Date.Formatter.Style} dateStyle date format style | ||
22076 | * @param {Object} locale | ||
22077 | * @returns {GregorianCalendar} | ||
22078 | * @static | ||
22079 | */ | ||
22080 | getDateInstance: function getDateInstance(dateStyle, locale) { | ||
22081 | return this.getDateTimeInstance(dateStyle, undefined, locale); | ||
22082 | }, | ||
22083 | 24821 | ||
22084 | /* | 24822 | addUnitAlias('quarter', 'Q'); |
22085 | * get a formatter instance of specified date style and time style. | 24823 | |
22086 | * @param {Date.Formatter.Style} dateStyle date format style | 24824 | // PRIORITY |
22087 | * @param {Date.Formatter.Style} timeStyle time format style | 24825 | |
22088 | * @param {Object} locale | 24826 | addUnitPriority('quarter', 7); |
22089 | * @returns {GregorianCalendar} | 24827 | |
22090 | * @static | 24828 | // PARSING |
22091 | */ | 24829 | |
22092 | getDateTimeInstance: function getDateTimeInstance(dateStyle, timeStyle, locale_) { | 24830 | addRegexToken('Q', match1); |
22093 | var locale = locale_ || enUsLocale; | 24831 | addParseToken('Q', function (input, array) { |
22094 | var datePattern = ''; | 24832 | array[MONTH] = (toInt(input) - 1) * 3; |
22095 | if (dateStyle !== undefined) { | 24833 | }); |
22096 | datePattern = locale.datePatterns[dateStyle]; | 24834 | |
22097 | } | 24835 | // MOMENTS |
22098 | var timePattern = ''; | 24836 | |
22099 | if (timeStyle !== undefined) { | 24837 | function getSetQuarter (input) { |
22100 | timePattern = locale.timePatterns[timeStyle]; | 24838 | return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3); |
22101 | } | ||
22102 | var pattern = datePattern; | ||
22103 | if (timePattern) { | ||
22104 | if (datePattern) { | ||
22105 | pattern = substitute(locale.dateTimePattern, { | ||
22106 | date: datePattern, | ||
22107 | time: timePattern | ||
22108 | }); | ||
22109 | } else { | ||
22110 | pattern = timePattern; | ||
22111 | } | ||
22112 | } | 24839 | } |
22113 | return new DateTimeFormat(pattern, locale); | ||
22114 | }, | ||
22115 | 24840 | ||
22116 | /* | 24841 | // FORMATTING |
22117 | * get a formatter instance of specified time style. | ||
22118 | * @param {Date.Formatter.Style} timeStyle time format style | ||
22119 | * @param {Object} locale | ||
22120 | * @returns {GregorianCalendar} | ||
22121 | * @static | ||
22122 | */ | ||
22123 | getTimeInstance: function getTimeInstance(timeStyle, locale) { | ||
22124 | return this.getDateTimeInstance(undefined, timeStyle, locale); | ||
22125 | } | ||
22126 | }); | ||
22127 | 24842 | ||
22128 | module.exports = DateTimeFormat; | 24843 | addFormatToken('D', ['DD', 2], 'Do', 'date'); |
22129 | 24844 | ||
22130 | DateTimeFormat.version = '@VERSION@'; | 24845 | // ALIASES |
22131 | 24846 | ||
22132 | // gc_format@163.com | 24847 | addUnitAlias('date', 'D'); |
22133 | |||
22134 | /***/ }, | ||
22135 | /* 166 */ | ||
22136 | /***/ function(module, exports) { | ||
22137 | |||
22138 | 'use strict'; | ||
22139 | 24848 | ||
22140 | module.exports = { | 24849 | // PRIOROITY |
22141 | eras: ['BC', 'AD'], | 24850 | addUnitPriority('date', 9); |
22142 | months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], | ||
22143 | shortMonths: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], | ||
22144 | weekdays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], | ||
22145 | shortWeekdays: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], | ||
22146 | veryShortWeekdays: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'], | ||
22147 | ampms: ['AM', 'PM'], | ||
22148 | datePatterns: ['EEEE, MMMM d, yyyy', 'MMMM d, yyyy', 'MMM d, yyyy', 'M/d/yy'], | ||
22149 | timePatterns: ['h:mm:ss a \'GMT\'Z', 'h:mm:ss a', 'h:mm:ss a', 'h:mm a'], | ||
22150 | dateTimePattern: '{date} {time}' | ||
22151 | }; | ||
22152 | |||
22153 | /***/ }, | ||
22154 | /* 167 */ | ||
22155 | /***/ function(module, exports, __webpack_require__) { | ||
22156 | |||
22157 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
22158 | * Copyright 2014-2015, Facebook, Inc. | ||
22159 | * All rights reserved. | ||
22160 | * | ||
22161 | * This source code is licensed under the BSD-style license found in the | ||
22162 | * LICENSE file in the root directory of this source tree. An additional grant | ||
22163 | * of patent rights can be found in the PATENTS file in the same directory. | ||
22164 | */ | ||
22165 | 24851 | ||
22166 | 'use strict'; | 24852 | // PARSING |
22167 | 24853 | ||
22168 | /** | 24854 | addRegexToken('D', match1to2); |
22169 | * Similar to invariant but only logs a warning if the condition is not met. | 24855 | addRegexToken('DD', match1to2, match2); |
22170 | * This can be used to log issues in development environments in critical | 24856 | addRegexToken('Do', function (isStrict, locale) { |
22171 | * paths. Removing the logging code for production environments will keep the | 24857 | return isStrict ? locale._ordinalParse : locale._ordinalParseLenient; |
22172 | * same logic and follow the same code paths. | 24858 | }); |
22173 | */ | ||
22174 | 24859 | ||
22175 | var warning = function() {}; | 24860 | addParseToken(['D', 'DD'], DATE); |
24861 | addParseToken('Do', function (input, array) { | ||
24862 | array[DATE] = toInt(input.match(match1to2)[0], 10); | ||
24863 | }); | ||
22176 | 24864 | ||
22177 | if (process.env.NODE_ENV !== 'production') { | 24865 | // MOMENTS |
22178 | warning = function(condition, format, args) { | 24866 | |
22179 | var len = arguments.length; | 24867 | var getSetDayOfMonth = makeGetSet('Date', true); |
22180 | args = new Array(len > 2 ? len - 2 : 0); | 24868 | |
22181 | for (var key = 2; key < len; key++) { | 24869 | // FORMATTING |
22182 | args[key - 2] = arguments[key]; | 24870 | |
24871 | addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear'); | ||
24872 | |||
24873 | // ALIASES | ||
24874 | |||
24875 | addUnitAlias('dayOfYear', 'DDD'); | ||
24876 | |||
24877 | // PRIORITY | ||
24878 | addUnitPriority('dayOfYear', 4); | ||
24879 | |||
24880 | // PARSING | ||
24881 | |||
24882 | addRegexToken('DDD', match1to3); | ||
24883 | addRegexToken('DDDD', match3); | ||
24884 | addParseToken(['DDD', 'DDDD'], function (input, array, config) { | ||
24885 | config._dayOfYear = toInt(input); | ||
24886 | }); | ||
24887 | |||
24888 | // HELPERS | ||
24889 | |||
24890 | // MOMENTS | ||
24891 | |||
24892 | function getSetDayOfYear (input) { | ||
24893 | var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1; | ||
24894 | return input == null ? dayOfYear : this.add((input - dayOfYear), 'd'); | ||
22183 | } | 24895 | } |
22184 | if (format === undefined) { | 24896 | |
22185 | throw new Error( | 24897 | // FORMATTING |
22186 | '`warning(condition, format, ...args)` requires a warning ' + | 24898 | |
22187 | 'message argument' | 24899 | addFormatToken('m', ['mm', 2], 0, 'minute'); |
22188 | ); | 24900 | |
24901 | // ALIASES | ||
24902 | |||
24903 | addUnitAlias('minute', 'm'); | ||
24904 | |||
24905 | // PRIORITY | ||
24906 | |||
24907 | addUnitPriority('minute', 14); | ||
24908 | |||
24909 | // PARSING | ||
24910 | |||
24911 | addRegexToken('m', match1to2); | ||
24912 | addRegexToken('mm', match1to2, match2); | ||
24913 | addParseToken(['m', 'mm'], MINUTE); | ||
24914 | |||
24915 | // MOMENTS | ||
24916 | |||
24917 | var getSetMinute = makeGetSet('Minutes', false); | ||
24918 | |||
24919 | // FORMATTING | ||
24920 | |||
24921 | addFormatToken('s', ['ss', 2], 0, 'second'); | ||
24922 | |||
24923 | // ALIASES | ||
24924 | |||
24925 | addUnitAlias('second', 's'); | ||
24926 | |||
24927 | // PRIORITY | ||
24928 | |||
24929 | addUnitPriority('second', 15); | ||
24930 | |||
24931 | // PARSING | ||
24932 | |||
24933 | addRegexToken('s', match1to2); | ||
24934 | addRegexToken('ss', match1to2, match2); | ||
24935 | addParseToken(['s', 'ss'], SECOND); | ||
24936 | |||
24937 | // MOMENTS | ||
24938 | |||
24939 | var getSetSecond = makeGetSet('Seconds', false); | ||
24940 | |||
24941 | // FORMATTING | ||
24942 | |||
24943 | addFormatToken('S', 0, 0, function () { | ||
24944 | return ~~(this.millisecond() / 100); | ||
24945 | }); | ||
24946 | |||
24947 | addFormatToken(0, ['SS', 2], 0, function () { | ||
24948 | return ~~(this.millisecond() / 10); | ||
24949 | }); | ||
24950 | |||
24951 | addFormatToken(0, ['SSS', 3], 0, 'millisecond'); | ||
24952 | addFormatToken(0, ['SSSS', 4], 0, function () { | ||
24953 | return this.millisecond() * 10; | ||
24954 | }); | ||
24955 | addFormatToken(0, ['SSSSS', 5], 0, function () { | ||
24956 | return this.millisecond() * 100; | ||
24957 | }); | ||
24958 | addFormatToken(0, ['SSSSSS', 6], 0, function () { | ||
24959 | return this.millisecond() * 1000; | ||
24960 | }); | ||
24961 | addFormatToken(0, ['SSSSSSS', 7], 0, function () { | ||
24962 | return this.millisecond() * 10000; | ||
24963 | }); | ||
24964 | addFormatToken(0, ['SSSSSSSS', 8], 0, function () { | ||
24965 | return this.millisecond() * 100000; | ||
24966 | }); | ||
24967 | addFormatToken(0, ['SSSSSSSSS', 9], 0, function () { | ||
24968 | return this.millisecond() * 1000000; | ||
24969 | }); | ||
24970 | |||
24971 | |||
24972 | // ALIASES | ||
24973 | |||
24974 | addUnitAlias('millisecond', 'ms'); | ||
24975 | |||
24976 | // PRIORITY | ||
24977 | |||
24978 | addUnitPriority('millisecond', 16); | ||
24979 | |||
24980 | // PARSING | ||
24981 | |||
24982 | addRegexToken('S', match1to3, match1); | ||
24983 | addRegexToken('SS', match1to3, match2); | ||
24984 | addRegexToken('SSS', match1to3, match3); | ||
24985 | |||
24986 | var token; | ||
24987 | for (token = 'SSSS'; token.length <= 9; token += 'S') { | ||
24988 | addRegexToken(token, matchUnsigned); | ||
22189 | } | 24989 | } |
22190 | 24990 | ||
22191 | if (format.length < 10 || (/^[s\W]*$/).test(format)) { | 24991 | function parseMs(input, array) { |
22192 | throw new Error( | 24992 | array[MILLISECOND] = toInt(('0.' + input) * 1000); |
22193 | 'The warning format should be able to uniquely identify this ' + | ||
22194 | 'warning. Please, use a more descriptive format than: ' + format | ||
22195 | ); | ||
22196 | } | 24993 | } |
22197 | 24994 | ||
22198 | if (!condition) { | 24995 | for (token = 'S'; token.length <= 9; token += 'S') { |
22199 | var argIndex = 0; | 24996 | addParseToken(token, parseMs); |
22200 | var message = 'Warning: ' + | ||
22201 | format.replace(/%s/g, function() { | ||
22202 | return args[argIndex++]; | ||
22203 | }); | ||
22204 | if (typeof console !== 'undefined') { | ||
22205 | console.error(message); | ||
22206 | } | ||
22207 | try { | ||
22208 | // This error was thrown as a convenience so that you can use this stack | ||
22209 | // to find the callsite that caused this warning to fire. | ||
22210 | throw new Error(message); | ||
22211 | } catch(x) {} | ||
22212 | } | 24997 | } |
22213 | }; | 24998 | // MOMENTS |
22214 | } | ||
22215 | 24999 | ||
22216 | module.exports = warning; | 25000 | var getSetMillisecond = makeGetSet('Milliseconds', false); |
25001 | |||
25002 | // FORMATTING | ||
25003 | |||
25004 | addFormatToken('z', 0, 0, 'zoneAbbr'); | ||
25005 | addFormatToken('zz', 0, 0, 'zoneName'); | ||
25006 | |||
25007 | // MOMENTS | ||
25008 | |||
25009 | function getZoneAbbr () { | ||
25010 | return this._isUTC ? 'UTC' : ''; | ||
25011 | } | ||
25012 | |||
25013 | function getZoneName () { | ||
25014 | return this._isUTC ? 'Coordinated Universal Time' : ''; | ||
25015 | } | ||
25016 | |||
25017 | var momentPrototype__proto = Moment.prototype; | ||
25018 | |||
25019 | momentPrototype__proto.add = add_subtract__add; | ||
25020 | momentPrototype__proto.calendar = moment_calendar__calendar; | ||
25021 | momentPrototype__proto.clone = clone; | ||
25022 | momentPrototype__proto.diff = diff; | ||
25023 | momentPrototype__proto.endOf = endOf; | ||
25024 | momentPrototype__proto.format = format; | ||
25025 | momentPrototype__proto.from = from; | ||
25026 | momentPrototype__proto.fromNow = fromNow; | ||
25027 | momentPrototype__proto.to = to; | ||
25028 | momentPrototype__proto.toNow = toNow; | ||
25029 | momentPrototype__proto.get = stringGet; | ||
25030 | momentPrototype__proto.invalidAt = invalidAt; | ||
25031 | momentPrototype__proto.isAfter = isAfter; | ||
25032 | momentPrototype__proto.isBefore = isBefore; | ||
25033 | momentPrototype__proto.isBetween = isBetween; | ||
25034 | momentPrototype__proto.isSame = isSame; | ||
25035 | momentPrototype__proto.isSameOrAfter = isSameOrAfter; | ||
25036 | momentPrototype__proto.isSameOrBefore = isSameOrBefore; | ||
25037 | momentPrototype__proto.isValid = moment_valid__isValid; | ||
25038 | momentPrototype__proto.lang = lang; | ||
25039 | momentPrototype__proto.locale = locale; | ||
25040 | momentPrototype__proto.localeData = localeData; | ||
25041 | momentPrototype__proto.max = prototypeMax; | ||
25042 | momentPrototype__proto.min = prototypeMin; | ||
25043 | momentPrototype__proto.parsingFlags = parsingFlags; | ||
25044 | momentPrototype__proto.set = stringSet; | ||
25045 | momentPrototype__proto.startOf = startOf; | ||
25046 | momentPrototype__proto.subtract = add_subtract__subtract; | ||
25047 | momentPrototype__proto.toArray = toArray; | ||
25048 | momentPrototype__proto.toObject = toObject; | ||
25049 | momentPrototype__proto.toDate = toDate; | ||
25050 | momentPrototype__proto.toISOString = moment_format__toISOString; | ||
25051 | momentPrototype__proto.toJSON = toJSON; | ||
25052 | momentPrototype__proto.toString = toString; | ||
25053 | momentPrototype__proto.unix = unix; | ||
25054 | momentPrototype__proto.valueOf = to_type__valueOf; | ||
25055 | momentPrototype__proto.creationData = creationData; | ||
25056 | |||
25057 | // Year | ||
25058 | momentPrototype__proto.year = getSetYear; | ||
25059 | momentPrototype__proto.isLeapYear = getIsLeapYear; | ||
25060 | |||
25061 | // Week Year | ||
25062 | momentPrototype__proto.weekYear = getSetWeekYear; | ||
25063 | momentPrototype__proto.isoWeekYear = getSetISOWeekYear; | ||
25064 | |||
25065 | // Quarter | ||
25066 | momentPrototype__proto.quarter = momentPrototype__proto.quarters = getSetQuarter; | ||
25067 | |||
25068 | // Month | ||
25069 | momentPrototype__proto.month = getSetMonth; | ||
25070 | momentPrototype__proto.daysInMonth = getDaysInMonth; | ||
25071 | |||
25072 | // Week | ||
25073 | momentPrototype__proto.week = momentPrototype__proto.weeks = getSetWeek; | ||
25074 | momentPrototype__proto.isoWeek = momentPrototype__proto.isoWeeks = getSetISOWeek; | ||
25075 | momentPrototype__proto.weeksInYear = getWeeksInYear; | ||
25076 | momentPrototype__proto.isoWeeksInYear = getISOWeeksInYear; | ||
25077 | |||
25078 | // Day | ||
25079 | momentPrototype__proto.date = getSetDayOfMonth; | ||
25080 | momentPrototype__proto.day = momentPrototype__proto.days = getSetDayOfWeek; | ||
25081 | momentPrototype__proto.weekday = getSetLocaleDayOfWeek; | ||
25082 | momentPrototype__proto.isoWeekday = getSetISODayOfWeek; | ||
25083 | momentPrototype__proto.dayOfYear = getSetDayOfYear; | ||
25084 | |||
25085 | // Hour | ||
25086 | momentPrototype__proto.hour = momentPrototype__proto.hours = getSetHour; | ||
25087 | |||
25088 | // Minute | ||
25089 | momentPrototype__proto.minute = momentPrototype__proto.minutes = getSetMinute; | ||
25090 | |||
25091 | // Second | ||
25092 | momentPrototype__proto.second = momentPrototype__proto.seconds = getSetSecond; | ||
25093 | |||
25094 | // Millisecond | ||
25095 | momentPrototype__proto.millisecond = momentPrototype__proto.milliseconds = getSetMillisecond; | ||
25096 | |||
25097 | // Offset | ||
25098 | momentPrototype__proto.utcOffset = getSetOffset; | ||
25099 | momentPrototype__proto.utc = setOffsetToUTC; | ||
25100 | momentPrototype__proto.local = setOffsetToLocal; | ||
25101 | momentPrototype__proto.parseZone = setOffsetToParsedOffset; | ||
25102 | momentPrototype__proto.hasAlignedHourOffset = hasAlignedHourOffset; | ||
25103 | momentPrototype__proto.isDST = isDaylightSavingTime; | ||
25104 | momentPrototype__proto.isLocal = isLocal; | ||
25105 | momentPrototype__proto.isUtcOffset = isUtcOffset; | ||
25106 | momentPrototype__proto.isUtc = isUtc; | ||
25107 | momentPrototype__proto.isUTC = isUtc; | ||
25108 | |||
25109 | // Timezone | ||
25110 | momentPrototype__proto.zoneAbbr = getZoneAbbr; | ||
25111 | momentPrototype__proto.zoneName = getZoneName; | ||
25112 | |||
25113 | // Deprecations | ||
25114 | momentPrototype__proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth); | ||
25115 | momentPrototype__proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth); | ||
25116 | momentPrototype__proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear); | ||
25117 | momentPrototype__proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', getSetZone); | ||
25118 | momentPrototype__proto.isDSTShifted = deprecate('isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', isDaylightSavingTimeShifted); | ||
25119 | |||
25120 | var momentPrototype = momentPrototype__proto; | ||
25121 | |||
25122 | function moment__createUnix (input) { | ||
25123 | return local__createLocal(input * 1000); | ||
25124 | } | ||
25125 | |||
25126 | function moment__createInZone () { | ||
25127 | return local__createLocal.apply(null, arguments).parseZone(); | ||
25128 | } | ||
25129 | |||
25130 | function preParsePostFormat (string) { | ||
25131 | return string; | ||
25132 | } | ||
25133 | |||
25134 | var prototype__proto = Locale.prototype; | ||
25135 | |||
25136 | prototype__proto.calendar = locale_calendar__calendar; | ||
25137 | prototype__proto.longDateFormat = longDateFormat; | ||
25138 | prototype__proto.invalidDate = invalidDate; | ||
25139 | prototype__proto.ordinal = ordinal; | ||
25140 | prototype__proto.preparse = preParsePostFormat; | ||
25141 | prototype__proto.postformat = preParsePostFormat; | ||
25142 | prototype__proto.relativeTime = relative__relativeTime; | ||
25143 | prototype__proto.pastFuture = pastFuture; | ||
25144 | prototype__proto.set = locale_set__set; | ||
25145 | |||
25146 | // Month | ||
25147 | prototype__proto.months = localeMonths; | ||
25148 | prototype__proto.monthsShort = localeMonthsShort; | ||
25149 | prototype__proto.monthsParse = localeMonthsParse; | ||
25150 | prototype__proto.monthsRegex = monthsRegex; | ||
25151 | prototype__proto.monthsShortRegex = monthsShortRegex; | ||
25152 | |||
25153 | // Week | ||
25154 | prototype__proto.week = localeWeek; | ||
25155 | prototype__proto.firstDayOfYear = localeFirstDayOfYear; | ||
25156 | prototype__proto.firstDayOfWeek = localeFirstDayOfWeek; | ||
25157 | |||
25158 | // Day of Week | ||
25159 | prototype__proto.weekdays = localeWeekdays; | ||
25160 | prototype__proto.weekdaysMin = localeWeekdaysMin; | ||
25161 | prototype__proto.weekdaysShort = localeWeekdaysShort; | ||
25162 | prototype__proto.weekdaysParse = localeWeekdaysParse; | ||
25163 | |||
25164 | prototype__proto.weekdaysRegex = weekdaysRegex; | ||
25165 | prototype__proto.weekdaysShortRegex = weekdaysShortRegex; | ||
25166 | prototype__proto.weekdaysMinRegex = weekdaysMinRegex; | ||
25167 | |||
25168 | // Hours | ||
25169 | prototype__proto.isPM = localeIsPM; | ||
25170 | prototype__proto.meridiem = localeMeridiem; | ||
25171 | |||
25172 | function lists__get (format, index, field, setter) { | ||
25173 | var locale = locale_locales__getLocale(); | ||
25174 | var utc = create_utc__createUTC().set(setter, index); | ||
25175 | return locale[field](utc, format); | ||
25176 | } | ||
25177 | |||
25178 | function listMonthsImpl (format, index, field) { | ||
25179 | if (typeof format === 'number') { | ||
25180 | index = format; | ||
25181 | format = undefined; | ||
25182 | } | ||
25183 | |||
25184 | format = format || ''; | ||
25185 | |||
25186 | if (index != null) { | ||
25187 | return lists__get(format, index, field, 'month'); | ||
25188 | } | ||
25189 | |||
25190 | var i; | ||
25191 | var out = []; | ||
25192 | for (i = 0; i < 12; i++) { | ||
25193 | out[i] = lists__get(format, i, field, 'month'); | ||
25194 | } | ||
25195 | return out; | ||
25196 | } | ||
25197 | |||
25198 | // () | ||
25199 | // (5) | ||
25200 | // (fmt, 5) | ||
25201 | // (fmt) | ||
25202 | // (true) | ||
25203 | // (true, 5) | ||
25204 | // (true, fmt, 5) | ||
25205 | // (true, fmt) | ||
25206 | function listWeekdaysImpl (localeSorted, format, index, field) { | ||
25207 | if (typeof localeSorted === 'boolean') { | ||
25208 | if (typeof format === 'number') { | ||
25209 | index = format; | ||
25210 | format = undefined; | ||
25211 | } | ||
25212 | |||
25213 | format = format || ''; | ||
25214 | } else { | ||
25215 | format = localeSorted; | ||
25216 | index = format; | ||
25217 | localeSorted = false; | ||
25218 | |||
25219 | if (typeof format === 'number') { | ||
25220 | index = format; | ||
25221 | format = undefined; | ||
25222 | } | ||
25223 | |||
25224 | format = format || ''; | ||
25225 | } | ||
25226 | |||
25227 | var locale = locale_locales__getLocale(), | ||
25228 | shift = localeSorted ? locale._week.dow : 0; | ||
25229 | |||
25230 | if (index != null) { | ||
25231 | return lists__get(format, (index + shift) % 7, field, 'day'); | ||
25232 | } | ||
25233 | |||
25234 | var i; | ||
25235 | var out = []; | ||
25236 | for (i = 0; i < 7; i++) { | ||
25237 | out[i] = lists__get(format, (i + shift) % 7, field, 'day'); | ||
25238 | } | ||
25239 | return out; | ||
25240 | } | ||
25241 | |||
25242 | function lists__listMonths (format, index) { | ||
25243 | return listMonthsImpl(format, index, 'months'); | ||
25244 | } | ||
25245 | |||
25246 | function lists__listMonthsShort (format, index) { | ||
25247 | return listMonthsImpl(format, index, 'monthsShort'); | ||
25248 | } | ||
22217 | 25249 | ||
22218 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | 25250 | function lists__listWeekdays (localeSorted, format, index) { |
25251 | return listWeekdaysImpl(localeSorted, format, index, 'weekdays'); | ||
25252 | } | ||
25253 | |||
25254 | function lists__listWeekdaysShort (localeSorted, format, index) { | ||
25255 | return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort'); | ||
25256 | } | ||
25257 | |||
25258 | function lists__listWeekdaysMin (localeSorted, format, index) { | ||
25259 | return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin'); | ||
25260 | } | ||
25261 | |||
25262 | locale_locales__getSetGlobalLocale('en', { | ||
25263 | ordinalParse: /\d{1,2}(th|st|nd|rd)/, | ||
25264 | ordinal : function (number) { | ||
25265 | var b = number % 10, | ||
25266 | output = (toInt(number % 100 / 10) === 1) ? 'th' : | ||
25267 | (b === 1) ? 'st' : | ||
25268 | (b === 2) ? 'nd' : | ||
25269 | (b === 3) ? 'rd' : 'th'; | ||
25270 | return number + output; | ||
25271 | } | ||
25272 | }); | ||
25273 | |||
25274 | // Side effect imports | ||
25275 | utils_hooks__hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', locale_locales__getSetGlobalLocale); | ||
25276 | utils_hooks__hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', locale_locales__getLocale); | ||
25277 | |||
25278 | var mathAbs = Math.abs; | ||
25279 | |||
25280 | function duration_abs__abs () { | ||
25281 | var data = this._data; | ||
25282 | |||
25283 | this._milliseconds = mathAbs(this._milliseconds); | ||
25284 | this._days = mathAbs(this._days); | ||
25285 | this._months = mathAbs(this._months); | ||
25286 | |||
25287 | data.milliseconds = mathAbs(data.milliseconds); | ||
25288 | data.seconds = mathAbs(data.seconds); | ||
25289 | data.minutes = mathAbs(data.minutes); | ||
25290 | data.hours = mathAbs(data.hours); | ||
25291 | data.months = mathAbs(data.months); | ||
25292 | data.years = mathAbs(data.years); | ||
25293 | |||
25294 | return this; | ||
25295 | } | ||
25296 | |||
25297 | function duration_add_subtract__addSubtract (duration, input, value, direction) { | ||
25298 | var other = create__createDuration(input, value); | ||
25299 | |||
25300 | duration._milliseconds += direction * other._milliseconds; | ||
25301 | duration._days += direction * other._days; | ||
25302 | duration._months += direction * other._months; | ||
25303 | |||
25304 | return duration._bubble(); | ||
25305 | } | ||
25306 | |||
25307 | // supports only 2.0-style add(1, 's') or add(duration) | ||
25308 | function duration_add_subtract__add (input, value) { | ||
25309 | return duration_add_subtract__addSubtract(this, input, value, 1); | ||
25310 | } | ||
25311 | |||
25312 | // supports only 2.0-style subtract(1, 's') or subtract(duration) | ||
25313 | function duration_add_subtract__subtract (input, value) { | ||
25314 | return duration_add_subtract__addSubtract(this, input, value, -1); | ||
25315 | } | ||
25316 | |||
25317 | function absCeil (number) { | ||
25318 | if (number < 0) { | ||
25319 | return Math.floor(number); | ||
25320 | } else { | ||
25321 | return Math.ceil(number); | ||
25322 | } | ||
25323 | } | ||
25324 | |||
25325 | function bubble () { | ||
25326 | var milliseconds = this._milliseconds; | ||
25327 | var days = this._days; | ||
25328 | var months = this._months; | ||
25329 | var data = this._data; | ||
25330 | var seconds, minutes, hours, years, monthsFromDays; | ||
25331 | |||
25332 | // if we have a mix of positive and negative values, bubble down first | ||
25333 | // check: https://github.com/moment/moment/issues/2166 | ||
25334 | if (!((milliseconds >= 0 && days >= 0 && months >= 0) || | ||
25335 | (milliseconds <= 0 && days <= 0 && months <= 0))) { | ||
25336 | milliseconds += absCeil(monthsToDays(months) + days) * 864e5; | ||
25337 | days = 0; | ||
25338 | months = 0; | ||
25339 | } | ||
25340 | |||
25341 | // The following code bubbles up values, see the tests for | ||
25342 | // examples of what that means. | ||
25343 | data.milliseconds = milliseconds % 1000; | ||
25344 | |||
25345 | seconds = absFloor(milliseconds / 1000); | ||
25346 | data.seconds = seconds % 60; | ||
25347 | |||
25348 | minutes = absFloor(seconds / 60); | ||
25349 | data.minutes = minutes % 60; | ||
25350 | |||
25351 | hours = absFloor(minutes / 60); | ||
25352 | data.hours = hours % 24; | ||
25353 | |||
25354 | days += absFloor(hours / 24); | ||
25355 | |||
25356 | // convert days to months | ||
25357 | monthsFromDays = absFloor(daysToMonths(days)); | ||
25358 | months += monthsFromDays; | ||
25359 | days -= absCeil(monthsToDays(monthsFromDays)); | ||
25360 | |||
25361 | // 12 months -> 1 year | ||
25362 | years = absFloor(months / 12); | ||
25363 | months %= 12; | ||
25364 | |||
25365 | data.days = days; | ||
25366 | data.months = months; | ||
25367 | data.years = years; | ||
25368 | |||
25369 | return this; | ||
25370 | } | ||
25371 | |||
25372 | function daysToMonths (days) { | ||
25373 | // 400 years have 146097 days (taking into account leap year rules) | ||
25374 | // 400 years have 12 months === 4800 | ||
25375 | return days * 4800 / 146097; | ||
25376 | } | ||
25377 | |||
25378 | function monthsToDays (months) { | ||
25379 | // the reverse of daysToMonths | ||
25380 | return months * 146097 / 4800; | ||
25381 | } | ||
25382 | |||
25383 | function as (units) { | ||
25384 | var days; | ||
25385 | var months; | ||
25386 | var milliseconds = this._milliseconds; | ||
25387 | |||
25388 | units = normalizeUnits(units); | ||
25389 | |||
25390 | if (units === 'month' || units === 'year') { | ||
25391 | days = this._days + milliseconds / 864e5; | ||
25392 | months = this._months + daysToMonths(days); | ||
25393 | return units === 'month' ? months : months / 12; | ||
25394 | } else { | ||
25395 | // handle milliseconds separately because of floating point math errors (issue #1867) | ||
25396 | days = this._days + Math.round(monthsToDays(this._months)); | ||
25397 | switch (units) { | ||
25398 | case 'week' : return days / 7 + milliseconds / 6048e5; | ||
25399 | case 'day' : return days + milliseconds / 864e5; | ||
25400 | case 'hour' : return days * 24 + milliseconds / 36e5; | ||
25401 | case 'minute' : return days * 1440 + milliseconds / 6e4; | ||
25402 | case 'second' : return days * 86400 + milliseconds / 1000; | ||
25403 | // Math.floor prevents floating point math errors here | ||
25404 | case 'millisecond': return Math.floor(days * 864e5) + milliseconds; | ||
25405 | default: throw new Error('Unknown unit ' + units); | ||
25406 | } | ||
25407 | } | ||
25408 | } | ||
25409 | |||
25410 | // TODO: Use this.as('ms')? | ||
25411 | function duration_as__valueOf () { | ||
25412 | return ( | ||
25413 | this._milliseconds + | ||
25414 | this._days * 864e5 + | ||
25415 | (this._months % 12) * 2592e6 + | ||
25416 | toInt(this._months / 12) * 31536e6 | ||
25417 | ); | ||
25418 | } | ||
25419 | |||
25420 | function makeAs (alias) { | ||
25421 | return function () { | ||
25422 | return this.as(alias); | ||
25423 | }; | ||
25424 | } | ||
25425 | |||
25426 | var asMilliseconds = makeAs('ms'); | ||
25427 | var asSeconds = makeAs('s'); | ||
25428 | var asMinutes = makeAs('m'); | ||
25429 | var asHours = makeAs('h'); | ||
25430 | var asDays = makeAs('d'); | ||
25431 | var asWeeks = makeAs('w'); | ||
25432 | var asMonths = makeAs('M'); | ||
25433 | var asYears = makeAs('y'); | ||
25434 | |||
25435 | function duration_get__get (units) { | ||
25436 | units = normalizeUnits(units); | ||
25437 | return this[units + 's'](); | ||
25438 | } | ||
25439 | |||
25440 | function makeGetter(name) { | ||
25441 | return function () { | ||
25442 | return this._data[name]; | ||
25443 | }; | ||
25444 | } | ||
25445 | |||
25446 | var milliseconds = makeGetter('milliseconds'); | ||
25447 | var seconds = makeGetter('seconds'); | ||
25448 | var minutes = makeGetter('minutes'); | ||
25449 | var hours = makeGetter('hours'); | ||
25450 | var days = makeGetter('days'); | ||
25451 | var months = makeGetter('months'); | ||
25452 | var years = makeGetter('years'); | ||
25453 | |||
25454 | function weeks () { | ||
25455 | return absFloor(this.days() / 7); | ||
25456 | } | ||
25457 | |||
25458 | var round = Math.round; | ||
25459 | var thresholds = { | ||
25460 | s: 45, // seconds to minute | ||
25461 | m: 45, // minutes to hour | ||
25462 | h: 22, // hours to day | ||
25463 | d: 26, // days to month | ||
25464 | M: 11 // months to year | ||
25465 | }; | ||
25466 | |||
25467 | // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize | ||
25468 | function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) { | ||
25469 | return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture); | ||
25470 | } | ||
25471 | |||
25472 | function duration_humanize__relativeTime (posNegDuration, withoutSuffix, locale) { | ||
25473 | var duration = create__createDuration(posNegDuration).abs(); | ||
25474 | var seconds = round(duration.as('s')); | ||
25475 | var minutes = round(duration.as('m')); | ||
25476 | var hours = round(duration.as('h')); | ||
25477 | var days = round(duration.as('d')); | ||
25478 | var months = round(duration.as('M')); | ||
25479 | var years = round(duration.as('y')); | ||
25480 | |||
25481 | var a = seconds < thresholds.s && ['s', seconds] || | ||
25482 | minutes <= 1 && ['m'] || | ||
25483 | minutes < thresholds.m && ['mm', minutes] || | ||
25484 | hours <= 1 && ['h'] || | ||
25485 | hours < thresholds.h && ['hh', hours] || | ||
25486 | days <= 1 && ['d'] || | ||
25487 | days < thresholds.d && ['dd', days] || | ||
25488 | months <= 1 && ['M'] || | ||
25489 | months < thresholds.M && ['MM', months] || | ||
25490 | years <= 1 && ['y'] || ['yy', years]; | ||
25491 | |||
25492 | a[2] = withoutSuffix; | ||
25493 | a[3] = +posNegDuration > 0; | ||
25494 | a[4] = locale; | ||
25495 | return substituteTimeAgo.apply(null, a); | ||
25496 | } | ||
25497 | |||
25498 | // This function allows you to set the rounding function for relative time strings | ||
25499 | function duration_humanize__getSetRelativeTimeRounding (roundingFunction) { | ||
25500 | if (roundingFunction === undefined) { | ||
25501 | return round; | ||
25502 | } | ||
25503 | if (typeof(roundingFunction) === 'function') { | ||
25504 | round = roundingFunction; | ||
25505 | return true; | ||
25506 | } | ||
25507 | return false; | ||
25508 | } | ||
25509 | |||
25510 | // This function allows you to set a threshold for relative time strings | ||
25511 | function duration_humanize__getSetRelativeTimeThreshold (threshold, limit) { | ||
25512 | if (thresholds[threshold] === undefined) { | ||
25513 | return false; | ||
25514 | } | ||
25515 | if (limit === undefined) { | ||
25516 | return thresholds[threshold]; | ||
25517 | } | ||
25518 | thresholds[threshold] = limit; | ||
25519 | return true; | ||
25520 | } | ||
25521 | |||
25522 | function humanize (withSuffix) { | ||
25523 | var locale = this.localeData(); | ||
25524 | var output = duration_humanize__relativeTime(this, !withSuffix, locale); | ||
25525 | |||
25526 | if (withSuffix) { | ||
25527 | output = locale.pastFuture(+this, output); | ||
25528 | } | ||
25529 | |||
25530 | return locale.postformat(output); | ||
25531 | } | ||
25532 | |||
25533 | var iso_string__abs = Math.abs; | ||
25534 | |||
25535 | function iso_string__toISOString() { | ||
25536 | // for ISO strings we do not use the normal bubbling rules: | ||
25537 | // * milliseconds bubble up until they become hours | ||
25538 | // * days do not bubble at all | ||
25539 | // * months bubble up until they become years | ||
25540 | // This is because there is no context-free conversion between hours and days | ||
25541 | // (think of clock changes) | ||
25542 | // and also not between days and months (28-31 days per month) | ||
25543 | var seconds = iso_string__abs(this._milliseconds) / 1000; | ||
25544 | var days = iso_string__abs(this._days); | ||
25545 | var months = iso_string__abs(this._months); | ||
25546 | var minutes, hours, years; | ||
25547 | |||
25548 | // 3600 seconds -> 60 minutes -> 1 hour | ||
25549 | minutes = absFloor(seconds / 60); | ||
25550 | hours = absFloor(minutes / 60); | ||
25551 | seconds %= 60; | ||
25552 | minutes %= 60; | ||
25553 | |||
25554 | // 12 months -> 1 year | ||
25555 | years = absFloor(months / 12); | ||
25556 | months %= 12; | ||
25557 | |||
25558 | |||
25559 | // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js | ||
25560 | var Y = years; | ||
25561 | var M = months; | ||
25562 | var D = days; | ||
25563 | var h = hours; | ||
25564 | var m = minutes; | ||
25565 | var s = seconds; | ||
25566 | var total = this.asSeconds(); | ||
25567 | |||
25568 | if (!total) { | ||
25569 | // this is the same as C#'s (Noda) and python (isodate)... | ||
25570 | // but not other JS (goog.date) | ||
25571 | return 'P0D'; | ||
25572 | } | ||
25573 | |||
25574 | return (total < 0 ? '-' : '') + | ||
25575 | 'P' + | ||
25576 | (Y ? Y + 'Y' : '') + | ||
25577 | (M ? M + 'M' : '') + | ||
25578 | (D ? D + 'D' : '') + | ||
25579 | ((h || m || s) ? 'T' : '') + | ||
25580 | (h ? h + 'H' : '') + | ||
25581 | (m ? m + 'M' : '') + | ||
25582 | (s ? s + 'S' : ''); | ||
25583 | } | ||
25584 | |||
25585 | var duration_prototype__proto = Duration.prototype; | ||
25586 | |||
25587 | duration_prototype__proto.abs = duration_abs__abs; | ||
25588 | duration_prototype__proto.add = duration_add_subtract__add; | ||
25589 | duration_prototype__proto.subtract = duration_add_subtract__subtract; | ||
25590 | duration_prototype__proto.as = as; | ||
25591 | duration_prototype__proto.asMilliseconds = asMilliseconds; | ||
25592 | duration_prototype__proto.asSeconds = asSeconds; | ||
25593 | duration_prototype__proto.asMinutes = asMinutes; | ||
25594 | duration_prototype__proto.asHours = asHours; | ||
25595 | duration_prototype__proto.asDays = asDays; | ||
25596 | duration_prototype__proto.asWeeks = asWeeks; | ||
25597 | duration_prototype__proto.asMonths = asMonths; | ||
25598 | duration_prototype__proto.asYears = asYears; | ||
25599 | duration_prototype__proto.valueOf = duration_as__valueOf; | ||
25600 | duration_prototype__proto._bubble = bubble; | ||
25601 | duration_prototype__proto.get = duration_get__get; | ||
25602 | duration_prototype__proto.milliseconds = milliseconds; | ||
25603 | duration_prototype__proto.seconds = seconds; | ||
25604 | duration_prototype__proto.minutes = minutes; | ||
25605 | duration_prototype__proto.hours = hours; | ||
25606 | duration_prototype__proto.days = days; | ||
25607 | duration_prototype__proto.weeks = weeks; | ||
25608 | duration_prototype__proto.months = months; | ||
25609 | duration_prototype__proto.years = years; | ||
25610 | duration_prototype__proto.humanize = humanize; | ||
25611 | duration_prototype__proto.toISOString = iso_string__toISOString; | ||
25612 | duration_prototype__proto.toString = iso_string__toISOString; | ||
25613 | duration_prototype__proto.toJSON = iso_string__toISOString; | ||
25614 | duration_prototype__proto.locale = locale; | ||
25615 | duration_prototype__proto.localeData = localeData; | ||
25616 | |||
25617 | // Deprecations | ||
25618 | duration_prototype__proto.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', iso_string__toISOString); | ||
25619 | duration_prototype__proto.lang = lang; | ||
25620 | |||
25621 | // Side effect imports | ||
25622 | |||
25623 | // FORMATTING | ||
25624 | |||
25625 | addFormatToken('X', 0, 0, 'unix'); | ||
25626 | addFormatToken('x', 0, 0, 'valueOf'); | ||
25627 | |||
25628 | // PARSING | ||
25629 | |||
25630 | addRegexToken('x', matchSigned); | ||
25631 | addRegexToken('X', matchTimestamp); | ||
25632 | addParseToken('X', function (input, array, config) { | ||
25633 | config._d = new Date(parseFloat(input, 10) * 1000); | ||
25634 | }); | ||
25635 | addParseToken('x', function (input, array, config) { | ||
25636 | config._d = new Date(toInt(input)); | ||
25637 | }); | ||
25638 | |||
25639 | // Side effect imports | ||
25640 | |||
25641 | |||
25642 | utils_hooks__hooks.version = '2.14.1'; | ||
25643 | |||
25644 | setHookCallback(local__createLocal); | ||
25645 | |||
25646 | utils_hooks__hooks.fn = momentPrototype; | ||
25647 | utils_hooks__hooks.min = min; | ||
25648 | utils_hooks__hooks.max = max; | ||
25649 | utils_hooks__hooks.now = now; | ||
25650 | utils_hooks__hooks.utc = create_utc__createUTC; | ||
25651 | utils_hooks__hooks.unix = moment__createUnix; | ||
25652 | utils_hooks__hooks.months = lists__listMonths; | ||
25653 | utils_hooks__hooks.isDate = isDate; | ||
25654 | utils_hooks__hooks.locale = locale_locales__getSetGlobalLocale; | ||
25655 | utils_hooks__hooks.invalid = valid__createInvalid; | ||
25656 | utils_hooks__hooks.duration = create__createDuration; | ||
25657 | utils_hooks__hooks.isMoment = isMoment; | ||
25658 | utils_hooks__hooks.weekdays = lists__listWeekdays; | ||
25659 | utils_hooks__hooks.parseZone = moment__createInZone; | ||
25660 | utils_hooks__hooks.localeData = locale_locales__getLocale; | ||
25661 | utils_hooks__hooks.isDuration = isDuration; | ||
25662 | utils_hooks__hooks.monthsShort = lists__listMonthsShort; | ||
25663 | utils_hooks__hooks.weekdaysMin = lists__listWeekdaysMin; | ||
25664 | utils_hooks__hooks.defineLocale = defineLocale; | ||
25665 | utils_hooks__hooks.updateLocale = updateLocale; | ||
25666 | utils_hooks__hooks.locales = locale_locales__listLocales; | ||
25667 | utils_hooks__hooks.weekdaysShort = lists__listWeekdaysShort; | ||
25668 | utils_hooks__hooks.normalizeUnits = normalizeUnits; | ||
25669 | utils_hooks__hooks.relativeTimeRounding = duration_humanize__getSetRelativeTimeRounding; | ||
25670 | utils_hooks__hooks.relativeTimeThreshold = duration_humanize__getSetRelativeTimeThreshold; | ||
25671 | utils_hooks__hooks.calendarFormat = getCalendarFormat; | ||
25672 | utils_hooks__hooks.prototype = momentPrototype; | ||
25673 | |||
25674 | var _moment = utils_hooks__hooks; | ||
25675 | |||
25676 | return _moment; | ||
25677 | |||
25678 | })); | ||
22219 | 25679 | ||
22220 | /***/ }, | 25680 | /***/ }, |
22221 | /* 168 */ | 25681 | /* 178 */ |
22222 | /***/ function(module, exports, __webpack_require__) { | 25682 | /***/ function(module, exports, __webpack_require__) { |
22223 | 25683 | ||
22224 | 'use strict'; | 25684 | 'use strict'; |
22225 | 25685 | ||
22226 | Object.defineProperty(exports, '__esModule', { | 25686 | Object.defineProperty(exports, "__esModule", { |
22227 | value: true | 25687 | value: true |
22228 | }); | 25688 | }); |
22229 | 25689 | ||
22230 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | 25690 | var _src = __webpack_require__(179); |
22231 | |||
22232 | var _src = __webpack_require__(169); | ||
22233 | 25691 | ||
22234 | var _src2 = _interopRequireDefault(_src); | 25692 | var _src2 = _interopRequireDefault(_src); |
22235 | 25693 | ||
22236 | exports['default'] = _src2['default']; | 25694 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
25695 | |||
25696 | exports.default = _src2.default; | ||
22237 | module.exports = exports['default']; | 25697 | module.exports = exports['default']; |
22238 | 25698 | ||
22239 | /***/ }, | 25699 | /***/ }, |
22240 | /* 169 */ | 25700 | /* 179 */ |
22241 | /***/ function(module, exports, __webpack_require__) { | 25701 | /***/ function(module, exports, __webpack_require__) { |
22242 | 25702 | ||
22243 | 'use strict'; | 25703 | 'use strict'; |
22244 | 25704 | ||
22245 | Object.defineProperty(exports, '__esModule', { | 25705 | Object.defineProperty(exports, "__esModule", { |
22246 | value: true | 25706 | value: true |
22247 | }); | 25707 | }); |
22248 | 25708 | ||
22249 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | 25709 | var _TimePicker = __webpack_require__(180); |
22250 | |||
22251 | var _TimePicker = __webpack_require__(170); | ||
22252 | 25710 | ||
22253 | var _TimePicker2 = _interopRequireDefault(_TimePicker); | 25711 | var _TimePicker2 = _interopRequireDefault(_TimePicker); |
22254 | 25712 | ||
22255 | exports['default'] = _TimePicker2['default']; | 25713 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
25714 | |||
25715 | exports.default = _TimePicker2.default; | ||
22256 | module.exports = exports['default']; | 25716 | module.exports = exports['default']; |
22257 | 25717 | ||
22258 | /***/ }, | 25718 | /***/ }, |
22259 | /* 170 */ | 25719 | /* 180 */ |
22260 | /***/ function(module, exports, __webpack_require__) { | 25720 | /***/ function(module, exports, __webpack_require__) { |
22261 | 25721 | ||
22262 | 'use strict'; | 25722 | 'use strict'; |
22263 | 25723 | ||
22264 | Object.defineProperty(exports, '__esModule', { | 25724 | Object.defineProperty(exports, "__esModule", { |
22265 | value: true | 25725 | value: true |
22266 | }); | 25726 | }); |
22267 | 25727 | ||
22268 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
22269 | |||
22270 | var _react = __webpack_require__(3); | 25728 | var _react = __webpack_require__(3); |
22271 | 25729 | ||
22272 | var _react2 = _interopRequireDefault(_react); | 25730 | var _react2 = _interopRequireDefault(_react); |
22273 | 25731 | ||
22274 | var _rcTrigger = __webpack_require__(171); | 25732 | var _rcTrigger = __webpack_require__(181); |
22275 | 25733 | ||
22276 | var _rcTrigger2 = _interopRequireDefault(_rcTrigger); | 25734 | var _rcTrigger2 = _interopRequireDefault(_rcTrigger); |
22277 | 25735 | ||
22278 | var _modulePanel = __webpack_require__(218); | 25736 | var _Panel = __webpack_require__(213); |
22279 | 25737 | ||
22280 | var _modulePanel2 = _interopRequireDefault(_modulePanel); | 25738 | var _Panel2 = _interopRequireDefault(_Panel); |
22281 | 25739 | ||
22282 | var _utilPlacements = __webpack_require__(225); | 25740 | var _placements = __webpack_require__(237); |
22283 | 25741 | ||
22284 | var _utilPlacements2 = _interopRequireDefault(_utilPlacements); | 25742 | var _placements2 = _interopRequireDefault(_placements); |
22285 | 25743 | ||
22286 | var _mixinCommonMixin = __webpack_require__(219); | 25744 | var _moment = __webpack_require__(177); |
22287 | 25745 | ||
22288 | var _mixinCommonMixin2 = _interopRequireDefault(_mixinCommonMixin); | 25746 | var _moment2 = _interopRequireDefault(_moment); |
22289 | 25747 | ||
22290 | var _utilIndex = __webpack_require__(226); | 25748 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
22291 | 25749 | ||
22292 | function noop() {} | 25750 | function noop() {} |
22293 | 25751 | ||
@@ -22295,13 +25753,14 @@ | |||
22295 | this[field] = component; | 25753 | this[field] = component; |
22296 | } | 25754 | } |
22297 | 25755 | ||
22298 | var Picker = _react2['default'].createClass({ | 25756 | var Picker = _react2.default.createClass({ |
22299 | displayName: 'Picker', | 25757 | displayName: 'Picker', |
22300 | 25758 | ||
22301 | propTypes: { | 25759 | propTypes: { |
22302 | prefixCls: _react.PropTypes.string, | 25760 | prefixCls: _react.PropTypes.string, |
22303 | locale: _react.PropTypes.object, | 25761 | clearText: _react.PropTypes.string, |
22304 | value: _react.PropTypes.object, | 25762 | value: _react.PropTypes.object, |
25763 | defaultOpenValue: _react.PropTypes.object, | ||
22305 | disabled: _react.PropTypes.bool, | 25764 | disabled: _react.PropTypes.bool, |
22306 | allowEmpty: _react.PropTypes.bool, | 25765 | allowEmpty: _react.PropTypes.bool, |
22307 | defaultValue: _react.PropTypes.object, | 25766 | defaultValue: _react.PropTypes.object, |
@@ -22312,7 +25771,7 @@ | |||
22312 | transitionName: _react.PropTypes.string, | 25771 | transitionName: _react.PropTypes.string, |
22313 | getPopupContainer: _react.PropTypes.func, | 25772 | getPopupContainer: _react.PropTypes.func, |
22314 | placeholder: _react.PropTypes.string, | 25773 | placeholder: _react.PropTypes.string, |
22315 | formatter: _react.PropTypes.any, | 25774 | format: _react.PropTypes.string, |
22316 | showHour: _react.PropTypes.bool, | 25775 | showHour: _react.PropTypes.bool, |
22317 | style: _react.PropTypes.object, | 25776 | style: _react.PropTypes.object, |
22318 | className: _react.PropTypes.string, | 25777 | className: _react.PropTypes.string, |
@@ -22326,15 +25785,15 @@ | |||
22326 | onClose: _react.PropTypes.func | 25785 | onClose: _react.PropTypes.func |
22327 | }, | 25786 | }, |
22328 | 25787 | ||
22329 | mixins: [_mixinCommonMixin2['default']], | ||
22330 | |||
22331 | getDefaultProps: function getDefaultProps() { | 25788 | getDefaultProps: function getDefaultProps() { |
22332 | return { | 25789 | return { |
25790 | clearText: 'clear', | ||
22333 | prefixCls: 'rc-time-picker', | 25791 | prefixCls: 'rc-time-picker', |
22334 | defaultOpen: false, | 25792 | defaultOpen: false, |
22335 | style: {}, | 25793 | style: {}, |
22336 | className: '', | 25794 | className: '', |
22337 | align: {}, | 25795 | align: {}, |
25796 | defaultOpenValue: (0, _moment2.default)(), | ||
22338 | allowEmpty: true, | 25797 | allowEmpty: true, |
22339 | showHour: true, | 25798 | showHour: true, |
22340 | showSecond: true, | 25799 | showSecond: true, |
@@ -22348,7 +25807,6 @@ | |||
22348 | onClose: noop | 25807 | onClose: noop |
22349 | }; | 25808 | }; |
22350 | }, | 25809 | }, |
22351 | |||
22352 | getInitialState: function getInitialState() { | 25810 | getInitialState: function getInitialState() { |
22353 | this.savePanelRef = refFn.bind(this, 'panelInstance'); | 25811 | this.savePanelRef = refFn.bind(this, 'panelInstance'); |
22354 | var _props = this.props; | 25812 | var _props = this.props; |
@@ -22364,7 +25822,6 @@ | |||
22364 | value: value | 25822 | value: value |
22365 | }; | 25823 | }; |
22366 | }, | 25824 | }, |
22367 | |||
22368 | componentWillReceiveProps: function componentWillReceiveProps(nextProps) { | 25825 | componentWillReceiveProps: function componentWillReceiveProps(nextProps) { |
22369 | var value = nextProps.value; | 25826 | var value = nextProps.value; |
22370 | var open = nextProps.open; | 25827 | var open = nextProps.open; |
@@ -22378,31 +25835,25 @@ | |||
22378 | this.setState({ open: open }); | 25835 | this.setState({ open: open }); |
22379 | } | 25836 | } |
22380 | }, | 25837 | }, |
22381 | |||
22382 | onPanelChange: function onPanelChange(value) { | 25838 | onPanelChange: function onPanelChange(value) { |
22383 | this.setValue(value); | 25839 | this.setValue(value); |
22384 | }, | 25840 | }, |
22385 | |||
22386 | onPanelClear: function onPanelClear() { | 25841 | onPanelClear: function onPanelClear() { |
22387 | this.setValue(null); | 25842 | this.setValue(null); |
22388 | this.setOpen(false); | 25843 | this.setOpen(false); |
22389 | }, | 25844 | }, |
22390 | |||
22391 | onVisibleChange: function onVisibleChange(open) { | 25845 | onVisibleChange: function onVisibleChange(open) { |
22392 | this.setOpen(open); | 25846 | this.setOpen(open); |
22393 | }, | 25847 | }, |
22394 | |||
22395 | onEsc: function onEsc() { | 25848 | onEsc: function onEsc() { |
22396 | this.setOpen(false); | 25849 | this.setOpen(false); |
22397 | this.refs.picker.focus(); | 25850 | this.refs.picker.focus(); |
22398 | }, | 25851 | }, |
22399 | |||
22400 | onKeyDown: function onKeyDown(e) { | 25852 | onKeyDown: function onKeyDown(e) { |
22401 | if (e.keyCode === 40) { | 25853 | if (e.keyCode === 40) { |
22402 | this.setOpen(true); | 25854 | this.setOpen(true); |
22403 | } | 25855 | } |
22404 | }, | 25856 | }, |
22405 | |||
22406 | setValue: function setValue(value) { | 25857 | setValue: function setValue(value) { |
22407 | if (!('value' in this.props)) { | 25858 | if (!('value' in this.props)) { |
22408 | this.setState({ | 25859 | this.setState({ |
@@ -22411,41 +25862,22 @@ | |||
22411 | } | 25862 | } |
22412 | this.props.onChange(value); | 25863 | this.props.onChange(value); |
22413 | }, | 25864 | }, |
22414 | 25865 | getFormat: function getFormat() { | |
22415 | getFormatter: function getFormatter() { | 25866 | var format = this.props.format; |
22416 | var formatter = this.props.formatter; | 25867 | if (format) { |
22417 | var locale = this.props.locale; | 25868 | return format; |
22418 | if (formatter) { | ||
22419 | if (formatter === this.lastFormatter) { | ||
22420 | return this.normalFormatter; | ||
22421 | } | ||
22422 | this.normalFormatter = (0, _utilIndex.getFormatter)(formatter, locale); | ||
22423 | this.lastFormatter = formatter; | ||
22424 | return this.normalFormatter; | ||
22425 | } | 25869 | } |
22426 | if (!this.props.showSecond) { | 25870 | if (!this.props.showSecond) { |
22427 | if (!this.notShowSecondFormatter) { | 25871 | return 'HH:mm'; |
22428 | this.notShowSecondFormatter = (0, _utilIndex.getFormatter)('HH:mm', locale); | ||
22429 | } | ||
22430 | return this.notShowSecondFormatter; | ||
22431 | } | 25872 | } |
22432 | if (!this.props.showHour) { | 25873 | if (!this.props.showHour) { |
22433 | if (!this.notShowHourFormatter) { | 25874 | return 'mm:ss'; |
22434 | this.notShowHourFormatter = (0, _utilIndex.getFormatter)('mm:ss', locale); | ||
22435 | } | ||
22436 | return this.notShowHourFormatter; | ||
22437 | } | ||
22438 | if (!this.normalFormatter) { | ||
22439 | this.normalFormatter = (0, _utilIndex.getFormatter)('HH:mm:ss', locale); | ||
22440 | } | 25875 | } |
22441 | return this.normalFormatter; | 25876 | return 'HH:mm:ss'; |
22442 | }, | 25877 | }, |
22443 | |||
22444 | getPanelElement: function getPanelElement() { | 25878 | getPanelElement: function getPanelElement() { |
22445 | var _props2 = this.props; | 25879 | var _props2 = this.props; |
22446 | var prefixCls = _props2.prefixCls; | 25880 | var prefixCls = _props2.prefixCls; |
22447 | var defaultValue = _props2.defaultValue; | ||
22448 | var locale = _props2.locale; | ||
22449 | var placeholder = _props2.placeholder; | 25881 | var placeholder = _props2.placeholder; |
22450 | var disabledHours = _props2.disabledHours; | 25882 | var disabledHours = _props2.disabledHours; |
22451 | var disabledMinutes = _props2.disabledMinutes; | 25883 | var disabledMinutes = _props2.disabledMinutes; |
@@ -22454,21 +25886,22 @@ | |||
22454 | var allowEmpty = _props2.allowEmpty; | 25886 | var allowEmpty = _props2.allowEmpty; |
22455 | var showHour = _props2.showHour; | 25887 | var showHour = _props2.showHour; |
22456 | var showSecond = _props2.showSecond; | 25888 | var showSecond = _props2.showSecond; |
25889 | var defaultOpenValue = _props2.defaultOpenValue; | ||
25890 | var clearText = _props2.clearText; | ||
22457 | 25891 | ||
22458 | return _react2['default'].createElement(_modulePanel2['default'], { | 25892 | return _react2.default.createElement(_Panel2.default, { |
25893 | clearText: clearText, | ||
22459 | prefixCls: prefixCls + '-panel', | 25894 | prefixCls: prefixCls + '-panel', |
22460 | ref: this.savePanelRef, | 25895 | ref: this.savePanelRef, |
22461 | value: this.state.value, | 25896 | value: this.state.value, |
22462 | onChange: this.onPanelChange, | 25897 | onChange: this.onPanelChange, |
22463 | gregorianCalendarLocale: locale.calendar, | ||
22464 | onClear: this.onPanelClear, | 25898 | onClear: this.onPanelClear, |
22465 | defaultValue: defaultValue, | 25899 | defaultOpenValue: defaultOpenValue, |
22466 | showHour: showHour, | 25900 | showHour: showHour, |
22467 | onEsc: this.onEsc, | 25901 | onEsc: this.onEsc, |
22468 | showSecond: showSecond, | 25902 | showSecond: showSecond, |
22469 | locale: locale, | ||
22470 | allowEmpty: allowEmpty, | 25903 | allowEmpty: allowEmpty, |
22471 | formatter: this.getFormatter(), | 25904 | format: this.getFormat(), |
22472 | placeholder: placeholder, | 25905 | placeholder: placeholder, |
22473 | disabledHours: disabledHours, | 25906 | disabledHours: disabledHours, |
22474 | disabledMinutes: disabledMinutes, | 25907 | disabledMinutes: disabledMinutes, |
@@ -22476,7 +25909,6 @@ | |||
22476 | hideDisabledOptions: hideDisabledOptions | 25909 | hideDisabledOptions: hideDisabledOptions |
22477 | }); | 25910 | }); |
22478 | }, | 25911 | }, |
22479 | |||
22480 | setOpen: function setOpen(open, callback) { | 25912 | setOpen: function setOpen(open, callback) { |
22481 | var _props3 = this.props; | 25913 | var _props3 = this.props; |
22482 | var onOpen = _props3.onOpen; | 25914 | var onOpen = _props3.onOpen; |
@@ -22486,17 +25918,16 @@ | |||
22486 | this.setState({ | 25918 | this.setState({ |
22487 | open: open | 25919 | open: open |
22488 | }, callback); | 25920 | }, callback); |
22489 | var _event = { | 25921 | var event = { |
22490 | open: open | 25922 | open: open |
22491 | }; | 25923 | }; |
22492 | if (open) { | 25924 | if (open) { |
22493 | onOpen(_event); | 25925 | onOpen(event); |
22494 | } else { | 25926 | } else { |
22495 | onClose(_event); | 25927 | onClose(event); |
22496 | } | 25928 | } |
22497 | } | 25929 | } |
22498 | }, | 25930 | }, |
22499 | |||
22500 | render: function render() { | 25931 | render: function render() { |
22501 | var _props4 = this.props; | 25932 | var _props4 = this.props; |
22502 | var prefixCls = _props4.prefixCls; | 25933 | var prefixCls = _props4.prefixCls; |
@@ -22514,18 +25945,18 @@ | |||
22514 | var open = _state.open; | 25945 | var open = _state.open; |
22515 | var value = _state.value; | 25946 | var value = _state.value; |
22516 | 25947 | ||
22517 | var popupClassName = undefined; | 25948 | var popupClassName = void 0; |
22518 | if (!showHour || !showSecond) { | 25949 | if (!showHour || !showSecond) { |
22519 | popupClassName = prefixCls + '-panel-narrow'; | 25950 | popupClassName = prefixCls + '-panel-narrow'; |
22520 | } | 25951 | } |
22521 | return _react2['default'].createElement( | 25952 | return _react2.default.createElement( |
22522 | _rcTrigger2['default'], | 25953 | _rcTrigger2.default, |
22523 | { | 25954 | { |
22524 | prefixCls: prefixCls + '-panel', | 25955 | prefixCls: prefixCls + '-panel', |
22525 | popupClassName: popupClassName, | 25956 | popupClassName: popupClassName, |
22526 | popup: this.getPanelElement(), | 25957 | popup: this.getPanelElement(), |
22527 | popupAlign: align, | 25958 | popupAlign: align, |
22528 | builtinPlacements: _utilPlacements2['default'], | 25959 | builtinPlacements: _placements2.default, |
22529 | popupPlacement: placement, | 25960 | popupPlacement: placement, |
22530 | action: disabled ? [] : ['click'], | 25961 | action: disabled ? [] : ['click'], |
22531 | destroyPopupOnHide: true, | 25962 | destroyPopupOnHide: true, |
@@ -22534,62 +25965,72 @@ | |||
22534 | popupVisible: open, | 25965 | popupVisible: open, |
22535 | onPopupVisibleChange: this.onVisibleChange | 25966 | onPopupVisibleChange: this.onVisibleChange |
22536 | }, | 25967 | }, |
22537 | _react2['default'].createElement( | 25968 | _react2.default.createElement( |
22538 | 'span', | 25969 | 'span', |
22539 | { className: prefixCls + ' ' + className, style: style }, | 25970 | { className: prefixCls + ' ' + className, style: style }, |
22540 | _react2['default'].createElement('input', { | 25971 | _react2.default.createElement('input', { |
22541 | className: prefixCls + '-input', | 25972 | className: prefixCls + '-input', |
22542 | ref: 'picker', type: 'text', placeholder: placeholder, | 25973 | ref: 'picker', type: 'text', placeholder: placeholder, |
22543 | readOnly: true, | 25974 | readOnly: true, |
22544 | onKeyDown: this.onKeyDown, | 25975 | onKeyDown: this.onKeyDown, |
22545 | disabled: disabled, value: value && this.getFormatter().format(value) || '' | 25976 | disabled: disabled, value: value && value.format(this.getFormat()) || '' |
22546 | }), | 25977 | }), |
22547 | _react2['default'].createElement('span', { className: prefixCls + '-icon' }) | 25978 | _react2.default.createElement('span', { className: prefixCls + '-icon' }) |
22548 | ) | 25979 | ) |
22549 | ); | 25980 | ); |
22550 | } | 25981 | } |
22551 | }); | 25982 | }); |
22552 | 25983 | ||
22553 | exports['default'] = Picker; | 25984 | exports.default = Picker; |
22554 | module.exports = exports['default']; | 25985 | module.exports = exports['default']; |
22555 | 25986 | ||
22556 | /***/ }, | 25987 | /***/ }, |
22557 | /* 171 */ | 25988 | /* 181 */ |
22558 | /***/ function(module, exports, __webpack_require__) { | 25989 | /***/ function(module, exports, __webpack_require__) { |
22559 | 25990 | ||
22560 | 'use strict'; | 25991 | 'use strict'; |
22561 | 25992 | ||
22562 | module.exports = __webpack_require__(172); | 25993 | module.exports = __webpack_require__(182); |
22563 | 25994 | ||
22564 | /***/ }, | 25995 | /***/ }, |
22565 | /* 172 */ | 25996 | /* 182 */ |
22566 | /***/ function(module, exports, __webpack_require__) { | 25997 | /***/ function(module, exports, __webpack_require__) { |
22567 | 25998 | ||
22568 | 'use strict'; | 25999 | 'use strict'; |
22569 | 26000 | ||
22570 | Object.defineProperty(exports, '__esModule', { | 26001 | Object.defineProperty(exports, "__esModule", { |
22571 | value: true | 26002 | value: true |
22572 | }); | 26003 | }); |
22573 | 26004 | ||
22574 | 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; }; | 26005 | 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; }; |
22575 | 26006 | ||
22576 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
22577 | |||
22578 | var _react = __webpack_require__(3); | 26007 | var _react = __webpack_require__(3); |
22579 | 26008 | ||
22580 | var _react2 = _interopRequireDefault(_react); | 26009 | var _react2 = _interopRequireDefault(_react); |
22581 | 26010 | ||
22582 | var _reactDom = __webpack_require__(160); | 26011 | var _reactDom = __webpack_require__(37); |
22583 | 26012 | ||
22584 | var _reactDom2 = _interopRequireDefault(_reactDom); | 26013 | var _reactDom2 = _interopRequireDefault(_reactDom); |
22585 | 26014 | ||
22586 | var _rcUtil = __webpack_require__(173); | 26015 | var _contains = __webpack_require__(183); |
26016 | |||
26017 | var _contains2 = _interopRequireDefault(_contains); | ||
22587 | 26018 | ||
22588 | var _Popup = __webpack_require__(196); | 26019 | var _addEventListener = __webpack_require__(184); |
26020 | |||
26021 | var _addEventListener2 = _interopRequireDefault(_addEventListener); | ||
26022 | |||
26023 | var _Popup = __webpack_require__(188); | ||
22589 | 26024 | ||
22590 | var _Popup2 = _interopRequireDefault(_Popup); | 26025 | var _Popup2 = _interopRequireDefault(_Popup); |
22591 | 26026 | ||
22592 | var _utils = __webpack_require__(217); | 26027 | var _utils = __webpack_require__(211); |
26028 | |||
26029 | var _getContainerRenderMixin = __webpack_require__(212); | ||
26030 | |||
26031 | var _getContainerRenderMixin2 = _interopRequireDefault(_getContainerRenderMixin); | ||
26032 | |||
26033 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
22593 | 26034 | ||
22594 | function noop() {} | 26035 | function noop() {} |
22595 | 26036 | ||
@@ -22597,16 +26038,22 @@ | |||
22597 | return ''; | 26038 | return ''; |
22598 | } | 26039 | } |
22599 | 26040 | ||
22600 | var Trigger = _react2['default'].createClass({ | 26041 | var ALL_HANDLERS = ['onClick', 'onMouseDown', 'onTouchStart', 'onMouseEnter', 'onMouseLeave', 'onFocus', 'onBlur']; |
26042 | |||
26043 | var Trigger = _react2["default"].createClass({ | ||
22601 | displayName: 'Trigger', | 26044 | displayName: 'Trigger', |
22602 | 26045 | ||
22603 | propTypes: { | 26046 | propTypes: { |
22604 | action: _react.PropTypes.any, | 26047 | children: _react.PropTypes.any, |
26048 | action: _react.PropTypes.oneOfType([_react.PropTypes.string, _react.PropTypes.arrayOf(_react.PropTypes.string)]), | ||
26049 | showAction: _react.PropTypes.any, | ||
26050 | hideAction: _react.PropTypes.any, | ||
22605 | getPopupClassNameFromAlign: _react.PropTypes.any, | 26051 | getPopupClassNameFromAlign: _react.PropTypes.any, |
22606 | onPopupVisibleChange: _react.PropTypes.func, | 26052 | onPopupVisibleChange: _react.PropTypes.func, |
22607 | afterPopupVisibleChange: _react.PropTypes.func, | 26053 | afterPopupVisibleChange: _react.PropTypes.func, |
22608 | popup: _react.PropTypes.node.isRequired, | 26054 | popup: _react.PropTypes.oneOfType([_react.PropTypes.node, _react.PropTypes.func]).isRequired, |
22609 | popupStyle: _react.PropTypes.object, | 26055 | popupStyle: _react.PropTypes.object, |
26056 | prefixCls: _react.PropTypes.string, | ||
22610 | popupClassName: _react.PropTypes.string, | 26057 | popupClassName: _react.PropTypes.string, |
22611 | popupPlacement: _react.PropTypes.string, | 26058 | popupPlacement: _react.PropTypes.string, |
22612 | builtinPlacements: _react.PropTypes.object, | 26059 | builtinPlacements: _react.PropTypes.object, |
@@ -22614,111 +26061,151 @@ | |||
22614 | popupAnimation: _react.PropTypes.any, | 26061 | popupAnimation: _react.PropTypes.any, |
22615 | mouseEnterDelay: _react.PropTypes.number, | 26062 | mouseEnterDelay: _react.PropTypes.number, |
22616 | mouseLeaveDelay: _react.PropTypes.number, | 26063 | mouseLeaveDelay: _react.PropTypes.number, |
26064 | zIndex: _react.PropTypes.number, | ||
26065 | focusDelay: _react.PropTypes.number, | ||
26066 | blurDelay: _react.PropTypes.number, | ||
22617 | getPopupContainer: _react.PropTypes.func, | 26067 | getPopupContainer: _react.PropTypes.func, |
22618 | destroyPopupOnHide: _react.PropTypes.bool, | 26068 | destroyPopupOnHide: _react.PropTypes.bool, |
26069 | mask: _react.PropTypes.bool, | ||
26070 | onPopupAlign: _react.PropTypes.func, | ||
22619 | popupAlign: _react.PropTypes.object, | 26071 | popupAlign: _react.PropTypes.object, |
22620 | popupVisible: _react.PropTypes.bool | 26072 | popupVisible: _react.PropTypes.bool, |
26073 | maskTransitionName: _react.PropTypes.string, | ||
26074 | maskAnimation: _react.PropTypes.string | ||
22621 | }, | 26075 | }, |
22622 | 26076 | ||
26077 | mixins: [(0, _getContainerRenderMixin2["default"])({ | ||
26078 | autoMount: false, | ||
26079 | |||
26080 | isVisible: function isVisible(instance) { | ||
26081 | return instance.state.popupVisible; | ||
26082 | }, | ||
26083 | getContainer: function getContainer(instance) { | ||
26084 | var popupContainer = document.createElement('div'); | ||
26085 | var mountNode = instance.props.getPopupContainer ? instance.props.getPopupContainer((0, _reactDom.findDOMNode)(instance)) : document.body; | ||
26086 | mountNode.appendChild(popupContainer); | ||
26087 | return popupContainer; | ||
26088 | }, | ||
26089 | getComponent: function getComponent(instance) { | ||
26090 | var props = instance.props; | ||
26091 | var state = instance.state; | ||
26092 | |||
26093 | var mouseProps = {}; | ||
26094 | if (instance.isMouseEnterToShow()) { | ||
26095 | mouseProps.onMouseEnter = instance.onPopupMouseEnter; | ||
26096 | } | ||
26097 | if (instance.isMouseLeaveToHide()) { | ||
26098 | mouseProps.onMouseLeave = instance.onPopupMouseLeave; | ||
26099 | } | ||
26100 | return _react2["default"].createElement( | ||
26101 | _Popup2["default"], | ||
26102 | _extends({ | ||
26103 | prefixCls: props.prefixCls, | ||
26104 | destroyPopupOnHide: props.destroyPopupOnHide, | ||
26105 | visible: state.popupVisible, | ||
26106 | className: props.popupClassName, | ||
26107 | action: props.action, | ||
26108 | align: instance.getPopupAlign(), | ||
26109 | onAlign: props.onPopupAlign, | ||
26110 | animation: props.popupAnimation, | ||
26111 | getClassNameFromAlign: instance.getPopupClassNameFromAlign | ||
26112 | }, mouseProps, { | ||
26113 | getRootDomNode: instance.getRootDomNode, | ||
26114 | style: props.popupStyle, | ||
26115 | mask: props.mask, | ||
26116 | zIndex: props.zIndex, | ||
26117 | transitionName: props.popupTransitionName, | ||
26118 | maskAnimation: props.maskAnimation, | ||
26119 | maskTransitionName: props.maskTransitionName | ||
26120 | }), | ||
26121 | typeof props.popup === 'function' ? props.popup() : props.popup | ||
26122 | ); | ||
26123 | } | ||
26124 | })], | ||
26125 | |||
22623 | getDefaultProps: function getDefaultProps() { | 26126 | getDefaultProps: function getDefaultProps() { |
22624 | return { | 26127 | return { |
22625 | prefixCls: 'rc-trigger-popup', | 26128 | prefixCls: 'rc-trigger-popup', |
22626 | getPopupClassNameFromAlign: returnEmptyString, | 26129 | getPopupClassNameFromAlign: returnEmptyString, |
22627 | onPopupVisibleChange: noop, | 26130 | onPopupVisibleChange: noop, |
22628 | afterPopupVisibleChange: noop, | 26131 | afterPopupVisibleChange: noop, |
26132 | onPopupAlign: noop, | ||
22629 | popupClassName: '', | 26133 | popupClassName: '', |
22630 | mouseEnterDelay: 0, | 26134 | mouseEnterDelay: 0, |
22631 | mouseLeaveDelay: 0.1, | 26135 | mouseLeaveDelay: 0.1, |
26136 | focusDelay: 0, | ||
26137 | blurDelay: 0.15, | ||
22632 | popupStyle: {}, | 26138 | popupStyle: {}, |
22633 | destroyPopupOnHide: false, | 26139 | destroyPopupOnHide: false, |
22634 | popupAlign: {}, | 26140 | popupAlign: {}, |
22635 | defaultPopupVisible: false, | 26141 | defaultPopupVisible: false, |
22636 | action: [] | 26142 | mask: false, |
26143 | action: [], | ||
26144 | showAction: [], | ||
26145 | hideAction: [] | ||
22637 | }; | 26146 | }; |
22638 | }, | 26147 | }, |
22639 | |||
22640 | getInitialState: function getInitialState() { | 26148 | getInitialState: function getInitialState() { |
22641 | var props = this.props; | 26149 | var props = this.props; |
22642 | var popupVisible = undefined; | 26150 | var popupVisible = void 0; |
22643 | if ('popupVisible' in props) { | 26151 | if ('popupVisible' in props) { |
22644 | popupVisible = !!props.popupVisible; | 26152 | popupVisible = !!props.popupVisible; |
22645 | } else { | 26153 | } else { |
22646 | popupVisible = !!props.defaultPopupVisible; | 26154 | popupVisible = !!props.defaultPopupVisible; |
22647 | } | 26155 | } |
22648 | return { popupVisible: popupVisible }; | 26156 | return { |
26157 | popupVisible: popupVisible | ||
26158 | }; | ||
22649 | }, | 26159 | }, |
26160 | componentWillMount: function componentWillMount() { | ||
26161 | var _this = this; | ||
22650 | 26162 | ||
26163 | ALL_HANDLERS.forEach(function (h) { | ||
26164 | _this['fire' + h] = function (e) { | ||
26165 | _this.fireEvents(h, e); | ||
26166 | }; | ||
26167 | }); | ||
26168 | }, | ||
22651 | componentDidMount: function componentDidMount() { | 26169 | componentDidMount: function componentDidMount() { |
22652 | this.componentDidUpdate({}, { | 26170 | this.componentDidUpdate({}, { |
22653 | popupVisible: this.state.popupVisible | 26171 | popupVisible: this.state.popupVisible |
22654 | }); | 26172 | }); |
22655 | }, | 26173 | }, |
26174 | componentWillReceiveProps: function componentWillReceiveProps(_ref) { | ||
26175 | var popupVisible = _ref.popupVisible; | ||
22656 | 26176 | ||
22657 | componentWillReceiveProps: function componentWillReceiveProps(nextProps) { | 26177 | if (popupVisible !== undefined) { |
22658 | if ('popupVisible' in nextProps) { | ||
22659 | this.setState({ | 26178 | this.setState({ |
22660 | popupVisible: !!nextProps.popupVisible | 26179 | popupVisible: popupVisible |
22661 | }); | 26180 | }); |
22662 | } | 26181 | } |
22663 | }, | 26182 | }, |
22664 | 26183 | componentDidUpdate: function componentDidUpdate(_, prevState) { | |
22665 | componentDidUpdate: function componentDidUpdate(prevProps, prevState) { | ||
22666 | var _this = this; | ||
22667 | |||
22668 | var props = this.props; | 26184 | var props = this.props; |
22669 | var state = this.state; | 26185 | var state = this.state; |
22670 | if (this.popupRendered) { | 26186 | this.renderComponent(null, function () { |
22671 | var _ret = (function () { | 26187 | if (prevState.popupVisible !== state.popupVisible) { |
22672 | var self = _this; | 26188 | props.afterPopupVisibleChange(state.popupVisible); |
22673 | _reactDom2['default'].unstable_renderSubtreeIntoContainer(_this, _this.getPopupElement(), _this.getPopupContainer(), function renderPopup() { | 26189 | } |
22674 | if (this.isMounted()) { | 26190 | }); |
22675 | self.popupDomNode = _reactDom2['default'].findDOMNode(this); | 26191 | if (this.isClickToHide()) { |
22676 | } else { | 26192 | if (state.popupVisible) { |
22677 | self.popupDomNode = null; | 26193 | if (!this.clickOutsideHandler) { |
22678 | } | 26194 | this.clickOutsideHandler = (0, _addEventListener2["default"])(document, 'mousedown', this.onDocumentClick); |
22679 | if (prevState.popupVisible !== state.popupVisible) { | 26195 | this.touchOutsideHandler = (0, _addEventListener2["default"])(document, 'touchstart', this.onDocumentClick); |
22680 | props.afterPopupVisibleChange(state.popupVisible); | ||
22681 | } | ||
22682 | }); | ||
22683 | if (props.action.indexOf('click') !== -1) { | ||
22684 | if (state.popupVisible) { | ||
22685 | if (!_this.clickOutsideHandler) { | ||
22686 | _this.clickOutsideHandler = _rcUtil.Dom.addEventListener(document, 'mousedown', _this.onDocumentClick); | ||
22687 | _this.touchOutsideHandler = _rcUtil.Dom.addEventListener(document, 'touchstart', _this.onDocumentClick); | ||
22688 | } | ||
22689 | return { | ||
22690 | v: undefined | ||
22691 | }; | ||
22692 | } | ||
22693 | } | ||
22694 | if (_this.clickOutsideHandler) { | ||
22695 | _this.clickOutsideHandler.remove(); | ||
22696 | _this.touchOutsideHandler.remove(); | ||
22697 | _this.clickOutsideHandler = null; | ||
22698 | _this.touchOutsideHandler = null; | ||
22699 | } | 26196 | } |
22700 | })(); | 26197 | return; |
22701 | |||
22702 | if (typeof _ret === 'object') return _ret.v; | ||
22703 | } | ||
22704 | }, | ||
22705 | |||
22706 | componentWillUnmount: function componentWillUnmount() { | ||
22707 | var popupContainer = this.popupContainer; | ||
22708 | if (popupContainer) { | ||
22709 | _reactDom2['default'].unmountComponentAtNode(popupContainer); | ||
22710 | if (this.props.getPopupContainer) { | ||
22711 | var mountNode = this.props.getPopupContainer(); | ||
22712 | mountNode.removeChild(popupContainer); | ||
22713 | } else { | ||
22714 | document.body.removeChild(popupContainer); | ||
22715 | } | 26198 | } |
22716 | this.popupContainer = null; | ||
22717 | } | 26199 | } |
22718 | if (this.delayTimer) { | 26200 | if (this.clickOutsideHandler) { |
22719 | clearTimeout(this.delayTimer); | 26201 | this.clickOutsideHandler.remove(); |
22720 | this.delayTimer = null; | 26202 | this.touchOutsideHandler.remove(); |
26203 | this.clickOutsideHandler = null; | ||
26204 | this.touchOutsideHandler = null; | ||
22721 | } | 26205 | } |
26206 | }, | ||
26207 | componentWillUnmount: function componentWillUnmount() { | ||
26208 | this.clearDelayTimer(); | ||
22722 | if (this.clickOutsideHandler) { | 26209 | if (this.clickOutsideHandler) { |
22723 | this.clickOutsideHandler.remove(); | 26210 | this.clickOutsideHandler.remove(); |
22724 | this.touchOutsideHandler.remove(); | 26211 | this.touchOutsideHandler.remove(); |
@@ -22726,36 +26213,54 @@ | |||
22726 | this.touchOutsideHandler = null; | 26213 | this.touchOutsideHandler = null; |
22727 | } | 26214 | } |
22728 | }, | 26215 | }, |
22729 | 26216 | onMouseEnter: function onMouseEnter(e) { | |
22730 | onMouseEnter: function onMouseEnter() { | 26217 | this.fireEvents('onMouseEnter', e); |
22731 | this.delaySetPopupVisible(true, this.props.mouseEnterDelay); | 26218 | this.delaySetPopupVisible(true, this.props.mouseEnterDelay); |
22732 | }, | 26219 | }, |
22733 | 26220 | onMouseLeave: function onMouseLeave(e) { | |
22734 | onMouseLeave: function onMouseLeave() { | 26221 | this.fireEvents('onMouseLeave', e); |
22735 | this.delaySetPopupVisible(false, this.props.mouseLeaveDelay); | 26222 | this.delaySetPopupVisible(false, this.props.mouseLeaveDelay); |
22736 | }, | 26223 | }, |
22737 | 26224 | onPopupMouseEnter: function onPopupMouseEnter() { | |
22738 | onFocus: function onFocus() { | 26225 | this.clearDelayTimer(); |
22739 | this.focusTime = Date.now(); | ||
22740 | this.setPopupVisible(true); | ||
22741 | }, | 26226 | }, |
22742 | 26227 | onPopupMouseLeave: function onPopupMouseLeave(e) { | |
22743 | onMouseDown: function onMouseDown() { | 26228 | // https://github.com/react-component/trigger/pull/13 |
26229 | // react bug? | ||
26230 | if (e.relatedTarget && !e.relatedTarget.setTimeout && this._component && (0, _contains2["default"])(this._component.getPopupDomNode(), e.relatedTarget)) { | ||
26231 | return; | ||
26232 | } | ||
26233 | this.delaySetPopupVisible(false, this.props.mouseLeaveDelay); | ||
26234 | }, | ||
26235 | onFocus: function onFocus(e) { | ||
26236 | this.fireEvents('onFocus', e); | ||
26237 | // incase focusin and focusout | ||
26238 | this.clearDelayTimer(); | ||
26239 | if (this.isFocusToShow()) { | ||
26240 | this.focusTime = Date.now(); | ||
26241 | this.delaySetPopupVisible(true, this.props.focusDelay); | ||
26242 | } | ||
26243 | }, | ||
26244 | onMouseDown: function onMouseDown(e) { | ||
26245 | this.fireEvents('onMouseDown', e); | ||
22744 | this.preClickTime = Date.now(); | 26246 | this.preClickTime = Date.now(); |
22745 | }, | 26247 | }, |
22746 | 26248 | onTouchStart: function onTouchStart(e) { | |
22747 | onTouchStart: function onTouchStart() { | 26249 | this.fireEvents('onTouchStart', e); |
22748 | this.preTouchTime = Date.now(); | 26250 | this.preTouchTime = Date.now(); |
22749 | }, | 26251 | }, |
22750 | 26252 | onBlur: function onBlur(e) { | |
22751 | onBlur: function onBlur() { | 26253 | this.fireEvents('onBlur', e); |
22752 | this.setPopupVisible(false); | 26254 | this.clearDelayTimer(); |
26255 | if (this.isBlurToHide()) { | ||
26256 | this.delaySetPopupVisible(false, this.props.blurDelay); | ||
26257 | } | ||
22753 | }, | 26258 | }, |
22754 | |||
22755 | onClick: function onClick(event) { | 26259 | onClick: function onClick(event) { |
26260 | this.fireEvents('onClick', event); | ||
22756 | // focus will trigger click | 26261 | // focus will trigger click |
22757 | if (this.focusTime) { | 26262 | if (this.focusTime) { |
22758 | var preTime = undefined; | 26263 | var preTime = void 0; |
22759 | if (this.preClickTime && this.preTouchTime) { | 26264 | if (this.preClickTime && this.preTouchTime) { |
22760 | preTime = Math.min(this.preClickTime, this.preTouchTime); | 26265 | preTime = Math.min(this.preClickTime, this.preTouchTime); |
22761 | } else if (this.preClickTime) { | 26266 | } else if (this.preClickTime) { |
@@ -22771,36 +26276,29 @@ | |||
22771 | this.preClickTime = 0; | 26276 | this.preClickTime = 0; |
22772 | this.preTouchTime = 0; | 26277 | this.preTouchTime = 0; |
22773 | event.preventDefault(); | 26278 | event.preventDefault(); |
22774 | this.setPopupVisible(!this.state.popupVisible); | 26279 | var nextVisible = !this.state.popupVisible; |
26280 | if (this.isClickToHide() && !nextVisible || nextVisible && this.isClickToShow()) { | ||
26281 | this.setPopupVisible(!this.state.popupVisible); | ||
26282 | } | ||
22775 | }, | 26283 | }, |
22776 | |||
22777 | onDocumentClick: function onDocumentClick(event) { | 26284 | onDocumentClick: function onDocumentClick(event) { |
22778 | var target = event.target; | 26285 | var target = event.target; |
22779 | var root = _reactDom2['default'].findDOMNode(this); | 26286 | var root = (0, _reactDom.findDOMNode)(this); |
22780 | var popupNode = this.getPopupDomNode(); | 26287 | var popupNode = this.getPopupDomNode(); |
22781 | if (!_rcUtil.Dom.contains(root, target) && !_rcUtil.Dom.contains(popupNode, target)) { | 26288 | if (!(0, _contains2["default"])(root, target) && !(0, _contains2["default"])(popupNode, target)) { |
22782 | this.setPopupVisible(false); | 26289 | this.setPopupVisible(false); |
22783 | } | 26290 | } |
22784 | }, | 26291 | }, |
22785 | |||
22786 | getPopupDomNode: function getPopupDomNode() { | 26292 | getPopupDomNode: function getPopupDomNode() { |
22787 | // for test | 26293 | // for test |
22788 | return this.popupDomNode; | 26294 | if (this._component) { |
22789 | }, | 26295 | return this._component.isMounted() ? this._component.getPopupDomNode() : null; |
22790 | |||
22791 | getPopupContainer: function getPopupContainer() { | ||
22792 | if (!this.popupContainer) { | ||
22793 | this.popupContainer = document.createElement('div'); | ||
22794 | if (this.props.getPopupContainer) { | ||
22795 | var mountNode = this.props.getPopupContainer(); | ||
22796 | mountNode.appendChild(this.popupContainer); | ||
22797 | } else { | ||
22798 | document.body.appendChild(this.popupContainer); | ||
22799 | } | ||
22800 | } | 26296 | } |
22801 | return this.popupContainer; | 26297 | return null; |
26298 | }, | ||
26299 | getRootDomNode: function getRootDomNode() { | ||
26300 | return _reactDom2["default"].findDOMNode(this); | ||
22802 | }, | 26301 | }, |
22803 | |||
22804 | getPopupClassNameFromAlign: function getPopupClassNameFromAlign(align) { | 26302 | getPopupClassNameFromAlign: function getPopupClassNameFromAlign(align) { |
22805 | var className = []; | 26303 | var className = []; |
22806 | var props = this.props; | 26304 | var props = this.props; |
@@ -22816,7 +26314,6 @@ | |||
22816 | } | 26314 | } |
22817 | return className.join(' '); | 26315 | return className.join(' '); |
22818 | }, | 26316 | }, |
22819 | |||
22820 | getPopupAlign: function getPopupAlign() { | 26317 | getPopupAlign: function getPopupAlign() { |
22821 | var props = this.props; | 26318 | var props = this.props; |
22822 | var popupPlacement = props.popupPlacement; | 26319 | var popupPlacement = props.popupPlacement; |
@@ -22828,34 +26325,8 @@ | |||
22828 | } | 26325 | } |
22829 | return popupAlign; | 26326 | return popupAlign; |
22830 | }, | 26327 | }, |
22831 | |||
22832 | getPopupElement: function getPopupElement() { | ||
22833 | var props = this.props; | ||
22834 | var state = this.state; | ||
22835 | var mouseProps = {}; | ||
22836 | if (props.action.indexOf('hover') !== -1) { | ||
22837 | mouseProps.onMouseEnter = this.onMouseEnter; | ||
22838 | mouseProps.onMouseLeave = this.onMouseLeave; | ||
22839 | } | ||
22840 | return _react2['default'].createElement( | ||
22841 | _Popup2['default'], | ||
22842 | _extends({ prefixCls: props.prefixCls, | ||
22843 | destroyPopupOnHide: props.destroyPopupOnHide, | ||
22844 | visible: state.popupVisible, | ||
22845 | className: props.popupClassName, | ||
22846 | action: props.action, | ||
22847 | align: this.getPopupAlign(), | ||
22848 | animation: props.popupAnimation, | ||
22849 | getClassNameFromAlign: this.getPopupClassNameFromAlign | ||
22850 | }, mouseProps, { | ||
22851 | wrap: this, | ||
22852 | style: props.popupStyle, | ||
22853 | transitionName: props.popupTransitionName }), | ||
22854 | props.popup | ||
22855 | ); | ||
22856 | }, | ||
22857 | |||
22858 | setPopupVisible: function setPopupVisible(popupVisible) { | 26328 | setPopupVisible: function setPopupVisible(popupVisible) { |
26329 | this.clearDelayTimer(); | ||
22859 | if (this.state.popupVisible !== popupVisible) { | 26330 | if (this.state.popupVisible !== popupVisible) { |
22860 | if (!('popupVisible' in this.props)) { | 26331 | if (!('popupVisible' in this.props)) { |
22861 | this.setState({ | 26332 | this.setState({ |
@@ -22865,1610 +26336,181 @@ | |||
22865 | this.props.onPopupVisibleChange(popupVisible); | 26336 | this.props.onPopupVisibleChange(popupVisible); |
22866 | } | 26337 | } |
22867 | }, | 26338 | }, |
22868 | |||
22869 | delaySetPopupVisible: function delaySetPopupVisible(visible, delayS) { | 26339 | delaySetPopupVisible: function delaySetPopupVisible(visible, delayS) { |
22870 | var _this2 = this; | 26340 | var _this2 = this; |
22871 | 26341 | ||
22872 | var delay = delayS * 1000; | 26342 | var delay = delayS * 1000; |
22873 | if (this.delayTimer) { | 26343 | this.clearDelayTimer(); |
22874 | clearTimeout(this.delayTimer); | ||
22875 | this.delayTimer = null; | ||
22876 | } | ||
22877 | if (delay) { | 26344 | if (delay) { |
22878 | this.delayTimer = setTimeout(function () { | 26345 | this.delayTimer = setTimeout(function () { |
22879 | _this2.setPopupVisible(visible); | 26346 | _this2.setPopupVisible(visible); |
22880 | _this2.delayTimer = null; | 26347 | _this2.clearDelayTimer(); |
22881 | }, delay); | 26348 | }, delay); |
22882 | } else { | 26349 | } else { |
22883 | this.setPopupVisible(visible); | 26350 | this.setPopupVisible(visible); |
22884 | } | 26351 | } |
22885 | }, | 26352 | }, |
22886 | 26353 | clearDelayTimer: function clearDelayTimer() { | |
22887 | render: function render() { | 26354 | if (this.delayTimer) { |
22888 | this.popupRendered = this.popupRendered || this.state.popupVisible; | 26355 | clearTimeout(this.delayTimer); |
22889 | var props = this.props; | 26356 | this.delayTimer = null; |
22890 | var children = props.children; | ||
22891 | var child = _react2['default'].Children.only(children); | ||
22892 | var childProps = child.props || {}; | ||
22893 | var newChildProps = {}; | ||
22894 | var trigger = props.action; | ||
22895 | if (trigger.indexOf('click') !== -1) { | ||
22896 | newChildProps.onClick = (0, _rcUtil.createChainedFunction)(this.onClick, childProps.onClick); | ||
22897 | newChildProps.onMouseDown = (0, _rcUtil.createChainedFunction)(this.onMouseDown, childProps.onMouseDown); | ||
22898 | newChildProps.onTouchStart = (0, _rcUtil.createChainedFunction)(this.onTouchStart, childProps.onTouchStart); | ||
22899 | } | ||
22900 | if (trigger.indexOf('hover') !== -1) { | ||
22901 | newChildProps.onMouseEnter = (0, _rcUtil.createChainedFunction)(this.onMouseEnter, childProps.onMouseEnter); | ||
22902 | newChildProps.onMouseLeave = (0, _rcUtil.createChainedFunction)(this.onMouseLeave, childProps.onMouseLeave); | ||
22903 | } | ||
22904 | if (trigger.indexOf('focus') !== -1) { | ||
22905 | newChildProps.onFocus = (0, _rcUtil.createChainedFunction)(this.onFocus, childProps.onFocus); | ||
22906 | newChildProps.onBlur = (0, _rcUtil.createChainedFunction)(this.onBlur, childProps.onBlur); | ||
22907 | } | 26357 | } |
22908 | |||
22909 | return _react2['default'].cloneElement(child, newChildProps); | ||
22910 | } | ||
22911 | }); | ||
22912 | |||
22913 | exports['default'] = Trigger; | ||
22914 | module.exports = exports['default']; | ||
22915 | |||
22916 | /***/ }, | ||
22917 | /* 173 */ | ||
22918 | /***/ function(module, exports, __webpack_require__) { | ||
22919 | |||
22920 | 'use strict'; | ||
22921 | |||
22922 | module.exports = { | ||
22923 | guid: __webpack_require__(174), | ||
22924 | classSet: __webpack_require__(175), | ||
22925 | joinClasses: __webpack_require__(178), | ||
22926 | KeyCode: __webpack_require__(179), | ||
22927 | PureRenderMixin: __webpack_require__(180), | ||
22928 | shallowEqual: __webpack_require__(181), | ||
22929 | createChainedFunction: __webpack_require__(187), | ||
22930 | Dom: { | ||
22931 | addEventListener: __webpack_require__(188), | ||
22932 | contains: __webpack_require__(193) | ||
22933 | }, | 26358 | }, |
22934 | Children: { | 26359 | createTwoChains: function createTwoChains(event) { |
22935 | toArray: __webpack_require__(194), | 26360 | var childPros = this.props.children.props; |
22936 | mapSelf: __webpack_require__(195) | 26361 | var props = this.props; |
22937 | } | 26362 | if (childPros[event] && props[event]) { |
22938 | }; | 26363 | return this['fire' + event]; |
22939 | |||
22940 | /***/ }, | ||
22941 | /* 174 */ | ||
22942 | /***/ function(module, exports) { | ||
22943 | |||
22944 | 'use strict'; | ||
22945 | |||
22946 | var seed = 0; | ||
22947 | module.exports = function guid() { | ||
22948 | return Date.now() + '_' + seed++; | ||
22949 | }; | ||
22950 | |||
22951 | /***/ }, | ||
22952 | /* 175 */ | ||
22953 | /***/ function(module, exports, __webpack_require__) { | ||
22954 | |||
22955 | 'use strict'; | ||
22956 | |||
22957 | var deprecate = __webpack_require__(176); | ||
22958 | var classNames = __webpack_require__(177); | ||
22959 | |||
22960 | module.exports = deprecate(classNames, '`rcUtil.classSet()` is deprecated, use `classNames()` by `require(\'classnames\')` instead'); | ||
22961 | |||
22962 | /***/ }, | ||
22963 | /* 176 */ | ||
22964 | /***/ function(module, exports) { | ||
22965 | |||
22966 | /* WEBPACK VAR INJECTION */(function(global) { | ||
22967 | /** | ||
22968 | * Module exports. | ||
22969 | */ | ||
22970 | |||
22971 | module.exports = deprecate; | ||
22972 | |||
22973 | /** | ||
22974 | * Mark that a method should not be used. | ||
22975 | * Returns a modified function which warns once by default. | ||
22976 | * | ||
22977 | * If `localStorage.noDeprecation = true` is set, then it is a no-op. | ||
22978 | * | ||
22979 | * If `localStorage.throwDeprecation = true` is set, then deprecated functions | ||
22980 | * will throw an Error when invoked. | ||
22981 | * | ||
22982 | * If `localStorage.traceDeprecation = true` is set, then deprecated functions | ||
22983 | * will invoke `console.trace()` instead of `console.error()`. | ||
22984 | * | ||
22985 | * @param {Function} fn - the function to deprecate | ||
22986 | * @param {String} msg - the string to print to the console when `fn` is invoked | ||
22987 | * @returns {Function} a new "deprecated" version of `fn` | ||
22988 | * @api public | ||
22989 | */ | ||
22990 | |||
22991 | function deprecate (fn, msg) { | ||
22992 | if (config('noDeprecation')) { | ||
22993 | return fn; | ||
22994 | } | ||
22995 | |||
22996 | var warned = false; | ||
22997 | function deprecated() { | ||
22998 | if (!warned) { | ||
22999 | if (config('throwDeprecation')) { | ||
23000 | throw new Error(msg); | ||
23001 | } else if (config('traceDeprecation')) { | ||
23002 | console.trace(msg); | ||
23003 | } else { | ||
23004 | console.warn(msg); | ||
23005 | } | ||
23006 | warned = true; | ||
23007 | } | 26364 | } |
23008 | return fn.apply(this, arguments); | 26365 | return childPros[event] || props[event]; |
23009 | } | 26366 | }, |
23010 | 26367 | isClickToShow: function isClickToShow() { | |
23011 | return deprecated; | 26368 | var _props = this.props; |
23012 | } | 26369 | var action = _props.action; |
23013 | 26370 | var showAction = _props.showAction; | |
23014 | /** | ||
23015 | * Checks `localStorage` for boolean values for the given `name`. | ||
23016 | * | ||
23017 | * @param {String} name | ||
23018 | * @returns {Boolean} | ||
23019 | * @api private | ||
23020 | */ | ||
23021 | |||
23022 | function config (name) { | ||
23023 | // accessing global.localStorage can trigger a DOMException in sandboxed iframes | ||
23024 | try { | ||
23025 | if (!global.localStorage) return false; | ||
23026 | } catch (_) { | ||
23027 | return false; | ||
23028 | } | ||
23029 | var val = global.localStorage[name]; | ||
23030 | if (null == val) return false; | ||
23031 | return String(val).toLowerCase() === 'true'; | ||
23032 | } | ||
23033 | |||
23034 | /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) | ||
23035 | |||
23036 | /***/ }, | ||
23037 | /* 177 */ | ||
23038 | /***/ function(module, exports, __webpack_require__) { | ||
23039 | |||
23040 | var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! | ||
23041 | Copyright (c) 2015 Jed Watson. | ||
23042 | Licensed under the MIT License (MIT), see | ||
23043 | http://jedwatson.github.io/classnames | ||
23044 | */ | ||
23045 | /* global define */ | ||
23046 | |||
23047 | (function () { | ||
23048 | 'use strict'; | ||
23049 | |||
23050 | var hasOwn = {}.hasOwnProperty; | ||
23051 | |||
23052 | function classNames () { | ||
23053 | var classes = ''; | ||
23054 | |||
23055 | for (var i = 0; i < arguments.length; i++) { | ||
23056 | var arg = arguments[i]; | ||
23057 | if (!arg) continue; | ||
23058 | |||
23059 | var argType = typeof arg; | ||
23060 | |||
23061 | if (argType === 'string' || argType === 'number') { | ||
23062 | classes += ' ' + arg; | ||
23063 | } else if (Array.isArray(arg)) { | ||
23064 | classes += ' ' + classNames.apply(null, arg); | ||
23065 | } else if (argType === 'object') { | ||
23066 | for (var key in arg) { | ||
23067 | if (hasOwn.call(arg, key) && arg[key]) { | ||
23068 | classes += ' ' + key; | ||
23069 | } | ||
23070 | } | ||
23071 | } | ||
23072 | } | ||
23073 | |||
23074 | return classes.substr(1); | ||
23075 | } | ||
23076 | |||
23077 | if (typeof module !== 'undefined' && module.exports) { | ||
23078 | module.exports = classNames; | ||
23079 | } else if (true) { | ||
23080 | // register as 'classnames', consistent with npm package name | ||
23081 | !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () { | ||
23082 | return classNames; | ||
23083 | }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); | ||
23084 | } else { | ||
23085 | window.classNames = classNames; | ||
23086 | } | ||
23087 | }()); | ||
23088 | |||
23089 | |||
23090 | /***/ }, | ||
23091 | /* 178 */ | ||
23092 | /***/ function(module, exports, __webpack_require__) { | ||
23093 | |||
23094 | 'use strict'; | ||
23095 | |||
23096 | var deprecate = __webpack_require__(176); | ||
23097 | var classNames = __webpack_require__(177); | ||
23098 | |||
23099 | module.exports = deprecate(classNames, '`rcUtil.joinClasses()` is deprecated, use `classNames()` by `require(\'classnames\')` instead'); | ||
23100 | |||
23101 | /***/ }, | ||
23102 | /* 179 */ | ||
23103 | /***/ function(module, exports) { | ||
23104 | |||
23105 | /** | ||
23106 | * @ignore | ||
23107 | * some key-codes definition and utils from closure-library | ||
23108 | * @author yiminghe@gmail.com | ||
23109 | */ | ||
23110 | |||
23111 | 'use strict'; | ||
23112 | |||
23113 | var KeyCode = { | ||
23114 | /** | ||
23115 | * MAC_ENTER | ||
23116 | */ | ||
23117 | MAC_ENTER: 3, | ||
23118 | /** | ||
23119 | * BACKSPACE | ||
23120 | */ | ||
23121 | BACKSPACE: 8, | ||
23122 | /** | ||
23123 | * TAB | ||
23124 | */ | ||
23125 | TAB: 9, | ||
23126 | /** | ||
23127 | * NUMLOCK on FF/Safari Mac | ||
23128 | */ | ||
23129 | NUM_CENTER: 12, // NUMLOCK on FF/Safari Mac | ||
23130 | /** | ||
23131 | * ENTER | ||
23132 | */ | ||
23133 | ENTER: 13, | ||
23134 | /** | ||
23135 | * SHIFT | ||
23136 | */ | ||
23137 | SHIFT: 16, | ||
23138 | /** | ||
23139 | * CTRL | ||
23140 | */ | ||
23141 | CTRL: 17, | ||
23142 | /** | ||
23143 | * ALT | ||
23144 | */ | ||
23145 | ALT: 18, | ||
23146 | /** | ||
23147 | * PAUSE | ||
23148 | */ | ||
23149 | PAUSE: 19, | ||
23150 | /** | ||
23151 | * CAPS_LOCK | ||
23152 | */ | ||
23153 | CAPS_LOCK: 20, | ||
23154 | /** | ||
23155 | * ESC | ||
23156 | */ | ||
23157 | ESC: 27, | ||
23158 | /** | ||
23159 | * SPACE | ||
23160 | */ | ||
23161 | SPACE: 32, | ||
23162 | /** | ||
23163 | * PAGE_UP | ||
23164 | */ | ||
23165 | PAGE_UP: 33, // also NUM_NORTH_EAST | ||
23166 | /** | ||
23167 | * PAGE_DOWN | ||
23168 | */ | ||
23169 | PAGE_DOWN: 34, // also NUM_SOUTH_EAST | ||
23170 | /** | ||
23171 | * END | ||
23172 | */ | ||
23173 | END: 35, // also NUM_SOUTH_WEST | ||
23174 | /** | ||
23175 | * HOME | ||
23176 | */ | ||
23177 | HOME: 36, // also NUM_NORTH_WEST | ||
23178 | /** | ||
23179 | * LEFT | ||
23180 | */ | ||
23181 | LEFT: 37, // also NUM_WEST | ||
23182 | /** | ||
23183 | * UP | ||
23184 | */ | ||
23185 | UP: 38, // also NUM_NORTH | ||
23186 | /** | ||
23187 | * RIGHT | ||
23188 | */ | ||
23189 | RIGHT: 39, // also NUM_EAST | ||
23190 | /** | ||
23191 | * DOWN | ||
23192 | */ | ||
23193 | DOWN: 40, // also NUM_SOUTH | ||
23194 | /** | ||
23195 | * PRINT_SCREEN | ||
23196 | */ | ||
23197 | PRINT_SCREEN: 44, | ||
23198 | /** | ||
23199 | * INSERT | ||
23200 | */ | ||
23201 | INSERT: 45, // also NUM_INSERT | ||
23202 | /** | ||
23203 | * DELETE | ||
23204 | */ | ||
23205 | DELETE: 46, // also NUM_DELETE | ||
23206 | /** | ||
23207 | * ZERO | ||
23208 | */ | ||
23209 | ZERO: 48, | ||
23210 | /** | ||
23211 | * ONE | ||
23212 | */ | ||
23213 | ONE: 49, | ||
23214 | /** | ||
23215 | * TWO | ||
23216 | */ | ||
23217 | TWO: 50, | ||
23218 | /** | ||
23219 | * THREE | ||
23220 | */ | ||
23221 | THREE: 51, | ||
23222 | /** | ||
23223 | * FOUR | ||
23224 | */ | ||
23225 | FOUR: 52, | ||
23226 | /** | ||
23227 | * FIVE | ||
23228 | */ | ||
23229 | FIVE: 53, | ||
23230 | /** | ||
23231 | * SIX | ||
23232 | */ | ||
23233 | SIX: 54, | ||
23234 | /** | ||
23235 | * SEVEN | ||
23236 | */ | ||
23237 | SEVEN: 55, | ||
23238 | /** | ||
23239 | * EIGHT | ||
23240 | */ | ||
23241 | EIGHT: 56, | ||
23242 | /** | ||
23243 | * NINE | ||
23244 | */ | ||
23245 | NINE: 57, | ||
23246 | /** | ||
23247 | * QUESTION_MARK | ||
23248 | */ | ||
23249 | QUESTION_MARK: 63, // needs localization | ||
23250 | /** | ||
23251 | * A | ||
23252 | */ | ||
23253 | A: 65, | ||
23254 | /** | ||
23255 | * B | ||
23256 | */ | ||
23257 | B: 66, | ||
23258 | /** | ||
23259 | * C | ||
23260 | */ | ||
23261 | C: 67, | ||
23262 | /** | ||
23263 | * D | ||
23264 | */ | ||
23265 | D: 68, | ||
23266 | /** | ||
23267 | * E | ||
23268 | */ | ||
23269 | E: 69, | ||
23270 | /** | ||
23271 | * F | ||
23272 | */ | ||
23273 | F: 70, | ||
23274 | /** | ||
23275 | * G | ||
23276 | */ | ||
23277 | G: 71, | ||
23278 | /** | ||
23279 | * H | ||
23280 | */ | ||
23281 | H: 72, | ||
23282 | /** | ||
23283 | * I | ||
23284 | */ | ||
23285 | I: 73, | ||
23286 | /** | ||
23287 | * J | ||
23288 | */ | ||
23289 | J: 74, | ||
23290 | /** | ||
23291 | * K | ||
23292 | */ | ||
23293 | K: 75, | ||
23294 | /** | ||
23295 | * L | ||
23296 | */ | ||
23297 | L: 76, | ||
23298 | /** | ||
23299 | * M | ||
23300 | */ | ||
23301 | M: 77, | ||
23302 | /** | ||
23303 | * N | ||
23304 | */ | ||
23305 | N: 78, | ||
23306 | /** | ||
23307 | * O | ||
23308 | */ | ||
23309 | O: 79, | ||
23310 | /** | ||
23311 | * P | ||
23312 | */ | ||
23313 | P: 80, | ||
23314 | /** | ||
23315 | * Q | ||
23316 | */ | ||
23317 | Q: 81, | ||
23318 | /** | ||
23319 | * R | ||
23320 | */ | ||
23321 | R: 82, | ||
23322 | /** | ||
23323 | * S | ||
23324 | */ | ||
23325 | S: 83, | ||
23326 | /** | ||
23327 | * T | ||
23328 | */ | ||
23329 | T: 84, | ||
23330 | /** | ||
23331 | * U | ||
23332 | */ | ||
23333 | U: 85, | ||
23334 | /** | ||
23335 | * V | ||
23336 | */ | ||
23337 | V: 86, | ||
23338 | /** | ||
23339 | * W | ||
23340 | */ | ||
23341 | W: 87, | ||
23342 | /** | ||
23343 | * X | ||
23344 | */ | ||
23345 | X: 88, | ||
23346 | /** | ||
23347 | * Y | ||
23348 | */ | ||
23349 | Y: 89, | ||
23350 | /** | ||
23351 | * Z | ||
23352 | */ | ||
23353 | Z: 90, | ||
23354 | /** | ||
23355 | * META | ||
23356 | */ | ||
23357 | META: 91, // WIN_KEY_LEFT | ||
23358 | /** | ||
23359 | * WIN_KEY_RIGHT | ||
23360 | */ | ||
23361 | WIN_KEY_RIGHT: 92, | ||
23362 | /** | ||
23363 | * CONTEXT_MENU | ||
23364 | */ | ||
23365 | CONTEXT_MENU: 93, | ||
23366 | /** | ||
23367 | * NUM_ZERO | ||
23368 | */ | ||
23369 | NUM_ZERO: 96, | ||
23370 | /** | ||
23371 | * NUM_ONE | ||
23372 | */ | ||
23373 | NUM_ONE: 97, | ||
23374 | /** | ||
23375 | * NUM_TWO | ||
23376 | */ | ||
23377 | NUM_TWO: 98, | ||
23378 | /** | ||
23379 | * NUM_THREE | ||
23380 | */ | ||
23381 | NUM_THREE: 99, | ||
23382 | /** | ||
23383 | * NUM_FOUR | ||
23384 | */ | ||
23385 | NUM_FOUR: 100, | ||
23386 | /** | ||
23387 | * NUM_FIVE | ||
23388 | */ | ||
23389 | NUM_FIVE: 101, | ||
23390 | /** | ||
23391 | * NUM_SIX | ||
23392 | */ | ||
23393 | NUM_SIX: 102, | ||
23394 | /** | ||
23395 | * NUM_SEVEN | ||
23396 | */ | ||
23397 | NUM_SEVEN: 103, | ||
23398 | /** | ||
23399 | * NUM_EIGHT | ||
23400 | */ | ||
23401 | NUM_EIGHT: 104, | ||
23402 | /** | ||
23403 | * NUM_NINE | ||
23404 | */ | ||
23405 | NUM_NINE: 105, | ||
23406 | /** | ||
23407 | * NUM_MULTIPLY | ||
23408 | */ | ||
23409 | NUM_MULTIPLY: 106, | ||
23410 | /** | ||
23411 | * NUM_PLUS | ||
23412 | */ | ||
23413 | NUM_PLUS: 107, | ||
23414 | /** | ||
23415 | * NUM_MINUS | ||
23416 | */ | ||
23417 | NUM_MINUS: 109, | ||
23418 | /** | ||
23419 | * NUM_PERIOD | ||
23420 | */ | ||
23421 | NUM_PERIOD: 110, | ||
23422 | /** | ||
23423 | * NUM_DIVISION | ||
23424 | */ | ||
23425 | NUM_DIVISION: 111, | ||
23426 | /** | ||
23427 | * F1 | ||
23428 | */ | ||
23429 | F1: 112, | ||
23430 | /** | ||
23431 | * F2 | ||
23432 | */ | ||
23433 | F2: 113, | ||
23434 | /** | ||
23435 | * F3 | ||
23436 | */ | ||
23437 | F3: 114, | ||
23438 | /** | ||
23439 | * F4 | ||
23440 | */ | ||
23441 | F4: 115, | ||
23442 | /** | ||
23443 | * F5 | ||
23444 | */ | ||
23445 | F5: 116, | ||
23446 | /** | ||
23447 | * F6 | ||
23448 | */ | ||
23449 | F6: 117, | ||
23450 | /** | ||
23451 | * F7 | ||
23452 | */ | ||
23453 | F7: 118, | ||
23454 | /** | ||
23455 | * F8 | ||
23456 | */ | ||
23457 | F8: 119, | ||
23458 | /** | ||
23459 | * F9 | ||
23460 | */ | ||
23461 | F9: 120, | ||
23462 | /** | ||
23463 | * F10 | ||
23464 | */ | ||
23465 | F10: 121, | ||
23466 | /** | ||
23467 | * F11 | ||
23468 | */ | ||
23469 | F11: 122, | ||
23470 | /** | ||
23471 | * F12 | ||
23472 | */ | ||
23473 | F12: 123, | ||
23474 | /** | ||
23475 | * NUMLOCK | ||
23476 | */ | ||
23477 | NUMLOCK: 144, | ||
23478 | /** | ||
23479 | * SEMICOLON | ||
23480 | */ | ||
23481 | SEMICOLON: 186, // needs localization | ||
23482 | /** | ||
23483 | * DASH | ||
23484 | */ | ||
23485 | DASH: 189, // needs localization | ||
23486 | /** | ||
23487 | * EQUALS | ||
23488 | */ | ||
23489 | EQUALS: 187, // needs localization | ||
23490 | /** | ||
23491 | * COMMA | ||
23492 | */ | ||
23493 | COMMA: 188, // needs localization | ||
23494 | /** | ||
23495 | * PERIOD | ||
23496 | */ | ||
23497 | PERIOD: 190, // needs localization | ||
23498 | /** | ||
23499 | * SLASH | ||
23500 | */ | ||
23501 | SLASH: 191, // needs localization | ||
23502 | /** | ||
23503 | * APOSTROPHE | ||
23504 | */ | ||
23505 | APOSTROPHE: 192, // needs localization | ||
23506 | /** | ||
23507 | * SINGLE_QUOTE | ||
23508 | */ | ||
23509 | SINGLE_QUOTE: 222, // needs localization | ||
23510 | /** | ||
23511 | * OPEN_SQUARE_BRACKET | ||
23512 | */ | ||
23513 | OPEN_SQUARE_BRACKET: 219, // needs localization | ||
23514 | /** | ||
23515 | * BACKSLASH | ||
23516 | */ | ||
23517 | BACKSLASH: 220, // needs localization | ||
23518 | /** | ||
23519 | * CLOSE_SQUARE_BRACKET | ||
23520 | */ | ||
23521 | CLOSE_SQUARE_BRACKET: 221, // needs localization | ||
23522 | /** | ||
23523 | * WIN_KEY | ||
23524 | */ | ||
23525 | WIN_KEY: 224, | ||
23526 | /** | ||
23527 | * MAC_FF_META | ||
23528 | */ | ||
23529 | MAC_FF_META: 224, // Firefox (Gecko) fires this for the meta key instead of 91 | ||
23530 | /** | ||
23531 | * WIN_IME | ||
23532 | */ | ||
23533 | WIN_IME: 229 | ||
23534 | }; | ||
23535 | |||
23536 | /* | ||
23537 | whether text and modified key is entered at the same time. | ||
23538 | */ | ||
23539 | KeyCode.isTextModifyingKeyEvent = function isTextModifyingKeyEvent(e) { | ||
23540 | var keyCode = e.keyCode; | ||
23541 | if (e.altKey && !e.ctrlKey || e.metaKey || | ||
23542 | // Function keys don't generate text | ||
23543 | keyCode >= KeyCode.F1 && keyCode <= KeyCode.F12) { | ||
23544 | return false; | ||
23545 | } | ||
23546 | |||
23547 | // The following keys are quite harmless, even in combination with | ||
23548 | // CTRL, ALT or SHIFT. | ||
23549 | switch (keyCode) { | ||
23550 | case KeyCode.ALT: | ||
23551 | case KeyCode.CAPS_LOCK: | ||
23552 | case KeyCode.CONTEXT_MENU: | ||
23553 | case KeyCode.CTRL: | ||
23554 | case KeyCode.DOWN: | ||
23555 | case KeyCode.END: | ||
23556 | case KeyCode.ESC: | ||
23557 | case KeyCode.HOME: | ||
23558 | case KeyCode.INSERT: | ||
23559 | case KeyCode.LEFT: | ||
23560 | case KeyCode.MAC_FF_META: | ||
23561 | case KeyCode.META: | ||
23562 | case KeyCode.NUMLOCK: | ||
23563 | case KeyCode.NUM_CENTER: | ||
23564 | case KeyCode.PAGE_DOWN: | ||
23565 | case KeyCode.PAGE_UP: | ||
23566 | case KeyCode.PAUSE: | ||
23567 | case KeyCode.PRINT_SCREEN: | ||
23568 | case KeyCode.RIGHT: | ||
23569 | case KeyCode.SHIFT: | ||
23570 | case KeyCode.UP: | ||
23571 | case KeyCode.WIN_KEY: | ||
23572 | case KeyCode.WIN_KEY_RIGHT: | ||
23573 | return false; | ||
23574 | default: | ||
23575 | return true; | ||
23576 | } | ||
23577 | }; | ||
23578 | |||
23579 | /* | ||
23580 | whether character is entered. | ||
23581 | */ | ||
23582 | KeyCode.isCharacterKey = function isCharacterKey(keyCode) { | ||
23583 | if (keyCode >= KeyCode.ZERO && keyCode <= KeyCode.NINE) { | ||
23584 | return true; | ||
23585 | } | ||
23586 | |||
23587 | if (keyCode >= KeyCode.NUM_ZERO && keyCode <= KeyCode.NUM_MULTIPLY) { | ||
23588 | return true; | ||
23589 | } | ||
23590 | |||
23591 | if (keyCode >= KeyCode.A && keyCode <= KeyCode.Z) { | ||
23592 | return true; | ||
23593 | } | ||
23594 | |||
23595 | // Safari sends zero key code for non-latin characters. | ||
23596 | if (window.navigation.userAgent.indexOf('WebKit') !== -1 && keyCode === 0) { | ||
23597 | return true; | ||
23598 | } | ||
23599 | |||
23600 | switch (keyCode) { | ||
23601 | case KeyCode.SPACE: | ||
23602 | case KeyCode.QUESTION_MARK: | ||
23603 | case KeyCode.NUM_PLUS: | ||
23604 | case KeyCode.NUM_MINUS: | ||
23605 | case KeyCode.NUM_PERIOD: | ||
23606 | case KeyCode.NUM_DIVISION: | ||
23607 | case KeyCode.SEMICOLON: | ||
23608 | case KeyCode.DASH: | ||
23609 | case KeyCode.EQUALS: | ||
23610 | case KeyCode.COMMA: | ||
23611 | case KeyCode.PERIOD: | ||
23612 | case KeyCode.SLASH: | ||
23613 | case KeyCode.APOSTROPHE: | ||
23614 | case KeyCode.SINGLE_QUOTE: | ||
23615 | case KeyCode.OPEN_SQUARE_BRACKET: | ||
23616 | case KeyCode.BACKSLASH: | ||
23617 | case KeyCode.CLOSE_SQUARE_BRACKET: | ||
23618 | return true; | ||
23619 | default: | ||
23620 | return false; | ||
23621 | } | ||
23622 | }; | ||
23623 | |||
23624 | module.exports = KeyCode; | ||
23625 | |||
23626 | /***/ }, | ||
23627 | /* 180 */ | ||
23628 | /***/ function(module, exports, __webpack_require__) { | ||
23629 | |||
23630 | 'use strict'; | ||
23631 | |||
23632 | var shallowEqual = __webpack_require__(181); | ||
23633 | |||
23634 | /** | ||
23635 | * If your React component's render function is "pure", e.g. it will render the | ||
23636 | * same result given the same props and state, provide this Mixin for a | ||
23637 | * considerable performance boost. | ||
23638 | * | ||
23639 | * Most React components have pure render functions. | ||
23640 | * | ||
23641 | * Example: | ||
23642 | * | ||
23643 | * const ReactComponentWithPureRenderMixin = | ||
23644 | * require('ReactComponentWithPureRenderMixin'); | ||
23645 | * React.createClass({ | ||
23646 | * mixins: [ReactComponentWithPureRenderMixin], | ||
23647 | * | ||
23648 | * render: function() { | ||
23649 | * return <div className={this.props.className}>foo</div>; | ||
23650 | * } | ||
23651 | * }); | ||
23652 | * | ||
23653 | * Note: This only checks shallow equality for props and state. If these contain | ||
23654 | * complex data structures this mixin may have false-negatives for deeper | ||
23655 | * differences. Only mixin to components which have simple props and state, or | ||
23656 | * use `forceUpdate()` when you know deep data structures have changed. | ||
23657 | */ | ||
23658 | var ReactComponentWithPureRenderMixin = { | ||
23659 | shouldComponentUpdate: function shouldComponentUpdate(nextProps, nextState) { | ||
23660 | return !shallowEqual(this.props, nextProps) || !shallowEqual(this.state, nextState); | ||
23661 | } | ||
23662 | }; | ||
23663 | |||
23664 | module.exports = ReactComponentWithPureRenderMixin; | ||
23665 | |||
23666 | /***/ }, | ||
23667 | /* 181 */ | ||
23668 | /***/ function(module, exports, __webpack_require__) { | ||
23669 | |||
23670 | 'use strict'; | ||
23671 | 26371 | ||
23672 | var shallowEqual = __webpack_require__(182); | 26372 | return action.indexOf('click') !== -1 || showAction.indexOf('click') !== -1; |
26373 | }, | ||
26374 | isClickToHide: function isClickToHide() { | ||
26375 | var _props2 = this.props; | ||
26376 | var action = _props2.action; | ||
26377 | var hideAction = _props2.hideAction; | ||
23673 | 26378 | ||
23674 | module.exports = shallowEqual; | 26379 | return action.indexOf('click') !== -1 || hideAction.indexOf('click') !== -1; |
23675 | 26380 | }, | |
23676 | /***/ }, | 26381 | isMouseEnterToShow: function isMouseEnterToShow() { |
23677 | /* 182 */ | 26382 | var _props3 = this.props; |
23678 | /***/ function(module, exports, __webpack_require__) { | 26383 | var action = _props3.action; |
23679 | 26384 | var showAction = _props3.showAction; | |
23680 | 'use strict'; | ||
23681 | 26385 | ||
23682 | var fetchKeys = __webpack_require__(183); | 26386 | return action.indexOf('hover') !== -1 || showAction.indexOf('mouseEnter') !== -1; |
26387 | }, | ||
26388 | isMouseLeaveToHide: function isMouseLeaveToHide() { | ||
26389 | var _props4 = this.props; | ||
26390 | var action = _props4.action; | ||
26391 | var hideAction = _props4.hideAction; | ||
23683 | 26392 | ||
23684 | module.exports = function shallowEqual(objA, objB, compare, compareContext) { | 26393 | return action.indexOf('hover') !== -1 || hideAction.indexOf('mouseLeave') !== -1; |
26394 | }, | ||
26395 | isFocusToShow: function isFocusToShow() { | ||
26396 | var _props5 = this.props; | ||
26397 | var action = _props5.action; | ||
26398 | var showAction = _props5.showAction; | ||
23685 | 26399 | ||
23686 | var ret = compare ? compare.call(compareContext, objA, objB) : void 0; | 26400 | return action.indexOf('focus') !== -1 || showAction.indexOf('focus') !== -1; |
26401 | }, | ||
26402 | isBlurToHide: function isBlurToHide() { | ||
26403 | var _props6 = this.props; | ||
26404 | var action = _props6.action; | ||
26405 | var hideAction = _props6.hideAction; | ||
23687 | 26406 | ||
23688 | if (ret !== void 0) { | 26407 | return action.indexOf('focus') !== -1 || hideAction.indexOf('blur') !== -1; |
23689 | return !!ret; | 26408 | }, |
26409 | forcePopupAlign: function forcePopupAlign() { | ||
26410 | if (this.state.popupVisible && this.popupInstance && this.popupInstance.alignInstance) { | ||
26411 | this.popupInstance.alignInstance.forceAlign(); | ||
23690 | } | 26412 | } |
23691 | 26413 | }, | |
23692 | if (objA === objB) { | 26414 | fireEvents: function fireEvents(type, e) { |
23693 | return true; | 26415 | var childCallback = this.props.children.props[type]; |
26416 | if (childCallback) { | ||
26417 | childCallback(e); | ||
23694 | } | 26418 | } |
23695 | 26419 | var callback = this.props[type]; | |
23696 | if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) { | 26420 | if (callback) { |
23697 | return false; | 26421 | callback(e); |
23698 | } | 26422 | } |
26423 | }, | ||
26424 | render: function render() { | ||
26425 | var props = this.props; | ||
26426 | var children = props.children; | ||
26427 | var child = _react2["default"].Children.only(children); | ||
26428 | var newChildProps = {}; | ||
23699 | 26429 | ||
23700 | var keysA = fetchKeys(objA); | 26430 | if (this.isClickToHide() || this.isClickToShow()) { |
23701 | var keysB = fetchKeys(objB); | 26431 | newChildProps.onClick = this.onClick; |
23702 | 26432 | newChildProps.onMouseDown = this.onMouseDown; | |
23703 | var len = keysA.length; | 26433 | newChildProps.onTouchStart = this.onTouchStart; |
23704 | if (len !== keysB.length) { | 26434 | } else { |
23705 | return false; | 26435 | newChildProps.onClick = this.createTwoChains('onClick'); |
26436 | newChildProps.onMouseDown = this.createTwoChains('onMouseDown'); | ||
26437 | newChildProps.onTouchStart = this.createTwoChains('onTouchStart'); | ||
23706 | } | 26438 | } |
23707 | 26439 | if (this.isMouseEnterToShow()) { | |
23708 | compareContext = compareContext || null; | 26440 | newChildProps.onMouseEnter = this.onMouseEnter; |
23709 | 26441 | } else { | |
23710 | // Test for A's keys different from B. | 26442 | newChildProps.onMouseEnter = this.createTwoChains('onMouseEnter'); |
23711 | var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB); | ||
23712 | for (var i = 0; i < len; i++) { | ||
23713 | var key = keysA[i]; | ||
23714 | if (!bHasOwnProperty(key)) { | ||
23715 | return false; | ||
23716 | } | ||
23717 | var valueA = objA[key]; | ||
23718 | var valueB = objB[key]; | ||
23719 | |||
23720 | var _ret = compare ? compare.call(compareContext, valueA, valueB, key) : void 0; | ||
23721 | if (_ret === false || _ret === void 0 && valueA !== valueB) { | ||
23722 | return false; | ||
23723 | } | ||
23724 | } | 26443 | } |
23725 | 26444 | if (this.isMouseLeaveToHide()) { | |
23726 | return true; | 26445 | newChildProps.onMouseLeave = this.onMouseLeave; |
23727 | }; | 26446 | } else { |
23728 | 26447 | newChildProps.onMouseLeave = this.createTwoChains('onMouseLeave'); | |
23729 | /***/ }, | ||
23730 | /* 183 */ | ||
23731 | /***/ function(module, exports, __webpack_require__) { | ||
23732 | |||
23733 | /** | ||
23734 | * lodash 3.1.2 (Custom Build) <https://lodash.com/> | ||
23735 | * Build: `lodash modern modularize exports="npm" -o ./` | ||
23736 | * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> | ||
23737 | * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> | ||
23738 | * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | ||
23739 | * Available under MIT license <https://lodash.com/license> | ||
23740 | */ | ||
23741 | var getNative = __webpack_require__(184), | ||
23742 | isArguments = __webpack_require__(185), | ||
23743 | isArray = __webpack_require__(186); | ||
23744 | |||
23745 | /** Used to detect unsigned integer values. */ | ||
23746 | var reIsUint = /^\d+$/; | ||
23747 | |||
23748 | /** Used for native method references. */ | ||
23749 | var objectProto = Object.prototype; | ||
23750 | |||
23751 | /** Used to check objects for own properties. */ | ||
23752 | var hasOwnProperty = objectProto.hasOwnProperty; | ||
23753 | |||
23754 | /* Native method references for those with the same name as other `lodash` methods. */ | ||
23755 | var nativeKeys = getNative(Object, 'keys'); | ||
23756 | |||
23757 | /** | ||
23758 | * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) | ||
23759 | * of an array-like value. | ||
23760 | */ | ||
23761 | var MAX_SAFE_INTEGER = 9007199254740991; | ||
23762 | |||
23763 | /** | ||
23764 | * The base implementation of `_.property` without support for deep paths. | ||
23765 | * | ||
23766 | * @private | ||
23767 | * @param {string} key The key of the property to get. | ||
23768 | * @returns {Function} Returns the new function. | ||
23769 | */ | ||
23770 | function baseProperty(key) { | ||
23771 | return function(object) { | ||
23772 | return object == null ? undefined : object[key]; | ||
23773 | }; | ||
23774 | } | ||
23775 | |||
23776 | /** | ||
23777 | * Gets the "length" property value of `object`. | ||
23778 | * | ||
23779 | * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) | ||
23780 | * that affects Safari on at least iOS 8.1-8.3 ARM64. | ||
23781 | * | ||
23782 | * @private | ||
23783 | * @param {Object} object The object to query. | ||
23784 | * @returns {*} Returns the "length" value. | ||
23785 | */ | ||
23786 | var getLength = baseProperty('length'); | ||
23787 | |||
23788 | /** | ||
23789 | * Checks if `value` is array-like. | ||
23790 | * | ||
23791 | * @private | ||
23792 | * @param {*} value The value to check. | ||
23793 | * @returns {boolean} Returns `true` if `value` is array-like, else `false`. | ||
23794 | */ | ||
23795 | function isArrayLike(value) { | ||
23796 | return value != null && isLength(getLength(value)); | ||
23797 | } | ||
23798 | |||
23799 | /** | ||
23800 | * Checks if `value` is a valid array-like index. | ||
23801 | * | ||
23802 | * @private | ||
23803 | * @param {*} value The value to check. | ||
23804 | * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. | ||
23805 | * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. | ||
23806 | */ | ||
23807 | function isIndex(value, length) { | ||
23808 | value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1; | ||
23809 | length = length == null ? MAX_SAFE_INTEGER : length; | ||
23810 | return value > -1 && value % 1 == 0 && value < length; | ||
23811 | } | ||
23812 | |||
23813 | /** | ||
23814 | * Checks if `value` is a valid array-like length. | ||
23815 | * | ||
23816 | * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). | ||
23817 | * | ||
23818 | * @private | ||
23819 | * @param {*} value The value to check. | ||
23820 | * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. | ||
23821 | */ | ||
23822 | function isLength(value) { | ||
23823 | return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; | ||
23824 | } | ||
23825 | |||
23826 | /** | ||
23827 | * A fallback implementation of `Object.keys` which creates an array of the | ||
23828 | * own enumerable property names of `object`. | ||
23829 | * | ||
23830 | * @private | ||
23831 | * @param {Object} object The object to query. | ||
23832 | * @returns {Array} Returns the array of property names. | ||
23833 | */ | ||
23834 | function shimKeys(object) { | ||
23835 | var props = keysIn(object), | ||
23836 | propsLength = props.length, | ||
23837 | length = propsLength && object.length; | ||
23838 | |||
23839 | var allowIndexes = !!length && isLength(length) && | ||
23840 | (isArray(object) || isArguments(object)); | ||
23841 | |||
23842 | var index = -1, | ||
23843 | result = []; | ||
23844 | |||
23845 | while (++index < propsLength) { | ||
23846 | var key = props[index]; | ||
23847 | if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) { | ||
23848 | result.push(key); | ||
23849 | } | 26448 | } |
23850 | } | 26449 | if (this.isFocusToShow() || this.isBlurToHide()) { |
23851 | return result; | 26450 | newChildProps.onFocus = this.onFocus; |
23852 | } | 26451 | newChildProps.onBlur = this.onBlur; |
23853 | 26452 | } else { | |
23854 | /** | 26453 | newChildProps.onFocus = this.createTwoChains('onFocus'); |
23855 | * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. | 26454 | newChildProps.onBlur = this.createTwoChains('onBlur'); |
23856 | * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) | ||
23857 | * | ||
23858 | * @static | ||
23859 | * @memberOf _ | ||
23860 | * @category Lang | ||
23861 | * @param {*} value The value to check. | ||
23862 | * @returns {boolean} Returns `true` if `value` is an object, else `false`. | ||
23863 | * @example | ||
23864 | * | ||
23865 | * _.isObject({}); | ||
23866 | * // => true | ||
23867 | * | ||
23868 | * _.isObject([1, 2, 3]); | ||
23869 | * // => true | ||
23870 | * | ||
23871 | * _.isObject(1); | ||
23872 | * // => false | ||
23873 | */ | ||
23874 | function isObject(value) { | ||
23875 | // Avoid a V8 JIT bug in Chrome 19-20. | ||
23876 | // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. | ||
23877 | var type = typeof value; | ||
23878 | return !!value && (type == 'object' || type == 'function'); | ||
23879 | } | ||
23880 | |||
23881 | /** | ||
23882 | * Creates an array of the own enumerable property names of `object`. | ||
23883 | * | ||
23884 | * **Note:** Non-object values are coerced to objects. See the | ||
23885 | * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys) | ||
23886 | * for more details. | ||
23887 | * | ||
23888 | * @static | ||
23889 | * @memberOf _ | ||
23890 | * @category Object | ||
23891 | * @param {Object} object The object to query. | ||
23892 | * @returns {Array} Returns the array of property names. | ||
23893 | * @example | ||
23894 | * | ||
23895 | * function Foo() { | ||
23896 | * this.a = 1; | ||
23897 | * this.b = 2; | ||
23898 | * } | ||
23899 | * | ||
23900 | * Foo.prototype.c = 3; | ||
23901 | * | ||
23902 | * _.keys(new Foo); | ||
23903 | * // => ['a', 'b'] (iteration order is not guaranteed) | ||
23904 | * | ||
23905 | * _.keys('hi'); | ||
23906 | * // => ['0', '1'] | ||
23907 | */ | ||
23908 | var keys = !nativeKeys ? shimKeys : function(object) { | ||
23909 | var Ctor = object == null ? undefined : object.constructor; | ||
23910 | if ((typeof Ctor == 'function' && Ctor.prototype === object) || | ||
23911 | (typeof object != 'function' && isArrayLike(object))) { | ||
23912 | return shimKeys(object); | ||
23913 | } | ||
23914 | return isObject(object) ? nativeKeys(object) : []; | ||
23915 | }; | ||
23916 | |||
23917 | /** | ||
23918 | * Creates an array of the own and inherited enumerable property names of `object`. | ||
23919 | * | ||
23920 | * **Note:** Non-object values are coerced to objects. | ||
23921 | * | ||
23922 | * @static | ||
23923 | * @memberOf _ | ||
23924 | * @category Object | ||
23925 | * @param {Object} object The object to query. | ||
23926 | * @returns {Array} Returns the array of property names. | ||
23927 | * @example | ||
23928 | * | ||
23929 | * function Foo() { | ||
23930 | * this.a = 1; | ||
23931 | * this.b = 2; | ||
23932 | * } | ||
23933 | * | ||
23934 | * Foo.prototype.c = 3; | ||
23935 | * | ||
23936 | * _.keysIn(new Foo); | ||
23937 | * // => ['a', 'b', 'c'] (iteration order is not guaranteed) | ||
23938 | */ | ||
23939 | function keysIn(object) { | ||
23940 | if (object == null) { | ||
23941 | return []; | ||
23942 | } | ||
23943 | if (!isObject(object)) { | ||
23944 | object = Object(object); | ||
23945 | } | ||
23946 | var length = object.length; | ||
23947 | length = (length && isLength(length) && | ||
23948 | (isArray(object) || isArguments(object)) && length) || 0; | ||
23949 | |||
23950 | var Ctor = object.constructor, | ||
23951 | index = -1, | ||
23952 | isProto = typeof Ctor == 'function' && Ctor.prototype === object, | ||
23953 | result = Array(length), | ||
23954 | skipIndexes = length > 0; | ||
23955 | |||
23956 | while (++index < length) { | ||
23957 | result[index] = (index + ''); | ||
23958 | } | ||
23959 | for (var key in object) { | ||
23960 | if (!(skipIndexes && isIndex(key, length)) && | ||
23961 | !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { | ||
23962 | result.push(key); | ||
23963 | } | 26455 | } |
23964 | } | ||
23965 | return result; | ||
23966 | } | ||
23967 | |||
23968 | module.exports = keys; | ||
23969 | |||
23970 | |||
23971 | /***/ }, | ||
23972 | /* 184 */ | ||
23973 | /***/ function(module, exports) { | ||
23974 | |||
23975 | /** | ||
23976 | * lodash 3.9.1 (Custom Build) <https://lodash.com/> | ||
23977 | * Build: `lodash modern modularize exports="npm" -o ./` | ||
23978 | * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> | ||
23979 | * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> | ||
23980 | * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | ||
23981 | * Available under MIT license <https://lodash.com/license> | ||
23982 | */ | ||
23983 | |||
23984 | /** `Object#toString` result references. */ | ||
23985 | var funcTag = '[object Function]'; | ||
23986 | |||
23987 | /** Used to detect host constructors (Safari > 5). */ | ||
23988 | var reIsHostCtor = /^\[object .+?Constructor\]$/; | ||
23989 | |||
23990 | /** | ||
23991 | * Checks if `value` is object-like. | ||
23992 | * | ||
23993 | * @private | ||
23994 | * @param {*} value The value to check. | ||
23995 | * @returns {boolean} Returns `true` if `value` is object-like, else `false`. | ||
23996 | */ | ||
23997 | function isObjectLike(value) { | ||
23998 | return !!value && typeof value == 'object'; | ||
23999 | } | ||
24000 | |||
24001 | /** Used for native method references. */ | ||
24002 | var objectProto = Object.prototype; | ||
24003 | |||
24004 | /** Used to resolve the decompiled source of functions. */ | ||
24005 | var fnToString = Function.prototype.toString; | ||
24006 | |||
24007 | /** Used to check objects for own properties. */ | ||
24008 | var hasOwnProperty = objectProto.hasOwnProperty; | ||
24009 | |||
24010 | /** | ||
24011 | * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) | ||
24012 | * of values. | ||
24013 | */ | ||
24014 | var objToString = objectProto.toString; | ||
24015 | |||
24016 | /** Used to detect if a method is native. */ | ||
24017 | var reIsNative = RegExp('^' + | ||
24018 | fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') | ||
24019 | .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' | ||
24020 | ); | ||
24021 | |||
24022 | /** | ||
24023 | * Gets the native function at `key` of `object`. | ||
24024 | * | ||
24025 | * @private | ||
24026 | * @param {Object} object The object to query. | ||
24027 | * @param {string} key The key of the method to get. | ||
24028 | * @returns {*} Returns the function if it's native, else `undefined`. | ||
24029 | */ | ||
24030 | function getNative(object, key) { | ||
24031 | var value = object == null ? undefined : object[key]; | ||
24032 | return isNative(value) ? value : undefined; | ||
24033 | } | ||
24034 | |||
24035 | /** | ||
24036 | * Checks if `value` is classified as a `Function` object. | ||
24037 | * | ||
24038 | * @static | ||
24039 | * @memberOf _ | ||
24040 | * @category Lang | ||
24041 | * @param {*} value The value to check. | ||
24042 | * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. | ||
24043 | * @example | ||
24044 | * | ||
24045 | * _.isFunction(_); | ||
24046 | * // => true | ||
24047 | * | ||
24048 | * _.isFunction(/abc/); | ||
24049 | * // => false | ||
24050 | */ | ||
24051 | function isFunction(value) { | ||
24052 | // The use of `Object#toString` avoids issues with the `typeof` operator | ||
24053 | // in older versions of Chrome and Safari which return 'function' for regexes | ||
24054 | // and Safari 8 equivalents which return 'object' for typed array constructors. | ||
24055 | return isObject(value) && objToString.call(value) == funcTag; | ||
24056 | } | ||
24057 | |||
24058 | /** | ||
24059 | * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. | ||
24060 | * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) | ||
24061 | * | ||
24062 | * @static | ||
24063 | * @memberOf _ | ||
24064 | * @category Lang | ||
24065 | * @param {*} value The value to check. | ||
24066 | * @returns {boolean} Returns `true` if `value` is an object, else `false`. | ||
24067 | * @example | ||
24068 | * | ||
24069 | * _.isObject({}); | ||
24070 | * // => true | ||
24071 | * | ||
24072 | * _.isObject([1, 2, 3]); | ||
24073 | * // => true | ||
24074 | * | ||
24075 | * _.isObject(1); | ||
24076 | * // => false | ||
24077 | */ | ||
24078 | function isObject(value) { | ||
24079 | // Avoid a V8 JIT bug in Chrome 19-20. | ||
24080 | // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. | ||
24081 | var type = typeof value; | ||
24082 | return !!value && (type == 'object' || type == 'function'); | ||
24083 | } | ||
24084 | |||
24085 | /** | ||
24086 | * Checks if `value` is a native function. | ||
24087 | * | ||
24088 | * @static | ||
24089 | * @memberOf _ | ||
24090 | * @category Lang | ||
24091 | * @param {*} value The value to check. | ||
24092 | * @returns {boolean} Returns `true` if `value` is a native function, else `false`. | ||
24093 | * @example | ||
24094 | * | ||
24095 | * _.isNative(Array.prototype.push); | ||
24096 | * // => true | ||
24097 | * | ||
24098 | * _.isNative(_); | ||
24099 | * // => false | ||
24100 | */ | ||
24101 | function isNative(value) { | ||
24102 | if (value == null) { | ||
24103 | return false; | ||
24104 | } | ||
24105 | if (isFunction(value)) { | ||
24106 | return reIsNative.test(fnToString.call(value)); | ||
24107 | } | ||
24108 | return isObjectLike(value) && reIsHostCtor.test(value); | ||
24109 | } | ||
24110 | |||
24111 | module.exports = getNative; | ||
24112 | |||
24113 | |||
24114 | /***/ }, | ||
24115 | /* 185 */ | ||
24116 | /***/ function(module, exports) { | ||
24117 | |||
24118 | /** | ||
24119 | * lodash 3.0.4 (Custom Build) <https://lodash.com/> | ||
24120 | * Build: `lodash modern modularize exports="npm" -o ./` | ||
24121 | * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> | ||
24122 | * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> | ||
24123 | * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | ||
24124 | * Available under MIT license <https://lodash.com/license> | ||
24125 | */ | ||
24126 | |||
24127 | /** | ||
24128 | * Checks if `value` is object-like. | ||
24129 | * | ||
24130 | * @private | ||
24131 | * @param {*} value The value to check. | ||
24132 | * @returns {boolean} Returns `true` if `value` is object-like, else `false`. | ||
24133 | */ | ||
24134 | function isObjectLike(value) { | ||
24135 | return !!value && typeof value == 'object'; | ||
24136 | } | ||
24137 | |||
24138 | /** Used for native method references. */ | ||
24139 | var objectProto = Object.prototype; | ||
24140 | |||
24141 | /** Used to check objects for own properties. */ | ||
24142 | var hasOwnProperty = objectProto.hasOwnProperty; | ||
24143 | |||
24144 | /** Native method references. */ | ||
24145 | var propertyIsEnumerable = objectProto.propertyIsEnumerable; | ||
24146 | |||
24147 | /** | ||
24148 | * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) | ||
24149 | * of an array-like value. | ||
24150 | */ | ||
24151 | var MAX_SAFE_INTEGER = 9007199254740991; | ||
24152 | |||
24153 | /** | ||
24154 | * The base implementation of `_.property` without support for deep paths. | ||
24155 | * | ||
24156 | * @private | ||
24157 | * @param {string} key The key of the property to get. | ||
24158 | * @returns {Function} Returns the new function. | ||
24159 | */ | ||
24160 | function baseProperty(key) { | ||
24161 | return function(object) { | ||
24162 | return object == null ? undefined : object[key]; | ||
24163 | }; | ||
24164 | } | ||
24165 | |||
24166 | /** | ||
24167 | * Gets the "length" property value of `object`. | ||
24168 | * | ||
24169 | * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) | ||
24170 | * that affects Safari on at least iOS 8.1-8.3 ARM64. | ||
24171 | * | ||
24172 | * @private | ||
24173 | * @param {Object} object The object to query. | ||
24174 | * @returns {*} Returns the "length" value. | ||
24175 | */ | ||
24176 | var getLength = baseProperty('length'); | ||
24177 | |||
24178 | /** | ||
24179 | * Checks if `value` is array-like. | ||
24180 | * | ||
24181 | * @private | ||
24182 | * @param {*} value The value to check. | ||
24183 | * @returns {boolean} Returns `true` if `value` is array-like, else `false`. | ||
24184 | */ | ||
24185 | function isArrayLike(value) { | ||
24186 | return value != null && isLength(getLength(value)); | ||
24187 | } | ||
24188 | |||
24189 | /** | ||
24190 | * Checks if `value` is a valid array-like length. | ||
24191 | * | ||
24192 | * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). | ||
24193 | * | ||
24194 | * @private | ||
24195 | * @param {*} value The value to check. | ||
24196 | * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. | ||
24197 | */ | ||
24198 | function isLength(value) { | ||
24199 | return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; | ||
24200 | } | ||
24201 | |||
24202 | /** | ||
24203 | * Checks if `value` is classified as an `arguments` object. | ||
24204 | * | ||
24205 | * @static | ||
24206 | * @memberOf _ | ||
24207 | * @category Lang | ||
24208 | * @param {*} value The value to check. | ||
24209 | * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. | ||
24210 | * @example | ||
24211 | * | ||
24212 | * _.isArguments(function() { return arguments; }()); | ||
24213 | * // => true | ||
24214 | * | ||
24215 | * _.isArguments([1, 2, 3]); | ||
24216 | * // => false | ||
24217 | */ | ||
24218 | function isArguments(value) { | ||
24219 | return isObjectLike(value) && isArrayLike(value) && | ||
24220 | hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee'); | ||
24221 | } | ||
24222 | |||
24223 | module.exports = isArguments; | ||
24224 | |||
24225 | |||
24226 | /***/ }, | ||
24227 | /* 186 */ | ||
24228 | /***/ function(module, exports) { | ||
24229 | |||
24230 | /** | ||
24231 | * lodash 3.0.4 (Custom Build) <https://lodash.com/> | ||
24232 | * Build: `lodash modern modularize exports="npm" -o ./` | ||
24233 | * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> | ||
24234 | * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> | ||
24235 | * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | ||
24236 | * Available under MIT license <https://lodash.com/license> | ||
24237 | */ | ||
24238 | |||
24239 | /** `Object#toString` result references. */ | ||
24240 | var arrayTag = '[object Array]', | ||
24241 | funcTag = '[object Function]'; | ||
24242 | |||
24243 | /** Used to detect host constructors (Safari > 5). */ | ||
24244 | var reIsHostCtor = /^\[object .+?Constructor\]$/; | ||
24245 | |||
24246 | /** | ||
24247 | * Checks if `value` is object-like. | ||
24248 | * | ||
24249 | * @private | ||
24250 | * @param {*} value The value to check. | ||
24251 | * @returns {boolean} Returns `true` if `value` is object-like, else `false`. | ||
24252 | */ | ||
24253 | function isObjectLike(value) { | ||
24254 | return !!value && typeof value == 'object'; | ||
24255 | } | ||
24256 | 26456 | ||
24257 | /** Used for native method references. */ | 26457 | return _react2["default"].cloneElement(child, newChildProps); |
24258 | var objectProto = Object.prototype; | ||
24259 | |||
24260 | /** Used to resolve the decompiled source of functions. */ | ||
24261 | var fnToString = Function.prototype.toString; | ||
24262 | |||
24263 | /** Used to check objects for own properties. */ | ||
24264 | var hasOwnProperty = objectProto.hasOwnProperty; | ||
24265 | |||
24266 | /** | ||
24267 | * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) | ||
24268 | * of values. | ||
24269 | */ | ||
24270 | var objToString = objectProto.toString; | ||
24271 | |||
24272 | /** Used to detect if a method is native. */ | ||
24273 | var reIsNative = RegExp('^' + | ||
24274 | fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') | ||
24275 | .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' | ||
24276 | ); | ||
24277 | |||
24278 | /* Native method references for those with the same name as other `lodash` methods. */ | ||
24279 | var nativeIsArray = getNative(Array, 'isArray'); | ||
24280 | |||
24281 | /** | ||
24282 | * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) | ||
24283 | * of an array-like value. | ||
24284 | */ | ||
24285 | var MAX_SAFE_INTEGER = 9007199254740991; | ||
24286 | |||
24287 | /** | ||
24288 | * Gets the native function at `key` of `object`. | ||
24289 | * | ||
24290 | * @private | ||
24291 | * @param {Object} object The object to query. | ||
24292 | * @param {string} key The key of the method to get. | ||
24293 | * @returns {*} Returns the function if it's native, else `undefined`. | ||
24294 | */ | ||
24295 | function getNative(object, key) { | ||
24296 | var value = object == null ? undefined : object[key]; | ||
24297 | return isNative(value) ? value : undefined; | ||
24298 | } | ||
24299 | |||
24300 | /** | ||
24301 | * Checks if `value` is a valid array-like length. | ||
24302 | * | ||
24303 | * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). | ||
24304 | * | ||
24305 | * @private | ||
24306 | * @param {*} value The value to check. | ||
24307 | * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. | ||
24308 | */ | ||
24309 | function isLength(value) { | ||
24310 | return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; | ||
24311 | } | ||
24312 | |||
24313 | /** | ||
24314 | * Checks if `value` is classified as an `Array` object. | ||
24315 | * | ||
24316 | * @static | ||
24317 | * @memberOf _ | ||
24318 | * @category Lang | ||
24319 | * @param {*} value The value to check. | ||
24320 | * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. | ||
24321 | * @example | ||
24322 | * | ||
24323 | * _.isArray([1, 2, 3]); | ||
24324 | * // => true | ||
24325 | * | ||
24326 | * _.isArray(function() { return arguments; }()); | ||
24327 | * // => false | ||
24328 | */ | ||
24329 | var isArray = nativeIsArray || function(value) { | ||
24330 | return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag; | ||
24331 | }; | ||
24332 | |||
24333 | /** | ||
24334 | * Checks if `value` is classified as a `Function` object. | ||
24335 | * | ||
24336 | * @static | ||
24337 | * @memberOf _ | ||
24338 | * @category Lang | ||
24339 | * @param {*} value The value to check. | ||
24340 | * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. | ||
24341 | * @example | ||
24342 | * | ||
24343 | * _.isFunction(_); | ||
24344 | * // => true | ||
24345 | * | ||
24346 | * _.isFunction(/abc/); | ||
24347 | * // => false | ||
24348 | */ | ||
24349 | function isFunction(value) { | ||
24350 | // The use of `Object#toString` avoids issues with the `typeof` operator | ||
24351 | // in older versions of Chrome and Safari which return 'function' for regexes | ||
24352 | // and Safari 8 equivalents which return 'object' for typed array constructors. | ||
24353 | return isObject(value) && objToString.call(value) == funcTag; | ||
24354 | } | ||
24355 | |||
24356 | /** | ||
24357 | * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. | ||
24358 | * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) | ||
24359 | * | ||
24360 | * @static | ||
24361 | * @memberOf _ | ||
24362 | * @category Lang | ||
24363 | * @param {*} value The value to check. | ||
24364 | * @returns {boolean} Returns `true` if `value` is an object, else `false`. | ||
24365 | * @example | ||
24366 | * | ||
24367 | * _.isObject({}); | ||
24368 | * // => true | ||
24369 | * | ||
24370 | * _.isObject([1, 2, 3]); | ||
24371 | * // => true | ||
24372 | * | ||
24373 | * _.isObject(1); | ||
24374 | * // => false | ||
24375 | */ | ||
24376 | function isObject(value) { | ||
24377 | // Avoid a V8 JIT bug in Chrome 19-20. | ||
24378 | // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. | ||
24379 | var type = typeof value; | ||
24380 | return !!value && (type == 'object' || type == 'function'); | ||
24381 | } | ||
24382 | |||
24383 | /** | ||
24384 | * Checks if `value` is a native function. | ||
24385 | * | ||
24386 | * @static | ||
24387 | * @memberOf _ | ||
24388 | * @category Lang | ||
24389 | * @param {*} value The value to check. | ||
24390 | * @returns {boolean} Returns `true` if `value` is a native function, else `false`. | ||
24391 | * @example | ||
24392 | * | ||
24393 | * _.isNative(Array.prototype.push); | ||
24394 | * // => true | ||
24395 | * | ||
24396 | * _.isNative(_); | ||
24397 | * // => false | ||
24398 | */ | ||
24399 | function isNative(value) { | ||
24400 | if (value == null) { | ||
24401 | return false; | ||
24402 | } | 26458 | } |
24403 | if (isFunction(value)) { | 26459 | }); |
24404 | return reIsNative.test(fnToString.call(value)); | ||
24405 | } | ||
24406 | return isObjectLike(value) && reIsHostCtor.test(value); | ||
24407 | } | ||
24408 | 26460 | ||
24409 | module.exports = isArray; | 26461 | exports["default"] = Trigger; |
24410 | 26462 | module.exports = exports['default']; | |
24411 | 26463 | ||
24412 | /***/ }, | 26464 | /***/ }, |
24413 | /* 187 */ | 26465 | /* 183 */ |
24414 | /***/ function(module, exports) { | 26466 | /***/ function(module, exports) { |
24415 | 26467 | ||
24416 | /** | ||
24417 | * Safe chained function | ||
24418 | * | ||
24419 | * Will only create a new function if needed, | ||
24420 | * otherwise will pass back existing functions or null. | ||
24421 | * | ||
24422 | * @returns {function|null} | ||
24423 | */ | ||
24424 | "use strict"; | 26468 | "use strict"; |
24425 | 26469 | ||
24426 | function createChainedFunction() { | 26470 | module.exports = function contains(root, n) { |
24427 | var args = arguments; | 26471 | var node = n; |
24428 | return function chainedFunction() { | 26472 | while (node) { |
24429 | for (var i = 0; i < args.length; i++) { | 26473 | if (node === root) { |
24430 | if (args[i] && args[i].apply) { | 26474 | return true; |
24431 | args[i].apply(this, arguments); | ||
24432 | } | ||
24433 | } | 26475 | } |
24434 | }; | 26476 | node = node.parentNode; |
24435 | } | 26477 | } |
24436 | 26478 | ||
24437 | module.exports = createChainedFunction; | 26479 | return false; |
26480 | }; | ||
24438 | 26481 | ||
24439 | /***/ }, | 26482 | /***/ }, |
24440 | /* 188 */ | 26483 | /* 184 */ |
24441 | /***/ function(module, exports, __webpack_require__) { | 26484 | /***/ function(module, exports, __webpack_require__) { |
24442 | 26485 | ||
24443 | 'use strict'; | 26486 | 'use strict'; |
24444 | 26487 | ||
24445 | Object.defineProperty(exports, '__esModule', { | 26488 | Object.defineProperty(exports, "__esModule", { |
24446 | value: true | 26489 | value: true |
24447 | }); | 26490 | }); |
24448 | exports['default'] = addEventListenerWrap; | 26491 | exports["default"] = addEventListenerWrap; |
24449 | |||
24450 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
24451 | 26492 | ||
24452 | var _addDomEventListener = __webpack_require__(189); | 26493 | var _addDomEventListener = __webpack_require__(185); |
24453 | 26494 | ||
24454 | var _addDomEventListener2 = _interopRequireDefault(_addDomEventListener); | 26495 | var _addDomEventListener2 = _interopRequireDefault(_addDomEventListener); |
24455 | 26496 | ||
24456 | var _reactDom = __webpack_require__(160); | 26497 | var _reactDom = __webpack_require__(37); |
24457 | 26498 | ||
24458 | var _reactDom2 = _interopRequireDefault(_reactDom); | 26499 | var _reactDom2 = _interopRequireDefault(_reactDom); |
24459 | 26500 | ||
26501 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
26502 | |||
24460 | function addEventListenerWrap(target, eventType, cb) { | 26503 | function addEventListenerWrap(target, eventType, cb) { |
24461 | /* eslint camelcase: 2 */ | 26504 | /* eslint camelcase: 2 */ |
24462 | var callback = _reactDom2['default'].unstable_batchedUpdates ? function run(e) { | 26505 | var callback = _reactDom2["default"].unstable_batchedUpdates ? function run(e) { |
24463 | _reactDom2['default'].unstable_batchedUpdates(cb, e); | 26506 | _reactDom2["default"].unstable_batchedUpdates(cb, e); |
24464 | } : cb; | 26507 | } : cb; |
24465 | return (0, _addDomEventListener2['default'])(target, eventType, callback); | 26508 | return (0, _addDomEventListener2["default"])(target, eventType, callback); |
24466 | } | 26509 | } |
24467 | |||
24468 | module.exports = exports['default']; | 26510 | module.exports = exports['default']; |
24469 | 26511 | ||
24470 | /***/ }, | 26512 | /***/ }, |
24471 | /* 189 */ | 26513 | /* 185 */ |
24472 | /***/ function(module, exports, __webpack_require__) { | 26514 | /***/ function(module, exports, __webpack_require__) { |
24473 | 26515 | ||
24474 | 'use strict'; | 26516 | 'use strict'; |
@@ -24480,7 +26522,7 @@ | |||
24480 | 26522 | ||
24481 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | 26523 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } |
24482 | 26524 | ||
24483 | var _EventObject = __webpack_require__(190); | 26525 | var _EventObject = __webpack_require__(186); |
24484 | 26526 | ||
24485 | var _EventObject2 = _interopRequireDefault(_EventObject); | 26527 | var _EventObject2 = _interopRequireDefault(_EventObject); |
24486 | 26528 | ||
@@ -24510,7 +26552,7 @@ | |||
24510 | module.exports = exports['default']; | 26552 | module.exports = exports['default']; |
24511 | 26553 | ||
24512 | /***/ }, | 26554 | /***/ }, |
24513 | /* 190 */ | 26555 | /* 186 */ |
24514 | /***/ function(module, exports, __webpack_require__) { | 26556 | /***/ function(module, exports, __webpack_require__) { |
24515 | 26557 | ||
24516 | /** | 26558 | /** |
@@ -24527,11 +26569,11 @@ | |||
24527 | 26569 | ||
24528 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | 26570 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } |
24529 | 26571 | ||
24530 | var _EventBaseObject = __webpack_require__(191); | 26572 | var _EventBaseObject = __webpack_require__(187); |
24531 | 26573 | ||
24532 | var _EventBaseObject2 = _interopRequireDefault(_EventBaseObject); | 26574 | var _EventBaseObject2 = _interopRequireDefault(_EventBaseObject); |
24533 | 26575 | ||
24534 | var _objectAssign = __webpack_require__(192); | 26576 | var _objectAssign = __webpack_require__(6); |
24535 | 26577 | ||
24536 | var _objectAssign2 = _interopRequireDefault(_objectAssign); | 26578 | var _objectAssign2 = _interopRequireDefault(_objectAssign); |
24537 | 26579 | ||
@@ -24793,7 +26835,7 @@ | |||
24793 | module.exports = exports['default']; | 26835 | module.exports = exports['default']; |
24794 | 26836 | ||
24795 | /***/ }, | 26837 | /***/ }, |
24796 | /* 191 */ | 26838 | /* 187 */ |
24797 | /***/ function(module, exports) { | 26839 | /***/ function(module, exports) { |
24798 | 26840 | ||
24799 | /** | 26841 | /** |
@@ -24861,150 +26903,63 @@ | |||
24861 | module.exports = exports["default"]; | 26903 | module.exports = exports["default"]; |
24862 | 26904 | ||
24863 | /***/ }, | 26905 | /***/ }, |
24864 | /* 192 */ | 26906 | /* 188 */ |
24865 | /***/ function(module, exports) { | ||
24866 | |||
24867 | /* eslint-disable no-unused-vars */ | ||
24868 | 'use strict'; | ||
24869 | var hasOwnProperty = Object.prototype.hasOwnProperty; | ||
24870 | var propIsEnumerable = Object.prototype.propertyIsEnumerable; | ||
24871 | |||
24872 | function toObject(val) { | ||
24873 | if (val === null || val === undefined) { | ||
24874 | throw new TypeError('Object.assign cannot be called with null or undefined'); | ||
24875 | } | ||
24876 | |||
24877 | return Object(val); | ||
24878 | } | ||
24879 | |||
24880 | module.exports = Object.assign || function (target, source) { | ||
24881 | var from; | ||
24882 | var to = toObject(target); | ||
24883 | var symbols; | ||
24884 | |||
24885 | for (var s = 1; s < arguments.length; s++) { | ||
24886 | from = Object(arguments[s]); | ||
24887 | |||
24888 | for (var key in from) { | ||
24889 | if (hasOwnProperty.call(from, key)) { | ||
24890 | to[key] = from[key]; | ||
24891 | } | ||
24892 | } | ||
24893 | |||
24894 | if (Object.getOwnPropertySymbols) { | ||
24895 | symbols = Object.getOwnPropertySymbols(from); | ||
24896 | for (var i = 0; i < symbols.length; i++) { | ||
24897 | if (propIsEnumerable.call(from, symbols[i])) { | ||
24898 | to[symbols[i]] = from[symbols[i]]; | ||
24899 | } | ||
24900 | } | ||
24901 | } | ||
24902 | } | ||
24903 | |||
24904 | return to; | ||
24905 | }; | ||
24906 | |||
24907 | |||
24908 | /***/ }, | ||
24909 | /* 193 */ | ||
24910 | /***/ function(module, exports) { | ||
24911 | |||
24912 | "use strict"; | ||
24913 | |||
24914 | module.exports = function contains(root, n) { | ||
24915 | var node = n; | ||
24916 | while (node) { | ||
24917 | if (node === root) { | ||
24918 | return true; | ||
24919 | } | ||
24920 | node = node.parentNode; | ||
24921 | } | ||
24922 | |||
24923 | return false; | ||
24924 | }; | ||
24925 | |||
24926 | /***/ }, | ||
24927 | /* 194 */ | ||
24928 | /***/ function(module, exports, __webpack_require__) { | ||
24929 | |||
24930 | 'use strict'; | ||
24931 | |||
24932 | var React = __webpack_require__(3); | ||
24933 | |||
24934 | module.exports = function toArray(children) { | ||
24935 | var ret = []; | ||
24936 | React.Children.forEach(children, function each(c) { | ||
24937 | ret.push(c); | ||
24938 | }); | ||
24939 | return ret; | ||
24940 | }; | ||
24941 | |||
24942 | /***/ }, | ||
24943 | /* 195 */ | ||
24944 | /***/ function(module, exports, __webpack_require__) { | ||
24945 | |||
24946 | 'use strict'; | ||
24947 | |||
24948 | var React = __webpack_require__(3); | ||
24949 | |||
24950 | function mirror(o) { | ||
24951 | return o; | ||
24952 | } | ||
24953 | |||
24954 | module.exports = function mapSelf(children) { | ||
24955 | // return ReactFragment | ||
24956 | return React.Children.map(children, mirror); | ||
24957 | }; | ||
24958 | |||
24959 | /***/ }, | ||
24960 | /* 196 */ | ||
24961 | /***/ function(module, exports, __webpack_require__) { | 26907 | /***/ function(module, exports, __webpack_require__) { |
24962 | 26908 | ||
24963 | 'use strict'; | 26909 | 'use strict'; |
24964 | 26910 | ||
24965 | Object.defineProperty(exports, '__esModule', { | 26911 | Object.defineProperty(exports, "__esModule", { |
24966 | value: true | 26912 | value: true |
24967 | }); | 26913 | }); |
24968 | 26914 | ||
24969 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | 26915 | 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; }; |
24970 | 26916 | ||
24971 | var _react = __webpack_require__(3); | 26917 | var _react = __webpack_require__(3); |
24972 | 26918 | ||
24973 | var _react2 = _interopRequireDefault(_react); | 26919 | var _react2 = _interopRequireDefault(_react); |
24974 | 26920 | ||
24975 | var _reactDom = __webpack_require__(160); | 26921 | var _reactDom = __webpack_require__(37); |
24976 | 26922 | ||
24977 | var _reactDom2 = _interopRequireDefault(_reactDom); | 26923 | var _reactDom2 = _interopRequireDefault(_reactDom); |
24978 | 26924 | ||
24979 | var _rcAlign = __webpack_require__(197); | 26925 | var _rcAlign = __webpack_require__(189); |
24980 | 26926 | ||
24981 | var _rcAlign2 = _interopRequireDefault(_rcAlign); | 26927 | var _rcAlign2 = _interopRequireDefault(_rcAlign); |
24982 | 26928 | ||
24983 | var _rcAnimate = __webpack_require__(208); | 26929 | var _rcAnimate = __webpack_require__(200); |
24984 | 26930 | ||
24985 | var _rcAnimate2 = _interopRequireDefault(_rcAnimate); | 26931 | var _rcAnimate2 = _interopRequireDefault(_rcAnimate); |
24986 | 26932 | ||
24987 | var _PopupInner = __webpack_require__(216); | 26933 | var _PopupInner = __webpack_require__(209); |
24988 | 26934 | ||
24989 | var _PopupInner2 = _interopRequireDefault(_PopupInner); | 26935 | var _PopupInner2 = _interopRequireDefault(_PopupInner); |
24990 | 26936 | ||
24991 | var Popup = _react2['default'].createClass({ | 26937 | var _LazyRenderBox = __webpack_require__(210); |
26938 | |||
26939 | var _LazyRenderBox2 = _interopRequireDefault(_LazyRenderBox); | ||
26940 | |||
26941 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
26942 | |||
26943 | var Popup = _react2["default"].createClass({ | ||
24992 | displayName: 'Popup', | 26944 | displayName: 'Popup', |
24993 | 26945 | ||
24994 | propTypes: { | 26946 | propTypes: { |
24995 | visible: _react.PropTypes.bool, | 26947 | visible: _react.PropTypes.bool, |
24996 | wrap: _react.PropTypes.object, | ||
24997 | style: _react.PropTypes.object, | 26948 | style: _react.PropTypes.object, |
24998 | getClassNameFromAlign: _react.PropTypes.func, | 26949 | getClassNameFromAlign: _react.PropTypes.func, |
26950 | onAlign: _react.PropTypes.func, | ||
26951 | getRootDomNode: _react.PropTypes.func, | ||
24999 | onMouseEnter: _react.PropTypes.func, | 26952 | onMouseEnter: _react.PropTypes.func, |
26953 | align: _react.PropTypes.any, | ||
26954 | destroyPopupOnHide: _react.PropTypes.bool, | ||
25000 | className: _react.PropTypes.string, | 26955 | className: _react.PropTypes.string, |
26956 | prefixCls: _react.PropTypes.string, | ||
25001 | onMouseLeave: _react.PropTypes.func | 26957 | onMouseLeave: _react.PropTypes.func |
25002 | }, | 26958 | }, |
25003 | 26959 | ||
25004 | componentDidMount: function componentDidMount() { | 26960 | componentDidMount: function componentDidMount() { |
25005 | this.rootNode = this.getPopupDomNode(); | 26961 | this.rootNode = this.getPopupDomNode(); |
25006 | }, | 26962 | }, |
25007 | |||
25008 | onAlign: function onAlign(popupDomNode, align) { | 26963 | onAlign: function onAlign(popupDomNode, align) { |
25009 | var props = this.props; | 26964 | var props = this.props; |
25010 | var alignClassName = props.getClassNameFromAlign(props.align); | 26965 | var alignClassName = props.getClassNameFromAlign(props.align); |
@@ -25013,16 +26968,23 @@ | |||
25013 | this.currentAlignClassName = currentAlignClassName; | 26968 | this.currentAlignClassName = currentAlignClassName; |
25014 | popupDomNode.className = this.getClassName(currentAlignClassName); | 26969 | popupDomNode.className = this.getClassName(currentAlignClassName); |
25015 | } | 26970 | } |
26971 | props.onAlign(popupDomNode, align); | ||
25016 | }, | 26972 | }, |
25017 | |||
25018 | getPopupDomNode: function getPopupDomNode() { | 26973 | getPopupDomNode: function getPopupDomNode() { |
25019 | return _reactDom2['default'].findDOMNode(this); | 26974 | return _reactDom2["default"].findDOMNode(this.refs.popup); |
25020 | }, | 26975 | }, |
25021 | |||
25022 | getTarget: function getTarget() { | 26976 | getTarget: function getTarget() { |
25023 | return _reactDom2['default'].findDOMNode(this.props.wrap); | 26977 | return this.props.getRootDomNode(); |
26978 | }, | ||
26979 | getMaskTransitionName: function getMaskTransitionName() { | ||
26980 | var props = this.props; | ||
26981 | var transitionName = props.maskTransitionName; | ||
26982 | var animation = props.maskAnimation; | ||
26983 | if (!transitionName && animation) { | ||
26984 | transitionName = props.prefixCls + '-' + animation; | ||
26985 | } | ||
26986 | return transitionName; | ||
25024 | }, | 26987 | }, |
25025 | |||
25026 | getTransitionName: function getTransitionName() { | 26988 | getTransitionName: function getTransitionName() { |
25027 | var props = this.props; | 26989 | var props = this.props; |
25028 | var transitionName = props.transitionName; | 26990 | var transitionName = props.transitionName; |
@@ -25031,17 +26993,10 @@ | |||
25031 | } | 26993 | } |
25032 | return transitionName; | 26994 | return transitionName; |
25033 | }, | 26995 | }, |
25034 | |||
25035 | getClassName: function getClassName(currentAlignClassName) { | 26996 | getClassName: function getClassName(currentAlignClassName) { |
25036 | var props = this.props; | 26997 | return this.props.prefixCls + ' ' + this.props.className + ' ' + currentAlignClassName; |
25037 | var prefixCls = props.prefixCls; | ||
25038 | |||
25039 | var className = prefixCls + ' ' + props.className + ' '; | ||
25040 | className += currentAlignClassName; | ||
25041 | return className; | ||
25042 | }, | 26998 | }, |
25043 | 26999 | getPopupElement: function getPopupElement() { | |
25044 | render: function render() { | ||
25045 | var props = this.props; | 27000 | var props = this.props; |
25046 | var align = props.align; | 27001 | var align = props.align; |
25047 | var style = props.style; | 27002 | var style = props.style; |
@@ -25054,129 +27009,201 @@ | |||
25054 | if (!visible) { | 27009 | if (!visible) { |
25055 | this.currentAlignClassName = null; | 27010 | this.currentAlignClassName = null; |
25056 | } | 27011 | } |
27012 | var newStyle = _extends({}, style, this.getZIndexStyle()); | ||
27013 | var popupInnerProps = { | ||
27014 | className: className, | ||
27015 | prefixCls: prefixCls, | ||
27016 | ref: 'popup', | ||
27017 | onMouseEnter: props.onMouseEnter, | ||
27018 | onMouseLeave: props.onMouseLeave, | ||
27019 | style: newStyle | ||
27020 | }; | ||
25057 | if (destroyPopupOnHide) { | 27021 | if (destroyPopupOnHide) { |
25058 | return _react2['default'].createElement( | 27022 | return _react2["default"].createElement( |
25059 | _rcAnimate2['default'], | 27023 | _rcAnimate2["default"], |
25060 | { component: '', | 27024 | { |
27025 | component: '', | ||
25061 | exclusive: true, | 27026 | exclusive: true, |
25062 | transitionAppear: true, | 27027 | transitionAppear: true, |
25063 | transitionName: this.getTransitionName() }, | 27028 | transitionName: this.getTransitionName() |
25064 | visible ? _react2['default'].createElement( | 27029 | }, |
25065 | _rcAlign2['default'], | 27030 | visible ? _react2["default"].createElement( |
25066 | { target: this.getTarget, | 27031 | _rcAlign2["default"], |
27032 | { | ||
27033 | target: this.getTarget, | ||
25067 | key: 'popup', | 27034 | key: 'popup', |
27035 | ref: this.saveAlign, | ||
25068 | monitorWindowResize: true, | 27036 | monitorWindowResize: true, |
25069 | align: align, | 27037 | align: align, |
25070 | onAlign: this.onAlign }, | 27038 | onAlign: this.onAlign |
25071 | _react2['default'].createElement( | 27039 | }, |
25072 | _PopupInner2['default'], | 27040 | _react2["default"].createElement( |
25073 | { className: className, | 27041 | _PopupInner2["default"], |
25074 | visible: true, | 27042 | _extends({ |
25075 | onMouseEnter: props.onMouseEnter, | 27043 | visible: true |
25076 | onMouseLeave: props.onMouseLeave, | 27044 | }, popupInnerProps), |
25077 | style: style }, | ||
25078 | props.children | 27045 | props.children |
25079 | ) | 27046 | ) |
25080 | ) : null | 27047 | ) : null |
25081 | ); | 27048 | ); |
25082 | } | 27049 | } |
25083 | return _react2['default'].createElement( | 27050 | return _react2["default"].createElement( |
25084 | _rcAnimate2['default'], | 27051 | _rcAnimate2["default"], |
25085 | { component: '', | 27052 | { |
27053 | component: '', | ||
25086 | exclusive: true, | 27054 | exclusive: true, |
25087 | transitionAppear: true, | 27055 | transitionAppear: true, |
25088 | transitionName: this.getTransitionName(), | 27056 | transitionName: this.getTransitionName(), |
25089 | showProp: 'xVisible' }, | 27057 | showProp: 'xVisible' |
25090 | _react2['default'].createElement( | 27058 | }, |
25091 | _rcAlign2['default'], | 27059 | _react2["default"].createElement( |
25092 | { target: this.getTarget, | 27060 | _rcAlign2["default"], |
27061 | { | ||
27062 | target: this.getTarget, | ||
25093 | key: 'popup', | 27063 | key: 'popup', |
27064 | ref: this.saveAlign, | ||
25094 | monitorWindowResize: true, | 27065 | monitorWindowResize: true, |
25095 | xVisible: visible, | 27066 | xVisible: visible, |
25096 | childrenProps: { | 27067 | childrenProps: { visible: 'xVisible' }, |
25097 | visible: 'xVisible' | ||
25098 | }, | ||
25099 | disabled: !visible, | 27068 | disabled: !visible, |
25100 | align: align, | 27069 | align: align, |
25101 | onAlign: this.onAlign }, | 27070 | onAlign: this.onAlign |
25102 | _react2['default'].createElement( | 27071 | }, |
25103 | _PopupInner2['default'], | 27072 | _react2["default"].createElement( |
25104 | { className: className, | 27073 | _PopupInner2["default"], |
25105 | hiddenClassName: hiddenClassName, | 27074 | _extends({ |
25106 | onMouseEnter: props.onMouseEnter, | 27075 | hiddenClassName: hiddenClassName |
25107 | onMouseLeave: props.onMouseLeave, | 27076 | }, popupInnerProps), |
25108 | style: style }, | ||
25109 | props.children | 27077 | props.children |
25110 | ) | 27078 | ) |
25111 | ) | 27079 | ) |
25112 | ); | 27080 | ); |
27081 | }, | ||
27082 | getZIndexStyle: function getZIndexStyle() { | ||
27083 | var style = {}; | ||
27084 | var props = this.props; | ||
27085 | if (props.zIndex !== undefined) { | ||
27086 | style.zIndex = props.zIndex; | ||
27087 | } | ||
27088 | return style; | ||
27089 | }, | ||
27090 | getMaskElement: function getMaskElement() { | ||
27091 | var props = this.props; | ||
27092 | var maskElement = void 0; | ||
27093 | if (props.mask) { | ||
27094 | var maskTransition = this.getMaskTransitionName(); | ||
27095 | maskElement = _react2["default"].createElement(_LazyRenderBox2["default"], { | ||
27096 | style: this.getZIndexStyle(), | ||
27097 | key: 'mask', | ||
27098 | className: props.prefixCls + '-mask', | ||
27099 | hiddenClassName: props.prefixCls + '-mask-hidden', | ||
27100 | visible: props.visible | ||
27101 | }); | ||
27102 | if (maskTransition) { | ||
27103 | maskElement = _react2["default"].createElement( | ||
27104 | _rcAnimate2["default"], | ||
27105 | { | ||
27106 | key: 'mask', | ||
27107 | showProp: 'visible', | ||
27108 | transitionAppear: true, | ||
27109 | component: '', | ||
27110 | transitionName: maskTransition | ||
27111 | }, | ||
27112 | maskElement | ||
27113 | ); | ||
27114 | } | ||
27115 | } | ||
27116 | return maskElement; | ||
27117 | }, | ||
27118 | saveAlign: function saveAlign(align) { | ||
27119 | this.alignInstance = align; | ||
27120 | }, | ||
27121 | render: function render() { | ||
27122 | return _react2["default"].createElement( | ||
27123 | 'div', | ||
27124 | null, | ||
27125 | this.getMaskElement(), | ||
27126 | this.getPopupElement() | ||
27127 | ); | ||
25113 | } | 27128 | } |
25114 | }); | 27129 | }); |
25115 | 27130 | ||
25116 | exports['default'] = Popup; | 27131 | exports["default"] = Popup; |
25117 | module.exports = exports['default']; | 27132 | module.exports = exports['default']; |
25118 | 27133 | ||
25119 | /***/ }, | 27134 | /***/ }, |
25120 | /* 197 */ | 27135 | /* 189 */ |
25121 | /***/ function(module, exports, __webpack_require__) { | 27136 | /***/ function(module, exports, __webpack_require__) { |
25122 | 27137 | ||
25123 | // export this package's api | ||
25124 | 'use strict'; | 27138 | 'use strict'; |
25125 | 27139 | ||
25126 | Object.defineProperty(exports, '__esModule', { | 27140 | Object.defineProperty(exports, "__esModule", { |
25127 | value: true | 27141 | value: true |
25128 | }); | 27142 | }); |
25129 | 27143 | ||
25130 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | 27144 | var _Align = __webpack_require__(190); |
25131 | |||
25132 | var _Align = __webpack_require__(198); | ||
25133 | 27145 | ||
25134 | var _Align2 = _interopRequireDefault(_Align); | 27146 | var _Align2 = _interopRequireDefault(_Align); |
25135 | 27147 | ||
25136 | exports['default'] = _Align2['default']; | 27148 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } |
27149 | |||
27150 | exports["default"] = _Align2["default"]; // export this package's api | ||
27151 | |||
25137 | module.exports = exports['default']; | 27152 | module.exports = exports['default']; |
25138 | 27153 | ||
25139 | /***/ }, | 27154 | /***/ }, |
25140 | /* 198 */ | 27155 | /* 190 */ |
25141 | /***/ function(module, exports, __webpack_require__) { | 27156 | /***/ function(module, exports, __webpack_require__) { |
25142 | 27157 | ||
25143 | 'use strict'; | 27158 | 'use strict'; |
25144 | 27159 | ||
25145 | Object.defineProperty(exports, '__esModule', { | 27160 | Object.defineProperty(exports, "__esModule", { |
25146 | value: true | 27161 | value: true |
25147 | }); | 27162 | }); |
25148 | 27163 | ||
25149 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
25150 | |||
25151 | var _react = __webpack_require__(3); | 27164 | var _react = __webpack_require__(3); |
25152 | 27165 | ||
25153 | var _react2 = _interopRequireDefault(_react); | 27166 | var _react2 = _interopRequireDefault(_react); |
25154 | 27167 | ||
25155 | var _reactDom = __webpack_require__(160); | 27168 | var _reactDom = __webpack_require__(37); |
25156 | 27169 | ||
25157 | var _reactDom2 = _interopRequireDefault(_reactDom); | 27170 | var _reactDom2 = _interopRequireDefault(_reactDom); |
25158 | 27171 | ||
25159 | var _domAlign = __webpack_require__(199); | 27172 | var _domAlign = __webpack_require__(191); |
25160 | 27173 | ||
25161 | var _domAlign2 = _interopRequireDefault(_domAlign); | 27174 | var _domAlign2 = _interopRequireDefault(_domAlign); |
25162 | 27175 | ||
25163 | var _rcUtil = __webpack_require__(173); | 27176 | var _addEventListener = __webpack_require__(184); |
27177 | |||
27178 | var _addEventListener2 = _interopRequireDefault(_addEventListener); | ||
25164 | 27179 | ||
25165 | var _isWindow = __webpack_require__(207); | 27180 | var _isWindow = __webpack_require__(199); |
25166 | 27181 | ||
25167 | var _isWindow2 = _interopRequireDefault(_isWindow); | 27182 | var _isWindow2 = _interopRequireDefault(_isWindow); |
25168 | 27183 | ||
27184 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
27185 | |||
25169 | function buffer(fn, ms) { | 27186 | function buffer(fn, ms) { |
25170 | var timer = undefined; | 27187 | var timer = void 0; |
25171 | return function bufferFn() { | 27188 | |
27189 | function clear() { | ||
25172 | if (timer) { | 27190 | if (timer) { |
25173 | clearTimeout(timer); | 27191 | clearTimeout(timer); |
27192 | timer = null; | ||
25174 | } | 27193 | } |
27194 | } | ||
27195 | |||
27196 | function bufferFn() { | ||
27197 | clear(); | ||
25175 | timer = setTimeout(fn, ms); | 27198 | timer = setTimeout(fn, ms); |
25176 | }; | 27199 | } |
27200 | |||
27201 | bufferFn.clear = clear; | ||
27202 | |||
27203 | return bufferFn; | ||
25177 | } | 27204 | } |
25178 | 27205 | ||
25179 | var Align = _react2['default'].createClass({ | 27206 | var Align = _react2["default"].createClass({ |
25180 | displayName: 'Align', | 27207 | displayName: 'Align', |
25181 | 27208 | ||
25182 | propTypes: { | 27209 | propTypes: { |
@@ -25196,37 +27223,31 @@ | |||
25196 | return window; | 27223 | return window; |
25197 | }, | 27224 | }, |
25198 | onAlign: function onAlign() {}, | 27225 | onAlign: function onAlign() {}, |
27226 | |||
25199 | monitorBufferTime: 50, | 27227 | monitorBufferTime: 50, |
25200 | monitorWindowResize: false, | 27228 | monitorWindowResize: false, |
25201 | disabled: false | 27229 | disabled: false |
25202 | }; | 27230 | }; |
25203 | }, | 27231 | }, |
25204 | |||
25205 | componentDidMount: function componentDidMount() { | 27232 | componentDidMount: function componentDidMount() { |
25206 | var props = this.props; | 27233 | var props = this.props; |
25207 | // if parent ref not attached .... use document.getElementById | 27234 | // if parent ref not attached .... use document.getElementById |
25208 | if (!props.disabled) { | 27235 | this.forceAlign(); |
25209 | var source = _reactDom2['default'].findDOMNode(this); | 27236 | if (!props.disabled && props.monitorWindowResize) { |
25210 | props.onAlign(source, (0, _domAlign2['default'])(source, props.target(), props.align)); | 27237 | this.startMonitorWindowResize(); |
25211 | if (props.monitorWindowResize) { | ||
25212 | this.startMonitorWindowResize(); | ||
25213 | } | ||
25214 | } | 27238 | } |
25215 | }, | 27239 | }, |
25216 | |||
25217 | componentDidUpdate: function componentDidUpdate(prevProps) { | 27240 | componentDidUpdate: function componentDidUpdate(prevProps) { |
25218 | var reAlign = false; | 27241 | var reAlign = false; |
25219 | var props = this.props; | 27242 | var props = this.props; |
25220 | var currentTarget = undefined; | ||
25221 | 27243 | ||
25222 | if (!props.disabled) { | 27244 | if (!props.disabled) { |
25223 | if (prevProps.disabled || prevProps.align !== props.align) { | 27245 | if (prevProps.disabled || prevProps.align !== props.align) { |
25224 | reAlign = true; | 27246 | reAlign = true; |
25225 | currentTarget = props.target(); | ||
25226 | } else { | 27247 | } else { |
25227 | var lastTarget = prevProps.target(); | 27248 | var lastTarget = prevProps.target(); |
25228 | currentTarget = props.target(); | 27249 | var currentTarget = props.target(); |
25229 | if ((0, _isWindow2['default'])(lastTarget) && (0, _isWindow2['default'])(currentTarget)) { | 27250 | if ((0, _isWindow2["default"])(lastTarget) && (0, _isWindow2["default"])(currentTarget)) { |
25230 | reAlign = false; | 27251 | reAlign = false; |
25231 | } else if (lastTarget !== currentTarget) { | 27252 | } else if (lastTarget !== currentTarget) { |
25232 | reAlign = true; | 27253 | reAlign = true; |
@@ -25235,8 +27256,7 @@ | |||
25235 | } | 27256 | } |
25236 | 27257 | ||
25237 | if (reAlign) { | 27258 | if (reAlign) { |
25238 | var source = _reactDom2['default'].findDOMNode(this); | 27259 | this.forceAlign(); |
25239 | props.onAlign(source, (0, _domAlign2['default'])(source, currentTarget, props.align)); | ||
25240 | } | 27260 | } |
25241 | 27261 | ||
25242 | if (props.monitorWindowResize && !props.disabled) { | 27262 | if (props.monitorWindowResize && !props.disabled) { |
@@ -25245,38 +27265,35 @@ | |||
25245 | this.stopMonitorWindowResize(); | 27265 | this.stopMonitorWindowResize(); |
25246 | } | 27266 | } |
25247 | }, | 27267 | }, |
25248 | |||
25249 | componentWillUnmount: function componentWillUnmount() { | 27268 | componentWillUnmount: function componentWillUnmount() { |
25250 | this.stopMonitorWindowResize(); | 27269 | this.stopMonitorWindowResize(); |
25251 | }, | 27270 | }, |
25252 | |||
25253 | onWindowResize: function onWindowResize() { | ||
25254 | var props = this.props; | ||
25255 | if (!props.disabled) { | ||
25256 | var source = _reactDom2['default'].findDOMNode(this); | ||
25257 | props.onAlign(source, (0, _domAlign2['default'])(source, props.target(), props.align)); | ||
25258 | } | ||
25259 | }, | ||
25260 | |||
25261 | startMonitorWindowResize: function startMonitorWindowResize() { | 27271 | startMonitorWindowResize: function startMonitorWindowResize() { |
25262 | if (!this.resizeHandler) { | 27272 | if (!this.resizeHandler) { |
25263 | this.resizeHandler = _rcUtil.Dom.addEventListener(window, 'resize', buffer(this.onWindowResize, this.props.monitorBufferTime)); | 27273 | this.bufferMonitor = buffer(this.forceAlign, this.props.monitorBufferTime); |
27274 | this.resizeHandler = (0, _addEventListener2["default"])(window, 'resize', this.bufferMonitor); | ||
25264 | } | 27275 | } |
25265 | }, | 27276 | }, |
25266 | |||
25267 | stopMonitorWindowResize: function stopMonitorWindowResize() { | 27277 | stopMonitorWindowResize: function stopMonitorWindowResize() { |
25268 | if (this.resizeHandler) { | 27278 | if (this.resizeHandler) { |
27279 | this.bufferMonitor.clear(); | ||
25269 | this.resizeHandler.remove(); | 27280 | this.resizeHandler.remove(); |
25270 | this.resizeHandler = null; | 27281 | this.resizeHandler = null; |
25271 | } | 27282 | } |
25272 | }, | 27283 | }, |
25273 | 27284 | forceAlign: function forceAlign() { | |
27285 | var props = this.props; | ||
27286 | if (!props.disabled) { | ||
27287 | var source = _reactDom2["default"].findDOMNode(this); | ||
27288 | props.onAlign(source, (0, _domAlign2["default"])(source, props.target(), props.align)); | ||
27289 | } | ||
27290 | }, | ||
25274 | render: function render() { | 27291 | render: function render() { |
25275 | var _props = this.props; | 27292 | var _props = this.props; |
25276 | var childrenProps = _props.childrenProps; | 27293 | var childrenProps = _props.childrenProps; |
25277 | var children = _props.children; | 27294 | var children = _props.children; |
25278 | 27295 | ||
25279 | var child = _react2['default'].Children.only(children); | 27296 | var child = _react2["default"].Children.only(children); |
25280 | if (childrenProps) { | 27297 | if (childrenProps) { |
25281 | var newProps = {}; | 27298 | var newProps = {}; |
25282 | for (var prop in childrenProps) { | 27299 | for (var prop in childrenProps) { |
@@ -25284,17 +27301,17 @@ | |||
25284 | newProps[prop] = this.props[childrenProps[prop]]; | 27301 | newProps[prop] = this.props[childrenProps[prop]]; |
25285 | } | 27302 | } |
25286 | } | 27303 | } |
25287 | return _react2['default'].cloneElement(child, newProps); | 27304 | return _react2["default"].cloneElement(child, newProps); |
25288 | } | 27305 | } |
25289 | return child; | 27306 | return child; |
25290 | } | 27307 | } |
25291 | }); | 27308 | }); |
25292 | 27309 | ||
25293 | exports['default'] = Align; | 27310 | exports["default"] = Align; |
25294 | module.exports = exports['default']; | 27311 | module.exports = exports['default']; |
25295 | 27312 | ||
25296 | /***/ }, | 27313 | /***/ }, |
25297 | /* 199 */ | 27314 | /* 191 */ |
25298 | /***/ function(module, exports, __webpack_require__) { | 27315 | /***/ function(module, exports, __webpack_require__) { |
25299 | 27316 | ||
25300 | /** | 27317 | /** |
@@ -25310,27 +27327,27 @@ | |||
25310 | 27327 | ||
25311 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | 27328 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } |
25312 | 27329 | ||
25313 | var _utils = __webpack_require__(200); | 27330 | var _utils = __webpack_require__(192); |
25314 | 27331 | ||
25315 | var _utils2 = _interopRequireDefault(_utils); | 27332 | var _utils2 = _interopRequireDefault(_utils); |
25316 | 27333 | ||
25317 | var _getOffsetParent = __webpack_require__(201); | 27334 | var _getOffsetParent = __webpack_require__(193); |
25318 | 27335 | ||
25319 | var _getOffsetParent2 = _interopRequireDefault(_getOffsetParent); | 27336 | var _getOffsetParent2 = _interopRequireDefault(_getOffsetParent); |
25320 | 27337 | ||
25321 | var _getVisibleRectForElement = __webpack_require__(202); | 27338 | var _getVisibleRectForElement = __webpack_require__(194); |
25322 | 27339 | ||
25323 | var _getVisibleRectForElement2 = _interopRequireDefault(_getVisibleRectForElement); | 27340 | var _getVisibleRectForElement2 = _interopRequireDefault(_getVisibleRectForElement); |
25324 | 27341 | ||
25325 | var _adjustForViewport = __webpack_require__(203); | 27342 | var _adjustForViewport = __webpack_require__(195); |
25326 | 27343 | ||
25327 | var _adjustForViewport2 = _interopRequireDefault(_adjustForViewport); | 27344 | var _adjustForViewport2 = _interopRequireDefault(_adjustForViewport); |
25328 | 27345 | ||
25329 | var _getRegion = __webpack_require__(204); | 27346 | var _getRegion = __webpack_require__(196); |
25330 | 27347 | ||
25331 | var _getRegion2 = _interopRequireDefault(_getRegion); | 27348 | var _getRegion2 = _interopRequireDefault(_getRegion); |
25332 | 27349 | ||
25333 | var _getElFuturePos = __webpack_require__(205); | 27350 | var _getElFuturePos = __webpack_require__(197); |
25334 | 27351 | ||
25335 | var _getElFuturePos2 = _interopRequireDefault(_getElFuturePos); | 27352 | var _getElFuturePos2 = _interopRequireDefault(_getElFuturePos); |
25336 | 27353 | ||
@@ -25344,6 +27361,14 @@ | |||
25344 | return elFuturePos.top < visibleRect.top || elFuturePos.top + elRegion.height > visibleRect.bottom; | 27361 | return elFuturePos.top < visibleRect.top || elFuturePos.top + elRegion.height > visibleRect.bottom; |
25345 | } | 27362 | } |
25346 | 27363 | ||
27364 | function isCompleteFailX(elFuturePos, elRegion, visibleRect) { | ||
27365 | return elFuturePos.left > visibleRect.right || elFuturePos.left + elRegion.width < visibleRect.left; | ||
27366 | } | ||
27367 | |||
27368 | function isCompleteFailY(elFuturePos, elRegion, visibleRect) { | ||
27369 | return elFuturePos.top > visibleRect.bottom || elFuturePos.top + elRegion.height < visibleRect.top; | ||
27370 | } | ||
27371 | |||
25347 | function flip(points, reg, map) { | 27372 | function flip(points, reg, map) { |
25348 | var ret = []; | 27373 | var ret = []; |
25349 | _utils2['default'].each(points, function (p) { | 27374 | _utils2['default'].each(points, function (p) { |
@@ -25406,30 +27431,42 @@ | |||
25406 | if (overflow.adjustX) { | 27431 | if (overflow.adjustX) { |
25407 | // 如果横向不能放下 | 27432 | // 如果横向不能放下 |
25408 | if (isFailX(elFuturePos, elRegion, visibleRect)) { | 27433 | if (isFailX(elFuturePos, elRegion, visibleRect)) { |
25409 | fail = 1; | ||
25410 | // 对齐位置反下 | 27434 | // 对齐位置反下 |
25411 | points = flip(points, /[lr]/ig, { | 27435 | var newPoints = flip(points, /[lr]/ig, { |
25412 | l: 'r', | 27436 | l: 'r', |
25413 | r: 'l' | 27437 | r: 'l' |
25414 | }); | 27438 | }); |
25415 | // 偏移量也反下 | 27439 | // 偏移量也反下 |
25416 | offset = flipOffset(offset, 0); | 27440 | var newOffset = flipOffset(offset, 0); |
25417 | targetOffset = flipOffset(targetOffset, 0); | 27441 | var newTargetOffset = flipOffset(targetOffset, 0); |
27442 | var newElFuturePos = (0, _getElFuturePos2['default'])(elRegion, refNodeRegion, newPoints, newOffset, newTargetOffset); | ||
27443 | if (!isCompleteFailX(newElFuturePos, elRegion, visibleRect)) { | ||
27444 | fail = 1; | ||
27445 | points = newPoints; | ||
27446 | offset = newOffset; | ||
27447 | targetOffset = newTargetOffset; | ||
27448 | } | ||
25418 | } | 27449 | } |
25419 | } | 27450 | } |
25420 | 27451 | ||
25421 | if (overflow.adjustY) { | 27452 | if (overflow.adjustY) { |
25422 | // 如果纵向不能放下 | 27453 | // 如果纵向不能放下 |
25423 | if (isFailY(elFuturePos, elRegion, visibleRect)) { | 27454 | if (isFailY(elFuturePos, elRegion, visibleRect)) { |
25424 | fail = 1; | ||
25425 | // 对齐位置反下 | 27455 | // 对齐位置反下 |
25426 | points = flip(points, /[tb]/ig, { | 27456 | var newPoints = flip(points, /[tb]/ig, { |
25427 | t: 'b', | 27457 | t: 'b', |
25428 | b: 't' | 27458 | b: 't' |
25429 | }); | 27459 | }); |
25430 | // 偏移量也反下 | 27460 | // 偏移量也反下 |
25431 | offset = flipOffset(offset, 1); | 27461 | var newOffset = flipOffset(offset, 1); |
25432 | targetOffset = flipOffset(targetOffset, 1); | 27462 | var newTargetOffset = flipOffset(targetOffset, 1); |
27463 | var newElFuturePos = (0, _getElFuturePos2['default'])(elRegion, refNodeRegion, newPoints, newOffset, newTargetOffset); | ||
27464 | if (!isCompleteFailY(newElFuturePos, elRegion, visibleRect)) { | ||
27465 | fail = 1; | ||
27466 | points = newPoints; | ||
27467 | offset = newOffset; | ||
27468 | targetOffset = newTargetOffset; | ||
27469 | } | ||
25433 | } | 27470 | } |
25434 | } | 27471 | } |
25435 | 27472 | ||
@@ -25497,7 +27534,7 @@ | |||
25497 | module.exports = exports['default']; | 27534 | module.exports = exports['default']; |
25498 | 27535 | ||
25499 | /***/ }, | 27536 | /***/ }, |
25500 | /* 200 */ | 27537 | /* 192 */ |
25501 | /***/ function(module, exports) { | 27538 | /***/ function(module, exports) { |
25502 | 27539 | ||
25503 | 'use strict'; | 27540 | 'use strict'; |
@@ -25995,7 +28032,7 @@ | |||
25995 | module.exports = exports['default']; | 28032 | module.exports = exports['default']; |
25996 | 28033 | ||
25997 | /***/ }, | 28034 | /***/ }, |
25998 | /* 201 */ | 28035 | /* 193 */ |
25999 | /***/ function(module, exports, __webpack_require__) { | 28036 | /***/ function(module, exports, __webpack_require__) { |
26000 | 28037 | ||
26001 | 'use strict'; | 28038 | 'use strict'; |
@@ -26006,7 +28043,7 @@ | |||
26006 | 28043 | ||
26007 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | 28044 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } |
26008 | 28045 | ||
26009 | var _utils = __webpack_require__(200); | 28046 | var _utils = __webpack_require__(192); |
26010 | 28047 | ||
26011 | var _utils2 = _interopRequireDefault(_utils); | 28048 | var _utils2 = _interopRequireDefault(_utils); |
26012 | 28049 | ||
@@ -26053,7 +28090,7 @@ | |||
26053 | module.exports = exports['default']; | 28090 | module.exports = exports['default']; |
26054 | 28091 | ||
26055 | /***/ }, | 28092 | /***/ }, |
26056 | /* 202 */ | 28093 | /* 194 */ |
26057 | /***/ function(module, exports, __webpack_require__) { | 28094 | /***/ function(module, exports, __webpack_require__) { |
26058 | 28095 | ||
26059 | 'use strict'; | 28096 | 'use strict'; |
@@ -26064,11 +28101,11 @@ | |||
26064 | 28101 | ||
26065 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | 28102 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } |
26066 | 28103 | ||
26067 | var _utils = __webpack_require__(200); | 28104 | var _utils = __webpack_require__(192); |
26068 | 28105 | ||
26069 | var _utils2 = _interopRequireDefault(_utils); | 28106 | var _utils2 = _interopRequireDefault(_utils); |
26070 | 28107 | ||
26071 | var _getOffsetParent = __webpack_require__(201); | 28108 | var _getOffsetParent = __webpack_require__(193); |
26072 | 28109 | ||
26073 | var _getOffsetParent2 = _interopRequireDefault(_getOffsetParent); | 28110 | var _getOffsetParent2 = _interopRequireDefault(_getOffsetParent); |
26074 | 28111 | ||
@@ -26134,7 +28171,7 @@ | |||
26134 | module.exports = exports['default']; | 28171 | module.exports = exports['default']; |
26135 | 28172 | ||
26136 | /***/ }, | 28173 | /***/ }, |
26137 | /* 203 */ | 28174 | /* 195 */ |
26138 | /***/ function(module, exports, __webpack_require__) { | 28175 | /***/ function(module, exports, __webpack_require__) { |
26139 | 28176 | ||
26140 | 'use strict'; | 28177 | 'use strict'; |
@@ -26145,7 +28182,7 @@ | |||
26145 | 28182 | ||
26146 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | 28183 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } |
26147 | 28184 | ||
26148 | var _utils = __webpack_require__(200); | 28185 | var _utils = __webpack_require__(192); |
26149 | 28186 | ||
26150 | var _utils2 = _interopRequireDefault(_utils); | 28187 | var _utils2 = _interopRequireDefault(_utils); |
26151 | 28188 | ||
@@ -26194,7 +28231,7 @@ | |||
26194 | module.exports = exports['default']; | 28231 | module.exports = exports['default']; |
26195 | 28232 | ||
26196 | /***/ }, | 28233 | /***/ }, |
26197 | /* 204 */ | 28234 | /* 196 */ |
26198 | /***/ function(module, exports, __webpack_require__) { | 28235 | /***/ function(module, exports, __webpack_require__) { |
26199 | 28236 | ||
26200 | 'use strict'; | 28237 | 'use strict'; |
@@ -26205,7 +28242,7 @@ | |||
26205 | 28242 | ||
26206 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | 28243 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } |
26207 | 28244 | ||
26208 | var _utils = __webpack_require__(200); | 28245 | var _utils = __webpack_require__(192); |
26209 | 28246 | ||
26210 | var _utils2 = _interopRequireDefault(_utils); | 28247 | var _utils2 = _interopRequireDefault(_utils); |
26211 | 28248 | ||
@@ -26235,7 +28272,7 @@ | |||
26235 | module.exports = exports['default']; | 28272 | module.exports = exports['default']; |
26236 | 28273 | ||
26237 | /***/ }, | 28274 | /***/ }, |
26238 | /* 205 */ | 28275 | /* 197 */ |
26239 | /***/ function(module, exports, __webpack_require__) { | 28276 | /***/ function(module, exports, __webpack_require__) { |
26240 | 28277 | ||
26241 | 'use strict'; | 28278 | 'use strict'; |
@@ -26246,7 +28283,7 @@ | |||
26246 | 28283 | ||
26247 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | 28284 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } |
26248 | 28285 | ||
26249 | var _getAlignOffset = __webpack_require__(206); | 28286 | var _getAlignOffset = __webpack_require__(198); |
26250 | 28287 | ||
26251 | var _getAlignOffset2 = _interopRequireDefault(_getAlignOffset); | 28288 | var _getAlignOffset2 = _interopRequireDefault(_getAlignOffset); |
26252 | 28289 | ||
@@ -26276,7 +28313,7 @@ | |||
26276 | module.exports = exports['default']; | 28313 | module.exports = exports['default']; |
26277 | 28314 | ||
26278 | /***/ }, | 28315 | /***/ }, |
26279 | /* 206 */ | 28316 | /* 198 */ |
26280 | /***/ function(module, exports) { | 28317 | /***/ function(module, exports) { |
26281 | 28318 | ||
26282 | /** | 28319 | /** |
@@ -26321,7 +28358,7 @@ | |||
26321 | module.exports = exports['default']; | 28358 | module.exports = exports['default']; |
26322 | 28359 | ||
26323 | /***/ }, | 28360 | /***/ }, |
26324 | /* 207 */ | 28361 | /* 199 */ |
26325 | /***/ function(module, exports) { | 28362 | /***/ function(module, exports) { |
26326 | 28363 | ||
26327 | "use strict"; | 28364 | "use strict"; |
@@ -26330,59 +28367,58 @@ | |||
26330 | value: true | 28367 | value: true |
26331 | }); | 28368 | }); |
26332 | exports["default"] = isWindow; | 28369 | exports["default"] = isWindow; |
26333 | |||
26334 | function isWindow(obj) { | 28370 | function isWindow(obj) { |
26335 | /* eslint no-eq-null: 0 */ | 28371 | /* eslint no-eq-null: 0 */ |
26336 | /* eslint eqeqeq: 0 */ | 28372 | /* eslint eqeqeq: 0 */ |
26337 | return obj != null && obj == obj.window; | 28373 | return obj != null && obj == obj.window; |
26338 | } | 28374 | } |
26339 | 28375 | module.exports = exports['default']; | |
26340 | module.exports = exports["default"]; | ||
26341 | 28376 | ||
26342 | /***/ }, | 28377 | /***/ }, |
26343 | /* 208 */ | 28378 | /* 200 */ |
26344 | /***/ function(module, exports, __webpack_require__) { | 28379 | /***/ function(module, exports, __webpack_require__) { |
26345 | 28380 | ||
26346 | // export this package's api | ||
26347 | 'use strict'; | 28381 | 'use strict'; |
26348 | 28382 | ||
26349 | module.exports = __webpack_require__(209); | 28383 | // export this package's api |
28384 | module.exports = __webpack_require__(201); | ||
26350 | 28385 | ||
26351 | /***/ }, | 28386 | /***/ }, |
26352 | /* 209 */ | 28387 | /* 201 */ |
26353 | /***/ function(module, exports, __webpack_require__) { | 28388 | /***/ function(module, exports, __webpack_require__) { |
26354 | 28389 | ||
26355 | 'use strict'; | 28390 | 'use strict'; |
26356 | 28391 | ||
26357 | Object.defineProperty(exports, '__esModule', { | 28392 | Object.defineProperty(exports, "__esModule", { |
26358 | value: true | 28393 | value: true |
26359 | }); | 28394 | }); |
26360 | 28395 | ||
26361 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
26362 | |||
26363 | 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; } | ||
26364 | |||
26365 | var _react = __webpack_require__(3); | 28396 | var _react = __webpack_require__(3); |
26366 | 28397 | ||
26367 | var _react2 = _interopRequireDefault(_react); | 28398 | var _react2 = _interopRequireDefault(_react); |
26368 | 28399 | ||
26369 | var _ChildrenUtils = __webpack_require__(210); | 28400 | var _ChildrenUtils = __webpack_require__(202); |
26370 | 28401 | ||
26371 | var _AnimateChild = __webpack_require__(211); | 28402 | var _AnimateChild = __webpack_require__(203); |
26372 | 28403 | ||
26373 | var _AnimateChild2 = _interopRequireDefault(_AnimateChild); | 28404 | var _AnimateChild2 = _interopRequireDefault(_AnimateChild); |
26374 | 28405 | ||
26375 | var _util = __webpack_require__(215); | 28406 | var _util = __webpack_require__(208); |
26376 | 28407 | ||
26377 | var _util2 = _interopRequireDefault(_util); | 28408 | var _util2 = _interopRequireDefault(_util); |
26378 | 28409 | ||
28410 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
28411 | |||
28412 | 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; } | ||
28413 | |||
26379 | var defaultKey = 'rc_animate_' + Date.now(); | 28414 | var defaultKey = 'rc_animate_' + Date.now(); |
26380 | 28415 | ||
28416 | |||
26381 | function getChildrenFromProps(props) { | 28417 | function getChildrenFromProps(props) { |
26382 | var children = props.children; | 28418 | var children = props.children; |
26383 | if (_react2['default'].isValidElement(children)) { | 28419 | if (_react2["default"].isValidElement(children)) { |
26384 | if (!children.key) { | 28420 | if (!children.key) { |
26385 | return _react2['default'].cloneElement(children, { | 28421 | return _react2["default"].cloneElement(children, { |
26386 | key: defaultKey | 28422 | key: defaultKey |
26387 | }); | 28423 | }); |
26388 | } | 28424 | } |
@@ -26392,22 +28428,22 @@ | |||
26392 | 28428 | ||
26393 | function noop() {} | 28429 | function noop() {} |
26394 | 28430 | ||
26395 | var Animate = _react2['default'].createClass({ | 28431 | var Animate = _react2["default"].createClass({ |
26396 | displayName: 'Animate', | 28432 | displayName: 'Animate', |
26397 | 28433 | ||
26398 | propTypes: { | 28434 | propTypes: { |
26399 | component: _react2['default'].PropTypes.any, | 28435 | component: _react2["default"].PropTypes.any, |
26400 | animation: _react2['default'].PropTypes.object, | 28436 | animation: _react2["default"].PropTypes.object, |
26401 | transitionName: _react2['default'].PropTypes.string, | 28437 | transitionName: _react2["default"].PropTypes.oneOfType([_react2["default"].PropTypes.string, _react2["default"].PropTypes.object]), |
26402 | transitionEnter: _react2['default'].PropTypes.bool, | 28438 | transitionEnter: _react2["default"].PropTypes.bool, |
26403 | transitionAppear: _react2['default'].PropTypes.bool, | 28439 | transitionAppear: _react2["default"].PropTypes.bool, |
26404 | exclusive: _react2['default'].PropTypes.bool, | 28440 | exclusive: _react2["default"].PropTypes.bool, |
26405 | transitionLeave: _react2['default'].PropTypes.bool, | 28441 | transitionLeave: _react2["default"].PropTypes.bool, |
26406 | onEnd: _react2['default'].PropTypes.func, | 28442 | onEnd: _react2["default"].PropTypes.func, |
26407 | onEnter: _react2['default'].PropTypes.func, | 28443 | onEnter: _react2["default"].PropTypes.func, |
26408 | onLeave: _react2['default'].PropTypes.func, | 28444 | onLeave: _react2["default"].PropTypes.func, |
26409 | onAppear: _react2['default'].PropTypes.func, | 28445 | onAppear: _react2["default"].PropTypes.func, |
26410 | showProp: _react2['default'].PropTypes.string | 28446 | showProp: _react2["default"].PropTypes.string |
26411 | }, | 28447 | }, |
26412 | 28448 | ||
26413 | getDefaultProps: function getDefaultProps() { | 28449 | getDefaultProps: function getDefaultProps() { |
@@ -26423,7 +28459,6 @@ | |||
26423 | onAppear: noop | 28459 | onAppear: noop |
26424 | }; | 28460 | }; |
26425 | }, | 28461 | }, |
26426 | |||
26427 | getInitialState: function getInitialState() { | 28462 | getInitialState: function getInitialState() { |
26428 | this.currentlyAnimatingKeys = {}; | 28463 | this.currentlyAnimatingKeys = {}; |
26429 | this.keysToEnter = []; | 28464 | this.keysToEnter = []; |
@@ -26432,7 +28467,6 @@ | |||
26432 | children: (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(this.props)) | 28467 | children: (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(this.props)) |
26433 | }; | 28468 | }; |
26434 | }, | 28469 | }, |
26435 | |||
26436 | componentDidMount: function componentDidMount() { | 28470 | componentDidMount: function componentDidMount() { |
26437 | var _this = this; | 28471 | var _this = this; |
26438 | 28472 | ||
@@ -26444,28 +28478,35 @@ | |||
26444 | }); | 28478 | }); |
26445 | } | 28479 | } |
26446 | children.forEach(function (child) { | 28480 | children.forEach(function (child) { |
26447 | _this.performAppear(child.key); | 28481 | if (child) { |
28482 | _this.performAppear(child.key); | ||
28483 | } | ||
26448 | }); | 28484 | }); |
26449 | }, | 28485 | }, |
26450 | |||
26451 | componentWillReceiveProps: function componentWillReceiveProps(nextProps) { | 28486 | componentWillReceiveProps: function componentWillReceiveProps(nextProps) { |
26452 | var _this2 = this; | 28487 | var _this2 = this; |
26453 | 28488 | ||
28489 | this.nextProps = nextProps; | ||
26454 | var nextChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(nextProps)); | 28490 | var nextChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(nextProps)); |
26455 | var props = this.props; | 28491 | var props = this.props; |
28492 | // exclusive needs immediate response | ||
28493 | if (props.exclusive) { | ||
28494 | Object.keys(this.currentlyAnimatingKeys).forEach(function (key) { | ||
28495 | _this2.stop(key); | ||
28496 | }); | ||
28497 | } | ||
26456 | var showProp = props.showProp; | 28498 | var showProp = props.showProp; |
26457 | var currentlyAnimatingKeys = this.currentlyAnimatingKeys; | 28499 | var currentlyAnimatingKeys = this.currentlyAnimatingKeys; |
26458 | // last props children if exclusive | 28500 | // last props children if exclusive |
26459 | // exclusive needs immediate response | 28501 | var currentChildren = props.exclusive ? (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props)) : this.state.children; |
26460 | var currentChildren = this.state.children; | ||
26461 | // in case destroy in showProp mode | 28502 | // in case destroy in showProp mode |
26462 | var newChildren = []; | 28503 | var newChildren = []; |
26463 | if (showProp) { | 28504 | if (showProp) { |
26464 | currentChildren.forEach(function (currentChild) { | 28505 | currentChildren.forEach(function (currentChild) { |
26465 | var nextChild = (0, _ChildrenUtils.findChildInChildrenByKey)(nextChildren, currentChild.key); | 28506 | var nextChild = currentChild && (0, _ChildrenUtils.findChildInChildrenByKey)(nextChildren, currentChild.key); |
26466 | var newChild = undefined; | 28507 | var newChild = void 0; |
26467 | if ((!nextChild || !nextChild.props[showProp]) && currentChild.props[showProp]) { | 28508 | if ((!nextChild || !nextChild.props[showProp]) && currentChild.props[showProp]) { |
26468 | newChild = _react2['default'].cloneElement(nextChild || currentChild, _defineProperty({}, showProp, true)); | 28509 | newChild = _react2["default"].cloneElement(nextChild || currentChild, _defineProperty({}, showProp, true)); |
26469 | } else { | 28510 | } else { |
26470 | newChild = nextChild; | 28511 | newChild = nextChild; |
26471 | } | 28512 | } |
@@ -26474,7 +28515,7 @@ | |||
26474 | } | 28515 | } |
26475 | }); | 28516 | }); |
26476 | nextChildren.forEach(function (nextChild) { | 28517 | nextChildren.forEach(function (nextChild) { |
26477 | if (!(0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, nextChild.key)) { | 28518 | if (!nextChild || !(0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, nextChild.key)) { |
26478 | newChildren.push(nextChild); | 28519 | newChildren.push(nextChild); |
26479 | } | 28520 | } |
26480 | }); | 28521 | }); |
@@ -26488,11 +28529,11 @@ | |||
26488 | }); | 28529 | }); |
26489 | 28530 | ||
26490 | nextChildren.forEach(function (child) { | 28531 | nextChildren.forEach(function (child) { |
26491 | var key = child.key; | 28532 | var key = child && child.key; |
26492 | if (currentlyAnimatingKeys[key]) { | 28533 | if (child && currentlyAnimatingKeys[key]) { |
26493 | return; | 28534 | return; |
26494 | } | 28535 | } |
26495 | var hasPrev = (0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, key); | 28536 | var hasPrev = child && (0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, key); |
26496 | if (showProp) { | 28537 | if (showProp) { |
26497 | var showInNext = child.props[showProp]; | 28538 | var showInNext = child.props[showProp]; |
26498 | if (hasPrev) { | 28539 | if (hasPrev) { |
@@ -26509,11 +28550,11 @@ | |||
26509 | }); | 28550 | }); |
26510 | 28551 | ||
26511 | currentChildren.forEach(function (child) { | 28552 | currentChildren.forEach(function (child) { |
26512 | var key = child.key; | 28553 | var key = child && child.key; |
26513 | if (currentlyAnimatingKeys[key]) { | 28554 | if (child && currentlyAnimatingKeys[key]) { |
26514 | return; | 28555 | return; |
26515 | } | 28556 | } |
26516 | var hasNext = (0, _ChildrenUtils.findChildInChildrenByKey)(nextChildren, key); | 28557 | var hasNext = child && (0, _ChildrenUtils.findChildInChildrenByKey)(nextChildren, key); |
26517 | if (showProp) { | 28558 | if (showProp) { |
26518 | var showInNow = child.props[showProp]; | 28559 | var showInNow = child.props[showProp]; |
26519 | if (hasNext) { | 28560 | if (hasNext) { |
@@ -26529,26 +28570,14 @@ | |||
26529 | } | 28570 | } |
26530 | }); | 28571 | }); |
26531 | }, | 28572 | }, |
26532 | 28573 | componentDidUpdate: function componentDidUpdate() { | |
26533 | componentDidUpdate: function componentDidUpdate(prevProps) { | 28574 | var keysToEnter = this.keysToEnter; |
26534 | var _this3 = this; | 28575 | this.keysToEnter = []; |
26535 | 28576 | keysToEnter.forEach(this.performEnter); | |
26536 | // exclusive needs immediate response | 28577 | var keysToLeave = this.keysToLeave; |
26537 | if (this.props.exclusive && this.props !== prevProps) { | 28578 | this.keysToLeave = []; |
26538 | Object.keys(this.currentlyAnimatingKeys).forEach(function (key) { | 28579 | keysToLeave.forEach(this.performLeave); |
26539 | _this3.stop(key); | ||
26540 | }); | ||
26541 | } | ||
26542 | if (this.isMounted()) { | ||
26543 | var keysToEnter = this.keysToEnter; | ||
26544 | this.keysToEnter = []; | ||
26545 | keysToEnter.forEach(this.performEnter); | ||
26546 | var keysToLeave = this.keysToLeave; | ||
26547 | this.keysToLeave = []; | ||
26548 | keysToLeave.forEach(this.performLeave); | ||
26549 | } | ||
26550 | }, | 28580 | }, |
26551 | |||
26552 | performEnter: function performEnter(key) { | 28581 | performEnter: function performEnter(key) { |
26553 | // may already remove by exclusive | 28582 | // may already remove by exclusive |
26554 | if (this.refs[key]) { | 28583 | if (this.refs[key]) { |
@@ -26556,36 +28585,37 @@ | |||
26556 | this.refs[key].componentWillEnter(this.handleDoneAdding.bind(this, key, 'enter')); | 28585 | this.refs[key].componentWillEnter(this.handleDoneAdding.bind(this, key, 'enter')); |
26557 | } | 28586 | } |
26558 | }, | 28587 | }, |
26559 | |||
26560 | performAppear: function performAppear(key) { | 28588 | performAppear: function performAppear(key) { |
26561 | if (this.refs[key]) { | 28589 | if (this.refs[key]) { |
26562 | this.currentlyAnimatingKeys[key] = true; | 28590 | this.currentlyAnimatingKeys[key] = true; |
26563 | this.refs[key].componentWillAppear(this.handleDoneAdding.bind(this, key, 'appear')); | 28591 | this.refs[key].componentWillAppear(this.handleDoneAdding.bind(this, key, 'appear')); |
26564 | } | 28592 | } |
26565 | }, | 28593 | }, |
26566 | |||
26567 | handleDoneAdding: function handleDoneAdding(key, type) { | 28594 | handleDoneAdding: function handleDoneAdding(key, type) { |
26568 | var props = this.props; | 28595 | var props = this.props; |
26569 | delete this.currentlyAnimatingKeys[key]; | 28596 | delete this.currentlyAnimatingKeys[key]; |
28597 | // if update on exclusive mode, skip check | ||
28598 | if (props.exclusive && props !== this.nextProps) { | ||
28599 | return; | ||
28600 | } | ||
26570 | var currentChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props)); | 28601 | var currentChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props)); |
26571 | if (!this.isValidChildByKey(currentChildren, key)) { | 28602 | if (!this.isValidChildByKey(currentChildren, key)) { |
26572 | // exclusive will not need this | 28603 | // exclusive will not need this |
26573 | this.performLeave(key); | 28604 | this.performLeave(key); |
26574 | } else { | 28605 | } else { |
26575 | if (type === 'appear') { | 28606 | if (type === 'appear') { |
26576 | if (_util2['default'].allowAppearCallback(props)) { | 28607 | if (_util2["default"].allowAppearCallback(props)) { |
26577 | props.onAppear(key); | 28608 | props.onAppear(key); |
26578 | props.onEnd(key, true); | 28609 | props.onEnd(key, true); |
26579 | } | 28610 | } |
26580 | } else { | 28611 | } else { |
26581 | if (_util2['default'].allowEnterCallback(props)) { | 28612 | if (_util2["default"].allowEnterCallback(props)) { |
26582 | props.onEnter(key); | 28613 | props.onEnter(key); |
26583 | props.onEnd(key, true); | 28614 | props.onEnd(key, true); |
26584 | } | 28615 | } |
26585 | } | 28616 | } |
26586 | } | 28617 | } |
26587 | }, | 28618 | }, |
26588 | |||
26589 | performLeave: function performLeave(key) { | 28619 | performLeave: function performLeave(key) { |
26590 | // may already remove by exclusive | 28620 | // may already remove by exclusive |
26591 | if (this.refs[key]) { | 28621 | if (this.refs[key]) { |
@@ -26593,27 +28623,34 @@ | |||
26593 | this.refs[key].componentWillLeave(this.handleDoneLeaving.bind(this, key)); | 28623 | this.refs[key].componentWillLeave(this.handleDoneLeaving.bind(this, key)); |
26594 | } | 28624 | } |
26595 | }, | 28625 | }, |
26596 | |||
26597 | handleDoneLeaving: function handleDoneLeaving(key) { | 28626 | handleDoneLeaving: function handleDoneLeaving(key) { |
26598 | var props = this.props; | 28627 | var props = this.props; |
26599 | delete this.currentlyAnimatingKeys[key]; | 28628 | delete this.currentlyAnimatingKeys[key]; |
28629 | // if update on exclusive mode, skip check | ||
28630 | if (props.exclusive && props !== this.nextProps) { | ||
28631 | return; | ||
28632 | } | ||
26600 | var currentChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props)); | 28633 | var currentChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props)); |
26601 | // in case state change is too fast | 28634 | // in case state change is too fast |
26602 | if (this.isValidChildByKey(currentChildren, key)) { | 28635 | if (this.isValidChildByKey(currentChildren, key)) { |
26603 | this.performEnter(key); | 28636 | this.performEnter(key); |
26604 | } else { | 28637 | } else { |
26605 | if (_util2['default'].allowLeaveCallback(props)) { | 28638 | var end = function end() { |
26606 | props.onLeave(key); | 28639 | if (_util2["default"].allowLeaveCallback(props)) { |
26607 | props.onEnd(key, false); | 28640 | props.onLeave(key); |
26608 | } | 28641 | props.onEnd(key, false); |
28642 | } | ||
28643 | }; | ||
28644 | /* eslint react/no-is-mounted:0 */ | ||
26609 | if (this.isMounted() && !(0, _ChildrenUtils.isSameChildren)(this.state.children, currentChildren, props.showProp)) { | 28645 | if (this.isMounted() && !(0, _ChildrenUtils.isSameChildren)(this.state.children, currentChildren, props.showProp)) { |
26610 | this.setState({ | 28646 | this.setState({ |
26611 | children: currentChildren | 28647 | children: currentChildren |
26612 | }); | 28648 | }, end); |
28649 | } else { | ||
28650 | end(); | ||
26613 | } | 28651 | } |
26614 | } | 28652 | } |
26615 | }, | 28653 | }, |
26616 | |||
26617 | isValidChildByKey: function isValidChildByKey(currentChildren, key) { | 28654 | isValidChildByKey: function isValidChildByKey(currentChildren, key) { |
26618 | var showProp = this.props.showProp; | 28655 | var showProp = this.props.showProp; |
26619 | if (showProp) { | 28656 | if (showProp) { |
@@ -26621,7 +28658,6 @@ | |||
26621 | } | 28658 | } |
26622 | return (0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, key); | 28659 | return (0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, key); |
26623 | }, | 28660 | }, |
26624 | |||
26625 | stop: function stop(key) { | 28661 | stop: function stop(key) { |
26626 | delete this.currentlyAnimatingKeys[key]; | 28662 | delete this.currentlyAnimatingKeys[key]; |
26627 | var component = this.refs[key]; | 28663 | var component = this.refs[key]; |
@@ -26629,18 +28665,21 @@ | |||
26629 | component.stop(); | 28665 | component.stop(); |
26630 | } | 28666 | } |
26631 | }, | 28667 | }, |
26632 | |||
26633 | render: function render() { | 28668 | render: function render() { |
26634 | var props = this.props; | 28669 | var props = this.props; |
28670 | this.nextProps = props; | ||
26635 | var stateChildren = this.state.children; | 28671 | var stateChildren = this.state.children; |
26636 | var children = null; | 28672 | var children = null; |
26637 | if (stateChildren) { | 28673 | if (stateChildren) { |
26638 | children = stateChildren.map(function (child) { | 28674 | children = stateChildren.map(function (child) { |
28675 | if (child === null || child === undefined) { | ||
28676 | return child; | ||
28677 | } | ||
26639 | if (!child.key) { | 28678 | if (!child.key) { |
26640 | throw new Error('must set key for <rc-animate> children'); | 28679 | throw new Error('must set key for <rc-animate> children'); |
26641 | } | 28680 | } |
26642 | return _react2['default'].createElement( | 28681 | return _react2["default"].createElement( |
26643 | _AnimateChild2['default'], | 28682 | _AnimateChild2["default"], |
26644 | { | 28683 | { |
26645 | key: child.key, | 28684 | key: child.key, |
26646 | ref: child.key, | 28685 | ref: child.key, |
@@ -26648,16 +28687,24 @@ | |||
26648 | transitionName: props.transitionName, | 28687 | transitionName: props.transitionName, |
26649 | transitionEnter: props.transitionEnter, | 28688 | transitionEnter: props.transitionEnter, |
26650 | transitionAppear: props.transitionAppear, | 28689 | transitionAppear: props.transitionAppear, |
26651 | transitionLeave: props.transitionLeave }, | 28690 | transitionLeave: props.transitionLeave |
28691 | }, | ||
26652 | child | 28692 | child |
26653 | ); | 28693 | ); |
26654 | }); | 28694 | }); |
26655 | } | 28695 | } |
26656 | var Component = props.component; | 28696 | var Component = props.component; |
26657 | if (Component) { | 28697 | if (Component) { |
26658 | return _react2['default'].createElement( | 28698 | var passedProps = props; |
28699 | if (typeof Component === 'string') { | ||
28700 | passedProps = { | ||
28701 | className: props.className, | ||
28702 | style: props.style | ||
28703 | }; | ||
28704 | } | ||
28705 | return _react2["default"].createElement( | ||
26659 | Component, | 28706 | Component, |
26660 | this.props, | 28707 | passedProps, |
26661 | children | 28708 | children |
26662 | ); | 28709 | ); |
26663 | } | 28710 | } |
@@ -26665,16 +28712,16 @@ | |||
26665 | } | 28712 | } |
26666 | }); | 28713 | }); |
26667 | 28714 | ||
26668 | exports['default'] = Animate; | 28715 | exports["default"] = Animate; |
26669 | module.exports = exports['default']; | 28716 | module.exports = exports['default']; |
26670 | 28717 | ||
26671 | /***/ }, | 28718 | /***/ }, |
26672 | /* 210 */ | 28719 | /* 202 */ |
26673 | /***/ function(module, exports, __webpack_require__) { | 28720 | /***/ function(module, exports, __webpack_require__) { |
26674 | 28721 | ||
26675 | 'use strict'; | 28722 | 'use strict'; |
26676 | 28723 | ||
26677 | Object.defineProperty(exports, '__esModule', { | 28724 | Object.defineProperty(exports, "__esModule", { |
26678 | value: true | 28725 | value: true |
26679 | }); | 28726 | }); |
26680 | exports.toArrayChildren = toArrayChildren; | 28727 | exports.toArrayChildren = toArrayChildren; |
@@ -26684,15 +28731,15 @@ | |||
26684 | exports.isSameChildren = isSameChildren; | 28731 | exports.isSameChildren = isSameChildren; |
26685 | exports.mergeChildren = mergeChildren; | 28732 | exports.mergeChildren = mergeChildren; |
26686 | 28733 | ||
26687 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
26688 | |||
26689 | var _react = __webpack_require__(3); | 28734 | var _react = __webpack_require__(3); |
26690 | 28735 | ||
26691 | var _react2 = _interopRequireDefault(_react); | 28736 | var _react2 = _interopRequireDefault(_react); |
26692 | 28737 | ||
28738 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
28739 | |||
26693 | function toArrayChildren(children) { | 28740 | function toArrayChildren(children) { |
26694 | var ret = []; | 28741 | var ret = []; |
26695 | _react2['default'].Children.forEach(children, function (child) { | 28742 | _react2["default"].Children.forEach(children, function (child) { |
26696 | ret.push(child); | 28743 | ret.push(child); |
26697 | }); | 28744 | }); |
26698 | return ret; | 28745 | return ret; |
@@ -26705,7 +28752,7 @@ | |||
26705 | if (ret) { | 28752 | if (ret) { |
26706 | return; | 28753 | return; |
26707 | } | 28754 | } |
26708 | if (child.key === key) { | 28755 | if (child && child.key === key) { |
26709 | ret = child; | 28756 | ret = child; |
26710 | } | 28757 | } |
26711 | }); | 28758 | }); |
@@ -26717,7 +28764,7 @@ | |||
26717 | var ret = null; | 28764 | var ret = null; |
26718 | if (children) { | 28765 | if (children) { |
26719 | children.forEach(function (child) { | 28766 | children.forEach(function (child) { |
26720 | if (child.key === key && child.props[showProp]) { | 28767 | if (child && child.key === key && child.props[showProp]) { |
26721 | if (ret) { | 28768 | if (ret) { |
26722 | throw new Error('two child with same key for <rc-animate> children'); | 28769 | throw new Error('two child with same key for <rc-animate> children'); |
26723 | } | 28770 | } |
@@ -26735,7 +28782,7 @@ | |||
26735 | if (found) { | 28782 | if (found) { |
26736 | return; | 28783 | return; |
26737 | } | 28784 | } |
26738 | found = child.key === key && !child.props[showProp]; | 28785 | found = child && child.key === key && !child.props[showProp]; |
26739 | }); | 28786 | }); |
26740 | } | 28787 | } |
26741 | return found; | 28788 | return found; |
@@ -26746,10 +28793,14 @@ | |||
26746 | if (same) { | 28793 | if (same) { |
26747 | c1.forEach(function (child, index) { | 28794 | c1.forEach(function (child, index) { |
26748 | var child2 = c2[index]; | 28795 | var child2 = c2[index]; |
26749 | if (child.key !== child2.key) { | 28796 | if (child && child2) { |
26750 | same = false; | 28797 | if (child && !child2 || !child && child2) { |
26751 | } else if (showProp && child.props[showProp] !== child2.props[showProp]) { | 28798 | same = false; |
26752 | same = false; | 28799 | } else if (child.key !== child2.key) { |
28800 | same = false; | ||
28801 | } else if (showProp && child.props[showProp] !== child2.props[showProp]) { | ||
28802 | same = false; | ||
28803 | } | ||
26753 | } | 28804 | } |
26754 | }); | 28805 | }); |
26755 | } | 28806 | } |
@@ -26764,7 +28815,7 @@ | |||
26764 | var nextChildrenPending = {}; | 28815 | var nextChildrenPending = {}; |
26765 | var pendingChildren = []; | 28816 | var pendingChildren = []; |
26766 | prev.forEach(function (child) { | 28817 | prev.forEach(function (child) { |
26767 | if (findChildInChildrenByKey(next, child.key)) { | 28818 | if (child && findChildInChildrenByKey(next, child.key)) { |
26768 | if (pendingChildren.length) { | 28819 | if (pendingChildren.length) { |
26769 | nextChildrenPending[child.key] = pendingChildren; | 28820 | nextChildrenPending[child.key] = pendingChildren; |
26770 | pendingChildren = []; | 28821 | pendingChildren = []; |
@@ -26775,7 +28826,7 @@ | |||
26775 | }); | 28826 | }); |
26776 | 28827 | ||
26777 | next.forEach(function (child) { | 28828 | next.forEach(function (child) { |
26778 | if (nextChildrenPending.hasOwnProperty(child.key)) { | 28829 | if (child && nextChildrenPending.hasOwnProperty(child.key)) { |
26779 | ret = ret.concat(nextChildrenPending[child.key]); | 28830 | ret = ret.concat(nextChildrenPending[child.key]); |
26780 | } | 28831 | } |
26781 | ret.push(child); | 28832 | ret.push(child); |
@@ -26787,92 +28838,101 @@ | |||
26787 | } | 28838 | } |
26788 | 28839 | ||
26789 | /***/ }, | 28840 | /***/ }, |
26790 | /* 211 */ | 28841 | /* 203 */ |
26791 | /***/ function(module, exports, __webpack_require__) { | 28842 | /***/ function(module, exports, __webpack_require__) { |
26792 | 28843 | ||
26793 | 'use strict'; | 28844 | 'use strict'; |
26794 | 28845 | ||
26795 | Object.defineProperty(exports, '__esModule', { | 28846 | Object.defineProperty(exports, "__esModule", { |
26796 | value: true | 28847 | value: true |
26797 | }); | 28848 | }); |
26798 | 28849 | ||
26799 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | 28850 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; |
26800 | 28851 | ||
26801 | var _react = __webpack_require__(3); | 28852 | var _react = __webpack_require__(3); |
26802 | 28853 | ||
26803 | var _react2 = _interopRequireDefault(_react); | 28854 | var _react2 = _interopRequireDefault(_react); |
26804 | 28855 | ||
26805 | var _reactDom = __webpack_require__(160); | 28856 | var _reactDom = __webpack_require__(37); |
26806 | 28857 | ||
26807 | var _reactDom2 = _interopRequireDefault(_reactDom); | 28858 | var _reactDom2 = _interopRequireDefault(_reactDom); |
26808 | 28859 | ||
26809 | var _cssAnimation = __webpack_require__(212); | 28860 | var _cssAnimation = __webpack_require__(204); |
26810 | 28861 | ||
26811 | var _cssAnimation2 = _interopRequireDefault(_cssAnimation); | 28862 | var _cssAnimation2 = _interopRequireDefault(_cssAnimation); |
26812 | 28863 | ||
26813 | var _util = __webpack_require__(215); | 28864 | var _util = __webpack_require__(208); |
26814 | 28865 | ||
26815 | var _util2 = _interopRequireDefault(_util); | 28866 | var _util2 = _interopRequireDefault(_util); |
26816 | 28867 | ||
28868 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
28869 | |||
26817 | var transitionMap = { | 28870 | var transitionMap = { |
26818 | enter: 'transitionEnter', | 28871 | enter: 'transitionEnter', |
26819 | appear: 'transitionAppear', | 28872 | appear: 'transitionAppear', |
26820 | leave: 'transitionLeave' | 28873 | leave: 'transitionLeave' |
26821 | }; | 28874 | }; |
26822 | 28875 | ||
26823 | var AnimateChild = _react2['default'].createClass({ | 28876 | var AnimateChild = _react2["default"].createClass({ |
26824 | displayName: 'AnimateChild', | 28877 | displayName: 'AnimateChild', |
26825 | 28878 | ||
26826 | propTypes: { | 28879 | propTypes: { |
26827 | children: _react2['default'].PropTypes.any | 28880 | children: _react2["default"].PropTypes.any |
26828 | }, | 28881 | }, |
26829 | 28882 | ||
26830 | componentWillUnmount: function componentWillUnmount() { | 28883 | componentWillUnmount: function componentWillUnmount() { |
26831 | this.stop(); | 28884 | this.stop(); |
26832 | }, | 28885 | }, |
26833 | |||
26834 | componentWillEnter: function componentWillEnter(done) { | 28886 | componentWillEnter: function componentWillEnter(done) { |
26835 | if (_util2['default'].isEnterSupported(this.props)) { | 28887 | if (_util2["default"].isEnterSupported(this.props)) { |
26836 | this.transition('enter', done); | 28888 | this.transition('enter', done); |
26837 | } else { | 28889 | } else { |
26838 | done(); | 28890 | done(); |
26839 | } | 28891 | } |
26840 | }, | 28892 | }, |
26841 | |||
26842 | componentWillAppear: function componentWillAppear(done) { | 28893 | componentWillAppear: function componentWillAppear(done) { |
26843 | if (_util2['default'].isAppearSupported(this.props)) { | 28894 | if (_util2["default"].isAppearSupported(this.props)) { |
26844 | this.transition('appear', done); | 28895 | this.transition('appear', done); |
26845 | } else { | 28896 | } else { |
26846 | done(); | 28897 | done(); |
26847 | } | 28898 | } |
26848 | }, | 28899 | }, |
26849 | |||
26850 | componentWillLeave: function componentWillLeave(done) { | 28900 | componentWillLeave: function componentWillLeave(done) { |
26851 | if (_util2['default'].isLeaveSupported(this.props)) { | 28901 | if (_util2["default"].isLeaveSupported(this.props)) { |
26852 | this.transition('leave', done); | 28902 | this.transition('leave', done); |
26853 | } else { | 28903 | } else { |
28904 | // always sync, do not interupt with react component life cycle | ||
28905 | // update hidden -> animate hidden -> | ||
28906 | // didUpdate -> animate leave -> unmount (if animate is none) | ||
26854 | done(); | 28907 | done(); |
26855 | } | 28908 | } |
26856 | }, | 28909 | }, |
26857 | |||
26858 | transition: function transition(animationType, finishCallback) { | 28910 | transition: function transition(animationType, finishCallback) { |
26859 | var _this = this; | 28911 | var _this = this; |
26860 | 28912 | ||
26861 | var node = _reactDom2['default'].findDOMNode(this); | 28913 | var node = _reactDom2["default"].findDOMNode(this); |
26862 | var props = this.props; | 28914 | var props = this.props; |
26863 | var transitionName = props.transitionName; | 28915 | var transitionName = props.transitionName; |
28916 | var nameIsObj = (typeof transitionName === 'undefined' ? 'undefined' : _typeof(transitionName)) === 'object'; | ||
26864 | this.stop(); | 28917 | this.stop(); |
26865 | var end = function end() { | 28918 | var end = function end() { |
26866 | _this.stopper = null; | 28919 | _this.stopper = null; |
26867 | finishCallback(); | 28920 | finishCallback(); |
26868 | }; | 28921 | }; |
26869 | if ((_cssAnimation.isCssAnimationSupported || !props.animation[animationType]) && transitionName && props[transitionMap[animationType]]) { | 28922 | if ((_cssAnimation.isCssAnimationSupported || !props.animation[animationType]) && transitionName && props[transitionMap[animationType]]) { |
26870 | this.stopper = (0, _cssAnimation2['default'])(node, transitionName + '-' + animationType, end); | 28923 | var name = nameIsObj ? transitionName[animationType] : transitionName + '-' + animationType; |
28924 | var activeName = name + '-active'; | ||
28925 | if (nameIsObj && transitionName[animationType + 'Active']) { | ||
28926 | activeName = transitionName[animationType + 'Active']; | ||
28927 | } | ||
28928 | this.stopper = (0, _cssAnimation2["default"])(node, { | ||
28929 | name: name, | ||
28930 | active: activeName | ||
28931 | }, end); | ||
26871 | } else { | 28932 | } else { |
26872 | this.stopper = props.animation[animationType](node, end); | 28933 | this.stopper = props.animation[animationType](node, end); |
26873 | } | 28934 | } |
26874 | }, | 28935 | }, |
26875 | |||
26876 | stop: function stop() { | 28936 | stop: function stop() { |
26877 | var stopper = this.stopper; | 28937 | var stopper = this.stopper; |
26878 | if (stopper) { | 28938 | if (stopper) { |
@@ -26880,28 +28940,47 @@ | |||
26880 | stopper.stop(); | 28940 | stopper.stop(); |
26881 | } | 28941 | } |
26882 | }, | 28942 | }, |
26883 | |||
26884 | render: function render() { | 28943 | render: function render() { |
26885 | return this.props.children; | 28944 | return this.props.children; |
26886 | } | 28945 | } |
26887 | }); | 28946 | }); |
26888 | 28947 | ||
26889 | exports['default'] = AnimateChild; | 28948 | exports["default"] = AnimateChild; |
26890 | module.exports = exports['default']; | 28949 | module.exports = exports['default']; |
26891 | 28950 | ||
26892 | /***/ }, | 28951 | /***/ }, |
26893 | /* 212 */ | 28952 | /* 204 */ |
26894 | /***/ function(module, exports, __webpack_require__) { | 28953 | /***/ function(module, exports, __webpack_require__) { |
26895 | 28954 | ||
26896 | 'use strict'; | 28955 | 'use strict'; |
26897 | 28956 | ||
26898 | var Event = __webpack_require__(213); | 28957 | Object.defineProperty(exports, "__esModule", { |
26899 | var Css = __webpack_require__(214); | 28958 | value: true |
26900 | var isCssAnimationSupported = Event.endEvents.length !== 0; | 28959 | }); |
28960 | |||
28961 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; | ||
28962 | |||
28963 | var _Event = __webpack_require__(205); | ||
28964 | |||
28965 | var _Event2 = _interopRequireDefault(_Event); | ||
28966 | |||
28967 | var _componentClasses = __webpack_require__(206); | ||
26901 | 28968 | ||
26902 | function getDuration(node, name) { | 28969 | var _componentClasses2 = _interopRequireDefault(_componentClasses); |
28970 | |||
28971 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
28972 | |||
28973 | var isCssAnimationSupported = _Event2["default"].endEvents.length !== 0; | ||
28974 | |||
28975 | |||
28976 | var capitalPrefixes = ['Webkit', 'Moz', 'O', | ||
28977 | // ms is special .... ! | ||
28978 | 'ms']; | ||
28979 | var prefixes = ['-webkit-', '-moz-', '-o-', 'ms-', '']; | ||
28980 | |||
28981 | function getStyleProperty(node, name) { | ||
26903 | var style = window.getComputedStyle(node); | 28982 | var style = window.getComputedStyle(node); |
26904 | var prefixes = ['-webkit-', '-moz-', '-o-', 'ms-', '']; | 28983 | |
26905 | var ret = ''; | 28984 | var ret = ''; |
26906 | for (var i = 0; i < prefixes.length; i++) { | 28985 | for (var i = 0; i < prefixes.length; i++) { |
26907 | ret = style.getPropertyValue(prefixes[i] + name); | 28986 | ret = style.getPropertyValue(prefixes[i] + name); |
@@ -26914,9 +28993,11 @@ | |||
26914 | 28993 | ||
26915 | function fixBrowserByTimeout(node) { | 28994 | function fixBrowserByTimeout(node) { |
26916 | if (isCssAnimationSupported) { | 28995 | if (isCssAnimationSupported) { |
26917 | var transitionDuration = parseFloat(getDuration(node, 'transition-duration')) || 0; | 28996 | var transitionDelay = parseFloat(getStyleProperty(node, 'transition-delay')) || 0; |
26918 | var animationDuration = parseFloat(getDuration(node, 'animation-duration')) || 0; | 28997 | var transitionDuration = parseFloat(getStyleProperty(node, 'transition-duration')) || 0; |
26919 | var time = Math.max(transitionDuration, animationDuration); | 28998 | var animationDelay = parseFloat(getStyleProperty(node, 'animation-delay')) || 0; |
28999 | var animationDuration = parseFloat(getStyleProperty(node, 'animation-duration')) || 0; | ||
29000 | var time = Math.max(transitionDuration + transitionDelay, animationDuration + animationDelay); | ||
26920 | // sometimes, browser bug | 29001 | // sometimes, browser bug |
26921 | node.rcEndAnimTimeout = setTimeout(function () { | 29002 | node.rcEndAnimTimeout = setTimeout(function () { |
26922 | node.rcEndAnimTimeout = null; | 29003 | node.rcEndAnimTimeout = null; |
@@ -26934,9 +29015,20 @@ | |||
26934 | } | 29015 | } |
26935 | } | 29016 | } |
26936 | 29017 | ||
26937 | var cssAnimation = function cssAnimation(node, transitionName, callback) { | 29018 | var cssAnimation = function cssAnimation(node, transitionName, endCallback) { |
26938 | var className = transitionName; | 29019 | var nameIsObj = (typeof transitionName === 'undefined' ? 'undefined' : _typeof(transitionName)) === 'object'; |
26939 | var activeClassName = className + '-active'; | 29020 | var className = nameIsObj ? transitionName.name : transitionName; |
29021 | var activeClassName = nameIsObj ? transitionName.active : transitionName + '-active'; | ||
29022 | var end = endCallback; | ||
29023 | var start = void 0; | ||
29024 | var active = void 0; | ||
29025 | var nodeClasses = (0, _componentClasses2["default"])(node); | ||
29026 | |||
29027 | if (endCallback && Object.prototype.toString.call(endCallback) === '[object Object]') { | ||
29028 | end = endCallback.end; | ||
29029 | start = endCallback.start; | ||
29030 | active = endCallback.active; | ||
29031 | } | ||
26940 | 29032 | ||
26941 | if (node.rcEndListener) { | 29033 | if (node.rcEndListener) { |
26942 | node.rcEndListener(); | 29034 | node.rcEndListener(); |
@@ -26954,28 +29046,35 @@ | |||
26954 | 29046 | ||
26955 | clearBrowserBugTimeout(node); | 29047 | clearBrowserBugTimeout(node); |
26956 | 29048 | ||
26957 | Css.removeClass(node, className); | 29049 | nodeClasses.remove(className); |
26958 | Css.removeClass(node, activeClassName); | 29050 | nodeClasses.remove(activeClassName); |
26959 | 29051 | ||
26960 | Event.removeEndEventListener(node, node.rcEndListener); | 29052 | _Event2["default"].removeEndEventListener(node, node.rcEndListener); |
26961 | node.rcEndListener = null; | 29053 | node.rcEndListener = null; |
26962 | 29054 | ||
26963 | // Usually this optional callback is used for informing an owner of | 29055 | // Usually this optional end is used for informing an owner of |
26964 | // a leave animation and telling it to remove the child. | 29056 | // a leave animation and telling it to remove the child. |
26965 | if (callback) { | 29057 | if (end) { |
26966 | callback(); | 29058 | end(); |
26967 | } | 29059 | } |
26968 | }; | 29060 | }; |
26969 | 29061 | ||
26970 | Event.addEndEventListener(node, node.rcEndListener); | 29062 | _Event2["default"].addEndEventListener(node, node.rcEndListener); |
26971 | 29063 | ||
26972 | Css.addClass(node, className); | 29064 | if (start) { |
29065 | start(); | ||
29066 | } | ||
29067 | nodeClasses.add(className); | ||
26973 | 29068 | ||
26974 | node.rcAnimTimeout = setTimeout(function () { | 29069 | node.rcAnimTimeout = setTimeout(function () { |
26975 | node.rcAnimTimeout = null; | 29070 | node.rcAnimTimeout = null; |
26976 | Css.addClass(node, activeClassName); | 29071 | nodeClasses.add(activeClassName); |
29072 | if (active) { | ||
29073 | setTimeout(active, 0); | ||
29074 | } | ||
26977 | fixBrowserByTimeout(node); | 29075 | fixBrowserByTimeout(node); |
26978 | }, 0); | 29076 | // 30ms for firefox |
29077 | }, 30); | ||
26979 | 29078 | ||
26980 | return { | 29079 | return { |
26981 | stop: function stop() { | 29080 | stop: function stop() { |
@@ -27003,7 +29102,7 @@ | |||
27003 | 29102 | ||
27004 | clearBrowserBugTimeout(node); | 29103 | clearBrowserBugTimeout(node); |
27005 | 29104 | ||
27006 | Event.removeEndEventListener(node, node.rcEndListener); | 29105 | _Event2["default"].removeEndEventListener(node, node.rcEndListener); |
27007 | node.rcEndListener = null; | 29106 | node.rcEndListener = null; |
27008 | 29107 | ||
27009 | // Usually this optional callback is used for informing an owner of | 29108 | // Usually this optional callback is used for informing an owner of |
@@ -27013,7 +29112,7 @@ | |||
27013 | } | 29112 | } |
27014 | }; | 29113 | }; |
27015 | 29114 | ||
27016 | Event.addEndEventListener(node, node.rcEndListener); | 29115 | _Event2["default"].addEndEventListener(node, node.rcEndListener); |
27017 | 29116 | ||
27018 | node.rcAnimTimeout = setTimeout(function () { | 29117 | node.rcAnimTimeout = setTimeout(function () { |
27019 | for (var s in style) { | 29118 | for (var s in style) { |
@@ -27034,25 +29133,25 @@ | |||
27034 | property = ''; | 29133 | property = ''; |
27035 | } | 29134 | } |
27036 | property = property || ''; | 29135 | property = property || ''; |
27037 | ['Webkit', 'Moz', 'O', | 29136 | capitalPrefixes.forEach(function (prefix) { |
27038 | // ms is special .... ! | ||
27039 | 'ms'].forEach(function (prefix) { | ||
27040 | node.style[prefix + 'Transition' + property] = v; | 29137 | node.style[prefix + 'Transition' + property] = v; |
27041 | }); | 29138 | }); |
27042 | }; | 29139 | }; |
27043 | 29140 | ||
27044 | cssAnimation.addClass = Css.addClass; | ||
27045 | cssAnimation.removeClass = Css.removeClass; | ||
27046 | cssAnimation.isCssAnimationSupported = isCssAnimationSupported; | 29141 | cssAnimation.isCssAnimationSupported = isCssAnimationSupported; |
27047 | 29142 | ||
27048 | module.exports = cssAnimation; | 29143 | exports["default"] = cssAnimation; |
29144 | module.exports = exports['default']; | ||
27049 | 29145 | ||
27050 | /***/ }, | 29146 | /***/ }, |
27051 | /* 213 */ | 29147 | /* 205 */ |
27052 | /***/ function(module, exports) { | 29148 | /***/ function(module, exports) { |
27053 | 29149 | ||
27054 | 'use strict'; | 29150 | 'use strict'; |
27055 | 29151 | ||
29152 | Object.defineProperty(exports, "__esModule", { | ||
29153 | value: true | ||
29154 | }); | ||
27056 | var EVENT_NAME_MAP = { | 29155 | var EVENT_NAME_MAP = { |
27057 | transitionend: { | 29156 | transitionend: { |
27058 | transition: 'transitionend', | 29157 | transition: 'transitionend', |
@@ -27098,7 +29197,7 @@ | |||
27098 | } | 29197 | } |
27099 | } | 29198 | } |
27100 | 29199 | ||
27101 | if (typeof window !== 'undefined') { | 29200 | if (typeof window !== 'undefined' && typeof document !== 'undefined') { |
27102 | detectEvents(); | 29201 | detectEvents(); |
27103 | } | 29202 | } |
27104 | 29203 | ||
@@ -27121,6 +29220,7 @@ | |||
27121 | }); | 29220 | }); |
27122 | }, | 29221 | }, |
27123 | 29222 | ||
29223 | |||
27124 | endEvents: endEvents, | 29224 | endEvents: endEvents, |
27125 | 29225 | ||
27126 | removeEndEventListener: function removeEndEventListener(node, eventListener) { | 29226 | removeEndEventListener: function removeEndEventListener(node, eventListener) { |
@@ -27133,41 +29233,220 @@ | |||
27133 | } | 29233 | } |
27134 | }; | 29234 | }; |
27135 | 29235 | ||
27136 | module.exports = TransitionEvents; | 29236 | exports["default"] = TransitionEvents; |
29237 | module.exports = exports['default']; | ||
27137 | 29238 | ||
27138 | /***/ }, | 29239 | /***/ }, |
27139 | /* 214 */ | 29240 | /* 206 */ |
27140 | /***/ function(module, exports) { | 29241 | /***/ function(module, exports, __webpack_require__) { |
27141 | 29242 | ||
27142 | 'use strict'; | 29243 | /** |
29244 | * Module dependencies. | ||
29245 | */ | ||
29246 | |||
29247 | try { | ||
29248 | var index = __webpack_require__(207); | ||
29249 | } catch (err) { | ||
29250 | var index = __webpack_require__(207); | ||
29251 | } | ||
29252 | |||
29253 | /** | ||
29254 | * Whitespace regexp. | ||
29255 | */ | ||
29256 | |||
29257 | var re = /\s+/; | ||
29258 | |||
29259 | /** | ||
29260 | * toString reference. | ||
29261 | */ | ||
27143 | 29262 | ||
27144 | var SPACE = ' '; | 29263 | var toString = Object.prototype.toString; |
27145 | var RE_CLASS = /[\n\t\r]/g; | 29264 | |
29265 | /** | ||
29266 | * Wrap `el` in a `ClassList`. | ||
29267 | * | ||
29268 | * @param {Element} el | ||
29269 | * @return {ClassList} | ||
29270 | * @api public | ||
29271 | */ | ||
29272 | |||
29273 | module.exports = function(el){ | ||
29274 | return new ClassList(el); | ||
29275 | }; | ||
29276 | |||
29277 | /** | ||
29278 | * Initialize a new ClassList for `el`. | ||
29279 | * | ||
29280 | * @param {Element} el | ||
29281 | * @api private | ||
29282 | */ | ||
27146 | 29283 | ||
27147 | function norm(elemClass) { | 29284 | function ClassList(el) { |
27148 | return (SPACE + elemClass + SPACE).replace(RE_CLASS, SPACE); | 29285 | if (!el || !el.nodeType) { |
29286 | throw new Error('A DOM element reference is required'); | ||
29287 | } | ||
29288 | this.el = el; | ||
29289 | this.list = el.classList; | ||
27149 | } | 29290 | } |
27150 | 29291 | ||
27151 | module.exports = { | 29292 | /** |
27152 | addClass: function addClass(elem, className) { | 29293 | * Add class `name` if not already present. |
27153 | elem.className += ' ' + className; | 29294 | * |
27154 | }, | 29295 | * @param {String} name |
29296 | * @return {ClassList} | ||
29297 | * @api public | ||
29298 | */ | ||
29299 | |||
29300 | ClassList.prototype.add = function(name){ | ||
29301 | // classList | ||
29302 | if (this.list) { | ||
29303 | this.list.add(name); | ||
29304 | return this; | ||
29305 | } | ||
29306 | |||
29307 | // fallback | ||
29308 | var arr = this.array(); | ||
29309 | var i = index(arr, name); | ||
29310 | if (!~i) arr.push(name); | ||
29311 | this.el.className = arr.join(' '); | ||
29312 | return this; | ||
29313 | }; | ||
29314 | |||
29315 | /** | ||
29316 | * Remove class `name` when present, or | ||
29317 | * pass a regular expression to remove | ||
29318 | * any which match. | ||
29319 | * | ||
29320 | * @param {String|RegExp} name | ||
29321 | * @return {ClassList} | ||
29322 | * @api public | ||
29323 | */ | ||
29324 | |||
29325 | ClassList.prototype.remove = function(name){ | ||
29326 | if ('[object RegExp]' == toString.call(name)) { | ||
29327 | return this.removeMatching(name); | ||
29328 | } | ||
29329 | |||
29330 | // classList | ||
29331 | if (this.list) { | ||
29332 | this.list.remove(name); | ||
29333 | return this; | ||
29334 | } | ||
29335 | |||
29336 | // fallback | ||
29337 | var arr = this.array(); | ||
29338 | var i = index(arr, name); | ||
29339 | if (~i) arr.splice(i, 1); | ||
29340 | this.el.className = arr.join(' '); | ||
29341 | return this; | ||
29342 | }; | ||
29343 | |||
29344 | /** | ||
29345 | * Remove all classes matching `re`. | ||
29346 | * | ||
29347 | * @param {RegExp} re | ||
29348 | * @return {ClassList} | ||
29349 | * @api private | ||
29350 | */ | ||
27155 | 29351 | ||
27156 | removeClass: function removeClass(elem, n) { | 29352 | ClassList.prototype.removeMatching = function(re){ |
27157 | var elemClass = elem.className.trim(); | 29353 | var arr = this.array(); |
27158 | var className = norm(elemClass); | 29354 | for (var i = 0; i < arr.length; i++) { |
27159 | var needle = n.trim(); | 29355 | if (re.test(arr[i])) { |
27160 | needle = SPACE + needle + SPACE; | 29356 | this.remove(arr[i]); |
27161 | // 一个 cls 有可能多次出现:'link link2 link link3 link' | ||
27162 | while (className.indexOf(needle) >= 0) { | ||
27163 | className = className.replace(needle, SPACE); | ||
27164 | } | 29357 | } |
27165 | elem.className = className.trim(); | ||
27166 | } | 29358 | } |
29359 | return this; | ||
29360 | }; | ||
29361 | |||
29362 | /** | ||
29363 | * Toggle class `name`, can force state via `force`. | ||
29364 | * | ||
29365 | * For browsers that support classList, but do not support `force` yet, | ||
29366 | * the mistake will be detected and corrected. | ||
29367 | * | ||
29368 | * @param {String} name | ||
29369 | * @param {Boolean} force | ||
29370 | * @return {ClassList} | ||
29371 | * @api public | ||
29372 | */ | ||
29373 | |||
29374 | ClassList.prototype.toggle = function(name, force){ | ||
29375 | // classList | ||
29376 | if (this.list) { | ||
29377 | if ("undefined" !== typeof force) { | ||
29378 | if (force !== this.list.toggle(name, force)) { | ||
29379 | this.list.toggle(name); // toggle again to correct | ||
29380 | } | ||
29381 | } else { | ||
29382 | this.list.toggle(name); | ||
29383 | } | ||
29384 | return this; | ||
29385 | } | ||
29386 | |||
29387 | // fallback | ||
29388 | if ("undefined" !== typeof force) { | ||
29389 | if (!force) { | ||
29390 | this.remove(name); | ||
29391 | } else { | ||
29392 | this.add(name); | ||
29393 | } | ||
29394 | } else { | ||
29395 | if (this.has(name)) { | ||
29396 | this.remove(name); | ||
29397 | } else { | ||
29398 | this.add(name); | ||
29399 | } | ||
29400 | } | ||
29401 | |||
29402 | return this; | ||
29403 | }; | ||
29404 | |||
29405 | /** | ||
29406 | * Return an array of classes. | ||
29407 | * | ||
29408 | * @return {Array} | ||
29409 | * @api public | ||
29410 | */ | ||
29411 | |||
29412 | ClassList.prototype.array = function(){ | ||
29413 | var className = this.el.getAttribute('class') || ''; | ||
29414 | var str = className.replace(/^\s+|\s+$/g, ''); | ||
29415 | var arr = str.split(re); | ||
29416 | if ('' === arr[0]) arr.shift(); | ||
29417 | return arr; | ||
29418 | }; | ||
29419 | |||
29420 | /** | ||
29421 | * Check if class `name` is present. | ||
29422 | * | ||
29423 | * @param {String} name | ||
29424 | * @return {ClassList} | ||
29425 | * @api public | ||
29426 | */ | ||
29427 | |||
29428 | ClassList.prototype.has = | ||
29429 | ClassList.prototype.contains = function(name){ | ||
29430 | return this.list | ||
29431 | ? this.list.contains(name) | ||
29432 | : !! ~index(this.array(), name); | ||
27167 | }; | 29433 | }; |
27168 | 29434 | ||
29435 | |||
27169 | /***/ }, | 29436 | /***/ }, |
27170 | /* 215 */ | 29437 | /* 207 */ |
29438 | /***/ function(module, exports) { | ||
29439 | |||
29440 | module.exports = function(arr, obj){ | ||
29441 | if (arr.indexOf) return arr.indexOf(obj); | ||
29442 | for (var i = 0; i < arr.length; ++i) { | ||
29443 | if (arr[i] === obj) return i; | ||
29444 | } | ||
29445 | return -1; | ||
29446 | }; | ||
29447 | |||
29448 | /***/ }, | ||
29449 | /* 208 */ | ||
27171 | /***/ function(module, exports) { | 29450 | /***/ function(module, exports) { |
27172 | 29451 | ||
27173 | "use strict"; | 29452 | "use strict"; |
@@ -27185,7 +29464,6 @@ | |||
27185 | isLeaveSupported: function isLeaveSupported(props) { | 29464 | isLeaveSupported: function isLeaveSupported(props) { |
27186 | return props.transitionName && props.transitionLeave || props.animation.leave; | 29465 | return props.transitionName && props.transitionLeave || props.animation.leave; |
27187 | }, | 29466 | }, |
27188 | |||
27189 | allowAppearCallback: function allowAppearCallback(props) { | 29467 | allowAppearCallback: function allowAppearCallback(props) { |
27190 | return props.transitionAppear || props.animation.appear; | 29468 | return props.transitionAppear || props.animation.appear; |
27191 | }, | 29469 | }, |
@@ -27197,30 +29475,35 @@ | |||
27197 | } | 29475 | } |
27198 | }; | 29476 | }; |
27199 | exports["default"] = util; | 29477 | exports["default"] = util; |
27200 | module.exports = exports["default"]; | 29478 | module.exports = exports['default']; |
27201 | 29479 | ||
27202 | /***/ }, | 29480 | /***/ }, |
27203 | /* 216 */ | 29481 | /* 209 */ |
27204 | /***/ function(module, exports, __webpack_require__) { | 29482 | /***/ function(module, exports, __webpack_require__) { |
27205 | 29483 | ||
27206 | 'use strict'; | 29484 | 'use strict'; |
27207 | 29485 | ||
27208 | Object.defineProperty(exports, '__esModule', { | 29486 | Object.defineProperty(exports, "__esModule", { |
27209 | value: true | 29487 | value: true |
27210 | }); | 29488 | }); |
27211 | 29489 | ||
27212 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
27213 | |||
27214 | var _react = __webpack_require__(3); | 29490 | var _react = __webpack_require__(3); |
27215 | 29491 | ||
27216 | var _react2 = _interopRequireDefault(_react); | 29492 | var _react2 = _interopRequireDefault(_react); |
27217 | 29493 | ||
27218 | var PopupInner = _react2['default'].createClass({ | 29494 | var _LazyRenderBox = __webpack_require__(210); |
29495 | |||
29496 | var _LazyRenderBox2 = _interopRequireDefault(_LazyRenderBox); | ||
29497 | |||
29498 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
29499 | |||
29500 | var PopupInner = _react2["default"].createClass({ | ||
27219 | displayName: 'PopupInner', | 29501 | displayName: 'PopupInner', |
27220 | 29502 | ||
27221 | propTypes: { | 29503 | propTypes: { |
27222 | hiddenClassName: _react.PropTypes.string, | 29504 | hiddenClassName: _react.PropTypes.string, |
27223 | className: _react.PropTypes.string, | 29505 | className: _react.PropTypes.string, |
29506 | prefixCls: _react.PropTypes.string, | ||
27224 | onMouseEnter: _react.PropTypes.func, | 29507 | onMouseEnter: _react.PropTypes.func, |
27225 | onMouseLeave: _react.PropTypes.func, | 29508 | onMouseLeave: _react.PropTypes.func, |
27226 | children: _react.PropTypes.any | 29509 | children: _react.PropTypes.any |
@@ -27231,45 +29514,98 @@ | |||
27231 | if (!props.visible) { | 29514 | if (!props.visible) { |
27232 | className += ' ' + props.hiddenClassName; | 29515 | className += ' ' + props.hiddenClassName; |
27233 | } | 29516 | } |
27234 | return _react2['default'].createElement( | 29517 | return _react2["default"].createElement( |
27235 | 'div', | 29518 | 'div', |
27236 | { className: className, | 29519 | { |
29520 | className: className, | ||
27237 | onMouseEnter: props.onMouseEnter, | 29521 | onMouseEnter: props.onMouseEnter, |
27238 | onMouseLeave: props.onMouseLeave, | 29522 | onMouseLeave: props.onMouseLeave, |
27239 | style: props.style }, | 29523 | style: props.style |
27240 | props.children | 29524 | }, |
29525 | _react2["default"].createElement( | ||
29526 | _LazyRenderBox2["default"], | ||
29527 | { className: props.prefixCls + '-content', visible: props.visible }, | ||
29528 | props.children | ||
29529 | ) | ||
27241 | ); | 29530 | ); |
27242 | } | 29531 | } |
27243 | }); | 29532 | }); |
27244 | 29533 | ||
27245 | exports['default'] = PopupInner; | 29534 | exports["default"] = PopupInner; |
27246 | module.exports = exports['default']; | 29535 | module.exports = exports['default']; |
27247 | 29536 | ||
27248 | /***/ }, | 29537 | /***/ }, |
27249 | /* 217 */ | 29538 | /* 210 */ |
27250 | /***/ function(module, exports, __webpack_require__) { | 29539 | /***/ function(module, exports, __webpack_require__) { |
27251 | 29540 | ||
27252 | 'use strict'; | 29541 | 'use strict'; |
27253 | 29542 | ||
27254 | Object.defineProperty(exports, '__esModule', { | 29543 | Object.defineProperty(exports, "__esModule", { |
27255 | value: true | 29544 | value: true |
27256 | }); | 29545 | }); |
27257 | exports.getAlignFromPlacement = getAlignFromPlacement; | ||
27258 | exports.getPopupClassNameFromAlign = getPopupClassNameFromAlign; | ||
27259 | 29546 | ||
27260 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | 29547 | var _react = __webpack_require__(3); |
27261 | 29548 | ||
27262 | var _objectAssign = __webpack_require__(192); | 29549 | var _react2 = _interopRequireDefault(_react); |
27263 | 29550 | ||
27264 | var _objectAssign2 = _interopRequireDefault(_objectAssign); | 29551 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } |
29552 | |||
29553 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
29554 | |||
29555 | var LazyRenderBox = _react2["default"].createClass({ | ||
29556 | displayName: 'LazyRenderBox', | ||
29557 | |||
29558 | propTypes: { | ||
29559 | children: _react.PropTypes.any, | ||
29560 | className: _react.PropTypes.string, | ||
29561 | visible: _react.PropTypes.bool, | ||
29562 | hiddenClassName: _react.PropTypes.string | ||
29563 | }, | ||
29564 | shouldComponentUpdate: function shouldComponentUpdate(nextProps) { | ||
29565 | return nextProps.hiddenClassName || nextProps.visible; | ||
29566 | }, | ||
29567 | render: function render() { | ||
29568 | var _props = this.props; | ||
29569 | var hiddenClassName = _props.hiddenClassName; | ||
29570 | var visible = _props.visible; | ||
29571 | |||
29572 | var props = _objectWithoutProperties(_props, ['hiddenClassName', 'visible']); | ||
29573 | |||
29574 | if (hiddenClassName || _react2["default"].Children.count(props.children) > 1) { | ||
29575 | if (!visible && hiddenClassName) { | ||
29576 | props.className += ' ' + hiddenClassName; | ||
29577 | } | ||
29578 | return _react2["default"].createElement('div', props); | ||
29579 | } | ||
29580 | |||
29581 | return _react2["default"].Children.only(props.children); | ||
29582 | } | ||
29583 | }); | ||
29584 | |||
29585 | exports["default"] = LazyRenderBox; | ||
29586 | module.exports = exports['default']; | ||
29587 | |||
29588 | /***/ }, | ||
29589 | /* 211 */ | ||
29590 | /***/ function(module, exports) { | ||
29591 | |||
29592 | 'use strict'; | ||
29593 | |||
29594 | Object.defineProperty(exports, "__esModule", { | ||
29595 | value: true | ||
29596 | }); | ||
27265 | 29597 | ||
29598 | 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; }; | ||
29599 | |||
29600 | exports.getAlignFromPlacement = getAlignFromPlacement; | ||
29601 | exports.getPopupClassNameFromAlign = getPopupClassNameFromAlign; | ||
27266 | function isPointsEq(a1, a2) { | 29602 | function isPointsEq(a1, a2) { |
27267 | return a1[0] === a2[0] && a1[1] === a2[1]; | 29603 | return a1[0] === a2[0] && a1[1] === a2[1]; |
27268 | } | 29604 | } |
27269 | 29605 | ||
27270 | function getAlignFromPlacement(builtinPlacements, placementStr, align) { | 29606 | function getAlignFromPlacement(builtinPlacements, placementStr, align) { |
27271 | var baseAlign = builtinPlacements[placementStr] || {}; | 29607 | var baseAlign = builtinPlacements[placementStr] || {}; |
27272 | return (0, _objectAssign2['default'])({}, baseAlign, align); | 29608 | return _extends({}, baseAlign, align); |
27273 | } | 29609 | } |
27274 | 29610 | ||
27275 | function getPopupClassNameFromAlign(builtinPlacements, prefixCls, align) { | 29611 | function getPopupClassNameFromAlign(builtinPlacements, prefixCls, align) { |
@@ -27285,33 +29621,132 @@ | |||
27285 | } | 29621 | } |
27286 | 29622 | ||
27287 | /***/ }, | 29623 | /***/ }, |
27288 | /* 218 */ | 29624 | /* 212 */ |
27289 | /***/ function(module, exports, __webpack_require__) { | 29625 | /***/ function(module, exports, __webpack_require__) { |
27290 | 29626 | ||
27291 | 'use strict'; | 29627 | 'use strict'; |
27292 | 29628 | ||
27293 | Object.defineProperty(exports, '__esModule', { | 29629 | Object.defineProperty(exports, "__esModule", { |
27294 | value: true | 29630 | value: true |
27295 | }); | 29631 | }); |
27296 | 29632 | ||
27297 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | 29633 | 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; }; |
27298 | 29634 | ||
27299 | var _react = __webpack_require__(3); | 29635 | exports["default"] = getContainerRenderMixin; |
29636 | |||
29637 | var _reactDom = __webpack_require__(37); | ||
29638 | |||
29639 | var _reactDom2 = _interopRequireDefault(_reactDom); | ||
29640 | |||
29641 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
29642 | |||
29643 | function defaultGetContainer() { | ||
29644 | var container = document.createElement('div'); | ||
29645 | document.body.appendChild(container); | ||
29646 | return container; | ||
29647 | } | ||
29648 | |||
29649 | function getContainerRenderMixin(config) { | ||
29650 | var _config$autoMount = config.autoMount; | ||
29651 | var autoMount = _config$autoMount === undefined ? true : _config$autoMount; | ||
29652 | var _config$autoDestroy = config.autoDestroy; | ||
29653 | var autoDestroy = _config$autoDestroy === undefined ? true : _config$autoDestroy; | ||
29654 | var isVisible = config.isVisible; | ||
29655 | var getComponent = config.getComponent; | ||
29656 | var _config$getContainer = config.getContainer; | ||
29657 | var getContainer = _config$getContainer === undefined ? defaultGetContainer : _config$getContainer; | ||
27300 | 29658 | ||
27301 | var _react2 = _interopRequireDefault(_react); | ||
27302 | 29659 | ||
27303 | var _mixinCommonMixin = __webpack_require__(219); | 29660 | var mixin = void 0; |
27304 | 29661 | ||
27305 | var _mixinCommonMixin2 = _interopRequireDefault(_mixinCommonMixin); | 29662 | function _renderComponent(instance, componentArg, ready) { |
29663 | if (!isVisible || instance._component || isVisible(instance)) { | ||
29664 | if (!instance._container) { | ||
29665 | instance._container = getContainer(instance); | ||
29666 | } | ||
29667 | _reactDom2["default"].unstable_renderSubtreeIntoContainer(instance, getComponent(instance, componentArg), instance._container, function callback() { | ||
29668 | instance._component = this; | ||
29669 | if (ready) { | ||
29670 | ready.call(this); | ||
29671 | } | ||
29672 | }); | ||
29673 | } | ||
29674 | } | ||
29675 | |||
29676 | if (autoMount) { | ||
29677 | mixin = _extends({}, mixin, { | ||
29678 | componentDidMount: function componentDidMount() { | ||
29679 | _renderComponent(this); | ||
29680 | }, | ||
29681 | componentDidUpdate: function componentDidUpdate() { | ||
29682 | _renderComponent(this); | ||
29683 | } | ||
29684 | }); | ||
29685 | } | ||
29686 | |||
29687 | if (!autoMount || !autoDestroy) { | ||
29688 | mixin = _extends({}, mixin, { | ||
29689 | renderComponent: function renderComponent(componentArg, ready) { | ||
29690 | _renderComponent(this, componentArg, ready); | ||
29691 | } | ||
29692 | }); | ||
29693 | } | ||
29694 | |||
29695 | function _removeContainer(instance) { | ||
29696 | if (instance._container) { | ||
29697 | var container = instance._container; | ||
29698 | _reactDom2["default"].unmountComponentAtNode(container); | ||
29699 | container.parentNode.removeChild(container); | ||
29700 | instance._container = null; | ||
29701 | } | ||
29702 | } | ||
29703 | |||
29704 | if (autoDestroy) { | ||
29705 | mixin = _extends({}, mixin, { | ||
29706 | componentWillUnmount: function componentWillUnmount() { | ||
29707 | _removeContainer(this); | ||
29708 | } | ||
29709 | }); | ||
29710 | } else { | ||
29711 | mixin = _extends({}, mixin, { | ||
29712 | removeContainer: function removeContainer() { | ||
29713 | _removeContainer(this); | ||
29714 | } | ||
29715 | }); | ||
29716 | } | ||
29717 | |||
29718 | return mixin; | ||
29719 | } | ||
29720 | module.exports = exports['default']; | ||
29721 | |||
29722 | /***/ }, | ||
29723 | /* 213 */ | ||
29724 | /***/ function(module, exports, __webpack_require__) { | ||
29725 | |||
29726 | 'use strict'; | ||
29727 | |||
29728 | Object.defineProperty(exports, "__esModule", { | ||
29729 | value: true | ||
29730 | }); | ||
27306 | 29731 | ||
27307 | var _Header = __webpack_require__(221); | 29732 | var _react = __webpack_require__(3); |
29733 | |||
29734 | var _react2 = _interopRequireDefault(_react); | ||
29735 | |||
29736 | var _Header = __webpack_require__(214); | ||
27308 | 29737 | ||
27309 | var _Header2 = _interopRequireDefault(_Header); | 29738 | var _Header2 = _interopRequireDefault(_Header); |
27310 | 29739 | ||
27311 | var _Combobox = __webpack_require__(223); | 29740 | var _Combobox = __webpack_require__(215); |
27312 | 29741 | ||
27313 | var _Combobox2 = _interopRequireDefault(_Combobox); | 29742 | var _Combobox2 = _interopRequireDefault(_Combobox); |
27314 | 29743 | ||
29744 | var _moment = __webpack_require__(177); | ||
29745 | |||
29746 | var _moment2 = _interopRequireDefault(_moment); | ||
29747 | |||
29748 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
29749 | |||
27315 | function noop() {} | 29750 | function noop() {} |
27316 | 29751 | ||
27317 | function generateOptions(length, disabledOptions, hideDisabledOptions) { | 29752 | function generateOptions(length, disabledOptions, hideDisabledOptions) { |
@@ -27324,16 +29759,16 @@ | |||
27324 | return arr; | 29759 | return arr; |
27325 | } | 29760 | } |
27326 | 29761 | ||
27327 | var Panel = _react2['default'].createClass({ | 29762 | var Panel = _react2.default.createClass({ |
27328 | displayName: 'Panel', | 29763 | displayName: 'Panel', |
27329 | 29764 | ||
27330 | propTypes: { | 29765 | propTypes: { |
29766 | clearText: _react.PropTypes.string, | ||
27331 | prefixCls: _react.PropTypes.string, | 29767 | prefixCls: _react.PropTypes.string, |
29768 | defaultOpenValue: _react.PropTypes.object, | ||
27332 | value: _react.PropTypes.object, | 29769 | value: _react.PropTypes.object, |
27333 | locale: _react.PropTypes.object, | ||
27334 | placeholder: _react.PropTypes.string, | 29770 | placeholder: _react.PropTypes.string, |
27335 | gregorianCalendarLocale: _react.PropTypes.object, | 29771 | format: _react.PropTypes.string, |
27336 | formatter: _react.PropTypes.object, | ||
27337 | disabledHours: _react.PropTypes.func, | 29772 | disabledHours: _react.PropTypes.func, |
27338 | disabledMinutes: _react.PropTypes.func, | 29773 | disabledMinutes: _react.PropTypes.func, |
27339 | disabledSeconds: _react.PropTypes.func, | 29774 | disabledSeconds: _react.PropTypes.func, |
@@ -27346,23 +29781,20 @@ | |||
27346 | onClear: _react.PropTypes.func | 29781 | onClear: _react.PropTypes.func |
27347 | }, | 29782 | }, |
27348 | 29783 | ||
27349 | mixins: [_mixinCommonMixin2['default']], | ||
27350 | |||
27351 | getDefaultProps: function getDefaultProps() { | 29784 | getDefaultProps: function getDefaultProps() { |
27352 | return { | 29785 | return { |
27353 | prefixCls: 'rc-time-picker-panel', | 29786 | prefixCls: 'rc-time-picker-panel', |
27354 | onChange: noop, | 29787 | onChange: noop, |
27355 | onClear: noop | 29788 | onClear: noop, |
29789 | defaultOpenValue: (0, _moment2.default)() | ||
27356 | }; | 29790 | }; |
27357 | }, | 29791 | }, |
27358 | |||
27359 | getInitialState: function getInitialState() { | 29792 | getInitialState: function getInitialState() { |
27360 | return { | 29793 | return { |
27361 | value: this.props.value, | 29794 | value: this.props.value, |
27362 | selectionRange: [] | 29795 | selectionRange: [] |
27363 | }; | 29796 | }; |
27364 | }, | 29797 | }, |
27365 | |||
27366 | componentWillReceiveProps: function componentWillReceiveProps(nextProps) { | 29798 | componentWillReceiveProps: function componentWillReceiveProps(nextProps) { |
27367 | var value = nextProps.value; | 29799 | var value = nextProps.value; |
27368 | if (value) { | 29800 | if (value) { |
@@ -27371,23 +29803,18 @@ | |||
27371 | }); | 29803 | }); |
27372 | } | 29804 | } |
27373 | }, | 29805 | }, |
27374 | |||
27375 | onChange: function onChange(newValue) { | 29806 | onChange: function onChange(newValue) { |
27376 | this.setState({ value: newValue }); | 29807 | this.setState({ value: newValue }); |
27377 | this.props.onChange(newValue); | 29808 | this.props.onChange(newValue); |
27378 | }, | 29809 | }, |
27379 | |||
27380 | onClear: function onClear() { | 29810 | onClear: function onClear() { |
27381 | this.props.onClear(); | 29811 | this.props.onClear(); |
27382 | }, | 29812 | }, |
27383 | |||
27384 | onCurrentSelectPanelChange: function onCurrentSelectPanelChange(currentSelectPanel) { | 29813 | onCurrentSelectPanelChange: function onCurrentSelectPanelChange(currentSelectPanel) { |
27385 | this.setState({ currentSelectPanel: currentSelectPanel }); | 29814 | this.setState({ currentSelectPanel: currentSelectPanel }); |
27386 | }, | 29815 | }, |
27387 | |||
27388 | render: function render() { | 29816 | render: function render() { |
27389 | var _props = this.props; | 29817 | var _props = this.props; |
27390 | var locale = _props.locale; | ||
27391 | var prefixCls = _props.prefixCls; | 29818 | var prefixCls = _props.prefixCls; |
27392 | var placeholder = _props.placeholder; | 29819 | var placeholder = _props.placeholder; |
27393 | var disabledHours = _props.disabledHours; | 29820 | var disabledHours = _props.disabledHours; |
@@ -27397,28 +29824,32 @@ | |||
27397 | var allowEmpty = _props.allowEmpty; | 29824 | var allowEmpty = _props.allowEmpty; |
27398 | var showHour = _props.showHour; | 29825 | var showHour = _props.showHour; |
27399 | var showSecond = _props.showSecond; | 29826 | var showSecond = _props.showSecond; |
27400 | var formatter = _props.formatter; | 29827 | var format = _props.format; |
27401 | var gregorianCalendarLocale = _props.gregorianCalendarLocale; | 29828 | var defaultOpenValue = _props.defaultOpenValue; |
29829 | var clearText = _props.clearText; | ||
29830 | var onEsc = _props.onEsc; | ||
29831 | var _state = this.state; | ||
29832 | var value = _state.value; | ||
29833 | var currentSelectPanel = _state.currentSelectPanel; | ||
27402 | 29834 | ||
27403 | var value = this.state.value; | ||
27404 | var disabledHourOptions = disabledHours(); | 29835 | var disabledHourOptions = disabledHours(); |
27405 | var disabledMinuteOptions = disabledMinutes(value ? value.getHourOfDay() : null); | 29836 | var disabledMinuteOptions = disabledMinutes(value ? value.hour() : null); |
27406 | var disabledSecondOptions = disabledSeconds(value ? value.getHourOfDay() : null, value ? value.getMinutes() : null); | 29837 | var disabledSecondOptions = disabledSeconds(value ? value.hour() : null, value ? value.minute() : null); |
27407 | var hourOptions = generateOptions(24, disabledHourOptions, hideDisabledOptions); | 29838 | var hourOptions = generateOptions(24, disabledHourOptions, hideDisabledOptions); |
27408 | var minuteOptions = generateOptions(60, disabledMinuteOptions, hideDisabledOptions); | 29839 | var minuteOptions = generateOptions(60, disabledMinuteOptions, hideDisabledOptions); |
27409 | var secondOptions = generateOptions(60, disabledSecondOptions, hideDisabledOptions); | 29840 | var secondOptions = generateOptions(60, disabledSecondOptions, hideDisabledOptions); |
27410 | 29841 | ||
27411 | return _react2['default'].createElement( | 29842 | return _react2.default.createElement( |
27412 | 'div', | 29843 | 'div', |
27413 | { className: prefixCls + '-inner' }, | 29844 | { className: prefixCls + '-inner' }, |
27414 | _react2['default'].createElement(_Header2['default'], { | 29845 | _react2.default.createElement(_Header2.default, { |
29846 | clearText: clearText, | ||
27415 | prefixCls: prefixCls, | 29847 | prefixCls: prefixCls, |
27416 | gregorianCalendarLocale: gregorianCalendarLocale, | 29848 | defaultOpenValue: defaultOpenValue, |
27417 | locale: locale, | ||
27418 | value: value, | 29849 | value: value, |
27419 | currentSelectPanel: this.state.currentSelectPanel, | 29850 | currentSelectPanel: currentSelectPanel, |
27420 | onEsc: this.props.onEsc, | 29851 | onEsc: onEsc, |
27421 | formatter: formatter, | 29852 | format: format, |
27422 | placeholder: placeholder, | 29853 | placeholder: placeholder, |
27423 | hourOptions: hourOptions, | 29854 | hourOptions: hourOptions, |
27424 | minuteOptions: minuteOptions, | 29855 | minuteOptions: minuteOptions, |
@@ -27430,11 +29861,11 @@ | |||
27430 | onClear: this.onClear, | 29861 | onClear: this.onClear, |
27431 | allowEmpty: allowEmpty | 29862 | allowEmpty: allowEmpty |
27432 | }), | 29863 | }), |
27433 | _react2['default'].createElement(_Combobox2['default'], { | 29864 | _react2.default.createElement(_Combobox2.default, { |
27434 | prefixCls: prefixCls, | 29865 | prefixCls: prefixCls, |
27435 | value: value, | 29866 | value: value, |
27436 | gregorianCalendarLocale: gregorianCalendarLocale, | 29867 | defaultOpenValue: defaultOpenValue, |
27437 | formatter: formatter, | 29868 | format: format, |
27438 | onChange: this.onChange, | 29869 | onChange: this.onChange, |
27439 | showHour: showHour, | 29870 | showHour: showHour, |
27440 | showSecond: showSecond, | 29871 | showSecond: showSecond, |
@@ -27450,98 +29881,38 @@ | |||
27450 | } | 29881 | } |
27451 | }); | 29882 | }); |
27452 | 29883 | ||
27453 | exports['default'] = Panel; | 29884 | exports.default = Panel; |
27454 | module.exports = exports['default']; | 29885 | module.exports = exports['default']; |
27455 | 29886 | ||
27456 | /***/ }, | 29887 | /***/ }, |
27457 | /* 219 */ | 29888 | /* 214 */ |
27458 | /***/ function(module, exports, __webpack_require__) { | ||
27459 | |||
27460 | 'use strict'; | ||
27461 | |||
27462 | Object.defineProperty(exports, '__esModule', { | ||
27463 | value: true | ||
27464 | }); | ||
27465 | |||
27466 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
27467 | |||
27468 | var _react = __webpack_require__(3); | ||
27469 | |||
27470 | var _localeEn_US = __webpack_require__(220); | ||
27471 | |||
27472 | var _localeEn_US2 = _interopRequireDefault(_localeEn_US); | ||
27473 | |||
27474 | exports['default'] = { | ||
27475 | propTypes: { | ||
27476 | prefixCls: _react.PropTypes.string, | ||
27477 | locale: _react.PropTypes.object | ||
27478 | }, | ||
27479 | |||
27480 | getDefaultProps: function getDefaultProps() { | ||
27481 | return { | ||
27482 | locale: _localeEn_US2['default'] | ||
27483 | }; | ||
27484 | } | ||
27485 | }; | ||
27486 | module.exports = exports['default']; | ||
27487 | |||
27488 | /***/ }, | ||
27489 | /* 220 */ | ||
27490 | /***/ function(module, exports, __webpack_require__) { | ||
27491 | |||
27492 | 'use strict'; | ||
27493 | |||
27494 | Object.defineProperty(exports, '__esModule', { | ||
27495 | value: true | ||
27496 | }); | ||
27497 | |||
27498 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
27499 | |||
27500 | var _gregorianCalendarFormatLibLocaleEn_US = __webpack_require__(166); | ||
27501 | |||
27502 | var _gregorianCalendarFormatLibLocaleEn_US2 = _interopRequireDefault(_gregorianCalendarFormatLibLocaleEn_US); | ||
27503 | |||
27504 | var _gregorianCalendarLibLocaleEn_US = __webpack_require__(164); | ||
27505 | |||
27506 | var _gregorianCalendarLibLocaleEn_US2 = _interopRequireDefault(_gregorianCalendarLibLocaleEn_US); | ||
27507 | |||
27508 | exports['default'] = { | ||
27509 | clear: 'Clear', | ||
27510 | format: _gregorianCalendarFormatLibLocaleEn_US2['default'], | ||
27511 | calendar: _gregorianCalendarLibLocaleEn_US2['default'] | ||
27512 | }; | ||
27513 | module.exports = exports['default']; | ||
27514 | |||
27515 | /***/ }, | ||
27516 | /* 221 */ | ||
27517 | /***/ function(module, exports, __webpack_require__) { | 29889 | /***/ function(module, exports, __webpack_require__) { |
27518 | 29890 | ||
27519 | 'use strict'; | 29891 | 'use strict'; |
27520 | 29892 | ||
27521 | Object.defineProperty(exports, '__esModule', { | 29893 | Object.defineProperty(exports, "__esModule", { |
27522 | value: true | 29894 | value: true |
27523 | }); | 29895 | }); |
27524 | 29896 | ||
27525 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
27526 | |||
27527 | var _react = __webpack_require__(3); | 29897 | var _react = __webpack_require__(3); |
27528 | 29898 | ||
27529 | var _react2 = _interopRequireDefault(_react); | 29899 | var _react2 = _interopRequireDefault(_react); |
27530 | 29900 | ||
27531 | var _utilSelection = __webpack_require__(222); | 29901 | var _moment = __webpack_require__(177); |
29902 | |||
29903 | var _moment2 = _interopRequireDefault(_moment); | ||
27532 | 29904 | ||
27533 | var _utilSelection2 = _interopRequireDefault(_utilSelection); | 29905 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
27534 | 29906 | ||
27535 | var Header = _react2['default'].createClass({ | 29907 | var Header = _react2.default.createClass({ |
27536 | displayName: 'Header', | 29908 | displayName: 'Header', |
27537 | 29909 | ||
27538 | propTypes: { | 29910 | propTypes: { |
27539 | formatter: _react.PropTypes.object, | 29911 | format: _react.PropTypes.string, |
27540 | prefixCls: _react.PropTypes.string, | 29912 | prefixCls: _react.PropTypes.string, |
27541 | gregorianCalendarLocale: _react.PropTypes.object, | ||
27542 | locale: _react.PropTypes.object, | ||
27543 | disabledDate: _react.PropTypes.func, | 29913 | disabledDate: _react.PropTypes.func, |
27544 | placeholder: _react.PropTypes.string, | 29914 | placeholder: _react.PropTypes.string, |
29915 | clearText: _react.PropTypes.string, | ||
27545 | value: _react.PropTypes.object, | 29916 | value: _react.PropTypes.object, |
27546 | hourOptions: _react.PropTypes.array, | 29917 | hourOptions: _react.PropTypes.array, |
27547 | minuteOptions: _react.PropTypes.array, | 29918 | minuteOptions: _react.PropTypes.array, |
@@ -27553,107 +29924,89 @@ | |||
27553 | onClear: _react.PropTypes.func, | 29924 | onClear: _react.PropTypes.func, |
27554 | onEsc: _react.PropTypes.func, | 29925 | onEsc: _react.PropTypes.func, |
27555 | allowEmpty: _react.PropTypes.bool, | 29926 | allowEmpty: _react.PropTypes.bool, |
29927 | defaultOpenValue: _react.PropTypes.object, | ||
27556 | currentSelectPanel: _react.PropTypes.string | 29928 | currentSelectPanel: _react.PropTypes.string |
27557 | }, | 29929 | }, |
27558 | 29930 | ||
27559 | getInitialState: function getInitialState() { | 29931 | getInitialState: function getInitialState() { |
27560 | var value = this.props.value; | 29932 | var _props = this.props; |
29933 | var value = _props.value; | ||
29934 | var format = _props.format; | ||
29935 | |||
27561 | return { | 29936 | return { |
27562 | str: value && this.props.formatter.format(value) || '', | 29937 | str: value && value.format(format) || '', |
27563 | invalid: false | 29938 | invalid: false |
27564 | }; | 29939 | }; |
27565 | }, | 29940 | }, |
27566 | |||
27567 | componentDidMount: function componentDidMount() { | ||
27568 | this.timer = setTimeout(this.selectRange, 0); | ||
27569 | }, | ||
27570 | |||
27571 | componentWillReceiveProps: function componentWillReceiveProps(nextProps) { | 29941 | componentWillReceiveProps: function componentWillReceiveProps(nextProps) { |
27572 | var value = nextProps.value; | 29942 | var value = nextProps.value; |
29943 | var format = nextProps.format; | ||
29944 | |||
27573 | this.setState({ | 29945 | this.setState({ |
27574 | str: value && nextProps.formatter.format(value) || '', | 29946 | str: value && value.format(format) || '', |
27575 | invalid: false | 29947 | invalid: false |
27576 | }); | 29948 | }); |
27577 | }, | 29949 | }, |
27578 | |||
27579 | componentDidUpdate: function componentDidUpdate() { | ||
27580 | this.timer = setTimeout(this.selectRange, 0); | ||
27581 | }, | ||
27582 | |||
27583 | componentWillUnmount: function componentWillUnmount() { | ||
27584 | clearTimeout(this.timer); | ||
27585 | }, | ||
27586 | |||
27587 | onInputChange: function onInputChange(event) { | 29950 | onInputChange: function onInputChange(event) { |
27588 | var str = event.target.value; | 29951 | var str = event.target.value; |
27589 | this.setState({ | 29952 | this.setState({ |
27590 | str: str | 29953 | str: str |
27591 | }); | 29954 | }); |
27592 | var value = null; | 29955 | var _props2 = this.props; |
27593 | var _props = this.props; | 29956 | var format = _props2.format; |
27594 | var formatter = _props.formatter; | 29957 | var hourOptions = _props2.hourOptions; |
27595 | var gregorianCalendarLocale = _props.gregorianCalendarLocale; | 29958 | var minuteOptions = _props2.minuteOptions; |
27596 | var hourOptions = _props.hourOptions; | 29959 | var secondOptions = _props2.secondOptions; |
27597 | var minuteOptions = _props.minuteOptions; | 29960 | var disabledHours = _props2.disabledHours; |
27598 | var secondOptions = _props.secondOptions; | 29961 | var disabledMinutes = _props2.disabledMinutes; |
27599 | var disabledHours = _props.disabledHours; | 29962 | var disabledSeconds = _props2.disabledSeconds; |
27600 | var disabledMinutes = _props.disabledMinutes; | 29963 | var onChange = _props2.onChange; |
27601 | var disabledSeconds = _props.disabledSeconds; | 29964 | var allowEmpty = _props2.allowEmpty; |
27602 | var onChange = _props.onChange; | 29965 | |
27603 | var allowEmpty = _props.allowEmpty; | ||
27604 | 29966 | ||
27605 | if (str) { | 29967 | if (str) { |
27606 | var originalValue = this.props.value; | 29968 | var originalValue = this.props.value; |
27607 | try { | 29969 | var value = this.getProtoValue().clone(); |
27608 | value = formatter.parse(str, { | 29970 | var parsed = (0, _moment2.default)(str, format, true); |
27609 | locale: gregorianCalendarLocale, | 29971 | if (!parsed.isValid()) { |
27610 | obeyCount: true | 29972 | this.setState({ |
29973 | invalid: true | ||
27611 | }); | 29974 | }); |
27612 | } catch (ex) { | 29975 | return; |
29976 | } | ||
29977 | value.hour(parsed.hour()).minute(parsed.minute()).second(parsed.second()); | ||
29978 | |||
29979 | // if time value not allowed, response warning. | ||
29980 | if (hourOptions.indexOf(value.hour()) < 0 || minuteOptions.indexOf(value.minute()) < 0 || secondOptions.indexOf(value.second()) < 0) { | ||
27613 | this.setState({ | 29981 | this.setState({ |
27614 | invalid: true | 29982 | invalid: true |
27615 | }); | 29983 | }); |
27616 | return; | 29984 | return; |
27617 | } | 29985 | } |
27618 | 29986 | ||
27619 | if (value) { | 29987 | // if time value is disabled, response warning. |
27620 | // if time value not allowed, response warning. | 29988 | var disabledHourOptions = disabledHours(); |
27621 | if (hourOptions.indexOf(value.getHourOfDay()) < 0 || minuteOptions.indexOf(value.getMinutes()) < 0 || secondOptions.indexOf(value.getSeconds()) < 0) { | 29989 | var disabledMinuteOptions = disabledMinutes(value.hour()); |
27622 | this.setState({ | 29990 | var disabledSecondOptions = disabledSeconds(value.hour(), value.minute()); |
27623 | invalid: true | 29991 | if (disabledHourOptions && disabledHourOptions.indexOf(value.hour()) >= 0 || disabledMinuteOptions && disabledMinuteOptions.indexOf(value.minute()) >= 0 || disabledSecondOptions && disabledSecondOptions.indexOf(value.second()) >= 0) { |
27624 | }); | ||
27625 | return; | ||
27626 | } | ||
27627 | |||
27628 | // if time value is disabled, response warning. | ||
27629 | var disabledHourOptions = disabledHours(); | ||
27630 | var disabledMinuteOptions = disabledMinutes(value.getHourOfDay()); | ||
27631 | var disabledSecondOptions = disabledSeconds(value.getHourOfDay(), value.getMinutes()); | ||
27632 | if (disabledHourOptions && disabledHourOptions.indexOf(value.getHourOfDay()) >= 0 || disabledMinuteOptions && disabledMinuteOptions.indexOf(value.getMinutes()) >= 0 || disabledSecondOptions && disabledSecondOptions.indexOf(value.getSeconds()) >= 0) { | ||
27633 | this.setState({ | ||
27634 | invalid: true | ||
27635 | }); | ||
27636 | return; | ||
27637 | } | ||
27638 | |||
27639 | if (originalValue && value) { | ||
27640 | if (originalValue.getHourOfDay() !== value.getHourOfDay() || originalValue.getMinutes() !== value.getMinutes() || originalValue.getSeconds() !== value.getSeconds()) { | ||
27641 | // keep other fields for rc-calendar | ||
27642 | var changedValue = originalValue.clone(); | ||
27643 | changedValue.setHourOfDay(value.getHourOfDay()); | ||
27644 | changedValue.setMinutes(value.getMinutes()); | ||
27645 | changedValue.setSeconds(value.getSeconds()); | ||
27646 | onChange(changedValue); | ||
27647 | } | ||
27648 | } else if (originalValue !== value) { | ||
27649 | onChange(value); | ||
27650 | } | ||
27651 | } else { | ||
27652 | this.setState({ | 29992 | this.setState({ |
27653 | invalid: true | 29993 | invalid: true |
27654 | }); | 29994 | }); |
27655 | return; | 29995 | return; |
27656 | } | 29996 | } |
29997 | |||
29998 | if (originalValue) { | ||
29999 | if (originalValue.hour() !== value.hour() || originalValue.minute() !== value.minute() || originalValue.second() !== value.second()) { | ||
30000 | // keep other fields for rc-calendar | ||
30001 | var changedValue = originalValue.clone(); | ||
30002 | changedValue.hour(value.hour()); | ||
30003 | changedValue.minute(value.minute()); | ||
30004 | changedValue.second(value.second()); | ||
30005 | onChange(changedValue); | ||
30006 | } | ||
30007 | } else if (originalValue !== value) { | ||
30008 | onChange(value); | ||
30009 | } | ||
27657 | } else if (allowEmpty) { | 30010 | } else if (allowEmpty) { |
27658 | onChange(null); | 30011 | onChange(null); |
27659 | } else { | 30012 | } else { |
@@ -27667,73 +30020,55 @@ | |||
27667 | invalid: false | 30020 | invalid: false |
27668 | }); | 30021 | }); |
27669 | }, | 30022 | }, |
27670 | |||
27671 | onKeyDown: function onKeyDown(e) { | 30023 | onKeyDown: function onKeyDown(e) { |
27672 | if (e.keyCode === 27) { | 30024 | if (e.keyCode === 27) { |
27673 | this.props.onEsc(); | 30025 | this.props.onEsc(); |
27674 | } | 30026 | } |
27675 | }, | 30027 | }, |
27676 | |||
27677 | onClear: function onClear() { | 30028 | onClear: function onClear() { |
27678 | this.setState({ str: '' }); | 30029 | this.setState({ str: '' }); |
27679 | this.props.onClear(); | 30030 | this.props.onClear(); |
27680 | }, | 30031 | }, |
27681 | |||
27682 | getClearButton: function getClearButton() { | 30032 | getClearButton: function getClearButton() { |
27683 | var _props2 = this.props; | 30033 | var _props3 = this.props; |
27684 | var locale = _props2.locale; | 30034 | var prefixCls = _props3.prefixCls; |
27685 | var prefixCls = _props2.prefixCls; | 30035 | var allowEmpty = _props3.allowEmpty; |
27686 | var allowEmpty = _props2.allowEmpty; | ||
27687 | 30036 | ||
27688 | if (!allowEmpty) { | 30037 | if (!allowEmpty) { |
27689 | return null; | 30038 | return null; |
27690 | } | 30039 | } |
27691 | return _react2['default'].createElement('a', { className: prefixCls + '-clear-btn', role: 'button', title: locale.clear, onMouseDown: this.onClear }); | 30040 | return _react2.default.createElement('a', { |
30041 | className: prefixCls + '-clear-btn', | ||
30042 | role: 'button', | ||
30043 | title: this.props.clearText, | ||
30044 | onMouseDown: this.onClear | ||
30045 | }); | ||
30046 | }, | ||
30047 | getProtoValue: function getProtoValue() { | ||
30048 | return this.props.value || this.props.defaultOpenValue; | ||
27692 | }, | 30049 | }, |
27693 | |||
27694 | getInput: function getInput() { | 30050 | getInput: function getInput() { |
27695 | var _props3 = this.props; | 30051 | var _props4 = this.props; |
27696 | var prefixCls = _props3.prefixCls; | 30052 | var prefixCls = _props4.prefixCls; |
27697 | var placeholder = _props3.placeholder; | 30053 | var placeholder = _props4.placeholder; |
27698 | var _state = this.state; | 30054 | var _state = this.state; |
27699 | var invalid = _state.invalid; | 30055 | var invalid = _state.invalid; |
27700 | var str = _state.str; | 30056 | var str = _state.str; |
27701 | 30057 | ||
27702 | var invalidClass = invalid ? prefixCls + '-input-invalid' : ''; | 30058 | var invalidClass = invalid ? prefixCls + '-input-invalid' : ''; |
27703 | return _react2['default'].createElement('input', { | 30059 | return _react2.default.createElement('input', { |
27704 | className: prefixCls + '-input ' + invalidClass, | 30060 | className: prefixCls + '-input ' + invalidClass, |
27705 | ref: 'input', | 30061 | ref: 'input', |
27706 | onKeyDown: this.onKeyDown, | 30062 | onKeyDown: this.onKeyDown, |
27707 | value: str, | 30063 | value: str, |
27708 | placeholder: placeholder, onChange: this.onInputChange | 30064 | placeholder: placeholder, |
30065 | onChange: this.onInputChange | ||
27709 | }); | 30066 | }); |
27710 | }, | 30067 | }, |
27711 | |||
27712 | selectRange: function selectRange() { | ||
27713 | this.refs.input.select(); | ||
27714 | if (this.props.currentSelectPanel && this.refs.input.value) { | ||
27715 | var selectionRangeStart = 0; | ||
27716 | var selectionRangeEnd = 0; | ||
27717 | if (this.props.currentSelectPanel === 'hour') { | ||
27718 | selectionRangeStart = 0; | ||
27719 | selectionRangeEnd = this.refs.input.value.indexOf(':'); | ||
27720 | } else if (this.props.currentSelectPanel === 'minute') { | ||
27721 | selectionRangeStart = this.refs.input.value.indexOf(':') + 1; | ||
27722 | selectionRangeEnd = this.refs.input.value.lastIndexOf(':'); | ||
27723 | } else if (this.props.currentSelectPanel === 'second') { | ||
27724 | selectionRangeStart = this.refs.input.value.lastIndexOf(':') + 1; | ||
27725 | selectionRangeEnd = this.refs.input.value.length; | ||
27726 | } | ||
27727 | if (selectionRangeEnd - selectionRangeStart === 2) { | ||
27728 | (0, _utilSelection2['default'])(this.refs.input, selectionRangeStart, selectionRangeEnd); | ||
27729 | } | ||
27730 | } | ||
27731 | }, | ||
27732 | |||
27733 | render: function render() { | 30068 | render: function render() { |
27734 | var prefixCls = this.props.prefixCls; | 30069 | var prefixCls = this.props.prefixCls; |
27735 | 30070 | ||
27736 | return _react2['default'].createElement( | 30071 | return _react2.default.createElement( |
27737 | 'div', | 30072 | 'div', |
27738 | { className: prefixCls + '-input-wrap' }, | 30073 | { className: prefixCls + '-input-wrap' }, |
27739 | this.getInput(), | 30074 | this.getInput(), |
@@ -27742,63 +30077,28 @@ | |||
27742 | } | 30077 | } |
27743 | }); | 30078 | }); |
27744 | 30079 | ||
27745 | exports['default'] = Header; | 30080 | exports.default = Header; |
27746 | module.exports = exports['default']; | ||
27747 | |||
27748 | /***/ }, | ||
27749 | /* 222 */ | ||
27750 | /***/ function(module, exports) { | ||
27751 | |||
27752 | 'use strict'; | ||
27753 | |||
27754 | Object.defineProperty(exports, '__esModule', { | ||
27755 | value: true | ||
27756 | }); | ||
27757 | exports['default'] = createSelection; | ||
27758 | |||
27759 | function createSelection(field, start, end) { | ||
27760 | if (field.createTextRange) { | ||
27761 | var selRange = field.createTextRange(); | ||
27762 | selRange.collapse(true); | ||
27763 | selRange.moveStart('character', start); | ||
27764 | selRange.moveEnd('character', end); | ||
27765 | selRange.select(); | ||
27766 | field.focus(); | ||
27767 | } else if (field.setSelectionRange) { | ||
27768 | field.focus(); | ||
27769 | field.setSelectionRange(start, end); | ||
27770 | } else if (typeof field.selectionStart !== 'undefined') { | ||
27771 | field.selectionStart = start; | ||
27772 | field.selectionEnd = end; | ||
27773 | field.focus(); | ||
27774 | } | ||
27775 | } | ||
27776 | |||
27777 | module.exports = exports['default']; | 30081 | module.exports = exports['default']; |
27778 | 30082 | ||
27779 | /***/ }, | 30083 | /***/ }, |
27780 | /* 223 */ | 30084 | /* 215 */ |
27781 | /***/ function(module, exports, __webpack_require__) { | 30085 | /***/ function(module, exports, __webpack_require__) { |
27782 | 30086 | ||
27783 | 'use strict'; | 30087 | 'use strict'; |
27784 | 30088 | ||
27785 | Object.defineProperty(exports, '__esModule', { | 30089 | Object.defineProperty(exports, "__esModule", { |
27786 | value: true | 30090 | value: true |
27787 | }); | 30091 | }); |
27788 | 30092 | ||
27789 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
27790 | |||
27791 | var _react = __webpack_require__(3); | 30093 | var _react = __webpack_require__(3); |
27792 | 30094 | ||
27793 | var _react2 = _interopRequireDefault(_react); | 30095 | var _react2 = _interopRequireDefault(_react); |
27794 | 30096 | ||
27795 | var _Select = __webpack_require__(224); | 30097 | var _Select = __webpack_require__(216); |
27796 | 30098 | ||
27797 | var _Select2 = _interopRequireDefault(_Select); | 30099 | var _Select2 = _interopRequireDefault(_Select); |
27798 | 30100 | ||
27799 | var _gregorianCalendar = __webpack_require__(161); | 30101 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
27800 | |||
27801 | var _gregorianCalendar2 = _interopRequireDefault(_gregorianCalendar); | ||
27802 | 30102 | ||
27803 | var formatOption = function formatOption(option, disabledOptions) { | 30103 | var formatOption = function formatOption(option, disabledOptions) { |
27804 | var value = '' + option; | 30104 | var value = '' + option; |
@@ -27817,16 +30117,16 @@ | |||
27817 | }; | 30117 | }; |
27818 | }; | 30118 | }; |
27819 | 30119 | ||
27820 | var Combobox = _react2['default'].createClass({ | 30120 | var Combobox = _react2.default.createClass({ |
27821 | displayName: 'Combobox', | 30121 | displayName: 'Combobox', |
27822 | 30122 | ||
27823 | propTypes: { | 30123 | propTypes: { |
27824 | formatter: _react.PropTypes.object, | 30124 | format: _react.PropTypes.string, |
30125 | defaultOpenValue: _react.PropTypes.object, | ||
27825 | prefixCls: _react.PropTypes.string, | 30126 | prefixCls: _react.PropTypes.string, |
27826 | value: _react.PropTypes.object, | 30127 | value: _react.PropTypes.object, |
27827 | onChange: _react.PropTypes.func, | 30128 | onChange: _react.PropTypes.func, |
27828 | showHour: _react.PropTypes.bool, | 30129 | showHour: _react.PropTypes.bool, |
27829 | gregorianCalendarLocale: _react.PropTypes.object, | ||
27830 | showSecond: _react.PropTypes.bool, | 30130 | showSecond: _react.PropTypes.bool, |
27831 | hourOptions: _react.PropTypes.array, | 30131 | hourOptions: _react.PropTypes.array, |
27832 | minuteOptions: _react.PropTypes.array, | 30132 | minuteOptions: _react.PropTypes.array, |
@@ -27838,41 +30138,36 @@ | |||
27838 | }, | 30138 | }, |
27839 | 30139 | ||
27840 | onItemChange: function onItemChange(type, itemValue) { | 30140 | onItemChange: function onItemChange(type, itemValue) { |
27841 | var onChange = this.props.onChange; | 30141 | var _props = this.props; |
30142 | var onChange = _props.onChange; | ||
30143 | var defaultOpenValue = _props.defaultOpenValue; | ||
27842 | 30144 | ||
27843 | var value = this.props.value; | 30145 | var value = (this.props.value || defaultOpenValue).clone(); |
27844 | if (value) { | ||
27845 | value = value.clone(); | ||
27846 | } else { | ||
27847 | value = this.getNow().clone(); | ||
27848 | } | ||
27849 | if (type === 'hour') { | 30146 | if (type === 'hour') { |
27850 | value.setHourOfDay(itemValue); | 30147 | value.hour(itemValue); |
27851 | } else if (type === 'minute') { | 30148 | } else if (type === 'minute') { |
27852 | value.setMinutes(itemValue); | 30149 | value.minute(itemValue); |
27853 | } else { | 30150 | } else { |
27854 | value.setSeconds(itemValue); | 30151 | value.second(itemValue); |
27855 | } | 30152 | } |
27856 | onChange(value); | 30153 | onChange(value); |
27857 | }, | 30154 | }, |
27858 | |||
27859 | onEnterSelectPanel: function onEnterSelectPanel(range) { | 30155 | onEnterSelectPanel: function onEnterSelectPanel(range) { |
27860 | this.props.onCurrentSelectPanelChange(range); | 30156 | this.props.onCurrentSelectPanelChange(range); |
27861 | }, | 30157 | }, |
27862 | |||
27863 | getHourSelect: function getHourSelect(hour) { | 30158 | getHourSelect: function getHourSelect(hour) { |
27864 | var _props = this.props; | 30159 | var _props2 = this.props; |
27865 | var prefixCls = _props.prefixCls; | 30160 | var prefixCls = _props2.prefixCls; |
27866 | var hourOptions = _props.hourOptions; | 30161 | var hourOptions = _props2.hourOptions; |
27867 | var disabledHours = _props.disabledHours; | 30162 | var disabledHours = _props2.disabledHours; |
27868 | var showHour = _props.showHour; | 30163 | var showHour = _props2.showHour; |
27869 | 30164 | ||
27870 | if (!showHour) { | 30165 | if (!showHour) { |
27871 | return null; | 30166 | return null; |
27872 | } | 30167 | } |
27873 | var disabledOptions = disabledHours(); | 30168 | var disabledOptions = disabledHours(); |
27874 | 30169 | ||
27875 | return _react2['default'].createElement(_Select2['default'], { | 30170 | return _react2.default.createElement(_Select2.default, { |
27876 | prefixCls: prefixCls, | 30171 | prefixCls: prefixCls, |
27877 | options: hourOptions.map(function (option) { | 30172 | options: hourOptions.map(function (option) { |
27878 | return formatOption(option, disabledOptions); | 30173 | return formatOption(option, disabledOptions); |
@@ -27883,17 +30178,17 @@ | |||
27883 | onMouseEnter: this.onEnterSelectPanel.bind(this, 'hour') | 30178 | onMouseEnter: this.onEnterSelectPanel.bind(this, 'hour') |
27884 | }); | 30179 | }); |
27885 | }, | 30180 | }, |
27886 | |||
27887 | getMinuteSelect: function getMinuteSelect(minute) { | 30181 | getMinuteSelect: function getMinuteSelect(minute) { |
27888 | var _props2 = this.props; | 30182 | var _props3 = this.props; |
27889 | var prefixCls = _props2.prefixCls; | 30183 | var prefixCls = _props3.prefixCls; |
27890 | var minuteOptions = _props2.minuteOptions; | 30184 | var minuteOptions = _props3.minuteOptions; |
27891 | var disabledMinutes = _props2.disabledMinutes; | 30185 | var disabledMinutes = _props3.disabledMinutes; |
30186 | var defaultOpenValue = _props3.defaultOpenValue; | ||
27892 | 30187 | ||
27893 | var value = this.props.value || this.getNow(); | 30188 | var value = this.props.value || defaultOpenValue; |
27894 | var disabledOptions = disabledMinutes(value.getHourOfDay()); | 30189 | var disabledOptions = disabledMinutes(value.hour()); |
27895 | 30190 | ||
27896 | return _react2['default'].createElement(_Select2['default'], { | 30191 | return _react2.default.createElement(_Select2.default, { |
27897 | prefixCls: prefixCls, | 30192 | prefixCls: prefixCls, |
27898 | options: minuteOptions.map(function (option) { | 30193 | options: minuteOptions.map(function (option) { |
27899 | return formatOption(option, disabledOptions); | 30194 | return formatOption(option, disabledOptions); |
@@ -27904,21 +30199,21 @@ | |||
27904 | onMouseEnter: this.onEnterSelectPanel.bind(this, 'minute') | 30199 | onMouseEnter: this.onEnterSelectPanel.bind(this, 'minute') |
27905 | }); | 30200 | }); |
27906 | }, | 30201 | }, |
27907 | |||
27908 | getSecondSelect: function getSecondSelect(second) { | 30202 | getSecondSelect: function getSecondSelect(second) { |
27909 | var _props3 = this.props; | 30203 | var _props4 = this.props; |
27910 | var prefixCls = _props3.prefixCls; | 30204 | var prefixCls = _props4.prefixCls; |
27911 | var secondOptions = _props3.secondOptions; | 30205 | var secondOptions = _props4.secondOptions; |
27912 | var disabledSeconds = _props3.disabledSeconds; | 30206 | var disabledSeconds = _props4.disabledSeconds; |
27913 | var showSecond = _props3.showSecond; | 30207 | var showSecond = _props4.showSecond; |
30208 | var defaultOpenValue = _props4.defaultOpenValue; | ||
27914 | 30209 | ||
27915 | if (!showSecond) { | 30210 | if (!showSecond) { |
27916 | return null; | 30211 | return null; |
27917 | } | 30212 | } |
27918 | var value = this.props.value || this.getNow(); | 30213 | var value = this.props.value || defaultOpenValue; |
27919 | var disabledOptions = disabledSeconds(value.getHourOfDay(), value.getMinutes()); | 30214 | var disabledOptions = disabledSeconds(value.hour(), value.minute()); |
27920 | 30215 | ||
27921 | return _react2['default'].createElement(_Select2['default'], { | 30216 | return _react2.default.createElement(_Select2.default, { |
27922 | prefixCls: prefixCls, | 30217 | prefixCls: prefixCls, |
27923 | options: secondOptions.map(function (option) { | 30218 | options: secondOptions.map(function (option) { |
27924 | return formatOption(option, disabledOptions); | 30219 | return formatOption(option, disabledOptions); |
@@ -27929,60 +30224,53 @@ | |||
27929 | onMouseEnter: this.onEnterSelectPanel.bind(this, 'second') | 30224 | onMouseEnter: this.onEnterSelectPanel.bind(this, 'second') |
27930 | }); | 30225 | }); |
27931 | }, | 30226 | }, |
27932 | |||
27933 | getNow: function getNow() { | ||
27934 | if (this.showNow) { | ||
27935 | return this.showNow; | ||
27936 | } | ||
27937 | var value = new _gregorianCalendar2['default'](this.props.gregorianCalendarLocale); | ||
27938 | value.setTime(Date.now()); | ||
27939 | this.showNow = value; | ||
27940 | return value; | ||
27941 | }, | ||
27942 | |||
27943 | render: function render() { | 30227 | render: function render() { |
27944 | var prefixCls = this.props.prefixCls; | 30228 | var _props5 = this.props; |
30229 | var prefixCls = _props5.prefixCls; | ||
30230 | var defaultOpenValue = _props5.defaultOpenValue; | ||
27945 | 30231 | ||
27946 | var value = this.props.value || this.getNow(); | 30232 | var value = this.props.value || defaultOpenValue; |
27947 | return _react2['default'].createElement( | 30233 | return _react2.default.createElement( |
27948 | 'div', | 30234 | 'div', |
27949 | { className: prefixCls + '-combobox' }, | 30235 | { className: prefixCls + '-combobox' }, |
27950 | this.getHourSelect(value.getHourOfDay()), | 30236 | this.getHourSelect(value.hour()), |
27951 | this.getMinuteSelect(value.getMinutes()), | 30237 | this.getMinuteSelect(value.minute()), |
27952 | this.getSecondSelect(value.getSeconds()) | 30238 | this.getSecondSelect(value.second()) |
27953 | ); | 30239 | ); |
27954 | } | 30240 | } |
27955 | }); | 30241 | }); |
27956 | 30242 | ||
27957 | exports['default'] = Combobox; | 30243 | exports.default = Combobox; |
27958 | module.exports = exports['default']; | 30244 | module.exports = exports['default']; |
27959 | 30245 | ||
27960 | /***/ }, | 30246 | /***/ }, |
27961 | /* 224 */ | 30247 | /* 216 */ |
27962 | /***/ function(module, exports, __webpack_require__) { | 30248 | /***/ function(module, exports, __webpack_require__) { |
27963 | 30249 | ||
27964 | 'use strict'; | 30250 | 'use strict'; |
27965 | 30251 | ||
27966 | Object.defineProperty(exports, '__esModule', { | 30252 | Object.defineProperty(exports, "__esModule", { |
27967 | value: true | 30253 | value: true |
27968 | }); | 30254 | }); |
27969 | 30255 | ||
27970 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | 30256 | var _defineProperty2 = __webpack_require__(217); |
27971 | 30257 | ||
27972 | 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; } | 30258 | var _defineProperty3 = _interopRequireDefault(_defineProperty2); |
27973 | 30259 | ||
27974 | var _react = __webpack_require__(3); | 30260 | var _react = __webpack_require__(3); |
27975 | 30261 | ||
27976 | var _react2 = _interopRequireDefault(_react); | 30262 | var _react2 = _interopRequireDefault(_react); |
27977 | 30263 | ||
27978 | var _reactDom = __webpack_require__(160); | 30264 | var _reactDom = __webpack_require__(37); |
27979 | 30265 | ||
27980 | var _reactDom2 = _interopRequireDefault(_reactDom); | 30266 | var _reactDom2 = _interopRequireDefault(_reactDom); |
27981 | 30267 | ||
27982 | var _classnames2 = __webpack_require__(177); | 30268 | var _classnames2 = __webpack_require__(236); |
27983 | 30269 | ||
27984 | var _classnames3 = _interopRequireDefault(_classnames2); | 30270 | var _classnames3 = _interopRequireDefault(_classnames2); |
27985 | 30271 | ||
30272 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
30273 | |||
27986 | var scrollTo = function scrollTo(element, to, duration) { | 30274 | var scrollTo = function scrollTo(element, to, duration) { |
27987 | var requestAnimationFrame = window.requestAnimationFrame || function requestAnimationFrameTimeout() { | 30275 | var requestAnimationFrame = window.requestAnimationFrame || function requestAnimationFrameTimeout() { |
27988 | return setTimeout(arguments[0], 10); | 30276 | return setTimeout(arguments[0], 10); |
@@ -28002,13 +30290,12 @@ | |||
28002 | }); | 30290 | }); |
28003 | }; | 30291 | }; |
28004 | 30292 | ||
28005 | var Select = _react2['default'].createClass({ | 30293 | var Select = _react2.default.createClass({ |
28006 | displayName: 'Select', | 30294 | displayName: 'Select', |
28007 | 30295 | ||
28008 | propTypes: { | 30296 | propTypes: { |
28009 | prefixCls: _react.PropTypes.string, | 30297 | prefixCls: _react.PropTypes.string, |
28010 | options: _react.PropTypes.array, | 30298 | options: _react.PropTypes.array, |
28011 | gregorianCalendarLocale: _react.PropTypes.object, | ||
28012 | selectedIndex: _react.PropTypes.number, | 30299 | selectedIndex: _react.PropTypes.number, |
28013 | type: _react.PropTypes.string, | 30300 | type: _react.PropTypes.string, |
28014 | onSelect: _react.PropTypes.func, | 30301 | onSelect: _react.PropTypes.func, |
@@ -28019,14 +30306,12 @@ | |||
28019 | // jump to selected option | 30306 | // jump to selected option |
28020 | this.scrollToSelected(0); | 30307 | this.scrollToSelected(0); |
28021 | }, | 30308 | }, |
28022 | |||
28023 | componentDidUpdate: function componentDidUpdate(prevProps) { | 30309 | componentDidUpdate: function componentDidUpdate(prevProps) { |
28024 | // smooth scroll to selected option | 30310 | // smooth scroll to selected option |
28025 | if (prevProps.selectedIndex !== this.props.selectedIndex) { | 30311 | if (prevProps.selectedIndex !== this.props.selectedIndex) { |
28026 | this.scrollToSelected(120); | 30312 | this.scrollToSelected(120); |
28027 | } | 30313 | } |
28028 | }, | 30314 | }, |
28029 | |||
28030 | onSelect: function onSelect(value) { | 30315 | onSelect: function onSelect(value) { |
28031 | var _props = this.props; | 30316 | var _props = this.props; |
28032 | var onSelect = _props.onSelect; | 30317 | var onSelect = _props.onSelect; |
@@ -28034,7 +30319,6 @@ | |||
28034 | 30319 | ||
28035 | onSelect(type, value); | 30320 | onSelect(type, value); |
28036 | }, | 30321 | }, |
28037 | |||
28038 | getOptions: function getOptions() { | 30322 | getOptions: function getOptions() { |
28039 | var _this = this; | 30323 | var _this = this; |
28040 | 30324 | ||
@@ -28046,23 +30330,27 @@ | |||
28046 | return options.map(function (item, index) { | 30330 | return options.map(function (item, index) { |
28047 | var _classnames; | 30331 | var _classnames; |
28048 | 30332 | ||
28049 | var cls = (0, _classnames3['default'])((_classnames = {}, _defineProperty(_classnames, prefixCls + '-select-option-selected', selectedIndex === index), _defineProperty(_classnames, prefixCls + '-select-option-disabled', item.disabled), _classnames)); | 30333 | var cls = (0, _classnames3.default)((_classnames = {}, (0, _defineProperty3.default)(_classnames, prefixCls + '-select-option-selected', selectedIndex === index), (0, _defineProperty3.default)(_classnames, prefixCls + '-select-option-disabled', item.disabled), _classnames)); |
28050 | var onclick = null; | 30334 | var onclick = null; |
28051 | if (!item.disabled) { | 30335 | if (!item.disabled) { |
28052 | onclick = _this.onSelect.bind(_this, +item.value); | 30336 | onclick = _this.onSelect.bind(_this, +item.value); |
28053 | } | 30337 | } |
28054 | return _react2['default'].createElement( | 30338 | return _react2.default.createElement( |
28055 | 'li', | 30339 | 'li', |
28056 | { className: cls, key: index, onClick: onclick, disabled: item.disabled }, | 30340 | { |
30341 | className: cls, | ||
30342 | key: index, | ||
30343 | onClick: onclick, | ||
30344 | disabled: item.disabled | ||
30345 | }, | ||
28057 | item.value | 30346 | item.value |
28058 | ); | 30347 | ); |
28059 | }); | 30348 | }); |
28060 | }, | 30349 | }, |
28061 | |||
28062 | scrollToSelected: function scrollToSelected(duration) { | 30350 | scrollToSelected: function scrollToSelected(duration) { |
28063 | // move to selected item | 30351 | // move to selected item |
28064 | var select = _reactDom2['default'].findDOMNode(this); | 30352 | var select = _reactDom2.default.findDOMNode(this); |
28065 | var list = _reactDom2['default'].findDOMNode(this.refs.list); | 30353 | var list = _reactDom2.default.findDOMNode(this.refs.list); |
28066 | var index = this.props.selectedIndex; | 30354 | var index = this.props.selectedIndex; |
28067 | if (index < 0) { | 30355 | if (index < 0) { |
28068 | index = 0; | 30356 | index = 0; |
@@ -28071,7 +30359,6 @@ | |||
28071 | var to = topOption.offsetTop; | 30359 | var to = topOption.offsetTop; |
28072 | scrollTo(select, to, duration); | 30360 | scrollTo(select, to, duration); |
28073 | }, | 30361 | }, |
28074 | |||
28075 | render: function render() { | 30362 | render: function render() { |
28076 | if (this.props.options.length === 0) { | 30363 | if (this.props.options.length === 0) { |
28077 | return null; | 30364 | return null; |
@@ -28079,11 +30366,14 @@ | |||
28079 | 30366 | ||
28080 | var prefixCls = this.props.prefixCls; | 30367 | var prefixCls = this.props.prefixCls; |
28081 | 30368 | ||
28082 | return _react2['default'].createElement( | 30369 | |
30370 | return _react2.default.createElement( | ||
28083 | 'div', | 30371 | 'div', |
28084 | { className: prefixCls + '-select', | 30372 | { |
28085 | onMouseEnter: this.props.onMouseEnter }, | 30373 | className: prefixCls + '-select', |
28086 | _react2['default'].createElement( | 30374 | onMouseEnter: this.props.onMouseEnter |
30375 | }, | ||
30376 | _react2.default.createElement( | ||
28087 | 'ul', | 30377 | 'ul', |
28088 | { ref: 'list' }, | 30378 | { ref: 'list' }, |
28089 | this.getOptions() | 30379 | this.getOptions() |
@@ -28092,16 +30382,362 @@ | |||
28092 | } | 30382 | } |
28093 | }); | 30383 | }); |
28094 | 30384 | ||
28095 | exports['default'] = Select; | 30385 | exports.default = Select; |
28096 | module.exports = exports['default']; | 30386 | module.exports = exports['default']; |
28097 | 30387 | ||
28098 | /***/ }, | 30388 | /***/ }, |
30389 | /* 217 */ | ||
30390 | /***/ function(module, exports, __webpack_require__) { | ||
30391 | |||
30392 | "use strict"; | ||
30393 | |||
30394 | exports.__esModule = true; | ||
30395 | |||
30396 | var _defineProperty = __webpack_require__(218); | ||
30397 | |||
30398 | var _defineProperty2 = _interopRequireDefault(_defineProperty); | ||
30399 | |||
30400 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
30401 | |||
30402 | exports.default = function (obj, key, value) { | ||
30403 | if (key in obj) { | ||
30404 | (0, _defineProperty2.default)(obj, key, { | ||
30405 | value: value, | ||
30406 | enumerable: true, | ||
30407 | configurable: true, | ||
30408 | writable: true | ||
30409 | }); | ||
30410 | } else { | ||
30411 | obj[key] = value; | ||
30412 | } | ||
30413 | |||
30414 | return obj; | ||
30415 | }; | ||
30416 | |||
30417 | /***/ }, | ||
30418 | /* 218 */ | ||
30419 | /***/ function(module, exports, __webpack_require__) { | ||
30420 | |||
30421 | module.exports = { "default": __webpack_require__(219), __esModule: true }; | ||
30422 | |||
30423 | /***/ }, | ||
30424 | /* 219 */ | ||
30425 | /***/ function(module, exports, __webpack_require__) { | ||
30426 | |||
30427 | __webpack_require__(220); | ||
30428 | var $Object = __webpack_require__(223).Object; | ||
30429 | module.exports = function defineProperty(it, key, desc){ | ||
30430 | return $Object.defineProperty(it, key, desc); | ||
30431 | }; | ||
30432 | |||
30433 | /***/ }, | ||
30434 | /* 220 */ | ||
30435 | /***/ function(module, exports, __webpack_require__) { | ||
30436 | |||
30437 | var $export = __webpack_require__(221); | ||
30438 | // 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes) | ||
30439 | $export($export.S + $export.F * !__webpack_require__(231), 'Object', {defineProperty: __webpack_require__(227).f}); | ||
30440 | |||
30441 | /***/ }, | ||
30442 | /* 221 */ | ||
30443 | /***/ function(module, exports, __webpack_require__) { | ||
30444 | |||
30445 | var global = __webpack_require__(222) | ||
30446 | , core = __webpack_require__(223) | ||
30447 | , ctx = __webpack_require__(224) | ||
30448 | , hide = __webpack_require__(226) | ||
30449 | , PROTOTYPE = 'prototype'; | ||
30450 | |||
30451 | var $export = function(type, name, source){ | ||
30452 | var IS_FORCED = type & $export.F | ||
30453 | , IS_GLOBAL = type & $export.G | ||
30454 | , IS_STATIC = type & $export.S | ||
30455 | , IS_PROTO = type & $export.P | ||
30456 | , IS_BIND = type & $export.B | ||
30457 | , IS_WRAP = type & $export.W | ||
30458 | , exports = IS_GLOBAL ? core : core[name] || (core[name] = {}) | ||
30459 | , expProto = exports[PROTOTYPE] | ||
30460 | , target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE] | ||
30461 | , key, own, out; | ||
30462 | if(IS_GLOBAL)source = name; | ||
30463 | for(key in source){ | ||
30464 | // contains in native | ||
30465 | own = !IS_FORCED && target && target[key] !== undefined; | ||
30466 | if(own && key in exports)continue; | ||
30467 | // export native or passed | ||
30468 | out = own ? target[key] : source[key]; | ||
30469 | // prevent global pollution for namespaces | ||
30470 | exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key] | ||
30471 | // bind timers to global for call from export context | ||
30472 | : IS_BIND && own ? ctx(out, global) | ||
30473 | // wrap global constructors for prevent change them in library | ||
30474 | : IS_WRAP && target[key] == out ? (function(C){ | ||
30475 | var F = function(a, b, c){ | ||
30476 | if(this instanceof C){ | ||
30477 | switch(arguments.length){ | ||
30478 | case 0: return new C; | ||
30479 | case 1: return new C(a); | ||
30480 | case 2: return new C(a, b); | ||
30481 | } return new C(a, b, c); | ||
30482 | } return C.apply(this, arguments); | ||
30483 | }; | ||
30484 | F[PROTOTYPE] = C[PROTOTYPE]; | ||
30485 | return F; | ||
30486 | // make static versions for prototype methods | ||
30487 | })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; | ||
30488 | // export proto methods to core.%CONSTRUCTOR%.methods.%NAME% | ||
30489 | if(IS_PROTO){ | ||
30490 | (exports.virtual || (exports.virtual = {}))[key] = out; | ||
30491 | // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME% | ||
30492 | if(type & $export.R && expProto && !expProto[key])hide(expProto, key, out); | ||
30493 | } | ||
30494 | } | ||
30495 | }; | ||
30496 | // type bitmap | ||
30497 | $export.F = 1; // forced | ||
30498 | $export.G = 2; // global | ||
30499 | $export.S = 4; // static | ||
30500 | $export.P = 8; // proto | ||
30501 | $export.B = 16; // bind | ||
30502 | $export.W = 32; // wrap | ||
30503 | $export.U = 64; // safe | ||
30504 | $export.R = 128; // real proto method for `library` | ||
30505 | module.exports = $export; | ||
30506 | |||
30507 | /***/ }, | ||
30508 | /* 222 */ | ||
30509 | /***/ function(module, exports) { | ||
30510 | |||
30511 | // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 | ||
30512 | var global = module.exports = typeof window != 'undefined' && window.Math == Math | ||
30513 | ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); | ||
30514 | if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef | ||
30515 | |||
30516 | /***/ }, | ||
30517 | /* 223 */ | ||
30518 | /***/ function(module, exports) { | ||
30519 | |||
30520 | var core = module.exports = {version: '2.4.0'}; | ||
30521 | if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef | ||
30522 | |||
30523 | /***/ }, | ||
30524 | /* 224 */ | ||
30525 | /***/ function(module, exports, __webpack_require__) { | ||
30526 | |||
30527 | // optional / simple context binding | ||
30528 | var aFunction = __webpack_require__(225); | ||
30529 | module.exports = function(fn, that, length){ | ||
30530 | aFunction(fn); | ||
30531 | if(that === undefined)return fn; | ||
30532 | switch(length){ | ||
30533 | case 1: return function(a){ | ||
30534 | return fn.call(that, a); | ||
30535 | }; | ||
30536 | case 2: return function(a, b){ | ||
30537 | return fn.call(that, a, b); | ||
30538 | }; | ||
30539 | case 3: return function(a, b, c){ | ||
30540 | return fn.call(that, a, b, c); | ||
30541 | }; | ||
30542 | } | ||
30543 | return function(/* ...args */){ | ||
30544 | return fn.apply(that, arguments); | ||
30545 | }; | ||
30546 | }; | ||
30547 | |||
30548 | /***/ }, | ||
28099 | /* 225 */ | 30549 | /* 225 */ |
28100 | /***/ function(module, exports) { | 30550 | /***/ function(module, exports) { |
28101 | 30551 | ||
30552 | module.exports = function(it){ | ||
30553 | if(typeof it != 'function')throw TypeError(it + ' is not a function!'); | ||
30554 | return it; | ||
30555 | }; | ||
30556 | |||
30557 | /***/ }, | ||
30558 | /* 226 */ | ||
30559 | /***/ function(module, exports, __webpack_require__) { | ||
30560 | |||
30561 | var dP = __webpack_require__(227) | ||
30562 | , createDesc = __webpack_require__(235); | ||
30563 | module.exports = __webpack_require__(231) ? function(object, key, value){ | ||
30564 | return dP.f(object, key, createDesc(1, value)); | ||
30565 | } : function(object, key, value){ | ||
30566 | object[key] = value; | ||
30567 | return object; | ||
30568 | }; | ||
30569 | |||
30570 | /***/ }, | ||
30571 | /* 227 */ | ||
30572 | /***/ function(module, exports, __webpack_require__) { | ||
30573 | |||
30574 | var anObject = __webpack_require__(228) | ||
30575 | , IE8_DOM_DEFINE = __webpack_require__(230) | ||
30576 | , toPrimitive = __webpack_require__(234) | ||
30577 | , dP = Object.defineProperty; | ||
30578 | |||
30579 | exports.f = __webpack_require__(231) ? Object.defineProperty : function defineProperty(O, P, Attributes){ | ||
30580 | anObject(O); | ||
30581 | P = toPrimitive(P, true); | ||
30582 | anObject(Attributes); | ||
30583 | if(IE8_DOM_DEFINE)try { | ||
30584 | return dP(O, P, Attributes); | ||
30585 | } catch(e){ /* empty */ } | ||
30586 | if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!'); | ||
30587 | if('value' in Attributes)O[P] = Attributes.value; | ||
30588 | return O; | ||
30589 | }; | ||
30590 | |||
30591 | /***/ }, | ||
30592 | /* 228 */ | ||
30593 | /***/ function(module, exports, __webpack_require__) { | ||
30594 | |||
30595 | var isObject = __webpack_require__(229); | ||
30596 | module.exports = function(it){ | ||
30597 | if(!isObject(it))throw TypeError(it + ' is not an object!'); | ||
30598 | return it; | ||
30599 | }; | ||
30600 | |||
30601 | /***/ }, | ||
30602 | /* 229 */ | ||
30603 | /***/ function(module, exports) { | ||
30604 | |||
30605 | module.exports = function(it){ | ||
30606 | return typeof it === 'object' ? it !== null : typeof it === 'function'; | ||
30607 | }; | ||
30608 | |||
30609 | /***/ }, | ||
30610 | /* 230 */ | ||
30611 | /***/ function(module, exports, __webpack_require__) { | ||
30612 | |||
30613 | module.exports = !__webpack_require__(231) && !__webpack_require__(232)(function(){ | ||
30614 | return Object.defineProperty(__webpack_require__(233)('div'), 'a', {get: function(){ return 7; }}).a != 7; | ||
30615 | }); | ||
30616 | |||
30617 | /***/ }, | ||
30618 | /* 231 */ | ||
30619 | /***/ function(module, exports, __webpack_require__) { | ||
30620 | |||
30621 | // Thank's IE8 for his funny defineProperty | ||
30622 | module.exports = !__webpack_require__(232)(function(){ | ||
30623 | return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7; | ||
30624 | }); | ||
30625 | |||
30626 | /***/ }, | ||
30627 | /* 232 */ | ||
30628 | /***/ function(module, exports) { | ||
30629 | |||
30630 | module.exports = function(exec){ | ||
30631 | try { | ||
30632 | return !!exec(); | ||
30633 | } catch(e){ | ||
30634 | return true; | ||
30635 | } | ||
30636 | }; | ||
30637 | |||
30638 | /***/ }, | ||
30639 | /* 233 */ | ||
30640 | /***/ function(module, exports, __webpack_require__) { | ||
30641 | |||
30642 | var isObject = __webpack_require__(229) | ||
30643 | , document = __webpack_require__(222).document | ||
30644 | // in old IE typeof document.createElement is 'object' | ||
30645 | , is = isObject(document) && isObject(document.createElement); | ||
30646 | module.exports = function(it){ | ||
30647 | return is ? document.createElement(it) : {}; | ||
30648 | }; | ||
30649 | |||
30650 | /***/ }, | ||
30651 | /* 234 */ | ||
30652 | /***/ function(module, exports, __webpack_require__) { | ||
30653 | |||
30654 | // 7.1.1 ToPrimitive(input [, PreferredType]) | ||
30655 | var isObject = __webpack_require__(229); | ||
30656 | // instead of the ES6 spec version, we didn't implement @@toPrimitive case | ||
30657 | // and the second argument - flag - preferred type is a string | ||
30658 | module.exports = function(it, S){ | ||
30659 | if(!isObject(it))return it; | ||
30660 | var fn, val; | ||
30661 | if(S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val; | ||
30662 | if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val; | ||
30663 | if(!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val; | ||
30664 | throw TypeError("Can't convert object to primitive value"); | ||
30665 | }; | ||
30666 | |||
30667 | /***/ }, | ||
30668 | /* 235 */ | ||
30669 | /***/ function(module, exports) { | ||
30670 | |||
30671 | module.exports = function(bitmap, value){ | ||
30672 | return { | ||
30673 | enumerable : !(bitmap & 1), | ||
30674 | configurable: !(bitmap & 2), | ||
30675 | writable : !(bitmap & 4), | ||
30676 | value : value | ||
30677 | }; | ||
30678 | }; | ||
30679 | |||
30680 | /***/ }, | ||
30681 | /* 236 */ | ||
30682 | /***/ function(module, exports, __webpack_require__) { | ||
30683 | |||
30684 | var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! | ||
30685 | Copyright (c) 2016 Jed Watson. | ||
30686 | Licensed under the MIT License (MIT), see | ||
30687 | http://jedwatson.github.io/classnames | ||
30688 | */ | ||
30689 | /* global define */ | ||
30690 | |||
30691 | (function () { | ||
30692 | 'use strict'; | ||
30693 | |||
30694 | var hasOwn = {}.hasOwnProperty; | ||
30695 | |||
30696 | function classNames () { | ||
30697 | var classes = []; | ||
30698 | |||
30699 | for (var i = 0; i < arguments.length; i++) { | ||
30700 | var arg = arguments[i]; | ||
30701 | if (!arg) continue; | ||
30702 | |||
30703 | var argType = typeof arg; | ||
30704 | |||
30705 | if (argType === 'string' || argType === 'number') { | ||
30706 | classes.push(arg); | ||
30707 | } else if (Array.isArray(arg)) { | ||
30708 | classes.push(classNames.apply(null, arg)); | ||
30709 | } else if (argType === 'object') { | ||
30710 | for (var key in arg) { | ||
30711 | if (hasOwn.call(arg, key) && arg[key]) { | ||
30712 | classes.push(key); | ||
30713 | } | ||
30714 | } | ||
30715 | } | ||
30716 | } | ||
30717 | |||
30718 | return classes.join(' '); | ||
30719 | } | ||
30720 | |||
30721 | if (typeof module !== 'undefined' && module.exports) { | ||
30722 | module.exports = classNames; | ||
30723 | } else if (true) { | ||
30724 | // register as 'classnames', consistent with npm package name | ||
30725 | !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () { | ||
30726 | return classNames; | ||
30727 | }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); | ||
30728 | } else { | ||
30729 | window.classNames = classNames; | ||
30730 | } | ||
30731 | }()); | ||
30732 | |||
30733 | |||
30734 | /***/ }, | ||
30735 | /* 237 */ | ||
30736 | /***/ function(module, exports) { | ||
30737 | |||
28102 | 'use strict'; | 30738 | 'use strict'; |
28103 | 30739 | ||
28104 | Object.defineProperty(exports, '__esModule', { | 30740 | Object.defineProperty(exports, "__esModule", { |
28105 | value: true | 30741 | value: true |
28106 | }); | 30742 | }); |
28107 | var autoAdjustOverflow = { | 30743 | var autoAdjustOverflow = { |
@@ -28138,97 +30774,9 @@ | |||
28138 | } | 30774 | } |
28139 | }; | 30775 | }; |
28140 | 30776 | ||
28141 | exports['default'] = placements; | 30777 | exports.default = placements; |
28142 | module.exports = exports['default']; | ||
28143 | |||
28144 | /***/ }, | ||
28145 | /* 226 */ | ||
28146 | /***/ function(module, exports, __webpack_require__) { | ||
28147 | |||
28148 | 'use strict'; | ||
28149 | |||
28150 | Object.defineProperty(exports, '__esModule', { | ||
28151 | value: true | ||
28152 | }); | ||
28153 | exports.getFormatter = getFormatter; | ||
28154 | |||
28155 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
28156 | |||
28157 | var _gregorianCalendarFormat = __webpack_require__(165); | ||
28158 | |||
28159 | var _gregorianCalendarFormat2 = _interopRequireDefault(_gregorianCalendarFormat); | ||
28160 | |||
28161 | function getFormatter(format, locale) { | ||
28162 | if (typeof format === 'string') { | ||
28163 | return new _gregorianCalendarFormat2['default'](format, locale.format); | ||
28164 | } | ||
28165 | return format; | ||
28166 | } | ||
28167 | |||
28168 | /***/ }, | ||
28169 | /* 227 */ | ||
28170 | /***/ function(module, exports, __webpack_require__) { | ||
28171 | |||
28172 | 'use strict'; | ||
28173 | |||
28174 | Object.defineProperty(exports, '__esModule', { | ||
28175 | value: true | ||
28176 | }); | ||
28177 | |||
28178 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
28179 | |||
28180 | var _gregorianCalendarFormatLibLocaleZh_CN = __webpack_require__(228); | ||
28181 | |||
28182 | var _gregorianCalendarFormatLibLocaleZh_CN2 = _interopRequireDefault(_gregorianCalendarFormatLibLocaleZh_CN); | ||
28183 | |||
28184 | var _gregorianCalendarLibLocaleZh_CN = __webpack_require__(229); | ||
28185 | |||
28186 | var _gregorianCalendarLibLocaleZh_CN2 = _interopRequireDefault(_gregorianCalendarLibLocaleZh_CN); | ||
28187 | |||
28188 | exports['default'] = { | ||
28189 | clear: '清除', | ||
28190 | format: _gregorianCalendarFormatLibLocaleZh_CN2['default'], | ||
28191 | calendar: _gregorianCalendarLibLocaleZh_CN2['default'] | ||
28192 | }; | ||
28193 | module.exports = exports['default']; | 30778 | module.exports = exports['default']; |
28194 | 30779 | ||
28195 | /***/ }, | ||
28196 | /* 228 */ | ||
28197 | /***/ function(module, exports) { | ||
28198 | |||
28199 | 'use strict'; | ||
28200 | |||
28201 | module.exports = { | ||
28202 | eras: ['公元前', '公元'], | ||
28203 | months: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'], | ||
28204 | shortMonths: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'], | ||
28205 | weekdays: ['星期天', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'], | ||
28206 | shortWeekdays: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'], | ||
28207 | veryShortWeekdays: ['日', '一', '二', '三', '四', '五', '六'], | ||
28208 | ampms: ['上午', '下午'], | ||
28209 | datePatterns: ['yyyy\'年\'M\'月\'d\'日\' EEEE', 'yyyy\'年\'M\'月\'d\'日\'', 'yyyy-M-d', 'yy-M-d'], | ||
28210 | timePatterns: ['ahh\'时\'mm\'分\'ss\'秒\' \'GMT\'Z', 'ahh\'时\'mm\'分\'ss\'秒\'', 'H:mm:ss', 'ah:mm'], | ||
28211 | dateTimePattern: '{date} {time}' | ||
28212 | }; | ||
28213 | |||
28214 | /***/ }, | ||
28215 | /* 229 */ | ||
28216 | /***/ function(module, exports) { | ||
28217 | |||
28218 | /* | ||
28219 | * zh-cn locale | ||
28220 | * @ignore | ||
28221 | * @author yiminghe@gmail.com | ||
28222 | */ | ||
28223 | "use strict"; | ||
28224 | |||
28225 | module.exports = { | ||
28226 | // in minutes | ||
28227 | timezoneOffset: 8 * 60, | ||
28228 | firstDayOfWeek: 1, | ||
28229 | minimalDaysInFirstWeek: 1 | ||
28230 | }; | ||
28231 | |||
28232 | /***/ } | 30780 | /***/ } |
28233 | /******/ ]); | 30781 | /******/ ]); |
28234 | //# sourceMappingURL=common.js.map \ No newline at end of file | 30782 | //# sourceMappingURL=common.js.map \ No newline at end of file |