diff options
author | afc163 <afc163@gmail.com> | 2015-12-08 16:43:06 +0800 |
---|---|---|
committer | afc163 <afc163@gmail.com> | 2015-12-08 16:43:06 +0800 |
commit | 5eeeb3ae2934caa65bcdea71d372f72dea7944c0 (patch) | |
tree | 6fcd32bc916bf25e6aca4ad571576b419dd78580 /examples/pick-time.js | |
parent | b4ff5eb649faa3e6032c610e54d9bfdc77999886 (diff) | |
download | time-picker-5eeeb3ae2934caa65bcdea71d372f72dea7944c0.tar.gz time-picker-5eeeb3ae2934caa65bcdea71d372f72dea7944c0.tar.zst time-picker-5eeeb3ae2934caa65bcdea71d372f72dea7944c0.zip |
Updates
Diffstat (limited to 'examples/pick-time.js')
-rw-r--r-- | examples/pick-time.js | 27988 |
1 files changed, 2 insertions, 27986 deletions
diff --git a/examples/pick-time.js b/examples/pick-time.js index fd86805..2271e01 100644 --- a/examples/pick-time.js +++ b/examples/pick-time.js | |||
@@ -1,4 +1,4 @@ | |||
1 | webpackJsonp([0,1],[ | 1 | webpackJsonp([0],[ |
2 | /* 0 */ | 2 | /* 0 */ |
3 | /***/ function(module, exports, __webpack_require__) { | 3 | /***/ function(module, exports, __webpack_require__) { |
4 | 4 | ||
@@ -60,27993 +60,9 @@ webpackJsonp([0,1],[ | |||
60 | _reactDom2['default'].render(_react2['default'].createElement(_rcTimePicker2['default'], { formatter: formatter, locale: _rcTimePickerSrcLocaleZh_CN2['default'], | 60 | _reactDom2['default'].render(_react2['default'].createElement(_rcTimePicker2['default'], { formatter: formatter, locale: _rcTimePickerSrcLocaleZh_CN2['default'], |
61 | showSecond: showSecond, | 61 | showSecond: showSecond, |
62 | defaultValue: now, | 62 | defaultValue: now, |
63 | className: 'xxx', | ||
63 | onChange: onChange }), document.getElementById('__react-content')); | 64 | onChange: onChange }), document.getElementById('__react-content')); |
64 | 65 | ||
65 | /***/ }, | ||
66 | /* 2 */ | ||
67 | /***/ function(module, exports) { | ||
68 | |||
69 | // removed by extract-text-webpack-plugin | ||
70 | |||
71 | /***/ }, | ||
72 | /* 3 */ | ||
73 | /***/ function(module, exports, __webpack_require__) { | ||
74 | |||
75 | 'use strict'; | ||
76 | |||
77 | module.exports = __webpack_require__(4); | ||
78 | |||
79 | |||
80 | /***/ }, | ||
81 | /* 4 */ | ||
82 | /***/ function(module, exports, __webpack_require__) { | ||
83 | |||
84 | /** | ||
85 | * Copyright 2013-2015, Facebook, Inc. | ||
86 | * All rights reserved. | ||
87 | * | ||
88 | * This source code is licensed under the BSD-style license found in the | ||
89 | * LICENSE file in the root directory of this source tree. An additional grant | ||
90 | * of patent rights can be found in the PATENTS file in the same directory. | ||
91 | * | ||
92 | * @providesModule React | ||
93 | */ | ||
94 | |||
95 | 'use strict'; | ||
96 | |||
97 | var ReactDOM = __webpack_require__(5); | ||
98 | var ReactDOMServer = __webpack_require__(150); | ||
99 | var ReactIsomorphic = __webpack_require__(154); | ||
100 | |||
101 | var assign = __webpack_require__(41); | ||
102 | var deprecated = __webpack_require__(159); | ||
103 | |||
104 | // `version` will be added here by ReactIsomorphic. | ||
105 | var React = {}; | ||
106 | |||
107 | assign(React, ReactIsomorphic); | ||
108 | |||
109 | assign(React, { | ||
110 | // ReactDOM | ||
111 | findDOMNode: deprecated('findDOMNode', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.findDOMNode), | ||
112 | render: deprecated('render', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.render), | ||
113 | unmountComponentAtNode: deprecated('unmountComponentAtNode', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.unmountComponentAtNode), | ||
114 | |||
115 | // ReactDOMServer | ||
116 | renderToString: deprecated('renderToString', 'ReactDOMServer', 'react-dom/server', ReactDOMServer, ReactDOMServer.renderToString), | ||
117 | renderToStaticMarkup: deprecated('renderToStaticMarkup', 'ReactDOMServer', 'react-dom/server', ReactDOMServer, ReactDOMServer.renderToStaticMarkup) | ||
118 | }); | ||
119 | |||
120 | React.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOM; | ||
121 | React.__SECRET_DOM_SERVER_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOMServer; | ||
122 | |||
123 | module.exports = React; | ||
124 | |||
125 | /***/ }, | ||
126 | /* 5 */ | ||
127 | /***/ function(module, exports, __webpack_require__) { | ||
128 | |||
129 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
130 | * Copyright 2013-2015, Facebook, Inc. | ||
131 | * All rights reserved. | ||
132 | * | ||
133 | * This source code is licensed under the BSD-style license found in the | ||
134 | * LICENSE file in the root directory of this source tree. An additional grant | ||
135 | * of patent rights can be found in the PATENTS file in the same directory. | ||
136 | * | ||
137 | * @providesModule ReactDOM | ||
138 | */ | ||
139 | |||
140 | /* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/ | ||
141 | |||
142 | 'use strict'; | ||
143 | |||
144 | var ReactCurrentOwner = __webpack_require__(7); | ||
145 | var ReactDOMTextComponent = __webpack_require__(8); | ||
146 | var ReactDefaultInjection = __webpack_require__(73); | ||
147 | var ReactInstanceHandles = __webpack_require__(47); | ||
148 | var ReactMount = __webpack_require__(30); | ||
149 | var ReactPerf = __webpack_require__(20); | ||
150 | var ReactReconciler = __webpack_require__(52); | ||
151 | var ReactUpdates = __webpack_require__(56); | ||
152 | var ReactVersion = __webpack_require__(148); | ||
153 | |||
154 | var findDOMNode = __webpack_require__(93); | ||
155 | var renderSubtreeIntoContainer = __webpack_require__(149); | ||
156 | var warning = __webpack_require__(27); | ||
157 | |||
158 | ReactDefaultInjection.inject(); | ||
159 | |||
160 | var render = ReactPerf.measure('React', 'render', ReactMount.render); | ||
161 | |||
162 | var React = { | ||
163 | findDOMNode: findDOMNode, | ||
164 | render: render, | ||
165 | unmountComponentAtNode: ReactMount.unmountComponentAtNode, | ||
166 | version: ReactVersion, | ||
167 | |||
168 | /* eslint-disable camelcase */ | ||
169 | unstable_batchedUpdates: ReactUpdates.batchedUpdates, | ||
170 | unstable_renderSubtreeIntoContainer: renderSubtreeIntoContainer | ||
171 | }; | ||
172 | |||
173 | // Inject the runtime into a devtools global hook regardless of browser. | ||
174 | // Allows for debugging when the hook is injected on the page. | ||
175 | /* eslint-enable camelcase */ | ||
176 | if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') { | ||
177 | __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({ | ||
178 | CurrentOwner: ReactCurrentOwner, | ||
179 | InstanceHandles: ReactInstanceHandles, | ||
180 | Mount: ReactMount, | ||
181 | Reconciler: ReactReconciler, | ||
182 | TextComponent: ReactDOMTextComponent | ||
183 | }); | ||
184 | } | ||
185 | |||
186 | if (process.env.NODE_ENV !== 'production') { | ||
187 | var ExecutionEnvironment = __webpack_require__(11); | ||
188 | if (ExecutionEnvironment.canUseDOM && window.top === window.self) { | ||
189 | |||
190 | // First check if devtools is not installed | ||
191 | if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') { | ||
192 | // If we're in Chrome or Firefox, provide a download link if not installed. | ||
193 | if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) { | ||
194 | console.debug('Download the React DevTools for a better development experience: ' + 'https://fb.me/react-devtools'); | ||
195 | } | ||
196 | } | ||
197 | |||
198 | // If we're in IE8, check to see if we are in compatibility mode and provide | ||
199 | // information on preventing compatibility mode | ||
200 | var ieCompatibilityMode = document.documentMode && document.documentMode < 8; | ||
201 | |||
202 | 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; | ||
203 | |||
204 | var expectedFeatures = [ | ||
205 | // shims | ||
206 | 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, | ||
207 | |||
208 | // shams | ||
209 | Object.create, Object.freeze]; | ||
210 | |||
211 | for (var i = 0; i < expectedFeatures.length; i++) { | ||
212 | if (!expectedFeatures[i]) { | ||
213 | console.error('One or more ES5 shim/shams expected by React are not available: ' + 'https://fb.me/react-warning-polyfills'); | ||
214 | break; | ||
215 | } | ||
216 | } | ||
217 | } | ||
218 | } | ||
219 | |||
220 | module.exports = React; | ||
221 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
222 | |||
223 | /***/ }, | ||
224 | /* 6 */ | ||
225 | /***/ function(module, exports) { | ||
226 | |||
227 | // shim for using process in browser | ||
228 | |||
229 | var process = module.exports = {}; | ||
230 | var queue = []; | ||
231 | var draining = false; | ||
232 | var currentQueue; | ||
233 | var queueIndex = -1; | ||
234 | |||
235 | function cleanUpNextTick() { | ||
236 | draining = false; | ||
237 | if (currentQueue.length) { | ||
238 | queue = currentQueue.concat(queue); | ||
239 | } else { | ||
240 | queueIndex = -1; | ||
241 | } | ||
242 | if (queue.length) { | ||
243 | drainQueue(); | ||
244 | } | ||
245 | } | ||
246 | |||
247 | function drainQueue() { | ||
248 | if (draining) { | ||
249 | return; | ||
250 | } | ||
251 | var timeout = setTimeout(cleanUpNextTick); | ||
252 | draining = true; | ||
253 | |||
254 | var len = queue.length; | ||
255 | while(len) { | ||
256 | currentQueue = queue; | ||
257 | queue = []; | ||
258 | while (++queueIndex < len) { | ||
259 | if (currentQueue) { | ||
260 | currentQueue[queueIndex].run(); | ||
261 | } | ||
262 | } | ||
263 | queueIndex = -1; | ||
264 | len = queue.length; | ||
265 | } | ||
266 | currentQueue = null; | ||
267 | draining = false; | ||
268 | clearTimeout(timeout); | ||
269 | } | ||
270 | |||
271 | process.nextTick = function (fun) { | ||
272 | var args = new Array(arguments.length - 1); | ||
273 | if (arguments.length > 1) { | ||
274 | for (var i = 1; i < arguments.length; i++) { | ||
275 | args[i - 1] = arguments[i]; | ||
276 | } | ||
277 | } | ||
278 | queue.push(new Item(fun, args)); | ||
279 | if (queue.length === 1 && !draining) { | ||
280 | setTimeout(drainQueue, 0); | ||
281 | } | ||
282 | }; | ||
283 | |||
284 | // v8 likes predictible objects | ||
285 | function Item(fun, array) { | ||
286 | this.fun = fun; | ||
287 | this.array = array; | ||
288 | } | ||
289 | Item.prototype.run = function () { | ||
290 | this.fun.apply(null, this.array); | ||
291 | }; | ||
292 | process.title = 'browser'; | ||
293 | process.browser = true; | ||
294 | process.env = {}; | ||
295 | process.argv = []; | ||
296 | process.version = ''; // empty string to avoid regexp issues | ||
297 | process.versions = {}; | ||
298 | |||
299 | function noop() {} | ||
300 | |||
301 | process.on = noop; | ||
302 | process.addListener = noop; | ||
303 | process.once = noop; | ||
304 | process.off = noop; | ||
305 | process.removeListener = noop; | ||
306 | process.removeAllListeners = noop; | ||
307 | process.emit = noop; | ||
308 | |||
309 | process.binding = function (name) { | ||
310 | throw new Error('process.binding is not supported'); | ||
311 | }; | ||
312 | |||
313 | process.cwd = function () { return '/' }; | ||
314 | process.chdir = function (dir) { | ||
315 | throw new Error('process.chdir is not supported'); | ||
316 | }; | ||
317 | process.umask = function() { return 0; }; | ||
318 | |||
319 | |||
320 | /***/ }, | ||
321 | /* 7 */ | ||
322 | /***/ function(module, exports) { | ||
323 | |||
324 | /** | ||
325 | * Copyright 2013-2015, Facebook, Inc. | ||
326 | * All rights reserved. | ||
327 | * | ||
328 | * This source code is licensed under the BSD-style license found in the | ||
329 | * LICENSE file in the root directory of this source tree. An additional grant | ||
330 | * of patent rights can be found in the PATENTS file in the same directory. | ||
331 | * | ||
332 | * @providesModule ReactCurrentOwner | ||
333 | */ | ||
334 | |||
335 | 'use strict'; | ||
336 | |||
337 | /** | ||
338 | * Keeps track of the current owner. | ||
339 | * | ||
340 | * The current owner is the component who should own any components that are | ||
341 | * currently being constructed. | ||
342 | */ | ||
343 | var ReactCurrentOwner = { | ||
344 | |||
345 | /** | ||
346 | * @internal | ||
347 | * @type {ReactComponent} | ||
348 | */ | ||
349 | current: null | ||
350 | |||
351 | }; | ||
352 | |||
353 | module.exports = ReactCurrentOwner; | ||
354 | |||
355 | /***/ }, | ||
356 | /* 8 */ | ||
357 | /***/ function(module, exports, __webpack_require__) { | ||
358 | |||
359 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
360 | * Copyright 2013-2015, Facebook, Inc. | ||
361 | * All rights reserved. | ||
362 | * | ||
363 | * This source code is licensed under the BSD-style license found in the | ||
364 | * LICENSE file in the root directory of this source tree. An additional grant | ||
365 | * of patent rights can be found in the PATENTS file in the same directory. | ||
366 | * | ||
367 | * @providesModule ReactDOMTextComponent | ||
368 | * @typechecks static-only | ||
369 | */ | ||
370 | |||
371 | 'use strict'; | ||
372 | |||
373 | var DOMChildrenOperations = __webpack_require__(9); | ||
374 | var DOMPropertyOperations = __webpack_require__(24); | ||
375 | var ReactComponentBrowserEnvironment = __webpack_require__(28); | ||
376 | var ReactMount = __webpack_require__(30); | ||
377 | |||
378 | var assign = __webpack_require__(41); | ||
379 | var escapeTextContentForBrowser = __webpack_require__(23); | ||
380 | var setTextContent = __webpack_require__(22); | ||
381 | var validateDOMNesting = __webpack_require__(72); | ||
382 | |||
383 | /** | ||
384 | * Text nodes violate a couple assumptions that React makes about components: | ||
385 | * | ||
386 | * - When mounting text into the DOM, adjacent text nodes are merged. | ||
387 | * - Text nodes cannot be assigned a React root ID. | ||
388 | * | ||
389 | * This component is used to wrap strings in elements so that they can undergo | ||
390 | * the same reconciliation that is applied to elements. | ||
391 | * | ||
392 | * TODO: Investigate representing React components in the DOM with text nodes. | ||
393 | * | ||
394 | * @class ReactDOMTextComponent | ||
395 | * @extends ReactComponent | ||
396 | * @internal | ||
397 | */ | ||
398 | var ReactDOMTextComponent = function (props) { | ||
399 | // This constructor and its argument is currently used by mocks. | ||
400 | }; | ||
401 | |||
402 | assign(ReactDOMTextComponent.prototype, { | ||
403 | |||
404 | /** | ||
405 | * @param {ReactText} text | ||
406 | * @internal | ||
407 | */ | ||
408 | construct: function (text) { | ||
409 | // TODO: This is really a ReactText (ReactNode), not a ReactElement | ||
410 | this._currentElement = text; | ||
411 | this._stringText = '' + text; | ||
412 | |||
413 | // Properties | ||
414 | this._rootNodeID = null; | ||
415 | this._mountIndex = 0; | ||
416 | }, | ||
417 | |||
418 | /** | ||
419 | * Creates the markup for this text node. This node is not intended to have | ||
420 | * any features besides containing text content. | ||
421 | * | ||
422 | * @param {string} rootID DOM ID of the root node. | ||
423 | * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction | ||
424 | * @return {string} Markup for this text node. | ||
425 | * @internal | ||
426 | */ | ||
427 | mountComponent: function (rootID, transaction, context) { | ||
428 | if (process.env.NODE_ENV !== 'production') { | ||
429 | if (context[validateDOMNesting.ancestorInfoContextKey]) { | ||
430 | validateDOMNesting('span', null, context[validateDOMNesting.ancestorInfoContextKey]); | ||
431 | } | ||
432 | } | ||
433 | |||
434 | this._rootNodeID = rootID; | ||
435 | if (transaction.useCreateElement) { | ||
436 | var ownerDocument = context[ReactMount.ownerDocumentContextKey]; | ||
437 | var el = ownerDocument.createElement('span'); | ||
438 | DOMPropertyOperations.setAttributeForID(el, rootID); | ||
439 | // Populate node cache | ||
440 | ReactMount.getID(el); | ||
441 | setTextContent(el, this._stringText); | ||
442 | return el; | ||
443 | } else { | ||
444 | var escapedText = escapeTextContentForBrowser(this._stringText); | ||
445 | |||
446 | if (transaction.renderToStaticMarkup) { | ||
447 | // Normally we'd wrap this in a `span` for the reasons stated above, but | ||
448 | // since this is a situation where React won't take over (static pages), | ||
449 | // we can simply return the text as it is. | ||
450 | return escapedText; | ||
451 | } | ||
452 | |||
453 | return '<span ' + DOMPropertyOperations.createMarkupForID(rootID) + '>' + escapedText + '</span>'; | ||
454 | } | ||
455 | }, | ||
456 | |||
457 | /** | ||
458 | * Updates this component by updating the text content. | ||
459 | * | ||
460 | * @param {ReactText} nextText The next text content | ||
461 | * @param {ReactReconcileTransaction} transaction | ||
462 | * @internal | ||
463 | */ | ||
464 | receiveComponent: function (nextText, transaction) { | ||
465 | if (nextText !== this._currentElement) { | ||
466 | this._currentElement = nextText; | ||
467 | var nextStringText = '' + nextText; | ||
468 | if (nextStringText !== this._stringText) { | ||
469 | // TODO: Save this as pending props and use performUpdateIfNecessary | ||
470 | // and/or updateComponent to do the actual update for consistency with | ||
471 | // other component types? | ||
472 | this._stringText = nextStringText; | ||
473 | var node = ReactMount.getNode(this._rootNodeID); | ||
474 | DOMChildrenOperations.updateTextContent(node, nextStringText); | ||
475 | } | ||
476 | } | ||
477 | }, | ||
478 | |||
479 | unmountComponent: function () { | ||
480 | ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID); | ||
481 | } | ||
482 | |||
483 | }); | ||
484 | |||
485 | module.exports = ReactDOMTextComponent; | ||
486 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
487 | |||
488 | /***/ }, | ||
489 | /* 9 */ | ||
490 | /***/ function(module, exports, __webpack_require__) { | ||
491 | |||
492 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
493 | * Copyright 2013-2015, Facebook, Inc. | ||
494 | * All rights reserved. | ||
495 | * | ||
496 | * This source code is licensed under the BSD-style license found in the | ||
497 | * LICENSE file in the root directory of this source tree. An additional grant | ||
498 | * of patent rights can be found in the PATENTS file in the same directory. | ||
499 | * | ||
500 | * @providesModule DOMChildrenOperations | ||
501 | * @typechecks static-only | ||
502 | */ | ||
503 | |||
504 | 'use strict'; | ||
505 | |||
506 | var Danger = __webpack_require__(10); | ||
507 | var ReactMultiChildUpdateTypes = __webpack_require__(18); | ||
508 | var ReactPerf = __webpack_require__(20); | ||
509 | |||
510 | var setInnerHTML = __webpack_require__(21); | ||
511 | var setTextContent = __webpack_require__(22); | ||
512 | var invariant = __webpack_require__(15); | ||
513 | |||
514 | /** | ||
515 | * Inserts `childNode` as a child of `parentNode` at the `index`. | ||
516 | * | ||
517 | * @param {DOMElement} parentNode Parent node in which to insert. | ||
518 | * @param {DOMElement} childNode Child node to insert. | ||
519 | * @param {number} index Index at which to insert the child. | ||
520 | * @internal | ||
521 | */ | ||
522 | function insertChildAt(parentNode, childNode, index) { | ||
523 | // By exploiting arrays returning `undefined` for an undefined index, we can | ||
524 | // rely exclusively on `insertBefore(node, null)` instead of also using | ||
525 | // `appendChild(node)`. However, using `undefined` is not allowed by all | ||
526 | // browsers so we must replace it with `null`. | ||
527 | |||
528 | // fix render order error in safari | ||
529 | // IE8 will throw error when index out of list size. | ||
530 | var beforeChild = index >= parentNode.childNodes.length ? null : parentNode.childNodes.item(index); | ||
531 | |||
532 | parentNode.insertBefore(childNode, beforeChild); | ||
533 | } | ||
534 | |||
535 | /** | ||
536 | * Operations for updating with DOM children. | ||
537 | */ | ||
538 | var DOMChildrenOperations = { | ||
539 | |||
540 | dangerouslyReplaceNodeWithMarkup: Danger.dangerouslyReplaceNodeWithMarkup, | ||
541 | |||
542 | updateTextContent: setTextContent, | ||
543 | |||
544 | /** | ||
545 | * Updates a component's children by processing a series of updates. The | ||
546 | * update configurations are each expected to have a `parentNode` property. | ||
547 | * | ||
548 | * @param {array<object>} updates List of update configurations. | ||
549 | * @param {array<string>} markupList List of markup strings. | ||
550 | * @internal | ||
551 | */ | ||
552 | processUpdates: function (updates, markupList) { | ||
553 | var update; | ||
554 | // Mapping from parent IDs to initial child orderings. | ||
555 | var initialChildren = null; | ||
556 | // List of children that will be moved or removed. | ||
557 | var updatedChildren = null; | ||
558 | |||
559 | for (var i = 0; i < updates.length; i++) { | ||
560 | update = updates[i]; | ||
561 | if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING || update.type === ReactMultiChildUpdateTypes.REMOVE_NODE) { | ||
562 | var updatedIndex = update.fromIndex; | ||
563 | var updatedChild = update.parentNode.childNodes[updatedIndex]; | ||
564 | var parentID = update.parentID; | ||
565 | |||
566 | !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; | ||
567 | |||
568 | initialChildren = initialChildren || {}; | ||
569 | initialChildren[parentID] = initialChildren[parentID] || []; | ||
570 | initialChildren[parentID][updatedIndex] = updatedChild; | ||
571 | |||
572 | updatedChildren = updatedChildren || []; | ||
573 | updatedChildren.push(updatedChild); | ||
574 | } | ||
575 | } | ||
576 | |||
577 | var renderedMarkup; | ||
578 | // markupList is either a list of markup or just a list of elements | ||
579 | if (markupList.length && typeof markupList[0] === 'string') { | ||
580 | renderedMarkup = Danger.dangerouslyRenderMarkup(markupList); | ||
581 | } else { | ||
582 | renderedMarkup = markupList; | ||
583 | } | ||
584 | |||
585 | // Remove updated children first so that `toIndex` is consistent. | ||
586 | if (updatedChildren) { | ||
587 | for (var j = 0; j < updatedChildren.length; j++) { | ||
588 | updatedChildren[j].parentNode.removeChild(updatedChildren[j]); | ||
589 | } | ||
590 | } | ||
591 | |||
592 | for (var k = 0; k < updates.length; k++) { | ||
593 | update = updates[k]; | ||
594 | switch (update.type) { | ||
595 | case ReactMultiChildUpdateTypes.INSERT_MARKUP: | ||
596 | insertChildAt(update.parentNode, renderedMarkup[update.markupIndex], update.toIndex); | ||
597 | break; | ||
598 | case ReactMultiChildUpdateTypes.MOVE_EXISTING: | ||
599 | insertChildAt(update.parentNode, initialChildren[update.parentID][update.fromIndex], update.toIndex); | ||
600 | break; | ||
601 | case ReactMultiChildUpdateTypes.SET_MARKUP: | ||
602 | setInnerHTML(update.parentNode, update.content); | ||
603 | break; | ||
604 | case ReactMultiChildUpdateTypes.TEXT_CONTENT: | ||
605 | setTextContent(update.parentNode, update.content); | ||
606 | break; | ||
607 | case ReactMultiChildUpdateTypes.REMOVE_NODE: | ||
608 | // Already removed by the for-loop above. | ||
609 | break; | ||
610 | } | ||
611 | } | ||
612 | } | ||
613 | |||
614 | }; | ||
615 | |||
616 | ReactPerf.measureMethods(DOMChildrenOperations, 'DOMChildrenOperations', { | ||
617 | updateTextContent: 'updateTextContent' | ||
618 | }); | ||
619 | |||
620 | module.exports = DOMChildrenOperations; | ||
621 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
622 | |||
623 | /***/ }, | ||
624 | /* 10 */ | ||
625 | /***/ function(module, exports, __webpack_require__) { | ||
626 | |||
627 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
628 | * Copyright 2013-2015, Facebook, Inc. | ||
629 | * All rights reserved. | ||
630 | * | ||
631 | * This source code is licensed under the BSD-style license found in the | ||
632 | * LICENSE file in the root directory of this source tree. An additional grant | ||
633 | * of patent rights can be found in the PATENTS file in the same directory. | ||
634 | * | ||
635 | * @providesModule Danger | ||
636 | * @typechecks static-only | ||
637 | */ | ||
638 | |||
639 | 'use strict'; | ||
640 | |||
641 | var ExecutionEnvironment = __webpack_require__(11); | ||
642 | |||
643 | var createNodesFromMarkup = __webpack_require__(12); | ||
644 | var emptyFunction = __webpack_require__(17); | ||
645 | var getMarkupWrap = __webpack_require__(16); | ||
646 | var invariant = __webpack_require__(15); | ||
647 | |||
648 | var OPEN_TAG_NAME_EXP = /^(<[^ \/>]+)/; | ||
649 | var RESULT_INDEX_ATTR = 'data-danger-index'; | ||
650 | |||
651 | /** | ||
652 | * Extracts the `nodeName` from a string of markup. | ||
653 | * | ||
654 | * NOTE: Extracting the `nodeName` does not require a regular expression match | ||
655 | * because we make assumptions about React-generated markup (i.e. there are no | ||
656 | * spaces surrounding the opening tag and there is at least one attribute). | ||
657 | * | ||
658 | * @param {string} markup String of markup. | ||
659 | * @return {string} Node name of the supplied markup. | ||
660 | * @see http://jsperf.com/extract-nodename | ||
661 | */ | ||
662 | function getNodeName(markup) { | ||
663 | return markup.substring(1, markup.indexOf(' ')); | ||
664 | } | ||
665 | |||
666 | var Danger = { | ||
667 | |||
668 | /** | ||
669 | * Renders markup into an array of nodes. The markup is expected to render | ||
670 | * into a list of root nodes. Also, the length of `resultList` and | ||
671 | * `markupList` should be the same. | ||
672 | * | ||
673 | * @param {array<string>} markupList List of markup strings to render. | ||
674 | * @return {array<DOMElement>} List of rendered nodes. | ||
675 | * @internal | ||
676 | */ | ||
677 | dangerouslyRenderMarkup: function (markupList) { | ||
678 | !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; | ||
679 | var nodeName; | ||
680 | var markupByNodeName = {}; | ||
681 | // Group markup by `nodeName` if a wrap is necessary, else by '*'. | ||
682 | for (var i = 0; i < markupList.length; i++) { | ||
683 | !markupList[i] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyRenderMarkup(...): Missing markup.') : invariant(false) : undefined; | ||
684 | nodeName = getNodeName(markupList[i]); | ||
685 | nodeName = getMarkupWrap(nodeName) ? nodeName : '*'; | ||
686 | markupByNodeName[nodeName] = markupByNodeName[nodeName] || []; | ||
687 | markupByNodeName[nodeName][i] = markupList[i]; | ||
688 | } | ||
689 | var resultList = []; | ||
690 | var resultListAssignmentCount = 0; | ||
691 | for (nodeName in markupByNodeName) { | ||
692 | if (!markupByNodeName.hasOwnProperty(nodeName)) { | ||
693 | continue; | ||
694 | } | ||
695 | var markupListByNodeName = markupByNodeName[nodeName]; | ||
696 | |||
697 | // This for-in loop skips the holes of the sparse array. The order of | ||
698 | // iteration should follow the order of assignment, which happens to match | ||
699 | // numerical index order, but we don't rely on that. | ||
700 | var resultIndex; | ||
701 | for (resultIndex in markupListByNodeName) { | ||
702 | if (markupListByNodeName.hasOwnProperty(resultIndex)) { | ||
703 | var markup = markupListByNodeName[resultIndex]; | ||
704 | |||
705 | // Push the requested markup with an additional RESULT_INDEX_ATTR | ||
706 | // attribute. If the markup does not start with a < character, it | ||
707 | // will be discarded below (with an appropriate console.error). | ||
708 | markupListByNodeName[resultIndex] = markup.replace(OPEN_TAG_NAME_EXP, | ||
709 | // This index will be parsed back out below. | ||
710 | '$1 ' + RESULT_INDEX_ATTR + '="' + resultIndex + '" '); | ||
711 | } | ||
712 | } | ||
713 | |||
714 | // Render each group of markup with similar wrapping `nodeName`. | ||
715 | var renderNodes = createNodesFromMarkup(markupListByNodeName.join(''), emptyFunction // Do nothing special with <script> tags. | ||
716 | ); | ||
717 | |||
718 | for (var j = 0; j < renderNodes.length; ++j) { | ||
719 | var renderNode = renderNodes[j]; | ||
720 | if (renderNode.hasAttribute && renderNode.hasAttribute(RESULT_INDEX_ATTR)) { | ||
721 | |||
722 | resultIndex = +renderNode.getAttribute(RESULT_INDEX_ATTR); | ||
723 | renderNode.removeAttribute(RESULT_INDEX_ATTR); | ||
724 | |||
725 | !!resultList.hasOwnProperty(resultIndex) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Danger: Assigning to an already-occupied result index.') : invariant(false) : undefined; | ||
726 | |||
727 | resultList[resultIndex] = renderNode; | ||
728 | |||
729 | // This should match resultList.length and markupList.length when | ||
730 | // we're done. | ||
731 | resultListAssignmentCount += 1; | ||
732 | } else if (process.env.NODE_ENV !== 'production') { | ||
733 | console.error('Danger: Discarding unexpected node:', renderNode); | ||
734 | } | ||
735 | } | ||
736 | } | ||
737 | |||
738 | // Although resultList was populated out of order, it should now be a dense | ||
739 | // array. | ||
740 | !(resultListAssignmentCount === resultList.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Danger: Did not assign to every index of resultList.') : invariant(false) : undefined; | ||
741 | |||
742 | !(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; | ||
743 | |||
744 | return resultList; | ||
745 | }, | ||
746 | |||
747 | /** | ||
748 | * Replaces a node with a string of markup at its current position within its | ||
749 | * parent. The markup must render into a single root node. | ||
750 | * | ||
751 | * @param {DOMElement} oldChild Child node to replace. | ||
752 | * @param {string} markup Markup to render in place of the child node. | ||
753 | * @internal | ||
754 | */ | ||
755 | dangerouslyReplaceNodeWithMarkup: function (oldChild, markup) { | ||
756 | !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; | ||
757 | !markup ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : invariant(false) : undefined; | ||
758 | !(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; | ||
759 | |||
760 | var newChild; | ||
761 | if (typeof markup === 'string') { | ||
762 | newChild = createNodesFromMarkup(markup, emptyFunction)[0]; | ||
763 | } else { | ||
764 | newChild = markup; | ||
765 | } | ||
766 | oldChild.parentNode.replaceChild(newChild, oldChild); | ||
767 | } | ||
768 | |||
769 | }; | ||
770 | |||
771 | module.exports = Danger; | ||
772 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
773 | |||
774 | /***/ }, | ||
775 | /* 11 */ | ||
776 | /***/ function(module, exports) { | ||
777 | |||
778 | /** | ||
779 | * Copyright 2013-2015, Facebook, Inc. | ||
780 | * All rights reserved. | ||
781 | * | ||
782 | * This source code is licensed under the BSD-style license found in the | ||
783 | * LICENSE file in the root directory of this source tree. An additional grant | ||
784 | * of patent rights can be found in the PATENTS file in the same directory. | ||
785 | * | ||
786 | * @providesModule ExecutionEnvironment | ||
787 | */ | ||
788 | |||
789 | 'use strict'; | ||
790 | |||
791 | var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement); | ||
792 | |||
793 | /** | ||
794 | * Simple, lightweight module assisting with the detection and context of | ||
795 | * Worker. Helps avoid circular dependencies and allows code to reason about | ||
796 | * whether or not they are in a Worker, even if they never include the main | ||
797 | * `ReactWorker` dependency. | ||
798 | */ | ||
799 | var ExecutionEnvironment = { | ||
800 | |||
801 | canUseDOM: canUseDOM, | ||
802 | |||
803 | canUseWorkers: typeof Worker !== 'undefined', | ||
804 | |||
805 | canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent), | ||
806 | |||
807 | canUseViewport: canUseDOM && !!window.screen, | ||
808 | |||
809 | isInWorker: !canUseDOM // For now, this is true - might change in the future. | ||
810 | |||
811 | }; | ||
812 | |||
813 | module.exports = ExecutionEnvironment; | ||
814 | |||
815 | /***/ }, | ||
816 | /* 12 */ | ||
817 | /***/ function(module, exports, __webpack_require__) { | ||
818 | |||
819 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
820 | * Copyright 2013-2015, Facebook, Inc. | ||
821 | * All rights reserved. | ||
822 | * | ||
823 | * This source code is licensed under the BSD-style license found in the | ||
824 | * LICENSE file in the root directory of this source tree. An additional grant | ||
825 | * of patent rights can be found in the PATENTS file in the same directory. | ||
826 | * | ||
827 | * @providesModule createNodesFromMarkup | ||
828 | * @typechecks | ||
829 | */ | ||
830 | |||
831 | /*eslint-disable fb-www/unsafe-html*/ | ||
832 | |||
833 | 'use strict'; | ||
834 | |||
835 | var ExecutionEnvironment = __webpack_require__(11); | ||
836 | |||
837 | var createArrayFromMixed = __webpack_require__(13); | ||
838 | var getMarkupWrap = __webpack_require__(16); | ||
839 | var invariant = __webpack_require__(15); | ||
840 | |||
841 | /** | ||
842 | * Dummy container used to render all markup. | ||
843 | */ | ||
844 | var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null; | ||
845 | |||
846 | /** | ||
847 | * Pattern used by `getNodeName`. | ||
848 | */ | ||
849 | var nodeNamePattern = /^\s*<(\w+)/; | ||
850 | |||
851 | /** | ||
852 | * Extracts the `nodeName` of the first element in a string of markup. | ||
853 | * | ||
854 | * @param {string} markup String of markup. | ||
855 | * @return {?string} Node name of the supplied markup. | ||
856 | */ | ||
857 | function getNodeName(markup) { | ||
858 | var nodeNameMatch = markup.match(nodeNamePattern); | ||
859 | return nodeNameMatch && nodeNameMatch[1].toLowerCase(); | ||
860 | } | ||
861 | |||
862 | /** | ||
863 | * Creates an array containing the nodes rendered from the supplied markup. The | ||
864 | * optionally supplied `handleScript` function will be invoked once for each | ||
865 | * <script> element that is rendered. If no `handleScript` function is supplied, | ||
866 | * an exception is thrown if any <script> elements are rendered. | ||
867 | * | ||
868 | * @param {string} markup A string of valid HTML markup. | ||
869 | * @param {?function} handleScript Invoked once for each rendered <script>. | ||
870 | * @return {array<DOMElement|DOMTextNode>} An array of rendered nodes. | ||
871 | */ | ||
872 | function createNodesFromMarkup(markup, handleScript) { | ||
873 | var node = dummyNode; | ||
874 | !!!dummyNode ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createNodesFromMarkup dummy not initialized') : invariant(false) : undefined; | ||
875 | var nodeName = getNodeName(markup); | ||
876 | |||
877 | var wrap = nodeName && getMarkupWrap(nodeName); | ||
878 | if (wrap) { | ||
879 | node.innerHTML = wrap[1] + markup + wrap[2]; | ||
880 | |||
881 | var wrapDepth = wrap[0]; | ||
882 | while (wrapDepth--) { | ||
883 | node = node.lastChild; | ||
884 | } | ||
885 | } else { | ||
886 | node.innerHTML = markup; | ||
887 | } | ||
888 | |||
889 | var scripts = node.getElementsByTagName('script'); | ||
890 | if (scripts.length) { | ||
891 | !handleScript ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createNodesFromMarkup(...): Unexpected <script> element rendered.') : invariant(false) : undefined; | ||
892 | createArrayFromMixed(scripts).forEach(handleScript); | ||
893 | } | ||
894 | |||
895 | var nodes = createArrayFromMixed(node.childNodes); | ||
896 | while (node.lastChild) { | ||
897 | node.removeChild(node.lastChild); | ||
898 | } | ||
899 | return nodes; | ||
900 | } | ||
901 | |||
902 | module.exports = createNodesFromMarkup; | ||
903 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
904 | |||
905 | /***/ }, | ||
906 | /* 13 */ | ||
907 | /***/ function(module, exports, __webpack_require__) { | ||
908 | |||
909 | /** | ||
910 | * Copyright 2013-2015, Facebook, Inc. | ||
911 | * All rights reserved. | ||
912 | * | ||
913 | * This source code is licensed under the BSD-style license found in the | ||
914 | * LICENSE file in the root directory of this source tree. An additional grant | ||
915 | * of patent rights can be found in the PATENTS file in the same directory. | ||
916 | * | ||
917 | * @providesModule createArrayFromMixed | ||
918 | * @typechecks | ||
919 | */ | ||
920 | |||
921 | 'use strict'; | ||
922 | |||
923 | var toArray = __webpack_require__(14); | ||
924 | |||
925 | /** | ||
926 | * Perform a heuristic test to determine if an object is "array-like". | ||
927 | * | ||
928 | * A monk asked Joshu, a Zen master, "Has a dog Buddha nature?" | ||
929 | * Joshu replied: "Mu." | ||
930 | * | ||
931 | * This function determines if its argument has "array nature": it returns | ||
932 | * true if the argument is an actual array, an `arguments' object, or an | ||
933 | * HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()). | ||
934 | * | ||
935 | * It will return false for other array-like objects like Filelist. | ||
936 | * | ||
937 | * @param {*} obj | ||
938 | * @return {boolean} | ||
939 | */ | ||
940 | function hasArrayNature(obj) { | ||
941 | return( | ||
942 | // not null/false | ||
943 | !!obj && ( | ||
944 | // arrays are objects, NodeLists are functions in Safari | ||
945 | typeof obj == 'object' || typeof obj == 'function') && | ||
946 | // quacks like an array | ||
947 | 'length' in obj && | ||
948 | // not window | ||
949 | !('setInterval' in obj) && | ||
950 | // no DOM node should be considered an array-like | ||
951 | // a 'select' element has 'length' and 'item' properties on IE8 | ||
952 | typeof obj.nodeType != 'number' && ( | ||
953 | // a real array | ||
954 | Array.isArray(obj) || | ||
955 | // arguments | ||
956 | 'callee' in obj || | ||
957 | // HTMLCollection/NodeList | ||
958 | 'item' in obj) | ||
959 | ); | ||
960 | } | ||
961 | |||
962 | /** | ||
963 | * Ensure that the argument is an array by wrapping it in an array if it is not. | ||
964 | * Creates a copy of the argument if it is already an array. | ||
965 | * | ||
966 | * This is mostly useful idiomatically: | ||
967 | * | ||
968 | * var createArrayFromMixed = require('createArrayFromMixed'); | ||
969 | * | ||
970 | * function takesOneOrMoreThings(things) { | ||
971 | * things = createArrayFromMixed(things); | ||
972 | * ... | ||
973 | * } | ||
974 | * | ||
975 | * This allows you to treat `things' as an array, but accept scalars in the API. | ||
976 | * | ||
977 | * If you need to convert an array-like object, like `arguments`, into an array | ||
978 | * use toArray instead. | ||
979 | * | ||
980 | * @param {*} obj | ||
981 | * @return {array} | ||
982 | */ | ||
983 | function createArrayFromMixed(obj) { | ||
984 | if (!hasArrayNature(obj)) { | ||
985 | return [obj]; | ||
986 | } else if (Array.isArray(obj)) { | ||
987 | return obj.slice(); | ||
988 | } else { | ||
989 | return toArray(obj); | ||
990 | } | ||
991 | } | ||
992 | |||
993 | module.exports = createArrayFromMixed; | ||
994 | |||
995 | /***/ }, | ||
996 | /* 14 */ | ||
997 | /***/ function(module, exports, __webpack_require__) { | ||
998 | |||
999 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
1000 | * Copyright 2013-2015, Facebook, Inc. | ||
1001 | * All rights reserved. | ||
1002 | * | ||
1003 | * This source code is licensed under the BSD-style license found in the | ||
1004 | * LICENSE file in the root directory of this source tree. An additional grant | ||
1005 | * of patent rights can be found in the PATENTS file in the same directory. | ||
1006 | * | ||
1007 | * @providesModule toArray | ||
1008 | * @typechecks | ||
1009 | */ | ||
1010 | |||
1011 | 'use strict'; | ||
1012 | |||
1013 | var invariant = __webpack_require__(15); | ||
1014 | |||
1015 | /** | ||
1016 | * Convert array-like objects to arrays. | ||
1017 | * | ||
1018 | * This API assumes the caller knows the contents of the data type. For less | ||
1019 | * well defined inputs use createArrayFromMixed. | ||
1020 | * | ||
1021 | * @param {object|function|filelist} obj | ||
1022 | * @return {array} | ||
1023 | */ | ||
1024 | function toArray(obj) { | ||
1025 | var length = obj.length; | ||
1026 | |||
1027 | // Some browse builtin objects can report typeof 'function' (e.g. NodeList in | ||
1028 | // old versions of Safari). | ||
1029 | !(!Array.isArray(obj) && (typeof obj === 'object' || typeof obj === 'function')) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Array-like object expected') : invariant(false) : undefined; | ||
1030 | |||
1031 | !(typeof length === 'number') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object needs a length property') : invariant(false) : undefined; | ||
1032 | |||
1033 | !(length === 0 || length - 1 in obj) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object should have keys for indices') : invariant(false) : undefined; | ||
1034 | |||
1035 | // Old IE doesn't give collections access to hasOwnProperty. Assume inputs | ||
1036 | // without method will throw during the slice call and skip straight to the | ||
1037 | // fallback. | ||
1038 | if (obj.hasOwnProperty) { | ||
1039 | try { | ||
1040 | return Array.prototype.slice.call(obj); | ||
1041 | } catch (e) { | ||
1042 | // IE < 9 does not support Array#slice on collections objects | ||
1043 | } | ||
1044 | } | ||
1045 | |||
1046 | // Fall back to copying key by key. This assumes all keys have a value, | ||
1047 | // so will not preserve sparsely populated inputs. | ||
1048 | var ret = Array(length); | ||
1049 | for (var ii = 0; ii < length; ii++) { | ||
1050 | ret[ii] = obj[ii]; | ||
1051 | } | ||
1052 | return ret; | ||
1053 | } | ||
1054 | |||
1055 | module.exports = toArray; | ||
1056 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
1057 | |||
1058 | /***/ }, | ||
1059 | /* 15 */ | ||
1060 | /***/ function(module, exports, __webpack_require__) { | ||
1061 | |||
1062 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
1063 | * Copyright 2013-2015, Facebook, Inc. | ||
1064 | * All rights reserved. | ||
1065 | * | ||
1066 | * This source code is licensed under the BSD-style license found in the | ||
1067 | * LICENSE file in the root directory of this source tree. An additional grant | ||
1068 | * of patent rights can be found in the PATENTS file in the same directory. | ||
1069 | * | ||
1070 | * @providesModule invariant | ||
1071 | */ | ||
1072 | |||
1073 | 'use strict'; | ||
1074 | |||
1075 | /** | ||
1076 | * Use invariant() to assert state which your program assumes to be true. | ||
1077 | * | ||
1078 | * Provide sprintf-style format (only %s is supported) and arguments | ||
1079 | * to provide information about what broke and what you were | ||
1080 | * expecting. | ||
1081 | * | ||
1082 | * The invariant message will be stripped in production, but the invariant | ||
1083 | * will remain to ensure logic does not differ in production. | ||
1084 | */ | ||
1085 | |||
1086 | var invariant = function (condition, format, a, b, c, d, e, f) { | ||
1087 | if (process.env.NODE_ENV !== 'production') { | ||
1088 | if (format === undefined) { | ||
1089 | throw new Error('invariant requires an error message argument'); | ||
1090 | } | ||
1091 | } | ||
1092 | |||
1093 | if (!condition) { | ||
1094 | var error; | ||
1095 | if (format === undefined) { | ||
1096 | error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.'); | ||
1097 | } else { | ||
1098 | var args = [a, b, c, d, e, f]; | ||
1099 | var argIndex = 0; | ||
1100 | error = new Error('Invariant Violation: ' + format.replace(/%s/g, function () { | ||
1101 | return args[argIndex++]; | ||
1102 | })); | ||
1103 | } | ||
1104 | |||
1105 | error.framesToPop = 1; // we don't care about invariant's own frame | ||
1106 | throw error; | ||
1107 | } | ||
1108 | }; | ||
1109 | |||
1110 | module.exports = invariant; | ||
1111 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
1112 | |||
1113 | /***/ }, | ||
1114 | /* 16 */ | ||
1115 | /***/ function(module, exports, __webpack_require__) { | ||
1116 | |||
1117 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
1118 | * Copyright 2013-2015, Facebook, Inc. | ||
1119 | * All rights reserved. | ||
1120 | * | ||
1121 | * This source code is licensed under the BSD-style license found in the | ||
1122 | * LICENSE file in the root directory of this source tree. An additional grant | ||
1123 | * of patent rights can be found in the PATENTS file in the same directory. | ||
1124 | * | ||
1125 | * @providesModule getMarkupWrap | ||
1126 | */ | ||
1127 | |||
1128 | /*eslint-disable fb-www/unsafe-html */ | ||
1129 | |||
1130 | 'use strict'; | ||
1131 | |||
1132 | var ExecutionEnvironment = __webpack_require__(11); | ||
1133 | |||
1134 | var invariant = __webpack_require__(15); | ||
1135 | |||
1136 | /** | ||
1137 | * Dummy container used to detect which wraps are necessary. | ||
1138 | */ | ||
1139 | var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null; | ||
1140 | |||
1141 | /** | ||
1142 | * Some browsers cannot use `innerHTML` to render certain elements standalone, | ||
1143 | * so we wrap them, render the wrapped nodes, then extract the desired node. | ||
1144 | * | ||
1145 | * In IE8, certain elements cannot render alone, so wrap all elements ('*'). | ||
1146 | */ | ||
1147 | |||
1148 | var shouldWrap = {}; | ||
1149 | |||
1150 | var selectWrap = [1, '<select multiple="true">', '</select>']; | ||
1151 | var tableWrap = [1, '<table>', '</table>']; | ||
1152 | var trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>']; | ||
1153 | |||
1154 | var svgWrap = [1, '<svg xmlns="http://www.w3.org/2000/svg">', '</svg>']; | ||
1155 | |||
1156 | var markupWrap = { | ||
1157 | '*': [1, '?<div>', '</div>'], | ||
1158 | |||
1159 | 'area': [1, '<map>', '</map>'], | ||
1160 | 'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'], | ||
1161 | 'legend': [1, '<fieldset>', '</fieldset>'], | ||
1162 | 'param': [1, '<object>', '</object>'], | ||
1163 | 'tr': [2, '<table><tbody>', '</tbody></table>'], | ||
1164 | |||
1165 | 'optgroup': selectWrap, | ||
1166 | 'option': selectWrap, | ||
1167 | |||
1168 | 'caption': tableWrap, | ||
1169 | 'colgroup': tableWrap, | ||
1170 | 'tbody': tableWrap, | ||
1171 | 'tfoot': tableWrap, | ||
1172 | 'thead': tableWrap, | ||
1173 | |||
1174 | 'td': trWrap, | ||
1175 | 'th': trWrap | ||
1176 | }; | ||
1177 | |||
1178 | // Initialize the SVG elements since we know they'll always need to be wrapped | ||
1179 | // consistently. If they are created inside a <div> they will be initialized in | ||
1180 | // the wrong namespace (and will not display). | ||
1181 | var svgElements = ['circle', 'clipPath', 'defs', 'ellipse', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'text', 'tspan']; | ||
1182 | svgElements.forEach(function (nodeName) { | ||
1183 | markupWrap[nodeName] = svgWrap; | ||
1184 | shouldWrap[nodeName] = true; | ||
1185 | }); | ||
1186 | |||
1187 | /** | ||
1188 | * Gets the markup wrap configuration for the supplied `nodeName`. | ||
1189 | * | ||
1190 | * NOTE: This lazily detects which wraps are necessary for the current browser. | ||
1191 | * | ||
1192 | * @param {string} nodeName Lowercase `nodeName`. | ||
1193 | * @return {?array} Markup wrap configuration, if applicable. | ||
1194 | */ | ||
1195 | function getMarkupWrap(nodeName) { | ||
1196 | !!!dummyNode ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Markup wrapping node not initialized') : invariant(false) : undefined; | ||
1197 | if (!markupWrap.hasOwnProperty(nodeName)) { | ||
1198 | nodeName = '*'; | ||
1199 | } | ||
1200 | if (!shouldWrap.hasOwnProperty(nodeName)) { | ||
1201 | if (nodeName === '*') { | ||
1202 | dummyNode.innerHTML = '<link />'; | ||
1203 | } else { | ||
1204 | dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>'; | ||
1205 | } | ||
1206 | shouldWrap[nodeName] = !dummyNode.firstChild; | ||
1207 | } | ||
1208 | return shouldWrap[nodeName] ? markupWrap[nodeName] : null; | ||
1209 | } | ||
1210 | |||
1211 | module.exports = getMarkupWrap; | ||
1212 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
1213 | |||
1214 | /***/ }, | ||
1215 | /* 17 */ | ||
1216 | /***/ function(module, exports) { | ||
1217 | |||
1218 | /** | ||
1219 | * Copyright 2013-2015, Facebook, Inc. | ||
1220 | * All rights reserved. | ||
1221 | * | ||
1222 | * This source code is licensed under the BSD-style license found in the | ||
1223 | * LICENSE file in the root directory of this source tree. An additional grant | ||
1224 | * of patent rights can be found in the PATENTS file in the same directory. | ||
1225 | * | ||
1226 | * @providesModule emptyFunction | ||
1227 | */ | ||
1228 | |||
1229 | "use strict"; | ||
1230 | |||
1231 | function makeEmptyFunction(arg) { | ||
1232 | return function () { | ||
1233 | return arg; | ||
1234 | }; | ||
1235 | } | ||
1236 | |||
1237 | /** | ||
1238 | * This function accepts and discards inputs; it has no side effects. This is | ||
1239 | * primarily useful idiomatically for overridable function endpoints which | ||
1240 | * always need to be callable, since JS lacks a null-call idiom ala Cocoa. | ||
1241 | */ | ||
1242 | function emptyFunction() {} | ||
1243 | |||
1244 | emptyFunction.thatReturns = makeEmptyFunction; | ||
1245 | emptyFunction.thatReturnsFalse = makeEmptyFunction(false); | ||
1246 | emptyFunction.thatReturnsTrue = makeEmptyFunction(true); | ||
1247 | emptyFunction.thatReturnsNull = makeEmptyFunction(null); | ||
1248 | emptyFunction.thatReturnsThis = function () { | ||
1249 | return this; | ||
1250 | }; | ||
1251 | emptyFunction.thatReturnsArgument = function (arg) { | ||
1252 | return arg; | ||
1253 | }; | ||
1254 | |||
1255 | module.exports = emptyFunction; | ||
1256 | |||
1257 | /***/ }, | ||
1258 | /* 18 */ | ||
1259 | /***/ function(module, exports, __webpack_require__) { | ||
1260 | |||
1261 | /** | ||
1262 | * Copyright 2013-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 | * @providesModule ReactMultiChildUpdateTypes | ||
1270 | */ | ||
1271 | |||
1272 | 'use strict'; | ||
1273 | |||
1274 | var keyMirror = __webpack_require__(19); | ||
1275 | |||
1276 | /** | ||
1277 | * When a component's children are updated, a series of update configuration | ||
1278 | * objects are created in order to batch and serialize the required changes. | ||
1279 | * | ||
1280 | * Enumerates all the possible types of update configurations. | ||
1281 | * | ||
1282 | * @internal | ||
1283 | */ | ||
1284 | var ReactMultiChildUpdateTypes = keyMirror({ | ||
1285 | INSERT_MARKUP: null, | ||
1286 | MOVE_EXISTING: null, | ||
1287 | REMOVE_NODE: null, | ||
1288 | SET_MARKUP: null, | ||
1289 | TEXT_CONTENT: null | ||
1290 | }); | ||
1291 | |||
1292 | module.exports = ReactMultiChildUpdateTypes; | ||
1293 | |||
1294 | /***/ }, | ||
1295 | /* 19 */ | ||
1296 | /***/ function(module, exports, __webpack_require__) { | ||
1297 | |||
1298 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
1299 | * Copyright 2013-2015, Facebook, Inc. | ||
1300 | * All rights reserved. | ||
1301 | * | ||
1302 | * This source code is licensed under the BSD-style license found in the | ||
1303 | * LICENSE file in the root directory of this source tree. An additional grant | ||
1304 | * of patent rights can be found in the PATENTS file in the same directory. | ||
1305 | * | ||
1306 | * @providesModule keyMirror | ||
1307 | * @typechecks static-only | ||
1308 | */ | ||
1309 | |||
1310 | 'use strict'; | ||
1311 | |||
1312 | var invariant = __webpack_require__(15); | ||
1313 | |||
1314 | /** | ||
1315 | * Constructs an enumeration with keys equal to their value. | ||
1316 | * | ||
1317 | * For example: | ||
1318 | * | ||
1319 | * var COLORS = keyMirror({blue: null, red: null}); | ||
1320 | * var myColor = COLORS.blue; | ||
1321 | * var isColorValid = !!COLORS[myColor]; | ||
1322 | * | ||
1323 | * The last line could not be performed if the values of the generated enum were | ||
1324 | * not equal to their keys. | ||
1325 | * | ||
1326 | * Input: {key1: val1, key2: val2} | ||
1327 | * Output: {key1: key1, key2: key2} | ||
1328 | * | ||
1329 | * @param {object} obj | ||
1330 | * @return {object} | ||
1331 | */ | ||
1332 | var keyMirror = function (obj) { | ||
1333 | var ret = {}; | ||
1334 | var key; | ||
1335 | !(obj instanceof Object && !Array.isArray(obj)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'keyMirror(...): Argument must be an object.') : invariant(false) : undefined; | ||
1336 | for (key in obj) { | ||
1337 | if (!obj.hasOwnProperty(key)) { | ||
1338 | continue; | ||
1339 | } | ||
1340 | ret[key] = key; | ||
1341 | } | ||
1342 | return ret; | ||
1343 | }; | ||
1344 | |||
1345 | module.exports = keyMirror; | ||
1346 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
1347 | |||
1348 | /***/ }, | ||
1349 | /* 20 */ | ||
1350 | /***/ function(module, exports, __webpack_require__) { | ||
1351 | |||
1352 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
1353 | * Copyright 2013-2015, Facebook, Inc. | ||
1354 | * All rights reserved. | ||
1355 | * | ||
1356 | * This source code is licensed under the BSD-style license found in the | ||
1357 | * LICENSE file in the root directory of this source tree. An additional grant | ||
1358 | * of patent rights can be found in the PATENTS file in the same directory. | ||
1359 | * | ||
1360 | * @providesModule ReactPerf | ||
1361 | * @typechecks static-only | ||
1362 | */ | ||
1363 | |||
1364 | 'use strict'; | ||
1365 | |||
1366 | /** | ||
1367 | * ReactPerf is a general AOP system designed to measure performance. This | ||
1368 | * module only has the hooks: see ReactDefaultPerf for the analysis tool. | ||
1369 | */ | ||
1370 | var ReactPerf = { | ||
1371 | /** | ||
1372 | * Boolean to enable/disable measurement. Set to false by default to prevent | ||
1373 | * accidental logging and perf loss. | ||
1374 | */ | ||
1375 | enableMeasure: false, | ||
1376 | |||
1377 | /** | ||
1378 | * Holds onto the measure function in use. By default, don't measure | ||
1379 | * anything, but we'll override this if we inject a measure function. | ||
1380 | */ | ||
1381 | storedMeasure: _noMeasure, | ||
1382 | |||
1383 | /** | ||
1384 | * @param {object} object | ||
1385 | * @param {string} objectName | ||
1386 | * @param {object<string>} methodNames | ||
1387 | */ | ||
1388 | measureMethods: function (object, objectName, methodNames) { | ||
1389 | if (process.env.NODE_ENV !== 'production') { | ||
1390 | for (var key in methodNames) { | ||
1391 | if (!methodNames.hasOwnProperty(key)) { | ||
1392 | continue; | ||
1393 | } | ||
1394 | object[key] = ReactPerf.measure(objectName, methodNames[key], object[key]); | ||
1395 | } | ||
1396 | } | ||
1397 | }, | ||
1398 | |||
1399 | /** | ||
1400 | * Use this to wrap methods you want to measure. Zero overhead in production. | ||
1401 | * | ||
1402 | * @param {string} objName | ||
1403 | * @param {string} fnName | ||
1404 | * @param {function} func | ||
1405 | * @return {function} | ||
1406 | */ | ||
1407 | measure: function (objName, fnName, func) { | ||
1408 | if (process.env.NODE_ENV !== 'production') { | ||
1409 | var measuredFunc = null; | ||
1410 | var wrapper = function () { | ||
1411 | if (ReactPerf.enableMeasure) { | ||
1412 | if (!measuredFunc) { | ||
1413 | measuredFunc = ReactPerf.storedMeasure(objName, fnName, func); | ||
1414 | } | ||
1415 | return measuredFunc.apply(this, arguments); | ||
1416 | } | ||
1417 | return func.apply(this, arguments); | ||
1418 | }; | ||
1419 | wrapper.displayName = objName + '_' + fnName; | ||
1420 | return wrapper; | ||
1421 | } | ||
1422 | return func; | ||
1423 | }, | ||
1424 | |||
1425 | injection: { | ||
1426 | /** | ||
1427 | * @param {function} measure | ||
1428 | */ | ||
1429 | injectMeasure: function (measure) { | ||
1430 | ReactPerf.storedMeasure = measure; | ||
1431 | } | ||
1432 | } | ||
1433 | }; | ||
1434 | |||
1435 | /** | ||
1436 | * Simply passes through the measured function, without measuring it. | ||
1437 | * | ||
1438 | * @param {string} objName | ||
1439 | * @param {string} fnName | ||
1440 | * @param {function} func | ||
1441 | * @return {function} | ||
1442 | */ | ||
1443 | function _noMeasure(objName, fnName, func) { | ||
1444 | return func; | ||
1445 | } | ||
1446 | |||
1447 | module.exports = ReactPerf; | ||
1448 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
1449 | |||
1450 | /***/ }, | ||
1451 | /* 21 */ | ||
1452 | /***/ function(module, exports, __webpack_require__) { | ||
1453 | |||
1454 | /** | ||
1455 | * Copyright 2013-2015, Facebook, Inc. | ||
1456 | * All rights reserved. | ||
1457 | * | ||
1458 | * This source code is licensed under the BSD-style license found in the | ||
1459 | * LICENSE file in the root directory of this source tree. An additional grant | ||
1460 | * of patent rights can be found in the PATENTS file in the same directory. | ||
1461 | * | ||
1462 | * @providesModule setInnerHTML | ||
1463 | */ | ||
1464 | |||
1465 | /* globals MSApp */ | ||
1466 | |||
1467 | 'use strict'; | ||
1468 | |||
1469 | var ExecutionEnvironment = __webpack_require__(11); | ||
1470 | |||
1471 | var WHITESPACE_TEST = /^[ \r\n\t\f]/; | ||
1472 | var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/; | ||
1473 | |||
1474 | /** | ||
1475 | * Set the innerHTML property of a node, ensuring that whitespace is preserved | ||
1476 | * even in IE8. | ||
1477 | * | ||
1478 | * @param {DOMElement} node | ||
1479 | * @param {string} html | ||
1480 | * @internal | ||
1481 | */ | ||
1482 | var setInnerHTML = function (node, html) { | ||
1483 | node.innerHTML = html; | ||
1484 | }; | ||
1485 | |||
1486 | // Win8 apps: Allow all html to be inserted | ||
1487 | if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) { | ||
1488 | setInnerHTML = function (node, html) { | ||
1489 | MSApp.execUnsafeLocalFunction(function () { | ||
1490 | node.innerHTML = html; | ||
1491 | }); | ||
1492 | }; | ||
1493 | } | ||
1494 | |||
1495 | if (ExecutionEnvironment.canUseDOM) { | ||
1496 | // IE8: When updating a just created node with innerHTML only leading | ||
1497 | // whitespace is removed. When updating an existing node with innerHTML | ||
1498 | // whitespace in root TextNodes is also collapsed. | ||
1499 | // @see quirksmode.org/bugreports/archives/2004/11/innerhtml_and_t.html | ||
1500 | |||
1501 | // Feature detection; only IE8 is known to behave improperly like this. | ||
1502 | var testElement = document.createElement('div'); | ||
1503 | testElement.innerHTML = ' '; | ||
1504 | if (testElement.innerHTML === '') { | ||
1505 | setInnerHTML = function (node, html) { | ||
1506 | // Magic theory: IE8 supposedly differentiates between added and updated | ||
1507 | // nodes when processing innerHTML, innerHTML on updated nodes suffers | ||
1508 | // from worse whitespace behavior. Re-adding a node like this triggers | ||
1509 | // the initial and more favorable whitespace behavior. | ||
1510 | // TODO: What to do on a detached node? | ||
1511 | if (node.parentNode) { | ||
1512 | node.parentNode.replaceChild(node, node); | ||
1513 | } | ||
1514 | |||
1515 | // We also implement a workaround for non-visible tags disappearing into | ||
1516 | // thin air on IE8, this only happens if there is no visible text | ||
1517 | // in-front of the non-visible tags. Piggyback on the whitespace fix | ||
1518 | // and simply check if any non-visible tags appear in the source. | ||
1519 | if (WHITESPACE_TEST.test(html) || html[0] === '<' && NONVISIBLE_TEST.test(html)) { | ||
1520 | // Recover leading whitespace by temporarily prepending any character. | ||
1521 | // \uFEFF has the potential advantage of being zero-width/invisible. | ||
1522 | // UglifyJS drops U+FEFF chars when parsing, so use String.fromCharCode | ||
1523 | // in hopes that this is preserved even if "\uFEFF" is transformed to | ||
1524 | // the actual Unicode character (by Babel, for example). | ||
1525 | // https://github.com/mishoo/UglifyJS2/blob/v2.4.20/lib/parse.js#L216 | ||
1526 | node.innerHTML = String.fromCharCode(0xFEFF) + html; | ||
1527 | |||
1528 | // deleteData leaves an empty `TextNode` which offsets the index of all | ||
1529 | // children. Definitely want to avoid this. | ||
1530 | var textNode = node.firstChild; | ||
1531 | if (textNode.data.length === 1) { | ||
1532 | node.removeChild(textNode); | ||
1533 | } else { | ||
1534 | textNode.deleteData(0, 1); | ||
1535 | } | ||
1536 | } else { | ||
1537 | node.innerHTML = html; | ||
1538 | } | ||
1539 | }; | ||
1540 | } | ||
1541 | } | ||
1542 | |||
1543 | module.exports = setInnerHTML; | ||
1544 | |||
1545 | /***/ }, | ||
1546 | /* 22 */ | ||
1547 | /***/ function(module, exports, __webpack_require__) { | ||
1548 | |||
1549 | /** | ||
1550 | * Copyright 2013-2015, Facebook, Inc. | ||
1551 | * All rights reserved. | ||
1552 | * | ||
1553 | * This source code is licensed under the BSD-style license found in the | ||
1554 | * LICENSE file in the root directory of this source tree. An additional grant | ||
1555 | * of patent rights can be found in the PATENTS file in the same directory. | ||
1556 | * | ||
1557 | * @providesModule setTextContent | ||
1558 | */ | ||
1559 | |||
1560 | 'use strict'; | ||
1561 | |||
1562 | var ExecutionEnvironment = __webpack_require__(11); | ||
1563 | var escapeTextContentForBrowser = __webpack_require__(23); | ||
1564 | var setInnerHTML = __webpack_require__(21); | ||
1565 | |||
1566 | /** | ||
1567 | * Set the textContent property of a node, ensuring that whitespace is preserved | ||
1568 | * even in IE8. innerText is a poor substitute for textContent and, among many | ||
1569 | * issues, inserts <br> instead of the literal newline chars. innerHTML behaves | ||
1570 | * as it should. | ||
1571 | * | ||
1572 | * @param {DOMElement} node | ||
1573 | * @param {string} text | ||
1574 | * @internal | ||
1575 | */ | ||
1576 | var setTextContent = function (node, text) { | ||
1577 | node.textContent = text; | ||
1578 | }; | ||
1579 | |||
1580 | if (ExecutionEnvironment.canUseDOM) { | ||
1581 | if (!('textContent' in document.documentElement)) { | ||
1582 | setTextContent = function (node, text) { | ||
1583 | setInnerHTML(node, escapeTextContentForBrowser(text)); | ||
1584 | }; | ||
1585 | } | ||
1586 | } | ||
1587 | |||
1588 | module.exports = setTextContent; | ||
1589 | |||
1590 | /***/ }, | ||
1591 | /* 23 */ | ||
1592 | /***/ function(module, exports) { | ||
1593 | |||
1594 | /** | ||
1595 | * Copyright 2013-2015, Facebook, Inc. | ||
1596 | * All rights reserved. | ||
1597 | * | ||
1598 | * This source code is licensed under the BSD-style license found in the | ||
1599 | * LICENSE file in the root directory of this source tree. An additional grant | ||
1600 | * of patent rights can be found in the PATENTS file in the same directory. | ||
1601 | * | ||
1602 | * @providesModule escapeTextContentForBrowser | ||
1603 | */ | ||
1604 | |||
1605 | 'use strict'; | ||
1606 | |||
1607 | var ESCAPE_LOOKUP = { | ||
1608 | '&': '&', | ||
1609 | '>': '>', | ||
1610 | '<': '<', | ||
1611 | '"': '"', | ||
1612 | '\'': ''' | ||
1613 | }; | ||
1614 | |||
1615 | var ESCAPE_REGEX = /[&><"']/g; | ||
1616 | |||
1617 | function escaper(match) { | ||
1618 | return ESCAPE_LOOKUP[match]; | ||
1619 | } | ||
1620 | |||
1621 | /** | ||
1622 | * Escapes text to prevent scripting attacks. | ||
1623 | * | ||
1624 | * @param {*} text Text value to escape. | ||
1625 | * @return {string} An escaped string. | ||
1626 | */ | ||
1627 | function escapeTextContentForBrowser(text) { | ||
1628 | return ('' + text).replace(ESCAPE_REGEX, escaper); | ||
1629 | } | ||
1630 | |||
1631 | module.exports = escapeTextContentForBrowser; | ||
1632 | |||
1633 | /***/ }, | ||
1634 | /* 24 */ | ||
1635 | /***/ function(module, exports, __webpack_require__) { | ||
1636 | |||
1637 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
1638 | * Copyright 2013-2015, Facebook, Inc. | ||
1639 | * All rights reserved. | ||
1640 | * | ||
1641 | * This source code is licensed under the BSD-style license found in the | ||
1642 | * LICENSE file in the root directory of this source tree. An additional grant | ||
1643 | * of patent rights can be found in the PATENTS file in the same directory. | ||
1644 | * | ||
1645 | * @providesModule DOMPropertyOperations | ||
1646 | * @typechecks static-only | ||
1647 | */ | ||
1648 | |||
1649 | 'use strict'; | ||
1650 | |||
1651 | var DOMProperty = __webpack_require__(25); | ||
1652 | var ReactPerf = __webpack_require__(20); | ||
1653 | |||
1654 | var quoteAttributeValueForBrowser = __webpack_require__(26); | ||
1655 | var warning = __webpack_require__(27); | ||
1656 | |||
1657 | // Simplified subset | ||
1658 | var VALID_ATTRIBUTE_NAME_REGEX = /^[a-zA-Z_][\w\.\-]*$/; | ||
1659 | var illegalAttributeNameCache = {}; | ||
1660 | var validatedAttributeNameCache = {}; | ||
1661 | |||
1662 | function isAttributeNameSafe(attributeName) { | ||
1663 | if (validatedAttributeNameCache.hasOwnProperty(attributeName)) { | ||
1664 | return true; | ||
1665 | } | ||
1666 | if (illegalAttributeNameCache.hasOwnProperty(attributeName)) { | ||
1667 | return false; | ||
1668 | } | ||
1669 | if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) { | ||
1670 | validatedAttributeNameCache[attributeName] = true; | ||
1671 | return true; | ||
1672 | } | ||
1673 | illegalAttributeNameCache[attributeName] = true; | ||
1674 | process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid attribute name: `%s`', attributeName) : undefined; | ||
1675 | return false; | ||
1676 | } | ||
1677 | |||
1678 | function shouldIgnoreValue(propertyInfo, value) { | ||
1679 | return value == null || propertyInfo.hasBooleanValue && !value || propertyInfo.hasNumericValue && isNaN(value) || propertyInfo.hasPositiveNumericValue && value < 1 || propertyInfo.hasOverloadedBooleanValue && value === false; | ||
1680 | } | ||
1681 | |||
1682 | if (process.env.NODE_ENV !== 'production') { | ||
1683 | var reactProps = { | ||
1684 | children: true, | ||
1685 | dangerouslySetInnerHTML: true, | ||
1686 | key: true, | ||
1687 | ref: true | ||
1688 | }; | ||
1689 | var warnedProperties = {}; | ||
1690 | |||
1691 | var warnUnknownProperty = function (name) { | ||
1692 | if (reactProps.hasOwnProperty(name) && reactProps[name] || warnedProperties.hasOwnProperty(name) && warnedProperties[name]) { | ||
1693 | return; | ||
1694 | } | ||
1695 | |||
1696 | warnedProperties[name] = true; | ||
1697 | var lowerCasedName = name.toLowerCase(); | ||
1698 | |||
1699 | // data-* attributes should be lowercase; suggest the lowercase version | ||
1700 | var standardName = DOMProperty.isCustomAttribute(lowerCasedName) ? lowerCasedName : DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ? DOMProperty.getPossibleStandardName[lowerCasedName] : null; | ||
1701 | |||
1702 | // For now, only warn when we have a suggested correction. This prevents | ||
1703 | // logging too much when using transferPropsTo. | ||
1704 | process.env.NODE_ENV !== 'production' ? warning(standardName == null, 'Unknown DOM property %s. Did you mean %s?', name, standardName) : undefined; | ||
1705 | }; | ||
1706 | } | ||
1707 | |||
1708 | /** | ||
1709 | * Operations for dealing with DOM properties. | ||
1710 | */ | ||
1711 | var DOMPropertyOperations = { | ||
1712 | |||
1713 | /** | ||
1714 | * Creates markup for the ID property. | ||
1715 | * | ||
1716 | * @param {string} id Unescaped ID. | ||
1717 | * @return {string} Markup string. | ||
1718 | */ | ||
1719 | createMarkupForID: function (id) { | ||
1720 | return DOMProperty.ID_ATTRIBUTE_NAME + '=' + quoteAttributeValueForBrowser(id); | ||
1721 | }, | ||
1722 | |||
1723 | setAttributeForID: function (node, id) { | ||
1724 | node.setAttribute(DOMProperty.ID_ATTRIBUTE_NAME, id); | ||
1725 | }, | ||
1726 | |||
1727 | /** | ||
1728 | * Creates markup for a property. | ||
1729 | * | ||
1730 | * @param {string} name | ||
1731 | * @param {*} value | ||
1732 | * @return {?string} Markup string, or null if the property was invalid. | ||
1733 | */ | ||
1734 | createMarkupForProperty: function (name, value) { | ||
1735 | var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null; | ||
1736 | if (propertyInfo) { | ||
1737 | if (shouldIgnoreValue(propertyInfo, value)) { | ||
1738 | return ''; | ||
1739 | } | ||
1740 | var attributeName = propertyInfo.attributeName; | ||
1741 | if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) { | ||
1742 | return attributeName + '=""'; | ||
1743 | } | ||
1744 | return attributeName + '=' + quoteAttributeValueForBrowser(value); | ||
1745 | } else if (DOMProperty.isCustomAttribute(name)) { | ||
1746 | if (value == null) { | ||
1747 | return ''; | ||
1748 | } | ||
1749 | return name + '=' + quoteAttributeValueForBrowser(value); | ||
1750 | } else if (process.env.NODE_ENV !== 'production') { | ||
1751 | warnUnknownProperty(name); | ||
1752 | } | ||
1753 | return null; | ||
1754 | }, | ||
1755 | |||
1756 | /** | ||
1757 | * Creates markup for a custom property. | ||
1758 | * | ||
1759 | * @param {string} name | ||
1760 | * @param {*} value | ||
1761 | * @return {string} Markup string, or empty string if the property was invalid. | ||
1762 | */ | ||
1763 | createMarkupForCustomAttribute: function (name, value) { | ||
1764 | if (!isAttributeNameSafe(name) || value == null) { | ||
1765 | return ''; | ||
1766 | } | ||
1767 | return name + '=' + quoteAttributeValueForBrowser(value); | ||
1768 | }, | ||
1769 | |||
1770 | /** | ||
1771 | * Sets the value for a property on a node. | ||
1772 | * | ||
1773 | * @param {DOMElement} node | ||
1774 | * @param {string} name | ||
1775 | * @param {*} value | ||
1776 | */ | ||
1777 | setValueForProperty: function (node, name, value) { | ||
1778 | var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null; | ||
1779 | if (propertyInfo) { | ||
1780 | var mutationMethod = propertyInfo.mutationMethod; | ||
1781 | if (mutationMethod) { | ||
1782 | mutationMethod(node, value); | ||
1783 | } else if (shouldIgnoreValue(propertyInfo, value)) { | ||
1784 | this.deleteValueForProperty(node, name); | ||
1785 | } else if (propertyInfo.mustUseAttribute) { | ||
1786 | var attributeName = propertyInfo.attributeName; | ||
1787 | var namespace = propertyInfo.attributeNamespace; | ||
1788 | // `setAttribute` with objects becomes only `[object]` in IE8/9, | ||
1789 | // ('' + value) makes it output the correct toString()-value. | ||
1790 | if (namespace) { | ||
1791 | node.setAttributeNS(namespace, attributeName, '' + value); | ||
1792 | } else if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) { | ||
1793 | node.setAttribute(attributeName, ''); | ||
1794 | } else { | ||
1795 | node.setAttribute(attributeName, '' + value); | ||
1796 | } | ||
1797 | } else { | ||
1798 | var propName = propertyInfo.propertyName; | ||
1799 | // Must explicitly cast values for HAS_SIDE_EFFECTS-properties to the | ||
1800 | // property type before comparing; only `value` does and is string. | ||
1801 | if (!propertyInfo.hasSideEffects || '' + node[propName] !== '' + value) { | ||
1802 | // Contrary to `setAttribute`, object properties are properly | ||
1803 | // `toString`ed by IE8/9. | ||
1804 | node[propName] = value; | ||
1805 | } | ||
1806 | } | ||
1807 | } else if (DOMProperty.isCustomAttribute(name)) { | ||
1808 | DOMPropertyOperations.setValueForAttribute(node, name, value); | ||
1809 | } else if (process.env.NODE_ENV !== 'production') { | ||
1810 | warnUnknownProperty(name); | ||
1811 | } | ||
1812 | }, | ||
1813 | |||
1814 | setValueForAttribute: function (node, name, value) { | ||
1815 | if (!isAttributeNameSafe(name)) { | ||
1816 | return; | ||
1817 | } | ||
1818 | if (value == null) { | ||
1819 | node.removeAttribute(name); | ||
1820 | } else { | ||
1821 | node.setAttribute(name, '' + value); | ||
1822 | } | ||
1823 | }, | ||
1824 | |||
1825 | /** | ||
1826 | * Deletes the value for a property on a node. | ||
1827 | * | ||
1828 | * @param {DOMElement} node | ||
1829 | * @param {string} name | ||
1830 | */ | ||
1831 | deleteValueForProperty: function (node, name) { | ||
1832 | var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null; | ||
1833 | if (propertyInfo) { | ||
1834 | var mutationMethod = propertyInfo.mutationMethod; | ||
1835 | if (mutationMethod) { | ||
1836 | mutationMethod(node, undefined); | ||
1837 | } else if (propertyInfo.mustUseAttribute) { | ||
1838 | node.removeAttribute(propertyInfo.attributeName); | ||
1839 | } else { | ||
1840 | var propName = propertyInfo.propertyName; | ||
1841 | var defaultValue = DOMProperty.getDefaultValueForProperty(node.nodeName, propName); | ||
1842 | if (!propertyInfo.hasSideEffects || '' + node[propName] !== defaultValue) { | ||
1843 | node[propName] = defaultValue; | ||
1844 | } | ||
1845 | } | ||
1846 | } else if (DOMProperty.isCustomAttribute(name)) { | ||
1847 | node.removeAttribute(name); | ||
1848 | } else if (process.env.NODE_ENV !== 'production') { | ||
1849 | warnUnknownProperty(name); | ||
1850 | } | ||
1851 | } | ||
1852 | |||
1853 | }; | ||
1854 | |||
1855 | ReactPerf.measureMethods(DOMPropertyOperations, 'DOMPropertyOperations', { | ||
1856 | setValueForProperty: 'setValueForProperty', | ||
1857 | setValueForAttribute: 'setValueForAttribute', | ||
1858 | deleteValueForProperty: 'deleteValueForProperty' | ||
1859 | }); | ||
1860 | |||
1861 | module.exports = DOMPropertyOperations; | ||
1862 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
1863 | |||
1864 | /***/ }, | ||
1865 | /* 25 */ | ||
1866 | /***/ function(module, exports, __webpack_require__) { | ||
1867 | |||
1868 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
1869 | * Copyright 2013-2015, Facebook, Inc. | ||
1870 | * All rights reserved. | ||
1871 | * | ||
1872 | * This source code is licensed under the BSD-style license found in the | ||
1873 | * LICENSE file in the root directory of this source tree. An additional grant | ||
1874 | * of patent rights can be found in the PATENTS file in the same directory. | ||
1875 | * | ||
1876 | * @providesModule DOMProperty | ||
1877 | * @typechecks static-only | ||
1878 | */ | ||
1879 | |||
1880 | 'use strict'; | ||
1881 | |||
1882 | var invariant = __webpack_require__(15); | ||
1883 | |||
1884 | function checkMask(value, bitmask) { | ||
1885 | return (value & bitmask) === bitmask; | ||
1886 | } | ||
1887 | |||
1888 | var DOMPropertyInjection = { | ||
1889 | /** | ||
1890 | * Mapping from normalized, camelcased property names to a configuration that | ||
1891 | * specifies how the associated DOM property should be accessed or rendered. | ||
1892 | */ | ||
1893 | MUST_USE_ATTRIBUTE: 0x1, | ||
1894 | MUST_USE_PROPERTY: 0x2, | ||
1895 | HAS_SIDE_EFFECTS: 0x4, | ||
1896 | HAS_BOOLEAN_VALUE: 0x8, | ||
1897 | HAS_NUMERIC_VALUE: 0x10, | ||
1898 | HAS_POSITIVE_NUMERIC_VALUE: 0x20 | 0x10, | ||
1899 | HAS_OVERLOADED_BOOLEAN_VALUE: 0x40, | ||
1900 | |||
1901 | /** | ||
1902 | * Inject some specialized knowledge about the DOM. This takes a config object | ||
1903 | * with the following properties: | ||
1904 | * | ||
1905 | * isCustomAttribute: function that given an attribute name will return true | ||
1906 | * if it can be inserted into the DOM verbatim. Useful for data-* or aria-* | ||
1907 | * attributes where it's impossible to enumerate all of the possible | ||
1908 | * attribute names, | ||
1909 | * | ||
1910 | * Properties: object mapping DOM property name to one of the | ||
1911 | * DOMPropertyInjection constants or null. If your attribute isn't in here, | ||
1912 | * it won't get written to the DOM. | ||
1913 | * | ||
1914 | * DOMAttributeNames: object mapping React attribute name to the DOM | ||
1915 | * attribute name. Attribute names not specified use the **lowercase** | ||
1916 | * normalized name. | ||
1917 | * | ||
1918 | * DOMAttributeNamespaces: object mapping React attribute name to the DOM | ||
1919 | * attribute namespace URL. (Attribute names not specified use no namespace.) | ||
1920 | * | ||
1921 | * DOMPropertyNames: similar to DOMAttributeNames but for DOM properties. | ||
1922 | * Property names not specified use the normalized name. | ||
1923 | * | ||
1924 | * DOMMutationMethods: Properties that require special mutation methods. If | ||
1925 | * `value` is undefined, the mutation method should unset the property. | ||
1926 | * | ||
1927 | * @param {object} domPropertyConfig the config as described above. | ||
1928 | */ | ||
1929 | injectDOMPropertyConfig: function (domPropertyConfig) { | ||
1930 | var Injection = DOMPropertyInjection; | ||
1931 | var Properties = domPropertyConfig.Properties || {}; | ||
1932 | var DOMAttributeNamespaces = domPropertyConfig.DOMAttributeNamespaces || {}; | ||
1933 | var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {}; | ||
1934 | var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {}; | ||
1935 | var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {}; | ||
1936 | |||
1937 | if (domPropertyConfig.isCustomAttribute) { | ||
1938 | DOMProperty._isCustomAttributeFunctions.push(domPropertyConfig.isCustomAttribute); | ||
1939 | } | ||
1940 | |||
1941 | for (var propName in Properties) { | ||
1942 | !!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; | ||
1943 | |||
1944 | var lowerCased = propName.toLowerCase(); | ||
1945 | var propConfig = Properties[propName]; | ||
1946 | |||
1947 | var propertyInfo = { | ||
1948 | attributeName: lowerCased, | ||
1949 | attributeNamespace: null, | ||
1950 | propertyName: propName, | ||
1951 | mutationMethod: null, | ||
1952 | |||
1953 | mustUseAttribute: checkMask(propConfig, Injection.MUST_USE_ATTRIBUTE), | ||
1954 | mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY), | ||
1955 | hasSideEffects: checkMask(propConfig, Injection.HAS_SIDE_EFFECTS), | ||
1956 | hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE), | ||
1957 | hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE), | ||
1958 | hasPositiveNumericValue: checkMask(propConfig, Injection.HAS_POSITIVE_NUMERIC_VALUE), | ||
1959 | hasOverloadedBooleanValue: checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE) | ||
1960 | }; | ||
1961 | |||
1962 | !(!propertyInfo.mustUseAttribute || !propertyInfo.mustUseProperty) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'DOMProperty: Cannot require using both attribute and property: %s', propName) : invariant(false) : undefined; | ||
1963 | !(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; | ||
1964 | !(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; | ||
1965 | |||
1966 | if (process.env.NODE_ENV !== 'production') { | ||
1967 | DOMProperty.getPossibleStandardName[lowerCased] = propName; | ||
1968 | } | ||
1969 | |||
1970 | if (DOMAttributeNames.hasOwnProperty(propName)) { | ||
1971 | var attributeName = DOMAttributeNames[propName]; | ||
1972 | propertyInfo.attributeName = attributeName; | ||
1973 | if (process.env.NODE_ENV !== 'production') { | ||
1974 | DOMProperty.getPossibleStandardName[attributeName] = propName; | ||
1975 | } | ||
1976 | } | ||
1977 | |||
1978 | if (DOMAttributeNamespaces.hasOwnProperty(propName)) { | ||
1979 | propertyInfo.attributeNamespace = DOMAttributeNamespaces[propName]; | ||
1980 | } | ||
1981 | |||
1982 | if (DOMPropertyNames.hasOwnProperty(propName)) { | ||
1983 | propertyInfo.propertyName = DOMPropertyNames[propName]; | ||
1984 | } | ||
1985 | |||
1986 | if (DOMMutationMethods.hasOwnProperty(propName)) { | ||
1987 | propertyInfo.mutationMethod = DOMMutationMethods[propName]; | ||
1988 | } | ||
1989 | |||
1990 | DOMProperty.properties[propName] = propertyInfo; | ||
1991 | } | ||
1992 | } | ||
1993 | }; | ||
1994 | var defaultValueCache = {}; | ||
1995 | |||
1996 | /** | ||
1997 | * DOMProperty exports lookup objects that can be used like functions: | ||
1998 | * | ||
1999 | * > DOMProperty.isValid['id'] | ||
2000 | * true | ||
2001 | * > DOMProperty.isValid['foobar'] | ||
2002 | * undefined | ||
2003 | * | ||
2004 | * Although this may be confusing, it performs better in general. | ||
2005 | * | ||
2006 | * @see http://jsperf.com/key-exists | ||
2007 | * @see http://jsperf.com/key-missing | ||
2008 | */ | ||
2009 | var DOMProperty = { | ||
2010 | |||
2011 | ID_ATTRIBUTE_NAME: 'data-reactid', | ||
2012 | |||
2013 | /** | ||
2014 | * Map from property "standard name" to an object with info about how to set | ||
2015 | * the property in the DOM. Each object contains: | ||
2016 | * | ||
2017 | * attributeName: | ||
2018 | * Used when rendering markup or with `*Attribute()`. | ||
2019 | * attributeNamespace | ||
2020 | * propertyName: | ||
2021 | * Used on DOM node instances. (This includes properties that mutate due to | ||
2022 | * external factors.) | ||
2023 | * mutationMethod: | ||
2024 | * If non-null, used instead of the property or `setAttribute()` after | ||
2025 | * initial render. | ||
2026 | * mustUseAttribute: | ||
2027 | * Whether the property must be accessed and mutated using `*Attribute()`. | ||
2028 | * (This includes anything that fails `<propName> in <element>`.) | ||
2029 | * mustUseProperty: | ||
2030 | * Whether the property must be accessed and mutated as an object property. | ||
2031 | * hasSideEffects: | ||
2032 | * Whether or not setting a value causes side effects such as triggering | ||
2033 | * resources to be loaded or text selection changes. If true, we read from | ||
2034 | * the DOM before updating to ensure that the value is only set if it has | ||
2035 | * changed. | ||
2036 | * hasBooleanValue: | ||
2037 | * Whether the property should be removed when set to a falsey value. | ||
2038 | * hasNumericValue: | ||
2039 | * Whether the property must be numeric or parse as a numeric and should be | ||
2040 | * removed when set to a falsey value. | ||
2041 | * hasPositiveNumericValue: | ||
2042 | * Whether the property must be positive numeric or parse as a positive | ||
2043 | * numeric and should be removed when set to a falsey value. | ||
2044 | * hasOverloadedBooleanValue: | ||
2045 | * Whether the property can be used as a flag as well as with a value. | ||
2046 | * Removed when strictly equal to false; present without a value when | ||
2047 | * strictly equal to true; present with a value otherwise. | ||
2048 | */ | ||
2049 | properties: {}, | ||
2050 | |||
2051 | /** | ||
2052 | * Mapping from lowercase property names to the properly cased version, used | ||
2053 | * to warn in the case of missing properties. Available only in __DEV__. | ||
2054 | * @type {Object} | ||
2055 | */ | ||
2056 | getPossibleStandardName: process.env.NODE_ENV !== 'production' ? {} : null, | ||
2057 | |||
2058 | /** | ||
2059 | * All of the isCustomAttribute() functions that have been injected. | ||
2060 | */ | ||
2061 | _isCustomAttributeFunctions: [], | ||
2062 | |||
2063 | /** | ||
2064 | * Checks whether a property name is a custom attribute. | ||
2065 | * @method | ||
2066 | */ | ||
2067 | isCustomAttribute: function (attributeName) { | ||
2068 | for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) { | ||
2069 | var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i]; | ||
2070 | if (isCustomAttributeFn(attributeName)) { | ||
2071 | return true; | ||
2072 | } | ||
2073 | } | ||
2074 | return false; | ||
2075 | }, | ||
2076 | |||
2077 | /** | ||
2078 | * Returns the default property value for a DOM property (i.e., not an | ||
2079 | * attribute). Most default values are '' or false, but not all. Worse yet, | ||
2080 | * some (in particular, `type`) vary depending on the type of element. | ||
2081 | * | ||
2082 | * TODO: Is it better to grab all the possible properties when creating an | ||
2083 | * element to avoid having to create the same element twice? | ||
2084 | */ | ||
2085 | getDefaultValueForProperty: function (nodeName, prop) { | ||
2086 | var nodeDefaults = defaultValueCache[nodeName]; | ||
2087 | var testElement; | ||
2088 | if (!nodeDefaults) { | ||
2089 | defaultValueCache[nodeName] = nodeDefaults = {}; | ||
2090 | } | ||
2091 | if (!(prop in nodeDefaults)) { | ||
2092 | testElement = document.createElement(nodeName); | ||
2093 | nodeDefaults[prop] = testElement[prop]; | ||
2094 | } | ||
2095 | return nodeDefaults[prop]; | ||
2096 | }, | ||
2097 | |||
2098 | injection: DOMPropertyInjection | ||
2099 | }; | ||
2100 | |||
2101 | module.exports = DOMProperty; | ||
2102 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
2103 | |||
2104 | /***/ }, | ||
2105 | /* 26 */ | ||
2106 | /***/ function(module, exports, __webpack_require__) { | ||
2107 | |||
2108 | /** | ||
2109 | * Copyright 2013-2015, Facebook, Inc. | ||
2110 | * All rights reserved. | ||
2111 | * | ||
2112 | * This source code is licensed under the BSD-style license found in the | ||
2113 | * LICENSE file in the root directory of this source tree. An additional grant | ||
2114 | * of patent rights can be found in the PATENTS file in the same directory. | ||
2115 | * | ||
2116 | * @providesModule quoteAttributeValueForBrowser | ||
2117 | */ | ||
2118 | |||
2119 | 'use strict'; | ||
2120 | |||
2121 | var escapeTextContentForBrowser = __webpack_require__(23); | ||
2122 | |||
2123 | /** | ||
2124 | * Escapes attribute value to prevent scripting attacks. | ||
2125 | * | ||
2126 | * @param {*} value Value to escape. | ||
2127 | * @return {string} An escaped string. | ||
2128 | */ | ||
2129 | function quoteAttributeValueForBrowser(value) { | ||
2130 | return '"' + escapeTextContentForBrowser(value) + '"'; | ||
2131 | } | ||
2132 | |||
2133 | module.exports = quoteAttributeValueForBrowser; | ||
2134 | |||
2135 | /***/ }, | ||
2136 | /* 27 */ | ||
2137 | /***/ function(module, exports, __webpack_require__) { | ||
2138 | |||
2139 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
2140 | * Copyright 2014-2015, 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 warning | ||
2148 | */ | ||
2149 | |||
2150 | 'use strict'; | ||
2151 | |||
2152 | var emptyFunction = __webpack_require__(17); | ||
2153 | |||
2154 | /** | ||
2155 | * Similar to invariant but only logs a warning if the condition is not met. | ||
2156 | * This can be used to log issues in development environments in critical | ||
2157 | * paths. Removing the logging code for production environments will keep the | ||
2158 | * same logic and follow the same code paths. | ||
2159 | */ | ||
2160 | |||
2161 | var warning = emptyFunction; | ||
2162 | |||
2163 | if (process.env.NODE_ENV !== 'production') { | ||
2164 | warning = function (condition, format) { | ||
2165 | for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { | ||
2166 | args[_key - 2] = arguments[_key]; | ||
2167 | } | ||
2168 | |||
2169 | if (format === undefined) { | ||
2170 | throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument'); | ||
2171 | } | ||
2172 | |||
2173 | if (format.indexOf('Failed Composite propType: ') === 0) { | ||
2174 | return; // Ignore CompositeComponent proptype check. | ||
2175 | } | ||
2176 | |||
2177 | if (!condition) { | ||
2178 | var argIndex = 0; | ||
2179 | var message = 'Warning: ' + format.replace(/%s/g, function () { | ||
2180 | return args[argIndex++]; | ||
2181 | }); | ||
2182 | if (typeof console !== 'undefined') { | ||
2183 | console.error(message); | ||
2184 | } | ||
2185 | try { | ||
2186 | // --- Welcome to debugging React --- | ||
2187 | // This error was thrown as a convenience so that you can use this stack | ||
2188 | // to find the callsite that caused this warning to fire. | ||
2189 | throw new Error(message); | ||
2190 | } catch (x) {} | ||
2191 | } | ||
2192 | }; | ||
2193 | } | ||
2194 | |||
2195 | module.exports = warning; | ||
2196 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
2197 | |||
2198 | /***/ }, | ||
2199 | /* 28 */ | ||
2200 | /***/ function(module, exports, __webpack_require__) { | ||
2201 | |||
2202 | /** | ||
2203 | * Copyright 2013-2015, Facebook, Inc. | ||
2204 | * All rights reserved. | ||
2205 | * | ||
2206 | * This source code is licensed under the BSD-style license found in the | ||
2207 | * LICENSE file in the root directory of this source tree. An additional grant | ||
2208 | * of patent rights can be found in the PATENTS file in the same directory. | ||
2209 | * | ||
2210 | * @providesModule ReactComponentBrowserEnvironment | ||
2211 | */ | ||
2212 | |||
2213 | 'use strict'; | ||
2214 | |||
2215 | var ReactDOMIDOperations = __webpack_require__(29); | ||
2216 | var ReactMount = __webpack_require__(30); | ||
2217 | |||
2218 | /** | ||
2219 | * Abstracts away all functionality of the reconciler that requires knowledge of | ||
2220 | * the browser context. TODO: These callers should be refactored to avoid the | ||
2221 | * need for this injection. | ||
2222 | */ | ||
2223 | var ReactComponentBrowserEnvironment = { | ||
2224 | |||
2225 | processChildrenUpdates: ReactDOMIDOperations.dangerouslyProcessChildrenUpdates, | ||
2226 | |||
2227 | replaceNodeWithMarkupByID: ReactDOMIDOperations.dangerouslyReplaceNodeWithMarkupByID, | ||
2228 | |||
2229 | /** | ||
2230 | * If a particular environment requires that some resources be cleaned up, | ||
2231 | * specify this in the injected Mixin. In the DOM, we would likely want to | ||
2232 | * purge any cached node ID lookups. | ||
2233 | * | ||
2234 | * @private | ||
2235 | */ | ||
2236 | unmountIDFromEnvironment: function (rootNodeID) { | ||
2237 | ReactMount.purgeID(rootNodeID); | ||
2238 | } | ||
2239 | |||
2240 | }; | ||
2241 | |||
2242 | module.exports = ReactComponentBrowserEnvironment; | ||
2243 | |||
2244 | /***/ }, | ||
2245 | /* 29 */ | ||
2246 | /***/ function(module, exports, __webpack_require__) { | ||
2247 | |||
2248 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
2249 | * Copyright 2013-2015, Facebook, Inc. | ||
2250 | * All rights reserved. | ||
2251 | * | ||
2252 | * This source code is licensed under the BSD-style license found in the | ||
2253 | * LICENSE file in the root directory of this source tree. An additional grant | ||
2254 | * of patent rights can be found in the PATENTS file in the same directory. | ||
2255 | * | ||
2256 | * @providesModule ReactDOMIDOperations | ||
2257 | * @typechecks static-only | ||
2258 | */ | ||
2259 | |||
2260 | 'use strict'; | ||
2261 | |||
2262 | var DOMChildrenOperations = __webpack_require__(9); | ||
2263 | var DOMPropertyOperations = __webpack_require__(24); | ||
2264 | var ReactMount = __webpack_require__(30); | ||
2265 | var ReactPerf = __webpack_require__(20); | ||
2266 | |||
2267 | var invariant = __webpack_require__(15); | ||
2268 | |||
2269 | /** | ||
2270 | * Errors for properties that should not be updated with `updatePropertyByID()`. | ||
2271 | * | ||
2272 | * @type {object} | ||
2273 | * @private | ||
2274 | */ | ||
2275 | var INVALID_PROPERTY_ERRORS = { | ||
2276 | dangerouslySetInnerHTML: '`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.', | ||
2277 | style: '`style` must be set using `updateStylesByID()`.' | ||
2278 | }; | ||
2279 | |||
2280 | /** | ||
2281 | * Operations used to process updates to DOM nodes. | ||
2282 | */ | ||
2283 | var ReactDOMIDOperations = { | ||
2284 | |||
2285 | /** | ||
2286 | * Updates a DOM node with new property values. This should only be used to | ||
2287 | * update DOM properties in `DOMProperty`. | ||
2288 | * | ||
2289 | * @param {string} id ID of the node to update. | ||
2290 | * @param {string} name A valid property name, see `DOMProperty`. | ||
2291 | * @param {*} value New value of the property. | ||
2292 | * @internal | ||
2293 | */ | ||
2294 | updatePropertyByID: function (id, name, value) { | ||
2295 | var node = ReactMount.getNode(id); | ||
2296 | !!INVALID_PROPERTY_ERRORS.hasOwnProperty(name) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'updatePropertyByID(...): %s', INVALID_PROPERTY_ERRORS[name]) : invariant(false) : undefined; | ||
2297 | |||
2298 | // If we're updating to null or undefined, we should remove the property | ||
2299 | // from the DOM node instead of inadvertantly setting to a string. This | ||
2300 | // brings us in line with the same behavior we have on initial render. | ||
2301 | if (value != null) { | ||
2302 | DOMPropertyOperations.setValueForProperty(node, name, value); | ||
2303 | } else { | ||
2304 | DOMPropertyOperations.deleteValueForProperty(node, name); | ||
2305 | } | ||
2306 | }, | ||
2307 | |||
2308 | /** | ||
2309 | * Replaces a DOM node that exists in the document with markup. | ||
2310 | * | ||
2311 | * @param {string} id ID of child to be replaced. | ||
2312 | * @param {string} markup Dangerous markup to inject in place of child. | ||
2313 | * @internal | ||
2314 | * @see {Danger.dangerouslyReplaceNodeWithMarkup} | ||
2315 | */ | ||
2316 | dangerouslyReplaceNodeWithMarkupByID: function (id, markup) { | ||
2317 | var node = ReactMount.getNode(id); | ||
2318 | DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup(node, markup); | ||
2319 | }, | ||
2320 | |||
2321 | /** | ||
2322 | * Updates a component's children by processing a series of updates. | ||
2323 | * | ||
2324 | * @param {array<object>} updates List of update configurations. | ||
2325 | * @param {array<string>} markup List of markup strings. | ||
2326 | * @internal | ||
2327 | */ | ||
2328 | dangerouslyProcessChildrenUpdates: function (updates, markup) { | ||
2329 | for (var i = 0; i < updates.length; i++) { | ||
2330 | updates[i].parentNode = ReactMount.getNode(updates[i].parentID); | ||
2331 | } | ||
2332 | DOMChildrenOperations.processUpdates(updates, markup); | ||
2333 | } | ||
2334 | }; | ||
2335 | |||
2336 | ReactPerf.measureMethods(ReactDOMIDOperations, 'ReactDOMIDOperations', { | ||
2337 | dangerouslyReplaceNodeWithMarkupByID: 'dangerouslyReplaceNodeWithMarkupByID', | ||
2338 | dangerouslyProcessChildrenUpdates: 'dangerouslyProcessChildrenUpdates' | ||
2339 | }); | ||
2340 | |||
2341 | module.exports = ReactDOMIDOperations; | ||
2342 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
2343 | |||
2344 | /***/ }, | ||
2345 | /* 30 */ | ||
2346 | /***/ function(module, exports, __webpack_require__) { | ||
2347 | |||
2348 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
2349 | * Copyright 2013-2015, Facebook, Inc. | ||
2350 | * All rights reserved. | ||
2351 | * | ||
2352 | * This source code is licensed under the BSD-style license found in the | ||
2353 | * LICENSE file in the root directory of this source tree. An additional grant | ||
2354 | * of patent rights can be found in the PATENTS file in the same directory. | ||
2355 | * | ||
2356 | * @providesModule ReactMount | ||
2357 | */ | ||
2358 | |||
2359 | 'use strict'; | ||
2360 | |||
2361 | var DOMProperty = __webpack_require__(25); | ||
2362 | var ReactBrowserEventEmitter = __webpack_require__(31); | ||
2363 | var ReactCurrentOwner = __webpack_require__(7); | ||
2364 | var ReactDOMFeatureFlags = __webpack_require__(43); | ||
2365 | var ReactElement = __webpack_require__(44); | ||
2366 | var ReactEmptyComponentRegistry = __webpack_require__(46); | ||
2367 | var ReactInstanceHandles = __webpack_require__(47); | ||
2368 | var ReactInstanceMap = __webpack_require__(49); | ||
2369 | var ReactMarkupChecksum = __webpack_require__(50); | ||
2370 | var ReactPerf = __webpack_require__(20); | ||
2371 | var ReactReconciler = __webpack_require__(52); | ||
2372 | var ReactUpdateQueue = __webpack_require__(55); | ||
2373 | var ReactUpdates = __webpack_require__(56); | ||
2374 | |||
2375 | var assign = __webpack_require__(41); | ||
2376 | var emptyObject = __webpack_require__(60); | ||
2377 | var containsNode = __webpack_require__(61); | ||
2378 | var instantiateReactComponent = __webpack_require__(64); | ||
2379 | var invariant = __webpack_require__(15); | ||
2380 | var setInnerHTML = __webpack_require__(21); | ||
2381 | var shouldUpdateReactComponent = __webpack_require__(69); | ||
2382 | var validateDOMNesting = __webpack_require__(72); | ||
2383 | var warning = __webpack_require__(27); | ||
2384 | |||
2385 | var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME; | ||
2386 | var nodeCache = {}; | ||
2387 | |||
2388 | var ELEMENT_NODE_TYPE = 1; | ||
2389 | var DOC_NODE_TYPE = 9; | ||
2390 | var DOCUMENT_FRAGMENT_NODE_TYPE = 11; | ||
2391 | |||
2392 | var ownerDocumentContextKey = '__ReactMount_ownerDocument$' + Math.random().toString(36).slice(2); | ||
2393 | |||
2394 | /** Mapping from reactRootID to React component instance. */ | ||
2395 | var instancesByReactRootID = {}; | ||
2396 | |||
2397 | /** Mapping from reactRootID to `container` nodes. */ | ||
2398 | var containersByReactRootID = {}; | ||
2399 | |||
2400 | if (process.env.NODE_ENV !== 'production') { | ||
2401 | /** __DEV__-only mapping from reactRootID to root elements. */ | ||
2402 | var rootElementsByReactRootID = {}; | ||
2403 | } | ||
2404 | |||
2405 | // Used to store breadth-first search state in findComponentRoot. | ||
2406 | var findComponentRootReusableArray = []; | ||
2407 | |||
2408 | /** | ||
2409 | * Finds the index of the first character | ||
2410 | * that's not common between the two given strings. | ||
2411 | * | ||
2412 | * @return {number} the index of the character where the strings diverge | ||
2413 | */ | ||
2414 | function firstDifferenceIndex(string1, string2) { | ||
2415 | var minLen = Math.min(string1.length, string2.length); | ||
2416 | for (var i = 0; i < minLen; i++) { | ||
2417 | if (string1.charAt(i) !== string2.charAt(i)) { | ||
2418 | return i; | ||
2419 | } | ||
2420 | } | ||
2421 | return string1.length === string2.length ? -1 : minLen; | ||
2422 | } | ||
2423 | |||
2424 | /** | ||
2425 | * @param {DOMElement|DOMDocument} container DOM element that may contain | ||
2426 | * a React component | ||
2427 | * @return {?*} DOM element that may have the reactRoot ID, or null. | ||
2428 | */ | ||
2429 | function getReactRootElementInContainer(container) { | ||
2430 | if (!container) { | ||
2431 | return null; | ||
2432 | } | ||
2433 | |||
2434 | if (container.nodeType === DOC_NODE_TYPE) { | ||
2435 | return container.documentElement; | ||
2436 | } else { | ||
2437 | return container.firstChild; | ||
2438 | } | ||
2439 | } | ||
2440 | |||
2441 | /** | ||
2442 | * @param {DOMElement} container DOM element that may contain a React component. | ||
2443 | * @return {?string} A "reactRoot" ID, if a React component is rendered. | ||
2444 | */ | ||
2445 | function getReactRootID(container) { | ||
2446 | var rootElement = getReactRootElementInContainer(container); | ||
2447 | return rootElement && ReactMount.getID(rootElement); | ||
2448 | } | ||
2449 | |||
2450 | /** | ||
2451 | * Accessing node[ATTR_NAME] or calling getAttribute(ATTR_NAME) on a form | ||
2452 | * element can return its control whose name or ID equals ATTR_NAME. All | ||
2453 | * DOM nodes support `getAttributeNode` but this can also get called on | ||
2454 | * other objects so just return '' if we're given something other than a | ||
2455 | * DOM node (such as window). | ||
2456 | * | ||
2457 | * @param {?DOMElement|DOMWindow|DOMDocument|DOMTextNode} node DOM node. | ||
2458 | * @return {string} ID of the supplied `domNode`. | ||
2459 | */ | ||
2460 | function getID(node) { | ||
2461 | var id = internalGetID(node); | ||
2462 | if (id) { | ||
2463 | if (nodeCache.hasOwnProperty(id)) { | ||
2464 | var cached = nodeCache[id]; | ||
2465 | if (cached !== node) { | ||
2466 | !!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; | ||
2467 | |||
2468 | nodeCache[id] = node; | ||
2469 | } | ||
2470 | } else { | ||
2471 | nodeCache[id] = node; | ||
2472 | } | ||
2473 | } | ||
2474 | |||
2475 | return id; | ||
2476 | } | ||
2477 | |||
2478 | function internalGetID(node) { | ||
2479 | // If node is something like a window, document, or text node, none of | ||
2480 | // which support attributes or a .getAttribute method, gracefully return | ||
2481 | // the empty string, as if the attribute were missing. | ||
2482 | return node && node.getAttribute && node.getAttribute(ATTR_NAME) || ''; | ||
2483 | } | ||
2484 | |||
2485 | /** | ||
2486 | * Sets the React-specific ID of the given node. | ||
2487 | * | ||
2488 | * @param {DOMElement} node The DOM node whose ID will be set. | ||
2489 | * @param {string} id The value of the ID attribute. | ||
2490 | */ | ||
2491 | function setID(node, id) { | ||
2492 | var oldID = internalGetID(node); | ||
2493 | if (oldID !== id) { | ||
2494 | delete nodeCache[oldID]; | ||
2495 | } | ||
2496 | node.setAttribute(ATTR_NAME, id); | ||
2497 | nodeCache[id] = node; | ||
2498 | } | ||
2499 | |||
2500 | /** | ||
2501 | * Finds the node with the supplied React-generated DOM ID. | ||
2502 | * | ||
2503 | * @param {string} id A React-generated DOM ID. | ||
2504 | * @return {DOMElement} DOM node with the suppled `id`. | ||
2505 | * @internal | ||
2506 | */ | ||
2507 | function getNode(id) { | ||
2508 | if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) { | ||
2509 | nodeCache[id] = ReactMount.findReactNodeByID(id); | ||
2510 | } | ||
2511 | return nodeCache[id]; | ||
2512 | } | ||
2513 | |||
2514 | /** | ||
2515 | * Finds the node with the supplied public React instance. | ||
2516 | * | ||
2517 | * @param {*} instance A public React instance. | ||
2518 | * @return {?DOMElement} DOM node with the suppled `id`. | ||
2519 | * @internal | ||
2520 | */ | ||
2521 | function getNodeFromInstance(instance) { | ||
2522 | var id = ReactInstanceMap.get(instance)._rootNodeID; | ||
2523 | if (ReactEmptyComponentRegistry.isNullComponentID(id)) { | ||
2524 | return null; | ||
2525 | } | ||
2526 | if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) { | ||
2527 | nodeCache[id] = ReactMount.findReactNodeByID(id); | ||
2528 | } | ||
2529 | return nodeCache[id]; | ||
2530 | } | ||
2531 | |||
2532 | /** | ||
2533 | * A node is "valid" if it is contained by a currently mounted container. | ||
2534 | * | ||
2535 | * This means that the node does not have to be contained by a document in | ||
2536 | * order to be considered valid. | ||
2537 | * | ||
2538 | * @param {?DOMElement} node The candidate DOM node. | ||
2539 | * @param {string} id The expected ID of the node. | ||
2540 | * @return {boolean} Whether the node is contained by a mounted container. | ||
2541 | */ | ||
2542 | function isValid(node, id) { | ||
2543 | if (node) { | ||
2544 | !(internalGetID(node) === id) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactMount: Unexpected modification of `%s`', ATTR_NAME) : invariant(false) : undefined; | ||
2545 | |||
2546 | var container = ReactMount.findReactContainerForID(id); | ||
2547 | if (container && containsNode(container, node)) { | ||
2548 | return true; | ||
2549 | } | ||
2550 | } | ||
2551 | |||
2552 | return false; | ||
2553 | } | ||
2554 | |||
2555 | /** | ||
2556 | * Causes the cache to forget about one React-specific ID. | ||
2557 | * | ||
2558 | * @param {string} id The ID to forget. | ||
2559 | */ | ||
2560 | function purgeID(id) { | ||
2561 | delete nodeCache[id]; | ||
2562 | } | ||
2563 | |||
2564 | var deepestNodeSoFar = null; | ||
2565 | function findDeepestCachedAncestorImpl(ancestorID) { | ||
2566 | var ancestor = nodeCache[ancestorID]; | ||
2567 | if (ancestor && isValid(ancestor, ancestorID)) { | ||
2568 | deepestNodeSoFar = ancestor; | ||
2569 | } else { | ||
2570 | // This node isn't populated in the cache, so presumably none of its | ||
2571 | // descendants are. Break out of the loop. | ||
2572 | return false; | ||
2573 | } | ||
2574 | } | ||
2575 | |||
2576 | /** | ||
2577 | * Return the deepest cached node whose ID is a prefix of `targetID`. | ||
2578 | */ | ||
2579 | function findDeepestCachedAncestor(targetID) { | ||
2580 | deepestNodeSoFar = null; | ||
2581 | ReactInstanceHandles.traverseAncestors(targetID, findDeepestCachedAncestorImpl); | ||
2582 | |||
2583 | var foundNode = deepestNodeSoFar; | ||
2584 | deepestNodeSoFar = null; | ||
2585 | return foundNode; | ||
2586 | } | ||
2587 | |||
2588 | /** | ||
2589 | * Mounts this component and inserts it into the DOM. | ||
2590 | * | ||
2591 | * @param {ReactComponent} componentInstance The instance to mount. | ||
2592 | * @param {string} rootID DOM ID of the root node. | ||
2593 | * @param {DOMElement} container DOM element to mount into. | ||
2594 | * @param {ReactReconcileTransaction} transaction | ||
2595 | * @param {boolean} shouldReuseMarkup If true, do not insert markup | ||
2596 | */ | ||
2597 | function mountComponentIntoNode(componentInstance, rootID, container, transaction, shouldReuseMarkup, context) { | ||
2598 | if (ReactDOMFeatureFlags.useCreateElement) { | ||
2599 | context = assign({}, context); | ||
2600 | if (container.nodeType === DOC_NODE_TYPE) { | ||
2601 | context[ownerDocumentContextKey] = container; | ||
2602 | } else { | ||
2603 | context[ownerDocumentContextKey] = container.ownerDocument; | ||
2604 | } | ||
2605 | } | ||
2606 | if (process.env.NODE_ENV !== 'production') { | ||
2607 | if (context === emptyObject) { | ||
2608 | context = {}; | ||
2609 | } | ||
2610 | var tag = container.nodeName.toLowerCase(); | ||
2611 | context[validateDOMNesting.ancestorInfoContextKey] = validateDOMNesting.updatedAncestorInfo(null, tag, null); | ||
2612 | } | ||
2613 | var markup = ReactReconciler.mountComponent(componentInstance, rootID, transaction, context); | ||
2614 | componentInstance._renderedComponent._topLevelWrapper = componentInstance; | ||
2615 | ReactMount._mountImageIntoNode(markup, container, shouldReuseMarkup, transaction); | ||
2616 | } | ||
2617 | |||
2618 | /** | ||
2619 | * Batched mount. | ||
2620 | * | ||
2621 | * @param {ReactComponent} componentInstance The instance to mount. | ||
2622 | * @param {string} rootID DOM ID of the root node. | ||
2623 | * @param {DOMElement} container DOM element to mount into. | ||
2624 | * @param {boolean} shouldReuseMarkup If true, do not insert markup | ||
2625 | */ | ||
2626 | function batchedMountComponentIntoNode(componentInstance, rootID, container, shouldReuseMarkup, context) { | ||
2627 | var transaction = ReactUpdates.ReactReconcileTransaction.getPooled( | ||
2628 | /* forceHTML */shouldReuseMarkup); | ||
2629 | transaction.perform(mountComponentIntoNode, null, componentInstance, rootID, container, transaction, shouldReuseMarkup, context); | ||
2630 | ReactUpdates.ReactReconcileTransaction.release(transaction); | ||
2631 | } | ||
2632 | |||
2633 | /** | ||
2634 | * Unmounts a component and removes it from the DOM. | ||
2635 | * | ||
2636 | * @param {ReactComponent} instance React component instance. | ||
2637 | * @param {DOMElement} container DOM element to unmount from. | ||
2638 | * @final | ||
2639 | * @internal | ||
2640 | * @see {ReactMount.unmountComponentAtNode} | ||
2641 | */ | ||
2642 | function unmountComponentFromNode(instance, container) { | ||
2643 | ReactReconciler.unmountComponent(instance); | ||
2644 | |||
2645 | if (container.nodeType === DOC_NODE_TYPE) { | ||
2646 | container = container.documentElement; | ||
2647 | } | ||
2648 | |||
2649 | // http://jsperf.com/emptying-a-node | ||
2650 | while (container.lastChild) { | ||
2651 | container.removeChild(container.lastChild); | ||
2652 | } | ||
2653 | } | ||
2654 | |||
2655 | /** | ||
2656 | * True if the supplied DOM node has a direct React-rendered child that is | ||
2657 | * not a React root element. Useful for warning in `render`, | ||
2658 | * `unmountComponentAtNode`, etc. | ||
2659 | * | ||
2660 | * @param {?DOMElement} node The candidate DOM node. | ||
2661 | * @return {boolean} True if the DOM element contains a direct child that was | ||
2662 | * rendered by React but is not a root element. | ||
2663 | * @internal | ||
2664 | */ | ||
2665 | function hasNonRootReactChild(node) { | ||
2666 | var reactRootID = getReactRootID(node); | ||
2667 | return reactRootID ? reactRootID !== ReactInstanceHandles.getReactRootIDFromNodeID(reactRootID) : false; | ||
2668 | } | ||
2669 | |||
2670 | /** | ||
2671 | * Returns the first (deepest) ancestor of a node which is rendered by this copy | ||
2672 | * of React. | ||
2673 | */ | ||
2674 | function findFirstReactDOMImpl(node) { | ||
2675 | // This node might be from another React instance, so we make sure not to | ||
2676 | // examine the node cache here | ||
2677 | for (; node && node.parentNode !== node; node = node.parentNode) { | ||
2678 | if (node.nodeType !== 1) { | ||
2679 | // Not a DOMElement, therefore not a React component | ||
2680 | continue; | ||
2681 | } | ||
2682 | var nodeID = internalGetID(node); | ||
2683 | if (!nodeID) { | ||
2684 | continue; | ||
2685 | } | ||
2686 | var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(nodeID); | ||
2687 | |||
2688 | // If containersByReactRootID contains the container we find by crawling up | ||
2689 | // the tree, we know that this instance of React rendered the node. | ||
2690 | // nb. isValid's strategy (with containsNode) does not work because render | ||
2691 | // trees may be nested and we don't want a false positive in that case. | ||
2692 | var current = node; | ||
2693 | var lastID; | ||
2694 | do { | ||
2695 | lastID = internalGetID(current); | ||
2696 | current = current.parentNode; | ||
2697 | if (current == null) { | ||
2698 | // The passed-in node has been detached from the container it was | ||
2699 | // originally rendered into. | ||
2700 | return null; | ||
2701 | } | ||
2702 | } while (lastID !== reactRootID); | ||
2703 | |||
2704 | if (current === containersByReactRootID[reactRootID]) { | ||
2705 | return node; | ||
2706 | } | ||
2707 | } | ||
2708 | return null; | ||
2709 | } | ||
2710 | |||
2711 | /** | ||
2712 | * Temporary (?) hack so that we can store all top-level pending updates on | ||
2713 | * composites instead of having to worry about different types of components | ||
2714 | * here. | ||
2715 | */ | ||
2716 | var TopLevelWrapper = function () {}; | ||
2717 | TopLevelWrapper.prototype.isReactComponent = {}; | ||
2718 | if (process.env.NODE_ENV !== 'production') { | ||
2719 | TopLevelWrapper.displayName = 'TopLevelWrapper'; | ||
2720 | } | ||
2721 | TopLevelWrapper.prototype.render = function () { | ||
2722 | // this.props is actually a ReactElement | ||
2723 | return this.props; | ||
2724 | }; | ||
2725 | |||
2726 | /** | ||
2727 | * Mounting is the process of initializing a React component by creating its | ||
2728 | * representative DOM elements and inserting them into a supplied `container`. | ||
2729 | * Any prior content inside `container` is destroyed in the process. | ||
2730 | * | ||
2731 | * ReactMount.render( | ||
2732 | * component, | ||
2733 | * document.getElementById('container') | ||
2734 | * ); | ||
2735 | * | ||
2736 | * <div id="container"> <-- Supplied `container`. | ||
2737 | * <div data-reactid=".3"> <-- Rendered reactRoot of React | ||
2738 | * // ... component. | ||
2739 | * </div> | ||
2740 | * </div> | ||
2741 | * | ||
2742 | * Inside of `container`, the first element rendered is the "reactRoot". | ||
2743 | */ | ||
2744 | var ReactMount = { | ||
2745 | |||
2746 | TopLevelWrapper: TopLevelWrapper, | ||
2747 | |||
2748 | /** Exposed for debugging purposes **/ | ||
2749 | _instancesByReactRootID: instancesByReactRootID, | ||
2750 | |||
2751 | /** | ||
2752 | * This is a hook provided to support rendering React components while | ||
2753 | * ensuring that the apparent scroll position of its `container` does not | ||
2754 | * change. | ||
2755 | * | ||
2756 | * @param {DOMElement} container The `container` being rendered into. | ||
2757 | * @param {function} renderCallback This must be called once to do the render. | ||
2758 | */ | ||
2759 | scrollMonitor: function (container, renderCallback) { | ||
2760 | renderCallback(); | ||
2761 | }, | ||
2762 | |||
2763 | /** | ||
2764 | * Take a component that's already mounted into the DOM and replace its props | ||
2765 | * @param {ReactComponent} prevComponent component instance already in the DOM | ||
2766 | * @param {ReactElement} nextElement component instance to render | ||
2767 | * @param {DOMElement} container container to render into | ||
2768 | * @param {?function} callback function triggered on completion | ||
2769 | */ | ||
2770 | _updateRootComponent: function (prevComponent, nextElement, container, callback) { | ||
2771 | ReactMount.scrollMonitor(container, function () { | ||
2772 | ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement); | ||
2773 | if (callback) { | ||
2774 | ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback); | ||
2775 | } | ||
2776 | }); | ||
2777 | |||
2778 | if (process.env.NODE_ENV !== 'production') { | ||
2779 | // Record the root element in case it later gets transplanted. | ||
2780 | rootElementsByReactRootID[getReactRootID(container)] = getReactRootElementInContainer(container); | ||
2781 | } | ||
2782 | |||
2783 | return prevComponent; | ||
2784 | }, | ||
2785 | |||
2786 | /** | ||
2787 | * Register a component into the instance map and starts scroll value | ||
2788 | * monitoring | ||
2789 | * @param {ReactComponent} nextComponent component instance to render | ||
2790 | * @param {DOMElement} container container to render into | ||
2791 | * @return {string} reactRoot ID prefix | ||
2792 | */ | ||
2793 | _registerComponent: function (nextComponent, container) { | ||
2794 | !(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; | ||
2795 | |||
2796 | ReactBrowserEventEmitter.ensureScrollValueMonitoring(); | ||
2797 | |||
2798 | var reactRootID = ReactMount.registerContainer(container); | ||
2799 | instancesByReactRootID[reactRootID] = nextComponent; | ||
2800 | return reactRootID; | ||
2801 | }, | ||
2802 | |||
2803 | /** | ||
2804 | * Render a new component into the DOM. | ||
2805 | * @param {ReactElement} nextElement element to render | ||
2806 | * @param {DOMElement} container container to render into | ||
2807 | * @param {boolean} shouldReuseMarkup if we should skip the markup insertion | ||
2808 | * @return {ReactComponent} nextComponent | ||
2809 | */ | ||
2810 | _renderNewRootComponent: function (nextElement, container, shouldReuseMarkup, context) { | ||
2811 | // Various parts of our code (such as ReactCompositeComponent's | ||
2812 | // _renderValidatedComponent) assume that calls to render aren't nested; | ||
2813 | // verify that that's the case. | ||
2814 | 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; | ||
2815 | |||
2816 | var componentInstance = instantiateReactComponent(nextElement, null); | ||
2817 | var reactRootID = ReactMount._registerComponent(componentInstance, container); | ||
2818 | |||
2819 | // The initial render is synchronous but any updates that happen during | ||
2820 | // rendering, in componentWillMount or componentDidMount, will be batched | ||
2821 | // according to the current batching strategy. | ||
2822 | |||
2823 | ReactUpdates.batchedUpdates(batchedMountComponentIntoNode, componentInstance, reactRootID, container, shouldReuseMarkup, context); | ||
2824 | |||
2825 | if (process.env.NODE_ENV !== 'production') { | ||
2826 | // Record the root element in case it later gets transplanted. | ||
2827 | rootElementsByReactRootID[reactRootID] = getReactRootElementInContainer(container); | ||
2828 | } | ||
2829 | |||
2830 | return componentInstance; | ||
2831 | }, | ||
2832 | |||
2833 | /** | ||
2834 | * Renders a React component into the DOM in the supplied `container`. | ||
2835 | * | ||
2836 | * If the React component was previously rendered into `container`, this will | ||
2837 | * perform an update on it and only mutate the DOM as necessary to reflect the | ||
2838 | * latest React component. | ||
2839 | * | ||
2840 | * @param {ReactComponent} parentComponent The conceptual parent of this render tree. | ||
2841 | * @param {ReactElement} nextElement Component element to render. | ||
2842 | * @param {DOMElement} container DOM element to render into. | ||
2843 | * @param {?function} callback function triggered on completion | ||
2844 | * @return {ReactComponent} Component instance rendered in `container`. | ||
2845 | */ | ||
2846 | renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) { | ||
2847 | !(parentComponent != null && parentComponent._reactInternalInstance != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'parentComponent must be a valid React Component') : invariant(false) : undefined; | ||
2848 | return ReactMount._renderSubtreeIntoContainer(parentComponent, nextElement, container, callback); | ||
2849 | }, | ||
2850 | |||
2851 | _renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) { | ||
2852 | !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.' : | ||
2853 | // Check if it quacks like an element | ||
2854 | nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : invariant(false) : undefined; | ||
2855 | |||
2856 | 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; | ||
2857 | |||
2858 | var nextWrappedElement = new ReactElement(TopLevelWrapper, null, null, null, null, null, nextElement); | ||
2859 | |||
2860 | var prevComponent = instancesByReactRootID[getReactRootID(container)]; | ||
2861 | |||
2862 | if (prevComponent) { | ||
2863 | var prevWrappedElement = prevComponent._currentElement; | ||
2864 | var prevElement = prevWrappedElement.props; | ||
2865 | if (shouldUpdateReactComponent(prevElement, nextElement)) { | ||
2866 | var publicInst = prevComponent._renderedComponent.getPublicInstance(); | ||
2867 | var updatedCallback = callback && function () { | ||
2868 | callback.call(publicInst); | ||
2869 | }; | ||
2870 | ReactMount._updateRootComponent(prevComponent, nextWrappedElement, container, updatedCallback); | ||
2871 | return publicInst; | ||
2872 | } else { | ||
2873 | ReactMount.unmountComponentAtNode(container); | ||
2874 | } | ||
2875 | } | ||
2876 | |||
2877 | var reactRootElement = getReactRootElementInContainer(container); | ||
2878 | var containerHasReactMarkup = reactRootElement && !!internalGetID(reactRootElement); | ||
2879 | var containerHasNonRootReactChild = hasNonRootReactChild(container); | ||
2880 | |||
2881 | if (process.env.NODE_ENV !== 'production') { | ||
2882 | 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; | ||
2883 | |||
2884 | if (!containerHasReactMarkup || reactRootElement.nextSibling) { | ||
2885 | var rootElementSibling = reactRootElement; | ||
2886 | while (rootElementSibling) { | ||
2887 | if (internalGetID(rootElementSibling)) { | ||
2888 | 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; | ||
2889 | break; | ||
2890 | } | ||
2891 | rootElementSibling = rootElementSibling.nextSibling; | ||
2892 | } | ||
2893 | } | ||
2894 | } | ||
2895 | |||
2896 | var shouldReuseMarkup = containerHasReactMarkup && !prevComponent && !containerHasNonRootReactChild; | ||
2897 | var component = ReactMount._renderNewRootComponent(nextWrappedElement, container, shouldReuseMarkup, parentComponent != null ? parentComponent._reactInternalInstance._processChildContext(parentComponent._reactInternalInstance._context) : emptyObject)._renderedComponent.getPublicInstance(); | ||
2898 | if (callback) { | ||
2899 | callback.call(component); | ||
2900 | } | ||
2901 | return component; | ||
2902 | }, | ||
2903 | |||
2904 | /** | ||
2905 | * Renders a React component into the DOM in the supplied `container`. | ||
2906 | * | ||
2907 | * If the React component was previously rendered into `container`, this will | ||
2908 | * perform an update on it and only mutate the DOM as necessary to reflect the | ||
2909 | * latest React component. | ||
2910 | * | ||
2911 | * @param {ReactElement} nextElement Component element to render. | ||
2912 | * @param {DOMElement} container DOM element to render into. | ||
2913 | * @param {?function} callback function triggered on completion | ||
2914 | * @return {ReactComponent} Component instance rendered in `container`. | ||
2915 | */ | ||
2916 | render: function (nextElement, container, callback) { | ||
2917 | return ReactMount._renderSubtreeIntoContainer(null, nextElement, container, callback); | ||
2918 | }, | ||
2919 | |||
2920 | /** | ||
2921 | * Registers a container node into which React components will be rendered. | ||
2922 | * This also creates the "reactRoot" ID that will be assigned to the element | ||
2923 | * rendered within. | ||
2924 | * | ||
2925 | * @param {DOMElement} container DOM element to register as a container. | ||
2926 | * @return {string} The "reactRoot" ID of elements rendered within. | ||
2927 | */ | ||
2928 | registerContainer: function (container) { | ||
2929 | var reactRootID = getReactRootID(container); | ||
2930 | if (reactRootID) { | ||
2931 | // If one exists, make sure it is a valid "reactRoot" ID. | ||
2932 | reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(reactRootID); | ||
2933 | } | ||
2934 | if (!reactRootID) { | ||
2935 | // No valid "reactRoot" ID found, create one. | ||
2936 | reactRootID = ReactInstanceHandles.createReactRootID(); | ||
2937 | } | ||
2938 | containersByReactRootID[reactRootID] = container; | ||
2939 | return reactRootID; | ||
2940 | }, | ||
2941 | |||
2942 | /** | ||
2943 | * Unmounts and destroys the React component rendered in the `container`. | ||
2944 | * | ||
2945 | * @param {DOMElement} container DOM element containing a React component. | ||
2946 | * @return {boolean} True if a component was found in and unmounted from | ||
2947 | * `container` | ||
2948 | */ | ||
2949 | unmountComponentAtNode: function (container) { | ||
2950 | // Various parts of our code (such as ReactCompositeComponent's | ||
2951 | // _renderValidatedComponent) assume that calls to render aren't nested; | ||
2952 | // verify that that's the case. (Strictly speaking, unmounting won't cause a | ||
2953 | // render but we still don't expect to be in a render call here.) | ||
2954 | 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; | ||
2955 | |||
2956 | !(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; | ||
2957 | |||
2958 | var reactRootID = getReactRootID(container); | ||
2959 | var component = instancesByReactRootID[reactRootID]; | ||
2960 | if (!component) { | ||
2961 | // Check if the node being unmounted was rendered by React, but isn't a | ||
2962 | // root node. | ||
2963 | var containerHasNonRootReactChild = hasNonRootReactChild(container); | ||
2964 | |||
2965 | // Check if the container itself is a React root node. | ||
2966 | var containerID = internalGetID(container); | ||
2967 | var isContainerReactRoot = containerID && containerID === ReactInstanceHandles.getReactRootIDFromNodeID(containerID); | ||
2968 | |||
2969 | if (process.env.NODE_ENV !== 'production') { | ||
2970 | 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; | ||
2971 | } | ||
2972 | |||
2973 | return false; | ||
2974 | } | ||
2975 | ReactUpdates.batchedUpdates(unmountComponentFromNode, component, container); | ||
2976 | delete instancesByReactRootID[reactRootID]; | ||
2977 | delete containersByReactRootID[reactRootID]; | ||
2978 | if (process.env.NODE_ENV !== 'production') { | ||
2979 | delete rootElementsByReactRootID[reactRootID]; | ||
2980 | } | ||
2981 | return true; | ||
2982 | }, | ||
2983 | |||
2984 | /** | ||
2985 | * Finds the container DOM element that contains React component to which the | ||
2986 | * supplied DOM `id` belongs. | ||
2987 | * | ||
2988 | * @param {string} id The ID of an element rendered by a React component. | ||
2989 | * @return {?DOMElement} DOM element that contains the `id`. | ||
2990 | */ | ||
2991 | findReactContainerForID: function (id) { | ||
2992 | var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(id); | ||
2993 | var container = containersByReactRootID[reactRootID]; | ||
2994 | |||
2995 | if (process.env.NODE_ENV !== 'production') { | ||
2996 | var rootElement = rootElementsByReactRootID[reactRootID]; | ||
2997 | if (rootElement && rootElement.parentNode !== container) { | ||
2998 | process.env.NODE_ENV !== 'production' ? warning( | ||
2999 | // Call internalGetID here because getID calls isValid which calls | ||
3000 | // findReactContainerForID (this function). | ||
3001 | internalGetID(rootElement) === reactRootID, 'ReactMount: Root element ID differed from reactRootID.') : undefined; | ||
3002 | var containerChild = container.firstChild; | ||
3003 | if (containerChild && reactRootID === internalGetID(containerChild)) { | ||
3004 | // If the container has a new child with the same ID as the old | ||
3005 | // root element, then rootElementsByReactRootID[reactRootID] is | ||
3006 | // just stale and needs to be updated. The case that deserves a | ||
3007 | // warning is when the container is empty. | ||
3008 | rootElementsByReactRootID[reactRootID] = containerChild; | ||
3009 | } else { | ||
3010 | process.env.NODE_ENV !== 'production' ? warning(false, 'ReactMount: Root element has been removed from its original ' + 'container. New container: %s', rootElement.parentNode) : undefined; | ||
3011 | } | ||
3012 | } | ||
3013 | } | ||
3014 | |||
3015 | return container; | ||
3016 | }, | ||
3017 | |||
3018 | /** | ||
3019 | * Finds an element rendered by React with the supplied ID. | ||
3020 | * | ||
3021 | * @param {string} id ID of a DOM node in the React component. | ||
3022 | * @return {DOMElement} Root DOM node of the React component. | ||
3023 | */ | ||
3024 | findReactNodeByID: function (id) { | ||
3025 | var reactRoot = ReactMount.findReactContainerForID(id); | ||
3026 | return ReactMount.findComponentRoot(reactRoot, id); | ||
3027 | }, | ||
3028 | |||
3029 | /** | ||
3030 | * Traverses up the ancestors of the supplied node to find a node that is a | ||
3031 | * DOM representation of a React component rendered by this copy of React. | ||
3032 | * | ||
3033 | * @param {*} node | ||
3034 | * @return {?DOMEventTarget} | ||
3035 | * @internal | ||
3036 | */ | ||
3037 | getFirstReactDOM: function (node) { | ||
3038 | return findFirstReactDOMImpl(node); | ||
3039 | }, | ||
3040 | |||
3041 | /** | ||
3042 | * Finds a node with the supplied `targetID` inside of the supplied | ||
3043 | * `ancestorNode`. Exploits the ID naming scheme to perform the search | ||
3044 | * quickly. | ||
3045 | * | ||
3046 | * @param {DOMEventTarget} ancestorNode Search from this root. | ||
3047 | * @pararm {string} targetID ID of the DOM representation of the component. | ||
3048 | * @return {DOMEventTarget} DOM node with the supplied `targetID`. | ||
3049 | * @internal | ||
3050 | */ | ||
3051 | findComponentRoot: function (ancestorNode, targetID) { | ||
3052 | var firstChildren = findComponentRootReusableArray; | ||
3053 | var childIndex = 0; | ||
3054 | |||
3055 | var deepestAncestor = findDeepestCachedAncestor(targetID) || ancestorNode; | ||
3056 | |||
3057 | if (process.env.NODE_ENV !== 'production') { | ||
3058 | // This will throw on the next line; give an early warning | ||
3059 | 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; | ||
3060 | } | ||
3061 | |||
3062 | firstChildren[0] = deepestAncestor.firstChild; | ||
3063 | firstChildren.length = 1; | ||
3064 | |||
3065 | while (childIndex < firstChildren.length) { | ||
3066 | var child = firstChildren[childIndex++]; | ||
3067 | var targetChild; | ||
3068 | |||
3069 | while (child) { | ||
3070 | var childID = ReactMount.getID(child); | ||
3071 | if (childID) { | ||
3072 | // Even if we find the node we're looking for, we finish looping | ||
3073 | // through its siblings to ensure they're cached so that we don't have | ||
3074 | // to revisit this node again. Otherwise, we make n^2 calls to getID | ||
3075 | // when visiting the many children of a single node in order. | ||
3076 | |||
3077 | if (targetID === childID) { | ||
3078 | targetChild = child; | ||
3079 | } else if (ReactInstanceHandles.isAncestorIDOf(childID, targetID)) { | ||
3080 | // If we find a child whose ID is an ancestor of the given ID, | ||
3081 | // then we can be sure that we only want to search the subtree | ||
3082 | // rooted at this child, so we can throw out the rest of the | ||
3083 | // search state. | ||
3084 | firstChildren.length = childIndex = 0; | ||
3085 | firstChildren.push(child.firstChild); | ||
3086 | } | ||
3087 | } else { | ||
3088 | // If this child had no ID, then there's a chance that it was | ||
3089 | // injected automatically by the browser, as when a `<table>` | ||
3090 | // element sprouts an extra `<tbody>` child as a side effect of | ||
3091 | // `.innerHTML` parsing. Optimistically continue down this | ||
3092 | // branch, but not before examining the other siblings. | ||
3093 | firstChildren.push(child.firstChild); | ||
3094 | } | ||
3095 | |||
3096 | child = child.nextSibling; | ||
3097 | } | ||
3098 | |||
3099 | if (targetChild) { | ||
3100 | // Emptying firstChildren/findComponentRootReusableArray is | ||
3101 | // not necessary for correctness, but it helps the GC reclaim | ||
3102 | // any nodes that were left at the end of the search. | ||
3103 | firstChildren.length = 0; | ||
3104 | |||
3105 | return targetChild; | ||
3106 | } | ||
3107 | } | ||
3108 | |||
3109 | firstChildren.length = 0; | ||
3110 | |||
3111 | 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; | ||
3112 | }, | ||
3113 | |||
3114 | _mountImageIntoNode: function (markup, container, shouldReuseMarkup, transaction) { | ||
3115 | !(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; | ||
3116 | |||
3117 | if (shouldReuseMarkup) { | ||
3118 | var rootElement = getReactRootElementInContainer(container); | ||
3119 | if (ReactMarkupChecksum.canReuseMarkup(markup, rootElement)) { | ||
3120 | return; | ||
3121 | } else { | ||
3122 | var checksum = rootElement.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME); | ||
3123 | rootElement.removeAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME); | ||
3124 | |||
3125 | var rootMarkup = rootElement.outerHTML; | ||
3126 | rootElement.setAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME, checksum); | ||
3127 | |||
3128 | var normalizedMarkup = markup; | ||
3129 | if (process.env.NODE_ENV !== 'production') { | ||
3130 | // because rootMarkup is retrieved from the DOM, various normalizations | ||
3131 | // will have occurred which will not be present in `markup`. Here, | ||
3132 | // insert markup into a <div> or <iframe> depending on the container | ||
3133 | // type to perform the same normalizations before comparing. | ||
3134 | var normalizer; | ||
3135 | if (container.nodeType === ELEMENT_NODE_TYPE) { | ||
3136 | normalizer = document.createElement('div'); | ||
3137 | normalizer.innerHTML = markup; | ||
3138 | normalizedMarkup = normalizer.innerHTML; | ||
3139 | } else { | ||
3140 | normalizer = document.createElement('iframe'); | ||
3141 | document.body.appendChild(normalizer); | ||
3142 | normalizer.contentDocument.write(markup); | ||
3143 | normalizedMarkup = normalizer.contentDocument.documentElement.outerHTML; | ||
3144 | document.body.removeChild(normalizer); | ||
3145 | } | ||
3146 | } | ||
3147 | |||
3148 | var diffIndex = firstDifferenceIndex(normalizedMarkup, rootMarkup); | ||
3149 | var difference = ' (client) ' + normalizedMarkup.substring(diffIndex - 20, diffIndex + 20) + '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20); | ||
3150 | |||
3151 | !(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; | ||
3152 | |||
3153 | if (process.env.NODE_ENV !== 'production') { | ||
3154 | 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; | ||
3155 | } | ||
3156 | } | ||
3157 | } | ||
3158 | |||
3159 | !(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; | ||
3160 | |||
3161 | if (transaction.useCreateElement) { | ||
3162 | while (container.lastChild) { | ||
3163 | container.removeChild(container.lastChild); | ||
3164 | } | ||
3165 | container.appendChild(markup); | ||
3166 | } else { | ||
3167 | setInnerHTML(container, markup); | ||
3168 | } | ||
3169 | }, | ||
3170 | |||
3171 | ownerDocumentContextKey: ownerDocumentContextKey, | ||
3172 | |||
3173 | /** | ||
3174 | * React ID utilities. | ||
3175 | */ | ||
3176 | |||
3177 | getReactRootID: getReactRootID, | ||
3178 | |||
3179 | getID: getID, | ||
3180 | |||
3181 | setID: setID, | ||
3182 | |||
3183 | getNode: getNode, | ||
3184 | |||
3185 | getNodeFromInstance: getNodeFromInstance, | ||
3186 | |||
3187 | isValid: isValid, | ||
3188 | |||
3189 | purgeID: purgeID | ||
3190 | }; | ||
3191 | |||
3192 | ReactPerf.measureMethods(ReactMount, 'ReactMount', { | ||
3193 | _renderNewRootComponent: '_renderNewRootComponent', | ||
3194 | _mountImageIntoNode: '_mountImageIntoNode' | ||
3195 | }); | ||
3196 | |||
3197 | module.exports = ReactMount; | ||
3198 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
3199 | |||
3200 | /***/ }, | ||
3201 | /* 31 */ | ||
3202 | /***/ function(module, exports, __webpack_require__) { | ||
3203 | |||
3204 | /** | ||
3205 | * Copyright 2013-2015, Facebook, Inc. | ||
3206 | * All rights reserved. | ||
3207 | * | ||
3208 | * This source code is licensed under the BSD-style license found in the | ||
3209 | * LICENSE file in the root directory of this source tree. An additional grant | ||
3210 | * of patent rights can be found in the PATENTS file in the same directory. | ||
3211 | * | ||
3212 | * @providesModule ReactBrowserEventEmitter | ||
3213 | * @typechecks static-only | ||
3214 | */ | ||
3215 | |||
3216 | 'use strict'; | ||
3217 | |||
3218 | var EventConstants = __webpack_require__(32); | ||
3219 | var EventPluginHub = __webpack_require__(33); | ||
3220 | var EventPluginRegistry = __webpack_require__(34); | ||
3221 | var ReactEventEmitterMixin = __webpack_require__(39); | ||
3222 | var ReactPerf = __webpack_require__(20); | ||
3223 | var ViewportMetrics = __webpack_require__(40); | ||
3224 | |||
3225 | var assign = __webpack_require__(41); | ||
3226 | var isEventSupported = __webpack_require__(42); | ||
3227 | |||
3228 | /** | ||
3229 | * Summary of `ReactBrowserEventEmitter` event handling: | ||
3230 | * | ||
3231 | * - Top-level delegation is used to trap most native browser events. This | ||
3232 | * may only occur in the main thread and is the responsibility of | ||
3233 | * ReactEventListener, which is injected and can therefore support pluggable | ||
3234 | * event sources. This is the only work that occurs in the main thread. | ||
3235 | * | ||
3236 | * - We normalize and de-duplicate events to account for browser quirks. This | ||
3237 | * may be done in the worker thread. | ||
3238 | * | ||
3239 | * - Forward these native events (with the associated top-level type used to | ||
3240 | * trap it) to `EventPluginHub`, which in turn will ask plugins if they want | ||
3241 | * to extract any synthetic events. | ||
3242 | * | ||
3243 | * - The `EventPluginHub` will then process each event by annotating them with | ||
3244 | * "dispatches", a sequence of listeners and IDs that care about that event. | ||
3245 | * | ||
3246 | * - The `EventPluginHub` then dispatches the events. | ||
3247 | * | ||
3248 | * Overview of React and the event system: | ||
3249 | * | ||
3250 | * +------------+ . | ||
3251 | * | DOM | . | ||
3252 | * +------------+ . | ||
3253 | * | . | ||
3254 | * v . | ||
3255 | * +------------+ . | ||
3256 | * | ReactEvent | . | ||
3257 | * | Listener | . | ||
3258 | * +------------+ . +-----------+ | ||
3259 | * | . +--------+|SimpleEvent| | ||
3260 | * | . | |Plugin | | ||
3261 | * +-----|------+ . v +-----------+ | ||
3262 | * | | | . +--------------+ +------------+ | ||
3263 | * | +-----------.--->|EventPluginHub| | Event | | ||
3264 | * | | . | | +-----------+ | Propagators| | ||
3265 | * | ReactEvent | . | | |TapEvent | |------------| | ||
3266 | * | Emitter | . | |<---+|Plugin | |other plugin| | ||
3267 | * | | . | | +-----------+ | utilities | | ||
3268 | * | +-----------.--->| | +------------+ | ||
3269 | * | | | . +--------------+ | ||
3270 | * +-----|------+ . ^ +-----------+ | ||
3271 | * | . | |Enter/Leave| | ||
3272 | * + . +-------+|Plugin | | ||
3273 | * +-------------+ . +-----------+ | ||
3274 | * | application | . | ||
3275 | * |-------------| . | ||
3276 | * | | . | ||
3277 | * | | . | ||
3278 | * +-------------+ . | ||
3279 | * . | ||
3280 | * React Core . General Purpose Event Plugin System | ||
3281 | */ | ||
3282 | |||
3283 | var alreadyListeningTo = {}; | ||
3284 | var isMonitoringScrollValue = false; | ||
3285 | var reactTopListenersCounter = 0; | ||
3286 | |||
3287 | // For events like 'submit' which don't consistently bubble (which we trap at a | ||
3288 | // lower node than `document`), binding at `document` would cause duplicate | ||
3289 | // events so we don't include them here | ||
3290 | var topEventMapping = { | ||
3291 | topAbort: 'abort', | ||
3292 | topBlur: 'blur', | ||
3293 | topCanPlay: 'canplay', | ||
3294 | topCanPlayThrough: 'canplaythrough', | ||
3295 | topChange: 'change', | ||
3296 | topClick: 'click', | ||
3297 | topCompositionEnd: 'compositionend', | ||
3298 | topCompositionStart: 'compositionstart', | ||
3299 | topCompositionUpdate: 'compositionupdate', | ||
3300 | topContextMenu: 'contextmenu', | ||
3301 | topCopy: 'copy', | ||
3302 | topCut: 'cut', | ||
3303 | topDoubleClick: 'dblclick', | ||
3304 | topDrag: 'drag', | ||
3305 | topDragEnd: 'dragend', | ||
3306 | topDragEnter: 'dragenter', | ||
3307 | topDragExit: 'dragexit', | ||
3308 | topDragLeave: 'dragleave', | ||
3309 | topDragOver: 'dragover', | ||
3310 | topDragStart: 'dragstart', | ||
3311 | topDrop: 'drop', | ||
3312 | topDurationChange: 'durationchange', | ||
3313 | topEmptied: 'emptied', | ||
3314 | topEncrypted: 'encrypted', | ||
3315 | topEnded: 'ended', | ||
3316 | topError: 'error', | ||
3317 | topFocus: 'focus', | ||
3318 | topInput: 'input', | ||
3319 | topKeyDown: 'keydown', | ||
3320 | topKeyPress: 'keypress', | ||
3321 | topKeyUp: 'keyup', | ||
3322 | topLoadedData: 'loadeddata', | ||
3323 | topLoadedMetadata: 'loadedmetadata', | ||
3324 | topLoadStart: 'loadstart', | ||
3325 | topMouseDown: 'mousedown', | ||
3326 | topMouseMove: 'mousemove', | ||
3327 | topMouseOut: 'mouseout', | ||
3328 | topMouseOver: 'mouseover', | ||
3329 | topMouseUp: 'mouseup', | ||
3330 | topPaste: 'paste', | ||
3331 | topPause: 'pause', | ||
3332 | topPlay: 'play', | ||
3333 | topPlaying: 'playing', | ||
3334 | topProgress: 'progress', | ||
3335 | topRateChange: 'ratechange', | ||
3336 | topScroll: 'scroll', | ||
3337 | topSeeked: 'seeked', | ||
3338 | topSeeking: 'seeking', | ||
3339 | topSelectionChange: 'selectionchange', | ||
3340 | topStalled: 'stalled', | ||
3341 | topSuspend: 'suspend', | ||
3342 | topTextInput: 'textInput', | ||
3343 | topTimeUpdate: 'timeupdate', | ||
3344 | topTouchCancel: 'touchcancel', | ||
3345 | topTouchEnd: 'touchend', | ||
3346 | topTouchMove: 'touchmove', | ||
3347 | topTouchStart: 'touchstart', | ||
3348 | topVolumeChange: 'volumechange', | ||
3349 | topWaiting: 'waiting', | ||
3350 | topWheel: 'wheel' | ||
3351 | }; | ||
3352 | |||
3353 | /** | ||
3354 | * To ensure no conflicts with other potential React instances on the page | ||
3355 | */ | ||
3356 | var topListenersIDKey = '_reactListenersID' + String(Math.random()).slice(2); | ||
3357 | |||
3358 | function getListeningForDocument(mountAt) { | ||
3359 | // In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty` | ||
3360 | // directly. | ||
3361 | if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) { | ||
3362 | mountAt[topListenersIDKey] = reactTopListenersCounter++; | ||
3363 | alreadyListeningTo[mountAt[topListenersIDKey]] = {}; | ||
3364 | } | ||
3365 | return alreadyListeningTo[mountAt[topListenersIDKey]]; | ||
3366 | } | ||
3367 | |||
3368 | /** | ||
3369 | * `ReactBrowserEventEmitter` is used to attach top-level event listeners. For | ||
3370 | * example: | ||
3371 | * | ||
3372 | * ReactBrowserEventEmitter.putListener('myID', 'onClick', myFunction); | ||
3373 | * | ||
3374 | * This would allocate a "registration" of `('onClick', myFunction)` on 'myID'. | ||
3375 | * | ||
3376 | * @internal | ||
3377 | */ | ||
3378 | var ReactBrowserEventEmitter = assign({}, ReactEventEmitterMixin, { | ||
3379 | |||
3380 | /** | ||
3381 | * Injectable event backend | ||
3382 | */ | ||
3383 | ReactEventListener: null, | ||
3384 | |||
3385 | injection: { | ||
3386 | /** | ||
3387 | * @param {object} ReactEventListener | ||
3388 | */ | ||
3389 | injectReactEventListener: function (ReactEventListener) { | ||
3390 | ReactEventListener.setHandleTopLevel(ReactBrowserEventEmitter.handleTopLevel); | ||
3391 | ReactBrowserEventEmitter.ReactEventListener = ReactEventListener; | ||
3392 | } | ||
3393 | }, | ||
3394 | |||
3395 | /** | ||
3396 | * Sets whether or not any created callbacks should be enabled. | ||
3397 | * | ||
3398 | * @param {boolean} enabled True if callbacks should be enabled. | ||
3399 | */ | ||
3400 | setEnabled: function (enabled) { | ||
3401 | if (ReactBrowserEventEmitter.ReactEventListener) { | ||
3402 | ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled); | ||
3403 | } | ||
3404 | }, | ||
3405 | |||
3406 | /** | ||
3407 | * @return {boolean} True if callbacks are enabled. | ||
3408 | */ | ||
3409 | isEnabled: function () { | ||
3410 | return !!(ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled()); | ||
3411 | }, | ||
3412 | |||
3413 | /** | ||
3414 | * We listen for bubbled touch events on the document object. | ||
3415 | * | ||
3416 | * Firefox v8.01 (and possibly others) exhibited strange behavior when | ||
3417 | * mounting `onmousemove` events at some node that was not the document | ||
3418 | * element. The symptoms were that if your mouse is not moving over something | ||
3419 | * contained within that mount point (for example on the background) the | ||
3420 | * top-level listeners for `onmousemove` won't be called. However, if you | ||
3421 | * register the `mousemove` on the document object, then it will of course | ||
3422 | * catch all `mousemove`s. This along with iOS quirks, justifies restricting | ||
3423 | * top-level listeners to the document object only, at least for these | ||
3424 | * movement types of events and possibly all events. | ||
3425 | * | ||
3426 | * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html | ||
3427 | * | ||
3428 | * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but | ||
3429 | * they bubble to document. | ||
3430 | * | ||
3431 | * @param {string} registrationName Name of listener (e.g. `onClick`). | ||
3432 | * @param {object} contentDocumentHandle Document which owns the container | ||
3433 | */ | ||
3434 | listenTo: function (registrationName, contentDocumentHandle) { | ||
3435 | var mountAt = contentDocumentHandle; | ||
3436 | var isListening = getListeningForDocument(mountAt); | ||
3437 | var dependencies = EventPluginRegistry.registrationNameDependencies[registrationName]; | ||
3438 | |||
3439 | var topLevelTypes = EventConstants.topLevelTypes; | ||
3440 | for (var i = 0; i < dependencies.length; i++) { | ||
3441 | var dependency = dependencies[i]; | ||
3442 | if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) { | ||
3443 | if (dependency === topLevelTypes.topWheel) { | ||
3444 | if (isEventSupported('wheel')) { | ||
3445 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'wheel', mountAt); | ||
3446 | } else if (isEventSupported('mousewheel')) { | ||
3447 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'mousewheel', mountAt); | ||
3448 | } else { | ||
3449 | // Firefox needs to capture a different mouse scroll event. | ||
3450 | // @see http://www.quirksmode.org/dom/events/tests/scroll.html | ||
3451 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'DOMMouseScroll', mountAt); | ||
3452 | } | ||
3453 | } else if (dependency === topLevelTypes.topScroll) { | ||
3454 | |||
3455 | if (isEventSupported('scroll', true)) { | ||
3456 | ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topScroll, 'scroll', mountAt); | ||
3457 | } else { | ||
3458 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topScroll, 'scroll', ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE); | ||
3459 | } | ||
3460 | } else if (dependency === topLevelTypes.topFocus || dependency === topLevelTypes.topBlur) { | ||
3461 | |||
3462 | if (isEventSupported('focus', true)) { | ||
3463 | ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topFocus, 'focus', mountAt); | ||
3464 | ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topBlur, 'blur', mountAt); | ||
3465 | } else if (isEventSupported('focusin')) { | ||
3466 | // IE has `focusin` and `focusout` events which bubble. | ||
3467 | // @see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html | ||
3468 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topFocus, 'focusin', mountAt); | ||
3469 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topBlur, 'focusout', mountAt); | ||
3470 | } | ||
3471 | |||
3472 | // to make sure blur and focus event listeners are only attached once | ||
3473 | isListening[topLevelTypes.topBlur] = true; | ||
3474 | isListening[topLevelTypes.topFocus] = true; | ||
3475 | } else if (topEventMapping.hasOwnProperty(dependency)) { | ||
3476 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(dependency, topEventMapping[dependency], mountAt); | ||
3477 | } | ||
3478 | |||
3479 | isListening[dependency] = true; | ||
3480 | } | ||
3481 | } | ||
3482 | }, | ||
3483 | |||
3484 | trapBubbledEvent: function (topLevelType, handlerBaseName, handle) { | ||
3485 | return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelType, handlerBaseName, handle); | ||
3486 | }, | ||
3487 | |||
3488 | trapCapturedEvent: function (topLevelType, handlerBaseName, handle) { | ||
3489 | return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelType, handlerBaseName, handle); | ||
3490 | }, | ||
3491 | |||
3492 | /** | ||
3493 | * Listens to window scroll and resize events. We cache scroll values so that | ||
3494 | * application code can access them without triggering reflows. | ||
3495 | * | ||
3496 | * NOTE: Scroll events do not bubble. | ||
3497 | * | ||
3498 | * @see http://www.quirksmode.org/dom/events/scroll.html | ||
3499 | */ | ||
3500 | ensureScrollValueMonitoring: function () { | ||
3501 | if (!isMonitoringScrollValue) { | ||
3502 | var refresh = ViewportMetrics.refreshScrollValues; | ||
3503 | ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh); | ||
3504 | isMonitoringScrollValue = true; | ||
3505 | } | ||
3506 | }, | ||
3507 | |||
3508 | eventNameDispatchConfigs: EventPluginHub.eventNameDispatchConfigs, | ||
3509 | |||
3510 | registrationNameModules: EventPluginHub.registrationNameModules, | ||
3511 | |||
3512 | putListener: EventPluginHub.putListener, | ||
3513 | |||
3514 | getListener: EventPluginHub.getListener, | ||
3515 | |||
3516 | deleteListener: EventPluginHub.deleteListener, | ||
3517 | |||
3518 | deleteAllListeners: EventPluginHub.deleteAllListeners | ||
3519 | |||
3520 | }); | ||
3521 | |||
3522 | ReactPerf.measureMethods(ReactBrowserEventEmitter, 'ReactBrowserEventEmitter', { | ||
3523 | putListener: 'putListener', | ||
3524 | deleteListener: 'deleteListener' | ||
3525 | }); | ||
3526 | |||
3527 | module.exports = ReactBrowserEventEmitter; | ||
3528 | |||
3529 | /***/ }, | ||
3530 | /* 32 */ | ||
3531 | /***/ function(module, exports, __webpack_require__) { | ||
3532 | |||
3533 | /** | ||
3534 | * Copyright 2013-2015, Facebook, Inc. | ||
3535 | * All rights reserved. | ||
3536 | * | ||
3537 | * This source code is licensed under the BSD-style license found in the | ||
3538 | * LICENSE file in the root directory of this source tree. An additional grant | ||
3539 | * of patent rights can be found in the PATENTS file in the same directory. | ||
3540 | * | ||
3541 | * @providesModule EventConstants | ||
3542 | */ | ||
3543 | |||
3544 | 'use strict'; | ||
3545 | |||
3546 | var keyMirror = __webpack_require__(19); | ||
3547 | |||
3548 | var PropagationPhases = keyMirror({ bubbled: null, captured: null }); | ||
3549 | |||
3550 | /** | ||
3551 | * Types of raw signals from the browser caught at the top level. | ||
3552 | */ | ||
3553 | var topLevelTypes = keyMirror({ | ||
3554 | topAbort: null, | ||
3555 | topBlur: null, | ||
3556 | topCanPlay: null, | ||
3557 | topCanPlayThrough: null, | ||
3558 | topChange: null, | ||
3559 | topClick: null, | ||
3560 | topCompositionEnd: null, | ||
3561 | topCompositionStart: null, | ||
3562 | topCompositionUpdate: null, | ||
3563 | topContextMenu: null, | ||
3564 | topCopy: null, | ||
3565 | topCut: null, | ||
3566 | topDoubleClick: null, | ||
3567 | topDrag: null, | ||
3568 | topDragEnd: null, | ||
3569 | topDragEnter: null, | ||
3570 | topDragExit: null, | ||
3571 | topDragLeave: null, | ||
3572 | topDragOver: null, | ||
3573 | topDragStart: null, | ||
3574 | topDrop: null, | ||
3575 | topDurationChange: null, | ||
3576 | topEmptied: null, | ||
3577 | topEncrypted: null, | ||
3578 | topEnded: null, | ||
3579 | topError: null, | ||
3580 | topFocus: null, | ||
3581 | topInput: null, | ||
3582 | topKeyDown: null, | ||
3583 | topKeyPress: null, | ||
3584 | topKeyUp: null, | ||
3585 | topLoad: null, | ||
3586 | topLoadedData: null, | ||
3587 | topLoadedMetadata: null, | ||
3588 | topLoadStart: null, | ||
3589 | topMouseDown: null, | ||
3590 | topMouseMove: null, | ||
3591 | topMouseOut: null, | ||
3592 | topMouseOver: null, | ||
3593 | topMouseUp: null, | ||
3594 | topPaste: null, | ||
3595 | topPause: null, | ||
3596 | topPlay: null, | ||
3597 | topPlaying: null, | ||
3598 | topProgress: null, | ||
3599 | topRateChange: null, | ||
3600 | topReset: null, | ||
3601 | topScroll: null, | ||
3602 | topSeeked: null, | ||
3603 | topSeeking: null, | ||
3604 | topSelectionChange: null, | ||
3605 | topStalled: null, | ||
3606 | topSubmit: null, | ||
3607 | topSuspend: null, | ||
3608 | topTextInput: null, | ||
3609 | topTimeUpdate: null, | ||
3610 | topTouchCancel: null, | ||
3611 | topTouchEnd: null, | ||
3612 | topTouchMove: null, | ||
3613 | topTouchStart: null, | ||
3614 | topVolumeChange: null, | ||
3615 | topWaiting: null, | ||
3616 | topWheel: null | ||
3617 | }); | ||
3618 | |||
3619 | var EventConstants = { | ||
3620 | topLevelTypes: topLevelTypes, | ||
3621 | PropagationPhases: PropagationPhases | ||
3622 | }; | ||
3623 | |||
3624 | module.exports = EventConstants; | ||
3625 | |||
3626 | /***/ }, | ||
3627 | /* 33 */ | ||
3628 | /***/ function(module, exports, __webpack_require__) { | ||
3629 | |||
3630 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
3631 | * Copyright 2013-2015, Facebook, Inc. | ||
3632 | * All rights reserved. | ||
3633 | * | ||
3634 | * This source code is licensed under the BSD-style license found in the | ||
3635 | * LICENSE file in the root directory of this source tree. An additional grant | ||
3636 | * of patent rights can be found in the PATENTS file in the same directory. | ||
3637 | * | ||
3638 | * @providesModule EventPluginHub | ||
3639 | */ | ||
3640 | |||
3641 | 'use strict'; | ||
3642 | |||
3643 | var EventPluginRegistry = __webpack_require__(34); | ||
3644 | var EventPluginUtils = __webpack_require__(35); | ||
3645 | var ReactErrorUtils = __webpack_require__(36); | ||
3646 | |||
3647 | var accumulateInto = __webpack_require__(37); | ||
3648 | var forEachAccumulated = __webpack_require__(38); | ||
3649 | var invariant = __webpack_require__(15); | ||
3650 | var warning = __webpack_require__(27); | ||
3651 | |||
3652 | /** | ||
3653 | * Internal store for event listeners | ||
3654 | */ | ||
3655 | var listenerBank = {}; | ||
3656 | |||
3657 | /** | ||
3658 | * Internal queue of events that have accumulated their dispatches and are | ||
3659 | * waiting to have their dispatches executed. | ||
3660 | */ | ||
3661 | var eventQueue = null; | ||
3662 | |||
3663 | /** | ||
3664 | * Dispatches an event and releases it back into the pool, unless persistent. | ||
3665 | * | ||
3666 | * @param {?object} event Synthetic event to be dispatched. | ||
3667 | * @param {boolean} simulated If the event is simulated (changes exn behavior) | ||
3668 | * @private | ||
3669 | */ | ||
3670 | var executeDispatchesAndRelease = function (event, simulated) { | ||
3671 | if (event) { | ||
3672 | EventPluginUtils.executeDispatchesInOrder(event, simulated); | ||
3673 | |||
3674 | if (!event.isPersistent()) { | ||
3675 | event.constructor.release(event); | ||
3676 | } | ||
3677 | } | ||
3678 | }; | ||
3679 | var executeDispatchesAndReleaseSimulated = function (e) { | ||
3680 | return executeDispatchesAndRelease(e, true); | ||
3681 | }; | ||
3682 | var executeDispatchesAndReleaseTopLevel = function (e) { | ||
3683 | return executeDispatchesAndRelease(e, false); | ||
3684 | }; | ||
3685 | |||
3686 | /** | ||
3687 | * - `InstanceHandle`: [required] Module that performs logical traversals of DOM | ||
3688 | * hierarchy given ids of the logical DOM elements involved. | ||
3689 | */ | ||
3690 | var InstanceHandle = null; | ||
3691 | |||
3692 | function validateInstanceHandle() { | ||
3693 | var valid = InstanceHandle && InstanceHandle.traverseTwoPhase && InstanceHandle.traverseEnterLeave; | ||
3694 | process.env.NODE_ENV !== 'production' ? warning(valid, 'InstanceHandle not injected before use!') : undefined; | ||
3695 | } | ||
3696 | |||
3697 | /** | ||
3698 | * This is a unified interface for event plugins to be installed and configured. | ||
3699 | * | ||
3700 | * Event plugins can implement the following properties: | ||
3701 | * | ||
3702 | * `extractEvents` {function(string, DOMEventTarget, string, object): *} | ||
3703 | * Required. When a top-level event is fired, this method is expected to | ||
3704 | * extract synthetic events that will in turn be queued and dispatched. | ||
3705 | * | ||
3706 | * `eventTypes` {object} | ||
3707 | * Optional, plugins that fire events must publish a mapping of registration | ||
3708 | * names that are used to register listeners. Values of this mapping must | ||
3709 | * be objects that contain `registrationName` or `phasedRegistrationNames`. | ||
3710 | * | ||
3711 | * `executeDispatch` {function(object, function, string)} | ||
3712 | * Optional, allows plugins to override how an event gets dispatched. By | ||
3713 | * default, the listener is simply invoked. | ||
3714 | * | ||
3715 | * Each plugin that is injected into `EventsPluginHub` is immediately operable. | ||
3716 | * | ||
3717 | * @public | ||
3718 | */ | ||
3719 | var EventPluginHub = { | ||
3720 | |||
3721 | /** | ||
3722 | * Methods for injecting dependencies. | ||
3723 | */ | ||
3724 | injection: { | ||
3725 | |||
3726 | /** | ||
3727 | * @param {object} InjectedMount | ||
3728 | * @public | ||
3729 | */ | ||
3730 | injectMount: EventPluginUtils.injection.injectMount, | ||
3731 | |||
3732 | /** | ||
3733 | * @param {object} InjectedInstanceHandle | ||
3734 | * @public | ||
3735 | */ | ||
3736 | injectInstanceHandle: function (InjectedInstanceHandle) { | ||
3737 | InstanceHandle = InjectedInstanceHandle; | ||
3738 | if (process.env.NODE_ENV !== 'production') { | ||
3739 | validateInstanceHandle(); | ||
3740 | } | ||
3741 | }, | ||
3742 | |||
3743 | getInstanceHandle: function () { | ||
3744 | if (process.env.NODE_ENV !== 'production') { | ||
3745 | validateInstanceHandle(); | ||
3746 | } | ||
3747 | return InstanceHandle; | ||
3748 | }, | ||
3749 | |||
3750 | /** | ||
3751 | * @param {array} InjectedEventPluginOrder | ||
3752 | * @public | ||
3753 | */ | ||
3754 | injectEventPluginOrder: EventPluginRegistry.injectEventPluginOrder, | ||
3755 | |||
3756 | /** | ||
3757 | * @param {object} injectedNamesToPlugins Map from names to plugin modules. | ||
3758 | */ | ||
3759 | injectEventPluginsByName: EventPluginRegistry.injectEventPluginsByName | ||
3760 | |||
3761 | }, | ||
3762 | |||
3763 | eventNameDispatchConfigs: EventPluginRegistry.eventNameDispatchConfigs, | ||
3764 | |||
3765 | registrationNameModules: EventPluginRegistry.registrationNameModules, | ||
3766 | |||
3767 | /** | ||
3768 | * Stores `listener` at `listenerBank[registrationName][id]`. Is idempotent. | ||
3769 | * | ||
3770 | * @param {string} id ID of the DOM element. | ||
3771 | * @param {string} registrationName Name of listener (e.g. `onClick`). | ||
3772 | * @param {?function} listener The callback to store. | ||
3773 | */ | ||
3774 | putListener: function (id, registrationName, listener) { | ||
3775 | !(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; | ||
3776 | |||
3777 | var bankForRegistrationName = listenerBank[registrationName] || (listenerBank[registrationName] = {}); | ||
3778 | bankForRegistrationName[id] = listener; | ||
3779 | |||
3780 | var PluginModule = EventPluginRegistry.registrationNameModules[registrationName]; | ||
3781 | if (PluginModule && PluginModule.didPutListener) { | ||
3782 | PluginModule.didPutListener(id, registrationName, listener); | ||
3783 | } | ||
3784 | }, | ||
3785 | |||
3786 | /** | ||
3787 | * @param {string} id ID of the DOM element. | ||
3788 | * @param {string} registrationName Name of listener (e.g. `onClick`). | ||
3789 | * @return {?function} The stored callback. | ||
3790 | */ | ||
3791 | getListener: function (id, registrationName) { | ||
3792 | var bankForRegistrationName = listenerBank[registrationName]; | ||
3793 | return bankForRegistrationName && bankForRegistrationName[id]; | ||
3794 | }, | ||
3795 | |||
3796 | /** | ||
3797 | * Deletes a listener from the registration bank. | ||
3798 | * | ||
3799 | * @param {string} id ID of the DOM element. | ||
3800 | * @param {string} registrationName Name of listener (e.g. `onClick`). | ||
3801 | */ | ||
3802 | deleteListener: function (id, registrationName) { | ||
3803 | var PluginModule = EventPluginRegistry.registrationNameModules[registrationName]; | ||
3804 | if (PluginModule && PluginModule.willDeleteListener) { | ||
3805 | PluginModule.willDeleteListener(id, registrationName); | ||
3806 | } | ||
3807 | |||
3808 | var bankForRegistrationName = listenerBank[registrationName]; | ||
3809 | // TODO: This should never be null -- when is it? | ||
3810 | if (bankForRegistrationName) { | ||
3811 | delete bankForRegistrationName[id]; | ||
3812 | } | ||
3813 | }, | ||
3814 | |||
3815 | /** | ||
3816 | * Deletes all listeners for the DOM element with the supplied ID. | ||
3817 | * | ||
3818 | * @param {string} id ID of the DOM element. | ||
3819 | */ | ||
3820 | deleteAllListeners: function (id) { | ||
3821 | for (var registrationName in listenerBank) { | ||
3822 | if (!listenerBank[registrationName][id]) { | ||
3823 | continue; | ||
3824 | } | ||
3825 | |||
3826 | var PluginModule = EventPluginRegistry.registrationNameModules[registrationName]; | ||
3827 | if (PluginModule && PluginModule.willDeleteListener) { | ||
3828 | PluginModule.willDeleteListener(id, registrationName); | ||
3829 | } | ||
3830 | |||
3831 | delete listenerBank[registrationName][id]; | ||
3832 | } | ||
3833 | }, | ||
3834 | |||
3835 | /** | ||
3836 | * Allows registered plugins an opportunity to extract events from top-level | ||
3837 | * native browser events. | ||
3838 | * | ||
3839 | * @param {string} topLevelType Record from `EventConstants`. | ||
3840 | * @param {DOMEventTarget} topLevelTarget The listening component root node. | ||
3841 | * @param {string} topLevelTargetID ID of `topLevelTarget`. | ||
3842 | * @param {object} nativeEvent Native browser event. | ||
3843 | * @return {*} An accumulation of synthetic events. | ||
3844 | * @internal | ||
3845 | */ | ||
3846 | extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) { | ||
3847 | var events; | ||
3848 | var plugins = EventPluginRegistry.plugins; | ||
3849 | for (var i = 0; i < plugins.length; i++) { | ||
3850 | // Not every plugin in the ordering may be loaded at runtime. | ||
3851 | var possiblePlugin = plugins[i]; | ||
3852 | if (possiblePlugin) { | ||
3853 | var extractedEvents = possiblePlugin.extractEvents(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget); | ||
3854 | if (extractedEvents) { | ||
3855 | events = accumulateInto(events, extractedEvents); | ||
3856 | } | ||
3857 | } | ||
3858 | } | ||
3859 | return events; | ||
3860 | }, | ||
3861 | |||
3862 | /** | ||
3863 | * Enqueues a synthetic event that should be dispatched when | ||
3864 | * `processEventQueue` is invoked. | ||
3865 | * | ||
3866 | * @param {*} events An accumulation of synthetic events. | ||
3867 | * @internal | ||
3868 | */ | ||
3869 | enqueueEvents: function (events) { | ||
3870 | if (events) { | ||
3871 | eventQueue = accumulateInto(eventQueue, events); | ||
3872 | } | ||
3873 | }, | ||
3874 | |||
3875 | /** | ||
3876 | * Dispatches all synthetic events on the event queue. | ||
3877 | * | ||
3878 | * @internal | ||
3879 | */ | ||
3880 | processEventQueue: function (simulated) { | ||
3881 | // Set `eventQueue` to null before processing it so that we can tell if more | ||
3882 | // events get enqueued while processing. | ||
3883 | var processingEventQueue = eventQueue; | ||
3884 | eventQueue = null; | ||
3885 | if (simulated) { | ||
3886 | forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseSimulated); | ||
3887 | } else { | ||
3888 | forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel); | ||
3889 | } | ||
3890 | !!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; | ||
3891 | // This would be a good time to rethrow if any of the event handlers threw. | ||
3892 | ReactErrorUtils.rethrowCaughtError(); | ||
3893 | }, | ||
3894 | |||
3895 | /** | ||
3896 | * These are needed for tests only. Do not use! | ||
3897 | */ | ||
3898 | __purge: function () { | ||
3899 | listenerBank = {}; | ||
3900 | }, | ||
3901 | |||
3902 | __getListenerBank: function () { | ||
3903 | return listenerBank; | ||
3904 | } | ||
3905 | |||
3906 | }; | ||
3907 | |||
3908 | module.exports = EventPluginHub; | ||
3909 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
3910 | |||
3911 | /***/ }, | ||
3912 | /* 34 */ | ||
3913 | /***/ function(module, exports, __webpack_require__) { | ||
3914 | |||
3915 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
3916 | * Copyright 2013-2015, Facebook, Inc. | ||
3917 | * All rights reserved. | ||
3918 | * | ||
3919 | * This source code is licensed under the BSD-style license found in the | ||
3920 | * LICENSE file in the root directory of this source tree. An additional grant | ||
3921 | * of patent rights can be found in the PATENTS file in the same directory. | ||
3922 | * | ||
3923 | * @providesModule EventPluginRegistry | ||
3924 | * @typechecks static-only | ||
3925 | */ | ||
3926 | |||
3927 | 'use strict'; | ||
3928 | |||
3929 | var invariant = __webpack_require__(15); | ||
3930 | |||
3931 | /** | ||
3932 | * Injectable ordering of event plugins. | ||
3933 | */ | ||
3934 | var EventPluginOrder = null; | ||
3935 | |||
3936 | /** | ||
3937 | * Injectable mapping from names to event plugin modules. | ||
3938 | */ | ||
3939 | var namesToPlugins = {}; | ||
3940 | |||
3941 | /** | ||
3942 | * Recomputes the plugin list using the injected plugins and plugin ordering. | ||
3943 | * | ||
3944 | * @private | ||
3945 | */ | ||
3946 | function recomputePluginOrdering() { | ||
3947 | if (!EventPluginOrder) { | ||
3948 | // Wait until an `EventPluginOrder` is injected. | ||
3949 | return; | ||
3950 | } | ||
3951 | for (var pluginName in namesToPlugins) { | ||
3952 | var PluginModule = namesToPlugins[pluginName]; | ||
3953 | var pluginIndex = EventPluginOrder.indexOf(pluginName); | ||
3954 | !(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; | ||
3955 | if (EventPluginRegistry.plugins[pluginIndex]) { | ||
3956 | continue; | ||
3957 | } | ||
3958 | !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; | ||
3959 | EventPluginRegistry.plugins[pluginIndex] = PluginModule; | ||
3960 | var publishedEvents = PluginModule.eventTypes; | ||
3961 | for (var eventName in publishedEvents) { | ||
3962 | !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; | ||
3963 | } | ||
3964 | } | ||
3965 | } | ||
3966 | |||
3967 | /** | ||
3968 | * Publishes an event so that it can be dispatched by the supplied plugin. | ||
3969 | * | ||
3970 | * @param {object} dispatchConfig Dispatch configuration for the event. | ||
3971 | * @param {object} PluginModule Plugin publishing the event. | ||
3972 | * @return {boolean} True if the event was successfully published. | ||
3973 | * @private | ||
3974 | */ | ||
3975 | function publishEventForPlugin(dispatchConfig, PluginModule, eventName) { | ||
3976 | !!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; | ||
3977 | EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig; | ||
3978 | |||
3979 | var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; | ||
3980 | if (phasedRegistrationNames) { | ||
3981 | for (var phaseName in phasedRegistrationNames) { | ||
3982 | if (phasedRegistrationNames.hasOwnProperty(phaseName)) { | ||
3983 | var phasedRegistrationName = phasedRegistrationNames[phaseName]; | ||
3984 | publishRegistrationName(phasedRegistrationName, PluginModule, eventName); | ||
3985 | } | ||
3986 | } | ||
3987 | return true; | ||
3988 | } else if (dispatchConfig.registrationName) { | ||
3989 | publishRegistrationName(dispatchConfig.registrationName, PluginModule, eventName); | ||
3990 | return true; | ||
3991 | } | ||
3992 | return false; | ||
3993 | } | ||
3994 | |||
3995 | /** | ||
3996 | * Publishes a registration name that is used to identify dispatched events and | ||
3997 | * can be used with `EventPluginHub.putListener` to register listeners. | ||
3998 | * | ||
3999 | * @param {string} registrationName Registration name to add. | ||
4000 | * @param {object} PluginModule Plugin publishing the event. | ||
4001 | * @private | ||
4002 | */ | ||
4003 | function publishRegistrationName(registrationName, PluginModule, eventName) { | ||
4004 | !!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; | ||
4005 | EventPluginRegistry.registrationNameModules[registrationName] = PluginModule; | ||
4006 | EventPluginRegistry.registrationNameDependencies[registrationName] = PluginModule.eventTypes[eventName].dependencies; | ||
4007 | } | ||
4008 | |||
4009 | /** | ||
4010 | * Registers plugins so that they can extract and dispatch events. | ||
4011 | * | ||
4012 | * @see {EventPluginHub} | ||
4013 | */ | ||
4014 | var EventPluginRegistry = { | ||
4015 | |||
4016 | /** | ||
4017 | * Ordered list of injected plugins. | ||
4018 | */ | ||
4019 | plugins: [], | ||
4020 | |||
4021 | /** | ||
4022 | * Mapping from event name to dispatch config | ||
4023 | */ | ||
4024 | eventNameDispatchConfigs: {}, | ||
4025 | |||
4026 | /** | ||
4027 | * Mapping from registration name to plugin module | ||
4028 | */ | ||
4029 | registrationNameModules: {}, | ||
4030 | |||
4031 | /** | ||
4032 | * Mapping from registration name to event name | ||
4033 | */ | ||
4034 | registrationNameDependencies: {}, | ||
4035 | |||
4036 | /** | ||
4037 | * Injects an ordering of plugins (by plugin name). This allows the ordering | ||
4038 | * to be decoupled from injection of the actual plugins so that ordering is | ||
4039 | * always deterministic regardless of packaging, on-the-fly injection, etc. | ||
4040 | * | ||
4041 | * @param {array} InjectedEventPluginOrder | ||
4042 | * @internal | ||
4043 | * @see {EventPluginHub.injection.injectEventPluginOrder} | ||
4044 | */ | ||
4045 | injectEventPluginOrder: function (InjectedEventPluginOrder) { | ||
4046 | !!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; | ||
4047 | // Clone the ordering so it cannot be dynamically mutated. | ||
4048 | EventPluginOrder = Array.prototype.slice.call(InjectedEventPluginOrder); | ||
4049 | recomputePluginOrdering(); | ||
4050 | }, | ||
4051 | |||
4052 | /** | ||
4053 | * Injects plugins to be used by `EventPluginHub`. The plugin names must be | ||
4054 | * in the ordering injected by `injectEventPluginOrder`. | ||
4055 | * | ||
4056 | * Plugins can be injected as part of page initialization or on-the-fly. | ||
4057 | * | ||
4058 | * @param {object} injectedNamesToPlugins Map from names to plugin modules. | ||
4059 | * @internal | ||
4060 | * @see {EventPluginHub.injection.injectEventPluginsByName} | ||
4061 | */ | ||
4062 | injectEventPluginsByName: function (injectedNamesToPlugins) { | ||
4063 | var isOrderingDirty = false; | ||
4064 | for (var pluginName in injectedNamesToPlugins) { | ||
4065 | if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) { | ||
4066 | continue; | ||
4067 | } | ||
4068 | var PluginModule = injectedNamesToPlugins[pluginName]; | ||
4069 | if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== PluginModule) { | ||
4070 | !!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; | ||
4071 | namesToPlugins[pluginName] = PluginModule; | ||
4072 | isOrderingDirty = true; | ||
4073 | } | ||
4074 | } | ||
4075 | if (isOrderingDirty) { | ||
4076 | recomputePluginOrdering(); | ||
4077 | } | ||
4078 | }, | ||
4079 | |||
4080 | /** | ||
4081 | * Looks up the plugin for the supplied event. | ||
4082 | * | ||
4083 | * @param {object} event A synthetic event. | ||
4084 | * @return {?object} The plugin that created the supplied event. | ||
4085 | * @internal | ||
4086 | */ | ||
4087 | getPluginModuleForEvent: function (event) { | ||
4088 | var dispatchConfig = event.dispatchConfig; | ||
4089 | if (dispatchConfig.registrationName) { | ||
4090 | return EventPluginRegistry.registrationNameModules[dispatchConfig.registrationName] || null; | ||
4091 | } | ||
4092 | for (var phase in dispatchConfig.phasedRegistrationNames) { | ||
4093 | if (!dispatchConfig.phasedRegistrationNames.hasOwnProperty(phase)) { | ||
4094 | continue; | ||
4095 | } | ||
4096 | var PluginModule = EventPluginRegistry.registrationNameModules[dispatchConfig.phasedRegistrationNames[phase]]; | ||
4097 | if (PluginModule) { | ||
4098 | return PluginModule; | ||
4099 | } | ||
4100 | } | ||
4101 | return null; | ||
4102 | }, | ||
4103 | |||
4104 | /** | ||
4105 | * Exposed for unit testing. | ||
4106 | * @private | ||
4107 | */ | ||
4108 | _resetEventPlugins: function () { | ||
4109 | EventPluginOrder = null; | ||
4110 | for (var pluginName in namesToPlugins) { | ||
4111 | if (namesToPlugins.hasOwnProperty(pluginName)) { | ||
4112 | delete namesToPlugins[pluginName]; | ||
4113 | } | ||
4114 | } | ||
4115 | EventPluginRegistry.plugins.length = 0; | ||
4116 | |||
4117 | var eventNameDispatchConfigs = EventPluginRegistry.eventNameDispatchConfigs; | ||
4118 | for (var eventName in eventNameDispatchConfigs) { | ||
4119 | if (eventNameDispatchConfigs.hasOwnProperty(eventName)) { | ||
4120 | delete eventNameDispatchConfigs[eventName]; | ||
4121 | } | ||
4122 | } | ||
4123 | |||
4124 | var registrationNameModules = EventPluginRegistry.registrationNameModules; | ||
4125 | for (var registrationName in registrationNameModules) { | ||
4126 | if (registrationNameModules.hasOwnProperty(registrationName)) { | ||
4127 | delete registrationNameModules[registrationName]; | ||
4128 | } | ||
4129 | } | ||
4130 | } | ||
4131 | |||
4132 | }; | ||
4133 | |||
4134 | module.exports = EventPluginRegistry; | ||
4135 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
4136 | |||
4137 | /***/ }, | ||
4138 | /* 35 */ | ||
4139 | /***/ function(module, exports, __webpack_require__) { | ||
4140 | |||
4141 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
4142 | * Copyright 2013-2015, Facebook, Inc. | ||
4143 | * All rights reserved. | ||
4144 | * | ||
4145 | * This source code is licensed under the BSD-style license found in the | ||
4146 | * LICENSE file in the root directory of this source tree. An additional grant | ||
4147 | * of patent rights can be found in the PATENTS file in the same directory. | ||
4148 | * | ||
4149 | * @providesModule EventPluginUtils | ||
4150 | */ | ||
4151 | |||
4152 | 'use strict'; | ||
4153 | |||
4154 | var EventConstants = __webpack_require__(32); | ||
4155 | var ReactErrorUtils = __webpack_require__(36); | ||
4156 | |||
4157 | var invariant = __webpack_require__(15); | ||
4158 | var warning = __webpack_require__(27); | ||
4159 | |||
4160 | /** | ||
4161 | * Injected dependencies: | ||
4162 | */ | ||
4163 | |||
4164 | /** | ||
4165 | * - `Mount`: [required] Module that can convert between React dom IDs and | ||
4166 | * actual node references. | ||
4167 | */ | ||
4168 | var injection = { | ||
4169 | Mount: null, | ||
4170 | injectMount: function (InjectedMount) { | ||
4171 | injection.Mount = InjectedMount; | ||
4172 | if (process.env.NODE_ENV !== 'production') { | ||
4173 | process.env.NODE_ENV !== 'production' ? warning(InjectedMount && InjectedMount.getNode && InjectedMount.getID, 'EventPluginUtils.injection.injectMount(...): Injected Mount ' + 'module is missing getNode or getID.') : undefined; | ||
4174 | } | ||
4175 | } | ||
4176 | }; | ||
4177 | |||
4178 | var topLevelTypes = EventConstants.topLevelTypes; | ||
4179 | |||
4180 | function isEndish(topLevelType) { | ||
4181 | return topLevelType === topLevelTypes.topMouseUp || topLevelType === topLevelTypes.topTouchEnd || topLevelType === topLevelTypes.topTouchCancel; | ||
4182 | } | ||
4183 | |||
4184 | function isMoveish(topLevelType) { | ||
4185 | return topLevelType === topLevelTypes.topMouseMove || topLevelType === topLevelTypes.topTouchMove; | ||
4186 | } | ||
4187 | function isStartish(topLevelType) { | ||
4188 | return topLevelType === topLevelTypes.topMouseDown || topLevelType === topLevelTypes.topTouchStart; | ||
4189 | } | ||
4190 | |||
4191 | var validateEventDispatches; | ||
4192 | if (process.env.NODE_ENV !== 'production') { | ||
4193 | validateEventDispatches = function (event) { | ||
4194 | var dispatchListeners = event._dispatchListeners; | ||
4195 | var dispatchIDs = event._dispatchIDs; | ||
4196 | |||
4197 | var listenersIsArr = Array.isArray(dispatchListeners); | ||
4198 | var idsIsArr = Array.isArray(dispatchIDs); | ||
4199 | var IDsLen = idsIsArr ? dispatchIDs.length : dispatchIDs ? 1 : 0; | ||
4200 | var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0; | ||
4201 | |||
4202 | process.env.NODE_ENV !== 'production' ? warning(idsIsArr === listenersIsArr && IDsLen === listenersLen, 'EventPluginUtils: Invalid `event`.') : undefined; | ||
4203 | }; | ||
4204 | } | ||
4205 | |||
4206 | /** | ||
4207 | * Dispatch the event to the listener. | ||
4208 | * @param {SyntheticEvent} event SyntheticEvent to handle | ||
4209 | * @param {boolean} simulated If the event is simulated (changes exn behavior) | ||
4210 | * @param {function} listener Application-level callback | ||
4211 | * @param {string} domID DOM id to pass to the callback. | ||
4212 | */ | ||
4213 | function executeDispatch(event, simulated, listener, domID) { | ||
4214 | var type = event.type || 'unknown-event'; | ||
4215 | event.currentTarget = injection.Mount.getNode(domID); | ||
4216 | if (simulated) { | ||
4217 | ReactErrorUtils.invokeGuardedCallbackWithCatch(type, listener, event, domID); | ||
4218 | } else { | ||
4219 | ReactErrorUtils.invokeGuardedCallback(type, listener, event, domID); | ||
4220 | } | ||
4221 | event.currentTarget = null; | ||
4222 | } | ||
4223 | |||
4224 | /** | ||
4225 | * Standard/simple iteration through an event's collected dispatches. | ||
4226 | */ | ||
4227 | function executeDispatchesInOrder(event, simulated) { | ||
4228 | var dispatchListeners = event._dispatchListeners; | ||
4229 | var dispatchIDs = event._dispatchIDs; | ||
4230 | if (process.env.NODE_ENV !== 'production') { | ||
4231 | validateEventDispatches(event); | ||
4232 | } | ||
4233 | if (Array.isArray(dispatchListeners)) { | ||
4234 | for (var i = 0; i < dispatchListeners.length; i++) { | ||
4235 | if (event.isPropagationStopped()) { | ||
4236 | break; | ||
4237 | } | ||
4238 | // Listeners and IDs are two parallel arrays that are always in sync. | ||
4239 | executeDispatch(event, simulated, dispatchListeners[i], dispatchIDs[i]); | ||
4240 | } | ||
4241 | } else if (dispatchListeners) { | ||
4242 | executeDispatch(event, simulated, dispatchListeners, dispatchIDs); | ||
4243 | } | ||
4244 | event._dispatchListeners = null; | ||
4245 | event._dispatchIDs = null; | ||
4246 | } | ||
4247 | |||
4248 | /** | ||
4249 | * Standard/simple iteration through an event's collected dispatches, but stops | ||
4250 | * at the first dispatch execution returning true, and returns that id. | ||
4251 | * | ||
4252 | * @return {?string} id of the first dispatch execution who's listener returns | ||
4253 | * true, or null if no listener returned true. | ||
4254 | */ | ||
4255 | function executeDispatchesInOrderStopAtTrueImpl(event) { | ||
4256 | var dispatchListeners = event._dispatchListeners; | ||
4257 | var dispatchIDs = event._dispatchIDs; | ||
4258 | if (process.env.NODE_ENV !== 'production') { | ||
4259 | validateEventDispatches(event); | ||
4260 | } | ||
4261 | if (Array.isArray(dispatchListeners)) { | ||
4262 | for (var i = 0; i < dispatchListeners.length; i++) { | ||
4263 | if (event.isPropagationStopped()) { | ||
4264 | break; | ||
4265 | } | ||
4266 | // Listeners and IDs are two parallel arrays that are always in sync. | ||
4267 | if (dispatchListeners[i](event, dispatchIDs[i])) { | ||
4268 | return dispatchIDs[i]; | ||
4269 | } | ||
4270 | } | ||
4271 | } else if (dispatchListeners) { | ||
4272 | if (dispatchListeners(event, dispatchIDs)) { | ||
4273 | return dispatchIDs; | ||
4274 | } | ||
4275 | } | ||
4276 | return null; | ||
4277 | } | ||
4278 | |||
4279 | /** | ||
4280 | * @see executeDispatchesInOrderStopAtTrueImpl | ||
4281 | */ | ||
4282 | function executeDispatchesInOrderStopAtTrue(event) { | ||
4283 | var ret = executeDispatchesInOrderStopAtTrueImpl(event); | ||
4284 | event._dispatchIDs = null; | ||
4285 | event._dispatchListeners = null; | ||
4286 | return ret; | ||
4287 | } | ||
4288 | |||
4289 | /** | ||
4290 | * Execution of a "direct" dispatch - there must be at most one dispatch | ||
4291 | * accumulated on the event or it is considered an error. It doesn't really make | ||
4292 | * sense for an event with multiple dispatches (bubbled) to keep track of the | ||
4293 | * return values at each dispatch execution, but it does tend to make sense when | ||
4294 | * dealing with "direct" dispatches. | ||
4295 | * | ||
4296 | * @return {*} The return value of executing the single dispatch. | ||
4297 | */ | ||
4298 | function executeDirectDispatch(event) { | ||
4299 | if (process.env.NODE_ENV !== 'production') { | ||
4300 | validateEventDispatches(event); | ||
4301 | } | ||
4302 | var dispatchListener = event._dispatchListeners; | ||
4303 | var dispatchID = event._dispatchIDs; | ||
4304 | !!Array.isArray(dispatchListener) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : invariant(false) : undefined; | ||
4305 | var res = dispatchListener ? dispatchListener(event, dispatchID) : null; | ||
4306 | event._dispatchListeners = null; | ||
4307 | event._dispatchIDs = null; | ||
4308 | return res; | ||
4309 | } | ||
4310 | |||
4311 | /** | ||
4312 | * @param {SyntheticEvent} event | ||
4313 | * @return {boolean} True iff number of dispatches accumulated is greater than 0. | ||
4314 | */ | ||
4315 | function hasDispatches(event) { | ||
4316 | return !!event._dispatchListeners; | ||
4317 | } | ||
4318 | |||
4319 | /** | ||
4320 | * General utilities that are useful in creating custom Event Plugins. | ||
4321 | */ | ||
4322 | var EventPluginUtils = { | ||
4323 | isEndish: isEndish, | ||
4324 | isMoveish: isMoveish, | ||
4325 | isStartish: isStartish, | ||
4326 | |||
4327 | executeDirectDispatch: executeDirectDispatch, | ||
4328 | executeDispatchesInOrder: executeDispatchesInOrder, | ||
4329 | executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue, | ||
4330 | hasDispatches: hasDispatches, | ||
4331 | |||
4332 | getNode: function (id) { | ||
4333 | return injection.Mount.getNode(id); | ||
4334 | }, | ||
4335 | getID: function (node) { | ||
4336 | return injection.Mount.getID(node); | ||
4337 | }, | ||
4338 | |||
4339 | injection: injection | ||
4340 | }; | ||
4341 | |||
4342 | module.exports = EventPluginUtils; | ||
4343 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
4344 | |||
4345 | /***/ }, | ||
4346 | /* 36 */ | ||
4347 | /***/ function(module, exports, __webpack_require__) { | ||
4348 | |||
4349 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
4350 | * Copyright 2013-2015, Facebook, Inc. | ||
4351 | * All rights reserved. | ||
4352 | * | ||
4353 | * This source code is licensed under the BSD-style license found in the | ||
4354 | * LICENSE file in the root directory of this source tree. An additional grant | ||
4355 | * of patent rights can be found in the PATENTS file in the same directory. | ||
4356 | * | ||
4357 | * @providesModule ReactErrorUtils | ||
4358 | * @typechecks | ||
4359 | */ | ||
4360 | |||
4361 | 'use strict'; | ||
4362 | |||
4363 | var caughtError = null; | ||
4364 | |||
4365 | /** | ||
4366 | * Call a function while guarding against errors that happens within it. | ||
4367 | * | ||
4368 | * @param {?String} name of the guard to use for logging or debugging | ||
4369 | * @param {Function} func The function to invoke | ||
4370 | * @param {*} a First argument | ||
4371 | * @param {*} b Second argument | ||
4372 | */ | ||
4373 | function invokeGuardedCallback(name, func, a, b) { | ||
4374 | try { | ||
4375 | return func(a, b); | ||
4376 | } catch (x) { | ||
4377 | if (caughtError === null) { | ||
4378 | caughtError = x; | ||
4379 | } | ||
4380 | return undefined; | ||
4381 | } | ||
4382 | } | ||
4383 | |||
4384 | var ReactErrorUtils = { | ||
4385 | invokeGuardedCallback: invokeGuardedCallback, | ||
4386 | |||
4387 | /** | ||
4388 | * Invoked by ReactTestUtils.Simulate so that any errors thrown by the event | ||
4389 | * handler are sure to be rethrown by rethrowCaughtError. | ||
4390 | */ | ||
4391 | invokeGuardedCallbackWithCatch: invokeGuardedCallback, | ||
4392 | |||
4393 | /** | ||
4394 | * During execution of guarded functions we will capture the first error which | ||
4395 | * we will rethrow to be handled by the top level error handler. | ||
4396 | */ | ||
4397 | rethrowCaughtError: function () { | ||
4398 | if (caughtError) { | ||
4399 | var error = caughtError; | ||
4400 | caughtError = null; | ||
4401 | throw error; | ||
4402 | } | ||
4403 | } | ||
4404 | }; | ||
4405 | |||
4406 | if (process.env.NODE_ENV !== 'production') { | ||
4407 | /** | ||
4408 | * To help development we can get better devtools integration by simulating a | ||
4409 | * real browser event. | ||
4410 | */ | ||
4411 | if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') { | ||
4412 | var fakeNode = document.createElement('react'); | ||
4413 | ReactErrorUtils.invokeGuardedCallback = function (name, func, a, b) { | ||
4414 | var boundFunc = func.bind(null, a, b); | ||
4415 | var evtType = 'react-' + name; | ||
4416 | fakeNode.addEventListener(evtType, boundFunc, false); | ||
4417 | var evt = document.createEvent('Event'); | ||
4418 | evt.initEvent(evtType, false, false); | ||
4419 | fakeNode.dispatchEvent(evt); | ||
4420 | fakeNode.removeEventListener(evtType, boundFunc, false); | ||
4421 | }; | ||
4422 | } | ||
4423 | } | ||
4424 | |||
4425 | module.exports = ReactErrorUtils; | ||
4426 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
4427 | |||
4428 | /***/ }, | ||
4429 | /* 37 */ | ||
4430 | /***/ function(module, exports, __webpack_require__) { | ||
4431 | |||
4432 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
4433 | * Copyright 2014-2015, Facebook, Inc. | ||
4434 | * All rights reserved. | ||
4435 | * | ||
4436 | * This source code is licensed under the BSD-style license found in the | ||
4437 | * LICENSE file in the root directory of this source tree. An additional grant | ||
4438 | * of patent rights can be found in the PATENTS file in the same directory. | ||
4439 | * | ||
4440 | * @providesModule accumulateInto | ||
4441 | */ | ||
4442 | |||
4443 | 'use strict'; | ||
4444 | |||
4445 | var invariant = __webpack_require__(15); | ||
4446 | |||
4447 | /** | ||
4448 | * | ||
4449 | * Accumulates items that must not be null or undefined into the first one. This | ||
4450 | * is used to conserve memory by avoiding array allocations, and thus sacrifices | ||
4451 | * API cleanness. Since `current` can be null before being passed in and not | ||
4452 | * null after this function, make sure to assign it back to `current`: | ||
4453 | * | ||
4454 | * `a = accumulateInto(a, b);` | ||
4455 | * | ||
4456 | * This API should be sparingly used. Try `accumulate` for something cleaner. | ||
4457 | * | ||
4458 | * @return {*|array<*>} An accumulation of items. | ||
4459 | */ | ||
4460 | |||
4461 | function accumulateInto(current, next) { | ||
4462 | !(next != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : invariant(false) : undefined; | ||
4463 | if (current == null) { | ||
4464 | return next; | ||
4465 | } | ||
4466 | |||
4467 | // Both are not empty. Warning: Never call x.concat(y) when you are not | ||
4468 | // certain that x is an Array (x could be a string with concat method). | ||
4469 | var currentIsArray = Array.isArray(current); | ||
4470 | var nextIsArray = Array.isArray(next); | ||
4471 | |||
4472 | if (currentIsArray && nextIsArray) { | ||
4473 | current.push.apply(current, next); | ||
4474 | return current; | ||
4475 | } | ||
4476 | |||
4477 | if (currentIsArray) { | ||
4478 | current.push(next); | ||
4479 | return current; | ||
4480 | } | ||
4481 | |||
4482 | if (nextIsArray) { | ||
4483 | // A bit too dangerous to mutate `next`. | ||
4484 | return [current].concat(next); | ||
4485 | } | ||
4486 | |||
4487 | return [current, next]; | ||
4488 | } | ||
4489 | |||
4490 | module.exports = accumulateInto; | ||
4491 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
4492 | |||
4493 | /***/ }, | ||
4494 | /* 38 */ | ||
4495 | /***/ function(module, exports) { | ||
4496 | |||
4497 | /** | ||
4498 | * Copyright 2013-2015, Facebook, Inc. | ||
4499 | * All rights reserved. | ||
4500 | * | ||
4501 | * This source code is licensed under the BSD-style license found in the | ||
4502 | * LICENSE file in the root directory of this source tree. An additional grant | ||
4503 | * of patent rights can be found in the PATENTS file in the same directory. | ||
4504 | * | ||
4505 | * @providesModule forEachAccumulated | ||
4506 | */ | ||
4507 | |||
4508 | 'use strict'; | ||
4509 | |||
4510 | /** | ||
4511 | * @param {array} arr an "accumulation" of items which is either an Array or | ||
4512 | * a single item. Useful when paired with the `accumulate` module. This is a | ||
4513 | * simple utility that allows us to reason about a collection of items, but | ||
4514 | * handling the case when there is exactly one item (and we do not need to | ||
4515 | * allocate an array). | ||
4516 | */ | ||
4517 | var forEachAccumulated = function (arr, cb, scope) { | ||
4518 | if (Array.isArray(arr)) { | ||
4519 | arr.forEach(cb, scope); | ||
4520 | } else if (arr) { | ||
4521 | cb.call(scope, arr); | ||
4522 | } | ||
4523 | }; | ||
4524 | |||
4525 | module.exports = forEachAccumulated; | ||
4526 | |||
4527 | /***/ }, | ||
4528 | /* 39 */ | ||
4529 | /***/ function(module, exports, __webpack_require__) { | ||
4530 | |||
4531 | /** | ||
4532 | * Copyright 2013-2015, Facebook, Inc. | ||
4533 | * All rights reserved. | ||
4534 | * | ||
4535 | * This source code is licensed under the BSD-style license found in the | ||
4536 | * LICENSE file in the root directory of this source tree. An additional grant | ||
4537 | * of patent rights can be found in the PATENTS file in the same directory. | ||
4538 | * | ||
4539 | * @providesModule ReactEventEmitterMixin | ||
4540 | */ | ||
4541 | |||
4542 | 'use strict'; | ||
4543 | |||
4544 | var EventPluginHub = __webpack_require__(33); | ||
4545 | |||
4546 | function runEventQueueInBatch(events) { | ||
4547 | EventPluginHub.enqueueEvents(events); | ||
4548 | EventPluginHub.processEventQueue(false); | ||
4549 | } | ||
4550 | |||
4551 | var ReactEventEmitterMixin = { | ||
4552 | |||
4553 | /** | ||
4554 | * Streams a fired top-level event to `EventPluginHub` where plugins have the | ||
4555 | * opportunity to create `ReactEvent`s to be dispatched. | ||
4556 | * | ||
4557 | * @param {string} topLevelType Record from `EventConstants`. | ||
4558 | * @param {object} topLevelTarget The listening component root node. | ||
4559 | * @param {string} topLevelTargetID ID of `topLevelTarget`. | ||
4560 | * @param {object} nativeEvent Native environment event. | ||
4561 | */ | ||
4562 | handleTopLevel: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) { | ||
4563 | var events = EventPluginHub.extractEvents(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget); | ||
4564 | runEventQueueInBatch(events); | ||
4565 | } | ||
4566 | }; | ||
4567 | |||
4568 | module.exports = ReactEventEmitterMixin; | ||
4569 | |||
4570 | /***/ }, | ||
4571 | /* 40 */ | ||
4572 | /***/ function(module, exports) { | ||
4573 | |||
4574 | /** | ||
4575 | * Copyright 2013-2015, Facebook, Inc. | ||
4576 | * All rights reserved. | ||
4577 | * | ||
4578 | * This source code is licensed under the BSD-style license found in the | ||
4579 | * LICENSE file in the root directory of this source tree. An additional grant | ||
4580 | * of patent rights can be found in the PATENTS file in the same directory. | ||
4581 | * | ||
4582 | * @providesModule ViewportMetrics | ||
4583 | */ | ||
4584 | |||
4585 | 'use strict'; | ||
4586 | |||
4587 | var ViewportMetrics = { | ||
4588 | |||
4589 | currentScrollLeft: 0, | ||
4590 | |||
4591 | currentScrollTop: 0, | ||
4592 | |||
4593 | refreshScrollValues: function (scrollPosition) { | ||
4594 | ViewportMetrics.currentScrollLeft = scrollPosition.x; | ||
4595 | ViewportMetrics.currentScrollTop = scrollPosition.y; | ||
4596 | } | ||
4597 | |||
4598 | }; | ||
4599 | |||
4600 | module.exports = ViewportMetrics; | ||
4601 | |||
4602 | /***/ }, | ||
4603 | /* 41 */ | ||
4604 | /***/ function(module, exports) { | ||
4605 | |||
4606 | /** | ||
4607 | * Copyright 2014-2015, Facebook, Inc. | ||
4608 | * All rights reserved. | ||
4609 | * | ||
4610 | * This source code is licensed under the BSD-style license found in the | ||
4611 | * LICENSE file in the root directory of this source tree. An additional grant | ||
4612 | * of patent rights can be found in the PATENTS file in the same directory. | ||
4613 | * | ||
4614 | * @providesModule Object.assign | ||
4615 | */ | ||
4616 | |||
4617 | // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign | ||
4618 | |||
4619 | 'use strict'; | ||
4620 | |||
4621 | function assign(target, sources) { | ||
4622 | if (target == null) { | ||
4623 | throw new TypeError('Object.assign target cannot be null or undefined'); | ||
4624 | } | ||
4625 | |||
4626 | var to = Object(target); | ||
4627 | var hasOwnProperty = Object.prototype.hasOwnProperty; | ||
4628 | |||
4629 | for (var nextIndex = 1; nextIndex < arguments.length; nextIndex++) { | ||
4630 | var nextSource = arguments[nextIndex]; | ||
4631 | if (nextSource == null) { | ||
4632 | continue; | ||
4633 | } | ||
4634 | |||
4635 | var from = Object(nextSource); | ||
4636 | |||
4637 | // We don't currently support accessors nor proxies. Therefore this | ||
4638 | // copy cannot throw. If we ever supported this then we must handle | ||
4639 | // exceptions and side-effects. We don't support symbols so they won't | ||
4640 | // be transferred. | ||
4641 | |||
4642 | for (var key in from) { | ||
4643 | if (hasOwnProperty.call(from, key)) { | ||
4644 | to[key] = from[key]; | ||
4645 | } | ||
4646 | } | ||
4647 | } | ||
4648 | |||
4649 | return to; | ||
4650 | } | ||
4651 | |||
4652 | module.exports = assign; | ||
4653 | |||
4654 | /***/ }, | ||
4655 | /* 42 */ | ||
4656 | /***/ function(module, exports, __webpack_require__) { | ||
4657 | |||
4658 | /** | ||
4659 | * Copyright 2013-2015, Facebook, Inc. | ||
4660 | * All rights reserved. | ||
4661 | * | ||
4662 | * This source code is licensed under the BSD-style license found in the | ||
4663 | * LICENSE file in the root directory of this source tree. An additional grant | ||
4664 | * of patent rights can be found in the PATENTS file in the same directory. | ||
4665 | * | ||
4666 | * @providesModule isEventSupported | ||
4667 | */ | ||
4668 | |||
4669 | 'use strict'; | ||
4670 | |||
4671 | var ExecutionEnvironment = __webpack_require__(11); | ||
4672 | |||
4673 | var useHasFeature; | ||
4674 | if (ExecutionEnvironment.canUseDOM) { | ||
4675 | useHasFeature = document.implementation && document.implementation.hasFeature && | ||
4676 | // always returns true in newer browsers as per the standard. | ||
4677 | // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature | ||
4678 | document.implementation.hasFeature('', '') !== true; | ||
4679 | } | ||
4680 | |||
4681 | /** | ||
4682 | * Checks if an event is supported in the current execution environment. | ||
4683 | * | ||
4684 | * NOTE: This will not work correctly for non-generic events such as `change`, | ||
4685 | * `reset`, `load`, `error`, and `select`. | ||
4686 | * | ||
4687 | * Borrows from Modernizr. | ||
4688 | * | ||
4689 | * @param {string} eventNameSuffix Event name, e.g. "click". | ||
4690 | * @param {?boolean} capture Check if the capture phase is supported. | ||
4691 | * @return {boolean} True if the event is supported. | ||
4692 | * @internal | ||
4693 | * @license Modernizr 3.0.0pre (Custom Build) | MIT | ||
4694 | */ | ||
4695 | function isEventSupported(eventNameSuffix, capture) { | ||
4696 | if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) { | ||
4697 | return false; | ||
4698 | } | ||
4699 | |||
4700 | var eventName = 'on' + eventNameSuffix; | ||
4701 | var isSupported = (eventName in document); | ||
4702 | |||
4703 | if (!isSupported) { | ||
4704 | var element = document.createElement('div'); | ||
4705 | element.setAttribute(eventName, 'return;'); | ||
4706 | isSupported = typeof element[eventName] === 'function'; | ||
4707 | } | ||
4708 | |||
4709 | if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') { | ||
4710 | // This is the only way to test support for the `wheel` event in IE9+. | ||
4711 | isSupported = document.implementation.hasFeature('Events.wheel', '3.0'); | ||
4712 | } | ||
4713 | |||
4714 | return isSupported; | ||
4715 | } | ||
4716 | |||
4717 | module.exports = isEventSupported; | ||
4718 | |||
4719 | /***/ }, | ||
4720 | /* 43 */ | ||
4721 | /***/ function(module, exports) { | ||
4722 | |||
4723 | /** | ||
4724 | * Copyright 2013-2015, Facebook, Inc. | ||
4725 | * All rights reserved. | ||
4726 | * | ||
4727 | * This source code is licensed under the BSD-style license found in the | ||
4728 | * LICENSE file in the root directory of this source tree. An additional grant | ||
4729 | * of patent rights can be found in the PATENTS file in the same directory. | ||
4730 | * | ||
4731 | * @providesModule ReactDOMFeatureFlags | ||
4732 | */ | ||
4733 | |||
4734 | 'use strict'; | ||
4735 | |||
4736 | var ReactDOMFeatureFlags = { | ||
4737 | useCreateElement: false | ||
4738 | }; | ||
4739 | |||
4740 | module.exports = ReactDOMFeatureFlags; | ||
4741 | |||
4742 | /***/ }, | ||
4743 | /* 44 */ | ||
4744 | /***/ function(module, exports, __webpack_require__) { | ||
4745 | |||
4746 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
4747 | * Copyright 2014-2015, Facebook, Inc. | ||
4748 | * All rights reserved. | ||
4749 | * | ||
4750 | * This source code is licensed under the BSD-style license found in the | ||
4751 | * LICENSE file in the root directory of this source tree. An additional grant | ||
4752 | * of patent rights can be found in the PATENTS file in the same directory. | ||
4753 | * | ||
4754 | * @providesModule ReactElement | ||
4755 | */ | ||
4756 | |||
4757 | 'use strict'; | ||
4758 | |||
4759 | var ReactCurrentOwner = __webpack_require__(7); | ||
4760 | |||
4761 | var assign = __webpack_require__(41); | ||
4762 | var canDefineProperty = __webpack_require__(45); | ||
4763 | |||
4764 | // The Symbol used to tag the ReactElement type. If there is no native Symbol | ||
4765 | // nor polyfill, then a plain number is used for performance. | ||
4766 | var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7; | ||
4767 | |||
4768 | var RESERVED_PROPS = { | ||
4769 | key: true, | ||
4770 | ref: true, | ||
4771 | __self: true, | ||
4772 | __source: true | ||
4773 | }; | ||
4774 | |||
4775 | /** | ||
4776 | * Base constructor for all React elements. This is only used to make this | ||
4777 | * work with a dynamic instanceof check. Nothing should live on this prototype. | ||
4778 | * | ||
4779 | * @param {*} type | ||
4780 | * @param {*} key | ||
4781 | * @param {string|object} ref | ||
4782 | * @param {*} self A *temporary* helper to detect places where `this` is | ||
4783 | * different from the `owner` when React.createElement is called, so that we | ||
4784 | * can warn. We want to get rid of owner and replace string `ref`s with arrow | ||
4785 | * functions, and as long as `this` and owner are the same, there will be no | ||
4786 | * change in behavior. | ||
4787 | * @param {*} source An annotation object (added by a transpiler or otherwise) | ||
4788 | * indicating filename, line number, and/or other information. | ||
4789 | * @param {*} owner | ||
4790 | * @param {*} props | ||
4791 | * @internal | ||
4792 | */ | ||
4793 | var ReactElement = function (type, key, ref, self, source, owner, props) { | ||
4794 | var element = { | ||
4795 | // This tag allow us to uniquely identify this as a React Element | ||
4796 | $$typeof: REACT_ELEMENT_TYPE, | ||
4797 | |||
4798 | // Built-in properties that belong on the element | ||
4799 | type: type, | ||
4800 | key: key, | ||
4801 | ref: ref, | ||
4802 | props: props, | ||
4803 | |||
4804 | // Record the component responsible for creating this element. | ||
4805 | _owner: owner | ||
4806 | }; | ||
4807 | |||
4808 | if (process.env.NODE_ENV !== 'production') { | ||
4809 | // The validation flag is currently mutative. We put it on | ||
4810 | // an external backing store so that we can freeze the whole object. | ||
4811 | // This can be replaced with a WeakMap once they are implemented in | ||
4812 | // commonly used development environments. | ||
4813 | element._store = {}; | ||
4814 | |||
4815 | // To make comparing ReactElements easier for testing purposes, we make | ||
4816 | // the validation flag non-enumerable (where possible, which should | ||
4817 | // include every environment we run tests in), so the test framework | ||
4818 | // ignores it. | ||
4819 | if (canDefineProperty) { | ||
4820 | Object.defineProperty(element._store, 'validated', { | ||
4821 | configurable: false, | ||
4822 | enumerable: false, | ||
4823 | writable: true, | ||
4824 | value: false | ||
4825 | }); | ||
4826 | // self and source are DEV only properties. | ||
4827 | Object.defineProperty(element, '_self', { | ||
4828 | configurable: false, | ||
4829 | enumerable: false, | ||
4830 | writable: false, | ||
4831 | value: self | ||
4832 | }); | ||
4833 | // Two elements created in two different places should be considered | ||
4834 | // equal for testing purposes and therefore we hide it from enumeration. | ||
4835 | Object.defineProperty(element, '_source', { | ||
4836 | configurable: false, | ||
4837 | enumerable: false, | ||
4838 | writable: false, | ||
4839 | value: source | ||
4840 | }); | ||
4841 | } else { | ||
4842 | element._store.validated = false; | ||
4843 | element._self = self; | ||
4844 | element._source = source; | ||
4845 | } | ||
4846 | Object.freeze(element.props); | ||
4847 | Object.freeze(element); | ||
4848 | } | ||
4849 | |||
4850 | return element; | ||
4851 | }; | ||
4852 | |||
4853 | ReactElement.createElement = function (type, config, children) { | ||
4854 | var propName; | ||
4855 | |||
4856 | // Reserved names are extracted | ||
4857 | var props = {}; | ||
4858 | |||
4859 | var key = null; | ||
4860 | var ref = null; | ||
4861 | var self = null; | ||
4862 | var source = null; | ||
4863 | |||
4864 | if (config != null) { | ||
4865 | ref = config.ref === undefined ? null : config.ref; | ||
4866 | key = config.key === undefined ? null : '' + config.key; | ||
4867 | self = config.__self === undefined ? null : config.__self; | ||
4868 | source = config.__source === undefined ? null : config.__source; | ||
4869 | // Remaining properties are added to a new props object | ||
4870 | for (propName in config) { | ||
4871 | if (config.hasOwnProperty(propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { | ||
4872 | props[propName] = config[propName]; | ||
4873 | } | ||
4874 | } | ||
4875 | } | ||
4876 | |||
4877 | // Children can be more than one argument, and those are transferred onto | ||
4878 | // the newly allocated props object. | ||
4879 | var childrenLength = arguments.length - 2; | ||
4880 | if (childrenLength === 1) { | ||
4881 | props.children = children; | ||
4882 | } else if (childrenLength > 1) { | ||
4883 | var childArray = Array(childrenLength); | ||
4884 | for (var i = 0; i < childrenLength; i++) { | ||
4885 | childArray[i] = arguments[i + 2]; | ||
4886 | } | ||
4887 | props.children = childArray; | ||
4888 | } | ||
4889 | |||
4890 | // Resolve default props | ||
4891 | if (type && type.defaultProps) { | ||
4892 | var defaultProps = type.defaultProps; | ||
4893 | for (propName in defaultProps) { | ||
4894 | if (typeof props[propName] === 'undefined') { | ||
4895 | props[propName] = defaultProps[propName]; | ||
4896 | } | ||
4897 | } | ||
4898 | } | ||
4899 | |||
4900 | return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props); | ||
4901 | }; | ||
4902 | |||
4903 | ReactElement.createFactory = function (type) { | ||
4904 | var factory = ReactElement.createElement.bind(null, type); | ||
4905 | // Expose the type on the factory and the prototype so that it can be | ||
4906 | // easily accessed on elements. E.g. `<Foo />.type === Foo`. | ||
4907 | // This should not be named `constructor` since this may not be the function | ||
4908 | // that created the element, and it may not even be a constructor. | ||
4909 | // Legacy hook TODO: Warn if this is accessed | ||
4910 | factory.type = type; | ||
4911 | return factory; | ||
4912 | }; | ||
4913 | |||
4914 | ReactElement.cloneAndReplaceKey = function (oldElement, newKey) { | ||
4915 | var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props); | ||
4916 | |||
4917 | return newElement; | ||
4918 | }; | ||
4919 | |||
4920 | ReactElement.cloneAndReplaceProps = function (oldElement, newProps) { | ||
4921 | var newElement = ReactElement(oldElement.type, oldElement.key, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, newProps); | ||
4922 | |||
4923 | if (process.env.NODE_ENV !== 'production') { | ||
4924 | // If the key on the original is valid, then the clone is valid | ||
4925 | newElement._store.validated = oldElement._store.validated; | ||
4926 | } | ||
4927 | |||
4928 | return newElement; | ||
4929 | }; | ||
4930 | |||
4931 | ReactElement.cloneElement = function (element, config, children) { | ||
4932 | var propName; | ||
4933 | |||
4934 | // Original props are copied | ||
4935 | var props = assign({}, element.props); | ||
4936 | |||
4937 | // Reserved names are extracted | ||
4938 | var key = element.key; | ||
4939 | var ref = element.ref; | ||
4940 | // Self is preserved since the owner is preserved. | ||
4941 | var self = element._self; | ||
4942 | // Source is preserved since cloneElement is unlikely to be targeted by a | ||
4943 | // transpiler, and the original source is probably a better indicator of the | ||
4944 | // true owner. | ||
4945 | var source = element._source; | ||
4946 | |||
4947 | // Owner will be preserved, unless ref is overridden | ||
4948 | var owner = element._owner; | ||
4949 | |||
4950 | if (config != null) { | ||
4951 | if (config.ref !== undefined) { | ||
4952 | // Silently steal the ref from the parent. | ||
4953 | ref = config.ref; | ||
4954 | owner = ReactCurrentOwner.current; | ||
4955 | } | ||
4956 | if (config.key !== undefined) { | ||
4957 | key = '' + config.key; | ||
4958 | } | ||
4959 | // Remaining properties override existing props | ||
4960 | for (propName in config) { | ||
4961 | if (config.hasOwnProperty(propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { | ||
4962 | props[propName] = config[propName]; | ||
4963 | } | ||
4964 | } | ||
4965 | } | ||
4966 | |||
4967 | // Children can be more than one argument, and those are transferred onto | ||
4968 | // the newly allocated props object. | ||
4969 | var childrenLength = arguments.length - 2; | ||
4970 | if (childrenLength === 1) { | ||
4971 | props.children = children; | ||
4972 | } else if (childrenLength > 1) { | ||
4973 | var childArray = Array(childrenLength); | ||
4974 | for (var i = 0; i < childrenLength; i++) { | ||
4975 | childArray[i] = arguments[i + 2]; | ||
4976 | } | ||
4977 | props.children = childArray; | ||
4978 | } | ||
4979 | |||
4980 | return ReactElement(element.type, key, ref, self, source, owner, props); | ||
4981 | }; | ||
4982 | |||
4983 | /** | ||
4984 | * @param {?object} object | ||
4985 | * @return {boolean} True if `object` is a valid component. | ||
4986 | * @final | ||
4987 | */ | ||
4988 | ReactElement.isValidElement = function (object) { | ||
4989 | return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; | ||
4990 | }; | ||
4991 | |||
4992 | module.exports = ReactElement; | ||
4993 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
4994 | |||
4995 | /***/ }, | ||
4996 | /* 45 */ | ||
4997 | /***/ function(module, exports, __webpack_require__) { | ||
4998 | |||
4999 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
5000 | * Copyright 2013-2015, Facebook, Inc. | ||
5001 | * All rights reserved. | ||
5002 | * | ||
5003 | * This source code is licensed under the BSD-style license found in the | ||
5004 | * LICENSE file in the root directory of this source tree. An additional grant | ||
5005 | * of patent rights can be found in the PATENTS file in the same directory. | ||
5006 | * | ||
5007 | * @providesModule canDefineProperty | ||
5008 | */ | ||
5009 | |||
5010 | 'use strict'; | ||
5011 | |||
5012 | var canDefineProperty = false; | ||
5013 | if (process.env.NODE_ENV !== 'production') { | ||
5014 | try { | ||
5015 | Object.defineProperty({}, 'x', { get: function () {} }); | ||
5016 | canDefineProperty = true; | ||
5017 | } catch (x) { | ||
5018 | // IE will fail on defineProperty | ||
5019 | } | ||
5020 | } | ||
5021 | |||
5022 | module.exports = canDefineProperty; | ||
5023 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
5024 | |||
5025 | /***/ }, | ||
5026 | /* 46 */ | ||
5027 | /***/ function(module, exports) { | ||
5028 | |||
5029 | /** | ||
5030 | * Copyright 2014-2015, Facebook, Inc. | ||
5031 | * All rights reserved. | ||
5032 | * | ||
5033 | * This source code is licensed under the BSD-style license found in the | ||
5034 | * LICENSE file in the root directory of this source tree. An additional grant | ||
5035 | * of patent rights can be found in the PATENTS file in the same directory. | ||
5036 | * | ||
5037 | * @providesModule ReactEmptyComponentRegistry | ||
5038 | */ | ||
5039 | |||
5040 | 'use strict'; | ||
5041 | |||
5042 | // This registry keeps track of the React IDs of the components that rendered to | ||
5043 | // `null` (in reality a placeholder such as `noscript`) | ||
5044 | var nullComponentIDsRegistry = {}; | ||
5045 | |||
5046 | /** | ||
5047 | * @param {string} id Component's `_rootNodeID`. | ||
5048 | * @return {boolean} True if the component is rendered to null. | ||
5049 | */ | ||
5050 | function isNullComponentID(id) { | ||
5051 | return !!nullComponentIDsRegistry[id]; | ||
5052 | } | ||
5053 | |||
5054 | /** | ||
5055 | * Mark the component as having rendered to null. | ||
5056 | * @param {string} id Component's `_rootNodeID`. | ||
5057 | */ | ||
5058 | function registerNullComponentID(id) { | ||
5059 | nullComponentIDsRegistry[id] = true; | ||
5060 | } | ||
5061 | |||
5062 | /** | ||
5063 | * Unmark the component as having rendered to null: it renders to something now. | ||
5064 | * @param {string} id Component's `_rootNodeID`. | ||
5065 | */ | ||
5066 | function deregisterNullComponentID(id) { | ||
5067 | delete nullComponentIDsRegistry[id]; | ||
5068 | } | ||
5069 | |||
5070 | var ReactEmptyComponentRegistry = { | ||
5071 | isNullComponentID: isNullComponentID, | ||
5072 | registerNullComponentID: registerNullComponentID, | ||
5073 | deregisterNullComponentID: deregisterNullComponentID | ||
5074 | }; | ||
5075 | |||
5076 | module.exports = ReactEmptyComponentRegistry; | ||
5077 | |||
5078 | /***/ }, | ||
5079 | /* 47 */ | ||
5080 | /***/ function(module, exports, __webpack_require__) { | ||
5081 | |||
5082 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
5083 | * Copyright 2013-2015, Facebook, Inc. | ||
5084 | * All rights reserved. | ||
5085 | * | ||
5086 | * This source code is licensed under the BSD-style license found in the | ||
5087 | * LICENSE file in the root directory of this source tree. An additional grant | ||
5088 | * of patent rights can be found in the PATENTS file in the same directory. | ||
5089 | * | ||
5090 | * @providesModule ReactInstanceHandles | ||
5091 | * @typechecks static-only | ||
5092 | */ | ||
5093 | |||
5094 | 'use strict'; | ||
5095 | |||
5096 | var ReactRootIndex = __webpack_require__(48); | ||
5097 | |||
5098 | var invariant = __webpack_require__(15); | ||
5099 | |||
5100 | var SEPARATOR = '.'; | ||
5101 | var SEPARATOR_LENGTH = SEPARATOR.length; | ||
5102 | |||
5103 | /** | ||
5104 | * Maximum depth of traversals before we consider the possibility of a bad ID. | ||
5105 | */ | ||
5106 | var MAX_TREE_DEPTH = 10000; | ||
5107 | |||
5108 | /** | ||
5109 | * Creates a DOM ID prefix to use when mounting React components. | ||
5110 | * | ||
5111 | * @param {number} index A unique integer | ||
5112 | * @return {string} React root ID. | ||
5113 | * @internal | ||
5114 | */ | ||
5115 | function getReactRootIDString(index) { | ||
5116 | return SEPARATOR + index.toString(36); | ||
5117 | } | ||
5118 | |||
5119 | /** | ||
5120 | * Checks if a character in the supplied ID is a separator or the end. | ||
5121 | * | ||
5122 | * @param {string} id A React DOM ID. | ||
5123 | * @param {number} index Index of the character to check. | ||
5124 | * @return {boolean} True if the character is a separator or end of the ID. | ||
5125 | * @private | ||
5126 | */ | ||
5127 | function isBoundary(id, index) { | ||
5128 | return id.charAt(index) === SEPARATOR || index === id.length; | ||
5129 | } | ||
5130 | |||
5131 | /** | ||
5132 | * Checks if the supplied string is a valid React DOM ID. | ||
5133 | * | ||
5134 | * @param {string} id A React DOM ID, maybe. | ||
5135 | * @return {boolean} True if the string is a valid React DOM ID. | ||
5136 | * @private | ||
5137 | */ | ||
5138 | function isValidID(id) { | ||
5139 | return id === '' || id.charAt(0) === SEPARATOR && id.charAt(id.length - 1) !== SEPARATOR; | ||
5140 | } | ||
5141 | |||
5142 | /** | ||
5143 | * Checks if the first ID is an ancestor of or equal to the second ID. | ||
5144 | * | ||
5145 | * @param {string} ancestorID | ||
5146 | * @param {string} descendantID | ||
5147 | * @return {boolean} True if `ancestorID` is an ancestor of `descendantID`. | ||
5148 | * @internal | ||
5149 | */ | ||
5150 | function isAncestorIDOf(ancestorID, descendantID) { | ||
5151 | return descendantID.indexOf(ancestorID) === 0 && isBoundary(descendantID, ancestorID.length); | ||
5152 | } | ||
5153 | |||
5154 | /** | ||
5155 | * Gets the parent ID of the supplied React DOM ID, `id`. | ||
5156 | * | ||
5157 | * @param {string} id ID of a component. | ||
5158 | * @return {string} ID of the parent, or an empty string. | ||
5159 | * @private | ||
5160 | */ | ||
5161 | function getParentID(id) { | ||
5162 | return id ? id.substr(0, id.lastIndexOf(SEPARATOR)) : ''; | ||
5163 | } | ||
5164 | |||
5165 | /** | ||
5166 | * Gets the next DOM ID on the tree path from the supplied `ancestorID` to the | ||
5167 | * supplied `destinationID`. If they are equal, the ID is returned. | ||
5168 | * | ||
5169 | * @param {string} ancestorID ID of an ancestor node of `destinationID`. | ||
5170 | * @param {string} destinationID ID of the destination node. | ||
5171 | * @return {string} Next ID on the path from `ancestorID` to `destinationID`. | ||
5172 | * @private | ||
5173 | */ | ||
5174 | function getNextDescendantID(ancestorID, destinationID) { | ||
5175 | !(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; | ||
5176 | !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; | ||
5177 | if (ancestorID === destinationID) { | ||
5178 | return ancestorID; | ||
5179 | } | ||
5180 | // Skip over the ancestor and the immediate separator. Traverse until we hit | ||
5181 | // another separator or we reach the end of `destinationID`. | ||
5182 | var start = ancestorID.length + SEPARATOR_LENGTH; | ||
5183 | var i; | ||
5184 | for (i = start; i < destinationID.length; i++) { | ||
5185 | if (isBoundary(destinationID, i)) { | ||
5186 | break; | ||
5187 | } | ||
5188 | } | ||
5189 | return destinationID.substr(0, i); | ||
5190 | } | ||
5191 | |||
5192 | /** | ||
5193 | * Gets the nearest common ancestor ID of two IDs. | ||
5194 | * | ||
5195 | * Using this ID scheme, the nearest common ancestor ID is the longest common | ||
5196 | * prefix of the two IDs that immediately preceded a "marker" in both strings. | ||
5197 | * | ||
5198 | * @param {string} oneID | ||
5199 | * @param {string} twoID | ||
5200 | * @return {string} Nearest common ancestor ID, or the empty string if none. | ||
5201 | * @private | ||
5202 | */ | ||
5203 | function getFirstCommonAncestorID(oneID, twoID) { | ||
5204 | var minLength = Math.min(oneID.length, twoID.length); | ||
5205 | if (minLength === 0) { | ||
5206 | return ''; | ||
5207 | } | ||
5208 | var lastCommonMarkerIndex = 0; | ||
5209 | // Use `<=` to traverse until the "EOL" of the shorter string. | ||
5210 | for (var i = 0; i <= minLength; i++) { | ||
5211 | if (isBoundary(oneID, i) && isBoundary(twoID, i)) { | ||
5212 | lastCommonMarkerIndex = i; | ||
5213 | } else if (oneID.charAt(i) !== twoID.charAt(i)) { | ||
5214 | break; | ||
5215 | } | ||
5216 | } | ||
5217 | var longestCommonID = oneID.substr(0, lastCommonMarkerIndex); | ||
5218 | !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; | ||
5219 | return longestCommonID; | ||
5220 | } | ||
5221 | |||
5222 | /** | ||
5223 | * Traverses the parent path between two IDs (either up or down). The IDs must | ||
5224 | * not be the same, and there must exist a parent path between them. If the | ||
5225 | * callback returns `false`, traversal is stopped. | ||
5226 | * | ||
5227 | * @param {?string} start ID at which to start traversal. | ||
5228 | * @param {?string} stop ID at which to end traversal. | ||
5229 | * @param {function} cb Callback to invoke each ID with. | ||
5230 | * @param {*} arg Argument to invoke the callback with. | ||
5231 | * @param {?boolean} skipFirst Whether or not to skip the first node. | ||
5232 | * @param {?boolean} skipLast Whether or not to skip the last node. | ||
5233 | * @private | ||
5234 | */ | ||
5235 | function traverseParentPath(start, stop, cb, arg, skipFirst, skipLast) { | ||
5236 | start = start || ''; | ||
5237 | stop = stop || ''; | ||
5238 | !(start !== stop) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'traverseParentPath(...): Cannot traverse from and to the same ID, `%s`.', start) : invariant(false) : undefined; | ||
5239 | var traverseUp = isAncestorIDOf(stop, start); | ||
5240 | !(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; | ||
5241 | // Traverse from `start` to `stop` one depth at a time. | ||
5242 | var depth = 0; | ||
5243 | var traverse = traverseUp ? getParentID : getNextDescendantID; | ||
5244 | for (var id = start;; /* until break */id = traverse(id, stop)) { | ||
5245 | var ret; | ||
5246 | if ((!skipFirst || id !== start) && (!skipLast || id !== stop)) { | ||
5247 | ret = cb(id, traverseUp, arg); | ||
5248 | } | ||
5249 | if (ret === false || id === stop) { | ||
5250 | // Only break //after// visiting `stop`. | ||
5251 | break; | ||
5252 | } | ||
5253 | !(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; | ||
5254 | } | ||
5255 | } | ||
5256 | |||
5257 | /** | ||
5258 | * Manages the IDs assigned to DOM representations of React components. This | ||
5259 | * uses a specific scheme in order to traverse the DOM efficiently (e.g. in | ||
5260 | * order to simulate events). | ||
5261 | * | ||
5262 | * @internal | ||
5263 | */ | ||
5264 | var ReactInstanceHandles = { | ||
5265 | |||
5266 | /** | ||
5267 | * Constructs a React root ID | ||
5268 | * @return {string} A React root ID. | ||
5269 | */ | ||
5270 | createReactRootID: function () { | ||
5271 | return getReactRootIDString(ReactRootIndex.createReactRootIndex()); | ||
5272 | }, | ||
5273 | |||
5274 | /** | ||
5275 | * Constructs a React ID by joining a root ID with a name. | ||
5276 | * | ||
5277 | * @param {string} rootID Root ID of a parent component. | ||
5278 | * @param {string} name A component's name (as flattened children). | ||
5279 | * @return {string} A React ID. | ||
5280 | * @internal | ||
5281 | */ | ||
5282 | createReactID: function (rootID, name) { | ||
5283 | return rootID + name; | ||
5284 | }, | ||
5285 | |||
5286 | /** | ||
5287 | * Gets the DOM ID of the React component that is the root of the tree that | ||
5288 | * contains the React component with the supplied DOM ID. | ||
5289 | * | ||
5290 | * @param {string} id DOM ID of a React component. | ||
5291 | * @return {?string} DOM ID of the React component that is the root. | ||
5292 | * @internal | ||
5293 | */ | ||
5294 | getReactRootIDFromNodeID: function (id) { | ||
5295 | if (id && id.charAt(0) === SEPARATOR && id.length > 1) { | ||
5296 | var index = id.indexOf(SEPARATOR, 1); | ||
5297 | return index > -1 ? id.substr(0, index) : id; | ||
5298 | } | ||
5299 | return null; | ||
5300 | }, | ||
5301 | |||
5302 | /** | ||
5303 | * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that | ||
5304 | * should would receive a `mouseEnter` or `mouseLeave` event. | ||
5305 | * | ||
5306 | * NOTE: Does not invoke the callback on the nearest common ancestor because | ||
5307 | * nothing "entered" or "left" that element. | ||
5308 | * | ||
5309 | * @param {string} leaveID ID being left. | ||
5310 | * @param {string} enterID ID being entered. | ||
5311 | * @param {function} cb Callback to invoke on each entered/left ID. | ||
5312 | * @param {*} upArg Argument to invoke the callback with on left IDs. | ||
5313 | * @param {*} downArg Argument to invoke the callback with on entered IDs. | ||
5314 | * @internal | ||
5315 | */ | ||
5316 | traverseEnterLeave: function (leaveID, enterID, cb, upArg, downArg) { | ||
5317 | var ancestorID = getFirstCommonAncestorID(leaveID, enterID); | ||
5318 | if (ancestorID !== leaveID) { | ||
5319 | traverseParentPath(leaveID, ancestorID, cb, upArg, false, true); | ||
5320 | } | ||
5321 | if (ancestorID !== enterID) { | ||
5322 | traverseParentPath(ancestorID, enterID, cb, downArg, true, false); | ||
5323 | } | ||
5324 | }, | ||
5325 | |||
5326 | /** | ||
5327 | * Simulates the traversal of a two-phase, capture/bubble event dispatch. | ||
5328 | * | ||
5329 | * NOTE: This traversal happens on IDs without touching the DOM. | ||
5330 | * | ||
5331 | * @param {string} targetID ID of the target node. | ||
5332 | * @param {function} cb Callback to invoke. | ||
5333 | * @param {*} arg Argument to invoke the callback with. | ||
5334 | * @internal | ||
5335 | */ | ||
5336 | traverseTwoPhase: function (targetID, cb, arg) { | ||
5337 | if (targetID) { | ||
5338 | traverseParentPath('', targetID, cb, arg, true, false); | ||
5339 | traverseParentPath(targetID, '', cb, arg, false, true); | ||
5340 | } | ||
5341 | }, | ||
5342 | |||
5343 | /** | ||
5344 | * Same as `traverseTwoPhase` but skips the `targetID`. | ||
5345 | */ | ||
5346 | traverseTwoPhaseSkipTarget: function (targetID, cb, arg) { | ||
5347 | if (targetID) { | ||
5348 | traverseParentPath('', targetID, cb, arg, true, true); | ||
5349 | traverseParentPath(targetID, '', cb, arg, true, true); | ||
5350 | } | ||
5351 | }, | ||
5352 | |||
5353 | /** | ||
5354 | * Traverse a node ID, calling the supplied `cb` for each ancestor ID. For | ||
5355 | * example, passing `.0.$row-0.1` would result in `cb` getting called | ||
5356 | * with `.0`, `.0.$row-0`, and `.0.$row-0.1`. | ||
5357 | * | ||
5358 | * NOTE: This traversal happens on IDs without touching the DOM. | ||
5359 | * | ||
5360 | * @param {string} targetID ID of the target node. | ||
5361 | * @param {function} cb Callback to invoke. | ||
5362 | * @param {*} arg Argument to invoke the callback with. | ||
5363 | * @internal | ||
5364 | */ | ||
5365 | traverseAncestors: function (targetID, cb, arg) { | ||
5366 | traverseParentPath('', targetID, cb, arg, true, false); | ||
5367 | }, | ||
5368 | |||
5369 | getFirstCommonAncestorID: getFirstCommonAncestorID, | ||
5370 | |||
5371 | /** | ||
5372 | * Exposed for unit testing. | ||
5373 | * @private | ||
5374 | */ | ||
5375 | _getNextDescendantID: getNextDescendantID, | ||
5376 | |||
5377 | isAncestorIDOf: isAncestorIDOf, | ||
5378 | |||
5379 | SEPARATOR: SEPARATOR | ||
5380 | |||
5381 | }; | ||
5382 | |||
5383 | module.exports = ReactInstanceHandles; | ||
5384 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
5385 | |||
5386 | /***/ }, | ||
5387 | /* 48 */ | ||
5388 | /***/ function(module, exports) { | ||
5389 | |||
5390 | /** | ||
5391 | * Copyright 2013-2015, Facebook, Inc. | ||
5392 | * All rights reserved. | ||
5393 | * | ||
5394 | * This source code is licensed under the BSD-style license found in the | ||
5395 | * LICENSE file in the root directory of this source tree. An additional grant | ||
5396 | * of patent rights can be found in the PATENTS file in the same directory. | ||
5397 | * | ||
5398 | * @providesModule ReactRootIndex | ||
5399 | * @typechecks | ||
5400 | */ | ||
5401 | |||
5402 | 'use strict'; | ||
5403 | |||
5404 | var ReactRootIndexInjection = { | ||
5405 | /** | ||
5406 | * @param {function} _createReactRootIndex | ||
5407 | */ | ||
5408 | injectCreateReactRootIndex: function (_createReactRootIndex) { | ||
5409 | ReactRootIndex.createReactRootIndex = _createReactRootIndex; | ||
5410 | } | ||
5411 | }; | ||
5412 | |||
5413 | var ReactRootIndex = { | ||
5414 | createReactRootIndex: null, | ||
5415 | injection: ReactRootIndexInjection | ||
5416 | }; | ||
5417 | |||
5418 | module.exports = ReactRootIndex; | ||
5419 | |||
5420 | /***/ }, | ||
5421 | /* 49 */ | ||
5422 | /***/ function(module, exports) { | ||
5423 | |||
5424 | /** | ||
5425 | * Copyright 2013-2015, Facebook, Inc. | ||
5426 | * All rights reserved. | ||
5427 | * | ||
5428 | * This source code is licensed under the BSD-style license found in the | ||
5429 | * LICENSE file in the root directory of this source tree. An additional grant | ||
5430 | * of patent rights can be found in the PATENTS file in the same directory. | ||
5431 | * | ||
5432 | * @providesModule ReactInstanceMap | ||
5433 | */ | ||
5434 | |||
5435 | 'use strict'; | ||
5436 | |||
5437 | /** | ||
5438 | * `ReactInstanceMap` maintains a mapping from a public facing stateful | ||
5439 | * instance (key) and the internal representation (value). This allows public | ||
5440 | * methods to accept the user facing instance as an argument and map them back | ||
5441 | * to internal methods. | ||
5442 | */ | ||
5443 | |||
5444 | // TODO: Replace this with ES6: var ReactInstanceMap = new Map(); | ||
5445 | var ReactInstanceMap = { | ||
5446 | |||
5447 | /** | ||
5448 | * This API should be called `delete` but we'd have to make sure to always | ||
5449 | * transform these to strings for IE support. When this transform is fully | ||
5450 | * supported we can rename it. | ||
5451 | */ | ||
5452 | remove: function (key) { | ||
5453 | key._reactInternalInstance = undefined; | ||
5454 | }, | ||
5455 | |||
5456 | get: function (key) { | ||
5457 | return key._reactInternalInstance; | ||
5458 | }, | ||
5459 | |||
5460 | has: function (key) { | ||
5461 | return key._reactInternalInstance !== undefined; | ||
5462 | }, | ||
5463 | |||
5464 | set: function (key, value) { | ||
5465 | key._reactInternalInstance = value; | ||
5466 | } | ||
5467 | |||
5468 | }; | ||
5469 | |||
5470 | module.exports = ReactInstanceMap; | ||
5471 | |||
5472 | /***/ }, | ||
5473 | /* 50 */ | ||
5474 | /***/ function(module, exports, __webpack_require__) { | ||
5475 | |||
5476 | /** | ||
5477 | * Copyright 2013-2015, Facebook, Inc. | ||
5478 | * All rights reserved. | ||
5479 | * | ||
5480 | * This source code is licensed under the BSD-style license found in the | ||
5481 | * LICENSE file in the root directory of this source tree. An additional grant | ||
5482 | * of patent rights can be found in the PATENTS file in the same directory. | ||
5483 | * | ||
5484 | * @providesModule ReactMarkupChecksum | ||
5485 | */ | ||
5486 | |||
5487 | 'use strict'; | ||
5488 | |||
5489 | var adler32 = __webpack_require__(51); | ||
5490 | |||
5491 | var TAG_END = /\/?>/; | ||
5492 | |||
5493 | var ReactMarkupChecksum = { | ||
5494 | CHECKSUM_ATTR_NAME: 'data-react-checksum', | ||
5495 | |||
5496 | /** | ||
5497 | * @param {string} markup Markup string | ||
5498 | * @return {string} Markup string with checksum attribute attached | ||
5499 | */ | ||
5500 | addChecksumToMarkup: function (markup) { | ||
5501 | var checksum = adler32(markup); | ||
5502 | |||
5503 | // Add checksum (handle both parent tags and self-closing tags) | ||
5504 | return markup.replace(TAG_END, ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '"$&'); | ||
5505 | }, | ||
5506 | |||
5507 | /** | ||
5508 | * @param {string} markup to use | ||
5509 | * @param {DOMElement} element root React element | ||
5510 | * @returns {boolean} whether or not the markup is the same | ||
5511 | */ | ||
5512 | canReuseMarkup: function (markup, element) { | ||
5513 | var existingChecksum = element.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME); | ||
5514 | existingChecksum = existingChecksum && parseInt(existingChecksum, 10); | ||
5515 | var markupChecksum = adler32(markup); | ||
5516 | return markupChecksum === existingChecksum; | ||
5517 | } | ||
5518 | }; | ||
5519 | |||
5520 | module.exports = ReactMarkupChecksum; | ||
5521 | |||
5522 | /***/ }, | ||
5523 | /* 51 */ | ||
5524 | /***/ function(module, exports) { | ||
5525 | |||
5526 | /** | ||
5527 | * Copyright 2013-2015, Facebook, Inc. | ||
5528 | * All rights reserved. | ||
5529 | * | ||
5530 | * This source code is licensed under the BSD-style license found in the | ||
5531 | * LICENSE file in the root directory of this source tree. An additional grant | ||
5532 | * of patent rights can be found in the PATENTS file in the same directory. | ||
5533 | * | ||
5534 | * @providesModule adler32 | ||
5535 | */ | ||
5536 | |||
5537 | 'use strict'; | ||
5538 | |||
5539 | var MOD = 65521; | ||
5540 | |||
5541 | // adler32 is not cryptographically strong, and is only used to sanity check that | ||
5542 | // markup generated on the server matches the markup generated on the client. | ||
5543 | // This implementation (a modified version of the SheetJS version) has been optimized | ||
5544 | // for our use case, at the expense of conforming to the adler32 specification | ||
5545 | // for non-ascii inputs. | ||
5546 | function adler32(data) { | ||
5547 | var a = 1; | ||
5548 | var b = 0; | ||
5549 | var i = 0; | ||
5550 | var l = data.length; | ||
5551 | var m = l & ~0x3; | ||
5552 | while (i < m) { | ||
5553 | for (; i < Math.min(i + 4096, m); i += 4) { | ||
5554 | b += (a += data.charCodeAt(i)) + (a += data.charCodeAt(i + 1)) + (a += data.charCodeAt(i + 2)) + (a += data.charCodeAt(i + 3)); | ||
5555 | } | ||
5556 | a %= MOD; | ||
5557 | b %= MOD; | ||
5558 | } | ||
5559 | for (; i < l; i++) { | ||
5560 | b += a += data.charCodeAt(i); | ||
5561 | } | ||
5562 | a %= MOD; | ||
5563 | b %= MOD; | ||
5564 | return a | b << 16; | ||
5565 | } | ||
5566 | |||
5567 | module.exports = adler32; | ||
5568 | |||
5569 | /***/ }, | ||
5570 | /* 52 */ | ||
5571 | /***/ function(module, exports, __webpack_require__) { | ||
5572 | |||
5573 | /** | ||
5574 | * Copyright 2013-2015, Facebook, Inc. | ||
5575 | * All rights reserved. | ||
5576 | * | ||
5577 | * This source code is licensed under the BSD-style license found in the | ||
5578 | * LICENSE file in the root directory of this source tree. An additional grant | ||
5579 | * of patent rights can be found in the PATENTS file in the same directory. | ||
5580 | * | ||
5581 | * @providesModule ReactReconciler | ||
5582 | */ | ||
5583 | |||
5584 | 'use strict'; | ||
5585 | |||
5586 | var ReactRef = __webpack_require__(53); | ||
5587 | |||
5588 | /** | ||
5589 | * Helper to call ReactRef.attachRefs with this composite component, split out | ||
5590 | * to avoid allocations in the transaction mount-ready queue. | ||
5591 | */ | ||
5592 | function attachRefs() { | ||
5593 | ReactRef.attachRefs(this, this._currentElement); | ||
5594 | } | ||
5595 | |||
5596 | var ReactReconciler = { | ||
5597 | |||
5598 | /** | ||
5599 | * Initializes the component, renders markup, and registers event listeners. | ||
5600 | * | ||
5601 | * @param {ReactComponent} internalInstance | ||
5602 | * @param {string} rootID DOM ID of the root node. | ||
5603 | * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction | ||
5604 | * @return {?string} Rendered markup to be inserted into the DOM. | ||
5605 | * @final | ||
5606 | * @internal | ||
5607 | */ | ||
5608 | mountComponent: function (internalInstance, rootID, transaction, context) { | ||
5609 | var markup = internalInstance.mountComponent(rootID, transaction, context); | ||
5610 | if (internalInstance._currentElement && internalInstance._currentElement.ref != null) { | ||
5611 | transaction.getReactMountReady().enqueue(attachRefs, internalInstance); | ||
5612 | } | ||
5613 | return markup; | ||
5614 | }, | ||
5615 | |||
5616 | /** | ||
5617 | * Releases any resources allocated by `mountComponent`. | ||
5618 | * | ||
5619 | * @final | ||
5620 | * @internal | ||
5621 | */ | ||
5622 | unmountComponent: function (internalInstance) { | ||
5623 | ReactRef.detachRefs(internalInstance, internalInstance._currentElement); | ||
5624 | internalInstance.unmountComponent(); | ||
5625 | }, | ||
5626 | |||
5627 | /** | ||
5628 | * Update a component using a new element. | ||
5629 | * | ||
5630 | * @param {ReactComponent} internalInstance | ||
5631 | * @param {ReactElement} nextElement | ||
5632 | * @param {ReactReconcileTransaction} transaction | ||
5633 | * @param {object} context | ||
5634 | * @internal | ||
5635 | */ | ||
5636 | receiveComponent: function (internalInstance, nextElement, transaction, context) { | ||
5637 | var prevElement = internalInstance._currentElement; | ||
5638 | |||
5639 | if (nextElement === prevElement && context === internalInstance._context) { | ||
5640 | // Since elements are immutable after the owner is rendered, | ||
5641 | // we can do a cheap identity compare here to determine if this is a | ||
5642 | // superfluous reconcile. It's possible for state to be mutable but such | ||
5643 | // change should trigger an update of the owner which would recreate | ||
5644 | // the element. We explicitly check for the existence of an owner since | ||
5645 | // it's possible for an element created outside a composite to be | ||
5646 | // deeply mutated and reused. | ||
5647 | |||
5648 | // TODO: Bailing out early is just a perf optimization right? | ||
5649 | // TODO: Removing the return statement should affect correctness? | ||
5650 | return; | ||
5651 | } | ||
5652 | |||
5653 | var refsChanged = ReactRef.shouldUpdateRefs(prevElement, nextElement); | ||
5654 | |||
5655 | if (refsChanged) { | ||
5656 | ReactRef.detachRefs(internalInstance, prevElement); | ||
5657 | } | ||
5658 | |||
5659 | internalInstance.receiveComponent(nextElement, transaction, context); | ||
5660 | |||
5661 | if (refsChanged && internalInstance._currentElement && internalInstance._currentElement.ref != null) { | ||
5662 | transaction.getReactMountReady().enqueue(attachRefs, internalInstance); | ||
5663 | } | ||
5664 | }, | ||
5665 | |||
5666 | /** | ||
5667 | * Flush any dirty changes in a component. | ||
5668 | * | ||
5669 | * @param {ReactComponent} internalInstance | ||
5670 | * @param {ReactReconcileTransaction} transaction | ||
5671 | * @internal | ||
5672 | */ | ||
5673 | performUpdateIfNecessary: function (internalInstance, transaction) { | ||
5674 | internalInstance.performUpdateIfNecessary(transaction); | ||
5675 | } | ||
5676 | |||
5677 | }; | ||
5678 | |||
5679 | module.exports = ReactReconciler; | ||
5680 | |||
5681 | /***/ }, | ||
5682 | /* 53 */ | ||
5683 | /***/ function(module, exports, __webpack_require__) { | ||
5684 | |||
5685 | /** | ||
5686 | * Copyright 2013-2015, Facebook, Inc. | ||
5687 | * All rights reserved. | ||
5688 | * | ||
5689 | * This source code is licensed under the BSD-style license found in the | ||
5690 | * LICENSE file in the root directory of this source tree. An additional grant | ||
5691 | * of patent rights can be found in the PATENTS file in the same directory. | ||
5692 | * | ||
5693 | * @providesModule ReactRef | ||
5694 | */ | ||
5695 | |||
5696 | 'use strict'; | ||
5697 | |||
5698 | var ReactOwner = __webpack_require__(54); | ||
5699 | |||
5700 | var ReactRef = {}; | ||
5701 | |||
5702 | function attachRef(ref, component, owner) { | ||
5703 | if (typeof ref === 'function') { | ||
5704 | ref(component.getPublicInstance()); | ||
5705 | } else { | ||
5706 | // Legacy ref | ||
5707 | ReactOwner.addComponentAsRefTo(component, ref, owner); | ||
5708 | } | ||
5709 | } | ||
5710 | |||
5711 | function detachRef(ref, component, owner) { | ||
5712 | if (typeof ref === 'function') { | ||
5713 | ref(null); | ||
5714 | } else { | ||
5715 | // Legacy ref | ||
5716 | ReactOwner.removeComponentAsRefFrom(component, ref, owner); | ||
5717 | } | ||
5718 | } | ||
5719 | |||
5720 | ReactRef.attachRefs = function (instance, element) { | ||
5721 | if (element === null || element === false) { | ||
5722 | return; | ||
5723 | } | ||
5724 | var ref = element.ref; | ||
5725 | if (ref != null) { | ||
5726 | attachRef(ref, instance, element._owner); | ||
5727 | } | ||
5728 | }; | ||
5729 | |||
5730 | ReactRef.shouldUpdateRefs = function (prevElement, nextElement) { | ||
5731 | // If either the owner or a `ref` has changed, make sure the newest owner | ||
5732 | // has stored a reference to `this`, and the previous owner (if different) | ||
5733 | // has forgotten the reference to `this`. We use the element instead | ||
5734 | // of the public this.props because the post processing cannot determine | ||
5735 | // a ref. The ref conceptually lives on the element. | ||
5736 | |||
5737 | // TODO: Should this even be possible? The owner cannot change because | ||
5738 | // it's forbidden by shouldUpdateReactComponent. The ref can change | ||
5739 | // if you swap the keys of but not the refs. Reconsider where this check | ||
5740 | // is made. It probably belongs where the key checking and | ||
5741 | // instantiateReactComponent is done. | ||
5742 | |||
5743 | var prevEmpty = prevElement === null || prevElement === false; | ||
5744 | var nextEmpty = nextElement === null || nextElement === false; | ||
5745 | |||
5746 | return( | ||
5747 | // This has a few false positives w/r/t empty components. | ||
5748 | prevEmpty || nextEmpty || nextElement._owner !== prevElement._owner || nextElement.ref !== prevElement.ref | ||
5749 | ); | ||
5750 | }; | ||
5751 | |||
5752 | ReactRef.detachRefs = function (instance, element) { | ||
5753 | if (element === null || element === false) { | ||
5754 | return; | ||
5755 | } | ||
5756 | var ref = element.ref; | ||
5757 | if (ref != null) { | ||
5758 | detachRef(ref, instance, element._owner); | ||
5759 | } | ||
5760 | }; | ||
5761 | |||
5762 | module.exports = ReactRef; | ||
5763 | |||
5764 | /***/ }, | ||
5765 | /* 54 */ | ||
5766 | /***/ function(module, exports, __webpack_require__) { | ||
5767 | |||
5768 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
5769 | * Copyright 2013-2015, Facebook, Inc. | ||
5770 | * All rights reserved. | ||
5771 | * | ||
5772 | * This source code is licensed under the BSD-style license found in the | ||
5773 | * LICENSE file in the root directory of this source tree. An additional grant | ||
5774 | * of patent rights can be found in the PATENTS file in the same directory. | ||
5775 | * | ||
5776 | * @providesModule ReactOwner | ||
5777 | */ | ||
5778 | |||
5779 | 'use strict'; | ||
5780 | |||
5781 | var invariant = __webpack_require__(15); | ||
5782 | |||
5783 | /** | ||
5784 | * ReactOwners are capable of storing references to owned components. | ||
5785 | * | ||
5786 | * All components are capable of //being// referenced by owner components, but | ||
5787 | * only ReactOwner components are capable of //referencing// owned components. | ||
5788 | * The named reference is known as a "ref". | ||
5789 | * | ||
5790 | * Refs are available when mounted and updated during reconciliation. | ||
5791 | * | ||
5792 | * var MyComponent = React.createClass({ | ||
5793 | * render: function() { | ||
5794 | * return ( | ||
5795 | * <div onClick={this.handleClick}> | ||
5796 | * <CustomComponent ref="custom" /> | ||
5797 | * </div> | ||
5798 | * ); | ||
5799 | * }, | ||
5800 | * handleClick: function() { | ||
5801 | * this.refs.custom.handleClick(); | ||
5802 | * }, | ||
5803 | * componentDidMount: function() { | ||
5804 | * this.refs.custom.initialize(); | ||
5805 | * } | ||
5806 | * }); | ||
5807 | * | ||
5808 | * Refs should rarely be used. When refs are used, they should only be done to | ||
5809 | * control data that is not handled by React's data flow. | ||
5810 | * | ||
5811 | * @class ReactOwner | ||
5812 | */ | ||
5813 | var ReactOwner = { | ||
5814 | |||
5815 | /** | ||
5816 | * @param {?object} object | ||
5817 | * @return {boolean} True if `object` is a valid owner. | ||
5818 | * @final | ||
5819 | */ | ||
5820 | isValidOwner: function (object) { | ||
5821 | return !!(object && typeof object.attachRef === 'function' && typeof object.detachRef === 'function'); | ||
5822 | }, | ||
5823 | |||
5824 | /** | ||
5825 | * Adds a component by ref to an owner component. | ||
5826 | * | ||
5827 | * @param {ReactComponent} component Component to reference. | ||
5828 | * @param {string} ref Name by which to refer to the component. | ||
5829 | * @param {ReactOwner} owner Component on which to record the ref. | ||
5830 | * @final | ||
5831 | * @internal | ||
5832 | */ | ||
5833 | addComponentAsRefTo: function (component, ref, owner) { | ||
5834 | !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; | ||
5835 | owner.attachRef(ref, component); | ||
5836 | }, | ||
5837 | |||
5838 | /** | ||
5839 | * Removes a component by ref from an owner component. | ||
5840 | * | ||
5841 | * @param {ReactComponent} component Component to dereference. | ||
5842 | * @param {string} ref Name of the ref to remove. | ||
5843 | * @param {ReactOwner} owner Component on which the ref is recorded. | ||
5844 | * @final | ||
5845 | * @internal | ||
5846 | */ | ||
5847 | removeComponentAsRefFrom: function (component, ref, owner) { | ||
5848 | !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; | ||
5849 | // Check that `component` is still the current ref because we do not want to | ||
5850 | // detach the ref if another component stole it. | ||
5851 | if (owner.getPublicInstance().refs[ref] === component.getPublicInstance()) { | ||
5852 | owner.detachRef(ref); | ||
5853 | } | ||
5854 | } | ||
5855 | |||
5856 | }; | ||
5857 | |||
5858 | module.exports = ReactOwner; | ||
5859 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
5860 | |||
5861 | /***/ }, | ||
5862 | /* 55 */ | ||
5863 | /***/ function(module, exports, __webpack_require__) { | ||
5864 | |||
5865 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
5866 | * Copyright 2015, Facebook, Inc. | ||
5867 | * All rights reserved. | ||
5868 | * | ||
5869 | * This source code is licensed under the BSD-style license found in the | ||
5870 | * LICENSE file in the root directory of this source tree. An additional grant | ||
5871 | * of patent rights can be found in the PATENTS file in the same directory. | ||
5872 | * | ||
5873 | * @providesModule ReactUpdateQueue | ||
5874 | */ | ||
5875 | |||
5876 | 'use strict'; | ||
5877 | |||
5878 | var ReactCurrentOwner = __webpack_require__(7); | ||
5879 | var ReactElement = __webpack_require__(44); | ||
5880 | var ReactInstanceMap = __webpack_require__(49); | ||
5881 | var ReactUpdates = __webpack_require__(56); | ||
5882 | |||
5883 | var assign = __webpack_require__(41); | ||
5884 | var invariant = __webpack_require__(15); | ||
5885 | var warning = __webpack_require__(27); | ||
5886 | |||
5887 | function enqueueUpdate(internalInstance) { | ||
5888 | ReactUpdates.enqueueUpdate(internalInstance); | ||
5889 | } | ||
5890 | |||
5891 | function getInternalInstanceReadyForUpdate(publicInstance, callerName) { | ||
5892 | var internalInstance = ReactInstanceMap.get(publicInstance); | ||
5893 | if (!internalInstance) { | ||
5894 | if (process.env.NODE_ENV !== 'production') { | ||
5895 | // Only warn when we have a callerName. Otherwise we should be silent. | ||
5896 | // We're probably calling from enqueueCallback. We don't want to warn | ||
5897 | // there because we already warned for the corresponding lifecycle method. | ||
5898 | 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; | ||
5899 | } | ||
5900 | return null; | ||
5901 | } | ||
5902 | |||
5903 | if (process.env.NODE_ENV !== 'production') { | ||
5904 | 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; | ||
5905 | } | ||
5906 | |||
5907 | return internalInstance; | ||
5908 | } | ||
5909 | |||
5910 | /** | ||
5911 | * ReactUpdateQueue allows for state updates to be scheduled into a later | ||
5912 | * reconciliation step. | ||
5913 | */ | ||
5914 | var ReactUpdateQueue = { | ||
5915 | |||
5916 | /** | ||
5917 | * Checks whether or not this composite component is mounted. | ||
5918 | * @param {ReactClass} publicInstance The instance we want to test. | ||
5919 | * @return {boolean} True if mounted, false otherwise. | ||
5920 | * @protected | ||
5921 | * @final | ||
5922 | */ | ||
5923 | isMounted: function (publicInstance) { | ||
5924 | if (process.env.NODE_ENV !== 'production') { | ||
5925 | var owner = ReactCurrentOwner.current; | ||
5926 | if (owner !== null) { | ||
5927 | 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; | ||
5928 | owner._warnedAboutRefsInRender = true; | ||
5929 | } | ||
5930 | } | ||
5931 | var internalInstance = ReactInstanceMap.get(publicInstance); | ||
5932 | if (internalInstance) { | ||
5933 | // During componentWillMount and render this will still be null but after | ||
5934 | // that will always render to something. At least for now. So we can use | ||
5935 | // this hack. | ||
5936 | return !!internalInstance._renderedComponent; | ||
5937 | } else { | ||
5938 | return false; | ||
5939 | } | ||
5940 | }, | ||
5941 | |||
5942 | /** | ||
5943 | * Enqueue a callback that will be executed after all the pending updates | ||
5944 | * have processed. | ||
5945 | * | ||
5946 | * @param {ReactClass} publicInstance The instance to use as `this` context. | ||
5947 | * @param {?function} callback Called after state is updated. | ||
5948 | * @internal | ||
5949 | */ | ||
5950 | enqueueCallback: function (publicInstance, callback) { | ||
5951 | !(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; | ||
5952 | var internalInstance = getInternalInstanceReadyForUpdate(publicInstance); | ||
5953 | |||
5954 | // Previously we would throw an error if we didn't have an internal | ||
5955 | // instance. Since we want to make it a no-op instead, we mirror the same | ||
5956 | // behavior we have in other enqueue* methods. | ||
5957 | // We also need to ignore callbacks in componentWillMount. See | ||
5958 | // enqueueUpdates. | ||
5959 | if (!internalInstance) { | ||
5960 | return null; | ||
5961 | } | ||
5962 | |||
5963 | if (internalInstance._pendingCallbacks) { | ||
5964 | internalInstance._pendingCallbacks.push(callback); | ||
5965 | } else { | ||
5966 | internalInstance._pendingCallbacks = [callback]; | ||
5967 | } | ||
5968 | // TODO: The callback here is ignored when setState is called from | ||
5969 | // componentWillMount. Either fix it or disallow doing so completely in | ||
5970 | // favor of getInitialState. Alternatively, we can disallow | ||
5971 | // componentWillMount during server-side rendering. | ||
5972 | enqueueUpdate(internalInstance); | ||
5973 | }, | ||
5974 | |||
5975 | enqueueCallbackInternal: function (internalInstance, callback) { | ||
5976 | !(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; | ||
5977 | if (internalInstance._pendingCallbacks) { | ||
5978 | internalInstance._pendingCallbacks.push(callback); | ||
5979 | } else { | ||
5980 | internalInstance._pendingCallbacks = [callback]; | ||
5981 | } | ||
5982 | enqueueUpdate(internalInstance); | ||
5983 | }, | ||
5984 | |||
5985 | /** | ||
5986 | * Forces an update. This should only be invoked when it is known with | ||
5987 | * certainty that we are **not** in a DOM transaction. | ||
5988 | * | ||
5989 | * You may want to call this when you know that some deeper aspect of the | ||
5990 | * component's state has changed but `setState` was not called. | ||
5991 | * | ||
5992 | * This will not invoke `shouldComponentUpdate`, but it will invoke | ||
5993 | * `componentWillUpdate` and `componentDidUpdate`. | ||
5994 | * | ||
5995 | * @param {ReactClass} publicInstance The instance that should rerender. | ||
5996 | * @internal | ||
5997 | */ | ||
5998 | enqueueForceUpdate: function (publicInstance) { | ||
5999 | var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'forceUpdate'); | ||
6000 | |||
6001 | if (!internalInstance) { | ||
6002 | return; | ||
6003 | } | ||
6004 | |||
6005 | internalInstance._pendingForceUpdate = true; | ||
6006 | |||
6007 | enqueueUpdate(internalInstance); | ||
6008 | }, | ||
6009 | |||
6010 | /** | ||
6011 | * Replaces all of the state. Always use this or `setState` to mutate state. | ||
6012 | * You should treat `this.state` as immutable. | ||
6013 | * | ||
6014 | * There is no guarantee that `this.state` will be immediately updated, so | ||
6015 | * accessing `this.state` after calling this method may return the old value. | ||
6016 | * | ||
6017 | * @param {ReactClass} publicInstance The instance that should rerender. | ||
6018 | * @param {object} completeState Next state. | ||
6019 | * @internal | ||
6020 | */ | ||
6021 | enqueueReplaceState: function (publicInstance, completeState) { | ||
6022 | var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceState'); | ||
6023 | |||
6024 | if (!internalInstance) { | ||
6025 | return; | ||
6026 | } | ||
6027 | |||
6028 | internalInstance._pendingStateQueue = [completeState]; | ||
6029 | internalInstance._pendingReplaceState = true; | ||
6030 | |||
6031 | enqueueUpdate(internalInstance); | ||
6032 | }, | ||
6033 | |||
6034 | /** | ||
6035 | * Sets a subset of the state. This only exists because _pendingState is | ||
6036 | * internal. This provides a merging strategy that is not available to deep | ||
6037 | * properties which is confusing. TODO: Expose pendingState or don't use it | ||
6038 | * during the merge. | ||
6039 | * | ||
6040 | * @param {ReactClass} publicInstance The instance that should rerender. | ||
6041 | * @param {object} partialState Next partial state to be merged with state. | ||
6042 | * @internal | ||
6043 | */ | ||
6044 | enqueueSetState: function (publicInstance, partialState) { | ||
6045 | var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setState'); | ||
6046 | |||
6047 | if (!internalInstance) { | ||
6048 | return; | ||
6049 | } | ||
6050 | |||
6051 | var queue = internalInstance._pendingStateQueue || (internalInstance._pendingStateQueue = []); | ||
6052 | queue.push(partialState); | ||
6053 | |||
6054 | enqueueUpdate(internalInstance); | ||
6055 | }, | ||
6056 | |||
6057 | /** | ||
6058 | * Sets a subset of the props. | ||
6059 | * | ||
6060 | * @param {ReactClass} publicInstance The instance that should rerender. | ||
6061 | * @param {object} partialProps Subset of the next props. | ||
6062 | * @internal | ||
6063 | */ | ||
6064 | enqueueSetProps: function (publicInstance, partialProps) { | ||
6065 | var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setProps'); | ||
6066 | if (!internalInstance) { | ||
6067 | return; | ||
6068 | } | ||
6069 | ReactUpdateQueue.enqueueSetPropsInternal(internalInstance, partialProps); | ||
6070 | }, | ||
6071 | |||
6072 | enqueueSetPropsInternal: function (internalInstance, partialProps) { | ||
6073 | var topLevelWrapper = internalInstance._topLevelWrapper; | ||
6074 | !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; | ||
6075 | |||
6076 | // Merge with the pending element if it exists, otherwise with existing | ||
6077 | // element props. | ||
6078 | var wrapElement = topLevelWrapper._pendingElement || topLevelWrapper._currentElement; | ||
6079 | var element = wrapElement.props; | ||
6080 | var props = assign({}, element.props, partialProps); | ||
6081 | topLevelWrapper._pendingElement = ReactElement.cloneAndReplaceProps(wrapElement, ReactElement.cloneAndReplaceProps(element, props)); | ||
6082 | |||
6083 | enqueueUpdate(topLevelWrapper); | ||
6084 | }, | ||
6085 | |||
6086 | /** | ||
6087 | * Replaces all of the props. | ||
6088 | * | ||
6089 | * @param {ReactClass} publicInstance The instance that should rerender. | ||
6090 | * @param {object} props New props. | ||
6091 | * @internal | ||
6092 | */ | ||
6093 | enqueueReplaceProps: function (publicInstance, props) { | ||
6094 | var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceProps'); | ||
6095 | if (!internalInstance) { | ||
6096 | return; | ||
6097 | } | ||
6098 | ReactUpdateQueue.enqueueReplacePropsInternal(internalInstance, props); | ||
6099 | }, | ||
6100 | |||
6101 | enqueueReplacePropsInternal: function (internalInstance, props) { | ||
6102 | var topLevelWrapper = internalInstance._topLevelWrapper; | ||
6103 | !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; | ||
6104 | |||
6105 | // Merge with the pending element if it exists, otherwise with existing | ||
6106 | // element props. | ||
6107 | var wrapElement = topLevelWrapper._pendingElement || topLevelWrapper._currentElement; | ||
6108 | var element = wrapElement.props; | ||
6109 | topLevelWrapper._pendingElement = ReactElement.cloneAndReplaceProps(wrapElement, ReactElement.cloneAndReplaceProps(element, props)); | ||
6110 | |||
6111 | enqueueUpdate(topLevelWrapper); | ||
6112 | }, | ||
6113 | |||
6114 | enqueueElementInternal: function (internalInstance, newElement) { | ||
6115 | internalInstance._pendingElement = newElement; | ||
6116 | enqueueUpdate(internalInstance); | ||
6117 | } | ||
6118 | |||
6119 | }; | ||
6120 | |||
6121 | module.exports = ReactUpdateQueue; | ||
6122 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
6123 | |||
6124 | /***/ }, | ||
6125 | /* 56 */ | ||
6126 | /***/ function(module, exports, __webpack_require__) { | ||
6127 | |||
6128 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
6129 | * Copyright 2013-2015, Facebook, Inc. | ||
6130 | * All rights reserved. | ||
6131 | * | ||
6132 | * This source code is licensed under the BSD-style license found in the | ||
6133 | * LICENSE file in the root directory of this source tree. An additional grant | ||
6134 | * of patent rights can be found in the PATENTS file in the same directory. | ||
6135 | * | ||
6136 | * @providesModule ReactUpdates | ||
6137 | */ | ||
6138 | |||
6139 | 'use strict'; | ||
6140 | |||
6141 | var CallbackQueue = __webpack_require__(57); | ||
6142 | var PooledClass = __webpack_require__(58); | ||
6143 | var ReactPerf = __webpack_require__(20); | ||
6144 | var ReactReconciler = __webpack_require__(52); | ||
6145 | var Transaction = __webpack_require__(59); | ||
6146 | |||
6147 | var assign = __webpack_require__(41); | ||
6148 | var invariant = __webpack_require__(15); | ||
6149 | |||
6150 | var dirtyComponents = []; | ||
6151 | var asapCallbackQueue = CallbackQueue.getPooled(); | ||
6152 | var asapEnqueued = false; | ||
6153 | |||
6154 | var batchingStrategy = null; | ||
6155 | |||
6156 | function ensureInjected() { | ||
6157 | !(ReactUpdates.ReactReconcileTransaction && batchingStrategy) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must inject a reconcile transaction class and batching ' + 'strategy') : invariant(false) : undefined; | ||
6158 | } | ||
6159 | |||
6160 | var NESTED_UPDATES = { | ||
6161 | initialize: function () { | ||
6162 | this.dirtyComponentsLength = dirtyComponents.length; | ||
6163 | }, | ||
6164 | close: function () { | ||
6165 | if (this.dirtyComponentsLength !== dirtyComponents.length) { | ||
6166 | // Additional updates were enqueued by componentDidUpdate handlers or | ||
6167 | // similar; before our own UPDATE_QUEUEING wrapper closes, we want to run | ||
6168 | // these new updates so that if A's componentDidUpdate calls setState on | ||
6169 | // B, B will update before the callback A's updater provided when calling | ||
6170 | // setState. | ||
6171 | dirtyComponents.splice(0, this.dirtyComponentsLength); | ||
6172 | flushBatchedUpdates(); | ||
6173 | } else { | ||
6174 | dirtyComponents.length = 0; | ||
6175 | } | ||
6176 | } | ||
6177 | }; | ||
6178 | |||
6179 | var UPDATE_QUEUEING = { | ||
6180 | initialize: function () { | ||
6181 | this.callbackQueue.reset(); | ||
6182 | }, | ||
6183 | close: function () { | ||
6184 | this.callbackQueue.notifyAll(); | ||
6185 | } | ||
6186 | }; | ||
6187 | |||
6188 | var TRANSACTION_WRAPPERS = [NESTED_UPDATES, UPDATE_QUEUEING]; | ||
6189 | |||
6190 | function ReactUpdatesFlushTransaction() { | ||
6191 | this.reinitializeTransaction(); | ||
6192 | this.dirtyComponentsLength = null; | ||
6193 | this.callbackQueue = CallbackQueue.getPooled(); | ||
6194 | this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled( /* forceHTML */false); | ||
6195 | } | ||
6196 | |||
6197 | assign(ReactUpdatesFlushTransaction.prototype, Transaction.Mixin, { | ||
6198 | getTransactionWrappers: function () { | ||
6199 | return TRANSACTION_WRAPPERS; | ||
6200 | }, | ||
6201 | |||
6202 | destructor: function () { | ||
6203 | this.dirtyComponentsLength = null; | ||
6204 | CallbackQueue.release(this.callbackQueue); | ||
6205 | this.callbackQueue = null; | ||
6206 | ReactUpdates.ReactReconcileTransaction.release(this.reconcileTransaction); | ||
6207 | this.reconcileTransaction = null; | ||
6208 | }, | ||
6209 | |||
6210 | perform: function (method, scope, a) { | ||
6211 | // Essentially calls `this.reconcileTransaction.perform(method, scope, a)` | ||
6212 | // with this transaction's wrappers around it. | ||
6213 | return Transaction.Mixin.perform.call(this, this.reconcileTransaction.perform, this.reconcileTransaction, method, scope, a); | ||
6214 | } | ||
6215 | }); | ||
6216 | |||
6217 | PooledClass.addPoolingTo(ReactUpdatesFlushTransaction); | ||
6218 | |||
6219 | function batchedUpdates(callback, a, b, c, d, e) { | ||
6220 | ensureInjected(); | ||
6221 | batchingStrategy.batchedUpdates(callback, a, b, c, d, e); | ||
6222 | } | ||
6223 | |||
6224 | /** | ||
6225 | * Array comparator for ReactComponents by mount ordering. | ||
6226 | * | ||
6227 | * @param {ReactComponent} c1 first component you're comparing | ||
6228 | * @param {ReactComponent} c2 second component you're comparing | ||
6229 | * @return {number} Return value usable by Array.prototype.sort(). | ||
6230 | */ | ||
6231 | function mountOrderComparator(c1, c2) { | ||
6232 | return c1._mountOrder - c2._mountOrder; | ||
6233 | } | ||
6234 | |||
6235 | function runBatchedUpdates(transaction) { | ||
6236 | var len = transaction.dirtyComponentsLength; | ||
6237 | !(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; | ||
6238 | |||
6239 | // Since reconciling a component higher in the owner hierarchy usually (not | ||
6240 | // always -- see shouldComponentUpdate()) will reconcile children, reconcile | ||
6241 | // them before their children by sorting the array. | ||
6242 | dirtyComponents.sort(mountOrderComparator); | ||
6243 | |||
6244 | for (var i = 0; i < len; i++) { | ||
6245 | // If a component is unmounted before pending changes apply, it will still | ||
6246 | // be here, but we assume that it has cleared its _pendingCallbacks and | ||
6247 | // that performUpdateIfNecessary is a noop. | ||
6248 | var component = dirtyComponents[i]; | ||
6249 | |||
6250 | // If performUpdateIfNecessary happens to enqueue any new updates, we | ||
6251 | // shouldn't execute the callbacks until the next render happens, so | ||
6252 | // stash the callbacks first | ||
6253 | var callbacks = component._pendingCallbacks; | ||
6254 | component._pendingCallbacks = null; | ||
6255 | |||
6256 | ReactReconciler.performUpdateIfNecessary(component, transaction.reconcileTransaction); | ||
6257 | |||
6258 | if (callbacks) { | ||
6259 | for (var j = 0; j < callbacks.length; j++) { | ||
6260 | transaction.callbackQueue.enqueue(callbacks[j], component.getPublicInstance()); | ||
6261 | } | ||
6262 | } | ||
6263 | } | ||
6264 | } | ||
6265 | |||
6266 | var flushBatchedUpdates = function () { | ||
6267 | // ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents | ||
6268 | // array and perform any updates enqueued by mount-ready handlers (i.e., | ||
6269 | // componentDidUpdate) but we need to check here too in order to catch | ||
6270 | // updates enqueued by setState callbacks and asap calls. | ||
6271 | while (dirtyComponents.length || asapEnqueued) { | ||
6272 | if (dirtyComponents.length) { | ||
6273 | var transaction = ReactUpdatesFlushTransaction.getPooled(); | ||
6274 | transaction.perform(runBatchedUpdates, null, transaction); | ||
6275 | ReactUpdatesFlushTransaction.release(transaction); | ||
6276 | } | ||
6277 | |||
6278 | if (asapEnqueued) { | ||
6279 | asapEnqueued = false; | ||
6280 | var queue = asapCallbackQueue; | ||
6281 | asapCallbackQueue = CallbackQueue.getPooled(); | ||
6282 | queue.notifyAll(); | ||
6283 | CallbackQueue.release(queue); | ||
6284 | } | ||
6285 | } | ||
6286 | }; | ||
6287 | flushBatchedUpdates = ReactPerf.measure('ReactUpdates', 'flushBatchedUpdates', flushBatchedUpdates); | ||
6288 | |||
6289 | /** | ||
6290 | * Mark a component as needing a rerender, adding an optional callback to a | ||
6291 | * list of functions which will be executed once the rerender occurs. | ||
6292 | */ | ||
6293 | function enqueueUpdate(component) { | ||
6294 | ensureInjected(); | ||
6295 | |||
6296 | // Various parts of our code (such as ReactCompositeComponent's | ||
6297 | // _renderValidatedComponent) assume that calls to render aren't nested; | ||
6298 | // verify that that's the case. (This is called by each top-level update | ||
6299 | // function, like setProps, setState, forceUpdate, etc.; creation and | ||
6300 | // destruction of top-level components is guarded in ReactMount.) | ||
6301 | |||
6302 | if (!batchingStrategy.isBatchingUpdates) { | ||
6303 | batchingStrategy.batchedUpdates(enqueueUpdate, component); | ||
6304 | return; | ||
6305 | } | ||
6306 | |||
6307 | dirtyComponents.push(component); | ||
6308 | } | ||
6309 | |||
6310 | /** | ||
6311 | * Enqueue a callback to be run at the end of the current batching cycle. Throws | ||
6312 | * if no updates are currently being performed. | ||
6313 | */ | ||
6314 | function asap(callback, context) { | ||
6315 | !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; | ||
6316 | asapCallbackQueue.enqueue(callback, context); | ||
6317 | asapEnqueued = true; | ||
6318 | } | ||
6319 | |||
6320 | var ReactUpdatesInjection = { | ||
6321 | injectReconcileTransaction: function (ReconcileTransaction) { | ||
6322 | !ReconcileTransaction ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a reconcile transaction class') : invariant(false) : undefined; | ||
6323 | ReactUpdates.ReactReconcileTransaction = ReconcileTransaction; | ||
6324 | }, | ||
6325 | |||
6326 | injectBatchingStrategy: function (_batchingStrategy) { | ||
6327 | !_batchingStrategy ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batching strategy') : invariant(false) : undefined; | ||
6328 | !(typeof _batchingStrategy.batchedUpdates === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batchedUpdates() function') : invariant(false) : undefined; | ||
6329 | !(typeof _batchingStrategy.isBatchingUpdates === 'boolean') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide an isBatchingUpdates boolean attribute') : invariant(false) : undefined; | ||
6330 | batchingStrategy = _batchingStrategy; | ||
6331 | } | ||
6332 | }; | ||
6333 | |||
6334 | var ReactUpdates = { | ||
6335 | /** | ||
6336 | * React references `ReactReconcileTransaction` using this property in order | ||
6337 | * to allow dependency injection. | ||
6338 | * | ||
6339 | * @internal | ||
6340 | */ | ||
6341 | ReactReconcileTransaction: null, | ||
6342 | |||
6343 | batchedUpdates: batchedUpdates, | ||
6344 | enqueueUpdate: enqueueUpdate, | ||
6345 | flushBatchedUpdates: flushBatchedUpdates, | ||
6346 | injection: ReactUpdatesInjection, | ||
6347 | asap: asap | ||
6348 | }; | ||
6349 | |||
6350 | module.exports = ReactUpdates; | ||
6351 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
6352 | |||
6353 | /***/ }, | ||
6354 | /* 57 */ | ||
6355 | /***/ function(module, exports, __webpack_require__) { | ||
6356 | |||
6357 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
6358 | * Copyright 2013-2015, Facebook, Inc. | ||
6359 | * All rights reserved. | ||
6360 | * | ||
6361 | * This source code is licensed under the BSD-style license found in the | ||
6362 | * LICENSE file in the root directory of this source tree. An additional grant | ||
6363 | * of patent rights can be found in the PATENTS file in the same directory. | ||
6364 | * | ||
6365 | * @providesModule CallbackQueue | ||
6366 | */ | ||
6367 | |||
6368 | 'use strict'; | ||
6369 | |||
6370 | var PooledClass = __webpack_require__(58); | ||
6371 | |||
6372 | var assign = __webpack_require__(41); | ||
6373 | var invariant = __webpack_require__(15); | ||
6374 | |||
6375 | /** | ||
6376 | * A specialized pseudo-event module to help keep track of components waiting to | ||
6377 | * be notified when their DOM representations are available for use. | ||
6378 | * | ||
6379 | * This implements `PooledClass`, so you should never need to instantiate this. | ||
6380 | * Instead, use `CallbackQueue.getPooled()`. | ||
6381 | * | ||
6382 | * @class ReactMountReady | ||
6383 | * @implements PooledClass | ||
6384 | * @internal | ||
6385 | */ | ||
6386 | function CallbackQueue() { | ||
6387 | this._callbacks = null; | ||
6388 | this._contexts = null; | ||
6389 | } | ||
6390 | |||
6391 | assign(CallbackQueue.prototype, { | ||
6392 | |||
6393 | /** | ||
6394 | * Enqueues a callback to be invoked when `notifyAll` is invoked. | ||
6395 | * | ||
6396 | * @param {function} callback Invoked when `notifyAll` is invoked. | ||
6397 | * @param {?object} context Context to call `callback` with. | ||
6398 | * @internal | ||
6399 | */ | ||
6400 | enqueue: function (callback, context) { | ||
6401 | this._callbacks = this._callbacks || []; | ||
6402 | this._contexts = this._contexts || []; | ||
6403 | this._callbacks.push(callback); | ||
6404 | this._contexts.push(context); | ||
6405 | }, | ||
6406 | |||
6407 | /** | ||
6408 | * Invokes all enqueued callbacks and clears the queue. This is invoked after | ||
6409 | * the DOM representation of a component has been created or updated. | ||
6410 | * | ||
6411 | * @internal | ||
6412 | */ | ||
6413 | notifyAll: function () { | ||
6414 | var callbacks = this._callbacks; | ||
6415 | var contexts = this._contexts; | ||
6416 | if (callbacks) { | ||
6417 | !(callbacks.length === contexts.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Mismatched list of contexts in callback queue') : invariant(false) : undefined; | ||
6418 | this._callbacks = null; | ||
6419 | this._contexts = null; | ||
6420 | for (var i = 0; i < callbacks.length; i++) { | ||
6421 | callbacks[i].call(contexts[i]); | ||
6422 | } | ||
6423 | callbacks.length = 0; | ||
6424 | contexts.length = 0; | ||
6425 | } | ||
6426 | }, | ||
6427 | |||
6428 | /** | ||
6429 | * Resets the internal queue. | ||
6430 | * | ||
6431 | * @internal | ||
6432 | */ | ||
6433 | reset: function () { | ||
6434 | this._callbacks = null; | ||
6435 | this._contexts = null; | ||
6436 | }, | ||
6437 | |||
6438 | /** | ||
6439 | * `PooledClass` looks for this. | ||
6440 | */ | ||
6441 | destructor: function () { | ||
6442 | this.reset(); | ||
6443 | } | ||
6444 | |||
6445 | }); | ||
6446 | |||
6447 | PooledClass.addPoolingTo(CallbackQueue); | ||
6448 | |||
6449 | module.exports = CallbackQueue; | ||
6450 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
6451 | |||
6452 | /***/ }, | ||
6453 | /* 58 */ | ||
6454 | /***/ function(module, exports, __webpack_require__) { | ||
6455 | |||
6456 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
6457 | * Copyright 2013-2015, Facebook, Inc. | ||
6458 | * All rights reserved. | ||
6459 | * | ||
6460 | * This source code is licensed under the BSD-style license found in the | ||
6461 | * LICENSE file in the root directory of this source tree. An additional grant | ||
6462 | * of patent rights can be found in the PATENTS file in the same directory. | ||
6463 | * | ||
6464 | * @providesModule PooledClass | ||
6465 | */ | ||
6466 | |||
6467 | 'use strict'; | ||
6468 | |||
6469 | var invariant = __webpack_require__(15); | ||
6470 | |||
6471 | /** | ||
6472 | * Static poolers. Several custom versions for each potential number of | ||
6473 | * arguments. A completely generic pooler is easy to implement, but would | ||
6474 | * require accessing the `arguments` object. In each of these, `this` refers to | ||
6475 | * the Class itself, not an instance. If any others are needed, simply add them | ||
6476 | * here, or in their own files. | ||
6477 | */ | ||
6478 | var oneArgumentPooler = function (copyFieldsFrom) { | ||
6479 | var Klass = this; | ||
6480 | if (Klass.instancePool.length) { | ||
6481 | var instance = Klass.instancePool.pop(); | ||
6482 | Klass.call(instance, copyFieldsFrom); | ||
6483 | return instance; | ||
6484 | } else { | ||
6485 | return new Klass(copyFieldsFrom); | ||
6486 | } | ||
6487 | }; | ||
6488 | |||
6489 | var twoArgumentPooler = function (a1, a2) { | ||
6490 | var Klass = this; | ||
6491 | if (Klass.instancePool.length) { | ||
6492 | var instance = Klass.instancePool.pop(); | ||
6493 | Klass.call(instance, a1, a2); | ||
6494 | return instance; | ||
6495 | } else { | ||
6496 | return new Klass(a1, a2); | ||
6497 | } | ||
6498 | }; | ||
6499 | |||
6500 | var threeArgumentPooler = function (a1, a2, a3) { | ||
6501 | var Klass = this; | ||
6502 | if (Klass.instancePool.length) { | ||
6503 | var instance = Klass.instancePool.pop(); | ||
6504 | Klass.call(instance, a1, a2, a3); | ||
6505 | return instance; | ||
6506 | } else { | ||
6507 | return new Klass(a1, a2, a3); | ||
6508 | } | ||
6509 | }; | ||
6510 | |||
6511 | var fourArgumentPooler = function (a1, a2, a3, a4) { | ||
6512 | var Klass = this; | ||
6513 | if (Klass.instancePool.length) { | ||
6514 | var instance = Klass.instancePool.pop(); | ||
6515 | Klass.call(instance, a1, a2, a3, a4); | ||
6516 | return instance; | ||
6517 | } else { | ||
6518 | return new Klass(a1, a2, a3, a4); | ||
6519 | } | ||
6520 | }; | ||
6521 | |||
6522 | var fiveArgumentPooler = function (a1, a2, a3, a4, a5) { | ||
6523 | var Klass = this; | ||
6524 | if (Klass.instancePool.length) { | ||
6525 | var instance = Klass.instancePool.pop(); | ||
6526 | Klass.call(instance, a1, a2, a3, a4, a5); | ||
6527 | return instance; | ||
6528 | } else { | ||
6529 | return new Klass(a1, a2, a3, a4, a5); | ||
6530 | } | ||
6531 | }; | ||
6532 | |||
6533 | var standardReleaser = function (instance) { | ||
6534 | var Klass = this; | ||
6535 | !(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; | ||
6536 | instance.destructor(); | ||
6537 | if (Klass.instancePool.length < Klass.poolSize) { | ||
6538 | Klass.instancePool.push(instance); | ||
6539 | } | ||
6540 | }; | ||
6541 | |||
6542 | var DEFAULT_POOL_SIZE = 10; | ||
6543 | var DEFAULT_POOLER = oneArgumentPooler; | ||
6544 | |||
6545 | /** | ||
6546 | * Augments `CopyConstructor` to be a poolable class, augmenting only the class | ||
6547 | * itself (statically) not adding any prototypical fields. Any CopyConstructor | ||
6548 | * you give this may have a `poolSize` property, and will look for a | ||
6549 | * prototypical `destructor` on instances (optional). | ||
6550 | * | ||
6551 | * @param {Function} CopyConstructor Constructor that can be used to reset. | ||
6552 | * @param {Function} pooler Customizable pooler. | ||
6553 | */ | ||
6554 | var addPoolingTo = function (CopyConstructor, pooler) { | ||
6555 | var NewKlass = CopyConstructor; | ||
6556 | NewKlass.instancePool = []; | ||
6557 | NewKlass.getPooled = pooler || DEFAULT_POOLER; | ||
6558 | if (!NewKlass.poolSize) { | ||
6559 | NewKlass.poolSize = DEFAULT_POOL_SIZE; | ||
6560 | } | ||
6561 | NewKlass.release = standardReleaser; | ||
6562 | return NewKlass; | ||
6563 | }; | ||
6564 | |||
6565 | var PooledClass = { | ||
6566 | addPoolingTo: addPoolingTo, | ||
6567 | oneArgumentPooler: oneArgumentPooler, | ||
6568 | twoArgumentPooler: twoArgumentPooler, | ||
6569 | threeArgumentPooler: threeArgumentPooler, | ||
6570 | fourArgumentPooler: fourArgumentPooler, | ||
6571 | fiveArgumentPooler: fiveArgumentPooler | ||
6572 | }; | ||
6573 | |||
6574 | module.exports = PooledClass; | ||
6575 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
6576 | |||
6577 | /***/ }, | ||
6578 | /* 59 */ | ||
6579 | /***/ function(module, exports, __webpack_require__) { | ||
6580 | |||
6581 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
6582 | * Copyright 2013-2015, Facebook, Inc. | ||
6583 | * All rights reserved. | ||
6584 | * | ||
6585 | * This source code is licensed under the BSD-style license found in the | ||
6586 | * LICENSE file in the root directory of this source tree. An additional grant | ||
6587 | * of patent rights can be found in the PATENTS file in the same directory. | ||
6588 | * | ||
6589 | * @providesModule Transaction | ||
6590 | */ | ||
6591 | |||
6592 | 'use strict'; | ||
6593 | |||
6594 | var invariant = __webpack_require__(15); | ||
6595 | |||
6596 | /** | ||
6597 | * `Transaction` creates a black box that is able to wrap any method such that | ||
6598 | * certain invariants are maintained before and after the method is invoked | ||
6599 | * (Even if an exception is thrown while invoking the wrapped method). Whoever | ||
6600 | * instantiates a transaction can provide enforcers of the invariants at | ||
6601 | * creation time. The `Transaction` class itself will supply one additional | ||
6602 | * automatic invariant for you - the invariant that any transaction instance | ||
6603 | * should not be run while it is already being run. You would typically create a | ||
6604 | * single instance of a `Transaction` for reuse multiple times, that potentially | ||
6605 | * is used to wrap several different methods. Wrappers are extremely simple - | ||
6606 | * they only require implementing two methods. | ||
6607 | * | ||
6608 | * <pre> | ||
6609 | * wrappers (injected at creation time) | ||
6610 | * + + | ||
6611 | * | | | ||
6612 | * +-----------------|--------|--------------+ | ||
6613 | * | v | | | ||
6614 | * | +---------------+ | | | ||
6615 | * | +--| wrapper1 |---|----+ | | ||
6616 | * | | +---------------+ v | | | ||
6617 | * | | +-------------+ | | | ||
6618 | * | | +----| wrapper2 |--------+ | | ||
6619 | * | | | +-------------+ | | | | ||
6620 | * | | | | | | | ||
6621 | * | v v v v | wrapper | ||
6622 | * | +---+ +---+ +---------+ +---+ +---+ | invariants | ||
6623 | * perform(anyMethod) | | | | | | | | | | | | maintained | ||
6624 | * +----------------->|-|---|-|---|-->|anyMethod|---|---|-|---|-|--------> | ||
6625 | * | | | | | | | | | | | | | ||
6626 | * | | | | | | | | | | | | | ||
6627 | * | | | | | | | | | | | | | ||
6628 | * | +---+ +---+ +---------+ +---+ +---+ | | ||
6629 | * | initialize close | | ||
6630 | * +-----------------------------------------+ | ||
6631 | * </pre> | ||
6632 | * | ||
6633 | * Use cases: | ||
6634 | * - Preserving the input selection ranges before/after reconciliation. | ||
6635 | * Restoring selection even in the event of an unexpected error. | ||
6636 | * - Deactivating events while rearranging the DOM, preventing blurs/focuses, | ||
6637 | * while guaranteeing that afterwards, the event system is reactivated. | ||
6638 | * - Flushing a queue of collected DOM mutations to the main UI thread after a | ||
6639 | * reconciliation takes place in a worker thread. | ||
6640 | * - Invoking any collected `componentDidUpdate` callbacks after rendering new | ||
6641 | * content. | ||
6642 | * - (Future use case): Wrapping particular flushes of the `ReactWorker` queue | ||
6643 | * to preserve the `scrollTop` (an automatic scroll aware DOM). | ||
6644 | * - (Future use case): Layout calculations before and after DOM updates. | ||
6645 | * | ||
6646 | * Transactional plugin API: | ||
6647 | * - A module that has an `initialize` method that returns any precomputation. | ||
6648 | * - and a `close` method that accepts the precomputation. `close` is invoked | ||
6649 | * when the wrapped process is completed, or has failed. | ||
6650 | * | ||
6651 | * @param {Array<TransactionalWrapper>} transactionWrapper Wrapper modules | ||
6652 | * that implement `initialize` and `close`. | ||
6653 | * @return {Transaction} Single transaction for reuse in thread. | ||
6654 | * | ||
6655 | * @class Transaction | ||
6656 | */ | ||
6657 | var Mixin = { | ||
6658 | /** | ||
6659 | * Sets up this instance so that it is prepared for collecting metrics. Does | ||
6660 | * so such that this setup method may be used on an instance that is already | ||
6661 | * initialized, in a way that does not consume additional memory upon reuse. | ||
6662 | * That can be useful if you decide to make your subclass of this mixin a | ||
6663 | * "PooledClass". | ||
6664 | */ | ||
6665 | reinitializeTransaction: function () { | ||
6666 | this.transactionWrappers = this.getTransactionWrappers(); | ||
6667 | if (this.wrapperInitData) { | ||
6668 | this.wrapperInitData.length = 0; | ||
6669 | } else { | ||
6670 | this.wrapperInitData = []; | ||
6671 | } | ||
6672 | this._isInTransaction = false; | ||
6673 | }, | ||
6674 | |||
6675 | _isInTransaction: false, | ||
6676 | |||
6677 | /** | ||
6678 | * @abstract | ||
6679 | * @return {Array<TransactionWrapper>} Array of transaction wrappers. | ||
6680 | */ | ||
6681 | getTransactionWrappers: null, | ||
6682 | |||
6683 | isInTransaction: function () { | ||
6684 | return !!this._isInTransaction; | ||
6685 | }, | ||
6686 | |||
6687 | /** | ||
6688 | * Executes the function within a safety window. Use this for the top level | ||
6689 | * methods that result in large amounts of computation/mutations that would | ||
6690 | * need to be safety checked. The optional arguments helps prevent the need | ||
6691 | * to bind in many cases. | ||
6692 | * | ||
6693 | * @param {function} method Member of scope to call. | ||
6694 | * @param {Object} scope Scope to invoke from. | ||
6695 | * @param {Object?=} a Argument to pass to the method. | ||
6696 | * @param {Object?=} b Argument to pass to the method. | ||
6697 | * @param {Object?=} c Argument to pass to the method. | ||
6698 | * @param {Object?=} d Argument to pass to the method. | ||
6699 | * @param {Object?=} e Argument to pass to the method. | ||
6700 | * @param {Object?=} f Argument to pass to the method. | ||
6701 | * | ||
6702 | * @return {*} Return value from `method`. | ||
6703 | */ | ||
6704 | perform: function (method, scope, a, b, c, d, e, f) { | ||
6705 | !!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; | ||
6706 | var errorThrown; | ||
6707 | var ret; | ||
6708 | try { | ||
6709 | this._isInTransaction = true; | ||
6710 | // Catching errors makes debugging more difficult, so we start with | ||
6711 | // errorThrown set to true before setting it to false after calling | ||
6712 | // close -- if it's still set to true in the finally block, it means | ||
6713 | // one of these calls threw. | ||
6714 | errorThrown = true; | ||
6715 | this.initializeAll(0); | ||
6716 | ret = method.call(scope, a, b, c, d, e, f); | ||
6717 | errorThrown = false; | ||
6718 | } finally { | ||
6719 | try { | ||
6720 | if (errorThrown) { | ||
6721 | // If `method` throws, prefer to show that stack trace over any thrown | ||
6722 | // by invoking `closeAll`. | ||
6723 | try { | ||
6724 | this.closeAll(0); | ||
6725 | } catch (err) {} | ||
6726 | } else { | ||
6727 | // Since `method` didn't throw, we don't want to silence the exception | ||
6728 | // here. | ||
6729 | this.closeAll(0); | ||
6730 | } | ||
6731 | } finally { | ||
6732 | this._isInTransaction = false; | ||
6733 | } | ||
6734 | } | ||
6735 | return ret; | ||
6736 | }, | ||
6737 | |||
6738 | initializeAll: function (startIndex) { | ||
6739 | var transactionWrappers = this.transactionWrappers; | ||
6740 | for (var i = startIndex; i < transactionWrappers.length; i++) { | ||
6741 | var wrapper = transactionWrappers[i]; | ||
6742 | try { | ||
6743 | // Catching errors makes debugging more difficult, so we start with the | ||
6744 | // OBSERVED_ERROR state before overwriting it with the real return value | ||
6745 | // of initialize -- if it's still set to OBSERVED_ERROR in the finally | ||
6746 | // block, it means wrapper.initialize threw. | ||
6747 | this.wrapperInitData[i] = Transaction.OBSERVED_ERROR; | ||
6748 | this.wrapperInitData[i] = wrapper.initialize ? wrapper.initialize.call(this) : null; | ||
6749 | } finally { | ||
6750 | if (this.wrapperInitData[i] === Transaction.OBSERVED_ERROR) { | ||
6751 | // The initializer for wrapper i threw an error; initialize the | ||
6752 | // remaining wrappers but silence any exceptions from them to ensure | ||
6753 | // that the first error is the one to bubble up. | ||
6754 | try { | ||
6755 | this.initializeAll(i + 1); | ||
6756 | } catch (err) {} | ||
6757 | } | ||
6758 | } | ||
6759 | } | ||
6760 | }, | ||
6761 | |||
6762 | /** | ||
6763 | * Invokes each of `this.transactionWrappers.close[i]` functions, passing into | ||
6764 | * them the respective return values of `this.transactionWrappers.init[i]` | ||
6765 | * (`close`rs that correspond to initializers that failed will not be | ||
6766 | * invoked). | ||
6767 | */ | ||
6768 | closeAll: function (startIndex) { | ||
6769 | !this.isInTransaction() ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Transaction.closeAll(): Cannot close transaction when none are open.') : invariant(false) : undefined; | ||
6770 | var transactionWrappers = this.transactionWrappers; | ||
6771 | for (var i = startIndex; i < transactionWrappers.length; i++) { | ||
6772 | var wrapper = transactionWrappers[i]; | ||
6773 | var initData = this.wrapperInitData[i]; | ||
6774 | var errorThrown; | ||
6775 | try { | ||
6776 | // Catching errors makes debugging more difficult, so we start with | ||
6777 | // errorThrown set to true before setting it to false after calling | ||
6778 | // close -- if it's still set to true in the finally block, it means | ||
6779 | // wrapper.close threw. | ||
6780 | errorThrown = true; | ||
6781 | if (initData !== Transaction.OBSERVED_ERROR && wrapper.close) { | ||
6782 | wrapper.close.call(this, initData); | ||
6783 | } | ||
6784 | errorThrown = false; | ||
6785 | } finally { | ||
6786 | if (errorThrown) { | ||
6787 | // The closer for wrapper i threw an error; close the remaining | ||
6788 | // wrappers but silence any exceptions from them to ensure that the | ||
6789 | // first error is the one to bubble up. | ||
6790 | try { | ||
6791 | this.closeAll(i + 1); | ||
6792 | } catch (e) {} | ||
6793 | } | ||
6794 | } | ||
6795 | } | ||
6796 | this.wrapperInitData.length = 0; | ||
6797 | } | ||
6798 | }; | ||
6799 | |||
6800 | var Transaction = { | ||
6801 | |||
6802 | Mixin: Mixin, | ||
6803 | |||
6804 | /** | ||
6805 | * Token to look for to determine if an error occurred. | ||
6806 | */ | ||
6807 | OBSERVED_ERROR: {} | ||
6808 | |||
6809 | }; | ||
6810 | |||
6811 | module.exports = Transaction; | ||
6812 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
6813 | |||
6814 | /***/ }, | ||
6815 | /* 60 */ | ||
6816 | /***/ function(module, exports, __webpack_require__) { | ||
6817 | |||
6818 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
6819 | * Copyright 2013-2015, Facebook, Inc. | ||
6820 | * All rights reserved. | ||
6821 | * | ||
6822 | * This source code is licensed under the BSD-style license found in the | ||
6823 | * LICENSE file in the root directory of this source tree. An additional grant | ||
6824 | * of patent rights can be found in the PATENTS file in the same directory. | ||
6825 | * | ||
6826 | * @providesModule emptyObject | ||
6827 | */ | ||
6828 | |||
6829 | 'use strict'; | ||
6830 | |||
6831 | var emptyObject = {}; | ||
6832 | |||
6833 | if (process.env.NODE_ENV !== 'production') { | ||
6834 | Object.freeze(emptyObject); | ||
6835 | } | ||
6836 | |||
6837 | module.exports = emptyObject; | ||
6838 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
6839 | |||
6840 | /***/ }, | ||
6841 | /* 61 */ | ||
6842 | /***/ function(module, exports, __webpack_require__) { | ||
6843 | |||
6844 | /** | ||
6845 | * Copyright 2013-2015, Facebook, Inc. | ||
6846 | * All rights reserved. | ||
6847 | * | ||
6848 | * This source code is licensed under the BSD-style license found in the | ||
6849 | * LICENSE file in the root directory of this source tree. An additional grant | ||
6850 | * of patent rights can be found in the PATENTS file in the same directory. | ||
6851 | * | ||
6852 | * @providesModule containsNode | ||
6853 | * @typechecks | ||
6854 | */ | ||
6855 | |||
6856 | 'use strict'; | ||
6857 | |||
6858 | var isTextNode = __webpack_require__(62); | ||
6859 | |||
6860 | /*eslint-disable no-bitwise */ | ||
6861 | |||
6862 | /** | ||
6863 | * Checks if a given DOM node contains or is another DOM node. | ||
6864 | * | ||
6865 | * @param {?DOMNode} outerNode Outer DOM node. | ||
6866 | * @param {?DOMNode} innerNode Inner DOM node. | ||
6867 | * @return {boolean} True if `outerNode` contains or is `innerNode`. | ||
6868 | */ | ||
6869 | function containsNode(_x, _x2) { | ||
6870 | var _again = true; | ||
6871 | |||
6872 | _function: while (_again) { | ||
6873 | var outerNode = _x, | ||
6874 | innerNode = _x2; | ||
6875 | _again = false; | ||
6876 | |||
6877 | if (!outerNode || !innerNode) { | ||
6878 | return false; | ||
6879 | } else if (outerNode === innerNode) { | ||
6880 | return true; | ||
6881 | } else if (isTextNode(outerNode)) { | ||
6882 | return false; | ||
6883 | } else if (isTextNode(innerNode)) { | ||
6884 | _x = outerNode; | ||
6885 | _x2 = innerNode.parentNode; | ||
6886 | _again = true; | ||
6887 | continue _function; | ||
6888 | } else if (outerNode.contains) { | ||
6889 | return outerNode.contains(innerNode); | ||
6890 | } else if (outerNode.compareDocumentPosition) { | ||
6891 | return !!(outerNode.compareDocumentPosition(innerNode) & 16); | ||
6892 | } else { | ||
6893 | return false; | ||
6894 | } | ||
6895 | } | ||
6896 | } | ||
6897 | |||
6898 | module.exports = containsNode; | ||
6899 | |||
6900 | /***/ }, | ||
6901 | /* 62 */ | ||
6902 | /***/ function(module, exports, __webpack_require__) { | ||
6903 | |||
6904 | /** | ||
6905 | * Copyright 2013-2015, Facebook, Inc. | ||
6906 | * All rights reserved. | ||
6907 | * | ||
6908 | * This source code is licensed under the BSD-style license found in the | ||
6909 | * LICENSE file in the root directory of this source tree. An additional grant | ||
6910 | * of patent rights can be found in the PATENTS file in the same directory. | ||
6911 | * | ||
6912 | * @providesModule isTextNode | ||
6913 | * @typechecks | ||
6914 | */ | ||
6915 | |||
6916 | 'use strict'; | ||
6917 | |||
6918 | var isNode = __webpack_require__(63); | ||
6919 | |||
6920 | /** | ||
6921 | * @param {*} object The object to check. | ||
6922 | * @return {boolean} Whether or not the object is a DOM text node. | ||
6923 | */ | ||
6924 | function isTextNode(object) { | ||
6925 | return isNode(object) && object.nodeType == 3; | ||
6926 | } | ||
6927 | |||
6928 | module.exports = isTextNode; | ||
6929 | |||
6930 | /***/ }, | ||
6931 | /* 63 */ | ||
6932 | /***/ function(module, exports) { | ||
6933 | |||
6934 | /** | ||
6935 | * Copyright 2013-2015, Facebook, Inc. | ||
6936 | * All rights reserved. | ||
6937 | * | ||
6938 | * This source code is licensed under the BSD-style license found in the | ||
6939 | * LICENSE file in the root directory of this source tree. An additional grant | ||
6940 | * of patent rights can be found in the PATENTS file in the same directory. | ||
6941 | * | ||
6942 | * @providesModule isNode | ||
6943 | * @typechecks | ||
6944 | */ | ||
6945 | |||
6946 | /** | ||
6947 | * @param {*} object The object to check. | ||
6948 | * @return {boolean} Whether or not the object is a DOM node. | ||
6949 | */ | ||
6950 | 'use strict'; | ||
6951 | |||
6952 | function isNode(object) { | ||
6953 | return !!(object && (typeof Node === 'function' ? object instanceof Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string')); | ||
6954 | } | ||
6955 | |||
6956 | module.exports = isNode; | ||
6957 | |||
6958 | /***/ }, | ||
6959 | /* 64 */ | ||
6960 | /***/ function(module, exports, __webpack_require__) { | ||
6961 | |||
6962 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
6963 | * Copyright 2013-2015, Facebook, Inc. | ||
6964 | * All rights reserved. | ||
6965 | * | ||
6966 | * This source code is licensed under the BSD-style license found in the | ||
6967 | * LICENSE file in the root directory of this source tree. An additional grant | ||
6968 | * of patent rights can be found in the PATENTS file in the same directory. | ||
6969 | * | ||
6970 | * @providesModule instantiateReactComponent | ||
6971 | * @typechecks static-only | ||
6972 | */ | ||
6973 | |||
6974 | 'use strict'; | ||
6975 | |||
6976 | var ReactCompositeComponent = __webpack_require__(65); | ||
6977 | var ReactEmptyComponent = __webpack_require__(70); | ||
6978 | var ReactNativeComponent = __webpack_require__(71); | ||
6979 | |||
6980 | var assign = __webpack_require__(41); | ||
6981 | var invariant = __webpack_require__(15); | ||
6982 | var warning = __webpack_require__(27); | ||
6983 | |||
6984 | // To avoid a cyclic dependency, we create the final class in this module | ||
6985 | var ReactCompositeComponentWrapper = function () {}; | ||
6986 | assign(ReactCompositeComponentWrapper.prototype, ReactCompositeComponent.Mixin, { | ||
6987 | _instantiateReactComponent: instantiateReactComponent | ||
6988 | }); | ||
6989 | |||
6990 | function getDeclarationErrorAddendum(owner) { | ||
6991 | if (owner) { | ||
6992 | var name = owner.getName(); | ||
6993 | if (name) { | ||
6994 | return ' Check the render method of `' + name + '`.'; | ||
6995 | } | ||
6996 | } | ||
6997 | return ''; | ||
6998 | } | ||
6999 | |||
7000 | /** | ||
7001 | * Check if the type reference is a known internal type. I.e. not a user | ||
7002 | * provided composite type. | ||
7003 | * | ||
7004 | * @param {function} type | ||
7005 | * @return {boolean} Returns true if this is a valid internal type. | ||
7006 | */ | ||
7007 | function isInternalComponentType(type) { | ||
7008 | return typeof type === 'function' && typeof type.prototype !== 'undefined' && typeof type.prototype.mountComponent === 'function' && typeof type.prototype.receiveComponent === 'function'; | ||
7009 | } | ||
7010 | |||
7011 | /** | ||
7012 | * Given a ReactNode, create an instance that will actually be mounted. | ||
7013 | * | ||
7014 | * @param {ReactNode} node | ||
7015 | * @return {object} A new instance of the element's constructor. | ||
7016 | * @protected | ||
7017 | */ | ||
7018 | function instantiateReactComponent(node) { | ||
7019 | var instance; | ||
7020 | |||
7021 | if (node === null || node === false) { | ||
7022 | instance = new ReactEmptyComponent(instantiateReactComponent); | ||
7023 | } else if (typeof node === 'object') { | ||
7024 | var element = node; | ||
7025 | !(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; | ||
7026 | |||
7027 | // Special case string values | ||
7028 | if (typeof element.type === 'string') { | ||
7029 | instance = ReactNativeComponent.createInternalComponent(element); | ||
7030 | } else if (isInternalComponentType(element.type)) { | ||
7031 | // This is temporarily available for custom components that are not string | ||
7032 | // representations. I.e. ART. Once those are updated to use the string | ||
7033 | // representation, we can drop this code path. | ||
7034 | instance = new element.type(element); | ||
7035 | } else { | ||
7036 | instance = new ReactCompositeComponentWrapper(); | ||
7037 | } | ||
7038 | } else if (typeof node === 'string' || typeof node === 'number') { | ||
7039 | instance = ReactNativeComponent.createInstanceForText(node); | ||
7040 | } else { | ||
7041 | true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Encountered invalid React node of type %s', typeof node) : invariant(false) : undefined; | ||
7042 | } | ||
7043 | |||
7044 | if (process.env.NODE_ENV !== 'production') { | ||
7045 | 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; | ||
7046 | } | ||
7047 | |||
7048 | // Sets up the instance. This can probably just move into the constructor now. | ||
7049 | instance.construct(node); | ||
7050 | |||
7051 | // These two fields are used by the DOM and ART diffing algorithms | ||
7052 | // respectively. Instead of using expandos on components, we should be | ||
7053 | // storing the state needed by the diffing algorithms elsewhere. | ||
7054 | instance._mountIndex = 0; | ||
7055 | instance._mountImage = null; | ||
7056 | |||
7057 | if (process.env.NODE_ENV !== 'production') { | ||
7058 | instance._isOwnerNecessary = false; | ||
7059 | instance._warnedAboutRefsInRender = false; | ||
7060 | } | ||
7061 | |||
7062 | // Internal instances should fully constructed at this point, so they should | ||
7063 | // not get any new fields added to them at this point. | ||
7064 | if (process.env.NODE_ENV !== 'production') { | ||
7065 | if (Object.preventExtensions) { | ||
7066 | Object.preventExtensions(instance); | ||
7067 | } | ||
7068 | } | ||
7069 | |||
7070 | return instance; | ||
7071 | } | ||
7072 | |||
7073 | module.exports = instantiateReactComponent; | ||
7074 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
7075 | |||
7076 | /***/ }, | ||
7077 | /* 65 */ | ||
7078 | /***/ function(module, exports, __webpack_require__) { | ||
7079 | |||
7080 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
7081 | * Copyright 2013-2015, Facebook, Inc. | ||
7082 | * All rights reserved. | ||
7083 | * | ||
7084 | * This source code is licensed under the BSD-style license found in the | ||
7085 | * LICENSE file in the root directory of this source tree. An additional grant | ||
7086 | * of patent rights can be found in the PATENTS file in the same directory. | ||
7087 | * | ||
7088 | * @providesModule ReactCompositeComponent | ||
7089 | */ | ||
7090 | |||
7091 | 'use strict'; | ||
7092 | |||
7093 | var ReactComponentEnvironment = __webpack_require__(66); | ||
7094 | var ReactCurrentOwner = __webpack_require__(7); | ||
7095 | var ReactElement = __webpack_require__(44); | ||
7096 | var ReactInstanceMap = __webpack_require__(49); | ||
7097 | var ReactPerf = __webpack_require__(20); | ||
7098 | var ReactPropTypeLocations = __webpack_require__(67); | ||
7099 | var ReactPropTypeLocationNames = __webpack_require__(68); | ||
7100 | var ReactReconciler = __webpack_require__(52); | ||
7101 | var ReactUpdateQueue = __webpack_require__(55); | ||
7102 | |||
7103 | var assign = __webpack_require__(41); | ||
7104 | var emptyObject = __webpack_require__(60); | ||
7105 | var invariant = __webpack_require__(15); | ||
7106 | var shouldUpdateReactComponent = __webpack_require__(69); | ||
7107 | var warning = __webpack_require__(27); | ||
7108 | |||
7109 | function getDeclarationErrorAddendum(component) { | ||
7110 | var owner = component._currentElement._owner || null; | ||
7111 | if (owner) { | ||
7112 | var name = owner.getName(); | ||
7113 | if (name) { | ||
7114 | return ' Check the render method of `' + name + '`.'; | ||
7115 | } | ||
7116 | } | ||
7117 | return ''; | ||
7118 | } | ||
7119 | |||
7120 | function StatelessComponent(Component) {} | ||
7121 | StatelessComponent.prototype.render = function () { | ||
7122 | var Component = ReactInstanceMap.get(this)._currentElement.type; | ||
7123 | return Component(this.props, this.context, this.updater); | ||
7124 | }; | ||
7125 | |||
7126 | /** | ||
7127 | * ------------------ The Life-Cycle of a Composite Component ------------------ | ||
7128 | * | ||
7129 | * - constructor: Initialization of state. The instance is now retained. | ||
7130 | * - componentWillMount | ||
7131 | * - render | ||
7132 | * - [children's constructors] | ||
7133 | * - [children's componentWillMount and render] | ||
7134 | * - [children's componentDidMount] | ||
7135 | * - componentDidMount | ||
7136 | * | ||
7137 | * Update Phases: | ||
7138 | * - componentWillReceiveProps (only called if parent updated) | ||
7139 | * - shouldComponentUpdate | ||
7140 | * - componentWillUpdate | ||
7141 | * - render | ||
7142 | * - [children's constructors or receive props phases] | ||
7143 | * - componentDidUpdate | ||
7144 | * | ||
7145 | * - componentWillUnmount | ||
7146 | * - [children's componentWillUnmount] | ||
7147 | * - [children destroyed] | ||
7148 | * - (destroyed): The instance is now blank, released by React and ready for GC. | ||
7149 | * | ||
7150 | * ----------------------------------------------------------------------------- | ||
7151 | */ | ||
7152 | |||
7153 | /** | ||
7154 | * An incrementing ID assigned to each component when it is mounted. This is | ||
7155 | * used to enforce the order in which `ReactUpdates` updates dirty components. | ||
7156 | * | ||
7157 | * @private | ||
7158 | */ | ||
7159 | var nextMountID = 1; | ||
7160 | |||
7161 | /** | ||
7162 | * @lends {ReactCompositeComponent.prototype} | ||
7163 | */ | ||
7164 | var ReactCompositeComponentMixin = { | ||
7165 | |||
7166 | /** | ||
7167 | * Base constructor for all composite component. | ||
7168 | * | ||
7169 | * @param {ReactElement} element | ||
7170 | * @final | ||
7171 | * @internal | ||
7172 | */ | ||
7173 | construct: function (element) { | ||
7174 | this._currentElement = element; | ||
7175 | this._rootNodeID = null; | ||
7176 | this._instance = null; | ||
7177 | |||
7178 | // See ReactUpdateQueue | ||
7179 | this._pendingElement = null; | ||
7180 | this._pendingStateQueue = null; | ||
7181 | this._pendingReplaceState = false; | ||
7182 | this._pendingForceUpdate = false; | ||
7183 | |||
7184 | this._renderedComponent = null; | ||
7185 | |||
7186 | this._context = null; | ||
7187 | this._mountOrder = 0; | ||
7188 | this._topLevelWrapper = null; | ||
7189 | |||
7190 | // See ReactUpdates and ReactUpdateQueue. | ||
7191 | this._pendingCallbacks = null; | ||
7192 | }, | ||
7193 | |||
7194 | /** | ||
7195 | * Initializes the component, renders markup, and registers event listeners. | ||
7196 | * | ||
7197 | * @param {string} rootID DOM ID of the root node. | ||
7198 | * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction | ||
7199 | * @return {?string} Rendered markup to be inserted into the DOM. | ||
7200 | * @final | ||
7201 | * @internal | ||
7202 | */ | ||
7203 | mountComponent: function (rootID, transaction, context) { | ||
7204 | this._context = context; | ||
7205 | this._mountOrder = nextMountID++; | ||
7206 | this._rootNodeID = rootID; | ||
7207 | |||
7208 | var publicProps = this._processProps(this._currentElement.props); | ||
7209 | var publicContext = this._processContext(context); | ||
7210 | |||
7211 | var Component = this._currentElement.type; | ||
7212 | |||
7213 | // Initialize the public class | ||
7214 | var inst; | ||
7215 | var renderedElement; | ||
7216 | |||
7217 | // This is a way to detect if Component is a stateless arrow function | ||
7218 | // component, which is not newable. It might not be 100% reliable but is | ||
7219 | // something we can do until we start detecting that Component extends | ||
7220 | // React.Component. We already assume that typeof Component === 'function'. | ||
7221 | var canInstantiate = ('prototype' in Component); | ||
7222 | |||
7223 | if (canInstantiate) { | ||
7224 | if (process.env.NODE_ENV !== 'production') { | ||
7225 | ReactCurrentOwner.current = this; | ||
7226 | try { | ||
7227 | inst = new Component(publicProps, publicContext, ReactUpdateQueue); | ||
7228 | } finally { | ||
7229 | ReactCurrentOwner.current = null; | ||
7230 | } | ||
7231 | } else { | ||
7232 | inst = new Component(publicProps, publicContext, ReactUpdateQueue); | ||
7233 | } | ||
7234 | } | ||
7235 | |||
7236 | if (!canInstantiate || inst === null || inst === false || ReactElement.isValidElement(inst)) { | ||
7237 | renderedElement = inst; | ||
7238 | inst = new StatelessComponent(Component); | ||
7239 | } | ||
7240 | |||
7241 | if (process.env.NODE_ENV !== 'production') { | ||
7242 | // This will throw later in _renderValidatedComponent, but add an early | ||
7243 | // warning now to help debugging | ||
7244 | if (inst.render == null) { | ||
7245 | 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; | ||
7246 | } else { | ||
7247 | // We support ES6 inheriting from React.Component, the module pattern, | ||
7248 | // and stateless components, but not ES6 classes that don't extend | ||
7249 | 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; | ||
7250 | } | ||
7251 | } | ||
7252 | |||
7253 | // These should be set up in the constructor, but as a convenience for | ||
7254 | // simpler class abstractions, we set them up after the fact. | ||
7255 | inst.props = publicProps; | ||
7256 | inst.context = publicContext; | ||
7257 | inst.refs = emptyObject; | ||
7258 | inst.updater = ReactUpdateQueue; | ||
7259 | |||
7260 | this._instance = inst; | ||
7261 | |||
7262 | // Store a reference from the instance back to the internal representation | ||
7263 | ReactInstanceMap.set(inst, this); | ||
7264 | |||
7265 | if (process.env.NODE_ENV !== 'production') { | ||
7266 | // Since plain JS classes are defined without any special initialization | ||
7267 | // logic, we can not catch common errors early. Therefore, we have to | ||
7268 | // catch them here, at initialization time, instead. | ||
7269 | 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; | ||
7270 | 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; | ||
7271 | 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; | ||
7272 | 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; | ||
7273 | 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; | ||
7274 | 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; | ||
7275 | 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; | ||
7276 | } | ||
7277 | |||
7278 | var initialState = inst.state; | ||
7279 | if (initialState === undefined) { | ||
7280 | inst.state = initialState = null; | ||
7281 | } | ||
7282 | !(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; | ||
7283 | |||
7284 | this._pendingStateQueue = null; | ||
7285 | this._pendingReplaceState = false; | ||
7286 | this._pendingForceUpdate = false; | ||
7287 | |||
7288 | if (inst.componentWillMount) { | ||
7289 | inst.componentWillMount(); | ||
7290 | // When mounting, calls to `setState` by `componentWillMount` will set | ||
7291 | // `this._pendingStateQueue` without triggering a re-render. | ||
7292 | if (this._pendingStateQueue) { | ||
7293 | inst.state = this._processPendingState(inst.props, inst.context); | ||
7294 | } | ||
7295 | } | ||
7296 | |||
7297 | // If not a stateless component, we now render | ||
7298 | if (renderedElement === undefined) { | ||
7299 | renderedElement = this._renderValidatedComponent(); | ||
7300 | } | ||
7301 | |||
7302 | this._renderedComponent = this._instantiateReactComponent(renderedElement); | ||
7303 | |||
7304 | var markup = ReactReconciler.mountComponent(this._renderedComponent, rootID, transaction, this._processChildContext(context)); | ||
7305 | if (inst.componentDidMount) { | ||
7306 | transaction.getReactMountReady().enqueue(inst.componentDidMount, inst); | ||
7307 | } | ||
7308 | |||
7309 | return markup; | ||
7310 | }, | ||
7311 | |||
7312 | /** | ||
7313 | * Releases any resources allocated by `mountComponent`. | ||
7314 | * | ||
7315 | * @final | ||
7316 | * @internal | ||
7317 | */ | ||
7318 | unmountComponent: function () { | ||
7319 | var inst = this._instance; | ||
7320 | |||
7321 | if (inst.componentWillUnmount) { | ||
7322 | inst.componentWillUnmount(); | ||
7323 | } | ||
7324 | |||
7325 | ReactReconciler.unmountComponent(this._renderedComponent); | ||
7326 | this._renderedComponent = null; | ||
7327 | this._instance = null; | ||
7328 | |||
7329 | // Reset pending fields | ||
7330 | // Even if this component is scheduled for another update in ReactUpdates, | ||
7331 | // it would still be ignored because these fields are reset. | ||
7332 | this._pendingStateQueue = null; | ||
7333 | this._pendingReplaceState = false; | ||
7334 | this._pendingForceUpdate = false; | ||
7335 | this._pendingCallbacks = null; | ||
7336 | this._pendingElement = null; | ||
7337 | |||
7338 | // These fields do not really need to be reset since this object is no | ||
7339 | // longer accessible. | ||
7340 | this._context = null; | ||
7341 | this._rootNodeID = null; | ||
7342 | this._topLevelWrapper = null; | ||
7343 | |||
7344 | // Delete the reference from the instance to this internal representation | ||
7345 | // which allow the internals to be properly cleaned up even if the user | ||
7346 | // leaks a reference to the public instance. | ||
7347 | ReactInstanceMap.remove(inst); | ||
7348 | |||
7349 | // Some existing components rely on inst.props even after they've been | ||
7350 | // destroyed (in event handlers). | ||
7351 | // TODO: inst.props = null; | ||
7352 | // TODO: inst.state = null; | ||
7353 | // TODO: inst.context = null; | ||
7354 | }, | ||
7355 | |||
7356 | /** | ||
7357 | * Filters the context object to only contain keys specified in | ||
7358 | * `contextTypes` | ||
7359 | * | ||
7360 | * @param {object} context | ||
7361 | * @return {?object} | ||
7362 | * @private | ||
7363 | */ | ||
7364 | _maskContext: function (context) { | ||
7365 | var maskedContext = null; | ||
7366 | var Component = this._currentElement.type; | ||
7367 | var contextTypes = Component.contextTypes; | ||
7368 | if (!contextTypes) { | ||
7369 | return emptyObject; | ||
7370 | } | ||
7371 | maskedContext = {}; | ||
7372 | for (var contextName in contextTypes) { | ||
7373 | maskedContext[contextName] = context[contextName]; | ||
7374 | } | ||
7375 | return maskedContext; | ||
7376 | }, | ||
7377 | |||
7378 | /** | ||
7379 | * Filters the context object to only contain keys specified in | ||
7380 | * `contextTypes`, and asserts that they are valid. | ||
7381 | * | ||
7382 | * @param {object} context | ||
7383 | * @return {?object} | ||
7384 | * @private | ||
7385 | */ | ||
7386 | _processContext: function (context) { | ||
7387 | var maskedContext = this._maskContext(context); | ||
7388 | if (process.env.NODE_ENV !== 'production') { | ||
7389 | var Component = this._currentElement.type; | ||
7390 | if (Component.contextTypes) { | ||
7391 | this._checkPropTypes(Component.contextTypes, maskedContext, ReactPropTypeLocations.context); | ||
7392 | } | ||
7393 | } | ||
7394 | return maskedContext; | ||
7395 | }, | ||
7396 | |||
7397 | /** | ||
7398 | * @param {object} currentContext | ||
7399 | * @return {object} | ||
7400 | * @private | ||
7401 | */ | ||
7402 | _processChildContext: function (currentContext) { | ||
7403 | var Component = this._currentElement.type; | ||
7404 | var inst = this._instance; | ||
7405 | var childContext = inst.getChildContext && inst.getChildContext(); | ||
7406 | if (childContext) { | ||
7407 | !(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; | ||
7408 | if (process.env.NODE_ENV !== 'production') { | ||
7409 | this._checkPropTypes(Component.childContextTypes, childContext, ReactPropTypeLocations.childContext); | ||
7410 | } | ||
7411 | for (var name in childContext) { | ||
7412 | !(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; | ||
7413 | } | ||
7414 | return assign({}, currentContext, childContext); | ||
7415 | } | ||
7416 | return currentContext; | ||
7417 | }, | ||
7418 | |||
7419 | /** | ||
7420 | * Processes props by setting default values for unspecified props and | ||
7421 | * asserting that the props are valid. Does not mutate its argument; returns | ||
7422 | * a new props object with defaults merged in. | ||
7423 | * | ||
7424 | * @param {object} newProps | ||
7425 | * @return {object} | ||
7426 | * @private | ||
7427 | */ | ||
7428 | _processProps: function (newProps) { | ||
7429 | if (process.env.NODE_ENV !== 'production') { | ||
7430 | var Component = this._currentElement.type; | ||
7431 | if (Component.propTypes) { | ||
7432 | this._checkPropTypes(Component.propTypes, newProps, ReactPropTypeLocations.prop); | ||
7433 | } | ||
7434 | } | ||
7435 | return newProps; | ||
7436 | }, | ||
7437 | |||
7438 | /** | ||
7439 | * Assert that the props are valid | ||
7440 | * | ||
7441 | * @param {object} propTypes Map of prop name to a ReactPropType | ||
7442 | * @param {object} props | ||
7443 | * @param {string} location e.g. "prop", "context", "child context" | ||
7444 | * @private | ||
7445 | */ | ||
7446 | _checkPropTypes: function (propTypes, props, location) { | ||
7447 | // TODO: Stop validating prop types here and only use the element | ||
7448 | // validation. | ||
7449 | var componentName = this.getName(); | ||
7450 | for (var propName in propTypes) { | ||
7451 | if (propTypes.hasOwnProperty(propName)) { | ||
7452 | var error; | ||
7453 | try { | ||
7454 | // This is intentionally an invariant that gets caught. It's the same | ||
7455 | // behavior as without this statement except with a better message. | ||
7456 | !(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; | ||
7457 | error = propTypes[propName](props, propName, componentName, location); | ||
7458 | } catch (ex) { | ||
7459 | error = ex; | ||
7460 | } | ||
7461 | if (error instanceof Error) { | ||
7462 | // We may want to extend this logic for similar errors in | ||
7463 | // top-level render calls, so I'm abstracting it away into | ||
7464 | // a function to minimize refactoring in the future | ||
7465 | var addendum = getDeclarationErrorAddendum(this); | ||
7466 | |||
7467 | if (location === ReactPropTypeLocations.prop) { | ||
7468 | // Preface gives us something to blacklist in warning module | ||
7469 | process.env.NODE_ENV !== 'production' ? warning(false, 'Failed Composite propType: %s%s', error.message, addendum) : undefined; | ||
7470 | } else { | ||
7471 | process.env.NODE_ENV !== 'production' ? warning(false, 'Failed Context Types: %s%s', error.message, addendum) : undefined; | ||
7472 | } | ||
7473 | } | ||
7474 | } | ||
7475 | } | ||
7476 | }, | ||
7477 | |||
7478 | receiveComponent: function (nextElement, transaction, nextContext) { | ||
7479 | var prevElement = this._currentElement; | ||
7480 | var prevContext = this._context; | ||
7481 | |||
7482 | this._pendingElement = null; | ||
7483 | |||
7484 | this.updateComponent(transaction, prevElement, nextElement, prevContext, nextContext); | ||
7485 | }, | ||
7486 | |||
7487 | /** | ||
7488 | * If any of `_pendingElement`, `_pendingStateQueue`, or `_pendingForceUpdate` | ||
7489 | * is set, update the component. | ||
7490 | * | ||
7491 | * @param {ReactReconcileTransaction} transaction | ||
7492 | * @internal | ||
7493 | */ | ||
7494 | performUpdateIfNecessary: function (transaction) { | ||
7495 | if (this._pendingElement != null) { | ||
7496 | ReactReconciler.receiveComponent(this, this._pendingElement || this._currentElement, transaction, this._context); | ||
7497 | } | ||
7498 | |||
7499 | if (this._pendingStateQueue !== null || this._pendingForceUpdate) { | ||
7500 | this.updateComponent(transaction, this._currentElement, this._currentElement, this._context, this._context); | ||
7501 | } | ||
7502 | }, | ||
7503 | |||
7504 | /** | ||
7505 | * Perform an update to a mounted component. The componentWillReceiveProps and | ||
7506 | * shouldComponentUpdate methods are called, then (assuming the update isn't | ||
7507 | * skipped) the remaining update lifecycle methods are called and the DOM | ||
7508 | * representation is updated. | ||
7509 | * | ||
7510 | * By default, this implements React's rendering and reconciliation algorithm. | ||
7511 | * Sophisticated clients may wish to override this. | ||
7512 | * | ||
7513 | * @param {ReactReconcileTransaction} transaction | ||
7514 | * @param {ReactElement} prevParentElement | ||
7515 | * @param {ReactElement} nextParentElement | ||
7516 | * @internal | ||
7517 | * @overridable | ||
7518 | */ | ||
7519 | updateComponent: function (transaction, prevParentElement, nextParentElement, prevUnmaskedContext, nextUnmaskedContext) { | ||
7520 | var inst = this._instance; | ||
7521 | |||
7522 | var nextContext = this._context === nextUnmaskedContext ? inst.context : this._processContext(nextUnmaskedContext); | ||
7523 | var nextProps; | ||
7524 | |||
7525 | // Distinguish between a props update versus a simple state update | ||
7526 | if (prevParentElement === nextParentElement) { | ||
7527 | // Skip checking prop types again -- we don't read inst.props to avoid | ||
7528 | // warning for DOM component props in this upgrade | ||
7529 | nextProps = nextParentElement.props; | ||
7530 | } else { | ||
7531 | nextProps = this._processProps(nextParentElement.props); | ||
7532 | // An update here will schedule an update but immediately set | ||
7533 | // _pendingStateQueue which will ensure that any state updates gets | ||
7534 | // immediately reconciled instead of waiting for the next batch. | ||
7535 | |||
7536 | if (inst.componentWillReceiveProps) { | ||
7537 | inst.componentWillReceiveProps(nextProps, nextContext); | ||
7538 | } | ||
7539 | } | ||
7540 | |||
7541 | var nextState = this._processPendingState(nextProps, nextContext); | ||
7542 | |||
7543 | var shouldUpdate = this._pendingForceUpdate || !inst.shouldComponentUpdate || inst.shouldComponentUpdate(nextProps, nextState, nextContext); | ||
7544 | |||
7545 | if (process.env.NODE_ENV !== 'production') { | ||
7546 | 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; | ||
7547 | } | ||
7548 | |||
7549 | if (shouldUpdate) { | ||
7550 | this._pendingForceUpdate = false; | ||
7551 | // Will set `this.props`, `this.state` and `this.context`. | ||
7552 | this._performComponentUpdate(nextParentElement, nextProps, nextState, nextContext, transaction, nextUnmaskedContext); | ||
7553 | } else { | ||
7554 | // If it's determined that a component should not update, we still want | ||
7555 | // to set props and state but we shortcut the rest of the update. | ||
7556 | this._currentElement = nextParentElement; | ||
7557 | this._context = nextUnmaskedContext; | ||
7558 | inst.props = nextProps; | ||
7559 | inst.state = nextState; | ||
7560 | inst.context = nextContext; | ||
7561 | } | ||
7562 | }, | ||
7563 | |||
7564 | _processPendingState: function (props, context) { | ||
7565 | var inst = this._instance; | ||
7566 | var queue = this._pendingStateQueue; | ||
7567 | var replace = this._pendingReplaceState; | ||
7568 | this._pendingReplaceState = false; | ||
7569 | this._pendingStateQueue = null; | ||
7570 | |||
7571 | if (!queue) { | ||
7572 | return inst.state; | ||
7573 | } | ||
7574 | |||
7575 | if (replace && queue.length === 1) { | ||
7576 | return queue[0]; | ||
7577 | } | ||
7578 | |||
7579 | var nextState = assign({}, replace ? queue[0] : inst.state); | ||
7580 | for (var i = replace ? 1 : 0; i < queue.length; i++) { | ||
7581 | var partial = queue[i]; | ||
7582 | assign(nextState, typeof partial === 'function' ? partial.call(inst, nextState, props, context) : partial); | ||
7583 | } | ||
7584 | |||
7585 | return nextState; | ||
7586 | }, | ||
7587 | |||
7588 | /** | ||
7589 | * Merges new props and state, notifies delegate methods of update and | ||
7590 | * performs update. | ||
7591 | * | ||
7592 | * @param {ReactElement} nextElement Next element | ||
7593 | * @param {object} nextProps Next public object to set as properties. | ||
7594 | * @param {?object} nextState Next object to set as state. | ||
7595 | * @param {?object} nextContext Next public object to set as context. | ||
7596 | * @param {ReactReconcileTransaction} transaction | ||
7597 | * @param {?object} unmaskedContext | ||
7598 | * @private | ||
7599 | */ | ||
7600 | _performComponentUpdate: function (nextElement, nextProps, nextState, nextContext, transaction, unmaskedContext) { | ||
7601 | var inst = this._instance; | ||
7602 | |||
7603 | var hasComponentDidUpdate = Boolean(inst.componentDidUpdate); | ||
7604 | var prevProps; | ||
7605 | var prevState; | ||
7606 | var prevContext; | ||
7607 | if (hasComponentDidUpdate) { | ||
7608 | prevProps = inst.props; | ||
7609 | prevState = inst.state; | ||
7610 | prevContext = inst.context; | ||
7611 | } | ||
7612 | |||
7613 | if (inst.componentWillUpdate) { | ||
7614 | inst.componentWillUpdate(nextProps, nextState, nextContext); | ||
7615 | } | ||
7616 | |||
7617 | this._currentElement = nextElement; | ||
7618 | this._context = unmaskedContext; | ||
7619 | inst.props = nextProps; | ||
7620 | inst.state = nextState; | ||
7621 | inst.context = nextContext; | ||
7622 | |||
7623 | this._updateRenderedComponent(transaction, unmaskedContext); | ||
7624 | |||
7625 | if (hasComponentDidUpdate) { | ||
7626 | transaction.getReactMountReady().enqueue(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), inst); | ||
7627 | } | ||
7628 | }, | ||
7629 | |||
7630 | /** | ||
7631 | * Call the component's `render` method and update the DOM accordingly. | ||
7632 | * | ||
7633 | * @param {ReactReconcileTransaction} transaction | ||
7634 | * @internal | ||
7635 | */ | ||
7636 | _updateRenderedComponent: function (transaction, context) { | ||
7637 | var prevComponentInstance = this._renderedComponent; | ||
7638 | var prevRenderedElement = prevComponentInstance._currentElement; | ||
7639 | var nextRenderedElement = this._renderValidatedComponent(); | ||
7640 | if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) { | ||
7641 | ReactReconciler.receiveComponent(prevComponentInstance, nextRenderedElement, transaction, this._processChildContext(context)); | ||
7642 | } else { | ||
7643 | // These two IDs are actually the same! But nothing should rely on that. | ||
7644 | var thisID = this._rootNodeID; | ||
7645 | var prevComponentID = prevComponentInstance._rootNodeID; | ||
7646 | ReactReconciler.unmountComponent(prevComponentInstance); | ||
7647 | |||
7648 | this._renderedComponent = this._instantiateReactComponent(nextRenderedElement); | ||
7649 | var nextMarkup = ReactReconciler.mountComponent(this._renderedComponent, thisID, transaction, this._processChildContext(context)); | ||
7650 | this._replaceNodeWithMarkupByID(prevComponentID, nextMarkup); | ||
7651 | } | ||
7652 | }, | ||
7653 | |||
7654 | /** | ||
7655 | * @protected | ||
7656 | */ | ||
7657 | _replaceNodeWithMarkupByID: function (prevComponentID, nextMarkup) { | ||
7658 | ReactComponentEnvironment.replaceNodeWithMarkupByID(prevComponentID, nextMarkup); | ||
7659 | }, | ||
7660 | |||
7661 | /** | ||
7662 | * @protected | ||
7663 | */ | ||
7664 | _renderValidatedComponentWithoutOwnerOrContext: function () { | ||
7665 | var inst = this._instance; | ||
7666 | var renderedComponent = inst.render(); | ||
7667 | if (process.env.NODE_ENV !== 'production') { | ||
7668 | // We allow auto-mocks to proceed as if they're returning null. | ||
7669 | if (typeof renderedComponent === 'undefined' && inst.render._isMockFunction) { | ||
7670 | // This is probably bad practice. Consider warning here and | ||
7671 | // deprecating this convenience. | ||
7672 | renderedComponent = null; | ||
7673 | } | ||
7674 | } | ||
7675 | |||
7676 | return renderedComponent; | ||
7677 | }, | ||
7678 | |||
7679 | /** | ||
7680 | * @private | ||
7681 | */ | ||
7682 | _renderValidatedComponent: function () { | ||
7683 | var renderedComponent; | ||
7684 | ReactCurrentOwner.current = this; | ||
7685 | try { | ||
7686 | renderedComponent = this._renderValidatedComponentWithoutOwnerOrContext(); | ||
7687 | } finally { | ||
7688 | ReactCurrentOwner.current = null; | ||
7689 | } | ||
7690 | !( | ||
7691 | // TODO: An `isValidNode` function would probably be more appropriate | ||
7692 | 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; | ||
7693 | return renderedComponent; | ||
7694 | }, | ||
7695 | |||
7696 | /** | ||
7697 | * Lazily allocates the refs object and stores `component` as `ref`. | ||
7698 | * | ||
7699 | * @param {string} ref Reference name. | ||
7700 | * @param {component} component Component to store as `ref`. | ||
7701 | * @final | ||
7702 | * @private | ||
7703 | */ | ||
7704 | attachRef: function (ref, component) { | ||
7705 | var inst = this.getPublicInstance(); | ||
7706 | !(inst != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Stateless function components cannot have refs.') : invariant(false) : undefined; | ||
7707 | var publicComponentInstance = component.getPublicInstance(); | ||
7708 | if (process.env.NODE_ENV !== 'production') { | ||
7709 | var componentName = component && component.getName ? component.getName() : 'a component'; | ||
7710 | 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; | ||
7711 | } | ||
7712 | var refs = inst.refs === emptyObject ? inst.refs = {} : inst.refs; | ||
7713 | refs[ref] = publicComponentInstance; | ||
7714 | }, | ||
7715 | |||
7716 | /** | ||
7717 | * Detaches a reference name. | ||
7718 | * | ||
7719 | * @param {string} ref Name to dereference. | ||
7720 | * @final | ||
7721 | * @private | ||
7722 | */ | ||
7723 | detachRef: function (ref) { | ||
7724 | var refs = this.getPublicInstance().refs; | ||
7725 | delete refs[ref]; | ||
7726 | }, | ||
7727 | |||
7728 | /** | ||
7729 | * Get a text description of the component that can be used to identify it | ||
7730 | * in error messages. | ||
7731 | * @return {string} The name or null. | ||
7732 | * @internal | ||
7733 | */ | ||
7734 | getName: function () { | ||
7735 | var type = this._currentElement.type; | ||
7736 | var constructor = this._instance && this._instance.constructor; | ||
7737 | return type.displayName || constructor && constructor.displayName || type.name || constructor && constructor.name || null; | ||
7738 | }, | ||
7739 | |||
7740 | /** | ||
7741 | * Get the publicly accessible representation of this component - i.e. what | ||
7742 | * is exposed by refs and returned by render. Can be null for stateless | ||
7743 | * components. | ||
7744 | * | ||
7745 | * @return {ReactComponent} the public component instance. | ||
7746 | * @internal | ||
7747 | */ | ||
7748 | getPublicInstance: function () { | ||
7749 | var inst = this._instance; | ||
7750 | if (inst instanceof StatelessComponent) { | ||
7751 | return null; | ||
7752 | } | ||
7753 | return inst; | ||
7754 | }, | ||
7755 | |||
7756 | // Stub | ||
7757 | _instantiateReactComponent: null | ||
7758 | |||
7759 | }; | ||
7760 | |||
7761 | ReactPerf.measureMethods(ReactCompositeComponentMixin, 'ReactCompositeComponent', { | ||
7762 | mountComponent: 'mountComponent', | ||
7763 | updateComponent: 'updateComponent', | ||
7764 | _renderValidatedComponent: '_renderValidatedComponent' | ||
7765 | }); | ||
7766 | |||
7767 | var ReactCompositeComponent = { | ||
7768 | |||
7769 | Mixin: ReactCompositeComponentMixin | ||
7770 | |||
7771 | }; | ||
7772 | |||
7773 | module.exports = ReactCompositeComponent; | ||
7774 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
7775 | |||
7776 | /***/ }, | ||
7777 | /* 66 */ | ||
7778 | /***/ function(module, exports, __webpack_require__) { | ||
7779 | |||
7780 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
7781 | * Copyright 2014-2015, Facebook, Inc. | ||
7782 | * All rights reserved. | ||
7783 | * | ||
7784 | * This source code is licensed under the BSD-style license found in the | ||
7785 | * LICENSE file in the root directory of this source tree. An additional grant | ||
7786 | * of patent rights can be found in the PATENTS file in the same directory. | ||
7787 | * | ||
7788 | * @providesModule ReactComponentEnvironment | ||
7789 | */ | ||
7790 | |||
7791 | 'use strict'; | ||
7792 | |||
7793 | var invariant = __webpack_require__(15); | ||
7794 | |||
7795 | var injected = false; | ||
7796 | |||
7797 | var ReactComponentEnvironment = { | ||
7798 | |||
7799 | /** | ||
7800 | * Optionally injectable environment dependent cleanup hook. (server vs. | ||
7801 | * browser etc). Example: A browser system caches DOM nodes based on component | ||
7802 | * ID and must remove that cache entry when this instance is unmounted. | ||
7803 | */ | ||
7804 | unmountIDFromEnvironment: null, | ||
7805 | |||
7806 | /** | ||
7807 | * Optionally injectable hook for swapping out mount images in the middle of | ||
7808 | * the tree. | ||
7809 | */ | ||
7810 | replaceNodeWithMarkupByID: null, | ||
7811 | |||
7812 | /** | ||
7813 | * Optionally injectable hook for processing a queue of child updates. Will | ||
7814 | * later move into MultiChildComponents. | ||
7815 | */ | ||
7816 | processChildrenUpdates: null, | ||
7817 | |||
7818 | injection: { | ||
7819 | injectEnvironment: function (environment) { | ||
7820 | !!injected ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactCompositeComponent: injectEnvironment() can only be called once.') : invariant(false) : undefined; | ||
7821 | ReactComponentEnvironment.unmountIDFromEnvironment = environment.unmountIDFromEnvironment; | ||
7822 | ReactComponentEnvironment.replaceNodeWithMarkupByID = environment.replaceNodeWithMarkupByID; | ||
7823 | ReactComponentEnvironment.processChildrenUpdates = environment.processChildrenUpdates; | ||
7824 | injected = true; | ||
7825 | } | ||
7826 | } | ||
7827 | |||
7828 | }; | ||
7829 | |||
7830 | module.exports = ReactComponentEnvironment; | ||
7831 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
7832 | |||
7833 | /***/ }, | ||
7834 | /* 67 */ | ||
7835 | /***/ function(module, exports, __webpack_require__) { | ||
7836 | |||
7837 | /** | ||
7838 | * Copyright 2013-2015, Facebook, Inc. | ||
7839 | * All rights reserved. | ||
7840 | * | ||
7841 | * This source code is licensed under the BSD-style license found in the | ||
7842 | * LICENSE file in the root directory of this source tree. An additional grant | ||
7843 | * of patent rights can be found in the PATENTS file in the same directory. | ||
7844 | * | ||
7845 | * @providesModule ReactPropTypeLocations | ||
7846 | */ | ||
7847 | |||
7848 | 'use strict'; | ||
7849 | |||
7850 | var keyMirror = __webpack_require__(19); | ||
7851 | |||
7852 | var ReactPropTypeLocations = keyMirror({ | ||
7853 | prop: null, | ||
7854 | context: null, | ||
7855 | childContext: null | ||
7856 | }); | ||
7857 | |||
7858 | module.exports = ReactPropTypeLocations; | ||
7859 | |||
7860 | /***/ }, | ||
7861 | /* 68 */ | ||
7862 | /***/ function(module, exports, __webpack_require__) { | ||
7863 | |||
7864 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
7865 | * Copyright 2013-2015, Facebook, Inc. | ||
7866 | * All rights reserved. | ||
7867 | * | ||
7868 | * This source code is licensed under the BSD-style license found in the | ||
7869 | * LICENSE file in the root directory of this source tree. An additional grant | ||
7870 | * of patent rights can be found in the PATENTS file in the same directory. | ||
7871 | * | ||
7872 | * @providesModule ReactPropTypeLocationNames | ||
7873 | */ | ||
7874 | |||
7875 | 'use strict'; | ||
7876 | |||
7877 | var ReactPropTypeLocationNames = {}; | ||
7878 | |||
7879 | if (process.env.NODE_ENV !== 'production') { | ||
7880 | ReactPropTypeLocationNames = { | ||
7881 | prop: 'prop', | ||
7882 | context: 'context', | ||
7883 | childContext: 'child context' | ||
7884 | }; | ||
7885 | } | ||
7886 | |||
7887 | module.exports = ReactPropTypeLocationNames; | ||
7888 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
7889 | |||
7890 | /***/ }, | ||
7891 | /* 69 */ | ||
7892 | /***/ function(module, exports) { | ||
7893 | |||
7894 | /** | ||
7895 | * Copyright 2013-2015, Facebook, Inc. | ||
7896 | * All rights reserved. | ||
7897 | * | ||
7898 | * This source code is licensed under the BSD-style license found in the | ||
7899 | * LICENSE file in the root directory of this source tree. An additional grant | ||
7900 | * of patent rights can be found in the PATENTS file in the same directory. | ||
7901 | * | ||
7902 | * @providesModule shouldUpdateReactComponent | ||
7903 | * @typechecks static-only | ||
7904 | */ | ||
7905 | |||
7906 | 'use strict'; | ||
7907 | |||
7908 | /** | ||
7909 | * Given a `prevElement` and `nextElement`, determines if the existing | ||
7910 | * instance should be updated as opposed to being destroyed or replaced by a new | ||
7911 | * instance. Both arguments are elements. This ensures that this logic can | ||
7912 | * operate on stateless trees without any backing instance. | ||
7913 | * | ||
7914 | * @param {?object} prevElement | ||
7915 | * @param {?object} nextElement | ||
7916 | * @return {boolean} True if the existing instance should be updated. | ||
7917 | * @protected | ||
7918 | */ | ||
7919 | function shouldUpdateReactComponent(prevElement, nextElement) { | ||
7920 | var prevEmpty = prevElement === null || prevElement === false; | ||
7921 | var nextEmpty = nextElement === null || nextElement === false; | ||
7922 | if (prevEmpty || nextEmpty) { | ||
7923 | return prevEmpty === nextEmpty; | ||
7924 | } | ||
7925 | |||
7926 | var prevType = typeof prevElement; | ||
7927 | var nextType = typeof nextElement; | ||
7928 | if (prevType === 'string' || prevType === 'number') { | ||
7929 | return nextType === 'string' || nextType === 'number'; | ||
7930 | } else { | ||
7931 | return nextType === 'object' && prevElement.type === nextElement.type && prevElement.key === nextElement.key; | ||
7932 | } | ||
7933 | return false; | ||
7934 | } | ||
7935 | |||
7936 | module.exports = shouldUpdateReactComponent; | ||
7937 | |||
7938 | /***/ }, | ||
7939 | /* 70 */ | ||
7940 | /***/ function(module, exports, __webpack_require__) { | ||
7941 | |||
7942 | /** | ||
7943 | * Copyright 2014-2015, Facebook, Inc. | ||
7944 | * All rights reserved. | ||
7945 | * | ||
7946 | * This source code is licensed under the BSD-style license found in the | ||
7947 | * LICENSE file in the root directory of this source tree. An additional grant | ||
7948 | * of patent rights can be found in the PATENTS file in the same directory. | ||
7949 | * | ||
7950 | * @providesModule ReactEmptyComponent | ||
7951 | */ | ||
7952 | |||
7953 | 'use strict'; | ||
7954 | |||
7955 | var ReactElement = __webpack_require__(44); | ||
7956 | var ReactEmptyComponentRegistry = __webpack_require__(46); | ||
7957 | var ReactReconciler = __webpack_require__(52); | ||
7958 | |||
7959 | var assign = __webpack_require__(41); | ||
7960 | |||
7961 | var placeholderElement; | ||
7962 | |||
7963 | var ReactEmptyComponentInjection = { | ||
7964 | injectEmptyComponent: function (component) { | ||
7965 | placeholderElement = ReactElement.createElement(component); | ||
7966 | } | ||
7967 | }; | ||
7968 | |||
7969 | var ReactEmptyComponent = function (instantiate) { | ||
7970 | this._currentElement = null; | ||
7971 | this._rootNodeID = null; | ||
7972 | this._renderedComponent = instantiate(placeholderElement); | ||
7973 | }; | ||
7974 | assign(ReactEmptyComponent.prototype, { | ||
7975 | construct: function (element) {}, | ||
7976 | mountComponent: function (rootID, transaction, context) { | ||
7977 | ReactEmptyComponentRegistry.registerNullComponentID(rootID); | ||
7978 | this._rootNodeID = rootID; | ||
7979 | return ReactReconciler.mountComponent(this._renderedComponent, rootID, transaction, context); | ||
7980 | }, | ||
7981 | receiveComponent: function () {}, | ||
7982 | unmountComponent: function (rootID, transaction, context) { | ||
7983 | ReactReconciler.unmountComponent(this._renderedComponent); | ||
7984 | ReactEmptyComponentRegistry.deregisterNullComponentID(this._rootNodeID); | ||
7985 | this._rootNodeID = null; | ||
7986 | this._renderedComponent = null; | ||
7987 | } | ||
7988 | }); | ||
7989 | |||
7990 | ReactEmptyComponent.injection = ReactEmptyComponentInjection; | ||
7991 | |||
7992 | module.exports = ReactEmptyComponent; | ||
7993 | |||
7994 | /***/ }, | ||
7995 | /* 71 */ | ||
7996 | /***/ function(module, exports, __webpack_require__) { | ||
7997 | |||
7998 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
7999 | * Copyright 2014-2015, Facebook, Inc. | ||
8000 | * All rights reserved. | ||
8001 | * | ||
8002 | * This source code is licensed under the BSD-style license found in the | ||
8003 | * LICENSE file in the root directory of this source tree. An additional grant | ||
8004 | * of patent rights can be found in the PATENTS file in the same directory. | ||
8005 | * | ||
8006 | * @providesModule ReactNativeComponent | ||
8007 | */ | ||
8008 | |||
8009 | 'use strict'; | ||
8010 | |||
8011 | var assign = __webpack_require__(41); | ||
8012 | var invariant = __webpack_require__(15); | ||
8013 | |||
8014 | var autoGenerateWrapperClass = null; | ||
8015 | var genericComponentClass = null; | ||
8016 | // This registry keeps track of wrapper classes around native tags. | ||
8017 | var tagToComponentClass = {}; | ||
8018 | var textComponentClass = null; | ||
8019 | |||
8020 | var ReactNativeComponentInjection = { | ||
8021 | // This accepts a class that receives the tag string. This is a catch all | ||
8022 | // that can render any kind of tag. | ||
8023 | injectGenericComponentClass: function (componentClass) { | ||
8024 | genericComponentClass = componentClass; | ||
8025 | }, | ||
8026 | // This accepts a text component class that takes the text string to be | ||
8027 | // rendered as props. | ||
8028 | injectTextComponentClass: function (componentClass) { | ||
8029 | textComponentClass = componentClass; | ||
8030 | }, | ||
8031 | // This accepts a keyed object with classes as values. Each key represents a | ||
8032 | // tag. That particular tag will use this class instead of the generic one. | ||
8033 | injectComponentClasses: function (componentClasses) { | ||
8034 | assign(tagToComponentClass, componentClasses); | ||
8035 | } | ||
8036 | }; | ||
8037 | |||
8038 | /** | ||
8039 | * Get a composite component wrapper class for a specific tag. | ||
8040 | * | ||
8041 | * @param {ReactElement} element The tag for which to get the class. | ||
8042 | * @return {function} The React class constructor function. | ||
8043 | */ | ||
8044 | function getComponentClassForElement(element) { | ||
8045 | if (typeof element.type === 'function') { | ||
8046 | return element.type; | ||
8047 | } | ||
8048 | var tag = element.type; | ||
8049 | var componentClass = tagToComponentClass[tag]; | ||
8050 | if (componentClass == null) { | ||
8051 | tagToComponentClass[tag] = componentClass = autoGenerateWrapperClass(tag); | ||
8052 | } | ||
8053 | return componentClass; | ||
8054 | } | ||
8055 | |||
8056 | /** | ||
8057 | * Get a native internal component class for a specific tag. | ||
8058 | * | ||
8059 | * @param {ReactElement} element The element to create. | ||
8060 | * @return {function} The internal class constructor function. | ||
8061 | */ | ||
8062 | function createInternalComponent(element) { | ||
8063 | !genericComponentClass ? process.env.NODE_ENV !== 'production' ? invariant(false, 'There is no registered component for the tag %s', element.type) : invariant(false) : undefined; | ||
8064 | return new genericComponentClass(element.type, element.props); | ||
8065 | } | ||
8066 | |||
8067 | /** | ||
8068 | * @param {ReactText} text | ||
8069 | * @return {ReactComponent} | ||
8070 | */ | ||
8071 | function createInstanceForText(text) { | ||
8072 | return new textComponentClass(text); | ||
8073 | } | ||
8074 | |||
8075 | /** | ||
8076 | * @param {ReactComponent} component | ||
8077 | * @return {boolean} | ||
8078 | */ | ||
8079 | function isTextComponent(component) { | ||
8080 | return component instanceof textComponentClass; | ||
8081 | } | ||
8082 | |||
8083 | var ReactNativeComponent = { | ||
8084 | getComponentClassForElement: getComponentClassForElement, | ||
8085 | createInternalComponent: createInternalComponent, | ||
8086 | createInstanceForText: createInstanceForText, | ||
8087 | isTextComponent: isTextComponent, | ||
8088 | injection: ReactNativeComponentInjection | ||
8089 | }; | ||
8090 | |||
8091 | module.exports = ReactNativeComponent; | ||
8092 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
8093 | |||
8094 | /***/ }, | ||
8095 | /* 72 */ | ||
8096 | /***/ function(module, exports, __webpack_require__) { | ||
8097 | |||
8098 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
8099 | * Copyright 2015, Facebook, Inc. | ||
8100 | * All rights reserved. | ||
8101 | * | ||
8102 | * This source code is licensed under the BSD-style license found in the | ||
8103 | * LICENSE file in the root directory of this source tree. An additional grant | ||
8104 | * of patent rights can be found in the PATENTS file in the same directory. | ||
8105 | * | ||
8106 | * @providesModule validateDOMNesting | ||
8107 | */ | ||
8108 | |||
8109 | 'use strict'; | ||
8110 | |||
8111 | var assign = __webpack_require__(41); | ||
8112 | var emptyFunction = __webpack_require__(17); | ||
8113 | var warning = __webpack_require__(27); | ||
8114 | |||
8115 | var validateDOMNesting = emptyFunction; | ||
8116 | |||
8117 | if (process.env.NODE_ENV !== 'production') { | ||
8118 | // This validation code was written based on the HTML5 parsing spec: | ||
8119 | // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope | ||
8120 | // | ||
8121 | // Note: this does not catch all invalid nesting, nor does it try to (as it's | ||
8122 | // not clear what practical benefit doing so provides); instead, we warn only | ||
8123 | // for cases where the parser will give a parse tree differing from what React | ||
8124 | // intended. For example, <b><div></div></b> is invalid but we don't warn | ||
8125 | // because it still parses correctly; we do warn for other cases like nested | ||
8126 | // <p> tags where the beginning of the second element implicitly closes the | ||
8127 | // first, causing a confusing mess. | ||
8128 | |||
8129 | // https://html.spec.whatwg.org/multipage/syntax.html#special | ||
8130 | 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']; | ||
8131 | |||
8132 | // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope | ||
8133 | var inScopeTags = ['applet', 'caption', 'html', 'table', 'td', 'th', 'marquee', 'object', 'template', | ||
8134 | |||
8135 | // https://html.spec.whatwg.org/multipage/syntax.html#html-integration-point | ||
8136 | // TODO: Distinguish by namespace here -- for <title>, including it here | ||
8137 | // errs on the side of fewer warnings | ||
8138 | 'foreignObject', 'desc', 'title']; | ||
8139 | |||
8140 | // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-button-scope | ||
8141 | var buttonScopeTags = inScopeTags.concat(['button']); | ||
8142 | |||
8143 | // https://html.spec.whatwg.org/multipage/syntax.html#generate-implied-end-tags | ||
8144 | var impliedEndTags = ['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt']; | ||
8145 | |||
8146 | var emptyAncestorInfo = { | ||
8147 | parentTag: null, | ||
8148 | |||
8149 | formTag: null, | ||
8150 | aTagInScope: null, | ||
8151 | buttonTagInScope: null, | ||
8152 | nobrTagInScope: null, | ||
8153 | pTagInButtonScope: null, | ||
8154 | |||
8155 | listItemTagAutoclosing: null, | ||
8156 | dlItemTagAutoclosing: null | ||
8157 | }; | ||
8158 | |||
8159 | var updatedAncestorInfo = function (oldInfo, tag, instance) { | ||
8160 | var ancestorInfo = assign({}, oldInfo || emptyAncestorInfo); | ||
8161 | var info = { tag: tag, instance: instance }; | ||
8162 | |||
8163 | if (inScopeTags.indexOf(tag) !== -1) { | ||
8164 | ancestorInfo.aTagInScope = null; | ||
8165 | ancestorInfo.buttonTagInScope = null; | ||
8166 | ancestorInfo.nobrTagInScope = null; | ||
8167 | } | ||
8168 | if (buttonScopeTags.indexOf(tag) !== -1) { | ||
8169 | ancestorInfo.pTagInButtonScope = null; | ||
8170 | } | ||
8171 | |||
8172 | // See rules for 'li', 'dd', 'dt' start tags in | ||
8173 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody | ||
8174 | if (specialTags.indexOf(tag) !== -1 && tag !== 'address' && tag !== 'div' && tag !== 'p') { | ||
8175 | ancestorInfo.listItemTagAutoclosing = null; | ||
8176 | ancestorInfo.dlItemTagAutoclosing = null; | ||
8177 | } | ||
8178 | |||
8179 | ancestorInfo.parentTag = info; | ||
8180 | |||
8181 | if (tag === 'form') { | ||
8182 | ancestorInfo.formTag = info; | ||
8183 | } | ||
8184 | if (tag === 'a') { | ||
8185 | ancestorInfo.aTagInScope = info; | ||
8186 | } | ||
8187 | if (tag === 'button') { | ||
8188 | ancestorInfo.buttonTagInScope = info; | ||
8189 | } | ||
8190 | if (tag === 'nobr') { | ||
8191 | ancestorInfo.nobrTagInScope = info; | ||
8192 | } | ||
8193 | if (tag === 'p') { | ||
8194 | ancestorInfo.pTagInButtonScope = info; | ||
8195 | } | ||
8196 | if (tag === 'li') { | ||
8197 | ancestorInfo.listItemTagAutoclosing = info; | ||
8198 | } | ||
8199 | if (tag === 'dd' || tag === 'dt') { | ||
8200 | ancestorInfo.dlItemTagAutoclosing = info; | ||
8201 | } | ||
8202 | |||
8203 | return ancestorInfo; | ||
8204 | }; | ||
8205 | |||
8206 | /** | ||
8207 | * Returns whether | ||
8208 | */ | ||
8209 | var isTagValidWithParent = function (tag, parentTag) { | ||
8210 | // First, let's check if we're in an unusual parsing mode... | ||
8211 | switch (parentTag) { | ||
8212 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inselect | ||
8213 | case 'select': | ||
8214 | return tag === 'option' || tag === 'optgroup' || tag === '#text'; | ||
8215 | case 'optgroup': | ||
8216 | return tag === 'option' || tag === '#text'; | ||
8217 | // Strictly speaking, seeing an <option> doesn't mean we're in a <select> | ||
8218 | // but | ||
8219 | case 'option': | ||
8220 | return tag === '#text'; | ||
8221 | |||
8222 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intd | ||
8223 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incaption | ||
8224 | // No special behavior since these rules fall back to "in body" mode for | ||
8225 | // all except special table nodes which cause bad parsing behavior anyway. | ||
8226 | |||
8227 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intr | ||
8228 | case 'tr': | ||
8229 | return tag === 'th' || tag === 'td' || tag === 'style' || tag === 'script' || tag === 'template'; | ||
8230 | |||
8231 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intbody | ||
8232 | case 'tbody': | ||
8233 | case 'thead': | ||
8234 | case 'tfoot': | ||
8235 | return tag === 'tr' || tag === 'style' || tag === 'script' || tag === 'template'; | ||
8236 | |||
8237 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incolgroup | ||
8238 | case 'colgroup': | ||
8239 | return tag === 'col' || tag === 'template'; | ||
8240 | |||
8241 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intable | ||
8242 | case 'table': | ||
8243 | return tag === 'caption' || tag === 'colgroup' || tag === 'tbody' || tag === 'tfoot' || tag === 'thead' || tag === 'style' || tag === 'script' || tag === 'template'; | ||
8244 | |||
8245 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inhead | ||
8246 | case 'head': | ||
8247 | return tag === 'base' || tag === 'basefont' || tag === 'bgsound' || tag === 'link' || tag === 'meta' || tag === 'title' || tag === 'noscript' || tag === 'noframes' || tag === 'style' || tag === 'script' || tag === 'template'; | ||
8248 | |||
8249 | // https://html.spec.whatwg.org/multipage/semantics.html#the-html-element | ||
8250 | case 'html': | ||
8251 | return tag === 'head' || tag === 'body'; | ||
8252 | } | ||
8253 | |||
8254 | // Probably in the "in body" parsing mode, so we outlaw only tag combos | ||
8255 | // where the parsing rules cause implicit opens or closes to be added. | ||
8256 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody | ||
8257 | switch (tag) { | ||
8258 | case 'h1': | ||
8259 | case 'h2': | ||
8260 | case 'h3': | ||
8261 | case 'h4': | ||
8262 | case 'h5': | ||
8263 | case 'h6': | ||
8264 | return parentTag !== 'h1' && parentTag !== 'h2' && parentTag !== 'h3' && parentTag !== 'h4' && parentTag !== 'h5' && parentTag !== 'h6'; | ||
8265 | |||
8266 | case 'rp': | ||
8267 | case 'rt': | ||
8268 | return impliedEndTags.indexOf(parentTag) === -1; | ||
8269 | |||
8270 | case 'caption': | ||
8271 | case 'col': | ||
8272 | case 'colgroup': | ||
8273 | case 'frame': | ||
8274 | case 'head': | ||
8275 | case 'tbody': | ||
8276 | case 'td': | ||
8277 | case 'tfoot': | ||
8278 | case 'th': | ||
8279 | case 'thead': | ||
8280 | case 'tr': | ||
8281 | // These tags are only valid with a few parents that have special child | ||
8282 | // parsing rules -- if we're down here, then none of those matched and | ||
8283 | // so we allow it only if we don't know what the parent is, as all other | ||
8284 | // cases are invalid. | ||
8285 | return parentTag == null; | ||
8286 | } | ||
8287 | |||
8288 | return true; | ||
8289 | }; | ||
8290 | |||
8291 | /** | ||
8292 | * Returns whether | ||
8293 | */ | ||
8294 | var findInvalidAncestorForTag = function (tag, ancestorInfo) { | ||
8295 | switch (tag) { | ||
8296 | case 'address': | ||
8297 | case 'article': | ||
8298 | case 'aside': | ||
8299 | case 'blockquote': | ||
8300 | case 'center': | ||
8301 | case 'details': | ||
8302 | case 'dialog': | ||
8303 | case 'dir': | ||
8304 | case 'div': | ||
8305 | case 'dl': | ||
8306 | case 'fieldset': | ||
8307 | case 'figcaption': | ||
8308 | case 'figure': | ||
8309 | case 'footer': | ||
8310 | case 'header': | ||
8311 | case 'hgroup': | ||
8312 | case 'main': | ||
8313 | case 'menu': | ||
8314 | case 'nav': | ||
8315 | case 'ol': | ||
8316 | case 'p': | ||
8317 | case 'section': | ||
8318 | case 'summary': | ||
8319 | case 'ul': | ||
8320 | |||
8321 | case 'pre': | ||
8322 | case 'listing': | ||
8323 | |||
8324 | case 'table': | ||
8325 | |||
8326 | case 'hr': | ||
8327 | |||
8328 | case 'xmp': | ||
8329 | |||
8330 | case 'h1': | ||
8331 | case 'h2': | ||
8332 | case 'h3': | ||
8333 | case 'h4': | ||
8334 | case 'h5': | ||
8335 | case 'h6': | ||
8336 | return ancestorInfo.pTagInButtonScope; | ||
8337 | |||
8338 | case 'form': | ||
8339 | return ancestorInfo.formTag || ancestorInfo.pTagInButtonScope; | ||
8340 | |||
8341 | case 'li': | ||
8342 | return ancestorInfo.listItemTagAutoclosing; | ||
8343 | |||
8344 | case 'dd': | ||
8345 | case 'dt': | ||
8346 | return ancestorInfo.dlItemTagAutoclosing; | ||
8347 | |||
8348 | case 'button': | ||
8349 | return ancestorInfo.buttonTagInScope; | ||
8350 | |||
8351 | case 'a': | ||
8352 | // Spec says something about storing a list of markers, but it sounds | ||
8353 | // equivalent to this check. | ||
8354 | return ancestorInfo.aTagInScope; | ||
8355 | |||
8356 | case 'nobr': | ||
8357 | return ancestorInfo.nobrTagInScope; | ||
8358 | } | ||
8359 | |||
8360 | return null; | ||
8361 | }; | ||
8362 | |||
8363 | /** | ||
8364 | * Given a ReactCompositeComponent instance, return a list of its recursive | ||
8365 | * owners, starting at the root and ending with the instance itself. | ||
8366 | */ | ||
8367 | var findOwnerStack = function (instance) { | ||
8368 | if (!instance) { | ||
8369 | return []; | ||
8370 | } | ||
8371 | |||
8372 | var stack = []; | ||
8373 | /*eslint-disable space-after-keywords */ | ||
8374 | do { | ||
8375 | /*eslint-enable space-after-keywords */ | ||
8376 | stack.push(instance); | ||
8377 | } while (instance = instance._currentElement._owner); | ||
8378 | stack.reverse(); | ||
8379 | return stack; | ||
8380 | }; | ||
8381 | |||
8382 | var didWarn = {}; | ||
8383 | |||
8384 | validateDOMNesting = function (childTag, childInstance, ancestorInfo) { | ||
8385 | ancestorInfo = ancestorInfo || emptyAncestorInfo; | ||
8386 | var parentInfo = ancestorInfo.parentTag; | ||
8387 | var parentTag = parentInfo && parentInfo.tag; | ||
8388 | |||
8389 | var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo; | ||
8390 | var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo); | ||
8391 | var problematic = invalidParent || invalidAncestor; | ||
8392 | |||
8393 | if (problematic) { | ||
8394 | var ancestorTag = problematic.tag; | ||
8395 | var ancestorInstance = problematic.instance; | ||
8396 | |||
8397 | var childOwner = childInstance && childInstance._currentElement._owner; | ||
8398 | var ancestorOwner = ancestorInstance && ancestorInstance._currentElement._owner; | ||
8399 | |||
8400 | var childOwners = findOwnerStack(childOwner); | ||
8401 | var ancestorOwners = findOwnerStack(ancestorOwner); | ||
8402 | |||
8403 | var minStackLen = Math.min(childOwners.length, ancestorOwners.length); | ||
8404 | var i; | ||
8405 | |||
8406 | var deepestCommon = -1; | ||
8407 | for (i = 0; i < minStackLen; i++) { | ||
8408 | if (childOwners[i] === ancestorOwners[i]) { | ||
8409 | deepestCommon = i; | ||
8410 | } else { | ||
8411 | break; | ||
8412 | } | ||
8413 | } | ||
8414 | |||
8415 | var UNKNOWN = '(unknown)'; | ||
8416 | var childOwnerNames = childOwners.slice(deepestCommon + 1).map(function (inst) { | ||
8417 | return inst.getName() || UNKNOWN; | ||
8418 | }); | ||
8419 | var ancestorOwnerNames = ancestorOwners.slice(deepestCommon + 1).map(function (inst) { | ||
8420 | return inst.getName() || UNKNOWN; | ||
8421 | }); | ||
8422 | var ownerInfo = [].concat( | ||
8423 | // If the parent and child instances have a common owner ancestor, start | ||
8424 | // with that -- otherwise we just start with the parent's owners. | ||
8425 | deepestCommon !== -1 ? childOwners[deepestCommon].getName() || UNKNOWN : [], ancestorOwnerNames, ancestorTag, | ||
8426 | // If we're warning about an invalid (non-parent) ancestry, add '...' | ||
8427 | invalidAncestor ? ['...'] : [], childOwnerNames, childTag).join(' > '); | ||
8428 | |||
8429 | var warnKey = !!invalidParent + '|' + childTag + '|' + ancestorTag + '|' + ownerInfo; | ||
8430 | if (didWarn[warnKey]) { | ||
8431 | return; | ||
8432 | } | ||
8433 | didWarn[warnKey] = true; | ||
8434 | |||
8435 | if (invalidParent) { | ||
8436 | var info = ''; | ||
8437 | if (ancestorTag === 'table' && childTag === 'tr') { | ||
8438 | info += ' Add a <tbody> to your code to match the DOM tree generated by ' + 'the browser.'; | ||
8439 | } | ||
8440 | process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...): <%s> cannot appear as a child of <%s>. ' + 'See %s.%s', childTag, ancestorTag, ownerInfo, info) : undefined; | ||
8441 | } else { | ||
8442 | process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...): <%s> cannot appear as a descendant of ' + '<%s>. See %s.', childTag, ancestorTag, ownerInfo) : undefined; | ||
8443 | } | ||
8444 | } | ||
8445 | }; | ||
8446 | |||
8447 | validateDOMNesting.ancestorInfoContextKey = '__validateDOMNesting_ancestorInfo$' + Math.random().toString(36).slice(2); | ||
8448 | |||
8449 | validateDOMNesting.updatedAncestorInfo = updatedAncestorInfo; | ||
8450 | |||
8451 | // For testing | ||
8452 | validateDOMNesting.isTagValidInContext = function (tag, ancestorInfo) { | ||
8453 | ancestorInfo = ancestorInfo || emptyAncestorInfo; | ||
8454 | var parentInfo = ancestorInfo.parentTag; | ||
8455 | var parentTag = parentInfo && parentInfo.tag; | ||
8456 | return isTagValidWithParent(tag, parentTag) && !findInvalidAncestorForTag(tag, ancestorInfo); | ||
8457 | }; | ||
8458 | } | ||
8459 | |||
8460 | module.exports = validateDOMNesting; | ||
8461 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
8462 | |||
8463 | /***/ }, | ||
8464 | /* 73 */ | ||
8465 | /***/ function(module, exports, __webpack_require__) { | ||
8466 | |||
8467 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
8468 | * Copyright 2013-2015, Facebook, Inc. | ||
8469 | * All rights reserved. | ||
8470 | * | ||
8471 | * This source code is licensed under the BSD-style license found in the | ||
8472 | * LICENSE file in the root directory of this source tree. An additional grant | ||
8473 | * of patent rights can be found in the PATENTS file in the same directory. | ||
8474 | * | ||
8475 | * @providesModule ReactDefaultInjection | ||
8476 | */ | ||
8477 | |||
8478 | 'use strict'; | ||
8479 | |||
8480 | var BeforeInputEventPlugin = __webpack_require__(74); | ||
8481 | var ChangeEventPlugin = __webpack_require__(82); | ||
8482 | var ClientReactRootIndex = __webpack_require__(85); | ||
8483 | var DefaultEventPluginOrder = __webpack_require__(86); | ||
8484 | var EnterLeaveEventPlugin = __webpack_require__(87); | ||
8485 | var ExecutionEnvironment = __webpack_require__(11); | ||
8486 | var HTMLDOMPropertyConfig = __webpack_require__(91); | ||
8487 | var ReactBrowserComponentMixin = __webpack_require__(92); | ||
8488 | var ReactComponentBrowserEnvironment = __webpack_require__(28); | ||
8489 | var ReactDefaultBatchingStrategy = __webpack_require__(94); | ||
8490 | var ReactDOMComponent = __webpack_require__(95); | ||
8491 | var ReactDOMTextComponent = __webpack_require__(8); | ||
8492 | var ReactEventListener = __webpack_require__(120); | ||
8493 | var ReactInjection = __webpack_require__(123); | ||
8494 | var ReactInstanceHandles = __webpack_require__(47); | ||
8495 | var ReactMount = __webpack_require__(30); | ||
8496 | var ReactReconcileTransaction = __webpack_require__(127); | ||
8497 | var SelectEventPlugin = __webpack_require__(132); | ||
8498 | var ServerReactRootIndex = __webpack_require__(133); | ||
8499 | var SimpleEventPlugin = __webpack_require__(134); | ||
8500 | var SVGDOMPropertyConfig = __webpack_require__(143); | ||
8501 | |||
8502 | var alreadyInjected = false; | ||
8503 | |||
8504 | function inject() { | ||
8505 | if (alreadyInjected) { | ||
8506 | // TODO: This is currently true because these injections are shared between | ||
8507 | // the client and the server package. They should be built independently | ||
8508 | // and not share any injection state. Then this problem will be solved. | ||
8509 | return; | ||
8510 | } | ||
8511 | alreadyInjected = true; | ||
8512 | |||
8513 | ReactInjection.EventEmitter.injectReactEventListener(ReactEventListener); | ||
8514 | |||
8515 | /** | ||
8516 | * Inject modules for resolving DOM hierarchy and plugin ordering. | ||
8517 | */ | ||
8518 | ReactInjection.EventPluginHub.injectEventPluginOrder(DefaultEventPluginOrder); | ||
8519 | ReactInjection.EventPluginHub.injectInstanceHandle(ReactInstanceHandles); | ||
8520 | ReactInjection.EventPluginHub.injectMount(ReactMount); | ||
8521 | |||
8522 | /** | ||
8523 | * Some important event plugins included by default (without having to require | ||
8524 | * them). | ||
8525 | */ | ||
8526 | ReactInjection.EventPluginHub.injectEventPluginsByName({ | ||
8527 | SimpleEventPlugin: SimpleEventPlugin, | ||
8528 | EnterLeaveEventPlugin: EnterLeaveEventPlugin, | ||
8529 | ChangeEventPlugin: ChangeEventPlugin, | ||
8530 | SelectEventPlugin: SelectEventPlugin, | ||
8531 | BeforeInputEventPlugin: BeforeInputEventPlugin | ||
8532 | }); | ||
8533 | |||
8534 | ReactInjection.NativeComponent.injectGenericComponentClass(ReactDOMComponent); | ||
8535 | |||
8536 | ReactInjection.NativeComponent.injectTextComponentClass(ReactDOMTextComponent); | ||
8537 | |||
8538 | ReactInjection.Class.injectMixin(ReactBrowserComponentMixin); | ||
8539 | |||
8540 | ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig); | ||
8541 | ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig); | ||
8542 | |||
8543 | ReactInjection.EmptyComponent.injectEmptyComponent('noscript'); | ||
8544 | |||
8545 | ReactInjection.Updates.injectReconcileTransaction(ReactReconcileTransaction); | ||
8546 | ReactInjection.Updates.injectBatchingStrategy(ReactDefaultBatchingStrategy); | ||
8547 | |||
8548 | ReactInjection.RootIndex.injectCreateReactRootIndex(ExecutionEnvironment.canUseDOM ? ClientReactRootIndex.createReactRootIndex : ServerReactRootIndex.createReactRootIndex); | ||
8549 | |||
8550 | ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment); | ||
8551 | |||
8552 | if (process.env.NODE_ENV !== 'production') { | ||
8553 | var url = ExecutionEnvironment.canUseDOM && window.location.href || ''; | ||
8554 | if (/[?&]react_perf\b/.test(url)) { | ||
8555 | var ReactDefaultPerf = __webpack_require__(144); | ||
8556 | ReactDefaultPerf.start(); | ||
8557 | } | ||
8558 | } | ||
8559 | } | ||
8560 | |||
8561 | module.exports = { | ||
8562 | inject: inject | ||
8563 | }; | ||
8564 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
8565 | |||
8566 | /***/ }, | ||
8567 | /* 74 */ | ||
8568 | /***/ function(module, exports, __webpack_require__) { | ||
8569 | |||
8570 | /** | ||
8571 | * Copyright 2013-2015 Facebook, Inc. | ||
8572 | * All rights reserved. | ||
8573 | * | ||
8574 | * This source code is licensed under the BSD-style license found in the | ||
8575 | * LICENSE file in the root directory of this source tree. An additional grant | ||
8576 | * of patent rights can be found in the PATENTS file in the same directory. | ||
8577 | * | ||
8578 | * @providesModule BeforeInputEventPlugin | ||
8579 | * @typechecks static-only | ||
8580 | */ | ||
8581 | |||
8582 | 'use strict'; | ||
8583 | |||
8584 | var EventConstants = __webpack_require__(32); | ||
8585 | var EventPropagators = __webpack_require__(75); | ||
8586 | var ExecutionEnvironment = __webpack_require__(11); | ||
8587 | var FallbackCompositionState = __webpack_require__(76); | ||
8588 | var SyntheticCompositionEvent = __webpack_require__(78); | ||
8589 | var SyntheticInputEvent = __webpack_require__(80); | ||
8590 | |||
8591 | var keyOf = __webpack_require__(81); | ||
8592 | |||
8593 | var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space | ||
8594 | var START_KEYCODE = 229; | ||
8595 | |||
8596 | var canUseCompositionEvent = ExecutionEnvironment.canUseDOM && 'CompositionEvent' in window; | ||
8597 | |||
8598 | var documentMode = null; | ||
8599 | if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) { | ||
8600 | documentMode = document.documentMode; | ||
8601 | } | ||
8602 | |||
8603 | // Webkit offers a very useful `textInput` event that can be used to | ||
8604 | // directly represent `beforeInput`. The IE `textinput` event is not as | ||
8605 | // useful, so we don't use it. | ||
8606 | var canUseTextInputEvent = ExecutionEnvironment.canUseDOM && 'TextEvent' in window && !documentMode && !isPresto(); | ||
8607 | |||
8608 | // In IE9+, we have access to composition events, but the data supplied | ||
8609 | // by the native compositionend event may be incorrect. Japanese ideographic | ||
8610 | // spaces, for instance (\u3000) are not recorded correctly. | ||
8611 | var useFallbackCompositionData = ExecutionEnvironment.canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11); | ||
8612 | |||
8613 | /** | ||
8614 | * Opera <= 12 includes TextEvent in window, but does not fire | ||
8615 | * text input events. Rely on keypress instead. | ||
8616 | */ | ||
8617 | function isPresto() { | ||
8618 | var opera = window.opera; | ||
8619 | return typeof opera === 'object' && typeof opera.version === 'function' && parseInt(opera.version(), 10) <= 12; | ||
8620 | } | ||
8621 | |||
8622 | var SPACEBAR_CODE = 32; | ||
8623 | var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE); | ||
8624 | |||
8625 | var topLevelTypes = EventConstants.topLevelTypes; | ||
8626 | |||
8627 | // Events and their corresponding property names. | ||
8628 | var eventTypes = { | ||
8629 | beforeInput: { | ||
8630 | phasedRegistrationNames: { | ||
8631 | bubbled: keyOf({ onBeforeInput: null }), | ||
8632 | captured: keyOf({ onBeforeInputCapture: null }) | ||
8633 | }, | ||
8634 | dependencies: [topLevelTypes.topCompositionEnd, topLevelTypes.topKeyPress, topLevelTypes.topTextInput, topLevelTypes.topPaste] | ||
8635 | }, | ||
8636 | compositionEnd: { | ||
8637 | phasedRegistrationNames: { | ||
8638 | bubbled: keyOf({ onCompositionEnd: null }), | ||
8639 | captured: keyOf({ onCompositionEndCapture: null }) | ||
8640 | }, | ||
8641 | dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionEnd, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown] | ||
8642 | }, | ||
8643 | compositionStart: { | ||
8644 | phasedRegistrationNames: { | ||
8645 | bubbled: keyOf({ onCompositionStart: null }), | ||
8646 | captured: keyOf({ onCompositionStartCapture: null }) | ||
8647 | }, | ||
8648 | dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionStart, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown] | ||
8649 | }, | ||
8650 | compositionUpdate: { | ||
8651 | phasedRegistrationNames: { | ||
8652 | bubbled: keyOf({ onCompositionUpdate: null }), | ||
8653 | captured: keyOf({ onCompositionUpdateCapture: null }) | ||
8654 | }, | ||
8655 | dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionUpdate, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown] | ||
8656 | } | ||
8657 | }; | ||
8658 | |||
8659 | // Track whether we've ever handled a keypress on the space key. | ||
8660 | var hasSpaceKeypress = false; | ||
8661 | |||
8662 | /** | ||
8663 | * Return whether a native keypress event is assumed to be a command. | ||
8664 | * This is required because Firefox fires `keypress` events for key commands | ||
8665 | * (cut, copy, select-all, etc.) even though no character is inserted. | ||
8666 | */ | ||
8667 | function isKeypressCommand(nativeEvent) { | ||
8668 | return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) && | ||
8669 | // ctrlKey && altKey is equivalent to AltGr, and is not a command. | ||
8670 | !(nativeEvent.ctrlKey && nativeEvent.altKey); | ||
8671 | } | ||
8672 | |||
8673 | /** | ||
8674 | * Translate native top level events into event types. | ||
8675 | * | ||
8676 | * @param {string} topLevelType | ||
8677 | * @return {object} | ||
8678 | */ | ||
8679 | function getCompositionEventType(topLevelType) { | ||
8680 | switch (topLevelType) { | ||
8681 | case topLevelTypes.topCompositionStart: | ||
8682 | return eventTypes.compositionStart; | ||
8683 | case topLevelTypes.topCompositionEnd: | ||
8684 | return eventTypes.compositionEnd; | ||
8685 | case topLevelTypes.topCompositionUpdate: | ||
8686 | return eventTypes.compositionUpdate; | ||
8687 | } | ||
8688 | } | ||
8689 | |||
8690 | /** | ||
8691 | * Does our fallback best-guess model think this event signifies that | ||
8692 | * composition has begun? | ||
8693 | * | ||
8694 | * @param {string} topLevelType | ||
8695 | * @param {object} nativeEvent | ||
8696 | * @return {boolean} | ||
8697 | */ | ||
8698 | function isFallbackCompositionStart(topLevelType, nativeEvent) { | ||
8699 | return topLevelType === topLevelTypes.topKeyDown && nativeEvent.keyCode === START_KEYCODE; | ||
8700 | } | ||
8701 | |||
8702 | /** | ||
8703 | * Does our fallback mode think that this event is the end of composition? | ||
8704 | * | ||
8705 | * @param {string} topLevelType | ||
8706 | * @param {object} nativeEvent | ||
8707 | * @return {boolean} | ||
8708 | */ | ||
8709 | function isFallbackCompositionEnd(topLevelType, nativeEvent) { | ||
8710 | switch (topLevelType) { | ||
8711 | case topLevelTypes.topKeyUp: | ||
8712 | // Command keys insert or clear IME input. | ||
8713 | return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1; | ||
8714 | case topLevelTypes.topKeyDown: | ||
8715 | // Expect IME keyCode on each keydown. If we get any other | ||
8716 | // code we must have exited earlier. | ||
8717 | return nativeEvent.keyCode !== START_KEYCODE; | ||
8718 | case topLevelTypes.topKeyPress: | ||
8719 | case topLevelTypes.topMouseDown: | ||
8720 | case topLevelTypes.topBlur: | ||
8721 | // Events are not possible without cancelling IME. | ||
8722 | return true; | ||
8723 | default: | ||
8724 | return false; | ||
8725 | } | ||
8726 | } | ||
8727 | |||
8728 | /** | ||
8729 | * Google Input Tools provides composition data via a CustomEvent, | ||
8730 | * with the `data` property populated in the `detail` object. If this | ||
8731 | * is available on the event object, use it. If not, this is a plain | ||
8732 | * composition event and we have nothing special to extract. | ||
8733 | * | ||
8734 | * @param {object} nativeEvent | ||
8735 | * @return {?string} | ||
8736 | */ | ||
8737 | function getDataFromCustomEvent(nativeEvent) { | ||
8738 | var detail = nativeEvent.detail; | ||
8739 | if (typeof detail === 'object' && 'data' in detail) { | ||
8740 | return detail.data; | ||
8741 | } | ||
8742 | return null; | ||
8743 | } | ||
8744 | |||
8745 | // Track the current IME composition fallback object, if any. | ||
8746 | var currentComposition = null; | ||
8747 | |||
8748 | /** | ||
8749 | * @param {string} topLevelType Record from `EventConstants`. | ||
8750 | * @param {DOMEventTarget} topLevelTarget The listening component root node. | ||
8751 | * @param {string} topLevelTargetID ID of `topLevelTarget`. | ||
8752 | * @param {object} nativeEvent Native browser event. | ||
8753 | * @return {?object} A SyntheticCompositionEvent. | ||
8754 | */ | ||
8755 | function extractCompositionEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) { | ||
8756 | var eventType; | ||
8757 | var fallbackData; | ||
8758 | |||
8759 | if (canUseCompositionEvent) { | ||
8760 | eventType = getCompositionEventType(topLevelType); | ||
8761 | } else if (!currentComposition) { | ||
8762 | if (isFallbackCompositionStart(topLevelType, nativeEvent)) { | ||
8763 | eventType = eventTypes.compositionStart; | ||
8764 | } | ||
8765 | } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) { | ||
8766 | eventType = eventTypes.compositionEnd; | ||
8767 | } | ||
8768 | |||
8769 | if (!eventType) { | ||
8770 | return null; | ||
8771 | } | ||
8772 | |||
8773 | if (useFallbackCompositionData) { | ||
8774 | // The current composition is stored statically and must not be | ||
8775 | // overwritten while composition continues. | ||
8776 | if (!currentComposition && eventType === eventTypes.compositionStart) { | ||
8777 | currentComposition = FallbackCompositionState.getPooled(topLevelTarget); | ||
8778 | } else if (eventType === eventTypes.compositionEnd) { | ||
8779 | if (currentComposition) { | ||
8780 | fallbackData = currentComposition.getData(); | ||
8781 | } | ||
8782 | } | ||
8783 | } | ||
8784 | |||
8785 | var event = SyntheticCompositionEvent.getPooled(eventType, topLevelTargetID, nativeEvent, nativeEventTarget); | ||
8786 | |||
8787 | if (fallbackData) { | ||
8788 | // Inject data generated from fallback path into the synthetic event. | ||
8789 | // This matches the property of native CompositionEventInterface. | ||
8790 | event.data = fallbackData; | ||
8791 | } else { | ||
8792 | var customData = getDataFromCustomEvent(nativeEvent); | ||
8793 | if (customData !== null) { | ||
8794 | event.data = customData; | ||
8795 | } | ||
8796 | } | ||
8797 | |||
8798 | EventPropagators.accumulateTwoPhaseDispatches(event); | ||
8799 | return event; | ||
8800 | } | ||
8801 | |||
8802 | /** | ||
8803 | * @param {string} topLevelType Record from `EventConstants`. | ||
8804 | * @param {object} nativeEvent Native browser event. | ||
8805 | * @return {?string} The string corresponding to this `beforeInput` event. | ||
8806 | */ | ||
8807 | function getNativeBeforeInputChars(topLevelType, nativeEvent) { | ||
8808 | switch (topLevelType) { | ||
8809 | case topLevelTypes.topCompositionEnd: | ||
8810 | return getDataFromCustomEvent(nativeEvent); | ||
8811 | case topLevelTypes.topKeyPress: | ||
8812 | /** | ||
8813 | * If native `textInput` events are available, our goal is to make | ||
8814 | * use of them. However, there is a special case: the spacebar key. | ||
8815 | * In Webkit, preventing default on a spacebar `textInput` event | ||
8816 | * cancels character insertion, but it *also* causes the browser | ||
8817 | * to fall back to its default spacebar behavior of scrolling the | ||
8818 | * page. | ||
8819 | * | ||
8820 | * Tracking at: | ||
8821 | * https://code.google.com/p/chromium/issues/detail?id=355103 | ||
8822 | * | ||
8823 | * To avoid this issue, use the keypress event as if no `textInput` | ||
8824 | * event is available. | ||
8825 | */ | ||
8826 | var which = nativeEvent.which; | ||
8827 | if (which !== SPACEBAR_CODE) { | ||
8828 | return null; | ||
8829 | } | ||
8830 | |||
8831 | hasSpaceKeypress = true; | ||
8832 | return SPACEBAR_CHAR; | ||
8833 | |||
8834 | case topLevelTypes.topTextInput: | ||
8835 | // Record the characters to be added to the DOM. | ||
8836 | var chars = nativeEvent.data; | ||
8837 | |||
8838 | // If it's a spacebar character, assume that we have already handled | ||
8839 | // it at the keypress level and bail immediately. Android Chrome | ||
8840 | // doesn't give us keycodes, so we need to blacklist it. | ||
8841 | if (chars === SPACEBAR_CHAR && hasSpaceKeypress) { | ||
8842 | return null; | ||
8843 | } | ||
8844 | |||
8845 | return chars; | ||
8846 | |||
8847 | default: | ||
8848 | // For other native event types, do nothing. | ||
8849 | return null; | ||
8850 | } | ||
8851 | } | ||
8852 | |||
8853 | /** | ||
8854 | * For browsers that do not provide the `textInput` event, extract the | ||
8855 | * appropriate string to use for SyntheticInputEvent. | ||
8856 | * | ||
8857 | * @param {string} topLevelType Record from `EventConstants`. | ||
8858 | * @param {object} nativeEvent Native browser event. | ||
8859 | * @return {?string} The fallback string for this `beforeInput` event. | ||
8860 | */ | ||
8861 | function getFallbackBeforeInputChars(topLevelType, nativeEvent) { | ||
8862 | // If we are currently composing (IME) and using a fallback to do so, | ||
8863 | // try to extract the composed characters from the fallback object. | ||
8864 | if (currentComposition) { | ||
8865 | if (topLevelType === topLevelTypes.topCompositionEnd || isFallbackCompositionEnd(topLevelType, nativeEvent)) { | ||
8866 | var chars = currentComposition.getData(); | ||
8867 | FallbackCompositionState.release(currentComposition); | ||
8868 | currentComposition = null; | ||
8869 | return chars; | ||
8870 | } | ||
8871 | return null; | ||
8872 | } | ||
8873 | |||
8874 | switch (topLevelType) { | ||
8875 | case topLevelTypes.topPaste: | ||
8876 | // If a paste event occurs after a keypress, throw out the input | ||
8877 | // chars. Paste events should not lead to BeforeInput events. | ||
8878 | return null; | ||
8879 | case topLevelTypes.topKeyPress: | ||
8880 | /** | ||
8881 | * As of v27, Firefox may fire keypress events even when no character | ||
8882 | * will be inserted. A few possibilities: | ||
8883 | * | ||
8884 | * - `which` is `0`. Arrow keys, Esc key, etc. | ||
8885 | * | ||
8886 | * - `which` is the pressed key code, but no char is available. | ||
8887 | * Ex: 'AltGr + d` in Polish. There is no modified character for | ||
8888 | * this key combination and no character is inserted into the | ||
8889 | * document, but FF fires the keypress for char code `100` anyway. | ||
8890 | * No `input` event will occur. | ||
8891 | * | ||
8892 | * - `which` is the pressed key code, but a command combination is | ||
8893 | * being used. Ex: `Cmd+C`. No character is inserted, and no | ||
8894 | * `input` event will occur. | ||
8895 | */ | ||
8896 | if (nativeEvent.which && !isKeypressCommand(nativeEvent)) { | ||
8897 | return String.fromCharCode(nativeEvent.which); | ||
8898 | } | ||
8899 | return null; | ||
8900 | case topLevelTypes.topCompositionEnd: | ||
8901 | return useFallbackCompositionData ? null : nativeEvent.data; | ||
8902 | default: | ||
8903 | return null; | ||
8904 | } | ||
8905 | } | ||
8906 | |||
8907 | /** | ||
8908 | * Extract a SyntheticInputEvent for `beforeInput`, based on either native | ||
8909 | * `textInput` or fallback behavior. | ||
8910 | * | ||
8911 | * @param {string} topLevelType Record from `EventConstants`. | ||
8912 | * @param {DOMEventTarget} topLevelTarget The listening component root node. | ||
8913 | * @param {string} topLevelTargetID ID of `topLevelTarget`. | ||
8914 | * @param {object} nativeEvent Native browser event. | ||
8915 | * @return {?object} A SyntheticInputEvent. | ||
8916 | */ | ||
8917 | function extractBeforeInputEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) { | ||
8918 | var chars; | ||
8919 | |||
8920 | if (canUseTextInputEvent) { | ||
8921 | chars = getNativeBeforeInputChars(topLevelType, nativeEvent); | ||
8922 | } else { | ||
8923 | chars = getFallbackBeforeInputChars(topLevelType, nativeEvent); | ||
8924 | } | ||
8925 | |||
8926 | // If no characters are being inserted, no BeforeInput event should | ||
8927 | // be fired. | ||
8928 | if (!chars) { | ||
8929 | return null; | ||
8930 | } | ||
8931 | |||
8932 | var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, topLevelTargetID, nativeEvent, nativeEventTarget); | ||
8933 | |||
8934 | event.data = chars; | ||
8935 | EventPropagators.accumulateTwoPhaseDispatches(event); | ||
8936 | return event; | ||
8937 | } | ||
8938 | |||
8939 | /** | ||
8940 | * Create an `onBeforeInput` event to match | ||
8941 | * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents. | ||
8942 | * | ||
8943 | * This event plugin is based on the native `textInput` event | ||
8944 | * available in Chrome, Safari, Opera, and IE. This event fires after | ||
8945 | * `onKeyPress` and `onCompositionEnd`, but before `onInput`. | ||
8946 | * | ||
8947 | * `beforeInput` is spec'd but not implemented in any browsers, and | ||
8948 | * the `input` event does not provide any useful information about what has | ||
8949 | * actually been added, contrary to the spec. Thus, `textInput` is the best | ||
8950 | * available event to identify the characters that have actually been inserted | ||
8951 | * into the target node. | ||
8952 | * | ||
8953 | * This plugin is also responsible for emitting `composition` events, thus | ||
8954 | * allowing us to share composition fallback code for both `beforeInput` and | ||
8955 | * `composition` event types. | ||
8956 | */ | ||
8957 | var BeforeInputEventPlugin = { | ||
8958 | |||
8959 | eventTypes: eventTypes, | ||
8960 | |||
8961 | /** | ||
8962 | * @param {string} topLevelType Record from `EventConstants`. | ||
8963 | * @param {DOMEventTarget} topLevelTarget The listening component root node. | ||
8964 | * @param {string} topLevelTargetID ID of `topLevelTarget`. | ||
8965 | * @param {object} nativeEvent Native browser event. | ||
8966 | * @return {*} An accumulation of synthetic events. | ||
8967 | * @see {EventPluginHub.extractEvents} | ||
8968 | */ | ||
8969 | extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) { | ||
8970 | return [extractCompositionEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget), extractBeforeInputEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget)]; | ||
8971 | } | ||
8972 | }; | ||
8973 | |||
8974 | module.exports = BeforeInputEventPlugin; | ||
8975 | |||
8976 | /***/ }, | ||
8977 | /* 75 */ | ||
8978 | /***/ function(module, exports, __webpack_require__) { | ||
8979 | |||
8980 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
8981 | * Copyright 2013-2015, Facebook, Inc. | ||
8982 | * All rights reserved. | ||
8983 | * | ||
8984 | * This source code is licensed under the BSD-style license found in the | ||
8985 | * LICENSE file in the root directory of this source tree. An additional grant | ||
8986 | * of patent rights can be found in the PATENTS file in the same directory. | ||
8987 | * | ||
8988 | * @providesModule EventPropagators | ||
8989 | */ | ||
8990 | |||
8991 | 'use strict'; | ||
8992 | |||
8993 | var EventConstants = __webpack_require__(32); | ||
8994 | var EventPluginHub = __webpack_require__(33); | ||
8995 | |||
8996 | var warning = __webpack_require__(27); | ||
8997 | |||
8998 | var accumulateInto = __webpack_require__(37); | ||
8999 | var forEachAccumulated = __webpack_require__(38); | ||
9000 | |||
9001 | var PropagationPhases = EventConstants.PropagationPhases; | ||
9002 | var getListener = EventPluginHub.getListener; | ||
9003 | |||
9004 | /** | ||
9005 | * Some event types have a notion of different registration names for different | ||
9006 | * "phases" of propagation. This finds listeners by a given phase. | ||
9007 | */ | ||
9008 | function listenerAtPhase(id, event, propagationPhase) { | ||
9009 | var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase]; | ||
9010 | return getListener(id, registrationName); | ||
9011 | } | ||
9012 | |||
9013 | /** | ||
9014 | * Tags a `SyntheticEvent` with dispatched listeners. Creating this function | ||
9015 | * here, allows us to not have to bind or create functions for each event. | ||
9016 | * Mutating the event's members allows us to not have to create a wrapping | ||
9017 | * "dispatch" object that pairs the event with the listener. | ||
9018 | */ | ||
9019 | function accumulateDirectionalDispatches(domID, upwards, event) { | ||
9020 | if (process.env.NODE_ENV !== 'production') { | ||
9021 | process.env.NODE_ENV !== 'production' ? warning(domID, 'Dispatching id must not be null') : undefined; | ||
9022 | } | ||
9023 | var phase = upwards ? PropagationPhases.bubbled : PropagationPhases.captured; | ||
9024 | var listener = listenerAtPhase(domID, event, phase); | ||
9025 | if (listener) { | ||
9026 | event._dispatchListeners = accumulateInto(event._dispatchListeners, listener); | ||
9027 | event._dispatchIDs = accumulateInto(event._dispatchIDs, domID); | ||
9028 | } | ||
9029 | } | ||
9030 | |||
9031 | /** | ||
9032 | * Collect dispatches (must be entirely collected before dispatching - see unit | ||
9033 | * tests). Lazily allocate the array to conserve memory. We must loop through | ||
9034 | * each event and perform the traversal for each one. We cannot perform a | ||
9035 | * single traversal for the entire collection of events because each event may | ||
9036 | * have a different target. | ||
9037 | */ | ||
9038 | function accumulateTwoPhaseDispatchesSingle(event) { | ||
9039 | if (event && event.dispatchConfig.phasedRegistrationNames) { | ||
9040 | EventPluginHub.injection.getInstanceHandle().traverseTwoPhase(event.dispatchMarker, accumulateDirectionalDispatches, event); | ||
9041 | } | ||
9042 | } | ||
9043 | |||
9044 | /** | ||
9045 | * Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID. | ||
9046 | */ | ||
9047 | function accumulateTwoPhaseDispatchesSingleSkipTarget(event) { | ||
9048 | if (event && event.dispatchConfig.phasedRegistrationNames) { | ||
9049 | EventPluginHub.injection.getInstanceHandle().traverseTwoPhaseSkipTarget(event.dispatchMarker, accumulateDirectionalDispatches, event); | ||
9050 | } | ||
9051 | } | ||
9052 | |||
9053 | /** | ||
9054 | * Accumulates without regard to direction, does not look for phased | ||
9055 | * registration names. Same as `accumulateDirectDispatchesSingle` but without | ||
9056 | * requiring that the `dispatchMarker` be the same as the dispatched ID. | ||
9057 | */ | ||
9058 | function accumulateDispatches(id, ignoredDirection, event) { | ||
9059 | if (event && event.dispatchConfig.registrationName) { | ||
9060 | var registrationName = event.dispatchConfig.registrationName; | ||
9061 | var listener = getListener(id, registrationName); | ||
9062 | if (listener) { | ||
9063 | event._dispatchListeners = accumulateInto(event._dispatchListeners, listener); | ||
9064 | event._dispatchIDs = accumulateInto(event._dispatchIDs, id); | ||
9065 | } | ||
9066 | } | ||
9067 | } | ||
9068 | |||
9069 | /** | ||
9070 | * Accumulates dispatches on an `SyntheticEvent`, but only for the | ||
9071 | * `dispatchMarker`. | ||
9072 | * @param {SyntheticEvent} event | ||
9073 | */ | ||
9074 | function accumulateDirectDispatchesSingle(event) { | ||
9075 | if (event && event.dispatchConfig.registrationName) { | ||
9076 | accumulateDispatches(event.dispatchMarker, null, event); | ||
9077 | } | ||
9078 | } | ||
9079 | |||
9080 | function accumulateTwoPhaseDispatches(events) { | ||
9081 | forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle); | ||
9082 | } | ||
9083 | |||
9084 | function accumulateTwoPhaseDispatchesSkipTarget(events) { | ||
9085 | forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget); | ||
9086 | } | ||
9087 | |||
9088 | function accumulateEnterLeaveDispatches(leave, enter, fromID, toID) { | ||
9089 | EventPluginHub.injection.getInstanceHandle().traverseEnterLeave(fromID, toID, accumulateDispatches, leave, enter); | ||
9090 | } | ||
9091 | |||
9092 | function accumulateDirectDispatches(events) { | ||
9093 | forEachAccumulated(events, accumulateDirectDispatchesSingle); | ||
9094 | } | ||
9095 | |||
9096 | /** | ||
9097 | * A small set of propagation patterns, each of which will accept a small amount | ||
9098 | * of information, and generate a set of "dispatch ready event objects" - which | ||
9099 | * are sets of events that have already been annotated with a set of dispatched | ||
9100 | * listener functions/ids. The API is designed this way to discourage these | ||
9101 | * propagation strategies from actually executing the dispatches, since we | ||
9102 | * always want to collect the entire set of dispatches before executing event a | ||
9103 | * single one. | ||
9104 | * | ||
9105 | * @constructor EventPropagators | ||
9106 | */ | ||
9107 | var EventPropagators = { | ||
9108 | accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches, | ||
9109 | accumulateTwoPhaseDispatchesSkipTarget: accumulateTwoPhaseDispatchesSkipTarget, | ||
9110 | accumulateDirectDispatches: accumulateDirectDispatches, | ||
9111 | accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches | ||
9112 | }; | ||
9113 | |||
9114 | module.exports = EventPropagators; | ||
9115 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
9116 | |||
9117 | /***/ }, | ||
9118 | /* 76 */ | ||
9119 | /***/ function(module, exports, __webpack_require__) { | ||
9120 | |||
9121 | /** | ||
9122 | * Copyright 2013-2015, Facebook, Inc. | ||
9123 | * All rights reserved. | ||
9124 | * | ||
9125 | * This source code is licensed under the BSD-style license found in the | ||
9126 | * LICENSE file in the root directory of this source tree. An additional grant | ||
9127 | * of patent rights can be found in the PATENTS file in the same directory. | ||
9128 | * | ||
9129 | * @providesModule FallbackCompositionState | ||
9130 | * @typechecks static-only | ||
9131 | */ | ||
9132 | |||
9133 | 'use strict'; | ||
9134 | |||
9135 | var PooledClass = __webpack_require__(58); | ||
9136 | |||
9137 | var assign = __webpack_require__(41); | ||
9138 | var getTextContentAccessor = __webpack_require__(77); | ||
9139 | |||
9140 | /** | ||
9141 | * This helper class stores information about text content of a target node, | ||
9142 | * allowing comparison of content before and after a given event. | ||
9143 | * | ||
9144 | * Identify the node where selection currently begins, then observe | ||
9145 | * both its text content and its current position in the DOM. Since the | ||
9146 | * browser may natively replace the target node during composition, we can | ||
9147 | * use its position to find its replacement. | ||
9148 | * | ||
9149 | * @param {DOMEventTarget} root | ||
9150 | */ | ||
9151 | function FallbackCompositionState(root) { | ||
9152 | this._root = root; | ||
9153 | this._startText = this.getText(); | ||
9154 | this._fallbackText = null; | ||
9155 | } | ||
9156 | |||
9157 | assign(FallbackCompositionState.prototype, { | ||
9158 | destructor: function () { | ||
9159 | this._root = null; | ||
9160 | this._startText = null; | ||
9161 | this._fallbackText = null; | ||
9162 | }, | ||
9163 | |||
9164 | /** | ||
9165 | * Get current text of input. | ||
9166 | * | ||
9167 | * @return {string} | ||
9168 | */ | ||
9169 | getText: function () { | ||
9170 | if ('value' in this._root) { | ||
9171 | return this._root.value; | ||
9172 | } | ||
9173 | return this._root[getTextContentAccessor()]; | ||
9174 | }, | ||
9175 | |||
9176 | /** | ||
9177 | * Determine the differing substring between the initially stored | ||
9178 | * text content and the current content. | ||
9179 | * | ||
9180 | * @return {string} | ||
9181 | */ | ||
9182 | getData: function () { | ||
9183 | if (this._fallbackText) { | ||
9184 | return this._fallbackText; | ||
9185 | } | ||
9186 | |||
9187 | var start; | ||
9188 | var startValue = this._startText; | ||
9189 | var startLength = startValue.length; | ||
9190 | var end; | ||
9191 | var endValue = this.getText(); | ||
9192 | var endLength = endValue.length; | ||
9193 | |||
9194 | for (start = 0; start < startLength; start++) { | ||
9195 | if (startValue[start] !== endValue[start]) { | ||
9196 | break; | ||
9197 | } | ||
9198 | } | ||
9199 | |||
9200 | var minEnd = startLength - start; | ||
9201 | for (end = 1; end <= minEnd; end++) { | ||
9202 | if (startValue[startLength - end] !== endValue[endLength - end]) { | ||
9203 | break; | ||
9204 | } | ||
9205 | } | ||
9206 | |||
9207 | var sliceTail = end > 1 ? 1 - end : undefined; | ||
9208 | this._fallbackText = endValue.slice(start, sliceTail); | ||
9209 | return this._fallbackText; | ||
9210 | } | ||
9211 | }); | ||
9212 | |||
9213 | PooledClass.addPoolingTo(FallbackCompositionState); | ||
9214 | |||
9215 | module.exports = FallbackCompositionState; | ||
9216 | |||
9217 | /***/ }, | ||
9218 | /* 77 */ | ||
9219 | /***/ function(module, exports, __webpack_require__) { | ||
9220 | |||
9221 | /** | ||
9222 | * Copyright 2013-2015, Facebook, Inc. | ||
9223 | * All rights reserved. | ||
9224 | * | ||
9225 | * This source code is licensed under the BSD-style license found in the | ||
9226 | * LICENSE file in the root directory of this source tree. An additional grant | ||
9227 | * of patent rights can be found in the PATENTS file in the same directory. | ||
9228 | * | ||
9229 | * @providesModule getTextContentAccessor | ||
9230 | */ | ||
9231 | |||
9232 | 'use strict'; | ||
9233 | |||
9234 | var ExecutionEnvironment = __webpack_require__(11); | ||
9235 | |||
9236 | var contentKey = null; | ||
9237 | |||
9238 | /** | ||
9239 | * Gets the key used to access text content on a DOM node. | ||
9240 | * | ||
9241 | * @return {?string} Key used to access text content. | ||
9242 | * @internal | ||
9243 | */ | ||
9244 | function getTextContentAccessor() { | ||
9245 | if (!contentKey && ExecutionEnvironment.canUseDOM) { | ||
9246 | // Prefer textContent to innerText because many browsers support both but | ||
9247 | // SVG <text> elements don't support innerText even when <div> does. | ||
9248 | contentKey = 'textContent' in document.documentElement ? 'textContent' : 'innerText'; | ||
9249 | } | ||
9250 | return contentKey; | ||
9251 | } | ||
9252 | |||
9253 | module.exports = getTextContentAccessor; | ||
9254 | |||
9255 | /***/ }, | ||
9256 | /* 78 */ | ||
9257 | /***/ function(module, exports, __webpack_require__) { | ||
9258 | |||
9259 | /** | ||
9260 | * Copyright 2013-2015, Facebook, Inc. | ||
9261 | * All rights reserved. | ||
9262 | * | ||
9263 | * This source code is licensed under the BSD-style license found in the | ||
9264 | * LICENSE file in the root directory of this source tree. An additional grant | ||
9265 | * of patent rights can be found in the PATENTS file in the same directory. | ||
9266 | * | ||
9267 | * @providesModule SyntheticCompositionEvent | ||
9268 | * @typechecks static-only | ||
9269 | */ | ||
9270 | |||
9271 | 'use strict'; | ||
9272 | |||
9273 | var SyntheticEvent = __webpack_require__(79); | ||
9274 | |||
9275 | /** | ||
9276 | * @interface Event | ||
9277 | * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents | ||
9278 | */ | ||
9279 | var CompositionEventInterface = { | ||
9280 | data: null | ||
9281 | }; | ||
9282 | |||
9283 | /** | ||
9284 | * @param {object} dispatchConfig Configuration used to dispatch this event. | ||
9285 | * @param {string} dispatchMarker Marker identifying the event target. | ||
9286 | * @param {object} nativeEvent Native browser event. | ||
9287 | * @extends {SyntheticUIEvent} | ||
9288 | */ | ||
9289 | function SyntheticCompositionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | ||
9290 | SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | ||
9291 | } | ||
9292 | |||
9293 | SyntheticEvent.augmentClass(SyntheticCompositionEvent, CompositionEventInterface); | ||
9294 | |||
9295 | module.exports = SyntheticCompositionEvent; | ||
9296 | |||
9297 | /***/ }, | ||
9298 | /* 79 */ | ||
9299 | /***/ function(module, exports, __webpack_require__) { | ||
9300 | |||
9301 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
9302 | * Copyright 2013-2015, Facebook, Inc. | ||
9303 | * All rights reserved. | ||
9304 | * | ||
9305 | * This source code is licensed under the BSD-style license found in the | ||
9306 | * LICENSE file in the root directory of this source tree. An additional grant | ||
9307 | * of patent rights can be found in the PATENTS file in the same directory. | ||
9308 | * | ||
9309 | * @providesModule SyntheticEvent | ||
9310 | * @typechecks static-only | ||
9311 | */ | ||
9312 | |||
9313 | 'use strict'; | ||
9314 | |||
9315 | var PooledClass = __webpack_require__(58); | ||
9316 | |||
9317 | var assign = __webpack_require__(41); | ||
9318 | var emptyFunction = __webpack_require__(17); | ||
9319 | var warning = __webpack_require__(27); | ||
9320 | |||
9321 | /** | ||
9322 | * @interface Event | ||
9323 | * @see http://www.w3.org/TR/DOM-Level-3-Events/ | ||
9324 | */ | ||
9325 | var EventInterface = { | ||
9326 | type: null, | ||
9327 | // currentTarget is set when dispatching; no use in copying it here | ||
9328 | currentTarget: emptyFunction.thatReturnsNull, | ||
9329 | eventPhase: null, | ||
9330 | bubbles: null, | ||
9331 | cancelable: null, | ||
9332 | timeStamp: function (event) { | ||
9333 | return event.timeStamp || Date.now(); | ||
9334 | }, | ||
9335 | defaultPrevented: null, | ||
9336 | isTrusted: null | ||
9337 | }; | ||
9338 | |||
9339 | /** | ||
9340 | * Synthetic events are dispatched by event plugins, typically in response to a | ||
9341 | * top-level event delegation handler. | ||
9342 | * | ||
9343 | * These systems should generally use pooling to reduce the frequency of garbage | ||
9344 | * collection. The system should check `isPersistent` to determine whether the | ||
9345 | * event should be released into the pool after being dispatched. Users that | ||
9346 | * need a persisted event should invoke `persist`. | ||
9347 | * | ||
9348 | * Synthetic events (and subclasses) implement the DOM Level 3 Events API by | ||
9349 | * normalizing browser quirks. Subclasses do not necessarily have to implement a | ||
9350 | * DOM interface; custom application-specific events can also subclass this. | ||
9351 | * | ||
9352 | * @param {object} dispatchConfig Configuration used to dispatch this event. | ||
9353 | * @param {string} dispatchMarker Marker identifying the event target. | ||
9354 | * @param {object} nativeEvent Native browser event. | ||
9355 | */ | ||
9356 | function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | ||
9357 | this.dispatchConfig = dispatchConfig; | ||
9358 | this.dispatchMarker = dispatchMarker; | ||
9359 | this.nativeEvent = nativeEvent; | ||
9360 | this.target = nativeEventTarget; | ||
9361 | this.currentTarget = nativeEventTarget; | ||
9362 | |||
9363 | var Interface = this.constructor.Interface; | ||
9364 | for (var propName in Interface) { | ||
9365 | if (!Interface.hasOwnProperty(propName)) { | ||
9366 | continue; | ||
9367 | } | ||
9368 | var normalize = Interface[propName]; | ||
9369 | if (normalize) { | ||
9370 | this[propName] = normalize(nativeEvent); | ||
9371 | } else { | ||
9372 | this[propName] = nativeEvent[propName]; | ||
9373 | } | ||
9374 | } | ||
9375 | |||
9376 | var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false; | ||
9377 | if (defaultPrevented) { | ||
9378 | this.isDefaultPrevented = emptyFunction.thatReturnsTrue; | ||
9379 | } else { | ||
9380 | this.isDefaultPrevented = emptyFunction.thatReturnsFalse; | ||
9381 | } | ||
9382 | this.isPropagationStopped = emptyFunction.thatReturnsFalse; | ||
9383 | } | ||
9384 | |||
9385 | assign(SyntheticEvent.prototype, { | ||
9386 | |||
9387 | preventDefault: function () { | ||
9388 | this.defaultPrevented = true; | ||
9389 | var event = this.nativeEvent; | ||
9390 | if (process.env.NODE_ENV !== 'production') { | ||
9391 | 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; | ||
9392 | } | ||
9393 | if (!event) { | ||
9394 | return; | ||
9395 | } | ||
9396 | |||
9397 | if (event.preventDefault) { | ||
9398 | event.preventDefault(); | ||
9399 | } else { | ||
9400 | event.returnValue = false; | ||
9401 | } | ||
9402 | this.isDefaultPrevented = emptyFunction.thatReturnsTrue; | ||
9403 | }, | ||
9404 | |||
9405 | stopPropagation: function () { | ||
9406 | var event = this.nativeEvent; | ||
9407 | if (process.env.NODE_ENV !== 'production') { | ||
9408 | 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; | ||
9409 | } | ||
9410 | if (!event) { | ||
9411 | return; | ||
9412 | } | ||
9413 | |||
9414 | if (event.stopPropagation) { | ||
9415 | event.stopPropagation(); | ||
9416 | } else { | ||
9417 | event.cancelBubble = true; | ||
9418 | } | ||
9419 | this.isPropagationStopped = emptyFunction.thatReturnsTrue; | ||
9420 | }, | ||
9421 | |||
9422 | /** | ||
9423 | * We release all dispatched `SyntheticEvent`s after each event loop, adding | ||
9424 | * them back into the pool. This allows a way to hold onto a reference that | ||
9425 | * won't be added back into the pool. | ||
9426 | */ | ||
9427 | persist: function () { | ||
9428 | this.isPersistent = emptyFunction.thatReturnsTrue; | ||
9429 | }, | ||
9430 | |||
9431 | /** | ||
9432 | * Checks if this event should be released back into the pool. | ||
9433 | * | ||
9434 | * @return {boolean} True if this should not be released, false otherwise. | ||
9435 | */ | ||
9436 | isPersistent: emptyFunction.thatReturnsFalse, | ||
9437 | |||
9438 | /** | ||
9439 | * `PooledClass` looks for `destructor` on each instance it releases. | ||
9440 | */ | ||
9441 | destructor: function () { | ||
9442 | var Interface = this.constructor.Interface; | ||
9443 | for (var propName in Interface) { | ||
9444 | this[propName] = null; | ||
9445 | } | ||
9446 | this.dispatchConfig = null; | ||
9447 | this.dispatchMarker = null; | ||
9448 | this.nativeEvent = null; | ||
9449 | } | ||
9450 | |||
9451 | }); | ||
9452 | |||
9453 | SyntheticEvent.Interface = EventInterface; | ||
9454 | |||
9455 | /** | ||
9456 | * Helper to reduce boilerplate when creating subclasses. | ||
9457 | * | ||
9458 | * @param {function} Class | ||
9459 | * @param {?object} Interface | ||
9460 | */ | ||
9461 | SyntheticEvent.augmentClass = function (Class, Interface) { | ||
9462 | var Super = this; | ||
9463 | |||
9464 | var prototype = Object.create(Super.prototype); | ||
9465 | assign(prototype, Class.prototype); | ||
9466 | Class.prototype = prototype; | ||
9467 | Class.prototype.constructor = Class; | ||
9468 | |||
9469 | Class.Interface = assign({}, Super.Interface, Interface); | ||
9470 | Class.augmentClass = Super.augmentClass; | ||
9471 | |||
9472 | PooledClass.addPoolingTo(Class, PooledClass.fourArgumentPooler); | ||
9473 | }; | ||
9474 | |||
9475 | PooledClass.addPoolingTo(SyntheticEvent, PooledClass.fourArgumentPooler); | ||
9476 | |||
9477 | module.exports = SyntheticEvent; | ||
9478 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
9479 | |||
9480 | /***/ }, | ||
9481 | /* 80 */ | ||
9482 | /***/ function(module, exports, __webpack_require__) { | ||
9483 | |||
9484 | /** | ||
9485 | * Copyright 2013-2015, Facebook, Inc. | ||
9486 | * All rights reserved. | ||
9487 | * | ||
9488 | * This source code is licensed under the BSD-style license found in the | ||
9489 | * LICENSE file in the root directory of this source tree. An additional grant | ||
9490 | * of patent rights can be found in the PATENTS file in the same directory. | ||
9491 | * | ||
9492 | * @providesModule SyntheticInputEvent | ||
9493 | * @typechecks static-only | ||
9494 | */ | ||
9495 | |||
9496 | 'use strict'; | ||
9497 | |||
9498 | var SyntheticEvent = __webpack_require__(79); | ||
9499 | |||
9500 | /** | ||
9501 | * @interface Event | ||
9502 | * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105 | ||
9503 | * /#events-inputevents | ||
9504 | */ | ||
9505 | var InputEventInterface = { | ||
9506 | data: null | ||
9507 | }; | ||
9508 | |||
9509 | /** | ||
9510 | * @param {object} dispatchConfig Configuration used to dispatch this event. | ||
9511 | * @param {string} dispatchMarker Marker identifying the event target. | ||
9512 | * @param {object} nativeEvent Native browser event. | ||
9513 | * @extends {SyntheticUIEvent} | ||
9514 | */ | ||
9515 | function SyntheticInputEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | ||
9516 | SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | ||
9517 | } | ||
9518 | |||
9519 | SyntheticEvent.augmentClass(SyntheticInputEvent, InputEventInterface); | ||
9520 | |||
9521 | module.exports = SyntheticInputEvent; | ||
9522 | |||
9523 | /***/ }, | ||
9524 | /* 81 */ | ||
9525 | /***/ function(module, exports) { | ||
9526 | |||
9527 | /** | ||
9528 | * Copyright 2013-2015, Facebook, Inc. | ||
9529 | * All rights reserved. | ||
9530 | * | ||
9531 | * This source code is licensed under the BSD-style license found in the | ||
9532 | * LICENSE file in the root directory of this source tree. An additional grant | ||
9533 | * of patent rights can be found in the PATENTS file in the same directory. | ||
9534 | * | ||
9535 | * @providesModule keyOf | ||
9536 | */ | ||
9537 | |||
9538 | /** | ||
9539 | * Allows extraction of a minified key. Let's the build system minify keys | ||
9540 | * without losing the ability to dynamically use key strings as values | ||
9541 | * themselves. Pass in an object with a single key/val pair and it will return | ||
9542 | * you the string key of that single record. Suppose you want to grab the | ||
9543 | * value for a key 'className' inside of an object. Key/val minification may | ||
9544 | * have aliased that key to be 'xa12'. keyOf({className: null}) will return | ||
9545 | * 'xa12' in that case. Resolve keys you want to use once at startup time, then | ||
9546 | * reuse those resolutions. | ||
9547 | */ | ||
9548 | "use strict"; | ||
9549 | |||
9550 | var keyOf = function (oneKeyObj) { | ||
9551 | var key; | ||
9552 | for (key in oneKeyObj) { | ||
9553 | if (!oneKeyObj.hasOwnProperty(key)) { | ||
9554 | continue; | ||
9555 | } | ||
9556 | return key; | ||
9557 | } | ||
9558 | return null; | ||
9559 | }; | ||
9560 | |||
9561 | module.exports = keyOf; | ||
9562 | |||
9563 | /***/ }, | ||
9564 | /* 82 */ | ||
9565 | /***/ function(module, exports, __webpack_require__) { | ||
9566 | |||
9567 | /** | ||
9568 | * Copyright 2013-2015, Facebook, Inc. | ||
9569 | * All rights reserved. | ||
9570 | * | ||
9571 | * This source code is licensed under the BSD-style license found in the | ||
9572 | * LICENSE file in the root directory of this source tree. An additional grant | ||
9573 | * of patent rights can be found in the PATENTS file in the same directory. | ||
9574 | * | ||
9575 | * @providesModule ChangeEventPlugin | ||
9576 | */ | ||
9577 | |||
9578 | 'use strict'; | ||
9579 | |||
9580 | var EventConstants = __webpack_require__(32); | ||
9581 | var EventPluginHub = __webpack_require__(33); | ||
9582 | var EventPropagators = __webpack_require__(75); | ||
9583 | var ExecutionEnvironment = __webpack_require__(11); | ||
9584 | var ReactUpdates = __webpack_require__(56); | ||
9585 | var SyntheticEvent = __webpack_require__(79); | ||
9586 | |||
9587 | var getEventTarget = __webpack_require__(83); | ||
9588 | var isEventSupported = __webpack_require__(42); | ||
9589 | var isTextInputElement = __webpack_require__(84); | ||
9590 | var keyOf = __webpack_require__(81); | ||
9591 | |||
9592 | var topLevelTypes = EventConstants.topLevelTypes; | ||
9593 | |||
9594 | var eventTypes = { | ||
9595 | change: { | ||
9596 | phasedRegistrationNames: { | ||
9597 | bubbled: keyOf({ onChange: null }), | ||
9598 | captured: keyOf({ onChangeCapture: null }) | ||
9599 | }, | ||
9600 | dependencies: [topLevelTypes.topBlur, topLevelTypes.topChange, topLevelTypes.topClick, topLevelTypes.topFocus, topLevelTypes.topInput, topLevelTypes.topKeyDown, topLevelTypes.topKeyUp, topLevelTypes.topSelectionChange] | ||
9601 | } | ||
9602 | }; | ||
9603 | |||
9604 | /** | ||
9605 | * For IE shims | ||
9606 | */ | ||
9607 | var activeElement = null; | ||
9608 | var activeElementID = null; | ||
9609 | var activeElementValue = null; | ||
9610 | var activeElementValueProp = null; | ||
9611 | |||
9612 | /** | ||
9613 | * SECTION: handle `change` event | ||
9614 | */ | ||
9615 | function shouldUseChangeEvent(elem) { | ||
9616 | var nodeName = elem.nodeName && elem.nodeName.toLowerCase(); | ||
9617 | return nodeName === 'select' || nodeName === 'input' && elem.type === 'file'; | ||
9618 | } | ||
9619 | |||
9620 | var doesChangeEventBubble = false; | ||
9621 | if (ExecutionEnvironment.canUseDOM) { | ||
9622 | // See `handleChange` comment below | ||
9623 | doesChangeEventBubble = isEventSupported('change') && (!('documentMode' in document) || document.documentMode > 8); | ||
9624 | } | ||
9625 | |||
9626 | function manualDispatchChangeEvent(nativeEvent) { | ||
9627 | var event = SyntheticEvent.getPooled(eventTypes.change, activeElementID, nativeEvent, getEventTarget(nativeEvent)); | ||
9628 | EventPropagators.accumulateTwoPhaseDispatches(event); | ||
9629 | |||
9630 | // If change and propertychange bubbled, we'd just bind to it like all the | ||
9631 | // other events and have it go through ReactBrowserEventEmitter. Since it | ||
9632 | // doesn't, we manually listen for the events and so we have to enqueue and | ||
9633 | // process the abstract event manually. | ||
9634 | // | ||
9635 | // Batching is necessary here in order to ensure that all event handlers run | ||
9636 | // before the next rerender (including event handlers attached to ancestor | ||
9637 | // elements instead of directly on the input). Without this, controlled | ||
9638 | // components don't work properly in conjunction with event bubbling because | ||
9639 | // the component is rerendered and the value reverted before all the event | ||
9640 | // handlers can run. See https://github.com/facebook/react/issues/708. | ||
9641 | ReactUpdates.batchedUpdates(runEventInBatch, event); | ||
9642 | } | ||
9643 | |||
9644 | function runEventInBatch(event) { | ||
9645 | EventPluginHub.enqueueEvents(event); | ||
9646 | EventPluginHub.processEventQueue(false); | ||
9647 | } | ||
9648 | |||
9649 | function startWatchingForChangeEventIE8(target, targetID) { | ||
9650 | activeElement = target; | ||
9651 | activeElementID = targetID; | ||
9652 | activeElement.attachEvent('onchange', manualDispatchChangeEvent); | ||
9653 | } | ||
9654 | |||
9655 | function stopWatchingForChangeEventIE8() { | ||
9656 | if (!activeElement) { | ||
9657 | return; | ||
9658 | } | ||
9659 | activeElement.detachEvent('onchange', manualDispatchChangeEvent); | ||
9660 | activeElement = null; | ||
9661 | activeElementID = null; | ||
9662 | } | ||
9663 | |||
9664 | function getTargetIDForChangeEvent(topLevelType, topLevelTarget, topLevelTargetID) { | ||
9665 | if (topLevelType === topLevelTypes.topChange) { | ||
9666 | return topLevelTargetID; | ||
9667 | } | ||
9668 | } | ||
9669 | function handleEventsForChangeEventIE8(topLevelType, topLevelTarget, topLevelTargetID) { | ||
9670 | if (topLevelType === topLevelTypes.topFocus) { | ||
9671 | // stopWatching() should be a noop here but we call it just in case we | ||
9672 | // missed a blur event somehow. | ||
9673 | stopWatchingForChangeEventIE8(); | ||
9674 | startWatchingForChangeEventIE8(topLevelTarget, topLevelTargetID); | ||
9675 | } else if (topLevelType === topLevelTypes.topBlur) { | ||
9676 | stopWatchingForChangeEventIE8(); | ||
9677 | } | ||
9678 | } | ||
9679 | |||
9680 | /** | ||
9681 | * SECTION: handle `input` event | ||
9682 | */ | ||
9683 | var isInputEventSupported = false; | ||
9684 | if (ExecutionEnvironment.canUseDOM) { | ||
9685 | // IE9 claims to support the input event but fails to trigger it when | ||
9686 | // deleting text, so we ignore its input events | ||
9687 | isInputEventSupported = isEventSupported('input') && (!('documentMode' in document) || document.documentMode > 9); | ||
9688 | } | ||
9689 | |||
9690 | /** | ||
9691 | * (For old IE.) Replacement getter/setter for the `value` property that gets | ||
9692 | * set on the active element. | ||
9693 | */ | ||
9694 | var newValueProp = { | ||
9695 | get: function () { | ||
9696 | return activeElementValueProp.get.call(this); | ||
9697 | }, | ||
9698 | set: function (val) { | ||
9699 | // Cast to a string so we can do equality checks. | ||
9700 | activeElementValue = '' + val; | ||
9701 | activeElementValueProp.set.call(this, val); | ||
9702 | } | ||
9703 | }; | ||
9704 | |||
9705 | /** | ||
9706 | * (For old IE.) Starts tracking propertychange events on the passed-in element | ||
9707 | * and override the value property so that we can distinguish user events from | ||
9708 | * value changes in JS. | ||
9709 | */ | ||
9710 | function startWatchingForValueChange(target, targetID) { | ||
9711 | activeElement = target; | ||
9712 | activeElementID = targetID; | ||
9713 | activeElementValue = target.value; | ||
9714 | activeElementValueProp = Object.getOwnPropertyDescriptor(target.constructor.prototype, 'value'); | ||
9715 | |||
9716 | // Not guarded in a canDefineProperty check: IE8 supports defineProperty only | ||
9717 | // on DOM elements | ||
9718 | Object.defineProperty(activeElement, 'value', newValueProp); | ||
9719 | activeElement.attachEvent('onpropertychange', handlePropertyChange); | ||
9720 | } | ||
9721 | |||
9722 | /** | ||
9723 | * (For old IE.) Removes the event listeners from the currently-tracked element, | ||
9724 | * if any exists. | ||
9725 | */ | ||
9726 | function stopWatchingForValueChange() { | ||
9727 | if (!activeElement) { | ||
9728 | return; | ||
9729 | } | ||
9730 | |||
9731 | // delete restores the original property definition | ||
9732 | delete activeElement.value; | ||
9733 | activeElement.detachEvent('onpropertychange', handlePropertyChange); | ||
9734 | |||
9735 | activeElement = null; | ||
9736 | activeElementID = null; | ||
9737 | activeElementValue = null; | ||
9738 | activeElementValueProp = null; | ||
9739 | } | ||
9740 | |||
9741 | /** | ||
9742 | * (For old IE.) Handles a propertychange event, sending a `change` event if | ||
9743 | * the value of the active element has changed. | ||
9744 | */ | ||
9745 | function handlePropertyChange(nativeEvent) { | ||
9746 | if (nativeEvent.propertyName !== 'value') { | ||
9747 | return; | ||
9748 | } | ||
9749 | var value = nativeEvent.srcElement.value; | ||
9750 | if (value === activeElementValue) { | ||
9751 | return; | ||
9752 | } | ||
9753 | activeElementValue = value; | ||
9754 | |||
9755 | manualDispatchChangeEvent(nativeEvent); | ||
9756 | } | ||
9757 | |||
9758 | /** | ||
9759 | * If a `change` event should be fired, returns the target's ID. | ||
9760 | */ | ||
9761 | function getTargetIDForInputEvent(topLevelType, topLevelTarget, topLevelTargetID) { | ||
9762 | if (topLevelType === topLevelTypes.topInput) { | ||
9763 | // In modern browsers (i.e., not IE8 or IE9), the input event is exactly | ||
9764 | // what we want so fall through here and trigger an abstract event | ||
9765 | return topLevelTargetID; | ||
9766 | } | ||
9767 | } | ||
9768 | |||
9769 | // For IE8 and IE9. | ||
9770 | function handleEventsForInputEventIE(topLevelType, topLevelTarget, topLevelTargetID) { | ||
9771 | if (topLevelType === topLevelTypes.topFocus) { | ||
9772 | // In IE8, we can capture almost all .value changes by adding a | ||
9773 | // propertychange handler and looking for events with propertyName | ||
9774 | // equal to 'value' | ||
9775 | // In IE9, propertychange fires for most input events but is buggy and | ||
9776 | // doesn't fire when text is deleted, but conveniently, selectionchange | ||
9777 | // appears to fire in all of the remaining cases so we catch those and | ||
9778 | // forward the event if the value has changed | ||
9779 | // In either case, we don't want to call the event handler if the value | ||
9780 | // is changed from JS so we redefine a setter for `.value` that updates | ||
9781 | // our activeElementValue variable, allowing us to ignore those changes | ||
9782 | // | ||
9783 | // stopWatching() should be a noop here but we call it just in case we | ||
9784 | // missed a blur event somehow. | ||
9785 | stopWatchingForValueChange(); | ||
9786 | startWatchingForValueChange(topLevelTarget, topLevelTargetID); | ||
9787 | } else if (topLevelType === topLevelTypes.topBlur) { | ||
9788 | stopWatchingForValueChange(); | ||
9789 | } | ||
9790 | } | ||
9791 | |||
9792 | // For IE8 and IE9. | ||
9793 | function getTargetIDForInputEventIE(topLevelType, topLevelTarget, topLevelTargetID) { | ||
9794 | if (topLevelType === topLevelTypes.topSelectionChange || topLevelType === topLevelTypes.topKeyUp || topLevelType === topLevelTypes.topKeyDown) { | ||
9795 | // On the selectionchange event, the target is just document which isn't | ||
9796 | // helpful for us so just check activeElement instead. | ||
9797 | // | ||
9798 | // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire | ||
9799 | // propertychange on the first input event after setting `value` from a | ||
9800 | // script and fires only keydown, keypress, keyup. Catching keyup usually | ||
9801 | // gets it and catching keydown lets us fire an event for the first | ||
9802 | // keystroke if user does a key repeat (it'll be a little delayed: right | ||
9803 | // before the second keystroke). Other input methods (e.g., paste) seem to | ||
9804 | // fire selectionchange normally. | ||
9805 | if (activeElement && activeElement.value !== activeElementValue) { | ||
9806 | activeElementValue = activeElement.value; | ||
9807 | return activeElementID; | ||
9808 | } | ||
9809 | } | ||
9810 | } | ||
9811 | |||
9812 | /** | ||
9813 | * SECTION: handle `click` event | ||
9814 | */ | ||
9815 | function shouldUseClickEvent(elem) { | ||
9816 | // Use the `click` event to detect changes to checkbox and radio inputs. | ||
9817 | // This approach works across all browsers, whereas `change` does not fire | ||
9818 | // until `blur` in IE8. | ||
9819 | return elem.nodeName && elem.nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio'); | ||
9820 | } | ||
9821 | |||
9822 | function getTargetIDForClickEvent(topLevelType, topLevelTarget, topLevelTargetID) { | ||
9823 | if (topLevelType === topLevelTypes.topClick) { | ||
9824 | return topLevelTargetID; | ||
9825 | } | ||
9826 | } | ||
9827 | |||
9828 | /** | ||
9829 | * This plugin creates an `onChange` event that normalizes change events | ||
9830 | * across form elements. This event fires at a time when it's possible to | ||
9831 | * change the element's value without seeing a flicker. | ||
9832 | * | ||
9833 | * Supported elements are: | ||
9834 | * - input (see `isTextInputElement`) | ||
9835 | * - textarea | ||
9836 | * - select | ||
9837 | */ | ||
9838 | var ChangeEventPlugin = { | ||
9839 | |||
9840 | eventTypes: eventTypes, | ||
9841 | |||
9842 | /** | ||
9843 | * @param {string} topLevelType Record from `EventConstants`. | ||
9844 | * @param {DOMEventTarget} topLevelTarget The listening component root node. | ||
9845 | * @param {string} topLevelTargetID ID of `topLevelTarget`. | ||
9846 | * @param {object} nativeEvent Native browser event. | ||
9847 | * @return {*} An accumulation of synthetic events. | ||
9848 | * @see {EventPluginHub.extractEvents} | ||
9849 | */ | ||
9850 | extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) { | ||
9851 | |||
9852 | var getTargetIDFunc, handleEventFunc; | ||
9853 | if (shouldUseChangeEvent(topLevelTarget)) { | ||
9854 | if (doesChangeEventBubble) { | ||
9855 | getTargetIDFunc = getTargetIDForChangeEvent; | ||
9856 | } else { | ||
9857 | handleEventFunc = handleEventsForChangeEventIE8; | ||
9858 | } | ||
9859 | } else if (isTextInputElement(topLevelTarget)) { | ||
9860 | if (isInputEventSupported) { | ||
9861 | getTargetIDFunc = getTargetIDForInputEvent; | ||
9862 | } else { | ||
9863 | getTargetIDFunc = getTargetIDForInputEventIE; | ||
9864 | handleEventFunc = handleEventsForInputEventIE; | ||
9865 | } | ||
9866 | } else if (shouldUseClickEvent(topLevelTarget)) { | ||
9867 | getTargetIDFunc = getTargetIDForClickEvent; | ||
9868 | } | ||
9869 | |||
9870 | if (getTargetIDFunc) { | ||
9871 | var targetID = getTargetIDFunc(topLevelType, topLevelTarget, topLevelTargetID); | ||
9872 | if (targetID) { | ||
9873 | var event = SyntheticEvent.getPooled(eventTypes.change, targetID, nativeEvent, nativeEventTarget); | ||
9874 | event.type = 'change'; | ||
9875 | EventPropagators.accumulateTwoPhaseDispatches(event); | ||
9876 | return event; | ||
9877 | } | ||
9878 | } | ||
9879 | |||
9880 | if (handleEventFunc) { | ||
9881 | handleEventFunc(topLevelType, topLevelTarget, topLevelTargetID); | ||
9882 | } | ||
9883 | } | ||
9884 | |||
9885 | }; | ||
9886 | |||
9887 | module.exports = ChangeEventPlugin; | ||
9888 | |||
9889 | /***/ }, | ||
9890 | /* 83 */ | ||
9891 | /***/ function(module, exports) { | ||
9892 | |||
9893 | /** | ||
9894 | * Copyright 2013-2015, Facebook, Inc. | ||
9895 | * All rights reserved. | ||
9896 | * | ||
9897 | * This source code is licensed under the BSD-style license found in the | ||
9898 | * LICENSE file in the root directory of this source tree. An additional grant | ||
9899 | * of patent rights can be found in the PATENTS file in the same directory. | ||
9900 | * | ||
9901 | * @providesModule getEventTarget | ||
9902 | * @typechecks static-only | ||
9903 | */ | ||
9904 | |||
9905 | 'use strict'; | ||
9906 | |||
9907 | /** | ||
9908 | * Gets the target node from a native browser event by accounting for | ||
9909 | * inconsistencies in browser DOM APIs. | ||
9910 | * | ||
9911 | * @param {object} nativeEvent Native browser event. | ||
9912 | * @return {DOMEventTarget} Target node. | ||
9913 | */ | ||
9914 | function getEventTarget(nativeEvent) { | ||
9915 | var target = nativeEvent.target || nativeEvent.srcElement || window; | ||
9916 | // Safari may fire events on text nodes (Node.TEXT_NODE is 3). | ||
9917 | // @see http://www.quirksmode.org/js/events_properties.html | ||
9918 | return target.nodeType === 3 ? target.parentNode : target; | ||
9919 | } | ||
9920 | |||
9921 | module.exports = getEventTarget; | ||
9922 | |||
9923 | /***/ }, | ||
9924 | /* 84 */ | ||
9925 | /***/ function(module, exports) { | ||
9926 | |||
9927 | /** | ||
9928 | * Copyright 2013-2015, Facebook, Inc. | ||
9929 | * All rights reserved. | ||
9930 | * | ||
9931 | * This source code is licensed under the BSD-style license found in the | ||
9932 | * LICENSE file in the root directory of this source tree. An additional grant | ||
9933 | * of patent rights can be found in the PATENTS file in the same directory. | ||
9934 | * | ||
9935 | * @providesModule isTextInputElement | ||
9936 | */ | ||
9937 | |||
9938 | 'use strict'; | ||
9939 | |||
9940 | /** | ||
9941 | * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary | ||
9942 | */ | ||
9943 | var supportedInputTypes = { | ||
9944 | 'color': true, | ||
9945 | 'date': true, | ||
9946 | 'datetime': true, | ||
9947 | 'datetime-local': true, | ||
9948 | 'email': true, | ||
9949 | 'month': true, | ||
9950 | 'number': true, | ||
9951 | 'password': true, | ||
9952 | 'range': true, | ||
9953 | 'search': true, | ||
9954 | 'tel': true, | ||
9955 | 'text': true, | ||
9956 | 'time': true, | ||
9957 | 'url': true, | ||
9958 | 'week': true | ||
9959 | }; | ||
9960 | |||
9961 | function isTextInputElement(elem) { | ||
9962 | var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase(); | ||
9963 | return nodeName && (nodeName === 'input' && supportedInputTypes[elem.type] || nodeName === 'textarea'); | ||
9964 | } | ||
9965 | |||
9966 | module.exports = isTextInputElement; | ||
9967 | |||
9968 | /***/ }, | ||
9969 | /* 85 */ | ||
9970 | /***/ function(module, exports) { | ||
9971 | |||
9972 | /** | ||
9973 | * Copyright 2013-2015, Facebook, Inc. | ||
9974 | * All rights reserved. | ||
9975 | * | ||
9976 | * This source code is licensed under the BSD-style license found in the | ||
9977 | * LICENSE file in the root directory of this source tree. An additional grant | ||
9978 | * of patent rights can be found in the PATENTS file in the same directory. | ||
9979 | * | ||
9980 | * @providesModule ClientReactRootIndex | ||
9981 | * @typechecks | ||
9982 | */ | ||
9983 | |||
9984 | 'use strict'; | ||
9985 | |||
9986 | var nextReactRootIndex = 0; | ||
9987 | |||
9988 | var ClientReactRootIndex = { | ||
9989 | createReactRootIndex: function () { | ||
9990 | return nextReactRootIndex++; | ||
9991 | } | ||
9992 | }; | ||
9993 | |||
9994 | module.exports = ClientReactRootIndex; | ||
9995 | |||
9996 | /***/ }, | ||
9997 | /* 86 */ | ||
9998 | /***/ function(module, exports, __webpack_require__) { | ||
9999 | |||
10000 | /** | ||
10001 | * Copyright 2013-2015, Facebook, Inc. | ||
10002 | * All rights reserved. | ||
10003 | * | ||
10004 | * This source code is licensed under the BSD-style license found in the | ||
10005 | * LICENSE file in the root directory of this source tree. An additional grant | ||
10006 | * of patent rights can be found in the PATENTS file in the same directory. | ||
10007 | * | ||
10008 | * @providesModule DefaultEventPluginOrder | ||
10009 | */ | ||
10010 | |||
10011 | 'use strict'; | ||
10012 | |||
10013 | var keyOf = __webpack_require__(81); | ||
10014 | |||
10015 | /** | ||
10016 | * Module that is injectable into `EventPluginHub`, that specifies a | ||
10017 | * deterministic ordering of `EventPlugin`s. A convenient way to reason about | ||
10018 | * plugins, without having to package every one of them. This is better than | ||
10019 | * having plugins be ordered in the same order that they are injected because | ||
10020 | * that ordering would be influenced by the packaging order. | ||
10021 | * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that | ||
10022 | * preventing default on events is convenient in `SimpleEventPlugin` handlers. | ||
10023 | */ | ||
10024 | var DefaultEventPluginOrder = [keyOf({ ResponderEventPlugin: null }), keyOf({ SimpleEventPlugin: null }), keyOf({ TapEventPlugin: null }), keyOf({ EnterLeaveEventPlugin: null }), keyOf({ ChangeEventPlugin: null }), keyOf({ SelectEventPlugin: null }), keyOf({ BeforeInputEventPlugin: null })]; | ||
10025 | |||
10026 | module.exports = DefaultEventPluginOrder; | ||
10027 | |||
10028 | /***/ }, | ||
10029 | /* 87 */ | ||
10030 | /***/ function(module, exports, __webpack_require__) { | ||
10031 | |||
10032 | /** | ||
10033 | * Copyright 2013-2015, Facebook, Inc. | ||
10034 | * All rights reserved. | ||
10035 | * | ||
10036 | * This source code is licensed under the BSD-style license found in the | ||
10037 | * LICENSE file in the root directory of this source tree. An additional grant | ||
10038 | * of patent rights can be found in the PATENTS file in the same directory. | ||
10039 | * | ||
10040 | * @providesModule EnterLeaveEventPlugin | ||
10041 | * @typechecks static-only | ||
10042 | */ | ||
10043 | |||
10044 | 'use strict'; | ||
10045 | |||
10046 | var EventConstants = __webpack_require__(32); | ||
10047 | var EventPropagators = __webpack_require__(75); | ||
10048 | var SyntheticMouseEvent = __webpack_require__(88); | ||
10049 | |||
10050 | var ReactMount = __webpack_require__(30); | ||
10051 | var keyOf = __webpack_require__(81); | ||
10052 | |||
10053 | var topLevelTypes = EventConstants.topLevelTypes; | ||
10054 | var getFirstReactDOM = ReactMount.getFirstReactDOM; | ||
10055 | |||
10056 | var eventTypes = { | ||
10057 | mouseEnter: { | ||
10058 | registrationName: keyOf({ onMouseEnter: null }), | ||
10059 | dependencies: [topLevelTypes.topMouseOut, topLevelTypes.topMouseOver] | ||
10060 | }, | ||
10061 | mouseLeave: { | ||
10062 | registrationName: keyOf({ onMouseLeave: null }), | ||
10063 | dependencies: [topLevelTypes.topMouseOut, topLevelTypes.topMouseOver] | ||
10064 | } | ||
10065 | }; | ||
10066 | |||
10067 | var extractedEvents = [null, null]; | ||
10068 | |||
10069 | var EnterLeaveEventPlugin = { | ||
10070 | |||
10071 | eventTypes: eventTypes, | ||
10072 | |||
10073 | /** | ||
10074 | * For almost every interaction we care about, there will be both a top-level | ||
10075 | * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that | ||
10076 | * we do not extract duplicate events. However, moving the mouse into the | ||
10077 | * browser from outside will not fire a `mouseout` event. In this case, we use | ||
10078 | * the `mouseover` top-level event. | ||
10079 | * | ||
10080 | * @param {string} topLevelType Record from `EventConstants`. | ||
10081 | * @param {DOMEventTarget} topLevelTarget The listening component root node. | ||
10082 | * @param {string} topLevelTargetID ID of `topLevelTarget`. | ||
10083 | * @param {object} nativeEvent Native browser event. | ||
10084 | * @return {*} An accumulation of synthetic events. | ||
10085 | * @see {EventPluginHub.extractEvents} | ||
10086 | */ | ||
10087 | extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) { | ||
10088 | if (topLevelType === topLevelTypes.topMouseOver && (nativeEvent.relatedTarget || nativeEvent.fromElement)) { | ||
10089 | return null; | ||
10090 | } | ||
10091 | if (topLevelType !== topLevelTypes.topMouseOut && topLevelType !== topLevelTypes.topMouseOver) { | ||
10092 | // Must not be a mouse in or mouse out - ignoring. | ||
10093 | return null; | ||
10094 | } | ||
10095 | |||
10096 | var win; | ||
10097 | if (topLevelTarget.window === topLevelTarget) { | ||
10098 | // `topLevelTarget` is probably a window object. | ||
10099 | win = topLevelTarget; | ||
10100 | } else { | ||
10101 | // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8. | ||
10102 | var doc = topLevelTarget.ownerDocument; | ||
10103 | if (doc) { | ||
10104 | win = doc.defaultView || doc.parentWindow; | ||
10105 | } else { | ||
10106 | win = window; | ||
10107 | } | ||
10108 | } | ||
10109 | |||
10110 | var from; | ||
10111 | var to; | ||
10112 | var fromID = ''; | ||
10113 | var toID = ''; | ||
10114 | if (topLevelType === topLevelTypes.topMouseOut) { | ||
10115 | from = topLevelTarget; | ||
10116 | fromID = topLevelTargetID; | ||
10117 | to = getFirstReactDOM(nativeEvent.relatedTarget || nativeEvent.toElement); | ||
10118 | if (to) { | ||
10119 | toID = ReactMount.getID(to); | ||
10120 | } else { | ||
10121 | to = win; | ||
10122 | } | ||
10123 | to = to || win; | ||
10124 | } else { | ||
10125 | from = win; | ||
10126 | to = topLevelTarget; | ||
10127 | toID = topLevelTargetID; | ||
10128 | } | ||
10129 | |||
10130 | if (from === to) { | ||
10131 | // Nothing pertains to our managed components. | ||
10132 | return null; | ||
10133 | } | ||
10134 | |||
10135 | var leave = SyntheticMouseEvent.getPooled(eventTypes.mouseLeave, fromID, nativeEvent, nativeEventTarget); | ||
10136 | leave.type = 'mouseleave'; | ||
10137 | leave.target = from; | ||
10138 | leave.relatedTarget = to; | ||
10139 | |||
10140 | var enter = SyntheticMouseEvent.getPooled(eventTypes.mouseEnter, toID, nativeEvent, nativeEventTarget); | ||
10141 | enter.type = 'mouseenter'; | ||
10142 | enter.target = to; | ||
10143 | enter.relatedTarget = from; | ||
10144 | |||
10145 | EventPropagators.accumulateEnterLeaveDispatches(leave, enter, fromID, toID); | ||
10146 | |||
10147 | extractedEvents[0] = leave; | ||
10148 | extractedEvents[1] = enter; | ||
10149 | |||
10150 | return extractedEvents; | ||
10151 | } | ||
10152 | |||
10153 | }; | ||
10154 | |||
10155 | module.exports = EnterLeaveEventPlugin; | ||
10156 | |||
10157 | /***/ }, | ||
10158 | /* 88 */ | ||
10159 | /***/ function(module, exports, __webpack_require__) { | ||
10160 | |||
10161 | /** | ||
10162 | * Copyright 2013-2015, Facebook, Inc. | ||
10163 | * All rights reserved. | ||
10164 | * | ||
10165 | * This source code is licensed under the BSD-style license found in the | ||
10166 | * LICENSE file in the root directory of this source tree. An additional grant | ||
10167 | * of patent rights can be found in the PATENTS file in the same directory. | ||
10168 | * | ||
10169 | * @providesModule SyntheticMouseEvent | ||
10170 | * @typechecks static-only | ||
10171 | */ | ||
10172 | |||
10173 | 'use strict'; | ||
10174 | |||
10175 | var SyntheticUIEvent = __webpack_require__(89); | ||
10176 | var ViewportMetrics = __webpack_require__(40); | ||
10177 | |||
10178 | var getEventModifierState = __webpack_require__(90); | ||
10179 | |||
10180 | /** | ||
10181 | * @interface MouseEvent | ||
10182 | * @see http://www.w3.org/TR/DOM-Level-3-Events/ | ||
10183 | */ | ||
10184 | var MouseEventInterface = { | ||
10185 | screenX: null, | ||
10186 | screenY: null, | ||
10187 | clientX: null, | ||
10188 | clientY: null, | ||
10189 | ctrlKey: null, | ||
10190 | shiftKey: null, | ||
10191 | altKey: null, | ||
10192 | metaKey: null, | ||
10193 | getModifierState: getEventModifierState, | ||
10194 | button: function (event) { | ||
10195 | // Webkit, Firefox, IE9+ | ||
10196 | // which: 1 2 3 | ||
10197 | // button: 0 1 2 (standard) | ||
10198 | var button = event.button; | ||
10199 | if ('which' in event) { | ||
10200 | return button; | ||
10201 | } | ||
10202 | // IE<9 | ||
10203 | // which: undefined | ||
10204 | // button: 0 0 0 | ||
10205 | // button: 1 4 2 (onmouseup) | ||
10206 | return button === 2 ? 2 : button === 4 ? 1 : 0; | ||
10207 | }, | ||
10208 | buttons: null, | ||
10209 | relatedTarget: function (event) { | ||
10210 | return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement); | ||
10211 | }, | ||
10212 | // "Proprietary" Interface. | ||
10213 | pageX: function (event) { | ||
10214 | return 'pageX' in event ? event.pageX : event.clientX + ViewportMetrics.currentScrollLeft; | ||
10215 | }, | ||
10216 | pageY: function (event) { | ||
10217 | return 'pageY' in event ? event.pageY : event.clientY + ViewportMetrics.currentScrollTop; | ||
10218 | } | ||
10219 | }; | ||
10220 | |||
10221 | /** | ||
10222 | * @param {object} dispatchConfig Configuration used to dispatch this event. | ||
10223 | * @param {string} dispatchMarker Marker identifying the event target. | ||
10224 | * @param {object} nativeEvent Native browser event. | ||
10225 | * @extends {SyntheticUIEvent} | ||
10226 | */ | ||
10227 | function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | ||
10228 | SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | ||
10229 | } | ||
10230 | |||
10231 | SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface); | ||
10232 | |||
10233 | module.exports = SyntheticMouseEvent; | ||
10234 | |||
10235 | /***/ }, | ||
10236 | /* 89 */ | ||
10237 | /***/ function(module, exports, __webpack_require__) { | ||
10238 | |||
10239 | /** | ||
10240 | * Copyright 2013-2015, Facebook, Inc. | ||
10241 | * All rights reserved. | ||
10242 | * | ||
10243 | * This source code is licensed under the BSD-style license found in the | ||
10244 | * LICENSE file in the root directory of this source tree. An additional grant | ||
10245 | * of patent rights can be found in the PATENTS file in the same directory. | ||
10246 | * | ||
10247 | * @providesModule SyntheticUIEvent | ||
10248 | * @typechecks static-only | ||
10249 | */ | ||
10250 | |||
10251 | 'use strict'; | ||
10252 | |||
10253 | var SyntheticEvent = __webpack_require__(79); | ||
10254 | |||
10255 | var getEventTarget = __webpack_require__(83); | ||
10256 | |||
10257 | /** | ||
10258 | * @interface UIEvent | ||
10259 | * @see http://www.w3.org/TR/DOM-Level-3-Events/ | ||
10260 | */ | ||
10261 | var UIEventInterface = { | ||
10262 | view: function (event) { | ||
10263 | if (event.view) { | ||
10264 | return event.view; | ||
10265 | } | ||
10266 | |||
10267 | var target = getEventTarget(event); | ||
10268 | if (target != null && target.window === target) { | ||
10269 | // target is a window object | ||
10270 | return target; | ||
10271 | } | ||
10272 | |||
10273 | var doc = target.ownerDocument; | ||
10274 | // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8. | ||
10275 | if (doc) { | ||
10276 | return doc.defaultView || doc.parentWindow; | ||
10277 | } else { | ||
10278 | return window; | ||
10279 | } | ||
10280 | }, | ||
10281 | detail: function (event) { | ||
10282 | return event.detail || 0; | ||
10283 | } | ||
10284 | }; | ||
10285 | |||
10286 | /** | ||
10287 | * @param {object} dispatchConfig Configuration used to dispatch this event. | ||
10288 | * @param {string} dispatchMarker Marker identifying the event target. | ||
10289 | * @param {object} nativeEvent Native browser event. | ||
10290 | * @extends {SyntheticEvent} | ||
10291 | */ | ||
10292 | function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | ||
10293 | SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | ||
10294 | } | ||
10295 | |||
10296 | SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface); | ||
10297 | |||
10298 | module.exports = SyntheticUIEvent; | ||
10299 | |||
10300 | /***/ }, | ||
10301 | /* 90 */ | ||
10302 | /***/ function(module, exports) { | ||
10303 | |||
10304 | /** | ||
10305 | * Copyright 2013-2015, Facebook, Inc. | ||
10306 | * All rights reserved. | ||
10307 | * | ||
10308 | * This source code is licensed under the BSD-style license found in the | ||
10309 | * LICENSE file in the root directory of this source tree. An additional grant | ||
10310 | * of patent rights can be found in the PATENTS file in the same directory. | ||
10311 | * | ||
10312 | * @providesModule getEventModifierState | ||
10313 | * @typechecks static-only | ||
10314 | */ | ||
10315 | |||
10316 | 'use strict'; | ||
10317 | |||
10318 | /** | ||
10319 | * Translation from modifier key to the associated property in the event. | ||
10320 | * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers | ||
10321 | */ | ||
10322 | |||
10323 | var modifierKeyToProp = { | ||
10324 | 'Alt': 'altKey', | ||
10325 | 'Control': 'ctrlKey', | ||
10326 | 'Meta': 'metaKey', | ||
10327 | 'Shift': 'shiftKey' | ||
10328 | }; | ||
10329 | |||
10330 | // IE8 does not implement getModifierState so we simply map it to the only | ||
10331 | // modifier keys exposed by the event itself, does not support Lock-keys. | ||
10332 | // Currently, all major browsers except Chrome seems to support Lock-keys. | ||
10333 | function modifierStateGetter(keyArg) { | ||
10334 | var syntheticEvent = this; | ||
10335 | var nativeEvent = syntheticEvent.nativeEvent; | ||
10336 | if (nativeEvent.getModifierState) { | ||
10337 | return nativeEvent.getModifierState(keyArg); | ||
10338 | } | ||
10339 | var keyProp = modifierKeyToProp[keyArg]; | ||
10340 | return keyProp ? !!nativeEvent[keyProp] : false; | ||
10341 | } | ||
10342 | |||
10343 | function getEventModifierState(nativeEvent) { | ||
10344 | return modifierStateGetter; | ||
10345 | } | ||
10346 | |||
10347 | module.exports = getEventModifierState; | ||
10348 | |||
10349 | /***/ }, | ||
10350 | /* 91 */ | ||
10351 | /***/ function(module, exports, __webpack_require__) { | ||
10352 | |||
10353 | /** | ||
10354 | * Copyright 2013-2015, Facebook, Inc. | ||
10355 | * All rights reserved. | ||
10356 | * | ||
10357 | * This source code is licensed under the BSD-style license found in the | ||
10358 | * LICENSE file in the root directory of this source tree. An additional grant | ||
10359 | * of patent rights can be found in the PATENTS file in the same directory. | ||
10360 | * | ||
10361 | * @providesModule HTMLDOMPropertyConfig | ||
10362 | */ | ||
10363 | |||
10364 | 'use strict'; | ||
10365 | |||
10366 | var DOMProperty = __webpack_require__(25); | ||
10367 | var ExecutionEnvironment = __webpack_require__(11); | ||
10368 | |||
10369 | var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE; | ||
10370 | var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY; | ||
10371 | var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE; | ||
10372 | var HAS_SIDE_EFFECTS = DOMProperty.injection.HAS_SIDE_EFFECTS; | ||
10373 | var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE; | ||
10374 | var HAS_POSITIVE_NUMERIC_VALUE = DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE; | ||
10375 | var HAS_OVERLOADED_BOOLEAN_VALUE = DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE; | ||
10376 | |||
10377 | var hasSVG; | ||
10378 | if (ExecutionEnvironment.canUseDOM) { | ||
10379 | var implementation = document.implementation; | ||
10380 | hasSVG = implementation && implementation.hasFeature && implementation.hasFeature('http://www.w3.org/TR/SVG11/feature#BasicStructure', '1.1'); | ||
10381 | } | ||
10382 | |||
10383 | var HTMLDOMPropertyConfig = { | ||
10384 | isCustomAttribute: RegExp.prototype.test.bind(/^(data|aria)-[a-z_][a-z\d_.\-]*$/), | ||
10385 | Properties: { | ||
10386 | /** | ||
10387 | * Standard Properties | ||
10388 | */ | ||
10389 | accept: null, | ||
10390 | acceptCharset: null, | ||
10391 | accessKey: null, | ||
10392 | action: null, | ||
10393 | allowFullScreen: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE, | ||
10394 | allowTransparency: MUST_USE_ATTRIBUTE, | ||
10395 | alt: null, | ||
10396 | async: HAS_BOOLEAN_VALUE, | ||
10397 | autoComplete: null, | ||
10398 | // autoFocus is polyfilled/normalized by AutoFocusUtils | ||
10399 | // autoFocus: HAS_BOOLEAN_VALUE, | ||
10400 | autoPlay: HAS_BOOLEAN_VALUE, | ||
10401 | capture: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE, | ||
10402 | cellPadding: null, | ||
10403 | cellSpacing: null, | ||
10404 | charSet: MUST_USE_ATTRIBUTE, | ||
10405 | challenge: MUST_USE_ATTRIBUTE, | ||
10406 | checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, | ||
10407 | classID: MUST_USE_ATTRIBUTE, | ||
10408 | // To set className on SVG elements, it's necessary to use .setAttribute; | ||
10409 | // this works on HTML elements too in all browsers except IE8. Conveniently, | ||
10410 | // IE8 doesn't support SVG and so we can simply use the attribute in | ||
10411 | // browsers that support SVG and the property in browsers that don't, | ||
10412 | // regardless of whether the element is HTML or SVG. | ||
10413 | className: hasSVG ? MUST_USE_ATTRIBUTE : MUST_USE_PROPERTY, | ||
10414 | cols: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE, | ||
10415 | colSpan: null, | ||
10416 | content: null, | ||
10417 | contentEditable: null, | ||
10418 | contextMenu: MUST_USE_ATTRIBUTE, | ||
10419 | controls: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, | ||
10420 | coords: null, | ||
10421 | crossOrigin: null, | ||
10422 | data: null, // For `<object />` acts as `src`. | ||
10423 | dateTime: MUST_USE_ATTRIBUTE, | ||
10424 | 'default': HAS_BOOLEAN_VALUE, | ||
10425 | defer: HAS_BOOLEAN_VALUE, | ||
10426 | dir: null, | ||
10427 | disabled: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE, | ||
10428 | download: HAS_OVERLOADED_BOOLEAN_VALUE, | ||
10429 | draggable: null, | ||
10430 | encType: null, | ||
10431 | form: MUST_USE_ATTRIBUTE, | ||
10432 | formAction: MUST_USE_ATTRIBUTE, | ||
10433 | formEncType: MUST_USE_ATTRIBUTE, | ||
10434 | formMethod: MUST_USE_ATTRIBUTE, | ||
10435 | formNoValidate: HAS_BOOLEAN_VALUE, | ||
10436 | formTarget: MUST_USE_ATTRIBUTE, | ||
10437 | frameBorder: MUST_USE_ATTRIBUTE, | ||
10438 | headers: null, | ||
10439 | height: MUST_USE_ATTRIBUTE, | ||
10440 | hidden: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE, | ||
10441 | high: null, | ||
10442 | href: null, | ||
10443 | hrefLang: null, | ||
10444 | htmlFor: null, | ||
10445 | httpEquiv: null, | ||
10446 | icon: null, | ||
10447 | id: MUST_USE_PROPERTY, | ||
10448 | inputMode: MUST_USE_ATTRIBUTE, | ||
10449 | integrity: null, | ||
10450 | is: MUST_USE_ATTRIBUTE, | ||
10451 | keyParams: MUST_USE_ATTRIBUTE, | ||
10452 | keyType: MUST_USE_ATTRIBUTE, | ||
10453 | kind: null, | ||
10454 | label: null, | ||
10455 | lang: null, | ||
10456 | list: MUST_USE_ATTRIBUTE, | ||
10457 | loop: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, | ||
10458 | low: null, | ||
10459 | manifest: MUST_USE_ATTRIBUTE, | ||
10460 | marginHeight: null, | ||
10461 | marginWidth: null, | ||
10462 | max: null, | ||
10463 | maxLength: MUST_USE_ATTRIBUTE, | ||
10464 | media: MUST_USE_ATTRIBUTE, | ||
10465 | mediaGroup: null, | ||
10466 | method: null, | ||
10467 | min: null, | ||
10468 | minLength: MUST_USE_ATTRIBUTE, | ||
10469 | multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, | ||
10470 | muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, | ||
10471 | name: null, | ||
10472 | nonce: MUST_USE_ATTRIBUTE, | ||
10473 | noValidate: HAS_BOOLEAN_VALUE, | ||
10474 | open: HAS_BOOLEAN_VALUE, | ||
10475 | optimum: null, | ||
10476 | pattern: null, | ||
10477 | placeholder: null, | ||
10478 | poster: null, | ||
10479 | preload: null, | ||
10480 | radioGroup: null, | ||
10481 | readOnly: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, | ||
10482 | rel: null, | ||
10483 | required: HAS_BOOLEAN_VALUE, | ||
10484 | reversed: HAS_BOOLEAN_VALUE, | ||
10485 | role: MUST_USE_ATTRIBUTE, | ||
10486 | rows: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE, | ||
10487 | rowSpan: null, | ||
10488 | sandbox: null, | ||
10489 | scope: null, | ||
10490 | scoped: HAS_BOOLEAN_VALUE, | ||
10491 | scrolling: null, | ||
10492 | seamless: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE, | ||
10493 | selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, | ||
10494 | shape: null, | ||
10495 | size: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE, | ||
10496 | sizes: MUST_USE_ATTRIBUTE, | ||
10497 | span: HAS_POSITIVE_NUMERIC_VALUE, | ||
10498 | spellCheck: null, | ||
10499 | src: null, | ||
10500 | srcDoc: MUST_USE_PROPERTY, | ||
10501 | srcLang: null, | ||
10502 | srcSet: MUST_USE_ATTRIBUTE, | ||
10503 | start: HAS_NUMERIC_VALUE, | ||
10504 | step: null, | ||
10505 | style: null, | ||
10506 | summary: null, | ||
10507 | tabIndex: null, | ||
10508 | target: null, | ||
10509 | title: null, | ||
10510 | type: null, | ||
10511 | useMap: null, | ||
10512 | value: MUST_USE_PROPERTY | HAS_SIDE_EFFECTS, | ||
10513 | width: MUST_USE_ATTRIBUTE, | ||
10514 | wmode: MUST_USE_ATTRIBUTE, | ||
10515 | wrap: null, | ||
10516 | |||
10517 | /** | ||
10518 | * RDFa Properties | ||
10519 | */ | ||
10520 | about: MUST_USE_ATTRIBUTE, | ||
10521 | datatype: MUST_USE_ATTRIBUTE, | ||
10522 | inlist: MUST_USE_ATTRIBUTE, | ||
10523 | prefix: MUST_USE_ATTRIBUTE, | ||
10524 | // property is also supported for OpenGraph in meta tags. | ||
10525 | property: MUST_USE_ATTRIBUTE, | ||
10526 | resource: MUST_USE_ATTRIBUTE, | ||
10527 | 'typeof': MUST_USE_ATTRIBUTE, | ||
10528 | vocab: MUST_USE_ATTRIBUTE, | ||
10529 | |||
10530 | /** | ||
10531 | * Non-standard Properties | ||
10532 | */ | ||
10533 | // autoCapitalize and autoCorrect are supported in Mobile Safari for | ||
10534 | // keyboard hints. | ||
10535 | autoCapitalize: null, | ||
10536 | autoCorrect: null, | ||
10537 | // autoSave allows WebKit/Blink to persist values of input fields on page reloads | ||
10538 | autoSave: null, | ||
10539 | // color is for Safari mask-icon link | ||
10540 | color: null, | ||
10541 | // itemProp, itemScope, itemType are for | ||
10542 | // Microdata support. See http://schema.org/docs/gs.html | ||
10543 | itemProp: MUST_USE_ATTRIBUTE, | ||
10544 | itemScope: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE, | ||
10545 | itemType: MUST_USE_ATTRIBUTE, | ||
10546 | // itemID and itemRef are for Microdata support as well but | ||
10547 | // only specified in the the WHATWG spec document. See | ||
10548 | // https://html.spec.whatwg.org/multipage/microdata.html#microdata-dom-api | ||
10549 | itemID: MUST_USE_ATTRIBUTE, | ||
10550 | itemRef: MUST_USE_ATTRIBUTE, | ||
10551 | // results show looking glass icon and recent searches on input | ||
10552 | // search fields in WebKit/Blink | ||
10553 | results: null, | ||
10554 | // IE-only attribute that specifies security restrictions on an iframe | ||
10555 | // as an alternative to the sandbox attribute on IE<10 | ||
10556 | security: MUST_USE_ATTRIBUTE, | ||
10557 | // IE-only attribute that controls focus behavior | ||
10558 | unselectable: MUST_USE_ATTRIBUTE | ||
10559 | }, | ||
10560 | DOMAttributeNames: { | ||
10561 | acceptCharset: 'accept-charset', | ||
10562 | className: 'class', | ||
10563 | htmlFor: 'for', | ||
10564 | httpEquiv: 'http-equiv' | ||
10565 | }, | ||
10566 | DOMPropertyNames: { | ||
10567 | autoCapitalize: 'autocapitalize', | ||
10568 | autoComplete: 'autocomplete', | ||
10569 | autoCorrect: 'autocorrect', | ||
10570 | autoFocus: 'autofocus', | ||
10571 | autoPlay: 'autoplay', | ||
10572 | autoSave: 'autosave', | ||
10573 | // `encoding` is equivalent to `enctype`, IE8 lacks an `enctype` setter. | ||
10574 | // http://www.w3.org/TR/html5/forms.html#dom-fs-encoding | ||
10575 | encType: 'encoding', | ||
10576 | hrefLang: 'hreflang', | ||
10577 | radioGroup: 'radiogroup', | ||
10578 | spellCheck: 'spellcheck', | ||
10579 | srcDoc: 'srcdoc', | ||
10580 | srcSet: 'srcset' | ||
10581 | } | ||
10582 | }; | ||
10583 | |||
10584 | module.exports = HTMLDOMPropertyConfig; | ||
10585 | |||
10586 | /***/ }, | ||
10587 | /* 92 */ | ||
10588 | /***/ function(module, exports, __webpack_require__) { | ||
10589 | |||
10590 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
10591 | * Copyright 2013-2015, Facebook, Inc. | ||
10592 | * All rights reserved. | ||
10593 | * | ||
10594 | * This source code is licensed under the BSD-style license found in the | ||
10595 | * LICENSE file in the root directory of this source tree. An additional grant | ||
10596 | * of patent rights can be found in the PATENTS file in the same directory. | ||
10597 | * | ||
10598 | * @providesModule ReactBrowserComponentMixin | ||
10599 | */ | ||
10600 | |||
10601 | 'use strict'; | ||
10602 | |||
10603 | var ReactInstanceMap = __webpack_require__(49); | ||
10604 | |||
10605 | var findDOMNode = __webpack_require__(93); | ||
10606 | var warning = __webpack_require__(27); | ||
10607 | |||
10608 | var didWarnKey = '_getDOMNodeDidWarn'; | ||
10609 | |||
10610 | var ReactBrowserComponentMixin = { | ||
10611 | /** | ||
10612 | * Returns the DOM node rendered by this component. | ||
10613 | * | ||
10614 | * @return {DOMElement} The root node of this component. | ||
10615 | * @final | ||
10616 | * @protected | ||
10617 | */ | ||
10618 | getDOMNode: function () { | ||
10619 | 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; | ||
10620 | this.constructor[didWarnKey] = true; | ||
10621 | return findDOMNode(this); | ||
10622 | } | ||
10623 | }; | ||
10624 | |||
10625 | module.exports = ReactBrowserComponentMixin; | ||
10626 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
10627 | |||
10628 | /***/ }, | ||
10629 | /* 93 */ | ||
10630 | /***/ function(module, exports, __webpack_require__) { | ||
10631 | |||
10632 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
10633 | * Copyright 2013-2015, Facebook, Inc. | ||
10634 | * All rights reserved. | ||
10635 | * | ||
10636 | * This source code is licensed under the BSD-style license found in the | ||
10637 | * LICENSE file in the root directory of this source tree. An additional grant | ||
10638 | * of patent rights can be found in the PATENTS file in the same directory. | ||
10639 | * | ||
10640 | * @providesModule findDOMNode | ||
10641 | * @typechecks static-only | ||
10642 | */ | ||
10643 | |||
10644 | 'use strict'; | ||
10645 | |||
10646 | var ReactCurrentOwner = __webpack_require__(7); | ||
10647 | var ReactInstanceMap = __webpack_require__(49); | ||
10648 | var ReactMount = __webpack_require__(30); | ||
10649 | |||
10650 | var invariant = __webpack_require__(15); | ||
10651 | var warning = __webpack_require__(27); | ||
10652 | |||
10653 | /** | ||
10654 | * Returns the DOM node rendered by this element. | ||
10655 | * | ||
10656 | * @param {ReactComponent|DOMElement} componentOrElement | ||
10657 | * @return {?DOMElement} The root node of this element. | ||
10658 | */ | ||
10659 | function findDOMNode(componentOrElement) { | ||
10660 | if (process.env.NODE_ENV !== 'production') { | ||
10661 | var owner = ReactCurrentOwner.current; | ||
10662 | if (owner !== null) { | ||
10663 | 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; | ||
10664 | owner._warnedAboutRefsInRender = true; | ||
10665 | } | ||
10666 | } | ||
10667 | if (componentOrElement == null) { | ||
10668 | return null; | ||
10669 | } | ||
10670 | if (componentOrElement.nodeType === 1) { | ||
10671 | return componentOrElement; | ||
10672 | } | ||
10673 | if (ReactInstanceMap.has(componentOrElement)) { | ||
10674 | return ReactMount.getNodeFromInstance(componentOrElement); | ||
10675 | } | ||
10676 | !(componentOrElement.render == null || typeof componentOrElement.render !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findDOMNode was called on an unmounted component.') : invariant(false) : undefined; | ||
10677 | true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)', Object.keys(componentOrElement)) : invariant(false) : undefined; | ||
10678 | } | ||
10679 | |||
10680 | module.exports = findDOMNode; | ||
10681 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
10682 | |||
10683 | /***/ }, | ||
10684 | /* 94 */ | ||
10685 | /***/ function(module, exports, __webpack_require__) { | ||
10686 | |||
10687 | /** | ||
10688 | * Copyright 2013-2015, Facebook, Inc. | ||
10689 | * All rights reserved. | ||
10690 | * | ||
10691 | * This source code is licensed under the BSD-style license found in the | ||
10692 | * LICENSE file in the root directory of this source tree. An additional grant | ||
10693 | * of patent rights can be found in the PATENTS file in the same directory. | ||
10694 | * | ||
10695 | * @providesModule ReactDefaultBatchingStrategy | ||
10696 | */ | ||
10697 | |||
10698 | 'use strict'; | ||
10699 | |||
10700 | var ReactUpdates = __webpack_require__(56); | ||
10701 | var Transaction = __webpack_require__(59); | ||
10702 | |||
10703 | var assign = __webpack_require__(41); | ||
10704 | var emptyFunction = __webpack_require__(17); | ||
10705 | |||
10706 | var RESET_BATCHED_UPDATES = { | ||
10707 | initialize: emptyFunction, | ||
10708 | close: function () { | ||
10709 | ReactDefaultBatchingStrategy.isBatchingUpdates = false; | ||
10710 | } | ||
10711 | }; | ||
10712 | |||
10713 | var FLUSH_BATCHED_UPDATES = { | ||
10714 | initialize: emptyFunction, | ||
10715 | close: ReactUpdates.flushBatchedUpdates.bind(ReactUpdates) | ||
10716 | }; | ||
10717 | |||
10718 | var TRANSACTION_WRAPPERS = [FLUSH_BATCHED_UPDATES, RESET_BATCHED_UPDATES]; | ||
10719 | |||
10720 | function ReactDefaultBatchingStrategyTransaction() { | ||
10721 | this.reinitializeTransaction(); | ||
10722 | } | ||
10723 | |||
10724 | assign(ReactDefaultBatchingStrategyTransaction.prototype, Transaction.Mixin, { | ||
10725 | getTransactionWrappers: function () { | ||
10726 | return TRANSACTION_WRAPPERS; | ||
10727 | } | ||
10728 | }); | ||
10729 | |||
10730 | var transaction = new ReactDefaultBatchingStrategyTransaction(); | ||
10731 | |||
10732 | var ReactDefaultBatchingStrategy = { | ||
10733 | isBatchingUpdates: false, | ||
10734 | |||
10735 | /** | ||
10736 | * Call the provided function in a context within which calls to `setState` | ||
10737 | * and friends are batched such that components aren't updated unnecessarily. | ||
10738 | */ | ||
10739 | batchedUpdates: function (callback, a, b, c, d, e) { | ||
10740 | var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates; | ||
10741 | |||
10742 | ReactDefaultBatchingStrategy.isBatchingUpdates = true; | ||
10743 | |||
10744 | // The code is written this way to avoid extra allocations | ||
10745 | if (alreadyBatchingUpdates) { | ||
10746 | callback(a, b, c, d, e); | ||
10747 | } else { | ||
10748 | transaction.perform(callback, null, a, b, c, d, e); | ||
10749 | } | ||
10750 | } | ||
10751 | }; | ||
10752 | |||
10753 | module.exports = ReactDefaultBatchingStrategy; | ||
10754 | |||
10755 | /***/ }, | ||
10756 | /* 95 */ | ||
10757 | /***/ function(module, exports, __webpack_require__) { | ||
10758 | |||
10759 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
10760 | * Copyright 2013-2015, Facebook, Inc. | ||
10761 | * All rights reserved. | ||
10762 | * | ||
10763 | * This source code is licensed under the BSD-style license found in the | ||
10764 | * LICENSE file in the root directory of this source tree. An additional grant | ||
10765 | * of patent rights can be found in the PATENTS file in the same directory. | ||
10766 | * | ||
10767 | * @providesModule ReactDOMComponent | ||
10768 | * @typechecks static-only | ||
10769 | */ | ||
10770 | |||
10771 | /* global hasOwnProperty:true */ | ||
10772 | |||
10773 | 'use strict'; | ||
10774 | |||
10775 | var AutoFocusUtils = __webpack_require__(96); | ||
10776 | var CSSPropertyOperations = __webpack_require__(98); | ||
10777 | var DOMProperty = __webpack_require__(25); | ||
10778 | var DOMPropertyOperations = __webpack_require__(24); | ||
10779 | var EventConstants = __webpack_require__(32); | ||
10780 | var ReactBrowserEventEmitter = __webpack_require__(31); | ||
10781 | var ReactComponentBrowserEnvironment = __webpack_require__(28); | ||
10782 | var ReactDOMButton = __webpack_require__(106); | ||
10783 | var ReactDOMInput = __webpack_require__(107); | ||
10784 | var ReactDOMOption = __webpack_require__(111); | ||
10785 | var ReactDOMSelect = __webpack_require__(114); | ||
10786 | var ReactDOMTextarea = __webpack_require__(115); | ||
10787 | var ReactMount = __webpack_require__(30); | ||
10788 | var ReactMultiChild = __webpack_require__(116); | ||
10789 | var ReactPerf = __webpack_require__(20); | ||
10790 | var ReactUpdateQueue = __webpack_require__(55); | ||
10791 | |||
10792 | var assign = __webpack_require__(41); | ||
10793 | var canDefineProperty = __webpack_require__(45); | ||
10794 | var escapeTextContentForBrowser = __webpack_require__(23); | ||
10795 | var invariant = __webpack_require__(15); | ||
10796 | var isEventSupported = __webpack_require__(42); | ||
10797 | var keyOf = __webpack_require__(81); | ||
10798 | var setInnerHTML = __webpack_require__(21); | ||
10799 | var setTextContent = __webpack_require__(22); | ||
10800 | var shallowEqual = __webpack_require__(119); | ||
10801 | var validateDOMNesting = __webpack_require__(72); | ||
10802 | var warning = __webpack_require__(27); | ||
10803 | |||
10804 | var deleteListener = ReactBrowserEventEmitter.deleteListener; | ||
10805 | var listenTo = ReactBrowserEventEmitter.listenTo; | ||
10806 | var registrationNameModules = ReactBrowserEventEmitter.registrationNameModules; | ||
10807 | |||
10808 | // For quickly matching children type, to test if can be treated as content. | ||
10809 | var CONTENT_TYPES = { 'string': true, 'number': true }; | ||
10810 | |||
10811 | var CHILDREN = keyOf({ children: null }); | ||
10812 | var STYLE = keyOf({ style: null }); | ||
10813 | var HTML = keyOf({ __html: null }); | ||
10814 | |||
10815 | var ELEMENT_NODE_TYPE = 1; | ||
10816 | |||
10817 | function getDeclarationErrorAddendum(internalInstance) { | ||
10818 | if (internalInstance) { | ||
10819 | var owner = internalInstance._currentElement._owner || null; | ||
10820 | if (owner) { | ||
10821 | var name = owner.getName(); | ||
10822 | if (name) { | ||
10823 | return ' This DOM node was rendered by `' + name + '`.'; | ||
10824 | } | ||
10825 | } | ||
10826 | } | ||
10827 | return ''; | ||
10828 | } | ||
10829 | |||
10830 | var legacyPropsDescriptor; | ||
10831 | if (process.env.NODE_ENV !== 'production') { | ||
10832 | legacyPropsDescriptor = { | ||
10833 | props: { | ||
10834 | enumerable: false, | ||
10835 | get: function () { | ||
10836 | var component = this._reactInternalComponent; | ||
10837 | 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; | ||
10838 | return component._currentElement.props; | ||
10839 | } | ||
10840 | } | ||
10841 | }; | ||
10842 | } | ||
10843 | |||
10844 | function legacyGetDOMNode() { | ||
10845 | if (process.env.NODE_ENV !== 'production') { | ||
10846 | var component = this._reactInternalComponent; | ||
10847 | 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; | ||
10848 | } | ||
10849 | return this; | ||
10850 | } | ||
10851 | |||
10852 | function legacyIsMounted() { | ||
10853 | var component = this._reactInternalComponent; | ||
10854 | if (process.env.NODE_ENV !== 'production') { | ||
10855 | process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .isMounted() of a DOM node.%s', getDeclarationErrorAddendum(component)) : undefined; | ||
10856 | } | ||
10857 | return !!component; | ||
10858 | } | ||
10859 | |||
10860 | function legacySetStateEtc() { | ||
10861 | if (process.env.NODE_ENV !== 'production') { | ||
10862 | var component = this._reactInternalComponent; | ||
10863 | 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; | ||
10864 | } | ||
10865 | } | ||
10866 | |||
10867 | function legacySetProps(partialProps, callback) { | ||
10868 | var component = this._reactInternalComponent; | ||
10869 | if (process.env.NODE_ENV !== 'production') { | ||
10870 | 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; | ||
10871 | } | ||
10872 | if (!component) { | ||
10873 | return; | ||
10874 | } | ||
10875 | ReactUpdateQueue.enqueueSetPropsInternal(component, partialProps); | ||
10876 | if (callback) { | ||
10877 | ReactUpdateQueue.enqueueCallbackInternal(component, callback); | ||
10878 | } | ||
10879 | } | ||
10880 | |||
10881 | function legacyReplaceProps(partialProps, callback) { | ||
10882 | var component = this._reactInternalComponent; | ||
10883 | if (process.env.NODE_ENV !== 'production') { | ||
10884 | 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; | ||
10885 | } | ||
10886 | if (!component) { | ||
10887 | return; | ||
10888 | } | ||
10889 | ReactUpdateQueue.enqueueReplacePropsInternal(component, partialProps); | ||
10890 | if (callback) { | ||
10891 | ReactUpdateQueue.enqueueCallbackInternal(component, callback); | ||
10892 | } | ||
10893 | } | ||
10894 | |||
10895 | function friendlyStringify(obj) { | ||
10896 | if (typeof obj === 'object') { | ||
10897 | if (Array.isArray(obj)) { | ||
10898 | return '[' + obj.map(friendlyStringify).join(', ') + ']'; | ||
10899 | } else { | ||
10900 | var pairs = []; | ||
10901 | for (var key in obj) { | ||
10902 | if (Object.prototype.hasOwnProperty.call(obj, key)) { | ||
10903 | var keyEscaped = /^[a-z$_][\w$_]*$/i.test(key) ? key : JSON.stringify(key); | ||
10904 | pairs.push(keyEscaped + ': ' + friendlyStringify(obj[key])); | ||
10905 | } | ||
10906 | } | ||
10907 | return '{' + pairs.join(', ') + '}'; | ||
10908 | } | ||
10909 | } else if (typeof obj === 'string') { | ||
10910 | return JSON.stringify(obj); | ||
10911 | } else if (typeof obj === 'function') { | ||
10912 | return '[function object]'; | ||
10913 | } | ||
10914 | // Differs from JSON.stringify in that undefined becauses undefined and that | ||
10915 | // inf and nan don't become null | ||
10916 | return String(obj); | ||
10917 | } | ||
10918 | |||
10919 | var styleMutationWarning = {}; | ||
10920 | |||
10921 | function checkAndWarnForMutatedStyle(style1, style2, component) { | ||
10922 | if (style1 == null || style2 == null) { | ||
10923 | return; | ||
10924 | } | ||
10925 | if (shallowEqual(style1, style2)) { | ||
10926 | return; | ||
10927 | } | ||
10928 | |||
10929 | var componentName = component._tag; | ||
10930 | var owner = component._currentElement._owner; | ||
10931 | var ownerName; | ||
10932 | if (owner) { | ||
10933 | ownerName = owner.getName(); | ||
10934 | } | ||
10935 | |||
10936 | var hash = ownerName + '|' + componentName; | ||
10937 | |||
10938 | if (styleMutationWarning.hasOwnProperty(hash)) { | ||
10939 | return; | ||
10940 | } | ||
10941 | |||
10942 | styleMutationWarning[hash] = true; | ||
10943 | |||
10944 | 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; | ||
10945 | } | ||
10946 | |||
10947 | /** | ||
10948 | * @param {object} component | ||
10949 | * @param {?object} props | ||
10950 | */ | ||
10951 | function assertValidProps(component, props) { | ||
10952 | if (!props) { | ||
10953 | return; | ||
10954 | } | ||
10955 | // Note the use of `==` which checks for null or undefined. | ||
10956 | if (process.env.NODE_ENV !== 'production') { | ||
10957 | if (voidElementTags[component._tag]) { | ||
10958 | 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; | ||
10959 | } | ||
10960 | } | ||
10961 | if (props.dangerouslySetInnerHTML != null) { | ||
10962 | !(props.children == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : invariant(false) : undefined; | ||
10963 | !(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; | ||
10964 | } | ||
10965 | if (process.env.NODE_ENV !== 'production') { | ||
10966 | process.env.NODE_ENV !== 'production' ? warning(props.innerHTML == null, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.') : undefined; | ||
10967 | 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; | ||
10968 | } | ||
10969 | !(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; | ||
10970 | } | ||
10971 | |||
10972 | function enqueuePutListener(id, registrationName, listener, transaction) { | ||
10973 | if (process.env.NODE_ENV !== 'production') { | ||
10974 | // IE8 has no API for event capturing and the `onScroll` event doesn't | ||
10975 | // bubble. | ||
10976 | process.env.NODE_ENV !== 'production' ? warning(registrationName !== 'onScroll' || isEventSupported('scroll', true), 'This browser doesn\'t support the `onScroll` event') : undefined; | ||
10977 | } | ||
10978 | var container = ReactMount.findReactContainerForID(id); | ||
10979 | if (container) { | ||
10980 | var doc = container.nodeType === ELEMENT_NODE_TYPE ? container.ownerDocument : container; | ||
10981 | listenTo(registrationName, doc); | ||
10982 | } | ||
10983 | transaction.getReactMountReady().enqueue(putListener, { | ||
10984 | id: id, | ||
10985 | registrationName: registrationName, | ||
10986 | listener: listener | ||
10987 | }); | ||
10988 | } | ||
10989 | |||
10990 | function putListener() { | ||
10991 | var listenerToPut = this; | ||
10992 | ReactBrowserEventEmitter.putListener(listenerToPut.id, listenerToPut.registrationName, listenerToPut.listener); | ||
10993 | } | ||
10994 | |||
10995 | // There are so many media events, it makes sense to just | ||
10996 | // maintain a list rather than create a `trapBubbledEvent` for each | ||
10997 | var mediaEvents = { | ||
10998 | topAbort: 'abort', | ||
10999 | topCanPlay: 'canplay', | ||
11000 | topCanPlayThrough: 'canplaythrough', | ||
11001 | topDurationChange: 'durationchange', | ||
11002 | topEmptied: 'emptied', | ||
11003 | topEncrypted: 'encrypted', | ||
11004 | topEnded: 'ended', | ||
11005 | topError: 'error', | ||
11006 | topLoadedData: 'loadeddata', | ||
11007 | topLoadedMetadata: 'loadedmetadata', | ||
11008 | topLoadStart: 'loadstart', | ||
11009 | topPause: 'pause', | ||
11010 | topPlay: 'play', | ||
11011 | topPlaying: 'playing', | ||
11012 | topProgress: 'progress', | ||
11013 | topRateChange: 'ratechange', | ||
11014 | topSeeked: 'seeked', | ||
11015 | topSeeking: 'seeking', | ||
11016 | topStalled: 'stalled', | ||
11017 | topSuspend: 'suspend', | ||
11018 | topTimeUpdate: 'timeupdate', | ||
11019 | topVolumeChange: 'volumechange', | ||
11020 | topWaiting: 'waiting' | ||
11021 | }; | ||
11022 | |||
11023 | function trapBubbledEventsLocal() { | ||
11024 | var inst = this; | ||
11025 | // If a component renders to null or if another component fatals and causes | ||
11026 | // the state of the tree to be corrupted, `node` here can be null. | ||
11027 | !inst._rootNodeID ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Must be mounted to trap events') : invariant(false) : undefined; | ||
11028 | var node = ReactMount.getNode(inst._rootNodeID); | ||
11029 | !node ? process.env.NODE_ENV !== 'production' ? invariant(false, 'trapBubbledEvent(...): Requires node to be rendered.') : invariant(false) : undefined; | ||
11030 | |||
11031 | switch (inst._tag) { | ||
11032 | case 'iframe': | ||
11033 | inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load', node)]; | ||
11034 | break; | ||
11035 | case 'video': | ||
11036 | case 'audio': | ||
11037 | |||
11038 | inst._wrapperState.listeners = []; | ||
11039 | // create listener for each media event | ||
11040 | for (var event in mediaEvents) { | ||
11041 | if (mediaEvents.hasOwnProperty(event)) { | ||
11042 | inst._wrapperState.listeners.push(ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes[event], mediaEvents[event], node)); | ||
11043 | } | ||
11044 | } | ||
11045 | |||
11046 | break; | ||
11047 | case 'img': | ||
11048 | inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topError, 'error', node), ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load', node)]; | ||
11049 | break; | ||
11050 | case 'form': | ||
11051 | inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topReset, 'reset', node), ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topSubmit, 'submit', node)]; | ||
11052 | break; | ||
11053 | } | ||
11054 | } | ||
11055 | |||
11056 | function mountReadyInputWrapper() { | ||
11057 | ReactDOMInput.mountReadyWrapper(this); | ||
11058 | } | ||
11059 | |||
11060 | function postUpdateSelectWrapper() { | ||
11061 | ReactDOMSelect.postUpdateWrapper(this); | ||
11062 | } | ||
11063 | |||
11064 | // For HTML, certain tags should omit their close tag. We keep a whitelist for | ||
11065 | // those special cased tags. | ||
11066 | |||
11067 | var omittedCloseTags = { | ||
11068 | 'area': true, | ||
11069 | 'base': true, | ||
11070 | 'br': true, | ||
11071 | 'col': true, | ||
11072 | 'embed': true, | ||
11073 | 'hr': true, | ||
11074 | 'img': true, | ||
11075 | 'input': true, | ||
11076 | 'keygen': true, | ||
11077 | 'link': true, | ||
11078 | 'meta': true, | ||
11079 | 'param': true, | ||
11080 | 'source': true, | ||
11081 | 'track': true, | ||
11082 | 'wbr': true | ||
11083 | }; | ||
11084 | |||
11085 | // NOTE: menuitem's close tag should be omitted, but that causes problems. | ||
11086 | var newlineEatingTags = { | ||
11087 | 'listing': true, | ||
11088 | 'pre': true, | ||
11089 | 'textarea': true | ||
11090 | }; | ||
11091 | |||
11092 | // For HTML, certain tags cannot have children. This has the same purpose as | ||
11093 | // `omittedCloseTags` except that `menuitem` should still have its closing tag. | ||
11094 | |||
11095 | var voidElementTags = assign({ | ||
11096 | 'menuitem': true | ||
11097 | }, omittedCloseTags); | ||
11098 | |||
11099 | // We accept any tag to be rendered but since this gets injected into arbitrary | ||
11100 | // HTML, we want to make sure that it's a safe tag. | ||
11101 | // http://www.w3.org/TR/REC-xml/#NT-Name | ||
11102 | |||
11103 | var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset | ||
11104 | var validatedTagCache = {}; | ||
11105 | var hasOwnProperty = ({}).hasOwnProperty; | ||
11106 | |||
11107 | function validateDangerousTag(tag) { | ||
11108 | if (!hasOwnProperty.call(validatedTagCache, tag)) { | ||
11109 | !VALID_TAG_REGEX.test(tag) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Invalid tag: %s', tag) : invariant(false) : undefined; | ||
11110 | validatedTagCache[tag] = true; | ||
11111 | } | ||
11112 | } | ||
11113 | |||
11114 | function processChildContextDev(context, inst) { | ||
11115 | // Pass down our tag name to child components for validation purposes | ||
11116 | context = assign({}, context); | ||
11117 | var info = context[validateDOMNesting.ancestorInfoContextKey]; | ||
11118 | context[validateDOMNesting.ancestorInfoContextKey] = validateDOMNesting.updatedAncestorInfo(info, inst._tag, inst); | ||
11119 | return context; | ||
11120 | } | ||
11121 | |||
11122 | function isCustomComponent(tagName, props) { | ||
11123 | return tagName.indexOf('-') >= 0 || props.is != null; | ||
11124 | } | ||
11125 | |||
11126 | /** | ||
11127 | * Creates a new React class that is idempotent and capable of containing other | ||
11128 | * React components. It accepts event listeners and DOM properties that are | ||
11129 | * valid according to `DOMProperty`. | ||
11130 | * | ||
11131 | * - Event listeners: `onClick`, `onMouseDown`, etc. | ||
11132 | * - DOM properties: `className`, `name`, `title`, etc. | ||
11133 | * | ||
11134 | * The `style` property functions differently from the DOM API. It accepts an | ||
11135 | * object mapping of style properties to values. | ||
11136 | * | ||
11137 | * @constructor ReactDOMComponent | ||
11138 | * @extends ReactMultiChild | ||
11139 | */ | ||
11140 | function ReactDOMComponent(tag) { | ||
11141 | validateDangerousTag(tag); | ||
11142 | this._tag = tag.toLowerCase(); | ||
11143 | this._renderedChildren = null; | ||
11144 | this._previousStyle = null; | ||
11145 | this._previousStyleCopy = null; | ||
11146 | this._rootNodeID = null; | ||
11147 | this._wrapperState = null; | ||
11148 | this._topLevelWrapper = null; | ||
11149 | this._nodeWithLegacyProperties = null; | ||
11150 | if (process.env.NODE_ENV !== 'production') { | ||
11151 | this._unprocessedContextDev = null; | ||
11152 | this._processedContextDev = null; | ||
11153 | } | ||
11154 | } | ||
11155 | |||
11156 | ReactDOMComponent.displayName = 'ReactDOMComponent'; | ||
11157 | |||
11158 | ReactDOMComponent.Mixin = { | ||
11159 | |||
11160 | construct: function (element) { | ||
11161 | this._currentElement = element; | ||
11162 | }, | ||
11163 | |||
11164 | /** | ||
11165 | * Generates root tag markup then recurses. This method has side effects and | ||
11166 | * is not idempotent. | ||
11167 | * | ||
11168 | * @internal | ||
11169 | * @param {string} rootID The root DOM ID for this node. | ||
11170 | * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction | ||
11171 | * @param {object} context | ||
11172 | * @return {string} The computed markup. | ||
11173 | */ | ||
11174 | mountComponent: function (rootID, transaction, context) { | ||
11175 | this._rootNodeID = rootID; | ||
11176 | |||
11177 | var props = this._currentElement.props; | ||
11178 | |||
11179 | switch (this._tag) { | ||
11180 | case 'iframe': | ||
11181 | case 'img': | ||
11182 | case 'form': | ||
11183 | case 'video': | ||
11184 | case 'audio': | ||
11185 | this._wrapperState = { | ||
11186 | listeners: null | ||
11187 | }; | ||
11188 | transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this); | ||
11189 | break; | ||
11190 | case 'button': | ||
11191 | props = ReactDOMButton.getNativeProps(this, props, context); | ||
11192 | break; | ||
11193 | case 'input': | ||
11194 | ReactDOMInput.mountWrapper(this, props, context); | ||
11195 | props = ReactDOMInput.getNativeProps(this, props, context); | ||
11196 | break; | ||
11197 | case 'option': | ||
11198 | ReactDOMOption.mountWrapper(this, props, context); | ||
11199 | props = ReactDOMOption.getNativeProps(this, props, context); | ||
11200 | break; | ||
11201 | case 'select': | ||
11202 | ReactDOMSelect.mountWrapper(this, props, context); | ||
11203 | props = ReactDOMSelect.getNativeProps(this, props, context); | ||
11204 | context = ReactDOMSelect.processChildContext(this, props, context); | ||
11205 | break; | ||
11206 | case 'textarea': | ||
11207 | ReactDOMTextarea.mountWrapper(this, props, context); | ||
11208 | props = ReactDOMTextarea.getNativeProps(this, props, context); | ||
11209 | break; | ||
11210 | } | ||
11211 | |||
11212 | assertValidProps(this, props); | ||
11213 | if (process.env.NODE_ENV !== 'production') { | ||
11214 | if (context[validateDOMNesting.ancestorInfoContextKey]) { | ||
11215 | validateDOMNesting(this._tag, this, context[validateDOMNesting.ancestorInfoContextKey]); | ||
11216 | } | ||
11217 | } | ||
11218 | |||
11219 | if (process.env.NODE_ENV !== 'production') { | ||
11220 | this._unprocessedContextDev = context; | ||
11221 | this._processedContextDev = processChildContextDev(context, this); | ||
11222 | context = this._processedContextDev; | ||
11223 | } | ||
11224 | |||
11225 | var mountImage; | ||
11226 | if (transaction.useCreateElement) { | ||
11227 | var ownerDocument = context[ReactMount.ownerDocumentContextKey]; | ||
11228 | var el = ownerDocument.createElement(this._currentElement.type); | ||
11229 | DOMPropertyOperations.setAttributeForID(el, this._rootNodeID); | ||
11230 | // Populate node cache | ||
11231 | ReactMount.getID(el); | ||
11232 | this._updateDOMProperties({}, props, transaction, el); | ||
11233 | this._createInitialChildren(transaction, props, context, el); | ||
11234 | mountImage = el; | ||
11235 | } else { | ||
11236 | var tagOpen = this._createOpenTagMarkupAndPutListeners(transaction, props); | ||
11237 | var tagContent = this._createContentMarkup(transaction, props, context); | ||
11238 | if (!tagContent && omittedCloseTags[this._tag]) { | ||
11239 | mountImage = tagOpen + '/>'; | ||
11240 | } else { | ||
11241 | mountImage = tagOpen + '>' + tagContent + '</' + this._currentElement.type + '>'; | ||
11242 | } | ||
11243 | } | ||
11244 | |||
11245 | switch (this._tag) { | ||
11246 | case 'input': | ||
11247 | transaction.getReactMountReady().enqueue(mountReadyInputWrapper, this); | ||
11248 | // falls through | ||
11249 | case 'button': | ||
11250 | case 'select': | ||
11251 | case 'textarea': | ||
11252 | if (props.autoFocus) { | ||
11253 | transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this); | ||
11254 | } | ||
11255 | break; | ||
11256 | } | ||
11257 | |||
11258 | return mountImage; | ||
11259 | }, | ||
11260 | |||
11261 | /** | ||
11262 | * Creates markup for the open tag and all attributes. | ||
11263 | * | ||
11264 | * This method has side effects because events get registered. | ||
11265 | * | ||
11266 | * Iterating over object properties is faster than iterating over arrays. | ||
11267 | * @see http://jsperf.com/obj-vs-arr-iteration | ||
11268 | * | ||
11269 | * @private | ||
11270 | * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction | ||
11271 | * @param {object} props | ||
11272 | * @return {string} Markup of opening tag. | ||
11273 | */ | ||
11274 | _createOpenTagMarkupAndPutListeners: function (transaction, props) { | ||
11275 | var ret = '<' + this._currentElement.type; | ||
11276 | |||
11277 | for (var propKey in props) { | ||
11278 | if (!props.hasOwnProperty(propKey)) { | ||
11279 | continue; | ||
11280 | } | ||
11281 | var propValue = props[propKey]; | ||
11282 | if (propValue == null) { | ||
11283 | continue; | ||
11284 | } | ||
11285 | if (registrationNameModules.hasOwnProperty(propKey)) { | ||
11286 | if (propValue) { | ||
11287 | enqueuePutListener(this._rootNodeID, propKey, propValue, transaction); | ||
11288 | } | ||
11289 | } else { | ||
11290 | if (propKey === STYLE) { | ||
11291 | if (propValue) { | ||
11292 | if (process.env.NODE_ENV !== 'production') { | ||
11293 | // See `_updateDOMProperties`. style block | ||
11294 | this._previousStyle = propValue; | ||
11295 | } | ||
11296 | propValue = this._previousStyleCopy = assign({}, props.style); | ||
11297 | } | ||
11298 | propValue = CSSPropertyOperations.createMarkupForStyles(propValue); | ||
11299 | } | ||
11300 | var markup = null; | ||
11301 | if (this._tag != null && isCustomComponent(this._tag, props)) { | ||
11302 | if (propKey !== CHILDREN) { | ||
11303 | markup = DOMPropertyOperations.createMarkupForCustomAttribute(propKey, propValue); | ||
11304 | } | ||
11305 | } else { | ||
11306 | markup = DOMPropertyOperations.createMarkupForProperty(propKey, propValue); | ||
11307 | } | ||
11308 | if (markup) { | ||
11309 | ret += ' ' + markup; | ||
11310 | } | ||
11311 | } | ||
11312 | } | ||
11313 | |||
11314 | // For static pages, no need to put React ID and checksum. Saves lots of | ||
11315 | // bytes. | ||
11316 | if (transaction.renderToStaticMarkup) { | ||
11317 | return ret; | ||
11318 | } | ||
11319 | |||
11320 | var markupForID = DOMPropertyOperations.createMarkupForID(this._rootNodeID); | ||
11321 | return ret + ' ' + markupForID; | ||
11322 | }, | ||
11323 | |||
11324 | /** | ||
11325 | * Creates markup for the content between the tags. | ||
11326 | * | ||
11327 | * @private | ||
11328 | * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction | ||
11329 | * @param {object} props | ||
11330 | * @param {object} context | ||
11331 | * @return {string} Content markup. | ||
11332 | */ | ||
11333 | _createContentMarkup: function (transaction, props, context) { | ||
11334 | var ret = ''; | ||
11335 | |||
11336 | // Intentional use of != to avoid catching zero/false. | ||
11337 | var innerHTML = props.dangerouslySetInnerHTML; | ||
11338 | if (innerHTML != null) { | ||
11339 | if (innerHTML.__html != null) { | ||
11340 | ret = innerHTML.__html; | ||
11341 | } | ||
11342 | } else { | ||
11343 | var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null; | ||
11344 | var childrenToUse = contentToUse != null ? null : props.children; | ||
11345 | if (contentToUse != null) { | ||
11346 | // TODO: Validate that text is allowed as a child of this node | ||
11347 | ret = escapeTextContentForBrowser(contentToUse); | ||
11348 | } else if (childrenToUse != null) { | ||
11349 | var mountImages = this.mountChildren(childrenToUse, transaction, context); | ||
11350 | ret = mountImages.join(''); | ||
11351 | } | ||
11352 | } | ||
11353 | if (newlineEatingTags[this._tag] && ret.charAt(0) === '\n') { | ||
11354 | // text/html ignores the first character in these tags if it's a newline | ||
11355 | // Prefer to break application/xml over text/html (for now) by adding | ||
11356 | // a newline specifically to get eaten by the parser. (Alternately for | ||
11357 | // textareas, replacing "^\n" with "\r\n" doesn't get eaten, and the first | ||
11358 | // \r is normalized out by HTMLTextAreaElement#value.) | ||
11359 | // See: <http://www.w3.org/TR/html-polyglot/#newlines-in-textarea-and-pre> | ||
11360 | // See: <http://www.w3.org/TR/html5/syntax.html#element-restrictions> | ||
11361 | // See: <http://www.w3.org/TR/html5/syntax.html#newlines> | ||
11362 | // See: Parsing of "textarea" "listing" and "pre" elements | ||
11363 | // from <http://www.w3.org/TR/html5/syntax.html#parsing-main-inbody> | ||
11364 | return '\n' + ret; | ||
11365 | } else { | ||
11366 | return ret; | ||
11367 | } | ||
11368 | }, | ||
11369 | |||
11370 | _createInitialChildren: function (transaction, props, context, el) { | ||
11371 | // Intentional use of != to avoid catching zero/false. | ||
11372 | var innerHTML = props.dangerouslySetInnerHTML; | ||
11373 | if (innerHTML != null) { | ||
11374 | if (innerHTML.__html != null) { | ||
11375 | setInnerHTML(el, innerHTML.__html); | ||
11376 | } | ||
11377 | } else { | ||
11378 | var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null; | ||
11379 | var childrenToUse = contentToUse != null ? null : props.children; | ||
11380 | if (contentToUse != null) { | ||
11381 | // TODO: Validate that text is allowed as a child of this node | ||
11382 | setTextContent(el, contentToUse); | ||
11383 | } else if (childrenToUse != null) { | ||
11384 | var mountImages = this.mountChildren(childrenToUse, transaction, context); | ||
11385 | for (var i = 0; i < mountImages.length; i++) { | ||
11386 | el.appendChild(mountImages[i]); | ||
11387 | } | ||
11388 | } | ||
11389 | } | ||
11390 | }, | ||
11391 | |||
11392 | /** | ||
11393 | * Receives a next element and updates the component. | ||
11394 | * | ||
11395 | * @internal | ||
11396 | * @param {ReactElement} nextElement | ||
11397 | * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction | ||
11398 | * @param {object} context | ||
11399 | */ | ||
11400 | receiveComponent: function (nextElement, transaction, context) { | ||
11401 | var prevElement = this._currentElement; | ||
11402 | this._currentElement = nextElement; | ||
11403 | this.updateComponent(transaction, prevElement, nextElement, context); | ||
11404 | }, | ||
11405 | |||
11406 | /** | ||
11407 | * Updates a native DOM component after it has already been allocated and | ||
11408 | * attached to the DOM. Reconciles the root DOM node, then recurses. | ||
11409 | * | ||
11410 | * @param {ReactReconcileTransaction} transaction | ||
11411 | * @param {ReactElement} prevElement | ||
11412 | * @param {ReactElement} nextElement | ||
11413 | * @internal | ||
11414 | * @overridable | ||
11415 | */ | ||
11416 | updateComponent: function (transaction, prevElement, nextElement, context) { | ||
11417 | var lastProps = prevElement.props; | ||
11418 | var nextProps = this._currentElement.props; | ||
11419 | |||
11420 | switch (this._tag) { | ||
11421 | case 'button': | ||
11422 | lastProps = ReactDOMButton.getNativeProps(this, lastProps); | ||
11423 | nextProps = ReactDOMButton.getNativeProps(this, nextProps); | ||
11424 | break; | ||
11425 | case 'input': | ||
11426 | ReactDOMInput.updateWrapper(this); | ||
11427 | lastProps = ReactDOMInput.getNativeProps(this, lastProps); | ||
11428 | nextProps = ReactDOMInput.getNativeProps(this, nextProps); | ||
11429 | break; | ||
11430 | case 'option': | ||
11431 | lastProps = ReactDOMOption.getNativeProps(this, lastProps); | ||
11432 | nextProps = ReactDOMOption.getNativeProps(this, nextProps); | ||
11433 | break; | ||
11434 | case 'select': | ||
11435 | lastProps = ReactDOMSelect.getNativeProps(this, lastProps); | ||
11436 | nextProps = ReactDOMSelect.getNativeProps(this, nextProps); | ||
11437 | break; | ||
11438 | case 'textarea': | ||
11439 | ReactDOMTextarea.updateWrapper(this); | ||
11440 | lastProps = ReactDOMTextarea.getNativeProps(this, lastProps); | ||
11441 | nextProps = ReactDOMTextarea.getNativeProps(this, nextProps); | ||
11442 | break; | ||
11443 | } | ||
11444 | |||
11445 | if (process.env.NODE_ENV !== 'production') { | ||
11446 | // If the context is reference-equal to the old one, pass down the same | ||
11447 | // processed object so the update bailout in ReactReconciler behaves | ||
11448 | // correctly (and identically in dev and prod). See #5005. | ||
11449 | if (this._unprocessedContextDev !== context) { | ||
11450 | this._unprocessedContextDev = context; | ||
11451 | this._processedContextDev = processChildContextDev(context, this); | ||
11452 | } | ||
11453 | context = this._processedContextDev; | ||
11454 | } | ||
11455 | |||
11456 | assertValidProps(this, nextProps); | ||
11457 | this._updateDOMProperties(lastProps, nextProps, transaction, null); | ||
11458 | this._updateDOMChildren(lastProps, nextProps, transaction, context); | ||
11459 | |||
11460 | if (!canDefineProperty && this._nodeWithLegacyProperties) { | ||
11461 | this._nodeWithLegacyProperties.props = nextProps; | ||
11462 | } | ||
11463 | |||
11464 | if (this._tag === 'select') { | ||
11465 | // <select> value update needs to occur after <option> children | ||
11466 | // reconciliation | ||
11467 | transaction.getReactMountReady().enqueue(postUpdateSelectWrapper, this); | ||
11468 | } | ||
11469 | }, | ||
11470 | |||
11471 | /** | ||
11472 | * Reconciles the properties by detecting differences in property values and | ||
11473 | * updating the DOM as necessary. This function is probably the single most | ||
11474 | * critical path for performance optimization. | ||
11475 | * | ||
11476 | * TODO: Benchmark whether checking for changed values in memory actually | ||
11477 | * improves performance (especially statically positioned elements). | ||
11478 | * TODO: Benchmark the effects of putting this at the top since 99% of props | ||
11479 | * do not change for a given reconciliation. | ||
11480 | * TODO: Benchmark areas that can be improved with caching. | ||
11481 | * | ||
11482 | * @private | ||
11483 | * @param {object} lastProps | ||
11484 | * @param {object} nextProps | ||
11485 | * @param {ReactReconcileTransaction} transaction | ||
11486 | * @param {?DOMElement} node | ||
11487 | */ | ||
11488 | _updateDOMProperties: function (lastProps, nextProps, transaction, node) { | ||
11489 | var propKey; | ||
11490 | var styleName; | ||
11491 | var styleUpdates; | ||
11492 | for (propKey in lastProps) { | ||
11493 | if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey)) { | ||
11494 | continue; | ||
11495 | } | ||
11496 | if (propKey === STYLE) { | ||
11497 | var lastStyle = this._previousStyleCopy; | ||
11498 | for (styleName in lastStyle) { | ||
11499 | if (lastStyle.hasOwnProperty(styleName)) { | ||
11500 | styleUpdates = styleUpdates || {}; | ||
11501 | styleUpdates[styleName] = ''; | ||
11502 | } | ||
11503 | } | ||
11504 | this._previousStyleCopy = null; | ||
11505 | } else if (registrationNameModules.hasOwnProperty(propKey)) { | ||
11506 | if (lastProps[propKey]) { | ||
11507 | // Only call deleteListener if there was a listener previously or | ||
11508 | // else willDeleteListener gets called when there wasn't actually a | ||
11509 | // listener (e.g., onClick={null}) | ||
11510 | deleteListener(this._rootNodeID, propKey); | ||
11511 | } | ||
11512 | } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) { | ||
11513 | if (!node) { | ||
11514 | node = ReactMount.getNode(this._rootNodeID); | ||
11515 | } | ||
11516 | DOMPropertyOperations.deleteValueForProperty(node, propKey); | ||
11517 | } | ||
11518 | } | ||
11519 | for (propKey in nextProps) { | ||
11520 | var nextProp = nextProps[propKey]; | ||
11521 | var lastProp = propKey === STYLE ? this._previousStyleCopy : lastProps[propKey]; | ||
11522 | if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp) { | ||
11523 | continue; | ||
11524 | } | ||
11525 | if (propKey === STYLE) { | ||
11526 | if (nextProp) { | ||
11527 | if (process.env.NODE_ENV !== 'production') { | ||
11528 | checkAndWarnForMutatedStyle(this._previousStyleCopy, this._previousStyle, this); | ||
11529 | this._previousStyle = nextProp; | ||
11530 | } | ||
11531 | nextProp = this._previousStyleCopy = assign({}, nextProp); | ||
11532 | } else { | ||
11533 | this._previousStyleCopy = null; | ||
11534 | } | ||
11535 | if (lastProp) { | ||
11536 | // Unset styles on `lastProp` but not on `nextProp`. | ||
11537 | for (styleName in lastProp) { | ||
11538 | if (lastProp.hasOwnProperty(styleName) && (!nextProp || !nextProp.hasOwnProperty(styleName))) { | ||
11539 | styleUpdates = styleUpdates || {}; | ||
11540 | styleUpdates[styleName] = ''; | ||
11541 | } | ||
11542 | } | ||
11543 | // Update styles that changed since `lastProp`. | ||
11544 | for (styleName in nextProp) { | ||
11545 | if (nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName]) { | ||
11546 | styleUpdates = styleUpdates || {}; | ||
11547 | styleUpdates[styleName] = nextProp[styleName]; | ||
11548 | } | ||
11549 | } | ||
11550 | } else { | ||
11551 | // Relies on `updateStylesByID` not mutating `styleUpdates`. | ||
11552 | styleUpdates = nextProp; | ||
11553 | } | ||
11554 | } else if (registrationNameModules.hasOwnProperty(propKey)) { | ||
11555 | if (nextProp) { | ||
11556 | enqueuePutListener(this._rootNodeID, propKey, nextProp, transaction); | ||
11557 | } else if (lastProp) { | ||
11558 | deleteListener(this._rootNodeID, propKey); | ||
11559 | } | ||
11560 | } else if (isCustomComponent(this._tag, nextProps)) { | ||
11561 | if (!node) { | ||
11562 | node = ReactMount.getNode(this._rootNodeID); | ||
11563 | } | ||
11564 | if (propKey === CHILDREN) { | ||
11565 | nextProp = null; | ||
11566 | } | ||
11567 | DOMPropertyOperations.setValueForAttribute(node, propKey, nextProp); | ||
11568 | } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) { | ||
11569 | if (!node) { | ||
11570 | node = ReactMount.getNode(this._rootNodeID); | ||
11571 | } | ||
11572 | // If we're updating to null or undefined, we should remove the property | ||
11573 | // from the DOM node instead of inadvertantly setting to a string. This | ||
11574 | // brings us in line with the same behavior we have on initial render. | ||
11575 | if (nextProp != null) { | ||
11576 | DOMPropertyOperations.setValueForProperty(node, propKey, nextProp); | ||
11577 | } else { | ||
11578 | DOMPropertyOperations.deleteValueForProperty(node, propKey); | ||
11579 | } | ||
11580 | } | ||
11581 | } | ||
11582 | if (styleUpdates) { | ||
11583 | if (!node) { | ||
11584 | node = ReactMount.getNode(this._rootNodeID); | ||
11585 | } | ||
11586 | CSSPropertyOperations.setValueForStyles(node, styleUpdates); | ||
11587 | } | ||
11588 | }, | ||
11589 | |||
11590 | /** | ||
11591 | * Reconciles the children with the various properties that affect the | ||
11592 | * children content. | ||
11593 | * | ||
11594 | * @param {object} lastProps | ||
11595 | * @param {object} nextProps | ||
11596 | * @param {ReactReconcileTransaction} transaction | ||
11597 | * @param {object} context | ||
11598 | */ | ||
11599 | _updateDOMChildren: function (lastProps, nextProps, transaction, context) { | ||
11600 | var lastContent = CONTENT_TYPES[typeof lastProps.children] ? lastProps.children : null; | ||
11601 | var nextContent = CONTENT_TYPES[typeof nextProps.children] ? nextProps.children : null; | ||
11602 | |||
11603 | var lastHtml = lastProps.dangerouslySetInnerHTML && lastProps.dangerouslySetInnerHTML.__html; | ||
11604 | var nextHtml = nextProps.dangerouslySetInnerHTML && nextProps.dangerouslySetInnerHTML.__html; | ||
11605 | |||
11606 | // Note the use of `!=` which checks for null or undefined. | ||
11607 | var lastChildren = lastContent != null ? null : lastProps.children; | ||
11608 | var nextChildren = nextContent != null ? null : nextProps.children; | ||
11609 | |||
11610 | // If we're switching from children to content/html or vice versa, remove | ||
11611 | // the old content | ||
11612 | var lastHasContentOrHtml = lastContent != null || lastHtml != null; | ||
11613 | var nextHasContentOrHtml = nextContent != null || nextHtml != null; | ||
11614 | if (lastChildren != null && nextChildren == null) { | ||
11615 | this.updateChildren(null, transaction, context); | ||
11616 | } else if (lastHasContentOrHtml && !nextHasContentOrHtml) { | ||
11617 | this.updateTextContent(''); | ||
11618 | } | ||
11619 | |||
11620 | if (nextContent != null) { | ||
11621 | if (lastContent !== nextContent) { | ||
11622 | this.updateTextContent('' + nextContent); | ||
11623 | } | ||
11624 | } else if (nextHtml != null) { | ||
11625 | if (lastHtml !== nextHtml) { | ||
11626 | this.updateMarkup('' + nextHtml); | ||
11627 | } | ||
11628 | } else if (nextChildren != null) { | ||
11629 | this.updateChildren(nextChildren, transaction, context); | ||
11630 | } | ||
11631 | }, | ||
11632 | |||
11633 | /** | ||
11634 | * Destroys all event registrations for this instance. Does not remove from | ||
11635 | * the DOM. That must be done by the parent. | ||
11636 | * | ||
11637 | * @internal | ||
11638 | */ | ||
11639 | unmountComponent: function () { | ||
11640 | switch (this._tag) { | ||
11641 | case 'iframe': | ||
11642 | case 'img': | ||
11643 | case 'form': | ||
11644 | case 'video': | ||
11645 | case 'audio': | ||
11646 | var listeners = this._wrapperState.listeners; | ||
11647 | if (listeners) { | ||
11648 | for (var i = 0; i < listeners.length; i++) { | ||
11649 | listeners[i].remove(); | ||
11650 | } | ||
11651 | } | ||
11652 | break; | ||
11653 | case 'input': | ||
11654 | ReactDOMInput.unmountWrapper(this); | ||
11655 | break; | ||
11656 | case 'html': | ||
11657 | case 'head': | ||
11658 | case 'body': | ||
11659 | /** | ||
11660 | * Components like <html> <head> and <body> can't be removed or added | ||
11661 | * easily in a cross-browser way, however it's valuable to be able to | ||
11662 | * take advantage of React's reconciliation for styling and <title> | ||
11663 | * management. So we just document it and throw in dangerous cases. | ||
11664 | */ | ||
11665 | 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; | ||
11666 | break; | ||
11667 | } | ||
11668 | |||
11669 | this.unmountChildren(); | ||
11670 | ReactBrowserEventEmitter.deleteAllListeners(this._rootNodeID); | ||
11671 | ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID); | ||
11672 | this._rootNodeID = null; | ||
11673 | this._wrapperState = null; | ||
11674 | if (this._nodeWithLegacyProperties) { | ||
11675 | var node = this._nodeWithLegacyProperties; | ||
11676 | node._reactInternalComponent = null; | ||
11677 | this._nodeWithLegacyProperties = null; | ||
11678 | } | ||
11679 | }, | ||
11680 | |||
11681 | getPublicInstance: function () { | ||
11682 | if (!this._nodeWithLegacyProperties) { | ||
11683 | var node = ReactMount.getNode(this._rootNodeID); | ||
11684 | |||
11685 | node._reactInternalComponent = this; | ||
11686 | node.getDOMNode = legacyGetDOMNode; | ||
11687 | node.isMounted = legacyIsMounted; | ||
11688 | node.setState = legacySetStateEtc; | ||
11689 | node.replaceState = legacySetStateEtc; | ||
11690 | node.forceUpdate = legacySetStateEtc; | ||
11691 | node.setProps = legacySetProps; | ||
11692 | node.replaceProps = legacyReplaceProps; | ||
11693 | |||
11694 | if (process.env.NODE_ENV !== 'production') { | ||
11695 | if (canDefineProperty) { | ||
11696 | Object.defineProperties(node, legacyPropsDescriptor); | ||
11697 | } else { | ||
11698 | // updateComponent will update this property on subsequent renders | ||
11699 | node.props = this._currentElement.props; | ||
11700 | } | ||
11701 | } else { | ||
11702 | // updateComponent will update this property on subsequent renders | ||
11703 | node.props = this._currentElement.props; | ||
11704 | } | ||
11705 | |||
11706 | this._nodeWithLegacyProperties = node; | ||
11707 | } | ||
11708 | return this._nodeWithLegacyProperties; | ||
11709 | } | ||
11710 | |||
11711 | }; | ||
11712 | |||
11713 | ReactPerf.measureMethods(ReactDOMComponent, 'ReactDOMComponent', { | ||
11714 | mountComponent: 'mountComponent', | ||
11715 | updateComponent: 'updateComponent' | ||
11716 | }); | ||
11717 | |||
11718 | assign(ReactDOMComponent.prototype, ReactDOMComponent.Mixin, ReactMultiChild.Mixin); | ||
11719 | |||
11720 | module.exports = ReactDOMComponent; | ||
11721 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
11722 | |||
11723 | /***/ }, | ||
11724 | /* 96 */ | ||
11725 | /***/ function(module, exports, __webpack_require__) { | ||
11726 | |||
11727 | /** | ||
11728 | * Copyright 2013-2015, Facebook, Inc. | ||
11729 | * All rights reserved. | ||
11730 | * | ||
11731 | * This source code is licensed under the BSD-style license found in the | ||
11732 | * LICENSE file in the root directory of this source tree. An additional grant | ||
11733 | * of patent rights can be found in the PATENTS file in the same directory. | ||
11734 | * | ||
11735 | * @providesModule AutoFocusUtils | ||
11736 | * @typechecks static-only | ||
11737 | */ | ||
11738 | |||
11739 | 'use strict'; | ||
11740 | |||
11741 | var ReactMount = __webpack_require__(30); | ||
11742 | |||
11743 | var findDOMNode = __webpack_require__(93); | ||
11744 | var focusNode = __webpack_require__(97); | ||
11745 | |||
11746 | var Mixin = { | ||
11747 | componentDidMount: function () { | ||
11748 | if (this.props.autoFocus) { | ||
11749 | focusNode(findDOMNode(this)); | ||
11750 | } | ||
11751 | } | ||
11752 | }; | ||
11753 | |||
11754 | var AutoFocusUtils = { | ||
11755 | Mixin: Mixin, | ||
11756 | |||
11757 | focusDOMComponent: function () { | ||
11758 | focusNode(ReactMount.getNode(this._rootNodeID)); | ||
11759 | } | ||
11760 | }; | ||
11761 | |||
11762 | module.exports = AutoFocusUtils; | ||
11763 | |||
11764 | /***/ }, | ||
11765 | /* 97 */ | ||
11766 | /***/ function(module, exports) { | ||
11767 | |||
11768 | /** | ||
11769 | * Copyright 2013-2015, Facebook, Inc. | ||
11770 | * All rights reserved. | ||
11771 | * | ||
11772 | * This source code is licensed under the BSD-style license found in the | ||
11773 | * LICENSE file in the root directory of this source tree. An additional grant | ||
11774 | * of patent rights can be found in the PATENTS file in the same directory. | ||
11775 | * | ||
11776 | * @providesModule focusNode | ||
11777 | */ | ||
11778 | |||
11779 | 'use strict'; | ||
11780 | |||
11781 | /** | ||
11782 | * @param {DOMElement} node input/textarea to focus | ||
11783 | */ | ||
11784 | function focusNode(node) { | ||
11785 | // IE8 can throw "Can't move focus to the control because it is invisible, | ||
11786 | // not enabled, or of a type that does not accept the focus." for all kinds of | ||
11787 | // reasons that are too expensive and fragile to test. | ||
11788 | try { | ||
11789 | node.focus(); | ||
11790 | } catch (e) {} | ||
11791 | } | ||
11792 | |||
11793 | module.exports = focusNode; | ||
11794 | |||
11795 | /***/ }, | ||
11796 | /* 98 */ | ||
11797 | /***/ function(module, exports, __webpack_require__) { | ||
11798 | |||
11799 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
11800 | * Copyright 2013-2015, Facebook, Inc. | ||
11801 | * All rights reserved. | ||
11802 | * | ||
11803 | * 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 | ||
11805 | * of patent rights can be found in the PATENTS file in the same directory. | ||
11806 | * | ||
11807 | * @providesModule CSSPropertyOperations | ||
11808 | * @typechecks static-only | ||
11809 | */ | ||
11810 | |||
11811 | 'use strict'; | ||
11812 | |||
11813 | var CSSProperty = __webpack_require__(99); | ||
11814 | var ExecutionEnvironment = __webpack_require__(11); | ||
11815 | var ReactPerf = __webpack_require__(20); | ||
11816 | |||
11817 | var camelizeStyleName = __webpack_require__(100); | ||
11818 | var dangerousStyleValue = __webpack_require__(102); | ||
11819 | var hyphenateStyleName = __webpack_require__(103); | ||
11820 | var memoizeStringOnly = __webpack_require__(105); | ||
11821 | var warning = __webpack_require__(27); | ||
11822 | |||
11823 | var processStyleName = memoizeStringOnly(function (styleName) { | ||
11824 | return hyphenateStyleName(styleName); | ||
11825 | }); | ||
11826 | |||
11827 | var hasShorthandPropertyBug = false; | ||
11828 | var styleFloatAccessor = 'cssFloat'; | ||
11829 | if (ExecutionEnvironment.canUseDOM) { | ||
11830 | var tempStyle = document.createElement('div').style; | ||
11831 | try { | ||
11832 | // IE8 throws "Invalid argument." if resetting shorthand style properties. | ||
11833 | tempStyle.font = ''; | ||
11834 | } catch (e) { | ||
11835 | hasShorthandPropertyBug = true; | ||
11836 | } | ||
11837 | // IE8 only supports accessing cssFloat (standard) as styleFloat | ||
11838 | if (document.documentElement.style.cssFloat === undefined) { | ||
11839 | styleFloatAccessor = 'styleFloat'; | ||
11840 | } | ||
11841 | } | ||
11842 | |||
11843 | if (process.env.NODE_ENV !== 'production') { | ||
11844 | // 'msTransform' is correct, but the other prefixes should be capitalized | ||
11845 | var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/; | ||
11846 | |||
11847 | // style values shouldn't contain a semicolon | ||
11848 | var badStyleValueWithSemicolonPattern = /;\s*$/; | ||
11849 | |||
11850 | var warnedStyleNames = {}; | ||
11851 | var warnedStyleValues = {}; | ||
11852 | |||
11853 | var warnHyphenatedStyleName = function (name) { | ||
11854 | if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) { | ||
11855 | return; | ||
11856 | } | ||
11857 | |||
11858 | warnedStyleNames[name] = true; | ||
11859 | process.env.NODE_ENV !== 'production' ? warning(false, 'Unsupported style property %s. Did you mean %s?', name, camelizeStyleName(name)) : undefined; | ||
11860 | }; | ||
11861 | |||
11862 | var warnBadVendoredStyleName = function (name) { | ||
11863 | if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) { | ||
11864 | return; | ||
11865 | } | ||
11866 | |||
11867 | warnedStyleNames[name] = true; | ||
11868 | 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; | ||
11869 | }; | ||
11870 | |||
11871 | var warnStyleValueWithSemicolon = function (name, value) { | ||
11872 | if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) { | ||
11873 | return; | ||
11874 | } | ||
11875 | |||
11876 | warnedStyleValues[value] = true; | ||
11877 | process.env.NODE_ENV !== 'production' ? warning(false, 'Style property values shouldn\'t contain a semicolon. ' + 'Try "%s: %s" instead.', name, value.replace(badStyleValueWithSemicolonPattern, '')) : undefined; | ||
11878 | }; | ||
11879 | |||
11880 | /** | ||
11881 | * @param {string} name | ||
11882 | * @param {*} value | ||
11883 | */ | ||
11884 | var warnValidStyle = function (name, value) { | ||
11885 | if (name.indexOf('-') > -1) { | ||
11886 | warnHyphenatedStyleName(name); | ||
11887 | } else if (badVendoredStyleNamePattern.test(name)) { | ||
11888 | warnBadVendoredStyleName(name); | ||
11889 | } else if (badStyleValueWithSemicolonPattern.test(value)) { | ||
11890 | warnStyleValueWithSemicolon(name, value); | ||
11891 | } | ||
11892 | }; | ||
11893 | } | ||
11894 | |||
11895 | /** | ||
11896 | * Operations for dealing with CSS properties. | ||
11897 | */ | ||
11898 | var CSSPropertyOperations = { | ||
11899 | |||
11900 | /** | ||
11901 | * Serializes a mapping of style properties for use as inline styles: | ||
11902 | * | ||
11903 | * > createMarkupForStyles({width: '200px', height: 0}) | ||
11904 | * "width:200px;height:0;" | ||
11905 | * | ||
11906 | * Undefined values are ignored so that declarative programming is easier. | ||
11907 | * The result should be HTML-escaped before insertion into the DOM. | ||
11908 | * | ||
11909 | * @param {object} styles | ||
11910 | * @return {?string} | ||
11911 | */ | ||
11912 | createMarkupForStyles: function (styles) { | ||
11913 | var serialized = ''; | ||
11914 | for (var styleName in styles) { | ||
11915 | if (!styles.hasOwnProperty(styleName)) { | ||
11916 | continue; | ||
11917 | } | ||
11918 | var styleValue = styles[styleName]; | ||
11919 | if (process.env.NODE_ENV !== 'production') { | ||
11920 | warnValidStyle(styleName, styleValue); | ||
11921 | } | ||
11922 | if (styleValue != null) { | ||
11923 | serialized += processStyleName(styleName) + ':'; | ||
11924 | serialized += dangerousStyleValue(styleName, styleValue) + ';'; | ||
11925 | } | ||
11926 | } | ||
11927 | return serialized || null; | ||
11928 | }, | ||
11929 | |||
11930 | /** | ||
11931 | * Sets the value for multiple styles on a node. If a value is specified as | ||
11932 | * '' (empty string), the corresponding style property will be unset. | ||
11933 | * | ||
11934 | * @param {DOMElement} node | ||
11935 | * @param {object} styles | ||
11936 | */ | ||
11937 | setValueForStyles: function (node, styles) { | ||
11938 | var style = node.style; | ||
11939 | for (var styleName in styles) { | ||
11940 | if (!styles.hasOwnProperty(styleName)) { | ||
11941 | continue; | ||
11942 | } | ||
11943 | if (process.env.NODE_ENV !== 'production') { | ||
11944 | warnValidStyle(styleName, styles[styleName]); | ||
11945 | } | ||
11946 | var styleValue = dangerousStyleValue(styleName, styles[styleName]); | ||
11947 | if (styleName === 'float') { | ||
11948 | styleName = styleFloatAccessor; | ||
11949 | } | ||
11950 | if (styleValue) { | ||
11951 | style[styleName] = styleValue; | ||
11952 | } else { | ||
11953 | var expansion = hasShorthandPropertyBug && CSSProperty.shorthandPropertyExpansions[styleName]; | ||
11954 | if (expansion) { | ||
11955 | // Shorthand property that IE8 won't like unsetting, so unset each | ||
11956 | // component to placate it | ||
11957 | for (var individualStyleName in expansion) { | ||
11958 | style[individualStyleName] = ''; | ||
11959 | } | ||
11960 | } else { | ||
11961 | style[styleName] = ''; | ||
11962 | } | ||
11963 | } | ||
11964 | } | ||
11965 | } | ||
11966 | |||
11967 | }; | ||
11968 | |||
11969 | ReactPerf.measureMethods(CSSPropertyOperations, 'CSSPropertyOperations', { | ||
11970 | setValueForStyles: 'setValueForStyles' | ||
11971 | }); | ||
11972 | |||
11973 | module.exports = CSSPropertyOperations; | ||
11974 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
11975 | |||
11976 | /***/ }, | ||
11977 | /* 99 */ | ||
11978 | /***/ function(module, exports) { | ||
11979 | |||
11980 | /** | ||
11981 | * Copyright 2013-2015, Facebook, Inc. | ||
11982 | * All rights reserved. | ||
11983 | * | ||
11984 | * This source code is licensed under the BSD-style license found in the | ||
11985 | * LICENSE file in the root directory of this source tree. An additional grant | ||
11986 | * of patent rights can be found in the PATENTS file in the same directory. | ||
11987 | * | ||
11988 | * @providesModule CSSProperty | ||
11989 | */ | ||
11990 | |||
11991 | 'use strict'; | ||
11992 | |||
11993 | /** | ||
11994 | * CSS properties which accept numbers but are not in units of "px". | ||
11995 | */ | ||
11996 | var isUnitlessNumber = { | ||
11997 | animationIterationCount: true, | ||
11998 | boxFlex: true, | ||
11999 | boxFlexGroup: true, | ||
12000 | boxOrdinalGroup: true, | ||
12001 | columnCount: true, | ||
12002 | flex: true, | ||
12003 | flexGrow: true, | ||
12004 | flexPositive: true, | ||
12005 | flexShrink: true, | ||
12006 | flexNegative: true, | ||
12007 | flexOrder: true, | ||
12008 | fontWeight: true, | ||
12009 | lineClamp: true, | ||
12010 | lineHeight: true, | ||
12011 | opacity: true, | ||
12012 | order: true, | ||
12013 | orphans: true, | ||
12014 | tabSize: true, | ||
12015 | widows: true, | ||
12016 | zIndex: true, | ||
12017 | zoom: true, | ||
12018 | |||
12019 | // SVG-related properties | ||
12020 | fillOpacity: true, | ||
12021 | stopOpacity: true, | ||
12022 | strokeDashoffset: true, | ||
12023 | strokeOpacity: true, | ||
12024 | strokeWidth: true | ||
12025 | }; | ||
12026 | |||
12027 | /** | ||
12028 | * @param {string} prefix vendor-specific prefix, eg: Webkit | ||
12029 | * @param {string} key style name, eg: transitionDuration | ||
12030 | * @return {string} style name prefixed with `prefix`, properly camelCased, eg: | ||
12031 | * WebkitTransitionDuration | ||
12032 | */ | ||
12033 | function prefixKey(prefix, key) { | ||
12034 | return prefix + key.charAt(0).toUpperCase() + key.substring(1); | ||
12035 | } | ||
12036 | |||
12037 | /** | ||
12038 | * Support style names that may come passed in prefixed by adding permutations | ||
12039 | * of vendor prefixes. | ||
12040 | */ | ||
12041 | var prefixes = ['Webkit', 'ms', 'Moz', 'O']; | ||
12042 | |||
12043 | // Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an | ||
12044 | // infinite loop, because it iterates over the newly added props too. | ||
12045 | Object.keys(isUnitlessNumber).forEach(function (prop) { | ||
12046 | prefixes.forEach(function (prefix) { | ||
12047 | isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop]; | ||
12048 | }); | ||
12049 | }); | ||
12050 | |||
12051 | /** | ||
12052 | * Most style properties can be unset by doing .style[prop] = '' but IE8 | ||
12053 | * doesn't like doing that with shorthand properties so for the properties that | ||
12054 | * IE8 breaks on, which are listed here, we instead unset each of the | ||
12055 | * individual properties. See http://bugs.jquery.com/ticket/12385. | ||
12056 | * The 4-value 'clock' properties like margin, padding, border-width seem to | ||
12057 | * behave without any problems. Curiously, list-style works too without any | ||
12058 | * special prodding. | ||
12059 | */ | ||
12060 | var shorthandPropertyExpansions = { | ||
12061 | background: { | ||
12062 | backgroundAttachment: true, | ||
12063 | backgroundColor: true, | ||
12064 | backgroundImage: true, | ||
12065 | backgroundPositionX: true, | ||
12066 | backgroundPositionY: true, | ||
12067 | backgroundRepeat: true | ||
12068 | }, | ||
12069 | backgroundPosition: { | ||
12070 | backgroundPositionX: true, | ||
12071 | backgroundPositionY: true | ||
12072 | }, | ||
12073 | border: { | ||
12074 | borderWidth: true, | ||
12075 | borderStyle: true, | ||
12076 | borderColor: true | ||
12077 | }, | ||
12078 | borderBottom: { | ||
12079 | borderBottomWidth: true, | ||
12080 | borderBottomStyle: true, | ||
12081 | borderBottomColor: true | ||
12082 | }, | ||
12083 | borderLeft: { | ||
12084 | borderLeftWidth: true, | ||
12085 | borderLeftStyle: true, | ||
12086 | borderLeftColor: true | ||
12087 | }, | ||
12088 | borderRight: { | ||
12089 | borderRightWidth: true, | ||
12090 | borderRightStyle: true, | ||
12091 | borderRightColor: true | ||
12092 | }, | ||
12093 | borderTop: { | ||
12094 | borderTopWidth: true, | ||
12095 | borderTopStyle: true, | ||
12096 | borderTopColor: true | ||
12097 | }, | ||
12098 | font: { | ||
12099 | fontStyle: true, | ||
12100 | fontVariant: true, | ||
12101 | fontWeight: true, | ||
12102 | fontSize: true, | ||
12103 | lineHeight: true, | ||
12104 | fontFamily: true | ||
12105 | }, | ||
12106 | outline: { | ||
12107 | outlineWidth: true, | ||
12108 | outlineStyle: true, | ||
12109 | outlineColor: true | ||
12110 | } | ||
12111 | }; | ||
12112 | |||
12113 | var CSSProperty = { | ||
12114 | isUnitlessNumber: isUnitlessNumber, | ||
12115 | shorthandPropertyExpansions: shorthandPropertyExpansions | ||
12116 | }; | ||
12117 | |||
12118 | module.exports = CSSProperty; | ||
12119 | |||
12120 | /***/ }, | ||
12121 | /* 100 */ | ||
12122 | /***/ function(module, exports, __webpack_require__) { | ||
12123 | |||
12124 | /** | ||
12125 | * Copyright 2013-2015, Facebook, Inc. | ||
12126 | * All rights reserved. | ||
12127 | * | ||
12128 | * This source code is licensed under the BSD-style license found in the | ||
12129 | * LICENSE file in the root directory of this source tree. An additional grant | ||
12130 | * of patent rights can be found in the PATENTS file in the same directory. | ||
12131 | * | ||
12132 | * @providesModule camelizeStyleName | ||
12133 | * @typechecks | ||
12134 | */ | ||
12135 | |||
12136 | 'use strict'; | ||
12137 | |||
12138 | var camelize = __webpack_require__(101); | ||
12139 | |||
12140 | var msPattern = /^-ms-/; | ||
12141 | |||
12142 | /** | ||
12143 | * Camelcases a hyphenated CSS property name, for example: | ||
12144 | * | ||
12145 | * > camelizeStyleName('background-color') | ||
12146 | * < "backgroundColor" | ||
12147 | * > camelizeStyleName('-moz-transition') | ||
12148 | * < "MozTransition" | ||
12149 | * > camelizeStyleName('-ms-transition') | ||
12150 | * < "msTransition" | ||
12151 | * | ||
12152 | * As Andi Smith suggests | ||
12153 | * (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix | ||
12154 | * is converted to lowercase `ms`. | ||
12155 | * | ||
12156 | * @param {string} string | ||
12157 | * @return {string} | ||
12158 | */ | ||
12159 | function camelizeStyleName(string) { | ||
12160 | return camelize(string.replace(msPattern, 'ms-')); | ||
12161 | } | ||
12162 | |||
12163 | module.exports = camelizeStyleName; | ||
12164 | |||
12165 | /***/ }, | ||
12166 | /* 101 */ | ||
12167 | /***/ function(module, exports) { | ||
12168 | |||
12169 | /** | ||
12170 | * Copyright 2013-2015, Facebook, Inc. | ||
12171 | * All rights reserved. | ||
12172 | * | ||
12173 | * This source code is licensed under the BSD-style license found in the | ||
12174 | * LICENSE file in the root directory of this source tree. An additional grant | ||
12175 | * of patent rights can be found in the PATENTS file in the same directory. | ||
12176 | * | ||
12177 | * @providesModule camelize | ||
12178 | * @typechecks | ||
12179 | */ | ||
12180 | |||
12181 | "use strict"; | ||
12182 | |||
12183 | var _hyphenPattern = /-(.)/g; | ||
12184 | |||
12185 | /** | ||
12186 | * Camelcases a hyphenated string, for example: | ||
12187 | * | ||
12188 | * > camelize('background-color') | ||
12189 | * < "backgroundColor" | ||
12190 | * | ||
12191 | * @param {string} string | ||
12192 | * @return {string} | ||
12193 | */ | ||
12194 | function camelize(string) { | ||
12195 | return string.replace(_hyphenPattern, function (_, character) { | ||
12196 | return character.toUpperCase(); | ||
12197 | }); | ||
12198 | } | ||
12199 | |||
12200 | module.exports = camelize; | ||
12201 | |||
12202 | /***/ }, | ||
12203 | /* 102 */ | ||
12204 | /***/ function(module, exports, __webpack_require__) { | ||
12205 | |||
12206 | /** | ||
12207 | * Copyright 2013-2015, Facebook, Inc. | ||
12208 | * All rights reserved. | ||
12209 | * | ||
12210 | * This source code is licensed under the BSD-style license found in the | ||
12211 | * LICENSE file in the root directory of this source tree. An additional grant | ||
12212 | * of patent rights can be found in the PATENTS file in the same directory. | ||
12213 | * | ||
12214 | * @providesModule dangerousStyleValue | ||
12215 | * @typechecks static-only | ||
12216 | */ | ||
12217 | |||
12218 | 'use strict'; | ||
12219 | |||
12220 | var CSSProperty = __webpack_require__(99); | ||
12221 | |||
12222 | var isUnitlessNumber = CSSProperty.isUnitlessNumber; | ||
12223 | |||
12224 | /** | ||
12225 | * Convert a value into the proper css writable value. The style name `name` | ||
12226 | * should be logical (no hyphens), as specified | ||
12227 | * in `CSSProperty.isUnitlessNumber`. | ||
12228 | * | ||
12229 | * @param {string} name CSS property name such as `topMargin`. | ||
12230 | * @param {*} value CSS property value such as `10px`. | ||
12231 | * @return {string} Normalized style value with dimensions applied. | ||
12232 | */ | ||
12233 | function dangerousStyleValue(name, value) { | ||
12234 | // Note that we've removed escapeTextForBrowser() calls here since the | ||
12235 | // whole string will be escaped when the attribute is injected into | ||
12236 | // the markup. If you provide unsafe user data here they can inject | ||
12237 | // arbitrary CSS which may be problematic (I couldn't repro this): | ||
12238 | // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet | ||
12239 | // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/ | ||
12240 | // This is not an XSS hole but instead a potential CSS injection issue | ||
12241 | // which has lead to a greater discussion about how we're going to | ||
12242 | // trust URLs moving forward. See #2115901 | ||
12243 | |||
12244 | var isEmpty = value == null || typeof value === 'boolean' || value === ''; | ||
12245 | if (isEmpty) { | ||
12246 | return ''; | ||
12247 | } | ||
12248 | |||
12249 | var isNonNumeric = isNaN(value); | ||
12250 | if (isNonNumeric || value === 0 || isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) { | ||
12251 | return '' + value; // cast to string | ||
12252 | } | ||
12253 | |||
12254 | if (typeof value === 'string') { | ||
12255 | value = value.trim(); | ||
12256 | } | ||
12257 | return value + 'px'; | ||
12258 | } | ||
12259 | |||
12260 | module.exports = dangerousStyleValue; | ||
12261 | |||
12262 | /***/ }, | ||
12263 | /* 103 */ | ||
12264 | /***/ function(module, exports, __webpack_require__) { | ||
12265 | |||
12266 | /** | ||
12267 | * Copyright 2013-2015, Facebook, Inc. | ||
12268 | * All rights reserved. | ||
12269 | * | ||
12270 | * This source code is licensed under the BSD-style license found in the | ||
12271 | * LICENSE file in the root directory of this source tree. An additional grant | ||
12272 | * of patent rights can be found in the PATENTS file in the same directory. | ||
12273 | * | ||
12274 | * @providesModule hyphenateStyleName | ||
12275 | * @typechecks | ||
12276 | */ | ||
12277 | |||
12278 | 'use strict'; | ||
12279 | |||
12280 | var hyphenate = __webpack_require__(104); | ||
12281 | |||
12282 | var msPattern = /^ms-/; | ||
12283 | |||
12284 | /** | ||
12285 | * Hyphenates a camelcased CSS property name, for example: | ||
12286 | * | ||
12287 | * > hyphenateStyleName('backgroundColor') | ||
12288 | * < "background-color" | ||
12289 | * > hyphenateStyleName('MozTransition') | ||
12290 | * < "-moz-transition" | ||
12291 | * > hyphenateStyleName('msTransition') | ||
12292 | * < "-ms-transition" | ||
12293 | * | ||
12294 | * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix | ||
12295 | * is converted to `-ms-`. | ||
12296 | * | ||
12297 | * @param {string} string | ||
12298 | * @return {string} | ||
12299 | */ | ||
12300 | function hyphenateStyleName(string) { | ||
12301 | return hyphenate(string).replace(msPattern, '-ms-'); | ||
12302 | } | ||
12303 | |||
12304 | module.exports = hyphenateStyleName; | ||
12305 | |||
12306 | /***/ }, | ||
12307 | /* 104 */ | ||
12308 | /***/ function(module, exports) { | ||
12309 | |||
12310 | /** | ||
12311 | * Copyright 2013-2015, Facebook, Inc. | ||
12312 | * All rights reserved. | ||
12313 | * | ||
12314 | * This source code is licensed under the BSD-style license found in the | ||
12315 | * LICENSE file in the root directory of this source tree. An additional grant | ||
12316 | * of patent rights can be found in the PATENTS file in the same directory. | ||
12317 | * | ||
12318 | * @providesModule hyphenate | ||
12319 | * @typechecks | ||
12320 | */ | ||
12321 | |||
12322 | 'use strict'; | ||
12323 | |||
12324 | var _uppercasePattern = /([A-Z])/g; | ||
12325 | |||
12326 | /** | ||
12327 | * Hyphenates a camelcased string, for example: | ||
12328 | * | ||
12329 | * > hyphenate('backgroundColor') | ||
12330 | * < "background-color" | ||
12331 | * | ||
12332 | * For CSS style names, use `hyphenateStyleName` instead which works properly | ||
12333 | * with all vendor prefixes, including `ms`. | ||
12334 | * | ||
12335 | * @param {string} string | ||
12336 | * @return {string} | ||
12337 | */ | ||
12338 | function hyphenate(string) { | ||
12339 | return string.replace(_uppercasePattern, '-$1').toLowerCase(); | ||
12340 | } | ||
12341 | |||
12342 | module.exports = hyphenate; | ||
12343 | |||
12344 | /***/ }, | ||
12345 | /* 105 */ | ||
12346 | /***/ function(module, exports) { | ||
12347 | |||
12348 | /** | ||
12349 | * Copyright 2013-2015, Facebook, Inc. | ||
12350 | * All rights reserved. | ||
12351 | * | ||
12352 | * This source code is licensed under the BSD-style license found in the | ||
12353 | * LICENSE file in the root directory of this source tree. An additional grant | ||
12354 | * of patent rights can be found in the PATENTS file in the same directory. | ||
12355 | * | ||
12356 | * @providesModule memoizeStringOnly | ||
12357 | * @typechecks static-only | ||
12358 | */ | ||
12359 | |||
12360 | 'use strict'; | ||
12361 | |||
12362 | /** | ||
12363 | * Memoizes the return value of a function that accepts one string argument. | ||
12364 | * | ||
12365 | * @param {function} callback | ||
12366 | * @return {function} | ||
12367 | */ | ||
12368 | function memoizeStringOnly(callback) { | ||
12369 | var cache = {}; | ||
12370 | return function (string) { | ||
12371 | if (!cache.hasOwnProperty(string)) { | ||
12372 | cache[string] = callback.call(this, string); | ||
12373 | } | ||
12374 | return cache[string]; | ||
12375 | }; | ||
12376 | } | ||
12377 | |||
12378 | module.exports = memoizeStringOnly; | ||
12379 | |||
12380 | /***/ }, | ||
12381 | /* 106 */ | ||
12382 | /***/ function(module, exports) { | ||
12383 | |||
12384 | /** | ||
12385 | * Copyright 2013-2015, Facebook, Inc. | ||
12386 | * All rights reserved. | ||
12387 | * | ||
12388 | * This source code is licensed under the BSD-style license found in the | ||
12389 | * LICENSE file in the root directory of this source tree. An additional grant | ||
12390 | * of patent rights can be found in the PATENTS file in the same directory. | ||
12391 | * | ||
12392 | * @providesModule ReactDOMButton | ||
12393 | */ | ||
12394 | |||
12395 | 'use strict'; | ||
12396 | |||
12397 | var mouseListenerNames = { | ||
12398 | onClick: true, | ||
12399 | onDoubleClick: true, | ||
12400 | onMouseDown: true, | ||
12401 | onMouseMove: true, | ||
12402 | onMouseUp: true, | ||
12403 | |||
12404 | onClickCapture: true, | ||
12405 | onDoubleClickCapture: true, | ||
12406 | onMouseDownCapture: true, | ||
12407 | onMouseMoveCapture: true, | ||
12408 | onMouseUpCapture: true | ||
12409 | }; | ||
12410 | |||
12411 | /** | ||
12412 | * Implements a <button> native component that does not receive mouse events | ||
12413 | * when `disabled` is set. | ||
12414 | */ | ||
12415 | var ReactDOMButton = { | ||
12416 | getNativeProps: function (inst, props, context) { | ||
12417 | if (!props.disabled) { | ||
12418 | return props; | ||
12419 | } | ||
12420 | |||
12421 | // Copy the props, except the mouse listeners | ||
12422 | var nativeProps = {}; | ||
12423 | for (var key in props) { | ||
12424 | if (props.hasOwnProperty(key) && !mouseListenerNames[key]) { | ||
12425 | nativeProps[key] = props[key]; | ||
12426 | } | ||
12427 | } | ||
12428 | |||
12429 | return nativeProps; | ||
12430 | } | ||
12431 | }; | ||
12432 | |||
12433 | module.exports = ReactDOMButton; | ||
12434 | |||
12435 | /***/ }, | ||
12436 | /* 107 */ | ||
12437 | /***/ function(module, exports, __webpack_require__) { | ||
12438 | |||
12439 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
12440 | * Copyright 2013-2015, Facebook, Inc. | ||
12441 | * All rights reserved. | ||
12442 | * | ||
12443 | * This source code is licensed under the BSD-style license found in the | ||
12444 | * LICENSE file in the root directory of this source tree. An additional grant | ||
12445 | * of patent rights can be found in the PATENTS file in the same directory. | ||
12446 | * | ||
12447 | * @providesModule ReactDOMInput | ||
12448 | */ | ||
12449 | |||
12450 | 'use strict'; | ||
12451 | |||
12452 | var ReactDOMIDOperations = __webpack_require__(29); | ||
12453 | var LinkedValueUtils = __webpack_require__(108); | ||
12454 | var ReactMount = __webpack_require__(30); | ||
12455 | var ReactUpdates = __webpack_require__(56); | ||
12456 | |||
12457 | var assign = __webpack_require__(41); | ||
12458 | var invariant = __webpack_require__(15); | ||
12459 | |||
12460 | var instancesByReactID = {}; | ||
12461 | |||
12462 | function forceUpdateIfMounted() { | ||
12463 | if (this._rootNodeID) { | ||
12464 | // DOM component is still mounted; update | ||
12465 | ReactDOMInput.updateWrapper(this); | ||
12466 | } | ||
12467 | } | ||
12468 | |||
12469 | /** | ||
12470 | * Implements an <input> native component that allows setting these optional | ||
12471 | * props: `checked`, `value`, `defaultChecked`, and `defaultValue`. | ||
12472 | * | ||
12473 | * If `checked` or `value` are not supplied (or null/undefined), user actions | ||
12474 | * that affect the checked state or value will trigger updates to the element. | ||
12475 | * | ||
12476 | * If they are supplied (and not null/undefined), the rendered element will not | ||
12477 | * trigger updates to the element. Instead, the props must change in order for | ||
12478 | * the rendered element to be updated. | ||
12479 | * | ||
12480 | * The rendered element will be initialized as unchecked (or `defaultChecked`) | ||
12481 | * with an empty value (or `defaultValue`). | ||
12482 | * | ||
12483 | * @see http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html | ||
12484 | */ | ||
12485 | var ReactDOMInput = { | ||
12486 | getNativeProps: function (inst, props, context) { | ||
12487 | var value = LinkedValueUtils.getValue(props); | ||
12488 | var checked = LinkedValueUtils.getChecked(props); | ||
12489 | |||
12490 | var nativeProps = assign({}, props, { | ||
12491 | defaultChecked: undefined, | ||
12492 | defaultValue: undefined, | ||
12493 | value: value != null ? value : inst._wrapperState.initialValue, | ||
12494 | checked: checked != null ? checked : inst._wrapperState.initialChecked, | ||
12495 | onChange: inst._wrapperState.onChange | ||
12496 | }); | ||
12497 | |||
12498 | return nativeProps; | ||
12499 | }, | ||
12500 | |||
12501 | mountWrapper: function (inst, props) { | ||
12502 | if (process.env.NODE_ENV !== 'production') { | ||
12503 | LinkedValueUtils.checkPropTypes('input', props, inst._currentElement._owner); | ||
12504 | } | ||
12505 | |||
12506 | var defaultValue = props.defaultValue; | ||
12507 | inst._wrapperState = { | ||
12508 | initialChecked: props.defaultChecked || false, | ||
12509 | initialValue: defaultValue != null ? defaultValue : null, | ||
12510 | onChange: _handleChange.bind(inst) | ||
12511 | }; | ||
12512 | }, | ||
12513 | |||
12514 | mountReadyWrapper: function (inst) { | ||
12515 | // Can't be in mountWrapper or else server rendering leaks. | ||
12516 | instancesByReactID[inst._rootNodeID] = inst; | ||
12517 | }, | ||
12518 | |||
12519 | unmountWrapper: function (inst) { | ||
12520 | delete instancesByReactID[inst._rootNodeID]; | ||
12521 | }, | ||
12522 | |||
12523 | updateWrapper: function (inst) { | ||
12524 | var props = inst._currentElement.props; | ||
12525 | |||
12526 | // TODO: Shouldn't this be getChecked(props)? | ||
12527 | var checked = props.checked; | ||
12528 | if (checked != null) { | ||
12529 | ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'checked', checked || false); | ||
12530 | } | ||
12531 | |||
12532 | var value = LinkedValueUtils.getValue(props); | ||
12533 | if (value != null) { | ||
12534 | // Cast `value` to a string to ensure the value is set correctly. While | ||
12535 | // browsers typically do this as necessary, jsdom doesn't. | ||
12536 | ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'value', '' + value); | ||
12537 | } | ||
12538 | } | ||
12539 | }; | ||
12540 | |||
12541 | function _handleChange(event) { | ||
12542 | var props = this._currentElement.props; | ||
12543 | |||
12544 | var returnValue = LinkedValueUtils.executeOnChange(props, event); | ||
12545 | |||
12546 | // Here we use asap to wait until all updates have propagated, which | ||
12547 | // is important when using controlled components within layers: | ||
12548 | // https://github.com/facebook/react/issues/1698 | ||
12549 | ReactUpdates.asap(forceUpdateIfMounted, this); | ||
12550 | |||
12551 | var name = props.name; | ||
12552 | if (props.type === 'radio' && name != null) { | ||
12553 | var rootNode = ReactMount.getNode(this._rootNodeID); | ||
12554 | var queryRoot = rootNode; | ||
12555 | |||
12556 | while (queryRoot.parentNode) { | ||
12557 | queryRoot = queryRoot.parentNode; | ||
12558 | } | ||
12559 | |||
12560 | // If `rootNode.form` was non-null, then we could try `form.elements`, | ||
12561 | // but that sometimes behaves strangely in IE8. We could also try using | ||
12562 | // `form.getElementsByName`, but that will only return direct children | ||
12563 | // and won't include inputs that use the HTML5 `form=` attribute. Since | ||
12564 | // the input might not even be in a form, let's just use the global | ||
12565 | // `querySelectorAll` to ensure we don't miss anything. | ||
12566 | var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]'); | ||
12567 | |||
12568 | for (var i = 0; i < group.length; i++) { | ||
12569 | var otherNode = group[i]; | ||
12570 | if (otherNode === rootNode || otherNode.form !== rootNode.form) { | ||
12571 | continue; | ||
12572 | } | ||
12573 | // This will throw if radio buttons rendered by different copies of React | ||
12574 | // and the same name are rendered into the same form (same as #1939). | ||
12575 | // That's probably okay; we don't support it just as we don't support | ||
12576 | // mixing React with non-React. | ||
12577 | var otherID = ReactMount.getID(otherNode); | ||
12578 | !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; | ||
12579 | var otherInstance = instancesByReactID[otherID]; | ||
12580 | !otherInstance ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOMInput: Unknown radio button ID %s.', otherID) : invariant(false) : undefined; | ||
12581 | // If this is a controlled radio button group, forcing the input that | ||
12582 | // was previously checked to update will cause it to be come re-checked | ||
12583 | // as appropriate. | ||
12584 | ReactUpdates.asap(forceUpdateIfMounted, otherInstance); | ||
12585 | } | ||
12586 | } | ||
12587 | |||
12588 | return returnValue; | ||
12589 | } | ||
12590 | |||
12591 | module.exports = ReactDOMInput; | ||
12592 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
12593 | |||
12594 | /***/ }, | ||
12595 | /* 108 */ | ||
12596 | /***/ function(module, exports, __webpack_require__) { | ||
12597 | |||
12598 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
12599 | * Copyright 2013-2015, Facebook, Inc. | ||
12600 | * All rights reserved. | ||
12601 | * | ||
12602 | * This source code is licensed under the BSD-style license found in the | ||
12603 | * LICENSE file in the root directory of this source tree. An additional grant | ||
12604 | * of patent rights can be found in the PATENTS file in the same directory. | ||
12605 | * | ||
12606 | * @providesModule LinkedValueUtils | ||
12607 | * @typechecks static-only | ||
12608 | */ | ||
12609 | |||
12610 | 'use strict'; | ||
12611 | |||
12612 | var ReactPropTypes = __webpack_require__(109); | ||
12613 | var ReactPropTypeLocations = __webpack_require__(67); | ||
12614 | |||
12615 | var invariant = __webpack_require__(15); | ||
12616 | var warning = __webpack_require__(27); | ||
12617 | |||
12618 | var hasReadOnlyValue = { | ||
12619 | 'button': true, | ||
12620 | 'checkbox': true, | ||
12621 | 'image': true, | ||
12622 | 'hidden': true, | ||
12623 | 'radio': true, | ||
12624 | 'reset': true, | ||
12625 | 'submit': true | ||
12626 | }; | ||
12627 | |||
12628 | function _assertSingleLink(inputProps) { | ||
12629 | !(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; | ||
12630 | } | ||
12631 | function _assertValueLink(inputProps) { | ||
12632 | _assertSingleLink(inputProps); | ||
12633 | !(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; | ||
12634 | } | ||
12635 | |||
12636 | function _assertCheckedLink(inputProps) { | ||
12637 | _assertSingleLink(inputProps); | ||
12638 | !(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; | ||
12639 | } | ||
12640 | |||
12641 | var propTypes = { | ||
12642 | value: function (props, propName, componentName) { | ||
12643 | if (!props[propName] || hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled) { | ||
12644 | return null; | ||
12645 | } | ||
12646 | return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.'); | ||
12647 | }, | ||
12648 | checked: function (props, propName, componentName) { | ||
12649 | if (!props[propName] || props.onChange || props.readOnly || props.disabled) { | ||
12650 | return null; | ||
12651 | } | ||
12652 | return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.'); | ||
12653 | }, | ||
12654 | onChange: ReactPropTypes.func | ||
12655 | }; | ||
12656 | |||
12657 | var loggedTypeFailures = {}; | ||
12658 | function getDeclarationErrorAddendum(owner) { | ||
12659 | if (owner) { | ||
12660 | var name = owner.getName(); | ||
12661 | if (name) { | ||
12662 | return ' Check the render method of `' + name + '`.'; | ||
12663 | } | ||
12664 | } | ||
12665 | return ''; | ||
12666 | } | ||
12667 | |||
12668 | /** | ||
12669 | * Provide a linked `value` attribute for controlled forms. You should not use | ||
12670 | * this outside of the ReactDOM controlled form components. | ||
12671 | */ | ||
12672 | var LinkedValueUtils = { | ||
12673 | checkPropTypes: function (tagName, props, owner) { | ||
12674 | for (var propName in propTypes) { | ||
12675 | if (propTypes.hasOwnProperty(propName)) { | ||
12676 | var error = propTypes[propName](props, propName, tagName, ReactPropTypeLocations.prop); | ||
12677 | } | ||
12678 | if (error instanceof Error && !(error.message in loggedTypeFailures)) { | ||
12679 | // Only monitor this failure once because there tends to be a lot of the | ||
12680 | // same error. | ||
12681 | loggedTypeFailures[error.message] = true; | ||
12682 | |||
12683 | var addendum = getDeclarationErrorAddendum(owner); | ||
12684 | process.env.NODE_ENV !== 'production' ? warning(false, 'Failed form propType: %s%s', error.message, addendum) : undefined; | ||
12685 | } | ||
12686 | } | ||
12687 | }, | ||
12688 | |||
12689 | /** | ||
12690 | * @param {object} inputProps Props for form component | ||
12691 | * @return {*} current value of the input either from value prop or link. | ||
12692 | */ | ||
12693 | getValue: function (inputProps) { | ||
12694 | if (inputProps.valueLink) { | ||
12695 | _assertValueLink(inputProps); | ||
12696 | return inputProps.valueLink.value; | ||
12697 | } | ||
12698 | return inputProps.value; | ||
12699 | }, | ||
12700 | |||
12701 | /** | ||
12702 | * @param {object} inputProps Props for form component | ||
12703 | * @return {*} current checked status of the input either from checked prop | ||
12704 | * or link. | ||
12705 | */ | ||
12706 | getChecked: function (inputProps) { | ||
12707 | if (inputProps.checkedLink) { | ||
12708 | _assertCheckedLink(inputProps); | ||
12709 | return inputProps.checkedLink.value; | ||
12710 | } | ||
12711 | return inputProps.checked; | ||
12712 | }, | ||
12713 | |||
12714 | /** | ||
12715 | * @param {object} inputProps Props for form component | ||
12716 | * @param {SyntheticEvent} event change event to handle | ||
12717 | */ | ||
12718 | executeOnChange: function (inputProps, event) { | ||
12719 | if (inputProps.valueLink) { | ||
12720 | _assertValueLink(inputProps); | ||
12721 | return inputProps.valueLink.requestChange(event.target.value); | ||
12722 | } else if (inputProps.checkedLink) { | ||
12723 | _assertCheckedLink(inputProps); | ||
12724 | return inputProps.checkedLink.requestChange(event.target.checked); | ||
12725 | } else if (inputProps.onChange) { | ||
12726 | return inputProps.onChange.call(undefined, event); | ||
12727 | } | ||
12728 | } | ||
12729 | }; | ||
12730 | |||
12731 | module.exports = LinkedValueUtils; | ||
12732 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
12733 | |||
12734 | /***/ }, | ||
12735 | /* 109 */ | ||
12736 | /***/ function(module, exports, __webpack_require__) { | ||
12737 | |||
12738 | /** | ||
12739 | * Copyright 2013-2015, Facebook, Inc. | ||
12740 | * All rights reserved. | ||
12741 | * | ||
12742 | * This source code is licensed under the BSD-style license found in the | ||
12743 | * LICENSE file in the root directory of this source tree. An additional grant | ||
12744 | * of patent rights can be found in the PATENTS file in the same directory. | ||
12745 | * | ||
12746 | * @providesModule ReactPropTypes | ||
12747 | */ | ||
12748 | |||
12749 | 'use strict'; | ||
12750 | |||
12751 | var ReactElement = __webpack_require__(44); | ||
12752 | var ReactPropTypeLocationNames = __webpack_require__(68); | ||
12753 | |||
12754 | var emptyFunction = __webpack_require__(17); | ||
12755 | var getIteratorFn = __webpack_require__(110); | ||
12756 | |||
12757 | /** | ||
12758 | * Collection of methods that allow declaration and validation of props that are | ||
12759 | * supplied to React components. Example usage: | ||
12760 | * | ||
12761 | * var Props = require('ReactPropTypes'); | ||
12762 | * var MyArticle = React.createClass({ | ||
12763 | * propTypes: { | ||
12764 | * // An optional string prop named "description". | ||
12765 | * description: Props.string, | ||
12766 | * | ||
12767 | * // A required enum prop named "category". | ||
12768 | * category: Props.oneOf(['News','Photos']).isRequired, | ||
12769 | * | ||
12770 | * // A prop named "dialog" that requires an instance of Dialog. | ||
12771 | * dialog: Props.instanceOf(Dialog).isRequired | ||
12772 | * }, | ||
12773 | * render: function() { ... } | ||
12774 | * }); | ||
12775 | * | ||
12776 | * A more formal specification of how these methods are used: | ||
12777 | * | ||
12778 | * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...) | ||
12779 | * decl := ReactPropTypes.{type}(.isRequired)? | ||
12780 | * | ||
12781 | * Each and every declaration produces a function with the same signature. This | ||
12782 | * allows the creation of custom validation functions. For example: | ||
12783 | * | ||
12784 | * var MyLink = React.createClass({ | ||
12785 | * propTypes: { | ||
12786 | * // An optional string or URI prop named "href". | ||
12787 | * href: function(props, propName, componentName) { | ||
12788 | * var propValue = props[propName]; | ||
12789 | * if (propValue != null && typeof propValue !== 'string' && | ||
12790 | * !(propValue instanceof URI)) { | ||
12791 | * return new Error( | ||
12792 | * 'Expected a string or an URI for ' + propName + ' in ' + | ||
12793 | * componentName | ||
12794 | * ); | ||
12795 | * } | ||
12796 | * } | ||
12797 | * }, | ||
12798 | * render: function() {...} | ||
12799 | * }); | ||
12800 | * | ||
12801 | * @internal | ||
12802 | */ | ||
12803 | |||
12804 | var ANONYMOUS = '<<anonymous>>'; | ||
12805 | |||
12806 | var ReactPropTypes = { | ||
12807 | array: createPrimitiveTypeChecker('array'), | ||
12808 | bool: createPrimitiveTypeChecker('boolean'), | ||
12809 | func: createPrimitiveTypeChecker('function'), | ||
12810 | number: createPrimitiveTypeChecker('number'), | ||
12811 | object: createPrimitiveTypeChecker('object'), | ||
12812 | string: createPrimitiveTypeChecker('string'), | ||
12813 | |||
12814 | any: createAnyTypeChecker(), | ||
12815 | arrayOf: createArrayOfTypeChecker, | ||
12816 | element: createElementTypeChecker(), | ||
12817 | instanceOf: createInstanceTypeChecker, | ||
12818 | node: createNodeChecker(), | ||
12819 | objectOf: createObjectOfTypeChecker, | ||
12820 | oneOf: createEnumTypeChecker, | ||
12821 | oneOfType: createUnionTypeChecker, | ||
12822 | shape: createShapeTypeChecker | ||
12823 | }; | ||
12824 | |||
12825 | function createChainableTypeChecker(validate) { | ||
12826 | function checkType(isRequired, props, propName, componentName, location, propFullName) { | ||
12827 | componentName = componentName || ANONYMOUS; | ||
12828 | propFullName = propFullName || propName; | ||
12829 | if (props[propName] == null) { | ||
12830 | var locationName = ReactPropTypeLocationNames[location]; | ||
12831 | if (isRequired) { | ||
12832 | return new Error('Required ' + locationName + ' `' + propFullName + '` was not specified in ' + ('`' + componentName + '`.')); | ||
12833 | } | ||
12834 | return null; | ||
12835 | } else { | ||
12836 | return validate(props, propName, componentName, location, propFullName); | ||
12837 | } | ||
12838 | } | ||
12839 | |||
12840 | var chainedCheckType = checkType.bind(null, false); | ||
12841 | chainedCheckType.isRequired = checkType.bind(null, true); | ||
12842 | |||
12843 | return chainedCheckType; | ||
12844 | } | ||
12845 | |||
12846 | function createPrimitiveTypeChecker(expectedType) { | ||
12847 | function validate(props, propName, componentName, location, propFullName) { | ||
12848 | var propValue = props[propName]; | ||
12849 | var propType = getPropType(propValue); | ||
12850 | if (propType !== expectedType) { | ||
12851 | var locationName = ReactPropTypeLocationNames[location]; | ||
12852 | // `propValue` being instance of, say, date/regexp, pass the 'object' | ||
12853 | // check, but we can offer a more precise error message here rather than | ||
12854 | // 'of type `object`'. | ||
12855 | var preciseType = getPreciseType(propValue); | ||
12856 | |||
12857 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); | ||
12858 | } | ||
12859 | return null; | ||
12860 | } | ||
12861 | return createChainableTypeChecker(validate); | ||
12862 | } | ||
12863 | |||
12864 | function createAnyTypeChecker() { | ||
12865 | return createChainableTypeChecker(emptyFunction.thatReturns(null)); | ||
12866 | } | ||
12867 | |||
12868 | function createArrayOfTypeChecker(typeChecker) { | ||
12869 | function validate(props, propName, componentName, location, propFullName) { | ||
12870 | var propValue = props[propName]; | ||
12871 | if (!Array.isArray(propValue)) { | ||
12872 | var locationName = ReactPropTypeLocationNames[location]; | ||
12873 | var propType = getPropType(propValue); | ||
12874 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.')); | ||
12875 | } | ||
12876 | for (var i = 0; i < propValue.length; i++) { | ||
12877 | var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']'); | ||
12878 | if (error instanceof Error) { | ||
12879 | return error; | ||
12880 | } | ||
12881 | } | ||
12882 | return null; | ||
12883 | } | ||
12884 | return createChainableTypeChecker(validate); | ||
12885 | } | ||
12886 | |||
12887 | function createElementTypeChecker() { | ||
12888 | function validate(props, propName, componentName, location, propFullName) { | ||
12889 | if (!ReactElement.isValidElement(props[propName])) { | ||
12890 | var locationName = ReactPropTypeLocationNames[location]; | ||
12891 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a single ReactElement.')); | ||
12892 | } | ||
12893 | return null; | ||
12894 | } | ||
12895 | return createChainableTypeChecker(validate); | ||
12896 | } | ||
12897 | |||
12898 | function createInstanceTypeChecker(expectedClass) { | ||
12899 | function validate(props, propName, componentName, location, propFullName) { | ||
12900 | if (!(props[propName] instanceof expectedClass)) { | ||
12901 | var locationName = ReactPropTypeLocationNames[location]; | ||
12902 | var expectedClassName = expectedClass.name || ANONYMOUS; | ||
12903 | var actualClassName = getClassName(props[propName]); | ||
12904 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.')); | ||
12905 | } | ||
12906 | return null; | ||
12907 | } | ||
12908 | return createChainableTypeChecker(validate); | ||
12909 | } | ||
12910 | |||
12911 | function createEnumTypeChecker(expectedValues) { | ||
12912 | if (!Array.isArray(expectedValues)) { | ||
12913 | return createChainableTypeChecker(function () { | ||
12914 | return new Error('Invalid argument supplied to oneOf, expected an instance of array.'); | ||
12915 | }); | ||
12916 | } | ||
12917 | |||
12918 | function validate(props, propName, componentName, location, propFullName) { | ||
12919 | var propValue = props[propName]; | ||
12920 | for (var i = 0; i < expectedValues.length; i++) { | ||
12921 | if (propValue === expectedValues[i]) { | ||
12922 | return null; | ||
12923 | } | ||
12924 | } | ||
12925 | |||
12926 | var locationName = ReactPropTypeLocationNames[location]; | ||
12927 | var valuesString = JSON.stringify(expectedValues); | ||
12928 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.')); | ||
12929 | } | ||
12930 | return createChainableTypeChecker(validate); | ||
12931 | } | ||
12932 | |||
12933 | function createObjectOfTypeChecker(typeChecker) { | ||
12934 | function validate(props, propName, componentName, location, propFullName) { | ||
12935 | var propValue = props[propName]; | ||
12936 | var propType = getPropType(propValue); | ||
12937 | if (propType !== 'object') { | ||
12938 | var locationName = ReactPropTypeLocationNames[location]; | ||
12939 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.')); | ||
12940 | } | ||
12941 | for (var key in propValue) { | ||
12942 | if (propValue.hasOwnProperty(key)) { | ||
12943 | var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key); | ||
12944 | if (error instanceof Error) { | ||
12945 | return error; | ||
12946 | } | ||
12947 | } | ||
12948 | } | ||
12949 | return null; | ||
12950 | } | ||
12951 | return createChainableTypeChecker(validate); | ||
12952 | } | ||
12953 | |||
12954 | function createUnionTypeChecker(arrayOfTypeCheckers) { | ||
12955 | if (!Array.isArray(arrayOfTypeCheckers)) { | ||
12956 | return createChainableTypeChecker(function () { | ||
12957 | return new Error('Invalid argument supplied to oneOfType, expected an instance of array.'); | ||
12958 | }); | ||
12959 | } | ||
12960 | |||
12961 | function validate(props, propName, componentName, location, propFullName) { | ||
12962 | for (var i = 0; i < arrayOfTypeCheckers.length; i++) { | ||
12963 | var checker = arrayOfTypeCheckers[i]; | ||
12964 | if (checker(props, propName, componentName, location, propFullName) == null) { | ||
12965 | return null; | ||
12966 | } | ||
12967 | } | ||
12968 | |||
12969 | var locationName = ReactPropTypeLocationNames[location]; | ||
12970 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.')); | ||
12971 | } | ||
12972 | return createChainableTypeChecker(validate); | ||
12973 | } | ||
12974 | |||
12975 | function createNodeChecker() { | ||
12976 | function validate(props, propName, componentName, location, propFullName) { | ||
12977 | if (!isNode(props[propName])) { | ||
12978 | var locationName = ReactPropTypeLocationNames[location]; | ||
12979 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.')); | ||
12980 | } | ||
12981 | return null; | ||
12982 | } | ||
12983 | return createChainableTypeChecker(validate); | ||
12984 | } | ||
12985 | |||
12986 | function createShapeTypeChecker(shapeTypes) { | ||
12987 | function validate(props, propName, componentName, location, propFullName) { | ||
12988 | var propValue = props[propName]; | ||
12989 | var propType = getPropType(propValue); | ||
12990 | if (propType !== 'object') { | ||
12991 | var locationName = ReactPropTypeLocationNames[location]; | ||
12992 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); | ||
12993 | } | ||
12994 | for (var key in shapeTypes) { | ||
12995 | var checker = shapeTypes[key]; | ||
12996 | if (!checker) { | ||
12997 | continue; | ||
12998 | } | ||
12999 | var error = checker(propValue, key, componentName, location, propFullName + '.' + key); | ||
13000 | if (error) { | ||
13001 | return error; | ||
13002 | } | ||
13003 | } | ||
13004 | return null; | ||
13005 | } | ||
13006 | return createChainableTypeChecker(validate); | ||
13007 | } | ||
13008 | |||
13009 | function isNode(propValue) { | ||
13010 | switch (typeof propValue) { | ||
13011 | case 'number': | ||
13012 | case 'string': | ||
13013 | case 'undefined': | ||
13014 | return true; | ||
13015 | case 'boolean': | ||
13016 | return !propValue; | ||
13017 | case 'object': | ||
13018 | if (Array.isArray(propValue)) { | ||
13019 | return propValue.every(isNode); | ||
13020 | } | ||
13021 | if (propValue === null || ReactElement.isValidElement(propValue)) { | ||
13022 | return true; | ||
13023 | } | ||
13024 | |||
13025 | var iteratorFn = getIteratorFn(propValue); | ||
13026 | if (iteratorFn) { | ||
13027 | var iterator = iteratorFn.call(propValue); | ||
13028 | var step; | ||
13029 | if (iteratorFn !== propValue.entries) { | ||
13030 | while (!(step = iterator.next()).done) { | ||
13031 | if (!isNode(step.value)) { | ||
13032 | return false; | ||
13033 | } | ||
13034 | } | ||
13035 | } else { | ||
13036 | // Iterator will provide entry [k,v] tuples rather than values. | ||
13037 | while (!(step = iterator.next()).done) { | ||
13038 | var entry = step.value; | ||
13039 | if (entry) { | ||
13040 | if (!isNode(entry[1])) { | ||
13041 | return false; | ||
13042 | } | ||
13043 | } | ||
13044 | } | ||
13045 | } | ||
13046 | } else { | ||
13047 | return false; | ||
13048 | } | ||
13049 | |||
13050 | return true; | ||
13051 | default: | ||
13052 | return false; | ||
13053 | } | ||
13054 | } | ||
13055 | |||
13056 | // Equivalent of `typeof` but with special handling for array and regexp. | ||
13057 | function getPropType(propValue) { | ||
13058 | var propType = typeof propValue; | ||
13059 | if (Array.isArray(propValue)) { | ||
13060 | return 'array'; | ||
13061 | } | ||
13062 | if (propValue instanceof RegExp) { | ||
13063 | // Old webkits (at least until Android 4.0) return 'function' rather than | ||
13064 | // 'object' for typeof a RegExp. We'll normalize this here so that /bla/ | ||
13065 | // passes PropTypes.object. | ||
13066 | return 'object'; | ||
13067 | } | ||
13068 | return propType; | ||
13069 | } | ||
13070 | |||
13071 | // This handles more types than `getPropType`. Only used for error messages. | ||
13072 | // See `createPrimitiveTypeChecker`. | ||
13073 | function getPreciseType(propValue) { | ||
13074 | var propType = getPropType(propValue); | ||
13075 | if (propType === 'object') { | ||
13076 | if (propValue instanceof Date) { | ||
13077 | return 'date'; | ||
13078 | } else if (propValue instanceof RegExp) { | ||
13079 | return 'regexp'; | ||
13080 | } | ||
13081 | } | ||
13082 | return propType; | ||
13083 | } | ||
13084 | |||
13085 | // Returns class name of the object, if any. | ||
13086 | function getClassName(propValue) { | ||
13087 | if (!propValue.constructor || !propValue.constructor.name) { | ||
13088 | return '<<anonymous>>'; | ||
13089 | } | ||
13090 | return propValue.constructor.name; | ||
13091 | } | ||
13092 | |||
13093 | module.exports = ReactPropTypes; | ||
13094 | |||
13095 | /***/ }, | ||
13096 | /* 110 */ | ||
13097 | /***/ function(module, exports) { | ||
13098 | |||
13099 | /** | ||
13100 | * Copyright 2013-2015, Facebook, Inc. | ||
13101 | * All rights reserved. | ||
13102 | * | ||
13103 | * This source code is licensed under the BSD-style license found in the | ||
13104 | * LICENSE file in the root directory of this source tree. An additional grant | ||
13105 | * of patent rights can be found in the PATENTS file in the same directory. | ||
13106 | * | ||
13107 | * @providesModule getIteratorFn | ||
13108 | * @typechecks static-only | ||
13109 | */ | ||
13110 | |||
13111 | 'use strict'; | ||
13112 | |||
13113 | /* global Symbol */ | ||
13114 | var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; | ||
13115 | var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. | ||
13116 | |||
13117 | /** | ||
13118 | * Returns the iterator method function contained on the iterable object. | ||
13119 | * | ||
13120 | * Be sure to invoke the function with the iterable as context: | ||
13121 | * | ||
13122 | * var iteratorFn = getIteratorFn(myIterable); | ||
13123 | * if (iteratorFn) { | ||
13124 | * var iterator = iteratorFn.call(myIterable); | ||
13125 | * ... | ||
13126 | * } | ||
13127 | * | ||
13128 | * @param {?object} maybeIterable | ||
13129 | * @return {?function} | ||
13130 | */ | ||
13131 | function getIteratorFn(maybeIterable) { | ||
13132 | var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); | ||
13133 | if (typeof iteratorFn === 'function') { | ||
13134 | return iteratorFn; | ||
13135 | } | ||
13136 | } | ||
13137 | |||
13138 | module.exports = getIteratorFn; | ||
13139 | |||
13140 | /***/ }, | ||
13141 | /* 111 */ | ||
13142 | /***/ function(module, exports, __webpack_require__) { | ||
13143 | |||
13144 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
13145 | * Copyright 2013-2015, Facebook, Inc. | ||
13146 | * All rights reserved. | ||
13147 | * | ||
13148 | * This source code is licensed under the BSD-style license found in the | ||
13149 | * LICENSE file in the root directory of this source tree. An additional grant | ||
13150 | * of patent rights can be found in the PATENTS file in the same directory. | ||
13151 | * | ||
13152 | * @providesModule ReactDOMOption | ||
13153 | */ | ||
13154 | |||
13155 | 'use strict'; | ||
13156 | |||
13157 | var ReactChildren = __webpack_require__(112); | ||
13158 | var ReactDOMSelect = __webpack_require__(114); | ||
13159 | |||
13160 | var assign = __webpack_require__(41); | ||
13161 | var warning = __webpack_require__(27); | ||
13162 | |||
13163 | var valueContextKey = ReactDOMSelect.valueContextKey; | ||
13164 | |||
13165 | /** | ||
13166 | * Implements an <option> native component that warns when `selected` is set. | ||
13167 | */ | ||
13168 | var ReactDOMOption = { | ||
13169 | mountWrapper: function (inst, props, context) { | ||
13170 | // TODO (yungsters): Remove support for `selected` in <option>. | ||
13171 | if (process.env.NODE_ENV !== 'production') { | ||
13172 | process.env.NODE_ENV !== 'production' ? warning(props.selected == null, 'Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.') : undefined; | ||
13173 | } | ||
13174 | |||
13175 | // Look up whether this option is 'selected' via context | ||
13176 | var selectValue = context[valueContextKey]; | ||
13177 | |||
13178 | // If context key is null (e.g., no specified value or after initial mount) | ||
13179 | // or missing (e.g., for <datalist>), we don't change props.selected | ||
13180 | var selected = null; | ||
13181 | if (selectValue != null) { | ||
13182 | selected = false; | ||
13183 | if (Array.isArray(selectValue)) { | ||
13184 | // multiple | ||
13185 | for (var i = 0; i < selectValue.length; i++) { | ||
13186 | if ('' + selectValue[i] === '' + props.value) { | ||
13187 | selected = true; | ||
13188 | break; | ||
13189 | } | ||
13190 | } | ||
13191 | } else { | ||
13192 | selected = '' + selectValue === '' + props.value; | ||
13193 | } | ||
13194 | } | ||
13195 | |||
13196 | inst._wrapperState = { selected: selected }; | ||
13197 | }, | ||
13198 | |||
13199 | getNativeProps: function (inst, props, context) { | ||
13200 | var nativeProps = assign({ selected: undefined, children: undefined }, props); | ||
13201 | |||
13202 | // Read state only from initial mount because <select> updates value | ||
13203 | // manually; we need the initial state only for server rendering | ||
13204 | if (inst._wrapperState.selected != null) { | ||
13205 | nativeProps.selected = inst._wrapperState.selected; | ||
13206 | } | ||
13207 | |||
13208 | var content = ''; | ||
13209 | |||
13210 | // Flatten children and warn if they aren't strings or numbers; | ||
13211 | // invalid types are ignored. | ||
13212 | ReactChildren.forEach(props.children, function (child) { | ||
13213 | if (child == null) { | ||
13214 | return; | ||
13215 | } | ||
13216 | if (typeof child === 'string' || typeof child === 'number') { | ||
13217 | content += child; | ||
13218 | } else { | ||
13219 | process.env.NODE_ENV !== 'production' ? warning(false, 'Only strings and numbers are supported as <option> children.') : undefined; | ||
13220 | } | ||
13221 | }); | ||
13222 | |||
13223 | nativeProps.children = content; | ||
13224 | return nativeProps; | ||
13225 | } | ||
13226 | |||
13227 | }; | ||
13228 | |||
13229 | module.exports = ReactDOMOption; | ||
13230 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
13231 | |||
13232 | /***/ }, | ||
13233 | /* 112 */ | ||
13234 | /***/ function(module, exports, __webpack_require__) { | ||
13235 | |||
13236 | /** | ||
13237 | * Copyright 2013-2015, Facebook, Inc. | ||
13238 | * All rights reserved. | ||
13239 | * | ||
13240 | * This source code is licensed under the BSD-style license found in the | ||
13241 | * LICENSE file in the root directory of this source tree. An additional grant | ||
13242 | * of patent rights can be found in the PATENTS file in the same directory. | ||
13243 | * | ||
13244 | * @providesModule ReactChildren | ||
13245 | */ | ||
13246 | |||
13247 | 'use strict'; | ||
13248 | |||
13249 | var PooledClass = __webpack_require__(58); | ||
13250 | var ReactElement = __webpack_require__(44); | ||
13251 | |||
13252 | var emptyFunction = __webpack_require__(17); | ||
13253 | var traverseAllChildren = __webpack_require__(113); | ||
13254 | |||
13255 | var twoArgumentPooler = PooledClass.twoArgumentPooler; | ||
13256 | var fourArgumentPooler = PooledClass.fourArgumentPooler; | ||
13257 | |||
13258 | var userProvidedKeyEscapeRegex = /\/(?!\/)/g; | ||
13259 | function escapeUserProvidedKey(text) { | ||
13260 | return ('' + text).replace(userProvidedKeyEscapeRegex, '//'); | ||
13261 | } | ||
13262 | |||
13263 | /** | ||
13264 | * PooledClass representing the bookkeeping associated with performing a child | ||
13265 | * traversal. Allows avoiding binding callbacks. | ||
13266 | * | ||
13267 | * @constructor ForEachBookKeeping | ||
13268 | * @param {!function} forEachFunction Function to perform traversal with. | ||
13269 | * @param {?*} forEachContext Context to perform context with. | ||
13270 | */ | ||
13271 | function ForEachBookKeeping(forEachFunction, forEachContext) { | ||
13272 | this.func = forEachFunction; | ||
13273 | this.context = forEachContext; | ||
13274 | this.count = 0; | ||
13275 | } | ||
13276 | ForEachBookKeeping.prototype.destructor = function () { | ||
13277 | this.func = null; | ||
13278 | this.context = null; | ||
13279 | this.count = 0; | ||
13280 | }; | ||
13281 | PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler); | ||
13282 | |||
13283 | function forEachSingleChild(bookKeeping, child, name) { | ||
13284 | var func = bookKeeping.func; | ||
13285 | var context = bookKeeping.context; | ||
13286 | |||
13287 | func.call(context, child, bookKeeping.count++); | ||
13288 | } | ||
13289 | |||
13290 | /** | ||
13291 | * Iterates through children that are typically specified as `props.children`. | ||
13292 | * | ||
13293 | * The provided forEachFunc(child, index) will be called for each | ||
13294 | * leaf child. | ||
13295 | * | ||
13296 | * @param {?*} children Children tree container. | ||
13297 | * @param {function(*, int)} forEachFunc | ||
13298 | * @param {*} forEachContext Context for forEachContext. | ||
13299 | */ | ||
13300 | function forEachChildren(children, forEachFunc, forEachContext) { | ||
13301 | if (children == null) { | ||
13302 | return children; | ||
13303 | } | ||
13304 | var traverseContext = ForEachBookKeeping.getPooled(forEachFunc, forEachContext); | ||
13305 | traverseAllChildren(children, forEachSingleChild, traverseContext); | ||
13306 | ForEachBookKeeping.release(traverseContext); | ||
13307 | } | ||
13308 | |||
13309 | /** | ||
13310 | * PooledClass representing the bookkeeping associated with performing a child | ||
13311 | * mapping. Allows avoiding binding callbacks. | ||
13312 | * | ||
13313 | * @constructor MapBookKeeping | ||
13314 | * @param {!*} mapResult Object containing the ordered map of results. | ||
13315 | * @param {!function} mapFunction Function to perform mapping with. | ||
13316 | * @param {?*} mapContext Context to perform mapping with. | ||
13317 | */ | ||
13318 | function MapBookKeeping(mapResult, keyPrefix, mapFunction, mapContext) { | ||
13319 | this.result = mapResult; | ||
13320 | this.keyPrefix = keyPrefix; | ||
13321 | this.func = mapFunction; | ||
13322 | this.context = mapContext; | ||
13323 | this.count = 0; | ||
13324 | } | ||
13325 | MapBookKeeping.prototype.destructor = function () { | ||
13326 | this.result = null; | ||
13327 | this.keyPrefix = null; | ||
13328 | this.func = null; | ||
13329 | this.context = null; | ||
13330 | this.count = 0; | ||
13331 | }; | ||
13332 | PooledClass.addPoolingTo(MapBookKeeping, fourArgumentPooler); | ||
13333 | |||
13334 | function mapSingleChildIntoContext(bookKeeping, child, childKey) { | ||
13335 | var result = bookKeeping.result; | ||
13336 | var keyPrefix = bookKeeping.keyPrefix; | ||
13337 | var func = bookKeeping.func; | ||
13338 | var context = bookKeeping.context; | ||
13339 | |||
13340 | var mappedChild = func.call(context, child, bookKeeping.count++); | ||
13341 | if (Array.isArray(mappedChild)) { | ||
13342 | mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument); | ||
13343 | } else if (mappedChild != null) { | ||
13344 | if (ReactElement.isValidElement(mappedChild)) { | ||
13345 | mappedChild = ReactElement.cloneAndReplaceKey(mappedChild, | ||
13346 | // Keep both the (mapped) and old keys if they differ, just as | ||
13347 | // traverseAllChildren used to do for objects as children | ||
13348 | keyPrefix + (mappedChild !== child ? escapeUserProvidedKey(mappedChild.key || '') + '/' : '') + childKey); | ||
13349 | } | ||
13350 | result.push(mappedChild); | ||
13351 | } | ||
13352 | } | ||
13353 | |||
13354 | function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) { | ||
13355 | var escapedPrefix = ''; | ||
13356 | if (prefix != null) { | ||
13357 | escapedPrefix = escapeUserProvidedKey(prefix) + '/'; | ||
13358 | } | ||
13359 | var traverseContext = MapBookKeeping.getPooled(array, escapedPrefix, func, context); | ||
13360 | traverseAllChildren(children, mapSingleChildIntoContext, traverseContext); | ||
13361 | MapBookKeeping.release(traverseContext); | ||
13362 | } | ||
13363 | |||
13364 | /** | ||
13365 | * Maps children that are typically specified as `props.children`. | ||
13366 | * | ||
13367 | * The provided mapFunction(child, key, index) will be called for each | ||
13368 | * leaf child. | ||
13369 | * | ||
13370 | * @param {?*} children Children tree container. | ||
13371 | * @param {function(*, int)} func The map function. | ||
13372 | * @param {*} context Context for mapFunction. | ||
13373 | * @return {object} Object containing the ordered map of results. | ||
13374 | */ | ||
13375 | function mapChildren(children, func, context) { | ||
13376 | if (children == null) { | ||
13377 | return children; | ||
13378 | } | ||
13379 | var result = []; | ||
13380 | mapIntoWithKeyPrefixInternal(children, result, null, func, context); | ||
13381 | return result; | ||
13382 | } | ||
13383 | |||
13384 | function forEachSingleChildDummy(traverseContext, child, name) { | ||
13385 | return null; | ||
13386 | } | ||
13387 | |||
13388 | /** | ||
13389 | * Count the number of children that are typically specified as | ||
13390 | * `props.children`. | ||
13391 | * | ||
13392 | * @param {?*} children Children tree container. | ||
13393 | * @return {number} The number of children. | ||
13394 | */ | ||
13395 | function countChildren(children, context) { | ||
13396 | return traverseAllChildren(children, forEachSingleChildDummy, null); | ||
13397 | } | ||
13398 | |||
13399 | /** | ||
13400 | * Flatten a children object (typically specified as `props.children`) and | ||
13401 | * return an array with appropriately re-keyed children. | ||
13402 | */ | ||
13403 | function toArray(children) { | ||
13404 | var result = []; | ||
13405 | mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument); | ||
13406 | return result; | ||
13407 | } | ||
13408 | |||
13409 | var ReactChildren = { | ||
13410 | forEach: forEachChildren, | ||
13411 | map: mapChildren, | ||
13412 | mapIntoWithKeyPrefixInternal: mapIntoWithKeyPrefixInternal, | ||
13413 | count: countChildren, | ||
13414 | toArray: toArray | ||
13415 | }; | ||
13416 | |||
13417 | module.exports = ReactChildren; | ||
13418 | |||
13419 | /***/ }, | ||
13420 | /* 113 */ | ||
13421 | /***/ function(module, exports, __webpack_require__) { | ||
13422 | |||
13423 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
13424 | * Copyright 2013-2015, Facebook, Inc. | ||
13425 | * All rights reserved. | ||
13426 | * | ||
13427 | * This source code is licensed under the BSD-style license found in the | ||
13428 | * LICENSE file in the root directory of this source tree. An additional grant | ||
13429 | * of patent rights can be found in the PATENTS file in the same directory. | ||
13430 | * | ||
13431 | * @providesModule traverseAllChildren | ||
13432 | */ | ||
13433 | |||
13434 | 'use strict'; | ||
13435 | |||
13436 | var ReactCurrentOwner = __webpack_require__(7); | ||
13437 | var ReactElement = __webpack_require__(44); | ||
13438 | var ReactInstanceHandles = __webpack_require__(47); | ||
13439 | |||
13440 | var getIteratorFn = __webpack_require__(110); | ||
13441 | var invariant = __webpack_require__(15); | ||
13442 | var warning = __webpack_require__(27); | ||
13443 | |||
13444 | var SEPARATOR = ReactInstanceHandles.SEPARATOR; | ||
13445 | var SUBSEPARATOR = ':'; | ||
13446 | |||
13447 | /** | ||
13448 | * TODO: Test that a single child and an array with one item have the same key | ||
13449 | * pattern. | ||
13450 | */ | ||
13451 | |||
13452 | var userProvidedKeyEscaperLookup = { | ||
13453 | '=': '=0', | ||
13454 | '.': '=1', | ||
13455 | ':': '=2' | ||
13456 | }; | ||
13457 | |||
13458 | var userProvidedKeyEscapeRegex = /[=.:]/g; | ||
13459 | |||
13460 | var didWarnAboutMaps = false; | ||
13461 | |||
13462 | function userProvidedKeyEscaper(match) { | ||
13463 | return userProvidedKeyEscaperLookup[match]; | ||
13464 | } | ||
13465 | |||
13466 | /** | ||
13467 | * Generate a key string that identifies a component within a set. | ||
13468 | * | ||
13469 | * @param {*} component A component that could contain a manual key. | ||
13470 | * @param {number} index Index that is used if a manual key is not provided. | ||
13471 | * @return {string} | ||
13472 | */ | ||
13473 | function getComponentKey(component, index) { | ||
13474 | if (component && component.key != null) { | ||
13475 | // Explicit key | ||
13476 | return wrapUserProvidedKey(component.key); | ||
13477 | } | ||
13478 | // Implicit key determined by the index in the set | ||
13479 | return index.toString(36); | ||
13480 | } | ||
13481 | |||
13482 | /** | ||
13483 | * Escape a component key so that it is safe to use in a reactid. | ||
13484 | * | ||
13485 | * @param {*} text Component key to be escaped. | ||
13486 | * @return {string} An escaped string. | ||
13487 | */ | ||
13488 | function escapeUserProvidedKey(text) { | ||
13489 | return ('' + text).replace(userProvidedKeyEscapeRegex, userProvidedKeyEscaper); | ||
13490 | } | ||
13491 | |||
13492 | /** | ||
13493 | * Wrap a `key` value explicitly provided by the user to distinguish it from | ||
13494 | * implicitly-generated keys generated by a component's index in its parent. | ||
13495 | * | ||
13496 | * @param {string} key Value of a user-provided `key` attribute | ||
13497 | * @return {string} | ||
13498 | */ | ||
13499 | function wrapUserProvidedKey(key) { | ||
13500 | return '$' + escapeUserProvidedKey(key); | ||
13501 | } | ||
13502 | |||
13503 | /** | ||
13504 | * @param {?*} children Children tree container. | ||
13505 | * @param {!string} nameSoFar Name of the key path so far. | ||
13506 | * @param {!function} callback Callback to invoke with each child found. | ||
13507 | * @param {?*} traverseContext Used to pass information throughout the traversal | ||
13508 | * process. | ||
13509 | * @return {!number} The number of children in this subtree. | ||
13510 | */ | ||
13511 | function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) { | ||
13512 | var type = typeof children; | ||
13513 | |||
13514 | if (type === 'undefined' || type === 'boolean') { | ||
13515 | // All of the above are perceived as null. | ||
13516 | children = null; | ||
13517 | } | ||
13518 | |||
13519 | if (children === null || type === 'string' || type === 'number' || ReactElement.isValidElement(children)) { | ||
13520 | callback(traverseContext, children, | ||
13521 | // If it's the only child, treat the name as if it was wrapped in an array | ||
13522 | // so that it's consistent if the number of children grows. | ||
13523 | nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar); | ||
13524 | return 1; | ||
13525 | } | ||
13526 | |||
13527 | var child; | ||
13528 | var nextName; | ||
13529 | var subtreeCount = 0; // Count of children found in the current subtree. | ||
13530 | var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR; | ||
13531 | |||
13532 | if (Array.isArray(children)) { | ||
13533 | for (var i = 0; i < children.length; i++) { | ||
13534 | child = children[i]; | ||
13535 | nextName = nextNamePrefix + getComponentKey(child, i); | ||
13536 | subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); | ||
13537 | } | ||
13538 | } else { | ||
13539 | var iteratorFn = getIteratorFn(children); | ||
13540 | if (iteratorFn) { | ||
13541 | var iterator = iteratorFn.call(children); | ||
13542 | var step; | ||
13543 | if (iteratorFn !== children.entries) { | ||
13544 | var ii = 0; | ||
13545 | while (!(step = iterator.next()).done) { | ||
13546 | child = step.value; | ||
13547 | nextName = nextNamePrefix + getComponentKey(child, ii++); | ||
13548 | subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); | ||
13549 | } | ||
13550 | } else { | ||
13551 | if (process.env.NODE_ENV !== 'production') { | ||
13552 | 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; | ||
13553 | didWarnAboutMaps = true; | ||
13554 | } | ||
13555 | // Iterator will provide entry [k,v] tuples rather than values. | ||
13556 | while (!(step = iterator.next()).done) { | ||
13557 | var entry = step.value; | ||
13558 | if (entry) { | ||
13559 | child = entry[1]; | ||
13560 | nextName = nextNamePrefix + wrapUserProvidedKey(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0); | ||
13561 | subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); | ||
13562 | } | ||
13563 | } | ||
13564 | } | ||
13565 | } else if (type === 'object') { | ||
13566 | var addendum = ''; | ||
13567 | if (process.env.NODE_ENV !== 'production') { | ||
13568 | 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.'; | ||
13569 | if (children._isReactElement) { | ||
13570 | 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.'; | ||
13571 | } | ||
13572 | if (ReactCurrentOwner.current) { | ||
13573 | var name = ReactCurrentOwner.current.getName(); | ||
13574 | if (name) { | ||
13575 | addendum += ' Check the render method of `' + name + '`.'; | ||
13576 | } | ||
13577 | } | ||
13578 | } | ||
13579 | var childrenString = String(children); | ||
13580 | 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; | ||
13581 | } | ||
13582 | } | ||
13583 | |||
13584 | return subtreeCount; | ||
13585 | } | ||
13586 | |||
13587 | /** | ||
13588 | * Traverses children that are typically specified as `props.children`, but | ||
13589 | * might also be specified through attributes: | ||
13590 | * | ||
13591 | * - `traverseAllChildren(this.props.children, ...)` | ||
13592 | * - `traverseAllChildren(this.props.leftPanelChildren, ...)` | ||
13593 | * | ||
13594 | * The `traverseContext` is an optional argument that is passed through the | ||
13595 | * entire traversal. It can be used to store accumulations or anything else that | ||
13596 | * the callback might find relevant. | ||
13597 | * | ||
13598 | * @param {?*} children Children tree object. | ||
13599 | * @param {!function} callback To invoke upon traversing each child. | ||
13600 | * @param {?*} traverseContext Context for traversal. | ||
13601 | * @return {!number} The number of children in this subtree. | ||
13602 | */ | ||
13603 | function traverseAllChildren(children, callback, traverseContext) { | ||
13604 | if (children == null) { | ||
13605 | return 0; | ||
13606 | } | ||
13607 | |||
13608 | return traverseAllChildrenImpl(children, '', callback, traverseContext); | ||
13609 | } | ||
13610 | |||
13611 | module.exports = traverseAllChildren; | ||
13612 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
13613 | |||
13614 | /***/ }, | ||
13615 | /* 114 */ | ||
13616 | /***/ function(module, exports, __webpack_require__) { | ||
13617 | |||
13618 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
13619 | * Copyright 2013-2015, Facebook, Inc. | ||
13620 | * All rights reserved. | ||
13621 | * | ||
13622 | * This source code is licensed under the BSD-style license found in the | ||
13623 | * LICENSE file in the root directory of this source tree. An additional grant | ||
13624 | * of patent rights can be found in the PATENTS file in the same directory. | ||
13625 | * | ||
13626 | * @providesModule ReactDOMSelect | ||
13627 | */ | ||
13628 | |||
13629 | 'use strict'; | ||
13630 | |||
13631 | var LinkedValueUtils = __webpack_require__(108); | ||
13632 | var ReactMount = __webpack_require__(30); | ||
13633 | var ReactUpdates = __webpack_require__(56); | ||
13634 | |||
13635 | var assign = __webpack_require__(41); | ||
13636 | var warning = __webpack_require__(27); | ||
13637 | |||
13638 | var valueContextKey = '__ReactDOMSelect_value$' + Math.random().toString(36).slice(2); | ||
13639 | |||
13640 | function updateOptionsIfPendingUpdateAndMounted() { | ||
13641 | if (this._rootNodeID && this._wrapperState.pendingUpdate) { | ||
13642 | this._wrapperState.pendingUpdate = false; | ||
13643 | |||
13644 | var props = this._currentElement.props; | ||
13645 | var value = LinkedValueUtils.getValue(props); | ||
13646 | |||
13647 | if (value != null) { | ||
13648 | updateOptions(this, props, value); | ||
13649 | } | ||
13650 | } | ||
13651 | } | ||
13652 | |||
13653 | function getDeclarationErrorAddendum(owner) { | ||
13654 | if (owner) { | ||
13655 | var name = owner.getName(); | ||
13656 | if (name) { | ||
13657 | return ' Check the render method of `' + name + '`.'; | ||
13658 | } | ||
13659 | } | ||
13660 | return ''; | ||
13661 | } | ||
13662 | |||
13663 | var valuePropNames = ['value', 'defaultValue']; | ||
13664 | |||
13665 | /** | ||
13666 | * Validation function for `value` and `defaultValue`. | ||
13667 | * @private | ||
13668 | */ | ||
13669 | function checkSelectPropTypes(inst, props) { | ||
13670 | var owner = inst._currentElement._owner; | ||
13671 | LinkedValueUtils.checkPropTypes('select', props, owner); | ||
13672 | |||
13673 | for (var i = 0; i < valuePropNames.length; i++) { | ||
13674 | var propName = valuePropNames[i]; | ||
13675 | if (props[propName] == null) { | ||
13676 | continue; | ||
13677 | } | ||
13678 | if (props.multiple) { | ||
13679 | 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; | ||
13680 | } else { | ||
13681 | 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; | ||
13682 | } | ||
13683 | } | ||
13684 | } | ||
13685 | |||
13686 | /** | ||
13687 | * @param {ReactDOMComponent} inst | ||
13688 | * @param {boolean} multiple | ||
13689 | * @param {*} propValue A stringable (with `multiple`, a list of stringables). | ||
13690 | * @private | ||
13691 | */ | ||
13692 | function updateOptions(inst, multiple, propValue) { | ||
13693 | var selectedValue, i; | ||
13694 | var options = ReactMount.getNode(inst._rootNodeID).options; | ||
13695 | |||
13696 | if (multiple) { | ||
13697 | selectedValue = {}; | ||
13698 | for (i = 0; i < propValue.length; i++) { | ||
13699 | selectedValue['' + propValue[i]] = true; | ||
13700 | } | ||
13701 | for (i = 0; i < options.length; i++) { | ||
13702 | var selected = selectedValue.hasOwnProperty(options[i].value); | ||
13703 | if (options[i].selected !== selected) { | ||
13704 | options[i].selected = selected; | ||
13705 | } | ||
13706 | } | ||
13707 | } else { | ||
13708 | // Do not set `select.value` as exact behavior isn't consistent across all | ||
13709 | // browsers for all cases. | ||
13710 | selectedValue = '' + propValue; | ||
13711 | for (i = 0; i < options.length; i++) { | ||
13712 | if (options[i].value === selectedValue) { | ||
13713 | options[i].selected = true; | ||
13714 | return; | ||
13715 | } | ||
13716 | } | ||
13717 | if (options.length) { | ||
13718 | options[0].selected = true; | ||
13719 | } | ||
13720 | } | ||
13721 | } | ||
13722 | |||
13723 | /** | ||
13724 | * Implements a <select> native component that allows optionally setting the | ||
13725 | * props `value` and `defaultValue`. If `multiple` is false, the prop must be a | ||
13726 | * stringable. If `multiple` is true, the prop must be an array of stringables. | ||
13727 | * | ||
13728 | * If `value` is not supplied (or null/undefined), user actions that change the | ||
13729 | * selected option will trigger updates to the rendered options. | ||
13730 | * | ||
13731 | * If it is supplied (and not null/undefined), the rendered options will not | ||
13732 | * update in response to user actions. Instead, the `value` prop must change in | ||
13733 | * order for the rendered options to update. | ||
13734 | * | ||
13735 | * If `defaultValue` is provided, any options with the supplied values will be | ||
13736 | * selected. | ||
13737 | */ | ||
13738 | var ReactDOMSelect = { | ||
13739 | valueContextKey: valueContextKey, | ||
13740 | |||
13741 | getNativeProps: function (inst, props, context) { | ||
13742 | return assign({}, props, { | ||
13743 | onChange: inst._wrapperState.onChange, | ||
13744 | value: undefined | ||
13745 | }); | ||
13746 | }, | ||
13747 | |||
13748 | mountWrapper: function (inst, props) { | ||
13749 | if (process.env.NODE_ENV !== 'production') { | ||
13750 | checkSelectPropTypes(inst, props); | ||
13751 | } | ||
13752 | |||
13753 | var value = LinkedValueUtils.getValue(props); | ||
13754 | inst._wrapperState = { | ||
13755 | pendingUpdate: false, | ||
13756 | initialValue: value != null ? value : props.defaultValue, | ||
13757 | onChange: _handleChange.bind(inst), | ||
13758 | wasMultiple: Boolean(props.multiple) | ||
13759 | }; | ||
13760 | }, | ||
13761 | |||
13762 | processChildContext: function (inst, props, context) { | ||
13763 | // Pass down initial value so initial generated markup has correct | ||
13764 | // `selected` attributes | ||
13765 | var childContext = assign({}, context); | ||
13766 | childContext[valueContextKey] = inst._wrapperState.initialValue; | ||
13767 | return childContext; | ||
13768 | }, | ||
13769 | |||
13770 | postUpdateWrapper: function (inst) { | ||
13771 | var props = inst._currentElement.props; | ||
13772 | |||
13773 | // After the initial mount, we control selected-ness manually so don't pass | ||
13774 | // the context value down | ||
13775 | inst._wrapperState.initialValue = undefined; | ||
13776 | |||
13777 | var wasMultiple = inst._wrapperState.wasMultiple; | ||
13778 | inst._wrapperState.wasMultiple = Boolean(props.multiple); | ||
13779 | |||
13780 | var value = LinkedValueUtils.getValue(props); | ||
13781 | if (value != null) { | ||
13782 | inst._wrapperState.pendingUpdate = false; | ||
13783 | updateOptions(inst, Boolean(props.multiple), value); | ||
13784 | } else if (wasMultiple !== Boolean(props.multiple)) { | ||
13785 | // For simplicity, reapply `defaultValue` if `multiple` is toggled. | ||
13786 | if (props.defaultValue != null) { | ||
13787 | updateOptions(inst, Boolean(props.multiple), props.defaultValue); | ||
13788 | } else { | ||
13789 | // Revert the select back to its default unselected state. | ||
13790 | updateOptions(inst, Boolean(props.multiple), props.multiple ? [] : ''); | ||
13791 | } | ||
13792 | } | ||
13793 | } | ||
13794 | }; | ||
13795 | |||
13796 | function _handleChange(event) { | ||
13797 | var props = this._currentElement.props; | ||
13798 | var returnValue = LinkedValueUtils.executeOnChange(props, event); | ||
13799 | |||
13800 | this._wrapperState.pendingUpdate = true; | ||
13801 | ReactUpdates.asap(updateOptionsIfPendingUpdateAndMounted, this); | ||
13802 | return returnValue; | ||
13803 | } | ||
13804 | |||
13805 | module.exports = ReactDOMSelect; | ||
13806 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
13807 | |||
13808 | /***/ }, | ||
13809 | /* 115 */ | ||
13810 | /***/ function(module, exports, __webpack_require__) { | ||
13811 | |||
13812 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
13813 | * Copyright 2013-2015, Facebook, Inc. | ||
13814 | * All rights reserved. | ||
13815 | * | ||
13816 | * This source code is licensed under the BSD-style license found in the | ||
13817 | * LICENSE file in the root directory of this source tree. An additional grant | ||
13818 | * of patent rights can be found in the PATENTS file in the same directory. | ||
13819 | * | ||
13820 | * @providesModule ReactDOMTextarea | ||
13821 | */ | ||
13822 | |||
13823 | 'use strict'; | ||
13824 | |||
13825 | var LinkedValueUtils = __webpack_require__(108); | ||
13826 | var ReactDOMIDOperations = __webpack_require__(29); | ||
13827 | var ReactUpdates = __webpack_require__(56); | ||
13828 | |||
13829 | var assign = __webpack_require__(41); | ||
13830 | var invariant = __webpack_require__(15); | ||
13831 | var warning = __webpack_require__(27); | ||
13832 | |||
13833 | function forceUpdateIfMounted() { | ||
13834 | if (this._rootNodeID) { | ||
13835 | // DOM component is still mounted; update | ||
13836 | ReactDOMTextarea.updateWrapper(this); | ||
13837 | } | ||
13838 | } | ||
13839 | |||
13840 | /** | ||
13841 | * Implements a <textarea> native component that allows setting `value`, and | ||
13842 | * `defaultValue`. This differs from the traditional DOM API because value is | ||
13843 | * usually set as PCDATA children. | ||
13844 | * | ||
13845 | * If `value` is not supplied (or null/undefined), user actions that affect the | ||
13846 | * value will trigger updates to the element. | ||
13847 | * | ||
13848 | * If `value` is supplied (and not null/undefined), the rendered element will | ||
13849 | * not trigger updates to the element. Instead, the `value` prop must change in | ||
13850 | * order for the rendered element to be updated. | ||
13851 | * | ||
13852 | * The rendered element will be initialized with an empty value, the prop | ||
13853 | * `defaultValue` if specified, or the children content (deprecated). | ||
13854 | */ | ||
13855 | var ReactDOMTextarea = { | ||
13856 | getNativeProps: function (inst, props, context) { | ||
13857 | !(props.dangerouslySetInnerHTML == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, '`dangerouslySetInnerHTML` does not make sense on <textarea>.') : invariant(false) : undefined; | ||
13858 | |||
13859 | // Always set children to the same thing. In IE9, the selection range will | ||
13860 | // get reset if `textContent` is mutated. | ||
13861 | var nativeProps = assign({}, props, { | ||
13862 | defaultValue: undefined, | ||
13863 | value: undefined, | ||
13864 | children: inst._wrapperState.initialValue, | ||
13865 | onChange: inst._wrapperState.onChange | ||
13866 | }); | ||
13867 | |||
13868 | return nativeProps; | ||
13869 | }, | ||
13870 | |||
13871 | mountWrapper: function (inst, props) { | ||
13872 | if (process.env.NODE_ENV !== 'production') { | ||
13873 | LinkedValueUtils.checkPropTypes('textarea', props, inst._currentElement._owner); | ||
13874 | } | ||
13875 | |||
13876 | var defaultValue = props.defaultValue; | ||
13877 | // TODO (yungsters): Remove support for children content in <textarea>. | ||
13878 | var children = props.children; | ||
13879 | if (children != null) { | ||
13880 | if (process.env.NODE_ENV !== 'production') { | ||
13881 | process.env.NODE_ENV !== 'production' ? warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.') : undefined; | ||
13882 | } | ||
13883 | !(defaultValue == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : invariant(false) : undefined; | ||
13884 | if (Array.isArray(children)) { | ||
13885 | !(children.length <= 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, '<textarea> can only have at most one child.') : invariant(false) : undefined; | ||
13886 | children = children[0]; | ||
13887 | } | ||
13888 | |||
13889 | defaultValue = '' + children; | ||
13890 | } | ||
13891 | if (defaultValue == null) { | ||
13892 | defaultValue = ''; | ||
13893 | } | ||
13894 | var value = LinkedValueUtils.getValue(props); | ||
13895 | |||
13896 | inst._wrapperState = { | ||
13897 | // We save the initial value so that `ReactDOMComponent` doesn't update | ||
13898 | // `textContent` (unnecessary since we update value). | ||
13899 | // The initial value can be a boolean or object so that's why it's | ||
13900 | // forced to be a string. | ||
13901 | initialValue: '' + (value != null ? value : defaultValue), | ||
13902 | onChange: _handleChange.bind(inst) | ||
13903 | }; | ||
13904 | }, | ||
13905 | |||
13906 | updateWrapper: function (inst) { | ||
13907 | var props = inst._currentElement.props; | ||
13908 | var value = LinkedValueUtils.getValue(props); | ||
13909 | if (value != null) { | ||
13910 | // Cast `value` to a string to ensure the value is set correctly. While | ||
13911 | // browsers typically do this as necessary, jsdom doesn't. | ||
13912 | ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'value', '' + value); | ||
13913 | } | ||
13914 | } | ||
13915 | }; | ||
13916 | |||
13917 | function _handleChange(event) { | ||
13918 | var props = this._currentElement.props; | ||
13919 | var returnValue = LinkedValueUtils.executeOnChange(props, event); | ||
13920 | ReactUpdates.asap(forceUpdateIfMounted, this); | ||
13921 | return returnValue; | ||
13922 | } | ||
13923 | |||
13924 | module.exports = ReactDOMTextarea; | ||
13925 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
13926 | |||
13927 | /***/ }, | ||
13928 | /* 116 */ | ||
13929 | /***/ function(module, exports, __webpack_require__) { | ||
13930 | |||
13931 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
13932 | * Copyright 2013-2015, Facebook, Inc. | ||
13933 | * All rights reserved. | ||
13934 | * | ||
13935 | * This source code is licensed under the BSD-style license found in the | ||
13936 | * LICENSE file in the root directory of this source tree. An additional grant | ||
13937 | * of patent rights can be found in the PATENTS file in the same directory. | ||
13938 | * | ||
13939 | * @providesModule ReactMultiChild | ||
13940 | * @typechecks static-only | ||
13941 | */ | ||
13942 | |||
13943 | 'use strict'; | ||
13944 | |||
13945 | var ReactComponentEnvironment = __webpack_require__(66); | ||
13946 | var ReactMultiChildUpdateTypes = __webpack_require__(18); | ||
13947 | |||
13948 | var ReactCurrentOwner = __webpack_require__(7); | ||
13949 | var ReactReconciler = __webpack_require__(52); | ||
13950 | var ReactChildReconciler = __webpack_require__(117); | ||
13951 | |||
13952 | var flattenChildren = __webpack_require__(118); | ||
13953 | |||
13954 | /** | ||
13955 | * Updating children of a component may trigger recursive updates. The depth is | ||
13956 | * used to batch recursive updates to render markup more efficiently. | ||
13957 | * | ||
13958 | * @type {number} | ||
13959 | * @private | ||
13960 | */ | ||
13961 | var updateDepth = 0; | ||
13962 | |||
13963 | /** | ||
13964 | * Queue of update configuration objects. | ||
13965 | * | ||
13966 | * Each object has a `type` property that is in `ReactMultiChildUpdateTypes`. | ||
13967 | * | ||
13968 | * @type {array<object>} | ||
13969 | * @private | ||
13970 | */ | ||
13971 | var updateQueue = []; | ||
13972 | |||
13973 | /** | ||
13974 | * Queue of markup to be rendered. | ||
13975 | * | ||
13976 | * @type {array<string>} | ||
13977 | * @private | ||
13978 | */ | ||
13979 | var markupQueue = []; | ||
13980 | |||
13981 | /** | ||
13982 | * Enqueues markup to be rendered and inserted at a supplied index. | ||
13983 | * | ||
13984 | * @param {string} parentID ID of the parent component. | ||
13985 | * @param {string} markup Markup that renders into an element. | ||
13986 | * @param {number} toIndex Destination index. | ||
13987 | * @private | ||
13988 | */ | ||
13989 | function enqueueInsertMarkup(parentID, markup, toIndex) { | ||
13990 | // NOTE: Null values reduce hidden classes. | ||
13991 | updateQueue.push({ | ||
13992 | parentID: parentID, | ||
13993 | parentNode: null, | ||
13994 | type: ReactMultiChildUpdateTypes.INSERT_MARKUP, | ||
13995 | markupIndex: markupQueue.push(markup) - 1, | ||
13996 | content: null, | ||
13997 | fromIndex: null, | ||
13998 | toIndex: toIndex | ||
13999 | }); | ||
14000 | } | ||
14001 | |||
14002 | /** | ||
14003 | * Enqueues moving an existing element to another index. | ||
14004 | * | ||
14005 | * @param {string} parentID ID of the parent component. | ||
14006 | * @param {number} fromIndex Source index of the existing element. | ||
14007 | * @param {number} toIndex Destination index of the element. | ||
14008 | * @private | ||
14009 | */ | ||
14010 | function enqueueMove(parentID, fromIndex, toIndex) { | ||
14011 | // NOTE: Null values reduce hidden classes. | ||
14012 | updateQueue.push({ | ||
14013 | parentID: parentID, | ||
14014 | parentNode: null, | ||
14015 | type: ReactMultiChildUpdateTypes.MOVE_EXISTING, | ||
14016 | markupIndex: null, | ||
14017 | content: null, | ||
14018 | fromIndex: fromIndex, | ||
14019 | toIndex: toIndex | ||
14020 | }); | ||
14021 | } | ||
14022 | |||
14023 | /** | ||
14024 | * Enqueues removing an element at an index. | ||
14025 | * | ||
14026 | * @param {string} parentID ID of the parent component. | ||
14027 | * @param {number} fromIndex Index of the element to remove. | ||
14028 | * @private | ||
14029 | */ | ||
14030 | function enqueueRemove(parentID, fromIndex) { | ||
14031 | // NOTE: Null values reduce hidden classes. | ||
14032 | updateQueue.push({ | ||
14033 | parentID: parentID, | ||
14034 | parentNode: null, | ||
14035 | type: ReactMultiChildUpdateTypes.REMOVE_NODE, | ||
14036 | markupIndex: null, | ||
14037 | content: null, | ||
14038 | fromIndex: fromIndex, | ||
14039 | toIndex: null | ||
14040 | }); | ||
14041 | } | ||
14042 | |||
14043 | /** | ||
14044 | * Enqueues setting the markup of a node. | ||
14045 | * | ||
14046 | * @param {string} parentID ID of the parent component. | ||
14047 | * @param {string} markup Markup that renders into an element. | ||
14048 | * @private | ||
14049 | */ | ||
14050 | function enqueueSetMarkup(parentID, markup) { | ||
14051 | // NOTE: Null values reduce hidden classes. | ||
14052 | updateQueue.push({ | ||
14053 | parentID: parentID, | ||
14054 | parentNode: null, | ||
14055 | type: ReactMultiChildUpdateTypes.SET_MARKUP, | ||
14056 | markupIndex: null, | ||
14057 | content: markup, | ||
14058 | fromIndex: null, | ||
14059 | toIndex: null | ||
14060 | }); | ||
14061 | } | ||
14062 | |||
14063 | /** | ||
14064 | * Enqueues setting the text content. | ||
14065 | * | ||
14066 | * @param {string} parentID ID of the parent component. | ||
14067 | * @param {string} textContent Text content to set. | ||
14068 | * @private | ||
14069 | */ | ||
14070 | function enqueueTextContent(parentID, textContent) { | ||
14071 | // NOTE: Null values reduce hidden classes. | ||
14072 | updateQueue.push({ | ||
14073 | parentID: parentID, | ||
14074 | parentNode: null, | ||
14075 | type: ReactMultiChildUpdateTypes.TEXT_CONTENT, | ||
14076 | markupIndex: null, | ||
14077 | content: textContent, | ||
14078 | fromIndex: null, | ||
14079 | toIndex: null | ||
14080 | }); | ||
14081 | } | ||
14082 | |||
14083 | /** | ||
14084 | * Processes any enqueued updates. | ||
14085 | * | ||
14086 | * @private | ||
14087 | */ | ||
14088 | function processQueue() { | ||
14089 | if (updateQueue.length) { | ||
14090 | ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue); | ||
14091 | clearQueue(); | ||
14092 | } | ||
14093 | } | ||
14094 | |||
14095 | /** | ||
14096 | * Clears any enqueued updates. | ||
14097 | * | ||
14098 | * @private | ||
14099 | */ | ||
14100 | function clearQueue() { | ||
14101 | updateQueue.length = 0; | ||
14102 | markupQueue.length = 0; | ||
14103 | } | ||
14104 | |||
14105 | /** | ||
14106 | * ReactMultiChild are capable of reconciling multiple children. | ||
14107 | * | ||
14108 | * @class ReactMultiChild | ||
14109 | * @internal | ||
14110 | */ | ||
14111 | var ReactMultiChild = { | ||
14112 | |||
14113 | /** | ||
14114 | * Provides common functionality for components that must reconcile multiple | ||
14115 | * children. This is used by `ReactDOMComponent` to mount, update, and | ||
14116 | * unmount child components. | ||
14117 | * | ||
14118 | * @lends {ReactMultiChild.prototype} | ||
14119 | */ | ||
14120 | Mixin: { | ||
14121 | |||
14122 | _reconcilerInstantiateChildren: function (nestedChildren, transaction, context) { | ||
14123 | if (process.env.NODE_ENV !== 'production') { | ||
14124 | if (this._currentElement) { | ||
14125 | try { | ||
14126 | ReactCurrentOwner.current = this._currentElement._owner; | ||
14127 | return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context); | ||
14128 | } finally { | ||
14129 | ReactCurrentOwner.current = null; | ||
14130 | } | ||
14131 | } | ||
14132 | } | ||
14133 | return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context); | ||
14134 | }, | ||
14135 | |||
14136 | _reconcilerUpdateChildren: function (prevChildren, nextNestedChildrenElements, transaction, context) { | ||
14137 | var nextChildren; | ||
14138 | if (process.env.NODE_ENV !== 'production') { | ||
14139 | if (this._currentElement) { | ||
14140 | try { | ||
14141 | ReactCurrentOwner.current = this._currentElement._owner; | ||
14142 | nextChildren = flattenChildren(nextNestedChildrenElements); | ||
14143 | } finally { | ||
14144 | ReactCurrentOwner.current = null; | ||
14145 | } | ||
14146 | return ReactChildReconciler.updateChildren(prevChildren, nextChildren, transaction, context); | ||
14147 | } | ||
14148 | } | ||
14149 | nextChildren = flattenChildren(nextNestedChildrenElements); | ||
14150 | return ReactChildReconciler.updateChildren(prevChildren, nextChildren, transaction, context); | ||
14151 | }, | ||
14152 | |||
14153 | /** | ||
14154 | * Generates a "mount image" for each of the supplied children. In the case | ||
14155 | * of `ReactDOMComponent`, a mount image is a string of markup. | ||
14156 | * | ||
14157 | * @param {?object} nestedChildren Nested child maps. | ||
14158 | * @return {array} An array of mounted representations. | ||
14159 | * @internal | ||
14160 | */ | ||
14161 | mountChildren: function (nestedChildren, transaction, context) { | ||
14162 | var children = this._reconcilerInstantiateChildren(nestedChildren, transaction, context); | ||
14163 | this._renderedChildren = children; | ||
14164 | var mountImages = []; | ||
14165 | var index = 0; | ||
14166 | for (var name in children) { | ||
14167 | if (children.hasOwnProperty(name)) { | ||
14168 | var child = children[name]; | ||
14169 | // Inlined for performance, see `ReactInstanceHandles.createReactID`. | ||
14170 | var rootID = this._rootNodeID + name; | ||
14171 | var mountImage = ReactReconciler.mountComponent(child, rootID, transaction, context); | ||
14172 | child._mountIndex = index++; | ||
14173 | mountImages.push(mountImage); | ||
14174 | } | ||
14175 | } | ||
14176 | return mountImages; | ||
14177 | }, | ||
14178 | |||
14179 | /** | ||
14180 | * Replaces any rendered children with a text content string. | ||
14181 | * | ||
14182 | * @param {string} nextContent String of content. | ||
14183 | * @internal | ||
14184 | */ | ||
14185 | updateTextContent: function (nextContent) { | ||
14186 | updateDepth++; | ||
14187 | var errorThrown = true; | ||
14188 | try { | ||
14189 | var prevChildren = this._renderedChildren; | ||
14190 | // Remove any rendered children. | ||
14191 | ReactChildReconciler.unmountChildren(prevChildren); | ||
14192 | // TODO: The setTextContent operation should be enough | ||
14193 | for (var name in prevChildren) { | ||
14194 | if (prevChildren.hasOwnProperty(name)) { | ||
14195 | this._unmountChild(prevChildren[name]); | ||
14196 | } | ||
14197 | } | ||
14198 | // Set new text content. | ||
14199 | this.setTextContent(nextContent); | ||
14200 | errorThrown = false; | ||
14201 | } finally { | ||
14202 | updateDepth--; | ||
14203 | if (!updateDepth) { | ||
14204 | if (errorThrown) { | ||
14205 | clearQueue(); | ||
14206 | } else { | ||
14207 | processQueue(); | ||
14208 | } | ||
14209 | } | ||
14210 | } | ||
14211 | }, | ||
14212 | |||
14213 | /** | ||
14214 | * Replaces any rendered children with a markup string. | ||
14215 | * | ||
14216 | * @param {string} nextMarkup String of markup. | ||
14217 | * @internal | ||
14218 | */ | ||
14219 | updateMarkup: function (nextMarkup) { | ||
14220 | updateDepth++; | ||
14221 | var errorThrown = true; | ||
14222 | try { | ||
14223 | var prevChildren = this._renderedChildren; | ||
14224 | // Remove any rendered children. | ||
14225 | ReactChildReconciler.unmountChildren(prevChildren); | ||
14226 | for (var name in prevChildren) { | ||
14227 | if (prevChildren.hasOwnProperty(name)) { | ||
14228 | this._unmountChildByName(prevChildren[name], name); | ||
14229 | } | ||
14230 | } | ||
14231 | this.setMarkup(nextMarkup); | ||
14232 | errorThrown = false; | ||
14233 | } finally { | ||
14234 | updateDepth--; | ||
14235 | if (!updateDepth) { | ||
14236 | if (errorThrown) { | ||
14237 | clearQueue(); | ||
14238 | } else { | ||
14239 | processQueue(); | ||
14240 | } | ||
14241 | } | ||
14242 | } | ||
14243 | }, | ||
14244 | |||
14245 | /** | ||
14246 | * Updates the rendered children with new children. | ||
14247 | * | ||
14248 | * @param {?object} nextNestedChildrenElements Nested child element maps. | ||
14249 | * @param {ReactReconcileTransaction} transaction | ||
14250 | * @internal | ||
14251 | */ | ||
14252 | updateChildren: function (nextNestedChildrenElements, transaction, context) { | ||
14253 | updateDepth++; | ||
14254 | var errorThrown = true; | ||
14255 | try { | ||
14256 | this._updateChildren(nextNestedChildrenElements, transaction, context); | ||
14257 | errorThrown = false; | ||
14258 | } finally { | ||
14259 | updateDepth--; | ||
14260 | if (!updateDepth) { | ||
14261 | if (errorThrown) { | ||
14262 | clearQueue(); | ||
14263 | } else { | ||
14264 | processQueue(); | ||
14265 | } | ||
14266 | } | ||
14267 | } | ||
14268 | }, | ||
14269 | |||
14270 | /** | ||
14271 | * Improve performance by isolating this hot code path from the try/catch | ||
14272 | * block in `updateChildren`. | ||
14273 | * | ||
14274 | * @param {?object} nextNestedChildrenElements Nested child element maps. | ||
14275 | * @param {ReactReconcileTransaction} transaction | ||
14276 | * @final | ||
14277 | * @protected | ||
14278 | */ | ||
14279 | _updateChildren: function (nextNestedChildrenElements, transaction, context) { | ||
14280 | var prevChildren = this._renderedChildren; | ||
14281 | var nextChildren = this._reconcilerUpdateChildren(prevChildren, nextNestedChildrenElements, transaction, context); | ||
14282 | this._renderedChildren = nextChildren; | ||
14283 | if (!nextChildren && !prevChildren) { | ||
14284 | return; | ||
14285 | } | ||
14286 | var name; | ||
14287 | // `nextIndex` will increment for each child in `nextChildren`, but | ||
14288 | // `lastIndex` will be the last index visited in `prevChildren`. | ||
14289 | var lastIndex = 0; | ||
14290 | var nextIndex = 0; | ||
14291 | for (name in nextChildren) { | ||
14292 | if (!nextChildren.hasOwnProperty(name)) { | ||
14293 | continue; | ||
14294 | } | ||
14295 | var prevChild = prevChildren && prevChildren[name]; | ||
14296 | var nextChild = nextChildren[name]; | ||
14297 | if (prevChild === nextChild) { | ||
14298 | this.moveChild(prevChild, nextIndex, lastIndex); | ||
14299 | lastIndex = Math.max(prevChild._mountIndex, lastIndex); | ||
14300 | prevChild._mountIndex = nextIndex; | ||
14301 | } else { | ||
14302 | if (prevChild) { | ||
14303 | // Update `lastIndex` before `_mountIndex` gets unset by unmounting. | ||
14304 | lastIndex = Math.max(prevChild._mountIndex, lastIndex); | ||
14305 | this._unmountChild(prevChild); | ||
14306 | } | ||
14307 | // The child must be instantiated before it's mounted. | ||
14308 | this._mountChildByNameAtIndex(nextChild, name, nextIndex, transaction, context); | ||
14309 | } | ||
14310 | nextIndex++; | ||
14311 | } | ||
14312 | // Remove children that are no longer present. | ||
14313 | for (name in prevChildren) { | ||
14314 | if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) { | ||
14315 | this._unmountChild(prevChildren[name]); | ||
14316 | } | ||
14317 | } | ||
14318 | }, | ||
14319 | |||
14320 | /** | ||
14321 | * Unmounts all rendered children. This should be used to clean up children | ||
14322 | * when this component is unmounted. | ||
14323 | * | ||
14324 | * @internal | ||
14325 | */ | ||
14326 | unmountChildren: function () { | ||
14327 | var renderedChildren = this._renderedChildren; | ||
14328 | ReactChildReconciler.unmountChildren(renderedChildren); | ||
14329 | this._renderedChildren = null; | ||
14330 | }, | ||
14331 | |||
14332 | /** | ||
14333 | * Moves a child component to the supplied index. | ||
14334 | * | ||
14335 | * @param {ReactComponent} child Component to move. | ||
14336 | * @param {number} toIndex Destination index of the element. | ||
14337 | * @param {number} lastIndex Last index visited of the siblings of `child`. | ||
14338 | * @protected | ||
14339 | */ | ||
14340 | moveChild: function (child, toIndex, lastIndex) { | ||
14341 | // If the index of `child` is less than `lastIndex`, then it needs to | ||
14342 | // be moved. Otherwise, we do not need to move it because a child will be | ||
14343 | // inserted or moved before `child`. | ||
14344 | if (child._mountIndex < lastIndex) { | ||
14345 | enqueueMove(this._rootNodeID, child._mountIndex, toIndex); | ||
14346 | } | ||
14347 | }, | ||
14348 | |||
14349 | /** | ||
14350 | * Creates a child component. | ||
14351 | * | ||
14352 | * @param {ReactComponent} child Component to create. | ||
14353 | * @param {string} mountImage Markup to insert. | ||
14354 | * @protected | ||
14355 | */ | ||
14356 | createChild: function (child, mountImage) { | ||
14357 | enqueueInsertMarkup(this._rootNodeID, mountImage, child._mountIndex); | ||
14358 | }, | ||
14359 | |||
14360 | /** | ||
14361 | * Removes a child component. | ||
14362 | * | ||
14363 | * @param {ReactComponent} child Child to remove. | ||
14364 | * @protected | ||
14365 | */ | ||
14366 | removeChild: function (child) { | ||
14367 | enqueueRemove(this._rootNodeID, child._mountIndex); | ||
14368 | }, | ||
14369 | |||
14370 | /** | ||
14371 | * Sets this text content string. | ||
14372 | * | ||
14373 | * @param {string} textContent Text content to set. | ||
14374 | * @protected | ||
14375 | */ | ||
14376 | setTextContent: function (textContent) { | ||
14377 | enqueueTextContent(this._rootNodeID, textContent); | ||
14378 | }, | ||
14379 | |||
14380 | /** | ||
14381 | * Sets this markup string. | ||
14382 | * | ||
14383 | * @param {string} markup Markup to set. | ||
14384 | * @protected | ||
14385 | */ | ||
14386 | setMarkup: function (markup) { | ||
14387 | enqueueSetMarkup(this._rootNodeID, markup); | ||
14388 | }, | ||
14389 | |||
14390 | /** | ||
14391 | * Mounts a child with the supplied name. | ||
14392 | * | ||
14393 | * NOTE: This is part of `updateChildren` and is here for readability. | ||
14394 | * | ||
14395 | * @param {ReactComponent} child Component to mount. | ||
14396 | * @param {string} name Name of the child. | ||
14397 | * @param {number} index Index at which to insert the child. | ||
14398 | * @param {ReactReconcileTransaction} transaction | ||
14399 | * @private | ||
14400 | */ | ||
14401 | _mountChildByNameAtIndex: function (child, name, index, transaction, context) { | ||
14402 | // Inlined for performance, see `ReactInstanceHandles.createReactID`. | ||
14403 | var rootID = this._rootNodeID + name; | ||
14404 | var mountImage = ReactReconciler.mountComponent(child, rootID, transaction, context); | ||
14405 | child._mountIndex = index; | ||
14406 | this.createChild(child, mountImage); | ||
14407 | }, | ||
14408 | |||
14409 | /** | ||
14410 | * Unmounts a rendered child. | ||
14411 | * | ||
14412 | * NOTE: This is part of `updateChildren` and is here for readability. | ||
14413 | * | ||
14414 | * @param {ReactComponent} child Component to unmount. | ||
14415 | * @private | ||
14416 | */ | ||
14417 | _unmountChild: function (child) { | ||
14418 | this.removeChild(child); | ||
14419 | child._mountIndex = null; | ||
14420 | } | ||
14421 | |||
14422 | } | ||
14423 | |||
14424 | }; | ||
14425 | |||
14426 | module.exports = ReactMultiChild; | ||
14427 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
14428 | |||
14429 | /***/ }, | ||
14430 | /* 117 */ | ||
14431 | /***/ function(module, exports, __webpack_require__) { | ||
14432 | |||
14433 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
14434 | * Copyright 2014-2015, Facebook, Inc. | ||
14435 | * All rights reserved. | ||
14436 | * | ||
14437 | * This source code is licensed under the BSD-style license found in the | ||
14438 | * LICENSE file in the root directory of this source tree. An additional grant | ||
14439 | * of patent rights can be found in the PATENTS file in the same directory. | ||
14440 | * | ||
14441 | * @providesModule ReactChildReconciler | ||
14442 | * @typechecks static-only | ||
14443 | */ | ||
14444 | |||
14445 | 'use strict'; | ||
14446 | |||
14447 | var ReactReconciler = __webpack_require__(52); | ||
14448 | |||
14449 | var instantiateReactComponent = __webpack_require__(64); | ||
14450 | var shouldUpdateReactComponent = __webpack_require__(69); | ||
14451 | var traverseAllChildren = __webpack_require__(113); | ||
14452 | var warning = __webpack_require__(27); | ||
14453 | |||
14454 | function instantiateChild(childInstances, child, name) { | ||
14455 | // We found a component instance. | ||
14456 | var keyUnique = childInstances[name] === undefined; | ||
14457 | if (process.env.NODE_ENV !== 'production') { | ||
14458 | 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; | ||
14459 | } | ||
14460 | if (child != null && keyUnique) { | ||
14461 | childInstances[name] = instantiateReactComponent(child, null); | ||
14462 | } | ||
14463 | } | ||
14464 | |||
14465 | /** | ||
14466 | * ReactChildReconciler provides helpers for initializing or updating a set of | ||
14467 | * children. Its output is suitable for passing it onto ReactMultiChild which | ||
14468 | * does diffed reordering and insertion. | ||
14469 | */ | ||
14470 | var ReactChildReconciler = { | ||
14471 | /** | ||
14472 | * Generates a "mount image" for each of the supplied children. In the case | ||
14473 | * of `ReactDOMComponent`, a mount image is a string of markup. | ||
14474 | * | ||
14475 | * @param {?object} nestedChildNodes Nested child maps. | ||
14476 | * @return {?object} A set of child instances. | ||
14477 | * @internal | ||
14478 | */ | ||
14479 | instantiateChildren: function (nestedChildNodes, transaction, context) { | ||
14480 | if (nestedChildNodes == null) { | ||
14481 | return null; | ||
14482 | } | ||
14483 | var childInstances = {}; | ||
14484 | traverseAllChildren(nestedChildNodes, instantiateChild, childInstances); | ||
14485 | return childInstances; | ||
14486 | }, | ||
14487 | |||
14488 | /** | ||
14489 | * Updates the rendered children and returns a new set of children. | ||
14490 | * | ||
14491 | * @param {?object} prevChildren Previously initialized set of children. | ||
14492 | * @param {?object} nextChildren Flat child element maps. | ||
14493 | * @param {ReactReconcileTransaction} transaction | ||
14494 | * @param {object} context | ||
14495 | * @return {?object} A new set of child instances. | ||
14496 | * @internal | ||
14497 | */ | ||
14498 | updateChildren: function (prevChildren, nextChildren, transaction, context) { | ||
14499 | // We currently don't have a way to track moves here but if we use iterators | ||
14500 | // instead of for..in we can zip the iterators and check if an item has | ||
14501 | // moved. | ||
14502 | // TODO: If nothing has changed, return the prevChildren object so that we | ||
14503 | // can quickly bailout if nothing has changed. | ||
14504 | if (!nextChildren && !prevChildren) { | ||
14505 | return null; | ||
14506 | } | ||
14507 | var name; | ||
14508 | for (name in nextChildren) { | ||
14509 | if (!nextChildren.hasOwnProperty(name)) { | ||
14510 | continue; | ||
14511 | } | ||
14512 | var prevChild = prevChildren && prevChildren[name]; | ||
14513 | var prevElement = prevChild && prevChild._currentElement; | ||
14514 | var nextElement = nextChildren[name]; | ||
14515 | if (prevChild != null && shouldUpdateReactComponent(prevElement, nextElement)) { | ||
14516 | ReactReconciler.receiveComponent(prevChild, nextElement, transaction, context); | ||
14517 | nextChildren[name] = prevChild; | ||
14518 | } else { | ||
14519 | if (prevChild) { | ||
14520 | ReactReconciler.unmountComponent(prevChild, name); | ||
14521 | } | ||
14522 | // The child must be instantiated before it's mounted. | ||
14523 | var nextChildInstance = instantiateReactComponent(nextElement, null); | ||
14524 | nextChildren[name] = nextChildInstance; | ||
14525 | } | ||
14526 | } | ||
14527 | // Unmount children that are no longer present. | ||
14528 | for (name in prevChildren) { | ||
14529 | if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) { | ||
14530 | ReactReconciler.unmountComponent(prevChildren[name]); | ||
14531 | } | ||
14532 | } | ||
14533 | return nextChildren; | ||
14534 | }, | ||
14535 | |||
14536 | /** | ||
14537 | * Unmounts all rendered children. This should be used to clean up children | ||
14538 | * when this component is unmounted. | ||
14539 | * | ||
14540 | * @param {?object} renderedChildren Previously initialized set of children. | ||
14541 | * @internal | ||
14542 | */ | ||
14543 | unmountChildren: function (renderedChildren) { | ||
14544 | for (var name in renderedChildren) { | ||
14545 | if (renderedChildren.hasOwnProperty(name)) { | ||
14546 | var renderedChild = renderedChildren[name]; | ||
14547 | ReactReconciler.unmountComponent(renderedChild); | ||
14548 | } | ||
14549 | } | ||
14550 | } | ||
14551 | |||
14552 | }; | ||
14553 | |||
14554 | module.exports = ReactChildReconciler; | ||
14555 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
14556 | |||
14557 | /***/ }, | ||
14558 | /* 118 */ | ||
14559 | /***/ function(module, exports, __webpack_require__) { | ||
14560 | |||
14561 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
14562 | * Copyright 2013-2015, Facebook, Inc. | ||
14563 | * All rights reserved. | ||
14564 | * | ||
14565 | * This source code is licensed under the BSD-style license found in the | ||
14566 | * LICENSE file in the root directory of this source tree. An additional grant | ||
14567 | * of patent rights can be found in the PATENTS file in the same directory. | ||
14568 | * | ||
14569 | * @providesModule flattenChildren | ||
14570 | */ | ||
14571 | |||
14572 | 'use strict'; | ||
14573 | |||
14574 | var traverseAllChildren = __webpack_require__(113); | ||
14575 | var warning = __webpack_require__(27); | ||
14576 | |||
14577 | /** | ||
14578 | * @param {function} traverseContext Context passed through traversal. | ||
14579 | * @param {?ReactComponent} child React child component. | ||
14580 | * @param {!string} name String name of key path to child. | ||
14581 | */ | ||
14582 | function flattenSingleChildIntoContext(traverseContext, child, name) { | ||
14583 | // We found a component instance. | ||
14584 | var result = traverseContext; | ||
14585 | var keyUnique = result[name] === undefined; | ||
14586 | if (process.env.NODE_ENV !== 'production') { | ||
14587 | 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; | ||
14588 | } | ||
14589 | if (keyUnique && child != null) { | ||
14590 | result[name] = child; | ||
14591 | } | ||
14592 | } | ||
14593 | |||
14594 | /** | ||
14595 | * Flattens children that are typically specified as `props.children`. Any null | ||
14596 | * children will not be included in the resulting object. | ||
14597 | * @return {!object} flattened children keyed by name. | ||
14598 | */ | ||
14599 | function flattenChildren(children) { | ||
14600 | if (children == null) { | ||
14601 | return children; | ||
14602 | } | ||
14603 | var result = {}; | ||
14604 | traverseAllChildren(children, flattenSingleChildIntoContext, result); | ||
14605 | return result; | ||
14606 | } | ||
14607 | |||
14608 | module.exports = flattenChildren; | ||
14609 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
14610 | |||
14611 | /***/ }, | ||
14612 | /* 119 */ | ||
14613 | /***/ function(module, exports) { | ||
14614 | |||
14615 | /** | ||
14616 | * Copyright 2013-2015, Facebook, Inc. | ||
14617 | * All rights reserved. | ||
14618 | * | ||
14619 | * This source code is licensed under the BSD-style license found in the | ||
14620 | * LICENSE file in the root directory of this source tree. An additional grant | ||
14621 | * of patent rights can be found in the PATENTS file in the same directory. | ||
14622 | * | ||
14623 | * @providesModule shallowEqual | ||
14624 | * @typechecks | ||
14625 | * | ||
14626 | */ | ||
14627 | |||
14628 | 'use strict'; | ||
14629 | |||
14630 | var hasOwnProperty = Object.prototype.hasOwnProperty; | ||
14631 | |||
14632 | /** | ||
14633 | * Performs equality by iterating through keys on an object and returning false | ||
14634 | * when any key has values which are not strictly equal between the arguments. | ||
14635 | * Returns true when the values of all keys are strictly equal. | ||
14636 | */ | ||
14637 | function shallowEqual(objA, objB) { | ||
14638 | if (objA === objB) { | ||
14639 | return true; | ||
14640 | } | ||
14641 | |||
14642 | if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) { | ||
14643 | return false; | ||
14644 | } | ||
14645 | |||
14646 | var keysA = Object.keys(objA); | ||
14647 | var keysB = Object.keys(objB); | ||
14648 | |||
14649 | if (keysA.length !== keysB.length) { | ||
14650 | return false; | ||
14651 | } | ||
14652 | |||
14653 | // Test for A's keys different from B. | ||
14654 | var bHasOwnProperty = hasOwnProperty.bind(objB); | ||
14655 | for (var i = 0; i < keysA.length; i++) { | ||
14656 | if (!bHasOwnProperty(keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) { | ||
14657 | return false; | ||
14658 | } | ||
14659 | } | ||
14660 | |||
14661 | return true; | ||
14662 | } | ||
14663 | |||
14664 | module.exports = shallowEqual; | ||
14665 | |||
14666 | /***/ }, | ||
14667 | /* 120 */ | ||
14668 | /***/ function(module, exports, __webpack_require__) { | ||
14669 | |||
14670 | /** | ||
14671 | * Copyright 2013-2015, Facebook, Inc. | ||
14672 | * All rights reserved. | ||
14673 | * | ||
14674 | * This source code is licensed under the BSD-style license found in the | ||
14675 | * LICENSE file in the root directory of this source tree. An additional grant | ||
14676 | * of patent rights can be found in the PATENTS file in the same directory. | ||
14677 | * | ||
14678 | * @providesModule ReactEventListener | ||
14679 | * @typechecks static-only | ||
14680 | */ | ||
14681 | |||
14682 | 'use strict'; | ||
14683 | |||
14684 | var EventListener = __webpack_require__(121); | ||
14685 | var ExecutionEnvironment = __webpack_require__(11); | ||
14686 | var PooledClass = __webpack_require__(58); | ||
14687 | var ReactInstanceHandles = __webpack_require__(47); | ||
14688 | var ReactMount = __webpack_require__(30); | ||
14689 | var ReactUpdates = __webpack_require__(56); | ||
14690 | |||
14691 | var assign = __webpack_require__(41); | ||
14692 | var getEventTarget = __webpack_require__(83); | ||
14693 | var getUnboundedScrollPosition = __webpack_require__(122); | ||
14694 | |||
14695 | var DOCUMENT_FRAGMENT_NODE_TYPE = 11; | ||
14696 | |||
14697 | /** | ||
14698 | * Finds the parent React component of `node`. | ||
14699 | * | ||
14700 | * @param {*} node | ||
14701 | * @return {?DOMEventTarget} Parent container, or `null` if the specified node | ||
14702 | * is not nested. | ||
14703 | */ | ||
14704 | function findParent(node) { | ||
14705 | // TODO: It may be a good idea to cache this to prevent unnecessary DOM | ||
14706 | // traversal, but caching is difficult to do correctly without using a | ||
14707 | // mutation observer to listen for all DOM changes. | ||
14708 | var nodeID = ReactMount.getID(node); | ||
14709 | var rootID = ReactInstanceHandles.getReactRootIDFromNodeID(nodeID); | ||
14710 | var container = ReactMount.findReactContainerForID(rootID); | ||
14711 | var parent = ReactMount.getFirstReactDOM(container); | ||
14712 | return parent; | ||
14713 | } | ||
14714 | |||
14715 | // Used to store ancestor hierarchy in top level callback | ||
14716 | function TopLevelCallbackBookKeeping(topLevelType, nativeEvent) { | ||
14717 | this.topLevelType = topLevelType; | ||
14718 | this.nativeEvent = nativeEvent; | ||
14719 | this.ancestors = []; | ||
14720 | } | ||
14721 | assign(TopLevelCallbackBookKeeping.prototype, { | ||
14722 | destructor: function () { | ||
14723 | this.topLevelType = null; | ||
14724 | this.nativeEvent = null; | ||
14725 | this.ancestors.length = 0; | ||
14726 | } | ||
14727 | }); | ||
14728 | PooledClass.addPoolingTo(TopLevelCallbackBookKeeping, PooledClass.twoArgumentPooler); | ||
14729 | |||
14730 | function handleTopLevelImpl(bookKeeping) { | ||
14731 | // TODO: Re-enable event.path handling | ||
14732 | // | ||
14733 | // if (bookKeeping.nativeEvent.path && bookKeeping.nativeEvent.path.length > 1) { | ||
14734 | // // New browsers have a path attribute on native events | ||
14735 | // handleTopLevelWithPath(bookKeeping); | ||
14736 | // } else { | ||
14737 | // // Legacy browsers don't have a path attribute on native events | ||
14738 | // handleTopLevelWithoutPath(bookKeeping); | ||
14739 | // } | ||
14740 | |||
14741 | void handleTopLevelWithPath; // temporarily unused | ||
14742 | handleTopLevelWithoutPath(bookKeeping); | ||
14743 | } | ||
14744 | |||
14745 | // Legacy browsers don't have a path attribute on native events | ||
14746 | function handleTopLevelWithoutPath(bookKeeping) { | ||
14747 | var topLevelTarget = ReactMount.getFirstReactDOM(getEventTarget(bookKeeping.nativeEvent)) || window; | ||
14748 | |||
14749 | // Loop through the hierarchy, in case there's any nested components. | ||
14750 | // It's important that we build the array of ancestors before calling any | ||
14751 | // event handlers, because event handlers can modify the DOM, leading to | ||
14752 | // inconsistencies with ReactMount's node cache. See #1105. | ||
14753 | var ancestor = topLevelTarget; | ||
14754 | while (ancestor) { | ||
14755 | bookKeeping.ancestors.push(ancestor); | ||
14756 | ancestor = findParent(ancestor); | ||
14757 | } | ||
14758 | |||
14759 | for (var i = 0; i < bookKeeping.ancestors.length; i++) { | ||
14760 | topLevelTarget = bookKeeping.ancestors[i]; | ||
14761 | var topLevelTargetID = ReactMount.getID(topLevelTarget) || ''; | ||
14762 | ReactEventListener._handleTopLevel(bookKeeping.topLevelType, topLevelTarget, topLevelTargetID, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent)); | ||
14763 | } | ||
14764 | } | ||
14765 | |||
14766 | // New browsers have a path attribute on native events | ||
14767 | function handleTopLevelWithPath(bookKeeping) { | ||
14768 | var path = bookKeeping.nativeEvent.path; | ||
14769 | var currentNativeTarget = path[0]; | ||
14770 | var eventsFired = 0; | ||
14771 | for (var i = 0; i < path.length; i++) { | ||
14772 | var currentPathElement = path[i]; | ||
14773 | if (currentPathElement.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE) { | ||
14774 | currentNativeTarget = path[i + 1]; | ||
14775 | } | ||
14776 | // TODO: slow | ||
14777 | var reactParent = ReactMount.getFirstReactDOM(currentPathElement); | ||
14778 | if (reactParent === currentPathElement) { | ||
14779 | var currentPathElementID = ReactMount.getID(currentPathElement); | ||
14780 | var newRootID = ReactInstanceHandles.getReactRootIDFromNodeID(currentPathElementID); | ||
14781 | bookKeeping.ancestors.push(currentPathElement); | ||
14782 | |||
14783 | var topLevelTargetID = ReactMount.getID(currentPathElement) || ''; | ||
14784 | eventsFired++; | ||
14785 | ReactEventListener._handleTopLevel(bookKeeping.topLevelType, currentPathElement, topLevelTargetID, bookKeeping.nativeEvent, currentNativeTarget); | ||
14786 | |||
14787 | // Jump to the root of this React render tree | ||
14788 | while (currentPathElementID !== newRootID) { | ||
14789 | i++; | ||
14790 | currentPathElement = path[i]; | ||
14791 | currentPathElementID = ReactMount.getID(currentPathElement); | ||
14792 | } | ||
14793 | } | ||
14794 | } | ||
14795 | if (eventsFired === 0) { | ||
14796 | ReactEventListener._handleTopLevel(bookKeeping.topLevelType, window, '', bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent)); | ||
14797 | } | ||
14798 | } | ||
14799 | |||
14800 | function scrollValueMonitor(cb) { | ||
14801 | var scrollPosition = getUnboundedScrollPosition(window); | ||
14802 | cb(scrollPosition); | ||
14803 | } | ||
14804 | |||
14805 | var ReactEventListener = { | ||
14806 | _enabled: true, | ||
14807 | _handleTopLevel: null, | ||
14808 | |||
14809 | WINDOW_HANDLE: ExecutionEnvironment.canUseDOM ? window : null, | ||
14810 | |||
14811 | setHandleTopLevel: function (handleTopLevel) { | ||
14812 | ReactEventListener._handleTopLevel = handleTopLevel; | ||
14813 | }, | ||
14814 | |||
14815 | setEnabled: function (enabled) { | ||
14816 | ReactEventListener._enabled = !!enabled; | ||
14817 | }, | ||
14818 | |||
14819 | isEnabled: function () { | ||
14820 | return ReactEventListener._enabled; | ||
14821 | }, | ||
14822 | |||
14823 | /** | ||
14824 | * Traps top-level events by using event bubbling. | ||
14825 | * | ||
14826 | * @param {string} topLevelType Record from `EventConstants`. | ||
14827 | * @param {string} handlerBaseName Event name (e.g. "click"). | ||
14828 | * @param {object} handle Element on which to attach listener. | ||
14829 | * @return {?object} An object with a remove function which will forcefully | ||
14830 | * remove the listener. | ||
14831 | * @internal | ||
14832 | */ | ||
14833 | trapBubbledEvent: function (topLevelType, handlerBaseName, handle) { | ||
14834 | var element = handle; | ||
14835 | if (!element) { | ||
14836 | return null; | ||
14837 | } | ||
14838 | return EventListener.listen(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType)); | ||
14839 | }, | ||
14840 | |||
14841 | /** | ||
14842 | * Traps a top-level event by using event capturing. | ||
14843 | * | ||
14844 | * @param {string} topLevelType Record from `EventConstants`. | ||
14845 | * @param {string} handlerBaseName Event name (e.g. "click"). | ||
14846 | * @param {object} handle Element on which to attach listener. | ||
14847 | * @return {?object} An object with a remove function which will forcefully | ||
14848 | * remove the listener. | ||
14849 | * @internal | ||
14850 | */ | ||
14851 | trapCapturedEvent: function (topLevelType, handlerBaseName, handle) { | ||
14852 | var element = handle; | ||
14853 | if (!element) { | ||
14854 | return null; | ||
14855 | } | ||
14856 | return EventListener.capture(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType)); | ||
14857 | }, | ||
14858 | |||
14859 | monitorScrollValue: function (refresh) { | ||
14860 | var callback = scrollValueMonitor.bind(null, refresh); | ||
14861 | EventListener.listen(window, 'scroll', callback); | ||
14862 | }, | ||
14863 | |||
14864 | dispatchEvent: function (topLevelType, nativeEvent) { | ||
14865 | if (!ReactEventListener._enabled) { | ||
14866 | return; | ||
14867 | } | ||
14868 | |||
14869 | var bookKeeping = TopLevelCallbackBookKeeping.getPooled(topLevelType, nativeEvent); | ||
14870 | try { | ||
14871 | // Event queue being processed in the same cycle allows | ||
14872 | // `preventDefault`. | ||
14873 | ReactUpdates.batchedUpdates(handleTopLevelImpl, bookKeeping); | ||
14874 | } finally { | ||
14875 | TopLevelCallbackBookKeeping.release(bookKeeping); | ||
14876 | } | ||
14877 | } | ||
14878 | }; | ||
14879 | |||
14880 | module.exports = ReactEventListener; | ||
14881 | |||
14882 | /***/ }, | ||
14883 | /* 121 */ | ||
14884 | /***/ function(module, exports, __webpack_require__) { | ||
14885 | |||
14886 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
14887 | * Copyright 2013-2015, Facebook, Inc. | ||
14888 | * | ||
14889 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
14890 | * you may not use this file except in compliance with the License. | ||
14891 | * You may obtain a copy of the License at | ||
14892 | * | ||
14893 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
14894 | * | ||
14895 | * Unless required by applicable law or agreed to in writing, software | ||
14896 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
14897 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14898 | * See the License for the specific language governing permissions and | ||
14899 | * limitations under the License. | ||
14900 | * | ||
14901 | * @providesModule EventListener | ||
14902 | * @typechecks | ||
14903 | */ | ||
14904 | |||
14905 | 'use strict'; | ||
14906 | |||
14907 | var emptyFunction = __webpack_require__(17); | ||
14908 | |||
14909 | /** | ||
14910 | * Upstream version of event listener. Does not take into account specific | ||
14911 | * nature of platform. | ||
14912 | */ | ||
14913 | var EventListener = { | ||
14914 | /** | ||
14915 | * Listen to DOM events during the bubble phase. | ||
14916 | * | ||
14917 | * @param {DOMEventTarget} target DOM element to register listener on. | ||
14918 | * @param {string} eventType Event type, e.g. 'click' or 'mouseover'. | ||
14919 | * @param {function} callback Callback function. | ||
14920 | * @return {object} Object with a `remove` method. | ||
14921 | */ | ||
14922 | listen: function (target, eventType, callback) { | ||
14923 | if (target.addEventListener) { | ||
14924 | target.addEventListener(eventType, callback, false); | ||
14925 | return { | ||
14926 | remove: function () { | ||
14927 | target.removeEventListener(eventType, callback, false); | ||
14928 | } | ||
14929 | }; | ||
14930 | } else if (target.attachEvent) { | ||
14931 | target.attachEvent('on' + eventType, callback); | ||
14932 | return { | ||
14933 | remove: function () { | ||
14934 | target.detachEvent('on' + eventType, callback); | ||
14935 | } | ||
14936 | }; | ||
14937 | } | ||
14938 | }, | ||
14939 | |||
14940 | /** | ||
14941 | * Listen to DOM events during the capture phase. | ||
14942 | * | ||
14943 | * @param {DOMEventTarget} target DOM element to register listener on. | ||
14944 | * @param {string} eventType Event type, e.g. 'click' or 'mouseover'. | ||
14945 | * @param {function} callback Callback function. | ||
14946 | * @return {object} Object with a `remove` method. | ||
14947 | */ | ||
14948 | capture: function (target, eventType, callback) { | ||
14949 | if (target.addEventListener) { | ||
14950 | target.addEventListener(eventType, callback, true); | ||
14951 | return { | ||
14952 | remove: function () { | ||
14953 | target.removeEventListener(eventType, callback, true); | ||
14954 | } | ||
14955 | }; | ||
14956 | } else { | ||
14957 | if (process.env.NODE_ENV !== 'production') { | ||
14958 | 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.'); | ||
14959 | } | ||
14960 | return { | ||
14961 | remove: emptyFunction | ||
14962 | }; | ||
14963 | } | ||
14964 | }, | ||
14965 | |||
14966 | registerDefault: function () {} | ||
14967 | }; | ||
14968 | |||
14969 | module.exports = EventListener; | ||
14970 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
14971 | |||
14972 | /***/ }, | ||
14973 | /* 122 */ | ||
14974 | /***/ function(module, exports) { | ||
14975 | |||
14976 | /** | ||
14977 | * Copyright 2013-2015, Facebook, Inc. | ||
14978 | * All rights reserved. | ||
14979 | * | ||
14980 | * This source code is licensed under the BSD-style license found in the | ||
14981 | * LICENSE file in the root directory of this source tree. An additional grant | ||
14982 | * of patent rights can be found in the PATENTS file in the same directory. | ||
14983 | * | ||
14984 | * @providesModule getUnboundedScrollPosition | ||
14985 | * @typechecks | ||
14986 | */ | ||
14987 | |||
14988 | 'use strict'; | ||
14989 | |||
14990 | /** | ||
14991 | * Gets the scroll position of the supplied element or window. | ||
14992 | * | ||
14993 | * The return values are unbounded, unlike `getScrollPosition`. This means they | ||
14994 | * may be negative or exceed the element boundaries (which is possible using | ||
14995 | * inertial scrolling). | ||
14996 | * | ||
14997 | * @param {DOMWindow|DOMElement} scrollable | ||
14998 | * @return {object} Map with `x` and `y` keys. | ||
14999 | */ | ||
15000 | function getUnboundedScrollPosition(scrollable) { | ||
15001 | if (scrollable === window) { | ||
15002 | return { | ||
15003 | x: window.pageXOffset || document.documentElement.scrollLeft, | ||
15004 | y: window.pageYOffset || document.documentElement.scrollTop | ||
15005 | }; | ||
15006 | } | ||
15007 | return { | ||
15008 | x: scrollable.scrollLeft, | ||
15009 | y: scrollable.scrollTop | ||
15010 | }; | ||
15011 | } | ||
15012 | |||
15013 | module.exports = getUnboundedScrollPosition; | ||
15014 | |||
15015 | /***/ }, | ||
15016 | /* 123 */ | ||
15017 | /***/ function(module, exports, __webpack_require__) { | ||
15018 | |||
15019 | /** | ||
15020 | * Copyright 2013-2015, Facebook, Inc. | ||
15021 | * All rights reserved. | ||
15022 | * | ||
15023 | * This source code is licensed under the BSD-style license found in the | ||
15024 | * LICENSE file in the root directory of this source tree. An additional grant | ||
15025 | * of patent rights can be found in the PATENTS file in the same directory. | ||
15026 | * | ||
15027 | * @providesModule ReactInjection | ||
15028 | */ | ||
15029 | |||
15030 | 'use strict'; | ||
15031 | |||
15032 | var DOMProperty = __webpack_require__(25); | ||
15033 | var EventPluginHub = __webpack_require__(33); | ||
15034 | var ReactComponentEnvironment = __webpack_require__(66); | ||
15035 | var ReactClass = __webpack_require__(124); | ||
15036 | var ReactEmptyComponent = __webpack_require__(70); | ||
15037 | var ReactBrowserEventEmitter = __webpack_require__(31); | ||
15038 | var ReactNativeComponent = __webpack_require__(71); | ||
15039 | var ReactPerf = __webpack_require__(20); | ||
15040 | var ReactRootIndex = __webpack_require__(48); | ||
15041 | var ReactUpdates = __webpack_require__(56); | ||
15042 | |||
15043 | var ReactInjection = { | ||
15044 | Component: ReactComponentEnvironment.injection, | ||
15045 | Class: ReactClass.injection, | ||
15046 | DOMProperty: DOMProperty.injection, | ||
15047 | EmptyComponent: ReactEmptyComponent.injection, | ||
15048 | EventPluginHub: EventPluginHub.injection, | ||
15049 | EventEmitter: ReactBrowserEventEmitter.injection, | ||
15050 | NativeComponent: ReactNativeComponent.injection, | ||
15051 | Perf: ReactPerf.injection, | ||
15052 | RootIndex: ReactRootIndex.injection, | ||
15053 | Updates: ReactUpdates.injection | ||
15054 | }; | ||
15055 | |||
15056 | module.exports = ReactInjection; | ||
15057 | |||
15058 | /***/ }, | ||
15059 | /* 124 */ | ||
15060 | /***/ function(module, exports, __webpack_require__) { | ||
15061 | |||
15062 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
15063 | * Copyright 2013-2015, Facebook, Inc. | ||
15064 | * All rights reserved. | ||
15065 | * | ||
15066 | * This source code is licensed under the BSD-style license found in the | ||
15067 | * LICENSE file in the root directory of this source tree. An additional grant | ||
15068 | * of patent rights can be found in the PATENTS file in the same directory. | ||
15069 | * | ||
15070 | * @providesModule ReactClass | ||
15071 | */ | ||
15072 | |||
15073 | 'use strict'; | ||
15074 | |||
15075 | var ReactComponent = __webpack_require__(125); | ||
15076 | var ReactElement = __webpack_require__(44); | ||
15077 | var ReactPropTypeLocations = __webpack_require__(67); | ||
15078 | var ReactPropTypeLocationNames = __webpack_require__(68); | ||
15079 | var ReactNoopUpdateQueue = __webpack_require__(126); | ||
15080 | |||
15081 | var assign = __webpack_require__(41); | ||
15082 | var emptyObject = __webpack_require__(60); | ||
15083 | var invariant = __webpack_require__(15); | ||
15084 | var keyMirror = __webpack_require__(19); | ||
15085 | var keyOf = __webpack_require__(81); | ||
15086 | var warning = __webpack_require__(27); | ||
15087 | |||
15088 | var MIXINS_KEY = keyOf({ mixins: null }); | ||
15089 | |||
15090 | /** | ||
15091 | * Policies that describe methods in `ReactClassInterface`. | ||
15092 | */ | ||
15093 | var SpecPolicy = keyMirror({ | ||
15094 | /** | ||
15095 | * These methods may be defined only once by the class specification or mixin. | ||
15096 | */ | ||
15097 | DEFINE_ONCE: null, | ||
15098 | /** | ||
15099 | * These methods may be defined by both the class specification and mixins. | ||
15100 | * Subsequent definitions will be chained. These methods must return void. | ||
15101 | */ | ||
15102 | DEFINE_MANY: null, | ||
15103 | /** | ||
15104 | * These methods are overriding the base class. | ||
15105 | */ | ||
15106 | OVERRIDE_BASE: null, | ||
15107 | /** | ||
15108 | * These methods are similar to DEFINE_MANY, except we assume they return | ||
15109 | * objects. We try to merge the keys of the return values of all the mixed in | ||
15110 | * functions. If there is a key conflict we throw. | ||
15111 | */ | ||
15112 | DEFINE_MANY_MERGED: null | ||
15113 | }); | ||
15114 | |||
15115 | var injectedMixins = []; | ||
15116 | |||
15117 | var warnedSetProps = false; | ||
15118 | function warnSetProps() { | ||
15119 | if (!warnedSetProps) { | ||
15120 | warnedSetProps = true; | ||
15121 | process.env.NODE_ENV !== 'production' ? warning(false, 'setProps(...) and replaceProps(...) are deprecated. ' + 'Instead, call render again at the top level.') : undefined; | ||
15122 | } | ||
15123 | } | ||
15124 | |||
15125 | /** | ||
15126 | * Composite components are higher-level components that compose other composite | ||
15127 | * or native components. | ||
15128 | * | ||
15129 | * To create a new type of `ReactClass`, pass a specification of | ||
15130 | * your new class to `React.createClass`. The only requirement of your class | ||
15131 | * specification is that you implement a `render` method. | ||
15132 | * | ||
15133 | * var MyComponent = React.createClass({ | ||
15134 | * render: function() { | ||
15135 | * return <div>Hello World</div>; | ||
15136 | * } | ||
15137 | * }); | ||
15138 | * | ||
15139 | * The class specification supports a specific protocol of methods that have | ||
15140 | * special meaning (e.g. `render`). See `ReactClassInterface` for | ||
15141 | * more the comprehensive protocol. Any other properties and methods in the | ||
15142 | * class specification will be available on the prototype. | ||
15143 | * | ||
15144 | * @interface ReactClassInterface | ||
15145 | * @internal | ||
15146 | */ | ||
15147 | var ReactClassInterface = { | ||
15148 | |||
15149 | /** | ||
15150 | * An array of Mixin objects to include when defining your component. | ||
15151 | * | ||
15152 | * @type {array} | ||
15153 | * @optional | ||
15154 | */ | ||
15155 | mixins: SpecPolicy.DEFINE_MANY, | ||
15156 | |||
15157 | /** | ||
15158 | * An object containing properties and methods that should be defined on | ||
15159 | * the component's constructor instead of its prototype (static methods). | ||
15160 | * | ||
15161 | * @type {object} | ||
15162 | * @optional | ||
15163 | */ | ||
15164 | statics: SpecPolicy.DEFINE_MANY, | ||
15165 | |||
15166 | /** | ||
15167 | * Definition of prop types for this component. | ||
15168 | * | ||
15169 | * @type {object} | ||
15170 | * @optional | ||
15171 | */ | ||
15172 | propTypes: SpecPolicy.DEFINE_MANY, | ||
15173 | |||
15174 | /** | ||
15175 | * Definition of context types for this component. | ||
15176 | * | ||
15177 | * @type {object} | ||
15178 | * @optional | ||
15179 | */ | ||
15180 | contextTypes: SpecPolicy.DEFINE_MANY, | ||
15181 | |||
15182 | /** | ||
15183 | * Definition of context types this component sets for its children. | ||
15184 | * | ||
15185 | * @type {object} | ||
15186 | * @optional | ||
15187 | */ | ||
15188 | childContextTypes: SpecPolicy.DEFINE_MANY, | ||
15189 | |||
15190 | // ==== Definition methods ==== | ||
15191 | |||
15192 | /** | ||
15193 | * Invoked when the component is mounted. Values in the mapping will be set on | ||
15194 | * `this.props` if that prop is not specified (i.e. using an `in` check). | ||
15195 | * | ||
15196 | * This method is invoked before `getInitialState` and therefore cannot rely | ||
15197 | * on `this.state` or use `this.setState`. | ||
15198 | * | ||
15199 | * @return {object} | ||
15200 | * @optional | ||
15201 | */ | ||
15202 | getDefaultProps: SpecPolicy.DEFINE_MANY_MERGED, | ||
15203 | |||
15204 | /** | ||
15205 | * Invoked once before the component is mounted. The return value will be used | ||
15206 | * as the initial value of `this.state`. | ||
15207 | * | ||
15208 | * getInitialState: function() { | ||
15209 | * return { | ||
15210 | * isOn: false, | ||
15211 | * fooBaz: new BazFoo() | ||
15212 | * } | ||
15213 | * } | ||
15214 | * | ||
15215 | * @return {object} | ||
15216 | * @optional | ||
15217 | */ | ||
15218 | getInitialState: SpecPolicy.DEFINE_MANY_MERGED, | ||
15219 | |||
15220 | /** | ||
15221 | * @return {object} | ||
15222 | * @optional | ||
15223 | */ | ||
15224 | getChildContext: SpecPolicy.DEFINE_MANY_MERGED, | ||
15225 | |||
15226 | /** | ||
15227 | * Uses props from `this.props` and state from `this.state` to render the | ||
15228 | * structure of the component. | ||
15229 | * | ||
15230 | * No guarantees are made about when or how often this method is invoked, so | ||
15231 | * it must not have side effects. | ||
15232 | * | ||
15233 | * render: function() { | ||
15234 | * var name = this.props.name; | ||
15235 | * return <div>Hello, {name}!</div>; | ||
15236 | * } | ||
15237 | * | ||
15238 | * @return {ReactComponent} | ||
15239 | * @nosideeffects | ||
15240 | * @required | ||
15241 | */ | ||
15242 | render: SpecPolicy.DEFINE_ONCE, | ||
15243 | |||
15244 | // ==== Delegate methods ==== | ||
15245 | |||
15246 | /** | ||
15247 | * Invoked when the component is initially created and about to be mounted. | ||
15248 | * This may have side effects, but any external subscriptions or data created | ||
15249 | * by this method must be cleaned up in `componentWillUnmount`. | ||
15250 | * | ||
15251 | * @optional | ||
15252 | */ | ||
15253 | componentWillMount: SpecPolicy.DEFINE_MANY, | ||
15254 | |||
15255 | /** | ||
15256 | * Invoked when the component has been mounted and has a DOM representation. | ||
15257 | * However, there is no guarantee that the DOM node is in the document. | ||
15258 | * | ||
15259 | * Use this as an opportunity to operate on the DOM when the component has | ||
15260 | * been mounted (initialized and rendered) for the first time. | ||
15261 | * | ||
15262 | * @param {DOMElement} rootNode DOM element representing the component. | ||
15263 | * @optional | ||
15264 | */ | ||
15265 | componentDidMount: SpecPolicy.DEFINE_MANY, | ||
15266 | |||
15267 | /** | ||
15268 | * Invoked before the component receives new props. | ||
15269 | * | ||
15270 | * Use this as an opportunity to react to a prop transition by updating the | ||
15271 | * state using `this.setState`. Current props are accessed via `this.props`. | ||
15272 | * | ||
15273 | * componentWillReceiveProps: function(nextProps, nextContext) { | ||
15274 | * this.setState({ | ||
15275 | * likesIncreasing: nextProps.likeCount > this.props.likeCount | ||
15276 | * }); | ||
15277 | * } | ||
15278 | * | ||
15279 | * NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop | ||
15280 | * transition may cause a state change, but the opposite is not true. If you | ||
15281 | * need it, you are probably looking for `componentWillUpdate`. | ||
15282 | * | ||
15283 | * @param {object} nextProps | ||
15284 | * @optional | ||
15285 | */ | ||
15286 | componentWillReceiveProps: SpecPolicy.DEFINE_MANY, | ||
15287 | |||
15288 | /** | ||
15289 | * Invoked while deciding if the component should be updated as a result of | ||
15290 | * receiving new props, state and/or context. | ||
15291 | * | ||
15292 | * Use this as an opportunity to `return false` when you're certain that the | ||
15293 | * transition to the new props/state/context will not require a component | ||
15294 | * update. | ||
15295 | * | ||
15296 | * shouldComponentUpdate: function(nextProps, nextState, nextContext) { | ||
15297 | * return !equal(nextProps, this.props) || | ||
15298 | * !equal(nextState, this.state) || | ||
15299 | * !equal(nextContext, this.context); | ||
15300 | * } | ||
15301 | * | ||
15302 | * @param {object} nextProps | ||
15303 | * @param {?object} nextState | ||
15304 | * @param {?object} nextContext | ||
15305 | * @return {boolean} True if the component should update. | ||
15306 | * @optional | ||
15307 | */ | ||
15308 | shouldComponentUpdate: SpecPolicy.DEFINE_ONCE, | ||
15309 | |||
15310 | /** | ||
15311 | * Invoked when the component is about to update due to a transition from | ||
15312 | * `this.props`, `this.state` and `this.context` to `nextProps`, `nextState` | ||
15313 | * and `nextContext`. | ||
15314 | * | ||
15315 | * Use this as an opportunity to perform preparation before an update occurs. | ||
15316 | * | ||
15317 | * NOTE: You **cannot** use `this.setState()` in this method. | ||
15318 | * | ||
15319 | * @param {object} nextProps | ||
15320 | * @param {?object} nextState | ||
15321 | * @param {?object} nextContext | ||
15322 | * @param {ReactReconcileTransaction} transaction | ||
15323 | * @optional | ||
15324 | */ | ||
15325 | componentWillUpdate: SpecPolicy.DEFINE_MANY, | ||
15326 | |||
15327 | /** | ||
15328 | * Invoked when the component's DOM representation has been updated. | ||
15329 | * | ||
15330 | * Use this as an opportunity to operate on the DOM when the component has | ||
15331 | * been updated. | ||
15332 | * | ||
15333 | * @param {object} prevProps | ||
15334 | * @param {?object} prevState | ||
15335 | * @param {?object} prevContext | ||
15336 | * @param {DOMElement} rootNode DOM element representing the component. | ||
15337 | * @optional | ||
15338 | */ | ||
15339 | componentDidUpdate: SpecPolicy.DEFINE_MANY, | ||
15340 | |||
15341 | /** | ||
15342 | * Invoked when the component is about to be removed from its parent and have | ||
15343 | * its DOM representation destroyed. | ||
15344 | * | ||
15345 | * Use this as an opportunity to deallocate any external resources. | ||
15346 | * | ||
15347 | * NOTE: There is no `componentDidUnmount` since your component will have been | ||
15348 | * destroyed by that point. | ||
15349 | * | ||
15350 | * @optional | ||
15351 | */ | ||
15352 | componentWillUnmount: SpecPolicy.DEFINE_MANY, | ||
15353 | |||
15354 | // ==== Advanced methods ==== | ||
15355 | |||
15356 | /** | ||
15357 | * Updates the component's currently mounted DOM representation. | ||
15358 | * | ||
15359 | * By default, this implements React's rendering and reconciliation algorithm. | ||
15360 | * Sophisticated clients may wish to override this. | ||
15361 | * | ||
15362 | * @param {ReactReconcileTransaction} transaction | ||
15363 | * @internal | ||
15364 | * @overridable | ||
15365 | */ | ||
15366 | updateComponent: SpecPolicy.OVERRIDE_BASE | ||
15367 | |||
15368 | }; | ||
15369 | |||
15370 | /** | ||
15371 | * Mapping from class specification keys to special processing functions. | ||
15372 | * | ||
15373 | * Although these are declared like instance properties in the specification | ||
15374 | * when defining classes using `React.createClass`, they are actually static | ||
15375 | * and are accessible on the constructor instead of the prototype. Despite | ||
15376 | * being static, they must be defined outside of the "statics" key under | ||
15377 | * which all other static methods are defined. | ||
15378 | */ | ||
15379 | var RESERVED_SPEC_KEYS = { | ||
15380 | displayName: function (Constructor, displayName) { | ||
15381 | Constructor.displayName = displayName; | ||
15382 | }, | ||
15383 | mixins: function (Constructor, mixins) { | ||
15384 | if (mixins) { | ||
15385 | for (var i = 0; i < mixins.length; i++) { | ||
15386 | mixSpecIntoComponent(Constructor, mixins[i]); | ||
15387 | } | ||
15388 | } | ||
15389 | }, | ||
15390 | childContextTypes: function (Constructor, childContextTypes) { | ||
15391 | if (process.env.NODE_ENV !== 'production') { | ||
15392 | validateTypeDef(Constructor, childContextTypes, ReactPropTypeLocations.childContext); | ||
15393 | } | ||
15394 | Constructor.childContextTypes = assign({}, Constructor.childContextTypes, childContextTypes); | ||
15395 | }, | ||
15396 | contextTypes: function (Constructor, contextTypes) { | ||
15397 | if (process.env.NODE_ENV !== 'production') { | ||
15398 | validateTypeDef(Constructor, contextTypes, ReactPropTypeLocations.context); | ||
15399 | } | ||
15400 | Constructor.contextTypes = assign({}, Constructor.contextTypes, contextTypes); | ||
15401 | }, | ||
15402 | /** | ||
15403 | * Special case getDefaultProps which should move into statics but requires | ||
15404 | * automatic merging. | ||
15405 | */ | ||
15406 | getDefaultProps: function (Constructor, getDefaultProps) { | ||
15407 | if (Constructor.getDefaultProps) { | ||
15408 | Constructor.getDefaultProps = createMergedResultFunction(Constructor.getDefaultProps, getDefaultProps); | ||
15409 | } else { | ||
15410 | Constructor.getDefaultProps = getDefaultProps; | ||
15411 | } | ||
15412 | }, | ||
15413 | propTypes: function (Constructor, propTypes) { | ||
15414 | if (process.env.NODE_ENV !== 'production') { | ||
15415 | validateTypeDef(Constructor, propTypes, ReactPropTypeLocations.prop); | ||
15416 | } | ||
15417 | Constructor.propTypes = assign({}, Constructor.propTypes, propTypes); | ||
15418 | }, | ||
15419 | statics: function (Constructor, statics) { | ||
15420 | mixStaticSpecIntoComponent(Constructor, statics); | ||
15421 | }, | ||
15422 | autobind: function () {} }; | ||
15423 | |||
15424 | // noop | ||
15425 | function validateTypeDef(Constructor, typeDef, location) { | ||
15426 | for (var propName in typeDef) { | ||
15427 | if (typeDef.hasOwnProperty(propName)) { | ||
15428 | // use a warning instead of an invariant so components | ||
15429 | // don't show up in prod but not in __DEV__ | ||
15430 | 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; | ||
15431 | } | ||
15432 | } | ||
15433 | } | ||
15434 | |||
15435 | function validateMethodOverride(proto, name) { | ||
15436 | var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null; | ||
15437 | |||
15438 | // Disallow overriding of base class methods unless explicitly allowed. | ||
15439 | if (ReactClassMixin.hasOwnProperty(name)) { | ||
15440 | !(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; | ||
15441 | } | ||
15442 | |||
15443 | // Disallow defining methods more than once unless explicitly allowed. | ||
15444 | if (proto.hasOwnProperty(name)) { | ||
15445 | !(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; | ||
15446 | } | ||
15447 | } | ||
15448 | |||
15449 | /** | ||
15450 | * Mixin helper which handles policy validation and reserved | ||
15451 | * specification keys when building React classses. | ||
15452 | */ | ||
15453 | function mixSpecIntoComponent(Constructor, spec) { | ||
15454 | if (!spec) { | ||
15455 | return; | ||
15456 | } | ||
15457 | |||
15458 | !(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; | ||
15459 | !!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; | ||
15460 | |||
15461 | var proto = Constructor.prototype; | ||
15462 | |||
15463 | // By handling mixins before any other properties, we ensure the same | ||
15464 | // chaining order is applied to methods with DEFINE_MANY policy, whether | ||
15465 | // mixins are listed before or after these methods in the spec. | ||
15466 | if (spec.hasOwnProperty(MIXINS_KEY)) { | ||
15467 | RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins); | ||
15468 | } | ||
15469 | |||
15470 | for (var name in spec) { | ||
15471 | if (!spec.hasOwnProperty(name)) { | ||
15472 | continue; | ||
15473 | } | ||
15474 | |||
15475 | if (name === MIXINS_KEY) { | ||
15476 | // We have already handled mixins in a special case above. | ||
15477 | continue; | ||
15478 | } | ||
15479 | |||
15480 | var property = spec[name]; | ||
15481 | validateMethodOverride(proto, name); | ||
15482 | |||
15483 | if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) { | ||
15484 | RESERVED_SPEC_KEYS[name](Constructor, property); | ||
15485 | } else { | ||
15486 | // Setup methods on prototype: | ||
15487 | // The following member methods should not be automatically bound: | ||
15488 | // 1. Expected ReactClass methods (in the "interface"). | ||
15489 | // 2. Overridden methods (that were mixed in). | ||
15490 | var isReactClassMethod = ReactClassInterface.hasOwnProperty(name); | ||
15491 | var isAlreadyDefined = proto.hasOwnProperty(name); | ||
15492 | var isFunction = typeof property === 'function'; | ||
15493 | var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false; | ||
15494 | |||
15495 | if (shouldAutoBind) { | ||
15496 | if (!proto.__reactAutoBindMap) { | ||
15497 | proto.__reactAutoBindMap = {}; | ||
15498 | } | ||
15499 | proto.__reactAutoBindMap[name] = property; | ||
15500 | proto[name] = property; | ||
15501 | } else { | ||
15502 | if (isAlreadyDefined) { | ||
15503 | var specPolicy = ReactClassInterface[name]; | ||
15504 | |||
15505 | // These cases should already be caught by validateMethodOverride. | ||
15506 | !(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; | ||
15507 | |||
15508 | // For methods which are defined more than once, call the existing | ||
15509 | // methods before calling the new property, merging if appropriate. | ||
15510 | if (specPolicy === SpecPolicy.DEFINE_MANY_MERGED) { | ||
15511 | proto[name] = createMergedResultFunction(proto[name], property); | ||
15512 | } else if (specPolicy === SpecPolicy.DEFINE_MANY) { | ||
15513 | proto[name] = createChainedFunction(proto[name], property); | ||
15514 | } | ||
15515 | } else { | ||
15516 | proto[name] = property; | ||
15517 | if (process.env.NODE_ENV !== 'production') { | ||
15518 | // Add verbose displayName to the function, which helps when looking | ||
15519 | // at profiling tools. | ||
15520 | if (typeof property === 'function' && spec.displayName) { | ||
15521 | proto[name].displayName = spec.displayName + '_' + name; | ||
15522 | } | ||
15523 | } | ||
15524 | } | ||
15525 | } | ||
15526 | } | ||
15527 | } | ||
15528 | } | ||
15529 | |||
15530 | function mixStaticSpecIntoComponent(Constructor, statics) { | ||
15531 | if (!statics) { | ||
15532 | return; | ||
15533 | } | ||
15534 | for (var name in statics) { | ||
15535 | var property = statics[name]; | ||
15536 | if (!statics.hasOwnProperty(name)) { | ||
15537 | continue; | ||
15538 | } | ||
15539 | |||
15540 | var isReserved = (name in RESERVED_SPEC_KEYS); | ||
15541 | !!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; | ||
15542 | |||
15543 | var isInherited = (name in Constructor); | ||
15544 | !!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; | ||
15545 | Constructor[name] = property; | ||
15546 | } | ||
15547 | } | ||
15548 | |||
15549 | /** | ||
15550 | * Merge two objects, but throw if both contain the same key. | ||
15551 | * | ||
15552 | * @param {object} one The first object, which is mutated. | ||
15553 | * @param {object} two The second object | ||
15554 | * @return {object} one after it has been mutated to contain everything in two. | ||
15555 | */ | ||
15556 | function mergeIntoWithNoDuplicateKeys(one, two) { | ||
15557 | !(one && two && typeof one === 'object' && typeof two === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : invariant(false) : undefined; | ||
15558 | |||
15559 | for (var key in two) { | ||
15560 | if (two.hasOwnProperty(key)) { | ||
15561 | !(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; | ||
15562 | one[key] = two[key]; | ||
15563 | } | ||
15564 | } | ||
15565 | return one; | ||
15566 | } | ||
15567 | |||
15568 | /** | ||
15569 | * Creates a function that invokes two functions and merges their return values. | ||
15570 | * | ||
15571 | * @param {function} one Function to invoke first. | ||
15572 | * @param {function} two Function to invoke second. | ||
15573 | * @return {function} Function that invokes the two argument functions. | ||
15574 | * @private | ||
15575 | */ | ||
15576 | function createMergedResultFunction(one, two) { | ||
15577 | return function mergedResult() { | ||
15578 | var a = one.apply(this, arguments); | ||
15579 | var b = two.apply(this, arguments); | ||
15580 | if (a == null) { | ||
15581 | return b; | ||
15582 | } else if (b == null) { | ||
15583 | return a; | ||
15584 | } | ||
15585 | var c = {}; | ||
15586 | mergeIntoWithNoDuplicateKeys(c, a); | ||
15587 | mergeIntoWithNoDuplicateKeys(c, b); | ||
15588 | return c; | ||
15589 | }; | ||
15590 | } | ||
15591 | |||
15592 | /** | ||
15593 | * Creates a function that invokes two functions and ignores their return vales. | ||
15594 | * | ||
15595 | * @param {function} one Function to invoke first. | ||
15596 | * @param {function} two Function to invoke second. | ||
15597 | * @return {function} Function that invokes the two argument functions. | ||
15598 | * @private | ||
15599 | */ | ||
15600 | function createChainedFunction(one, two) { | ||
15601 | return function chainedFunction() { | ||
15602 | one.apply(this, arguments); | ||
15603 | two.apply(this, arguments); | ||
15604 | }; | ||
15605 | } | ||
15606 | |||
15607 | /** | ||
15608 | * Binds a method to the component. | ||
15609 | * | ||
15610 | * @param {object} component Component whose method is going to be bound. | ||
15611 | * @param {function} method Method to be bound. | ||
15612 | * @return {function} The bound method. | ||
15613 | */ | ||
15614 | function bindAutoBindMethod(component, method) { | ||
15615 | var boundMethod = method.bind(component); | ||
15616 | if (process.env.NODE_ENV !== 'production') { | ||
15617 | boundMethod.__reactBoundContext = component; | ||
15618 | boundMethod.__reactBoundMethod = method; | ||
15619 | boundMethod.__reactBoundArguments = null; | ||
15620 | var componentName = component.constructor.displayName; | ||
15621 | var _bind = boundMethod.bind; | ||
15622 | /* eslint-disable block-scoped-var, no-undef */ | ||
15623 | boundMethod.bind = function (newThis) { | ||
15624 | for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
15625 | args[_key - 1] = arguments[_key]; | ||
15626 | } | ||
15627 | |||
15628 | // User is trying to bind() an autobound method; we effectively will | ||
15629 | // ignore the value of "this" that the user is trying to use, so | ||
15630 | // let's warn. | ||
15631 | if (newThis !== component && newThis !== null) { | ||
15632 | process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : undefined; | ||
15633 | } else if (!args.length) { | ||
15634 | 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; | ||
15635 | return boundMethod; | ||
15636 | } | ||
15637 | var reboundMethod = _bind.apply(boundMethod, arguments); | ||
15638 | reboundMethod.__reactBoundContext = component; | ||
15639 | reboundMethod.__reactBoundMethod = method; | ||
15640 | reboundMethod.__reactBoundArguments = args; | ||
15641 | return reboundMethod; | ||
15642 | /* eslint-enable */ | ||
15643 | }; | ||
15644 | } | ||
15645 | return boundMethod; | ||
15646 | } | ||
15647 | |||
15648 | /** | ||
15649 | * Binds all auto-bound methods in a component. | ||
15650 | * | ||
15651 | * @param {object} component Component whose method is going to be bound. | ||
15652 | */ | ||
15653 | function bindAutoBindMethods(component) { | ||
15654 | for (var autoBindKey in component.__reactAutoBindMap) { | ||
15655 | if (component.__reactAutoBindMap.hasOwnProperty(autoBindKey)) { | ||
15656 | var method = component.__reactAutoBindMap[autoBindKey]; | ||
15657 | component[autoBindKey] = bindAutoBindMethod(component, method); | ||
15658 | } | ||
15659 | } | ||
15660 | } | ||
15661 | |||
15662 | /** | ||
15663 | * Add more to the ReactClass base class. These are all legacy features and | ||
15664 | * therefore not already part of the modern ReactComponent. | ||
15665 | */ | ||
15666 | var ReactClassMixin = { | ||
15667 | |||
15668 | /** | ||
15669 | * TODO: This will be deprecated because state should always keep a consistent | ||
15670 | * type signature and the only use case for this, is to avoid that. | ||
15671 | */ | ||
15672 | replaceState: function (newState, callback) { | ||
15673 | this.updater.enqueueReplaceState(this, newState); | ||
15674 | if (callback) { | ||
15675 | this.updater.enqueueCallback(this, callback); | ||
15676 | } | ||
15677 | }, | ||
15678 | |||
15679 | /** | ||
15680 | * Checks whether or not this composite component is mounted. | ||
15681 | * @return {boolean} True if mounted, false otherwise. | ||
15682 | * @protected | ||
15683 | * @final | ||
15684 | */ | ||
15685 | isMounted: function () { | ||
15686 | return this.updater.isMounted(this); | ||
15687 | }, | ||
15688 | |||
15689 | /** | ||
15690 | * Sets a subset of the props. | ||
15691 | * | ||
15692 | * @param {object} partialProps Subset of the next props. | ||
15693 | * @param {?function} callback Called after props are updated. | ||
15694 | * @final | ||
15695 | * @public | ||
15696 | * @deprecated | ||
15697 | */ | ||
15698 | setProps: function (partialProps, callback) { | ||
15699 | if (process.env.NODE_ENV !== 'production') { | ||
15700 | warnSetProps(); | ||
15701 | } | ||
15702 | this.updater.enqueueSetProps(this, partialProps); | ||
15703 | if (callback) { | ||
15704 | this.updater.enqueueCallback(this, callback); | ||
15705 | } | ||
15706 | }, | ||
15707 | |||
15708 | /** | ||
15709 | * Replace all the props. | ||
15710 | * | ||
15711 | * @param {object} newProps Subset of the next props. | ||
15712 | * @param {?function} callback Called after props are updated. | ||
15713 | * @final | ||
15714 | * @public | ||
15715 | * @deprecated | ||
15716 | */ | ||
15717 | replaceProps: function (newProps, callback) { | ||
15718 | if (process.env.NODE_ENV !== 'production') { | ||
15719 | warnSetProps(); | ||
15720 | } | ||
15721 | this.updater.enqueueReplaceProps(this, newProps); | ||
15722 | if (callback) { | ||
15723 | this.updater.enqueueCallback(this, callback); | ||
15724 | } | ||
15725 | } | ||
15726 | }; | ||
15727 | |||
15728 | var ReactClassComponent = function () {}; | ||
15729 | assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin); | ||
15730 | |||
15731 | /** | ||
15732 | * Module for creating composite components. | ||
15733 | * | ||
15734 | * @class ReactClass | ||
15735 | */ | ||
15736 | var ReactClass = { | ||
15737 | |||
15738 | /** | ||
15739 | * Creates a composite component class given a class specification. | ||
15740 | * | ||
15741 | * @param {object} spec Class specification (which must define `render`). | ||
15742 | * @return {function} Component constructor function. | ||
15743 | * @public | ||
15744 | */ | ||
15745 | createClass: function (spec) { | ||
15746 | var Constructor = function (props, context, updater) { | ||
15747 | // This constructor is overridden by mocks. The argument is used | ||
15748 | // by mocks to assert on what gets mounted. | ||
15749 | |||
15750 | if (process.env.NODE_ENV !== 'production') { | ||
15751 | 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; | ||
15752 | } | ||
15753 | |||
15754 | // Wire up auto-binding | ||
15755 | if (this.__reactAutoBindMap) { | ||
15756 | bindAutoBindMethods(this); | ||
15757 | } | ||
15758 | |||
15759 | this.props = props; | ||
15760 | this.context = context; | ||
15761 | this.refs = emptyObject; | ||
15762 | this.updater = updater || ReactNoopUpdateQueue; | ||
15763 | |||
15764 | this.state = null; | ||
15765 | |||
15766 | // ReactClasses doesn't have constructors. Instead, they use the | ||
15767 | // getInitialState and componentWillMount methods for initialization. | ||
15768 | |||
15769 | var initialState = this.getInitialState ? this.getInitialState() : null; | ||
15770 | if (process.env.NODE_ENV !== 'production') { | ||
15771 | // We allow auto-mocks to proceed as if they're returning null. | ||
15772 | if (typeof initialState === 'undefined' && this.getInitialState._isMockFunction) { | ||
15773 | // This is probably bad practice. Consider warning here and | ||
15774 | // deprecating this convenience. | ||
15775 | initialState = null; | ||
15776 | } | ||
15777 | } | ||
15778 | !(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; | ||
15779 | |||
15780 | this.state = initialState; | ||
15781 | }; | ||
15782 | Constructor.prototype = new ReactClassComponent(); | ||
15783 | Constructor.prototype.constructor = Constructor; | ||
15784 | |||
15785 | injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor)); | ||
15786 | |||
15787 | mixSpecIntoComponent(Constructor, spec); | ||
15788 | |||
15789 | // Initialize the defaultProps property after all mixins have been merged. | ||
15790 | if (Constructor.getDefaultProps) { | ||
15791 | Constructor.defaultProps = Constructor.getDefaultProps(); | ||
15792 | } | ||
15793 | |||
15794 | if (process.env.NODE_ENV !== 'production') { | ||
15795 | // This is a tag to indicate that the use of these method names is ok, | ||
15796 | // since it's used with createClass. If it's not, then it's likely a | ||
15797 | // mistake so we'll warn you to use the static property, property | ||
15798 | // initializer or constructor respectively. | ||
15799 | if (Constructor.getDefaultProps) { | ||
15800 | Constructor.getDefaultProps.isReactClassApproved = {}; | ||
15801 | } | ||
15802 | if (Constructor.prototype.getInitialState) { | ||
15803 | Constructor.prototype.getInitialState.isReactClassApproved = {}; | ||
15804 | } | ||
15805 | } | ||
15806 | |||
15807 | !Constructor.prototype.render ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : invariant(false) : undefined; | ||
15808 | |||
15809 | if (process.env.NODE_ENV !== 'production') { | ||
15810 | 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; | ||
15811 | process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component') : undefined; | ||
15812 | } | ||
15813 | |||
15814 | // Reduce time spent doing lookups by setting these on the prototype. | ||
15815 | for (var methodName in ReactClassInterface) { | ||
15816 | if (!Constructor.prototype[methodName]) { | ||
15817 | Constructor.prototype[methodName] = null; | ||
15818 | } | ||
15819 | } | ||
15820 | |||
15821 | return Constructor; | ||
15822 | }, | ||
15823 | |||
15824 | injection: { | ||
15825 | injectMixin: function (mixin) { | ||
15826 | injectedMixins.push(mixin); | ||
15827 | } | ||
15828 | } | ||
15829 | |||
15830 | }; | ||
15831 | |||
15832 | module.exports = ReactClass; | ||
15833 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
15834 | |||
15835 | /***/ }, | ||
15836 | /* 125 */ | ||
15837 | /***/ function(module, exports, __webpack_require__) { | ||
15838 | |||
15839 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
15840 | * Copyright 2013-2015, Facebook, Inc. | ||
15841 | * All rights reserved. | ||
15842 | * | ||
15843 | * This source code is licensed under the BSD-style license found in the | ||
15844 | * LICENSE file in the root directory of this source tree. An additional grant | ||
15845 | * of patent rights can be found in the PATENTS file in the same directory. | ||
15846 | * | ||
15847 | * @providesModule ReactComponent | ||
15848 | */ | ||
15849 | |||
15850 | 'use strict'; | ||
15851 | |||
15852 | var ReactNoopUpdateQueue = __webpack_require__(126); | ||
15853 | |||
15854 | var canDefineProperty = __webpack_require__(45); | ||
15855 | var emptyObject = __webpack_require__(60); | ||
15856 | var invariant = __webpack_require__(15); | ||
15857 | var warning = __webpack_require__(27); | ||
15858 | |||
15859 | /** | ||
15860 | * Base class helpers for the updating state of a component. | ||
15861 | */ | ||
15862 | function ReactComponent(props, context, updater) { | ||
15863 | this.props = props; | ||
15864 | this.context = context; | ||
15865 | this.refs = emptyObject; | ||
15866 | // We initialize the default updater but the real one gets injected by the | ||
15867 | // renderer. | ||
15868 | this.updater = updater || ReactNoopUpdateQueue; | ||
15869 | } | ||
15870 | |||
15871 | ReactComponent.prototype.isReactComponent = {}; | ||
15872 | |||
15873 | /** | ||
15874 | * Sets a subset of the state. Always use this to mutate | ||
15875 | * state. You should treat `this.state` as immutable. | ||
15876 | * | ||
15877 | * There is no guarantee that `this.state` will be immediately updated, so | ||
15878 | * accessing `this.state` after calling this method may return the old value. | ||
15879 | * | ||
15880 | * There is no guarantee that calls to `setState` will run synchronously, | ||
15881 | * as they may eventually be batched together. You can provide an optional | ||
15882 | * callback that will be executed when the call to setState is actually | ||
15883 | * completed. | ||
15884 | * | ||
15885 | * When a function is provided to setState, it will be called at some point in | ||
15886 | * the future (not synchronously). It will be called with the up to date | ||
15887 | * component arguments (state, props, context). These values can be different | ||
15888 | * from this.* because your function may be called after receiveProps but before | ||
15889 | * shouldComponentUpdate, and this new state, props, and context will not yet be | ||
15890 | * assigned to this. | ||
15891 | * | ||
15892 | * @param {object|function} partialState Next partial state or function to | ||
15893 | * produce next partial state to be merged with current state. | ||
15894 | * @param {?function} callback Called after state is updated. | ||
15895 | * @final | ||
15896 | * @protected | ||
15897 | */ | ||
15898 | ReactComponent.prototype.setState = function (partialState, callback) { | ||
15899 | !(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; | ||
15900 | if (process.env.NODE_ENV !== 'production') { | ||
15901 | process.env.NODE_ENV !== 'production' ? warning(partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().') : undefined; | ||
15902 | } | ||
15903 | this.updater.enqueueSetState(this, partialState); | ||
15904 | if (callback) { | ||
15905 | this.updater.enqueueCallback(this, callback); | ||
15906 | } | ||
15907 | }; | ||
15908 | |||
15909 | /** | ||
15910 | * Forces an update. This should only be invoked when it is known with | ||
15911 | * certainty that we are **not** in a DOM transaction. | ||
15912 | * | ||
15913 | * You may want to call this when you know that some deeper aspect of the | ||
15914 | * component's state has changed but `setState` was not called. | ||
15915 | * | ||
15916 | * This will not invoke `shouldComponentUpdate`, but it will invoke | ||
15917 | * `componentWillUpdate` and `componentDidUpdate`. | ||
15918 | * | ||
15919 | * @param {?function} callback Called after update is complete. | ||
15920 | * @final | ||
15921 | * @protected | ||
15922 | */ | ||
15923 | ReactComponent.prototype.forceUpdate = function (callback) { | ||
15924 | this.updater.enqueueForceUpdate(this); | ||
15925 | if (callback) { | ||
15926 | this.updater.enqueueCallback(this, callback); | ||
15927 | } | ||
15928 | }; | ||
15929 | |||
15930 | /** | ||
15931 | * Deprecated APIs. These APIs used to exist on classic React classes but since | ||
15932 | * we would like to deprecate them, we're not going to move them over to this | ||
15933 | * modern base class. Instead, we define a getter that warns if it's accessed. | ||
15934 | */ | ||
15935 | if (process.env.NODE_ENV !== 'production') { | ||
15936 | var deprecatedAPIs = { | ||
15937 | getDOMNode: ['getDOMNode', 'Use ReactDOM.findDOMNode(component) instead.'], | ||
15938 | isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'], | ||
15939 | replaceProps: ['replaceProps', 'Instead, call render again at the top level.'], | ||
15940 | replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).'], | ||
15941 | setProps: ['setProps', 'Instead, call render again at the top level.'] | ||
15942 | }; | ||
15943 | var defineDeprecationWarning = function (methodName, info) { | ||
15944 | if (canDefineProperty) { | ||
15945 | Object.defineProperty(ReactComponent.prototype, methodName, { | ||
15946 | get: function () { | ||
15947 | process.env.NODE_ENV !== 'production' ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) : undefined; | ||
15948 | return undefined; | ||
15949 | } | ||
15950 | }); | ||
15951 | } | ||
15952 | }; | ||
15953 | for (var fnName in deprecatedAPIs) { | ||
15954 | if (deprecatedAPIs.hasOwnProperty(fnName)) { | ||
15955 | defineDeprecationWarning(fnName, deprecatedAPIs[fnName]); | ||
15956 | } | ||
15957 | } | ||
15958 | } | ||
15959 | |||
15960 | module.exports = ReactComponent; | ||
15961 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
15962 | |||
15963 | /***/ }, | ||
15964 | /* 126 */ | ||
15965 | /***/ function(module, exports, __webpack_require__) { | ||
15966 | |||
15967 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
15968 | * Copyright 2015, Facebook, Inc. | ||
15969 | * All rights reserved. | ||
15970 | * | ||
15971 | * This source code is licensed under the BSD-style license found in the | ||
15972 | * LICENSE file in the root directory of this source tree. An additional grant | ||
15973 | * of patent rights can be found in the PATENTS file in the same directory. | ||
15974 | * | ||
15975 | * @providesModule ReactNoopUpdateQueue | ||
15976 | */ | ||
15977 | |||
15978 | 'use strict'; | ||
15979 | |||
15980 | var warning = __webpack_require__(27); | ||
15981 | |||
15982 | function warnTDZ(publicInstance, callerName) { | ||
15983 | if (process.env.NODE_ENV !== 'production') { | ||
15984 | 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; | ||
15985 | } | ||
15986 | } | ||
15987 | |||
15988 | /** | ||
15989 | * This is the abstract API for an update queue. | ||
15990 | */ | ||
15991 | var ReactNoopUpdateQueue = { | ||
15992 | |||
15993 | /** | ||
15994 | * Checks whether or not this composite component is mounted. | ||
15995 | * @param {ReactClass} publicInstance The instance we want to test. | ||
15996 | * @return {boolean} True if mounted, false otherwise. | ||
15997 | * @protected | ||
15998 | * @final | ||
15999 | */ | ||
16000 | isMounted: function (publicInstance) { | ||
16001 | return false; | ||
16002 | }, | ||
16003 | |||
16004 | /** | ||
16005 | * Enqueue a callback that will be executed after all the pending updates | ||
16006 | * have processed. | ||
16007 | * | ||
16008 | * @param {ReactClass} publicInstance The instance to use as `this` context. | ||
16009 | * @param {?function} callback Called after state is updated. | ||
16010 | * @internal | ||
16011 | */ | ||
16012 | enqueueCallback: function (publicInstance, callback) {}, | ||
16013 | |||
16014 | /** | ||
16015 | * Forces an update. This should only be invoked when it is known with | ||
16016 | * certainty that we are **not** in a DOM transaction. | ||
16017 | * | ||
16018 | * You may want to call this when you know that some deeper aspect of the | ||
16019 | * component's state has changed but `setState` was not called. | ||
16020 | * | ||
16021 | * This will not invoke `shouldComponentUpdate`, but it will invoke | ||
16022 | * `componentWillUpdate` and `componentDidUpdate`. | ||
16023 | * | ||
16024 | * @param {ReactClass} publicInstance The instance that should rerender. | ||
16025 | * @internal | ||
16026 | */ | ||
16027 | enqueueForceUpdate: function (publicInstance) { | ||
16028 | warnTDZ(publicInstance, 'forceUpdate'); | ||
16029 | }, | ||
16030 | |||
16031 | /** | ||
16032 | * Replaces all of the state. Always use this or `setState` to mutate state. | ||
16033 | * You should treat `this.state` as immutable. | ||
16034 | * | ||
16035 | * There is no guarantee that `this.state` will be immediately updated, so | ||
16036 | * accessing `this.state` after calling this method may return the old value. | ||
16037 | * | ||
16038 | * @param {ReactClass} publicInstance The instance that should rerender. | ||
16039 | * @param {object} completeState Next state. | ||
16040 | * @internal | ||
16041 | */ | ||
16042 | enqueueReplaceState: function (publicInstance, completeState) { | ||
16043 | warnTDZ(publicInstance, 'replaceState'); | ||
16044 | }, | ||
16045 | |||
16046 | /** | ||
16047 | * Sets a subset of the state. This only exists because _pendingState is | ||
16048 | * internal. This provides a merging strategy that is not available to deep | ||
16049 | * properties which is confusing. TODO: Expose pendingState or don't use it | ||
16050 | * during the merge. | ||
16051 | * | ||
16052 | * @param {ReactClass} publicInstance The instance that should rerender. | ||
16053 | * @param {object} partialState Next partial state to be merged with state. | ||
16054 | * @internal | ||
16055 | */ | ||
16056 | enqueueSetState: function (publicInstance, partialState) { | ||
16057 | warnTDZ(publicInstance, 'setState'); | ||
16058 | }, | ||
16059 | |||
16060 | /** | ||
16061 | * Sets a subset of the props. | ||
16062 | * | ||
16063 | * @param {ReactClass} publicInstance The instance that should rerender. | ||
16064 | * @param {object} partialProps Subset of the next props. | ||
16065 | * @internal | ||
16066 | */ | ||
16067 | enqueueSetProps: function (publicInstance, partialProps) { | ||
16068 | warnTDZ(publicInstance, 'setProps'); | ||
16069 | }, | ||
16070 | |||
16071 | /** | ||
16072 | * Replaces all of the props. | ||
16073 | * | ||
16074 | * @param {ReactClass} publicInstance The instance that should rerender. | ||
16075 | * @param {object} props New props. | ||
16076 | * @internal | ||
16077 | */ | ||
16078 | enqueueReplaceProps: function (publicInstance, props) { | ||
16079 | warnTDZ(publicInstance, 'replaceProps'); | ||
16080 | } | ||
16081 | |||
16082 | }; | ||
16083 | |||
16084 | module.exports = ReactNoopUpdateQueue; | ||
16085 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
16086 | |||
16087 | /***/ }, | ||
16088 | /* 127 */ | ||
16089 | /***/ function(module, exports, __webpack_require__) { | ||
16090 | |||
16091 | /** | ||
16092 | * Copyright 2013-2015, Facebook, Inc. | ||
16093 | * All rights reserved. | ||
16094 | * | ||
16095 | * This source code is licensed under the BSD-style license found in the | ||
16096 | * LICENSE file in the root directory of this source tree. An additional grant | ||
16097 | * of patent rights can be found in the PATENTS file in the same directory. | ||
16098 | * | ||
16099 | * @providesModule ReactReconcileTransaction | ||
16100 | * @typechecks static-only | ||
16101 | */ | ||
16102 | |||
16103 | 'use strict'; | ||
16104 | |||
16105 | var CallbackQueue = __webpack_require__(57); | ||
16106 | var PooledClass = __webpack_require__(58); | ||
16107 | var ReactBrowserEventEmitter = __webpack_require__(31); | ||
16108 | var ReactDOMFeatureFlags = __webpack_require__(43); | ||
16109 | var ReactInputSelection = __webpack_require__(128); | ||
16110 | var Transaction = __webpack_require__(59); | ||
16111 | |||
16112 | var assign = __webpack_require__(41); | ||
16113 | |||
16114 | /** | ||
16115 | * Ensures that, when possible, the selection range (currently selected text | ||
16116 | * input) is not disturbed by performing the transaction. | ||
16117 | */ | ||
16118 | var SELECTION_RESTORATION = { | ||
16119 | /** | ||
16120 | * @return {Selection} Selection information. | ||
16121 | */ | ||
16122 | initialize: ReactInputSelection.getSelectionInformation, | ||
16123 | /** | ||
16124 | * @param {Selection} sel Selection information returned from `initialize`. | ||
16125 | */ | ||
16126 | close: ReactInputSelection.restoreSelection | ||
16127 | }; | ||
16128 | |||
16129 | /** | ||
16130 | * Suppresses events (blur/focus) that could be inadvertently dispatched due to | ||
16131 | * high level DOM manipulations (like temporarily removing a text input from the | ||
16132 | * DOM). | ||
16133 | */ | ||
16134 | var EVENT_SUPPRESSION = { | ||
16135 | /** | ||
16136 | * @return {boolean} The enabled status of `ReactBrowserEventEmitter` before | ||
16137 | * the reconciliation. | ||
16138 | */ | ||
16139 | initialize: function () { | ||
16140 | var currentlyEnabled = ReactBrowserEventEmitter.isEnabled(); | ||
16141 | ReactBrowserEventEmitter.setEnabled(false); | ||
16142 | return currentlyEnabled; | ||
16143 | }, | ||
16144 | |||
16145 | /** | ||
16146 | * @param {boolean} previouslyEnabled Enabled status of | ||
16147 | * `ReactBrowserEventEmitter` before the reconciliation occurred. `close` | ||
16148 | * restores the previous value. | ||
16149 | */ | ||
16150 | close: function (previouslyEnabled) { | ||
16151 | ReactBrowserEventEmitter.setEnabled(previouslyEnabled); | ||
16152 | } | ||
16153 | }; | ||
16154 | |||
16155 | /** | ||
16156 | * Provides a queue for collecting `componentDidMount` and | ||
16157 | * `componentDidUpdate` callbacks during the the transaction. | ||
16158 | */ | ||
16159 | var ON_DOM_READY_QUEUEING = { | ||
16160 | /** | ||
16161 | * Initializes the internal `onDOMReady` queue. | ||
16162 | */ | ||
16163 | initialize: function () { | ||
16164 | this.reactMountReady.reset(); | ||
16165 | }, | ||
16166 | |||
16167 | /** | ||
16168 | * After DOM is flushed, invoke all registered `onDOMReady` callbacks. | ||
16169 | */ | ||
16170 | close: function () { | ||
16171 | this.reactMountReady.notifyAll(); | ||
16172 | } | ||
16173 | }; | ||
16174 | |||
16175 | /** | ||
16176 | * Executed within the scope of the `Transaction` instance. Consider these as | ||
16177 | * being member methods, but with an implied ordering while being isolated from | ||
16178 | * each other. | ||
16179 | */ | ||
16180 | var TRANSACTION_WRAPPERS = [SELECTION_RESTORATION, EVENT_SUPPRESSION, ON_DOM_READY_QUEUEING]; | ||
16181 | |||
16182 | /** | ||
16183 | * Currently: | ||
16184 | * - The order that these are listed in the transaction is critical: | ||
16185 | * - Suppresses events. | ||
16186 | * - Restores selection range. | ||
16187 | * | ||
16188 | * Future: | ||
16189 | * - Restore document/overflow scroll positions that were unintentionally | ||
16190 | * modified via DOM insertions above the top viewport boundary. | ||
16191 | * - Implement/integrate with customized constraint based layout system and keep | ||
16192 | * track of which dimensions must be remeasured. | ||
16193 | * | ||
16194 | * @class ReactReconcileTransaction | ||
16195 | */ | ||
16196 | function ReactReconcileTransaction(forceHTML) { | ||
16197 | this.reinitializeTransaction(); | ||
16198 | // Only server-side rendering really needs this option (see | ||
16199 | // `ReactServerRendering`), but server-side uses | ||
16200 | // `ReactServerRenderingTransaction` instead. This option is here so that it's | ||
16201 | // accessible and defaults to false when `ReactDOMComponent` and | ||
16202 | // `ReactTextComponent` checks it in `mountComponent`.` | ||
16203 | this.renderToStaticMarkup = false; | ||
16204 | this.reactMountReady = CallbackQueue.getPooled(null); | ||
16205 | this.useCreateElement = !forceHTML && ReactDOMFeatureFlags.useCreateElement; | ||
16206 | } | ||
16207 | |||
16208 | var Mixin = { | ||
16209 | /** | ||
16210 | * @see Transaction | ||
16211 | * @abstract | ||
16212 | * @final | ||
16213 | * @return {array<object>} List of operation wrap procedures. | ||
16214 | * TODO: convert to array<TransactionWrapper> | ||
16215 | */ | ||
16216 | getTransactionWrappers: function () { | ||
16217 | return TRANSACTION_WRAPPERS; | ||
16218 | }, | ||
16219 | |||
16220 | /** | ||
16221 | * @return {object} The queue to collect `onDOMReady` callbacks with. | ||
16222 | */ | ||
16223 | getReactMountReady: function () { | ||
16224 | return this.reactMountReady; | ||
16225 | }, | ||
16226 | |||
16227 | /** | ||
16228 | * `PooledClass` looks for this, and will invoke this before allowing this | ||
16229 | * instance to be reused. | ||
16230 | */ | ||
16231 | destructor: function () { | ||
16232 | CallbackQueue.release(this.reactMountReady); | ||
16233 | this.reactMountReady = null; | ||
16234 | } | ||
16235 | }; | ||
16236 | |||
16237 | assign(ReactReconcileTransaction.prototype, Transaction.Mixin, Mixin); | ||
16238 | |||
16239 | PooledClass.addPoolingTo(ReactReconcileTransaction); | ||
16240 | |||
16241 | module.exports = ReactReconcileTransaction; | ||
16242 | |||
16243 | /***/ }, | ||
16244 | /* 128 */ | ||
16245 | /***/ function(module, exports, __webpack_require__) { | ||
16246 | |||
16247 | /** | ||
16248 | * Copyright 2013-2015, Facebook, Inc. | ||
16249 | * All rights reserved. | ||
16250 | * | ||
16251 | * This source code is licensed under the BSD-style license found in the | ||
16252 | * LICENSE file in the root directory of this source tree. An additional grant | ||
16253 | * of patent rights can be found in the PATENTS file in the same directory. | ||
16254 | * | ||
16255 | * @providesModule ReactInputSelection | ||
16256 | */ | ||
16257 | |||
16258 | 'use strict'; | ||
16259 | |||
16260 | var ReactDOMSelection = __webpack_require__(129); | ||
16261 | |||
16262 | var containsNode = __webpack_require__(61); | ||
16263 | var focusNode = __webpack_require__(97); | ||
16264 | var getActiveElement = __webpack_require__(131); | ||
16265 | |||
16266 | function isInDocument(node) { | ||
16267 | return containsNode(document.documentElement, node); | ||
16268 | } | ||
16269 | |||
16270 | /** | ||
16271 | * @ReactInputSelection: React input selection module. Based on Selection.js, | ||
16272 | * but modified to be suitable for react and has a couple of bug fixes (doesn't | ||
16273 | * assume buttons have range selections allowed). | ||
16274 | * Input selection module for React. | ||
16275 | */ | ||
16276 | var ReactInputSelection = { | ||
16277 | |||
16278 | hasSelectionCapabilities: function (elem) { | ||
16279 | var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase(); | ||
16280 | return nodeName && (nodeName === 'input' && elem.type === 'text' || nodeName === 'textarea' || elem.contentEditable === 'true'); | ||
16281 | }, | ||
16282 | |||
16283 | getSelectionInformation: function () { | ||
16284 | var focusedElem = getActiveElement(); | ||
16285 | return { | ||
16286 | focusedElem: focusedElem, | ||
16287 | selectionRange: ReactInputSelection.hasSelectionCapabilities(focusedElem) ? ReactInputSelection.getSelection(focusedElem) : null | ||
16288 | }; | ||
16289 | }, | ||
16290 | |||
16291 | /** | ||
16292 | * @restoreSelection: If any selection information was potentially lost, | ||
16293 | * restore it. This is useful when performing operations that could remove dom | ||
16294 | * nodes and place them back in, resulting in focus being lost. | ||
16295 | */ | ||
16296 | restoreSelection: function (priorSelectionInformation) { | ||
16297 | var curFocusedElem = getActiveElement(); | ||
16298 | var priorFocusedElem = priorSelectionInformation.focusedElem; | ||
16299 | var priorSelectionRange = priorSelectionInformation.selectionRange; | ||
16300 | if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) { | ||
16301 | if (ReactInputSelection.hasSelectionCapabilities(priorFocusedElem)) { | ||
16302 | ReactInputSelection.setSelection(priorFocusedElem, priorSelectionRange); | ||
16303 | } | ||
16304 | focusNode(priorFocusedElem); | ||
16305 | } | ||
16306 | }, | ||
16307 | |||
16308 | /** | ||
16309 | * @getSelection: Gets the selection bounds of a focused textarea, input or | ||
16310 | * contentEditable node. | ||
16311 | * -@input: Look up selection bounds of this input | ||
16312 | * -@return {start: selectionStart, end: selectionEnd} | ||
16313 | */ | ||
16314 | getSelection: function (input) { | ||
16315 | var selection; | ||
16316 | |||
16317 | if ('selectionStart' in input) { | ||
16318 | // Modern browser with input or textarea. | ||
16319 | selection = { | ||
16320 | start: input.selectionStart, | ||
16321 | end: input.selectionEnd | ||
16322 | }; | ||
16323 | } else if (document.selection && (input.nodeName && input.nodeName.toLowerCase() === 'input')) { | ||
16324 | // IE8 input. | ||
16325 | var range = document.selection.createRange(); | ||
16326 | // There can only be one selection per document in IE, so it must | ||
16327 | // be in our element. | ||
16328 | if (range.parentElement() === input) { | ||
16329 | selection = { | ||
16330 | start: -range.moveStart('character', -input.value.length), | ||
16331 | end: -range.moveEnd('character', -input.value.length) | ||
16332 | }; | ||
16333 | } | ||
16334 | } else { | ||
16335 | // Content editable or old IE textarea. | ||
16336 | selection = ReactDOMSelection.getOffsets(input); | ||
16337 | } | ||
16338 | |||
16339 | return selection || { start: 0, end: 0 }; | ||
16340 | }, | ||
16341 | |||
16342 | /** | ||
16343 | * @setSelection: Sets the selection bounds of a textarea or input and focuses | ||
16344 | * the input. | ||
16345 | * -@input Set selection bounds of this input or textarea | ||
16346 | * -@offsets Object of same form that is returned from get* | ||
16347 | */ | ||
16348 | setSelection: function (input, offsets) { | ||
16349 | var start = offsets.start; | ||
16350 | var end = offsets.end; | ||
16351 | if (typeof end === 'undefined') { | ||
16352 | end = start; | ||
16353 | } | ||
16354 | |||
16355 | if ('selectionStart' in input) { | ||
16356 | input.selectionStart = start; | ||
16357 | input.selectionEnd = Math.min(end, input.value.length); | ||
16358 | } else if (document.selection && (input.nodeName && input.nodeName.toLowerCase() === 'input')) { | ||
16359 | var range = input.createTextRange(); | ||
16360 | range.collapse(true); | ||
16361 | range.moveStart('character', start); | ||
16362 | range.moveEnd('character', end - start); | ||
16363 | range.select(); | ||
16364 | } else { | ||
16365 | ReactDOMSelection.setOffsets(input, offsets); | ||
16366 | } | ||
16367 | } | ||
16368 | }; | ||
16369 | |||
16370 | module.exports = ReactInputSelection; | ||
16371 | |||
16372 | /***/ }, | ||
16373 | /* 129 */ | ||
16374 | /***/ function(module, exports, __webpack_require__) { | ||
16375 | |||
16376 | /** | ||
16377 | * Copyright 2013-2015, Facebook, Inc. | ||
16378 | * All rights reserved. | ||
16379 | * | ||
16380 | * This source code is licensed under the BSD-style license found in the | ||
16381 | * LICENSE file in the root directory of this source tree. An additional grant | ||
16382 | * of patent rights can be found in the PATENTS file in the same directory. | ||
16383 | * | ||
16384 | * @providesModule ReactDOMSelection | ||
16385 | */ | ||
16386 | |||
16387 | 'use strict'; | ||
16388 | |||
16389 | var ExecutionEnvironment = __webpack_require__(11); | ||
16390 | |||
16391 | var getNodeForCharacterOffset = __webpack_require__(130); | ||
16392 | var getTextContentAccessor = __webpack_require__(77); | ||
16393 | |||
16394 | /** | ||
16395 | * While `isCollapsed` is available on the Selection object and `collapsed` | ||
16396 | * is available on the Range object, IE11 sometimes gets them wrong. | ||
16397 | * If the anchor/focus nodes and offsets are the same, the range is collapsed. | ||
16398 | */ | ||
16399 | function isCollapsed(anchorNode, anchorOffset, focusNode, focusOffset) { | ||
16400 | return anchorNode === focusNode && anchorOffset === focusOffset; | ||
16401 | } | ||
16402 | |||
16403 | /** | ||
16404 | * Get the appropriate anchor and focus node/offset pairs for IE. | ||
16405 | * | ||
16406 | * The catch here is that IE's selection API doesn't provide information | ||
16407 | * about whether the selection is forward or backward, so we have to | ||
16408 | * behave as though it's always forward. | ||
16409 | * | ||
16410 | * IE text differs from modern selection in that it behaves as though | ||
16411 | * block elements end with a new line. This means character offsets will | ||
16412 | * differ between the two APIs. | ||
16413 | * | ||
16414 | * @param {DOMElement} node | ||
16415 | * @return {object} | ||
16416 | */ | ||
16417 | function getIEOffsets(node) { | ||
16418 | var selection = document.selection; | ||
16419 | var selectedRange = selection.createRange(); | ||
16420 | var selectedLength = selectedRange.text.length; | ||
16421 | |||
16422 | // Duplicate selection so we can move range without breaking user selection. | ||
16423 | var fromStart = selectedRange.duplicate(); | ||
16424 | fromStart.moveToElementText(node); | ||
16425 | fromStart.setEndPoint('EndToStart', selectedRange); | ||
16426 | |||
16427 | var startOffset = fromStart.text.length; | ||
16428 | var endOffset = startOffset + selectedLength; | ||
16429 | |||
16430 | return { | ||
16431 | start: startOffset, | ||
16432 | end: endOffset | ||
16433 | }; | ||
16434 | } | ||
16435 | |||
16436 | /** | ||
16437 | * @param {DOMElement} node | ||
16438 | * @return {?object} | ||
16439 | */ | ||
16440 | function getModernOffsets(node) { | ||
16441 | var selection = window.getSelection && window.getSelection(); | ||
16442 | |||
16443 | if (!selection || selection.rangeCount === 0) { | ||
16444 | return null; | ||
16445 | } | ||
16446 | |||
16447 | var anchorNode = selection.anchorNode; | ||
16448 | var anchorOffset = selection.anchorOffset; | ||
16449 | var focusNode = selection.focusNode; | ||
16450 | var focusOffset = selection.focusOffset; | ||
16451 | |||
16452 | var currentRange = selection.getRangeAt(0); | ||
16453 | |||
16454 | // In Firefox, range.startContainer and range.endContainer can be "anonymous | ||
16455 | // divs", e.g. the up/down buttons on an <input type="number">. Anonymous | ||
16456 | // divs do not seem to expose properties, triggering a "Permission denied | ||
16457 | // error" if any of its properties are accessed. The only seemingly possible | ||
16458 | // way to avoid erroring is to access a property that typically works for | ||
16459 | // non-anonymous divs and catch any error that may otherwise arise. See | ||
16460 | // https://bugzilla.mozilla.org/show_bug.cgi?id=208427 | ||
16461 | try { | ||
16462 | /* eslint-disable no-unused-expressions */ | ||
16463 | currentRange.startContainer.nodeType; | ||
16464 | currentRange.endContainer.nodeType; | ||
16465 | /* eslint-enable no-unused-expressions */ | ||
16466 | } catch (e) { | ||
16467 | return null; | ||
16468 | } | ||
16469 | |||
16470 | // If the node and offset values are the same, the selection is collapsed. | ||
16471 | // `Selection.isCollapsed` is available natively, but IE sometimes gets | ||
16472 | // this value wrong. | ||
16473 | var isSelectionCollapsed = isCollapsed(selection.anchorNode, selection.anchorOffset, selection.focusNode, selection.focusOffset); | ||
16474 | |||
16475 | var rangeLength = isSelectionCollapsed ? 0 : currentRange.toString().length; | ||
16476 | |||
16477 | var tempRange = currentRange.cloneRange(); | ||
16478 | tempRange.selectNodeContents(node); | ||
16479 | tempRange.setEnd(currentRange.startContainer, currentRange.startOffset); | ||
16480 | |||
16481 | var isTempRangeCollapsed = isCollapsed(tempRange.startContainer, tempRange.startOffset, tempRange.endContainer, tempRange.endOffset); | ||
16482 | |||
16483 | var start = isTempRangeCollapsed ? 0 : tempRange.toString().length; | ||
16484 | var end = start + rangeLength; | ||
16485 | |||
16486 | // Detect whether the selection is backward. | ||
16487 | var detectionRange = document.createRange(); | ||
16488 | detectionRange.setStart(anchorNode, anchorOffset); | ||
16489 | detectionRange.setEnd(focusNode, focusOffset); | ||
16490 | var isBackward = detectionRange.collapsed; | ||
16491 | |||
16492 | return { | ||
16493 | start: isBackward ? end : start, | ||
16494 | end: isBackward ? start : end | ||
16495 | }; | ||
16496 | } | ||
16497 | |||
16498 | /** | ||
16499 | * @param {DOMElement|DOMTextNode} node | ||
16500 | * @param {object} offsets | ||
16501 | */ | ||
16502 | function setIEOffsets(node, offsets) { | ||
16503 | var range = document.selection.createRange().duplicate(); | ||
16504 | var start, end; | ||
16505 | |||
16506 | if (typeof offsets.end === 'undefined') { | ||
16507 | start = offsets.start; | ||
16508 | end = start; | ||
16509 | } else if (offsets.start > offsets.end) { | ||
16510 | start = offsets.end; | ||
16511 | end = offsets.start; | ||
16512 | } else { | ||
16513 | start = offsets.start; | ||
16514 | end = offsets.end; | ||
16515 | } | ||
16516 | |||
16517 | range.moveToElementText(node); | ||
16518 | range.moveStart('character', start); | ||
16519 | range.setEndPoint('EndToStart', range); | ||
16520 | range.moveEnd('character', end - start); | ||
16521 | range.select(); | ||
16522 | } | ||
16523 | |||
16524 | /** | ||
16525 | * In modern non-IE browsers, we can support both forward and backward | ||
16526 | * selections. | ||
16527 | * | ||
16528 | * Note: IE10+ supports the Selection object, but it does not support | ||
16529 | * the `extend` method, which means that even in modern IE, it's not possible | ||
16530 | * to programatically create a backward selection. Thus, for all IE | ||
16531 | * versions, we use the old IE API to create our selections. | ||
16532 | * | ||
16533 | * @param {DOMElement|DOMTextNode} node | ||
16534 | * @param {object} offsets | ||
16535 | */ | ||
16536 | function setModernOffsets(node, offsets) { | ||
16537 | if (!window.getSelection) { | ||
16538 | return; | ||
16539 | } | ||
16540 | |||
16541 | var selection = window.getSelection(); | ||
16542 | var length = node[getTextContentAccessor()].length; | ||
16543 | var start = Math.min(offsets.start, length); | ||
16544 | var end = typeof offsets.end === 'undefined' ? start : Math.min(offsets.end, length); | ||
16545 | |||
16546 | // IE 11 uses modern selection, but doesn't support the extend method. | ||
16547 | // Flip backward selections, so we can set with a single range. | ||
16548 | if (!selection.extend && start > end) { | ||
16549 | var temp = end; | ||
16550 | end = start; | ||
16551 | start = temp; | ||
16552 | } | ||
16553 | |||
16554 | var startMarker = getNodeForCharacterOffset(node, start); | ||
16555 | var endMarker = getNodeForCharacterOffset(node, end); | ||
16556 | |||
16557 | if (startMarker && endMarker) { | ||
16558 | var range = document.createRange(); | ||
16559 | range.setStart(startMarker.node, startMarker.offset); | ||
16560 | selection.removeAllRanges(); | ||
16561 | |||
16562 | if (start > end) { | ||
16563 | selection.addRange(range); | ||
16564 | selection.extend(endMarker.node, endMarker.offset); | ||
16565 | } else { | ||
16566 | range.setEnd(endMarker.node, endMarker.offset); | ||
16567 | selection.addRange(range); | ||
16568 | } | ||
16569 | } | ||
16570 | } | ||
16571 | |||
16572 | var useIEOffsets = ExecutionEnvironment.canUseDOM && 'selection' in document && !('getSelection' in window); | ||
16573 | |||
16574 | var ReactDOMSelection = { | ||
16575 | /** | ||
16576 | * @param {DOMElement} node | ||
16577 | */ | ||
16578 | getOffsets: useIEOffsets ? getIEOffsets : getModernOffsets, | ||
16579 | |||
16580 | /** | ||
16581 | * @param {DOMElement|DOMTextNode} node | ||
16582 | * @param {object} offsets | ||
16583 | */ | ||
16584 | setOffsets: useIEOffsets ? setIEOffsets : setModernOffsets | ||
16585 | }; | ||
16586 | |||
16587 | module.exports = ReactDOMSelection; | ||
16588 | |||
16589 | /***/ }, | ||
16590 | /* 130 */ | ||
16591 | /***/ function(module, exports) { | ||
16592 | |||
16593 | /** | ||
16594 | * Copyright 2013-2015, Facebook, Inc. | ||
16595 | * All rights reserved. | ||
16596 | * | ||
16597 | * This source code is licensed under the BSD-style license found in the | ||
16598 | * LICENSE file in the root directory of this source tree. An additional grant | ||
16599 | * of patent rights can be found in the PATENTS file in the same directory. | ||
16600 | * | ||
16601 | * @providesModule getNodeForCharacterOffset | ||
16602 | */ | ||
16603 | |||
16604 | 'use strict'; | ||
16605 | |||
16606 | /** | ||
16607 | * Given any node return the first leaf node without children. | ||
16608 | * | ||
16609 | * @param {DOMElement|DOMTextNode} node | ||
16610 | * @return {DOMElement|DOMTextNode} | ||
16611 | */ | ||
16612 | function getLeafNode(node) { | ||
16613 | while (node && node.firstChild) { | ||
16614 | node = node.firstChild; | ||
16615 | } | ||
16616 | return node; | ||
16617 | } | ||
16618 | |||
16619 | /** | ||
16620 | * Get the next sibling within a container. This will walk up the | ||
16621 | * DOM if a node's siblings have been exhausted. | ||
16622 | * | ||
16623 | * @param {DOMElement|DOMTextNode} node | ||
16624 | * @return {?DOMElement|DOMTextNode} | ||
16625 | */ | ||
16626 | function getSiblingNode(node) { | ||
16627 | while (node) { | ||
16628 | if (node.nextSibling) { | ||
16629 | return node.nextSibling; | ||
16630 | } | ||
16631 | node = node.parentNode; | ||
16632 | } | ||
16633 | } | ||
16634 | |||
16635 | /** | ||
16636 | * Get object describing the nodes which contain characters at offset. | ||
16637 | * | ||
16638 | * @param {DOMElement|DOMTextNode} root | ||
16639 | * @param {number} offset | ||
16640 | * @return {?object} | ||
16641 | */ | ||
16642 | function getNodeForCharacterOffset(root, offset) { | ||
16643 | var node = getLeafNode(root); | ||
16644 | var nodeStart = 0; | ||
16645 | var nodeEnd = 0; | ||
16646 | |||
16647 | while (node) { | ||
16648 | if (node.nodeType === 3) { | ||
16649 | nodeEnd = nodeStart + node.textContent.length; | ||
16650 | |||
16651 | if (nodeStart <= offset && nodeEnd >= offset) { | ||
16652 | return { | ||
16653 | node: node, | ||
16654 | offset: offset - nodeStart | ||
16655 | }; | ||
16656 | } | ||
16657 | |||
16658 | nodeStart = nodeEnd; | ||
16659 | } | ||
16660 | |||
16661 | node = getLeafNode(getSiblingNode(node)); | ||
16662 | } | ||
16663 | } | ||
16664 | |||
16665 | module.exports = getNodeForCharacterOffset; | ||
16666 | |||
16667 | /***/ }, | ||
16668 | /* 131 */ | ||
16669 | /***/ function(module, exports) { | ||
16670 | |||
16671 | /** | ||
16672 | * Copyright 2013-2015, Facebook, Inc. | ||
16673 | * All rights reserved. | ||
16674 | * | ||
16675 | * This source code is licensed under the BSD-style license found in the | ||
16676 | * LICENSE file in the root directory of this source tree. An additional grant | ||
16677 | * of patent rights can be found in the PATENTS file in the same directory. | ||
16678 | * | ||
16679 | * @providesModule getActiveElement | ||
16680 | * @typechecks | ||
16681 | */ | ||
16682 | |||
16683 | /** | ||
16684 | * Same as document.activeElement but wraps in a try-catch block. In IE it is | ||
16685 | * not safe to call document.activeElement if there is nothing focused. | ||
16686 | * | ||
16687 | * The activeElement will be null only if the document or document body is not yet defined. | ||
16688 | */ | ||
16689 | 'use strict'; | ||
16690 | |||
16691 | function getActiveElement() /*?DOMElement*/{ | ||
16692 | if (typeof document === 'undefined') { | ||
16693 | return null; | ||
16694 | } | ||
16695 | |||
16696 | try { | ||
16697 | return document.activeElement || document.body; | ||
16698 | } catch (e) { | ||
16699 | return document.body; | ||
16700 | } | ||
16701 | } | ||
16702 | |||
16703 | module.exports = getActiveElement; | ||
16704 | |||
16705 | /***/ }, | ||
16706 | /* 132 */ | ||
16707 | /***/ function(module, exports, __webpack_require__) { | ||
16708 | |||
16709 | /** | ||
16710 | * Copyright 2013-2015, Facebook, Inc. | ||
16711 | * All rights reserved. | ||
16712 | * | ||
16713 | * This source code is licensed under the BSD-style license found in the | ||
16714 | * LICENSE file in the root directory of this source tree. An additional grant | ||
16715 | * of patent rights can be found in the PATENTS file in the same directory. | ||
16716 | * | ||
16717 | * @providesModule SelectEventPlugin | ||
16718 | */ | ||
16719 | |||
16720 | 'use strict'; | ||
16721 | |||
16722 | var EventConstants = __webpack_require__(32); | ||
16723 | var EventPropagators = __webpack_require__(75); | ||
16724 | var ExecutionEnvironment = __webpack_require__(11); | ||
16725 | var ReactInputSelection = __webpack_require__(128); | ||
16726 | var SyntheticEvent = __webpack_require__(79); | ||
16727 | |||
16728 | var getActiveElement = __webpack_require__(131); | ||
16729 | var isTextInputElement = __webpack_require__(84); | ||
16730 | var keyOf = __webpack_require__(81); | ||
16731 | var shallowEqual = __webpack_require__(119); | ||
16732 | |||
16733 | var topLevelTypes = EventConstants.topLevelTypes; | ||
16734 | |||
16735 | var skipSelectionChangeEvent = ExecutionEnvironment.canUseDOM && 'documentMode' in document && document.documentMode <= 11; | ||
16736 | |||
16737 | var eventTypes = { | ||
16738 | select: { | ||
16739 | phasedRegistrationNames: { | ||
16740 | bubbled: keyOf({ onSelect: null }), | ||
16741 | captured: keyOf({ onSelectCapture: null }) | ||
16742 | }, | ||
16743 | dependencies: [topLevelTypes.topBlur, topLevelTypes.topContextMenu, topLevelTypes.topFocus, topLevelTypes.topKeyDown, topLevelTypes.topMouseDown, topLevelTypes.topMouseUp, topLevelTypes.topSelectionChange] | ||
16744 | } | ||
16745 | }; | ||
16746 | |||
16747 | var activeElement = null; | ||
16748 | var activeElementID = null; | ||
16749 | var lastSelection = null; | ||
16750 | var mouseDown = false; | ||
16751 | |||
16752 | // Track whether a listener exists for this plugin. If none exist, we do | ||
16753 | // not extract events. | ||
16754 | var hasListener = false; | ||
16755 | var ON_SELECT_KEY = keyOf({ onSelect: null }); | ||
16756 | |||
16757 | /** | ||
16758 | * Get an object which is a unique representation of the current selection. | ||
16759 | * | ||
16760 | * The return value will not be consistent across nodes or browsers, but | ||
16761 | * two identical selections on the same node will return identical objects. | ||
16762 | * | ||
16763 | * @param {DOMElement} node | ||
16764 | * @return {object} | ||
16765 | */ | ||
16766 | function getSelection(node) { | ||
16767 | if ('selectionStart' in node && ReactInputSelection.hasSelectionCapabilities(node)) { | ||
16768 | return { | ||
16769 | start: node.selectionStart, | ||
16770 | end: node.selectionEnd | ||
16771 | }; | ||
16772 | } else if (window.getSelection) { | ||
16773 | var selection = window.getSelection(); | ||
16774 | return { | ||
16775 | anchorNode: selection.anchorNode, | ||
16776 | anchorOffset: selection.anchorOffset, | ||
16777 | focusNode: selection.focusNode, | ||
16778 | focusOffset: selection.focusOffset | ||
16779 | }; | ||
16780 | } else if (document.selection) { | ||
16781 | var range = document.selection.createRange(); | ||
16782 | return { | ||
16783 | parentElement: range.parentElement(), | ||
16784 | text: range.text, | ||
16785 | top: range.boundingTop, | ||
16786 | left: range.boundingLeft | ||
16787 | }; | ||
16788 | } | ||
16789 | } | ||
16790 | |||
16791 | /** | ||
16792 | * Poll selection to see whether it's changed. | ||
16793 | * | ||
16794 | * @param {object} nativeEvent | ||
16795 | * @return {?SyntheticEvent} | ||
16796 | */ | ||
16797 | function constructSelectEvent(nativeEvent, nativeEventTarget) { | ||
16798 | // Ensure we have the right element, and that the user is not dragging a | ||
16799 | // selection (this matches native `select` event behavior). In HTML5, select | ||
16800 | // fires only on input and textarea thus if there's no focused element we | ||
16801 | // won't dispatch. | ||
16802 | if (mouseDown || activeElement == null || activeElement !== getActiveElement()) { | ||
16803 | return null; | ||
16804 | } | ||
16805 | |||
16806 | // Only fire when selection has actually changed. | ||
16807 | var currentSelection = getSelection(activeElement); | ||
16808 | if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) { | ||
16809 | lastSelection = currentSelection; | ||
16810 | |||
16811 | var syntheticEvent = SyntheticEvent.getPooled(eventTypes.select, activeElementID, nativeEvent, nativeEventTarget); | ||
16812 | |||
16813 | syntheticEvent.type = 'select'; | ||
16814 | syntheticEvent.target = activeElement; | ||
16815 | |||
16816 | EventPropagators.accumulateTwoPhaseDispatches(syntheticEvent); | ||
16817 | |||
16818 | return syntheticEvent; | ||
16819 | } | ||
16820 | |||
16821 | return null; | ||
16822 | } | ||
16823 | |||
16824 | /** | ||
16825 | * This plugin creates an `onSelect` event that normalizes select events | ||
16826 | * across form elements. | ||
16827 | * | ||
16828 | * Supported elements are: | ||
16829 | * - input (see `isTextInputElement`) | ||
16830 | * - textarea | ||
16831 | * - contentEditable | ||
16832 | * | ||
16833 | * This differs from native browser implementations in the following ways: | ||
16834 | * - Fires on contentEditable fields as well as inputs. | ||
16835 | * - Fires for collapsed selection. | ||
16836 | * - Fires after user input. | ||
16837 | */ | ||
16838 | var SelectEventPlugin = { | ||
16839 | |||
16840 | eventTypes: eventTypes, | ||
16841 | |||
16842 | /** | ||
16843 | * @param {string} topLevelType Record from `EventConstants`. | ||
16844 | * @param {DOMEventTarget} topLevelTarget The listening component root node. | ||
16845 | * @param {string} topLevelTargetID ID of `topLevelTarget`. | ||
16846 | * @param {object} nativeEvent Native browser event. | ||
16847 | * @return {*} An accumulation of synthetic events. | ||
16848 | * @see {EventPluginHub.extractEvents} | ||
16849 | */ | ||
16850 | extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) { | ||
16851 | if (!hasListener) { | ||
16852 | return null; | ||
16853 | } | ||
16854 | |||
16855 | switch (topLevelType) { | ||
16856 | // Track the input node that has focus. | ||
16857 | case topLevelTypes.topFocus: | ||
16858 | if (isTextInputElement(topLevelTarget) || topLevelTarget.contentEditable === 'true') { | ||
16859 | activeElement = topLevelTarget; | ||
16860 | activeElementID = topLevelTargetID; | ||
16861 | lastSelection = null; | ||
16862 | } | ||
16863 | break; | ||
16864 | case topLevelTypes.topBlur: | ||
16865 | activeElement = null; | ||
16866 | activeElementID = null; | ||
16867 | lastSelection = null; | ||
16868 | break; | ||
16869 | |||
16870 | // Don't fire the event while the user is dragging. This matches the | ||
16871 | // semantics of the native select event. | ||
16872 | case topLevelTypes.topMouseDown: | ||
16873 | mouseDown = true; | ||
16874 | break; | ||
16875 | case topLevelTypes.topContextMenu: | ||
16876 | case topLevelTypes.topMouseUp: | ||
16877 | mouseDown = false; | ||
16878 | return constructSelectEvent(nativeEvent, nativeEventTarget); | ||
16879 | |||
16880 | // Chrome and IE fire non-standard event when selection is changed (and | ||
16881 | // sometimes when it hasn't). IE's event fires out of order with respect | ||
16882 | // to key and input events on deletion, so we discard it. | ||
16883 | // | ||
16884 | // Firefox doesn't support selectionchange, so check selection status | ||
16885 | // after each key entry. The selection changes after keydown and before | ||
16886 | // keyup, but we check on keydown as well in the case of holding down a | ||
16887 | // key, when multiple keydown events are fired but only one keyup is. | ||
16888 | // This is also our approach for IE handling, for the reason above. | ||
16889 | case topLevelTypes.topSelectionChange: | ||
16890 | if (skipSelectionChangeEvent) { | ||
16891 | break; | ||
16892 | } | ||
16893 | // falls through | ||
16894 | case topLevelTypes.topKeyDown: | ||
16895 | case topLevelTypes.topKeyUp: | ||
16896 | return constructSelectEvent(nativeEvent, nativeEventTarget); | ||
16897 | } | ||
16898 | |||
16899 | return null; | ||
16900 | }, | ||
16901 | |||
16902 | didPutListener: function (id, registrationName, listener) { | ||
16903 | if (registrationName === ON_SELECT_KEY) { | ||
16904 | hasListener = true; | ||
16905 | } | ||
16906 | } | ||
16907 | }; | ||
16908 | |||
16909 | module.exports = SelectEventPlugin; | ||
16910 | |||
16911 | /***/ }, | ||
16912 | /* 133 */ | ||
16913 | /***/ function(module, exports) { | ||
16914 | |||
16915 | /** | ||
16916 | * Copyright 2013-2015, Facebook, Inc. | ||
16917 | * All rights reserved. | ||
16918 | * | ||
16919 | * This source code is licensed under the BSD-style license found in the | ||
16920 | * LICENSE file in the root directory of this source tree. An additional grant | ||
16921 | * of patent rights can be found in the PATENTS file in the same directory. | ||
16922 | * | ||
16923 | * @providesModule ServerReactRootIndex | ||
16924 | * @typechecks | ||
16925 | */ | ||
16926 | |||
16927 | 'use strict'; | ||
16928 | |||
16929 | /** | ||
16930 | * Size of the reactRoot ID space. We generate random numbers for React root | ||
16931 | * IDs and if there's a collision the events and DOM update system will | ||
16932 | * get confused. In the future we need a way to generate GUIDs but for | ||
16933 | * now this will work on a smaller scale. | ||
16934 | */ | ||
16935 | var GLOBAL_MOUNT_POINT_MAX = Math.pow(2, 53); | ||
16936 | |||
16937 | var ServerReactRootIndex = { | ||
16938 | createReactRootIndex: function () { | ||
16939 | return Math.ceil(Math.random() * GLOBAL_MOUNT_POINT_MAX); | ||
16940 | } | ||
16941 | }; | ||
16942 | |||
16943 | module.exports = ServerReactRootIndex; | ||
16944 | |||
16945 | /***/ }, | ||
16946 | /* 134 */ | ||
16947 | /***/ function(module, exports, __webpack_require__) { | ||
16948 | |||
16949 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
16950 | * Copyright 2013-2015, Facebook, Inc. | ||
16951 | * All rights reserved. | ||
16952 | * | ||
16953 | * This source code is licensed under the BSD-style license found in the | ||
16954 | * LICENSE file in the root directory of this source tree. An additional grant | ||
16955 | * of patent rights can be found in the PATENTS file in the same directory. | ||
16956 | * | ||
16957 | * @providesModule SimpleEventPlugin | ||
16958 | */ | ||
16959 | |||
16960 | 'use strict'; | ||
16961 | |||
16962 | var EventConstants = __webpack_require__(32); | ||
16963 | var EventListener = __webpack_require__(121); | ||
16964 | var EventPropagators = __webpack_require__(75); | ||
16965 | var ReactMount = __webpack_require__(30); | ||
16966 | var SyntheticClipboardEvent = __webpack_require__(135); | ||
16967 | var SyntheticEvent = __webpack_require__(79); | ||
16968 | var SyntheticFocusEvent = __webpack_require__(136); | ||
16969 | var SyntheticKeyboardEvent = __webpack_require__(137); | ||
16970 | var SyntheticMouseEvent = __webpack_require__(88); | ||
16971 | var SyntheticDragEvent = __webpack_require__(140); | ||
16972 | var SyntheticTouchEvent = __webpack_require__(141); | ||
16973 | var SyntheticUIEvent = __webpack_require__(89); | ||
16974 | var SyntheticWheelEvent = __webpack_require__(142); | ||
16975 | |||
16976 | var emptyFunction = __webpack_require__(17); | ||
16977 | var getEventCharCode = __webpack_require__(138); | ||
16978 | var invariant = __webpack_require__(15); | ||
16979 | var keyOf = __webpack_require__(81); | ||
16980 | |||
16981 | var topLevelTypes = EventConstants.topLevelTypes; | ||
16982 | |||
16983 | var eventTypes = { | ||
16984 | abort: { | ||
16985 | phasedRegistrationNames: { | ||
16986 | bubbled: keyOf({ onAbort: true }), | ||
16987 | captured: keyOf({ onAbortCapture: true }) | ||
16988 | } | ||
16989 | }, | ||
16990 | blur: { | ||
16991 | phasedRegistrationNames: { | ||
16992 | bubbled: keyOf({ onBlur: true }), | ||
16993 | captured: keyOf({ onBlurCapture: true }) | ||
16994 | } | ||
16995 | }, | ||
16996 | canPlay: { | ||
16997 | phasedRegistrationNames: { | ||
16998 | bubbled: keyOf({ onCanPlay: true }), | ||
16999 | captured: keyOf({ onCanPlayCapture: true }) | ||
17000 | } | ||
17001 | }, | ||
17002 | canPlayThrough: { | ||
17003 | phasedRegistrationNames: { | ||
17004 | bubbled: keyOf({ onCanPlayThrough: true }), | ||
17005 | captured: keyOf({ onCanPlayThroughCapture: true }) | ||
17006 | } | ||
17007 | }, | ||
17008 | click: { | ||
17009 | phasedRegistrationNames: { | ||
17010 | bubbled: keyOf({ onClick: true }), | ||
17011 | captured: keyOf({ onClickCapture: true }) | ||
17012 | } | ||
17013 | }, | ||
17014 | contextMenu: { | ||
17015 | phasedRegistrationNames: { | ||
17016 | bubbled: keyOf({ onContextMenu: true }), | ||
17017 | captured: keyOf({ onContextMenuCapture: true }) | ||
17018 | } | ||
17019 | }, | ||
17020 | copy: { | ||
17021 | phasedRegistrationNames: { | ||
17022 | bubbled: keyOf({ onCopy: true }), | ||
17023 | captured: keyOf({ onCopyCapture: true }) | ||
17024 | } | ||
17025 | }, | ||
17026 | cut: { | ||
17027 | phasedRegistrationNames: { | ||
17028 | bubbled: keyOf({ onCut: true }), | ||
17029 | captured: keyOf({ onCutCapture: true }) | ||
17030 | } | ||
17031 | }, | ||
17032 | doubleClick: { | ||
17033 | phasedRegistrationNames: { | ||
17034 | bubbled: keyOf({ onDoubleClick: true }), | ||
17035 | captured: keyOf({ onDoubleClickCapture: true }) | ||
17036 | } | ||
17037 | }, | ||
17038 | drag: { | ||
17039 | phasedRegistrationNames: { | ||
17040 | bubbled: keyOf({ onDrag: true }), | ||
17041 | captured: keyOf({ onDragCapture: true }) | ||
17042 | } | ||
17043 | }, | ||
17044 | dragEnd: { | ||
17045 | phasedRegistrationNames: { | ||
17046 | bubbled: keyOf({ onDragEnd: true }), | ||
17047 | captured: keyOf({ onDragEndCapture: true }) | ||
17048 | } | ||
17049 | }, | ||
17050 | dragEnter: { | ||
17051 | phasedRegistrationNames: { | ||
17052 | bubbled: keyOf({ onDragEnter: true }), | ||
17053 | captured: keyOf({ onDragEnterCapture: true }) | ||
17054 | } | ||
17055 | }, | ||
17056 | dragExit: { | ||
17057 | phasedRegistrationNames: { | ||
17058 | bubbled: keyOf({ onDragExit: true }), | ||
17059 | captured: keyOf({ onDragExitCapture: true }) | ||
17060 | } | ||
17061 | }, | ||
17062 | dragLeave: { | ||
17063 | phasedRegistrationNames: { | ||
17064 | bubbled: keyOf({ onDragLeave: true }), | ||
17065 | captured: keyOf({ onDragLeaveCapture: true }) | ||
17066 | } | ||
17067 | }, | ||
17068 | dragOver: { | ||
17069 | phasedRegistrationNames: { | ||
17070 | bubbled: keyOf({ onDragOver: true }), | ||
17071 | captured: keyOf({ onDragOverCapture: true }) | ||
17072 | } | ||
17073 | }, | ||
17074 | dragStart: { | ||
17075 | phasedRegistrationNames: { | ||
17076 | bubbled: keyOf({ onDragStart: true }), | ||
17077 | captured: keyOf({ onDragStartCapture: true }) | ||
17078 | } | ||
17079 | }, | ||
17080 | drop: { | ||
17081 | phasedRegistrationNames: { | ||
17082 | bubbled: keyOf({ onDrop: true }), | ||
17083 | captured: keyOf({ onDropCapture: true }) | ||
17084 | } | ||
17085 | }, | ||
17086 | durationChange: { | ||
17087 | phasedRegistrationNames: { | ||
17088 | bubbled: keyOf({ onDurationChange: true }), | ||
17089 | captured: keyOf({ onDurationChangeCapture: true }) | ||
17090 | } | ||
17091 | }, | ||
17092 | emptied: { | ||
17093 | phasedRegistrationNames: { | ||
17094 | bubbled: keyOf({ onEmptied: true }), | ||
17095 | captured: keyOf({ onEmptiedCapture: true }) | ||
17096 | } | ||
17097 | }, | ||
17098 | encrypted: { | ||
17099 | phasedRegistrationNames: { | ||
17100 | bubbled: keyOf({ onEncrypted: true }), | ||
17101 | captured: keyOf({ onEncryptedCapture: true }) | ||
17102 | } | ||
17103 | }, | ||
17104 | ended: { | ||
17105 | phasedRegistrationNames: { | ||
17106 | bubbled: keyOf({ onEnded: true }), | ||
17107 | captured: keyOf({ onEndedCapture: true }) | ||
17108 | } | ||
17109 | }, | ||
17110 | error: { | ||
17111 | phasedRegistrationNames: { | ||
17112 | bubbled: keyOf({ onError: true }), | ||
17113 | captured: keyOf({ onErrorCapture: true }) | ||
17114 | } | ||
17115 | }, | ||
17116 | focus: { | ||
17117 | phasedRegistrationNames: { | ||
17118 | bubbled: keyOf({ onFocus: true }), | ||
17119 | captured: keyOf({ onFocusCapture: true }) | ||
17120 | } | ||
17121 | }, | ||
17122 | input: { | ||
17123 | phasedRegistrationNames: { | ||
17124 | bubbled: keyOf({ onInput: true }), | ||
17125 | captured: keyOf({ onInputCapture: true }) | ||
17126 | } | ||
17127 | }, | ||
17128 | keyDown: { | ||
17129 | phasedRegistrationNames: { | ||
17130 | bubbled: keyOf({ onKeyDown: true }), | ||
17131 | captured: keyOf({ onKeyDownCapture: true }) | ||
17132 | } | ||
17133 | }, | ||
17134 | keyPress: { | ||
17135 | phasedRegistrationNames: { | ||
17136 | bubbled: keyOf({ onKeyPress: true }), | ||
17137 | captured: keyOf({ onKeyPressCapture: true }) | ||
17138 | } | ||
17139 | }, | ||
17140 | keyUp: { | ||
17141 | phasedRegistrationNames: { | ||
17142 | bubbled: keyOf({ onKeyUp: true }), | ||
17143 | captured: keyOf({ onKeyUpCapture: true }) | ||
17144 | } | ||
17145 | }, | ||
17146 | load: { | ||
17147 | phasedRegistrationNames: { | ||
17148 | bubbled: keyOf({ onLoad: true }), | ||
17149 | captured: keyOf({ onLoadCapture: true }) | ||
17150 | } | ||
17151 | }, | ||
17152 | loadedData: { | ||
17153 | phasedRegistrationNames: { | ||
17154 | bubbled: keyOf({ onLoadedData: true }), | ||
17155 | captured: keyOf({ onLoadedDataCapture: true }) | ||
17156 | } | ||
17157 | }, | ||
17158 | loadedMetadata: { | ||
17159 | phasedRegistrationNames: { | ||
17160 | bubbled: keyOf({ onLoadedMetadata: true }), | ||
17161 | captured: keyOf({ onLoadedMetadataCapture: true }) | ||
17162 | } | ||
17163 | }, | ||
17164 | loadStart: { | ||
17165 | phasedRegistrationNames: { | ||
17166 | bubbled: keyOf({ onLoadStart: true }), | ||
17167 | captured: keyOf({ onLoadStartCapture: true }) | ||
17168 | } | ||
17169 | }, | ||
17170 | // Note: We do not allow listening to mouseOver events. Instead, use the | ||
17171 | // onMouseEnter/onMouseLeave created by `EnterLeaveEventPlugin`. | ||
17172 | mouseDown: { | ||
17173 | phasedRegistrationNames: { | ||
17174 | bubbled: keyOf({ onMouseDown: true }), | ||
17175 | captured: keyOf({ onMouseDownCapture: true }) | ||
17176 | } | ||
17177 | }, | ||
17178 | mouseMove: { | ||
17179 | phasedRegistrationNames: { | ||
17180 | bubbled: keyOf({ onMouseMove: true }), | ||
17181 | captured: keyOf({ onMouseMoveCapture: true }) | ||
17182 | } | ||
17183 | }, | ||
17184 | mouseOut: { | ||
17185 | phasedRegistrationNames: { | ||
17186 | bubbled: keyOf({ onMouseOut: true }), | ||
17187 | captured: keyOf({ onMouseOutCapture: true }) | ||
17188 | } | ||
17189 | }, | ||
17190 | mouseOver: { | ||
17191 | phasedRegistrationNames: { | ||
17192 | bubbled: keyOf({ onMouseOver: true }), | ||
17193 | captured: keyOf({ onMouseOverCapture: true }) | ||
17194 | } | ||
17195 | }, | ||
17196 | mouseUp: { | ||
17197 | phasedRegistrationNames: { | ||
17198 | bubbled: keyOf({ onMouseUp: true }), | ||
17199 | captured: keyOf({ onMouseUpCapture: true }) | ||
17200 | } | ||
17201 | }, | ||
17202 | paste: { | ||
17203 | phasedRegistrationNames: { | ||
17204 | bubbled: keyOf({ onPaste: true }), | ||
17205 | captured: keyOf({ onPasteCapture: true }) | ||
17206 | } | ||
17207 | }, | ||
17208 | pause: { | ||
17209 | phasedRegistrationNames: { | ||
17210 | bubbled: keyOf({ onPause: true }), | ||
17211 | captured: keyOf({ onPauseCapture: true }) | ||
17212 | } | ||
17213 | }, | ||
17214 | play: { | ||
17215 | phasedRegistrationNames: { | ||
17216 | bubbled: keyOf({ onPlay: true }), | ||
17217 | captured: keyOf({ onPlayCapture: true }) | ||
17218 | } | ||
17219 | }, | ||
17220 | playing: { | ||
17221 | phasedRegistrationNames: { | ||
17222 | bubbled: keyOf({ onPlaying: true }), | ||
17223 | captured: keyOf({ onPlayingCapture: true }) | ||
17224 | } | ||
17225 | }, | ||
17226 | progress: { | ||
17227 | phasedRegistrationNames: { | ||
17228 | bubbled: keyOf({ onProgress: true }), | ||
17229 | captured: keyOf({ onProgressCapture: true }) | ||
17230 | } | ||
17231 | }, | ||
17232 | rateChange: { | ||
17233 | phasedRegistrationNames: { | ||
17234 | bubbled: keyOf({ onRateChange: true }), | ||
17235 | captured: keyOf({ onRateChangeCapture: true }) | ||
17236 | } | ||
17237 | }, | ||
17238 | reset: { | ||
17239 | phasedRegistrationNames: { | ||
17240 | bubbled: keyOf({ onReset: true }), | ||
17241 | captured: keyOf({ onResetCapture: true }) | ||
17242 | } | ||
17243 | }, | ||
17244 | scroll: { | ||
17245 | phasedRegistrationNames: { | ||
17246 | bubbled: keyOf({ onScroll: true }), | ||
17247 | captured: keyOf({ onScrollCapture: true }) | ||
17248 | } | ||
17249 | }, | ||
17250 | seeked: { | ||
17251 | phasedRegistrationNames: { | ||
17252 | bubbled: keyOf({ onSeeked: true }), | ||
17253 | captured: keyOf({ onSeekedCapture: true }) | ||
17254 | } | ||
17255 | }, | ||
17256 | seeking: { | ||
17257 | phasedRegistrationNames: { | ||
17258 | bubbled: keyOf({ onSeeking: true }), | ||
17259 | captured: keyOf({ onSeekingCapture: true }) | ||
17260 | } | ||
17261 | }, | ||
17262 | stalled: { | ||
17263 | phasedRegistrationNames: { | ||
17264 | bubbled: keyOf({ onStalled: true }), | ||
17265 | captured: keyOf({ onStalledCapture: true }) | ||
17266 | } | ||
17267 | }, | ||
17268 | submit: { | ||
17269 | phasedRegistrationNames: { | ||
17270 | bubbled: keyOf({ onSubmit: true }), | ||
17271 | captured: keyOf({ onSubmitCapture: true }) | ||
17272 | } | ||
17273 | }, | ||
17274 | suspend: { | ||
17275 | phasedRegistrationNames: { | ||
17276 | bubbled: keyOf({ onSuspend: true }), | ||
17277 | captured: keyOf({ onSuspendCapture: true }) | ||
17278 | } | ||
17279 | }, | ||
17280 | timeUpdate: { | ||
17281 | phasedRegistrationNames: { | ||
17282 | bubbled: keyOf({ onTimeUpdate: true }), | ||
17283 | captured: keyOf({ onTimeUpdateCapture: true }) | ||
17284 | } | ||
17285 | }, | ||
17286 | touchCancel: { | ||
17287 | phasedRegistrationNames: { | ||
17288 | bubbled: keyOf({ onTouchCancel: true }), | ||
17289 | captured: keyOf({ onTouchCancelCapture: true }) | ||
17290 | } | ||
17291 | }, | ||
17292 | touchEnd: { | ||
17293 | phasedRegistrationNames: { | ||
17294 | bubbled: keyOf({ onTouchEnd: true }), | ||
17295 | captured: keyOf({ onTouchEndCapture: true }) | ||
17296 | } | ||
17297 | }, | ||
17298 | touchMove: { | ||
17299 | phasedRegistrationNames: { | ||
17300 | bubbled: keyOf({ onTouchMove: true }), | ||
17301 | captured: keyOf({ onTouchMoveCapture: true }) | ||
17302 | } | ||
17303 | }, | ||
17304 | touchStart: { | ||
17305 | phasedRegistrationNames: { | ||
17306 | bubbled: keyOf({ onTouchStart: true }), | ||
17307 | captured: keyOf({ onTouchStartCapture: true }) | ||
17308 | } | ||
17309 | }, | ||
17310 | volumeChange: { | ||
17311 | phasedRegistrationNames: { | ||
17312 | bubbled: keyOf({ onVolumeChange: true }), | ||
17313 | captured: keyOf({ onVolumeChangeCapture: true }) | ||
17314 | } | ||
17315 | }, | ||
17316 | waiting: { | ||
17317 | phasedRegistrationNames: { | ||
17318 | bubbled: keyOf({ onWaiting: true }), | ||
17319 | captured: keyOf({ onWaitingCapture: true }) | ||
17320 | } | ||
17321 | }, | ||
17322 | wheel: { | ||
17323 | phasedRegistrationNames: { | ||
17324 | bubbled: keyOf({ onWheel: true }), | ||
17325 | captured: keyOf({ onWheelCapture: true }) | ||
17326 | } | ||
17327 | } | ||
17328 | }; | ||
17329 | |||
17330 | var topLevelEventsToDispatchConfig = { | ||
17331 | topAbort: eventTypes.abort, | ||
17332 | topBlur: eventTypes.blur, | ||
17333 | topCanPlay: eventTypes.canPlay, | ||
17334 | topCanPlayThrough: eventTypes.canPlayThrough, | ||
17335 | topClick: eventTypes.click, | ||
17336 | topContextMenu: eventTypes.contextMenu, | ||
17337 | topCopy: eventTypes.copy, | ||
17338 | topCut: eventTypes.cut, | ||
17339 | topDoubleClick: eventTypes.doubleClick, | ||
17340 | topDrag: eventTypes.drag, | ||
17341 | topDragEnd: eventTypes.dragEnd, | ||
17342 | topDragEnter: eventTypes.dragEnter, | ||
17343 | topDragExit: eventTypes.dragExit, | ||
17344 | topDragLeave: eventTypes.dragLeave, | ||
17345 | topDragOver: eventTypes.dragOver, | ||
17346 | topDragStart: eventTypes.dragStart, | ||
17347 | topDrop: eventTypes.drop, | ||
17348 | topDurationChange: eventTypes.durationChange, | ||
17349 | topEmptied: eventTypes.emptied, | ||
17350 | topEncrypted: eventTypes.encrypted, | ||
17351 | topEnded: eventTypes.ended, | ||
17352 | topError: eventTypes.error, | ||
17353 | topFocus: eventTypes.focus, | ||
17354 | topInput: eventTypes.input, | ||
17355 | topKeyDown: eventTypes.keyDown, | ||
17356 | topKeyPress: eventTypes.keyPress, | ||
17357 | topKeyUp: eventTypes.keyUp, | ||
17358 | topLoad: eventTypes.load, | ||
17359 | topLoadedData: eventTypes.loadedData, | ||
17360 | topLoadedMetadata: eventTypes.loadedMetadata, | ||
17361 | topLoadStart: eventTypes.loadStart, | ||
17362 | topMouseDown: eventTypes.mouseDown, | ||
17363 | topMouseMove: eventTypes.mouseMove, | ||
17364 | topMouseOut: eventTypes.mouseOut, | ||
17365 | topMouseOver: eventTypes.mouseOver, | ||
17366 | topMouseUp: eventTypes.mouseUp, | ||
17367 | topPaste: eventTypes.paste, | ||
17368 | topPause: eventTypes.pause, | ||
17369 | topPlay: eventTypes.play, | ||
17370 | topPlaying: eventTypes.playing, | ||
17371 | topProgress: eventTypes.progress, | ||
17372 | topRateChange: eventTypes.rateChange, | ||
17373 | topReset: eventTypes.reset, | ||
17374 | topScroll: eventTypes.scroll, | ||
17375 | topSeeked: eventTypes.seeked, | ||
17376 | topSeeking: eventTypes.seeking, | ||
17377 | topStalled: eventTypes.stalled, | ||
17378 | topSubmit: eventTypes.submit, | ||
17379 | topSuspend: eventTypes.suspend, | ||
17380 | topTimeUpdate: eventTypes.timeUpdate, | ||
17381 | topTouchCancel: eventTypes.touchCancel, | ||
17382 | topTouchEnd: eventTypes.touchEnd, | ||
17383 | topTouchMove: eventTypes.touchMove, | ||
17384 | topTouchStart: eventTypes.touchStart, | ||
17385 | topVolumeChange: eventTypes.volumeChange, | ||
17386 | topWaiting: eventTypes.waiting, | ||
17387 | topWheel: eventTypes.wheel | ||
17388 | }; | ||
17389 | |||
17390 | for (var type in topLevelEventsToDispatchConfig) { | ||
17391 | topLevelEventsToDispatchConfig[type].dependencies = [type]; | ||
17392 | } | ||
17393 | |||
17394 | var ON_CLICK_KEY = keyOf({ onClick: null }); | ||
17395 | var onClickListeners = {}; | ||
17396 | |||
17397 | var SimpleEventPlugin = { | ||
17398 | |||
17399 | eventTypes: eventTypes, | ||
17400 | |||
17401 | /** | ||
17402 | * @param {string} topLevelType Record from `EventConstants`. | ||
17403 | * @param {DOMEventTarget} topLevelTarget The listening component root node. | ||
17404 | * @param {string} topLevelTargetID ID of `topLevelTarget`. | ||
17405 | * @param {object} nativeEvent Native browser event. | ||
17406 | * @return {*} An accumulation of synthetic events. | ||
17407 | * @see {EventPluginHub.extractEvents} | ||
17408 | */ | ||
17409 | extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) { | ||
17410 | var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType]; | ||
17411 | if (!dispatchConfig) { | ||
17412 | return null; | ||
17413 | } | ||
17414 | var EventConstructor; | ||
17415 | switch (topLevelType) { | ||
17416 | case topLevelTypes.topAbort: | ||
17417 | case topLevelTypes.topCanPlay: | ||
17418 | case topLevelTypes.topCanPlayThrough: | ||
17419 | case topLevelTypes.topDurationChange: | ||
17420 | case topLevelTypes.topEmptied: | ||
17421 | case topLevelTypes.topEncrypted: | ||
17422 | case topLevelTypes.topEnded: | ||
17423 | case topLevelTypes.topError: | ||
17424 | case topLevelTypes.topInput: | ||
17425 | case topLevelTypes.topLoad: | ||
17426 | case topLevelTypes.topLoadedData: | ||
17427 | case topLevelTypes.topLoadedMetadata: | ||
17428 | case topLevelTypes.topLoadStart: | ||
17429 | case topLevelTypes.topPause: | ||
17430 | case topLevelTypes.topPlay: | ||
17431 | case topLevelTypes.topPlaying: | ||
17432 | case topLevelTypes.topProgress: | ||
17433 | case topLevelTypes.topRateChange: | ||
17434 | case topLevelTypes.topReset: | ||
17435 | case topLevelTypes.topSeeked: | ||
17436 | case topLevelTypes.topSeeking: | ||
17437 | case topLevelTypes.topStalled: | ||
17438 | case topLevelTypes.topSubmit: | ||
17439 | case topLevelTypes.topSuspend: | ||
17440 | case topLevelTypes.topTimeUpdate: | ||
17441 | case topLevelTypes.topVolumeChange: | ||
17442 | case topLevelTypes.topWaiting: | ||
17443 | // HTML Events | ||
17444 | // @see http://www.w3.org/TR/html5/index.html#events-0 | ||
17445 | EventConstructor = SyntheticEvent; | ||
17446 | break; | ||
17447 | case topLevelTypes.topKeyPress: | ||
17448 | // FireFox creates a keypress event for function keys too. This removes | ||
17449 | // the unwanted keypress events. Enter is however both printable and | ||
17450 | // non-printable. One would expect Tab to be as well (but it isn't). | ||
17451 | if (getEventCharCode(nativeEvent) === 0) { | ||
17452 | return null; | ||
17453 | } | ||
17454 | /* falls through */ | ||
17455 | case topLevelTypes.topKeyDown: | ||
17456 | case topLevelTypes.topKeyUp: | ||
17457 | EventConstructor = SyntheticKeyboardEvent; | ||
17458 | break; | ||
17459 | case topLevelTypes.topBlur: | ||
17460 | case topLevelTypes.topFocus: | ||
17461 | EventConstructor = SyntheticFocusEvent; | ||
17462 | break; | ||
17463 | case topLevelTypes.topClick: | ||
17464 | // Firefox creates a click event on right mouse clicks. This removes the | ||
17465 | // unwanted click events. | ||
17466 | if (nativeEvent.button === 2) { | ||
17467 | return null; | ||
17468 | } | ||
17469 | /* falls through */ | ||
17470 | case topLevelTypes.topContextMenu: | ||
17471 | case topLevelTypes.topDoubleClick: | ||
17472 | case topLevelTypes.topMouseDown: | ||
17473 | case topLevelTypes.topMouseMove: | ||
17474 | case topLevelTypes.topMouseOut: | ||
17475 | case topLevelTypes.topMouseOver: | ||
17476 | case topLevelTypes.topMouseUp: | ||
17477 | EventConstructor = SyntheticMouseEvent; | ||
17478 | break; | ||
17479 | case topLevelTypes.topDrag: | ||
17480 | case topLevelTypes.topDragEnd: | ||
17481 | case topLevelTypes.topDragEnter: | ||
17482 | case topLevelTypes.topDragExit: | ||
17483 | case topLevelTypes.topDragLeave: | ||
17484 | case topLevelTypes.topDragOver: | ||
17485 | case topLevelTypes.topDragStart: | ||
17486 | case topLevelTypes.topDrop: | ||
17487 | EventConstructor = SyntheticDragEvent; | ||
17488 | break; | ||
17489 | case topLevelTypes.topTouchCancel: | ||
17490 | case topLevelTypes.topTouchEnd: | ||
17491 | case topLevelTypes.topTouchMove: | ||
17492 | case topLevelTypes.topTouchStart: | ||
17493 | EventConstructor = SyntheticTouchEvent; | ||
17494 | break; | ||
17495 | case topLevelTypes.topScroll: | ||
17496 | EventConstructor = SyntheticUIEvent; | ||
17497 | break; | ||
17498 | case topLevelTypes.topWheel: | ||
17499 | EventConstructor = SyntheticWheelEvent; | ||
17500 | break; | ||
17501 | case topLevelTypes.topCopy: | ||
17502 | case topLevelTypes.topCut: | ||
17503 | case topLevelTypes.topPaste: | ||
17504 | EventConstructor = SyntheticClipboardEvent; | ||
17505 | break; | ||
17506 | } | ||
17507 | !EventConstructor ? process.env.NODE_ENV !== 'production' ? invariant(false, 'SimpleEventPlugin: Unhandled event type, `%s`.', topLevelType) : invariant(false) : undefined; | ||
17508 | var event = EventConstructor.getPooled(dispatchConfig, topLevelTargetID, nativeEvent, nativeEventTarget); | ||
17509 | EventPropagators.accumulateTwoPhaseDispatches(event); | ||
17510 | return event; | ||
17511 | }, | ||
17512 | |||
17513 | didPutListener: function (id, registrationName, listener) { | ||
17514 | // Mobile Safari does not fire properly bubble click events on | ||
17515 | // non-interactive elements, which means delegated click listeners do not | ||
17516 | // fire. The workaround for this bug involves attaching an empty click | ||
17517 | // listener on the target node. | ||
17518 | if (registrationName === ON_CLICK_KEY) { | ||
17519 | var node = ReactMount.getNode(id); | ||
17520 | if (!onClickListeners[id]) { | ||
17521 | onClickListeners[id] = EventListener.listen(node, 'click', emptyFunction); | ||
17522 | } | ||
17523 | } | ||
17524 | }, | ||
17525 | |||
17526 | willDeleteListener: function (id, registrationName) { | ||
17527 | if (registrationName === ON_CLICK_KEY) { | ||
17528 | onClickListeners[id].remove(); | ||
17529 | delete onClickListeners[id]; | ||
17530 | } | ||
17531 | } | ||
17532 | |||
17533 | }; | ||
17534 | |||
17535 | module.exports = SimpleEventPlugin; | ||
17536 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
17537 | |||
17538 | /***/ }, | ||
17539 | /* 135 */ | ||
17540 | /***/ function(module, exports, __webpack_require__) { | ||
17541 | |||
17542 | /** | ||
17543 | * Copyright 2013-2015, Facebook, Inc. | ||
17544 | * All rights reserved. | ||
17545 | * | ||
17546 | * This source code is licensed under the BSD-style license found in the | ||
17547 | * LICENSE file in the root directory of this source tree. An additional grant | ||
17548 | * of patent rights can be found in the PATENTS file in the same directory. | ||
17549 | * | ||
17550 | * @providesModule SyntheticClipboardEvent | ||
17551 | * @typechecks static-only | ||
17552 | */ | ||
17553 | |||
17554 | 'use strict'; | ||
17555 | |||
17556 | var SyntheticEvent = __webpack_require__(79); | ||
17557 | |||
17558 | /** | ||
17559 | * @interface Event | ||
17560 | * @see http://www.w3.org/TR/clipboard-apis/ | ||
17561 | */ | ||
17562 | var ClipboardEventInterface = { | ||
17563 | clipboardData: function (event) { | ||
17564 | return 'clipboardData' in event ? event.clipboardData : window.clipboardData; | ||
17565 | } | ||
17566 | }; | ||
17567 | |||
17568 | /** | ||
17569 | * @param {object} dispatchConfig Configuration used to dispatch this event. | ||
17570 | * @param {string} dispatchMarker Marker identifying the event target. | ||
17571 | * @param {object} nativeEvent Native browser event. | ||
17572 | * @extends {SyntheticUIEvent} | ||
17573 | */ | ||
17574 | function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | ||
17575 | SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | ||
17576 | } | ||
17577 | |||
17578 | SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface); | ||
17579 | |||
17580 | module.exports = SyntheticClipboardEvent; | ||
17581 | |||
17582 | /***/ }, | ||
17583 | /* 136 */ | ||
17584 | /***/ function(module, exports, __webpack_require__) { | ||
17585 | |||
17586 | /** | ||
17587 | * Copyright 2013-2015, Facebook, Inc. | ||
17588 | * All rights reserved. | ||
17589 | * | ||
17590 | * This source code is licensed under the BSD-style license found in the | ||
17591 | * LICENSE file in the root directory of this source tree. An additional grant | ||
17592 | * of patent rights can be found in the PATENTS file in the same directory. | ||
17593 | * | ||
17594 | * @providesModule SyntheticFocusEvent | ||
17595 | * @typechecks static-only | ||
17596 | */ | ||
17597 | |||
17598 | 'use strict'; | ||
17599 | |||
17600 | var SyntheticUIEvent = __webpack_require__(89); | ||
17601 | |||
17602 | /** | ||
17603 | * @interface FocusEvent | ||
17604 | * @see http://www.w3.org/TR/DOM-Level-3-Events/ | ||
17605 | */ | ||
17606 | var FocusEventInterface = { | ||
17607 | relatedTarget: null | ||
17608 | }; | ||
17609 | |||
17610 | /** | ||
17611 | * @param {object} dispatchConfig Configuration used to dispatch this event. | ||
17612 | * @param {string} dispatchMarker Marker identifying the event target. | ||
17613 | * @param {object} nativeEvent Native browser event. | ||
17614 | * @extends {SyntheticUIEvent} | ||
17615 | */ | ||
17616 | function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | ||
17617 | SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | ||
17618 | } | ||
17619 | |||
17620 | SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface); | ||
17621 | |||
17622 | module.exports = SyntheticFocusEvent; | ||
17623 | |||
17624 | /***/ }, | ||
17625 | /* 137 */ | ||
17626 | /***/ function(module, exports, __webpack_require__) { | ||
17627 | |||
17628 | /** | ||
17629 | * Copyright 2013-2015, Facebook, Inc. | ||
17630 | * All rights reserved. | ||
17631 | * | ||
17632 | * This source code is licensed under the BSD-style license found in the | ||
17633 | * LICENSE file in the root directory of this source tree. An additional grant | ||
17634 | * of patent rights can be found in the PATENTS file in the same directory. | ||
17635 | * | ||
17636 | * @providesModule SyntheticKeyboardEvent | ||
17637 | * @typechecks static-only | ||
17638 | */ | ||
17639 | |||
17640 | 'use strict'; | ||
17641 | |||
17642 | var SyntheticUIEvent = __webpack_require__(89); | ||
17643 | |||
17644 | var getEventCharCode = __webpack_require__(138); | ||
17645 | var getEventKey = __webpack_require__(139); | ||
17646 | var getEventModifierState = __webpack_require__(90); | ||
17647 | |||
17648 | /** | ||
17649 | * @interface KeyboardEvent | ||
17650 | * @see http://www.w3.org/TR/DOM-Level-3-Events/ | ||
17651 | */ | ||
17652 | var KeyboardEventInterface = { | ||
17653 | key: getEventKey, | ||
17654 | location: null, | ||
17655 | ctrlKey: null, | ||
17656 | shiftKey: null, | ||
17657 | altKey: null, | ||
17658 | metaKey: null, | ||
17659 | repeat: null, | ||
17660 | locale: null, | ||
17661 | getModifierState: getEventModifierState, | ||
17662 | // Legacy Interface | ||
17663 | charCode: function (event) { | ||
17664 | // `charCode` is the result of a KeyPress event and represents the value of | ||
17665 | // the actual printable character. | ||
17666 | |||
17667 | // KeyPress is deprecated, but its replacement is not yet final and not | ||
17668 | // implemented in any major browser. Only KeyPress has charCode. | ||
17669 | if (event.type === 'keypress') { | ||
17670 | return getEventCharCode(event); | ||
17671 | } | ||
17672 | return 0; | ||
17673 | }, | ||
17674 | keyCode: function (event) { | ||
17675 | // `keyCode` is the result of a KeyDown/Up event and represents the value of | ||
17676 | // physical keyboard key. | ||
17677 | |||
17678 | // The actual meaning of the value depends on the users' keyboard layout | ||
17679 | // which cannot be detected. Assuming that it is a US keyboard layout | ||
17680 | // provides a surprisingly accurate mapping for US and European users. | ||
17681 | // Due to this, it is left to the user to implement at this time. | ||
17682 | if (event.type === 'keydown' || event.type === 'keyup') { | ||
17683 | return event.keyCode; | ||
17684 | } | ||
17685 | return 0; | ||
17686 | }, | ||
17687 | which: function (event) { | ||
17688 | // `which` is an alias for either `keyCode` or `charCode` depending on the | ||
17689 | // type of the event. | ||
17690 | if (event.type === 'keypress') { | ||
17691 | return getEventCharCode(event); | ||
17692 | } | ||
17693 | if (event.type === 'keydown' || event.type === 'keyup') { | ||
17694 | return event.keyCode; | ||
17695 | } | ||
17696 | return 0; | ||
17697 | } | ||
17698 | }; | ||
17699 | |||
17700 | /** | ||
17701 | * @param {object} dispatchConfig Configuration used to dispatch this event. | ||
17702 | * @param {string} dispatchMarker Marker identifying the event target. | ||
17703 | * @param {object} nativeEvent Native browser event. | ||
17704 | * @extends {SyntheticUIEvent} | ||
17705 | */ | ||
17706 | function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | ||
17707 | SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | ||
17708 | } | ||
17709 | |||
17710 | SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface); | ||
17711 | |||
17712 | module.exports = SyntheticKeyboardEvent; | ||
17713 | |||
17714 | /***/ }, | ||
17715 | /* 138 */ | ||
17716 | /***/ function(module, exports) { | ||
17717 | |||
17718 | /** | ||
17719 | * Copyright 2013-2015, Facebook, Inc. | ||
17720 | * All rights reserved. | ||
17721 | * | ||
17722 | * This source code is licensed under the BSD-style license found in the | ||
17723 | * LICENSE file in the root directory of this source tree. An additional grant | ||
17724 | * of patent rights can be found in the PATENTS file in the same directory. | ||
17725 | * | ||
17726 | * @providesModule getEventCharCode | ||
17727 | * @typechecks static-only | ||
17728 | */ | ||
17729 | |||
17730 | 'use strict'; | ||
17731 | |||
17732 | /** | ||
17733 | * `charCode` represents the actual "character code" and is safe to use with | ||
17734 | * `String.fromCharCode`. As such, only keys that correspond to printable | ||
17735 | * characters produce a valid `charCode`, the only exception to this is Enter. | ||
17736 | * The Tab-key is considered non-printable and does not have a `charCode`, | ||
17737 | * presumably because it does not produce a tab-character in browsers. | ||
17738 | * | ||
17739 | * @param {object} nativeEvent Native browser event. | ||
17740 | * @return {number} Normalized `charCode` property. | ||
17741 | */ | ||
17742 | function getEventCharCode(nativeEvent) { | ||
17743 | var charCode; | ||
17744 | var keyCode = nativeEvent.keyCode; | ||
17745 | |||
17746 | if ('charCode' in nativeEvent) { | ||
17747 | charCode = nativeEvent.charCode; | ||
17748 | |||
17749 | // FF does not set `charCode` for the Enter-key, check against `keyCode`. | ||
17750 | if (charCode === 0 && keyCode === 13) { | ||
17751 | charCode = 13; | ||
17752 | } | ||
17753 | } else { | ||
17754 | // IE8 does not implement `charCode`, but `keyCode` has the correct value. | ||
17755 | charCode = keyCode; | ||
17756 | } | ||
17757 | |||
17758 | // Some non-printable keys are reported in `charCode`/`keyCode`, discard them. | ||
17759 | // Must not discard the (non-)printable Enter-key. | ||
17760 | if (charCode >= 32 || charCode === 13) { | ||
17761 | return charCode; | ||
17762 | } | ||
17763 | |||
17764 | return 0; | ||
17765 | } | ||
17766 | |||
17767 | module.exports = getEventCharCode; | ||
17768 | |||
17769 | /***/ }, | ||
17770 | /* 139 */ | ||
17771 | /***/ function(module, exports, __webpack_require__) { | ||
17772 | |||
17773 | /** | ||
17774 | * Copyright 2013-2015, Facebook, Inc. | ||
17775 | * All rights reserved. | ||
17776 | * | ||
17777 | * This source code is licensed under the BSD-style license found in the | ||
17778 | * LICENSE file in the root directory of this source tree. An additional grant | ||
17779 | * of patent rights can be found in the PATENTS file in the same directory. | ||
17780 | * | ||
17781 | * @providesModule getEventKey | ||
17782 | * @typechecks static-only | ||
17783 | */ | ||
17784 | |||
17785 | 'use strict'; | ||
17786 | |||
17787 | var getEventCharCode = __webpack_require__(138); | ||
17788 | |||
17789 | /** | ||
17790 | * Normalization of deprecated HTML5 `key` values | ||
17791 | * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names | ||
17792 | */ | ||
17793 | var normalizeKey = { | ||
17794 | 'Esc': 'Escape', | ||
17795 | 'Spacebar': ' ', | ||
17796 | 'Left': 'ArrowLeft', | ||
17797 | 'Up': 'ArrowUp', | ||
17798 | 'Right': 'ArrowRight', | ||
17799 | 'Down': 'ArrowDown', | ||
17800 | 'Del': 'Delete', | ||
17801 | 'Win': 'OS', | ||
17802 | 'Menu': 'ContextMenu', | ||
17803 | 'Apps': 'ContextMenu', | ||
17804 | 'Scroll': 'ScrollLock', | ||
17805 | 'MozPrintableKey': 'Unidentified' | ||
17806 | }; | ||
17807 | |||
17808 | /** | ||
17809 | * Translation from legacy `keyCode` to HTML5 `key` | ||
17810 | * Only special keys supported, all others depend on keyboard layout or browser | ||
17811 | * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names | ||
17812 | */ | ||
17813 | var translateToKey = { | ||
17814 | 8: 'Backspace', | ||
17815 | 9: 'Tab', | ||
17816 | 12: 'Clear', | ||
17817 | 13: 'Enter', | ||
17818 | 16: 'Shift', | ||
17819 | 17: 'Control', | ||
17820 | 18: 'Alt', | ||
17821 | 19: 'Pause', | ||
17822 | 20: 'CapsLock', | ||
17823 | 27: 'Escape', | ||
17824 | 32: ' ', | ||
17825 | 33: 'PageUp', | ||
17826 | 34: 'PageDown', | ||
17827 | 35: 'End', | ||
17828 | 36: 'Home', | ||
17829 | 37: 'ArrowLeft', | ||
17830 | 38: 'ArrowUp', | ||
17831 | 39: 'ArrowRight', | ||
17832 | 40: 'ArrowDown', | ||
17833 | 45: 'Insert', | ||
17834 | 46: 'Delete', | ||
17835 | 112: 'F1', 113: 'F2', 114: 'F3', 115: 'F4', 116: 'F5', 117: 'F6', | ||
17836 | 118: 'F7', 119: 'F8', 120: 'F9', 121: 'F10', 122: 'F11', 123: 'F12', | ||
17837 | 144: 'NumLock', | ||
17838 | 145: 'ScrollLock', | ||
17839 | 224: 'Meta' | ||
17840 | }; | ||
17841 | |||
17842 | /** | ||
17843 | * @param {object} nativeEvent Native browser event. | ||
17844 | * @return {string} Normalized `key` property. | ||
17845 | */ | ||
17846 | function getEventKey(nativeEvent) { | ||
17847 | if (nativeEvent.key) { | ||
17848 | // Normalize inconsistent values reported by browsers due to | ||
17849 | // implementations of a working draft specification. | ||
17850 | |||
17851 | // FireFox implements `key` but returns `MozPrintableKey` for all | ||
17852 | // printable characters (normalized to `Unidentified`), ignore it. | ||
17853 | var key = normalizeKey[nativeEvent.key] || nativeEvent.key; | ||
17854 | if (key !== 'Unidentified') { | ||
17855 | return key; | ||
17856 | } | ||
17857 | } | ||
17858 | |||
17859 | // Browser does not implement `key`, polyfill as much of it as we can. | ||
17860 | if (nativeEvent.type === 'keypress') { | ||
17861 | var charCode = getEventCharCode(nativeEvent); | ||
17862 | |||
17863 | // The enter-key is technically both printable and non-printable and can | ||
17864 | // thus be captured by `keypress`, no other non-printable key should. | ||
17865 | return charCode === 13 ? 'Enter' : String.fromCharCode(charCode); | ||
17866 | } | ||
17867 | if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') { | ||
17868 | // While user keyboard layout determines the actual meaning of each | ||
17869 | // `keyCode` value, almost all function keys have a universal value. | ||
17870 | return translateToKey[nativeEvent.keyCode] || 'Unidentified'; | ||
17871 | } | ||
17872 | return ''; | ||
17873 | } | ||
17874 | |||
17875 | module.exports = getEventKey; | ||
17876 | |||
17877 | /***/ }, | ||
17878 | /* 140 */ | ||
17879 | /***/ function(module, exports, __webpack_require__) { | ||
17880 | |||
17881 | /** | ||
17882 | * Copyright 2013-2015, Facebook, Inc. | ||
17883 | * All rights reserved. | ||
17884 | * | ||
17885 | * This source code is licensed under the BSD-style license found in the | ||
17886 | * LICENSE file in the root directory of this source tree. An additional grant | ||
17887 | * of patent rights can be found in the PATENTS file in the same directory. | ||
17888 | * | ||
17889 | * @providesModule SyntheticDragEvent | ||
17890 | * @typechecks static-only | ||
17891 | */ | ||
17892 | |||
17893 | 'use strict'; | ||
17894 | |||
17895 | var SyntheticMouseEvent = __webpack_require__(88); | ||
17896 | |||
17897 | /** | ||
17898 | * @interface DragEvent | ||
17899 | * @see http://www.w3.org/TR/DOM-Level-3-Events/ | ||
17900 | */ | ||
17901 | var DragEventInterface = { | ||
17902 | dataTransfer: null | ||
17903 | }; | ||
17904 | |||
17905 | /** | ||
17906 | * @param {object} dispatchConfig Configuration used to dispatch this event. | ||
17907 | * @param {string} dispatchMarker Marker identifying the event target. | ||
17908 | * @param {object} nativeEvent Native browser event. | ||
17909 | * @extends {SyntheticUIEvent} | ||
17910 | */ | ||
17911 | function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | ||
17912 | SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | ||
17913 | } | ||
17914 | |||
17915 | SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface); | ||
17916 | |||
17917 | module.exports = SyntheticDragEvent; | ||
17918 | |||
17919 | /***/ }, | ||
17920 | /* 141 */ | ||
17921 | /***/ function(module, exports, __webpack_require__) { | ||
17922 | |||
17923 | /** | ||
17924 | * Copyright 2013-2015, Facebook, Inc. | ||
17925 | * All rights reserved. | ||
17926 | * | ||
17927 | * This source code is licensed under the BSD-style license found in the | ||
17928 | * LICENSE file in the root directory of this source tree. An additional grant | ||
17929 | * of patent rights can be found in the PATENTS file in the same directory. | ||
17930 | * | ||
17931 | * @providesModule SyntheticTouchEvent | ||
17932 | * @typechecks static-only | ||
17933 | */ | ||
17934 | |||
17935 | 'use strict'; | ||
17936 | |||
17937 | var SyntheticUIEvent = __webpack_require__(89); | ||
17938 | |||
17939 | var getEventModifierState = __webpack_require__(90); | ||
17940 | |||
17941 | /** | ||
17942 | * @interface TouchEvent | ||
17943 | * @see http://www.w3.org/TR/touch-events/ | ||
17944 | */ | ||
17945 | var TouchEventInterface = { | ||
17946 | touches: null, | ||
17947 | targetTouches: null, | ||
17948 | changedTouches: null, | ||
17949 | altKey: null, | ||
17950 | metaKey: null, | ||
17951 | ctrlKey: null, | ||
17952 | shiftKey: null, | ||
17953 | getModifierState: getEventModifierState | ||
17954 | }; | ||
17955 | |||
17956 | /** | ||
17957 | * @param {object} dispatchConfig Configuration used to dispatch this event. | ||
17958 | * @param {string} dispatchMarker Marker identifying the event target. | ||
17959 | * @param {object} nativeEvent Native browser event. | ||
17960 | * @extends {SyntheticUIEvent} | ||
17961 | */ | ||
17962 | function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | ||
17963 | SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | ||
17964 | } | ||
17965 | |||
17966 | SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface); | ||
17967 | |||
17968 | module.exports = SyntheticTouchEvent; | ||
17969 | |||
17970 | /***/ }, | ||
17971 | /* 142 */ | ||
17972 | /***/ function(module, exports, __webpack_require__) { | ||
17973 | |||
17974 | /** | ||
17975 | * Copyright 2013-2015, Facebook, Inc. | ||
17976 | * All rights reserved. | ||
17977 | * | ||
17978 | * This source code is licensed under the BSD-style license found in the | ||
17979 | * LICENSE file in the root directory of this source tree. An additional grant | ||
17980 | * of patent rights can be found in the PATENTS file in the same directory. | ||
17981 | * | ||
17982 | * @providesModule SyntheticWheelEvent | ||
17983 | * @typechecks static-only | ||
17984 | */ | ||
17985 | |||
17986 | 'use strict'; | ||
17987 | |||
17988 | var SyntheticMouseEvent = __webpack_require__(88); | ||
17989 | |||
17990 | /** | ||
17991 | * @interface WheelEvent | ||
17992 | * @see http://www.w3.org/TR/DOM-Level-3-Events/ | ||
17993 | */ | ||
17994 | var WheelEventInterface = { | ||
17995 | deltaX: function (event) { | ||
17996 | return 'deltaX' in event ? event.deltaX : | ||
17997 | // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive). | ||
17998 | 'wheelDeltaX' in event ? -event.wheelDeltaX : 0; | ||
17999 | }, | ||
18000 | deltaY: function (event) { | ||
18001 | return 'deltaY' in event ? event.deltaY : | ||
18002 | // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive). | ||
18003 | 'wheelDeltaY' in event ? -event.wheelDeltaY : | ||
18004 | // Fallback to `wheelDelta` for IE<9 and normalize (down is positive). | ||
18005 | 'wheelDelta' in event ? -event.wheelDelta : 0; | ||
18006 | }, | ||
18007 | deltaZ: null, | ||
18008 | |||
18009 | // Browsers without "deltaMode" is reporting in raw wheel delta where one | ||
18010 | // notch on the scroll is always +/- 120, roughly equivalent to pixels. | ||
18011 | // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or | ||
18012 | // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size. | ||
18013 | deltaMode: null | ||
18014 | }; | ||
18015 | |||
18016 | /** | ||
18017 | * @param {object} dispatchConfig Configuration used to dispatch this event. | ||
18018 | * @param {string} dispatchMarker Marker identifying the event target. | ||
18019 | * @param {object} nativeEvent Native browser event. | ||
18020 | * @extends {SyntheticMouseEvent} | ||
18021 | */ | ||
18022 | function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { | ||
18023 | SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); | ||
18024 | } | ||
18025 | |||
18026 | SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface); | ||
18027 | |||
18028 | module.exports = SyntheticWheelEvent; | ||
18029 | |||
18030 | /***/ }, | ||
18031 | /* 143 */ | ||
18032 | /***/ function(module, exports, __webpack_require__) { | ||
18033 | |||
18034 | /** | ||
18035 | * Copyright 2013-2015, Facebook, Inc. | ||
18036 | * All rights reserved. | ||
18037 | * | ||
18038 | * This source code is licensed under the BSD-style license found in the | ||
18039 | * LICENSE file in the root directory of this source tree. An additional grant | ||
18040 | * of patent rights can be found in the PATENTS file in the same directory. | ||
18041 | * | ||
18042 | * @providesModule SVGDOMPropertyConfig | ||
18043 | */ | ||
18044 | |||
18045 | 'use strict'; | ||
18046 | |||
18047 | var DOMProperty = __webpack_require__(25); | ||
18048 | |||
18049 | var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE; | ||
18050 | |||
18051 | var NS = { | ||
18052 | xlink: 'http://www.w3.org/1999/xlink', | ||
18053 | xml: 'http://www.w3.org/XML/1998/namespace' | ||
18054 | }; | ||
18055 | |||
18056 | var SVGDOMPropertyConfig = { | ||
18057 | Properties: { | ||
18058 | clipPath: MUST_USE_ATTRIBUTE, | ||
18059 | cx: MUST_USE_ATTRIBUTE, | ||
18060 | cy: MUST_USE_ATTRIBUTE, | ||
18061 | d: MUST_USE_ATTRIBUTE, | ||
18062 | dx: MUST_USE_ATTRIBUTE, | ||
18063 | dy: MUST_USE_ATTRIBUTE, | ||
18064 | fill: MUST_USE_ATTRIBUTE, | ||
18065 | fillOpacity: MUST_USE_ATTRIBUTE, | ||
18066 | fontFamily: MUST_USE_ATTRIBUTE, | ||
18067 | fontSize: MUST_USE_ATTRIBUTE, | ||
18068 | fx: MUST_USE_ATTRIBUTE, | ||
18069 | fy: MUST_USE_ATTRIBUTE, | ||
18070 | gradientTransform: MUST_USE_ATTRIBUTE, | ||
18071 | gradientUnits: MUST_USE_ATTRIBUTE, | ||
18072 | markerEnd: MUST_USE_ATTRIBUTE, | ||
18073 | markerMid: MUST_USE_ATTRIBUTE, | ||
18074 | markerStart: MUST_USE_ATTRIBUTE, | ||
18075 | offset: MUST_USE_ATTRIBUTE, | ||
18076 | opacity: MUST_USE_ATTRIBUTE, | ||
18077 | patternContentUnits: MUST_USE_ATTRIBUTE, | ||
18078 | patternUnits: MUST_USE_ATTRIBUTE, | ||
18079 | points: MUST_USE_ATTRIBUTE, | ||
18080 | preserveAspectRatio: MUST_USE_ATTRIBUTE, | ||
18081 | r: MUST_USE_ATTRIBUTE, | ||
18082 | rx: MUST_USE_ATTRIBUTE, | ||
18083 | ry: MUST_USE_ATTRIBUTE, | ||
18084 | spreadMethod: MUST_USE_ATTRIBUTE, | ||
18085 | stopColor: MUST_USE_ATTRIBUTE, | ||
18086 | stopOpacity: MUST_USE_ATTRIBUTE, | ||
18087 | stroke: MUST_USE_ATTRIBUTE, | ||
18088 | strokeDasharray: MUST_USE_ATTRIBUTE, | ||
18089 | strokeLinecap: MUST_USE_ATTRIBUTE, | ||
18090 | strokeOpacity: MUST_USE_ATTRIBUTE, | ||
18091 | strokeWidth: MUST_USE_ATTRIBUTE, | ||
18092 | textAnchor: MUST_USE_ATTRIBUTE, | ||
18093 | transform: MUST_USE_ATTRIBUTE, | ||
18094 | version: MUST_USE_ATTRIBUTE, | ||
18095 | viewBox: MUST_USE_ATTRIBUTE, | ||
18096 | x1: MUST_USE_ATTRIBUTE, | ||
18097 | x2: MUST_USE_ATTRIBUTE, | ||
18098 | x: MUST_USE_ATTRIBUTE, | ||
18099 | xlinkActuate: MUST_USE_ATTRIBUTE, | ||
18100 | xlinkArcrole: MUST_USE_ATTRIBUTE, | ||
18101 | xlinkHref: MUST_USE_ATTRIBUTE, | ||
18102 | xlinkRole: MUST_USE_ATTRIBUTE, | ||
18103 | xlinkShow: MUST_USE_ATTRIBUTE, | ||
18104 | xlinkTitle: MUST_USE_ATTRIBUTE, | ||
18105 | xlinkType: MUST_USE_ATTRIBUTE, | ||
18106 | xmlBase: MUST_USE_ATTRIBUTE, | ||
18107 | xmlLang: MUST_USE_ATTRIBUTE, | ||
18108 | xmlSpace: MUST_USE_ATTRIBUTE, | ||
18109 | y1: MUST_USE_ATTRIBUTE, | ||
18110 | y2: MUST_USE_ATTRIBUTE, | ||
18111 | y: MUST_USE_ATTRIBUTE | ||
18112 | }, | ||
18113 | DOMAttributeNamespaces: { | ||
18114 | xlinkActuate: NS.xlink, | ||
18115 | xlinkArcrole: NS.xlink, | ||
18116 | xlinkHref: NS.xlink, | ||
18117 | xlinkRole: NS.xlink, | ||
18118 | xlinkShow: NS.xlink, | ||
18119 | xlinkTitle: NS.xlink, | ||
18120 | xlinkType: NS.xlink, | ||
18121 | xmlBase: NS.xml, | ||
18122 | xmlLang: NS.xml, | ||
18123 | xmlSpace: NS.xml | ||
18124 | }, | ||
18125 | DOMAttributeNames: { | ||
18126 | clipPath: 'clip-path', | ||
18127 | fillOpacity: 'fill-opacity', | ||
18128 | fontFamily: 'font-family', | ||
18129 | fontSize: 'font-size', | ||
18130 | gradientTransform: 'gradientTransform', | ||
18131 | gradientUnits: 'gradientUnits', | ||
18132 | markerEnd: 'marker-end', | ||
18133 | markerMid: 'marker-mid', | ||
18134 | markerStart: 'marker-start', | ||
18135 | patternContentUnits: 'patternContentUnits', | ||
18136 | patternUnits: 'patternUnits', | ||
18137 | preserveAspectRatio: 'preserveAspectRatio', | ||
18138 | spreadMethod: 'spreadMethod', | ||
18139 | stopColor: 'stop-color', | ||
18140 | stopOpacity: 'stop-opacity', | ||
18141 | strokeDasharray: 'stroke-dasharray', | ||
18142 | strokeLinecap: 'stroke-linecap', | ||
18143 | strokeOpacity: 'stroke-opacity', | ||
18144 | strokeWidth: 'stroke-width', | ||
18145 | textAnchor: 'text-anchor', | ||
18146 | viewBox: 'viewBox', | ||
18147 | xlinkActuate: 'xlink:actuate', | ||
18148 | xlinkArcrole: 'xlink:arcrole', | ||
18149 | xlinkHref: 'xlink:href', | ||
18150 | xlinkRole: 'xlink:role', | ||
18151 | xlinkShow: 'xlink:show', | ||
18152 | xlinkTitle: 'xlink:title', | ||
18153 | xlinkType: 'xlink:type', | ||
18154 | xmlBase: 'xml:base', | ||
18155 | xmlLang: 'xml:lang', | ||
18156 | xmlSpace: 'xml:space' | ||
18157 | } | ||
18158 | }; | ||
18159 | |||
18160 | module.exports = SVGDOMPropertyConfig; | ||
18161 | |||
18162 | /***/ }, | ||
18163 | /* 144 */ | ||
18164 | /***/ function(module, exports, __webpack_require__) { | ||
18165 | |||
18166 | /** | ||
18167 | * Copyright 2013-2015, Facebook, Inc. | ||
18168 | * All rights reserved. | ||
18169 | * | ||
18170 | * This source code is licensed under the BSD-style license found in the | ||
18171 | * LICENSE file in the root directory of this source tree. An additional grant | ||
18172 | * of patent rights can be found in the PATENTS file in the same directory. | ||
18173 | * | ||
18174 | * @providesModule ReactDefaultPerf | ||
18175 | * @typechecks static-only | ||
18176 | */ | ||
18177 | |||
18178 | 'use strict'; | ||
18179 | |||
18180 | var DOMProperty = __webpack_require__(25); | ||
18181 | var ReactDefaultPerfAnalysis = __webpack_require__(145); | ||
18182 | var ReactMount = __webpack_require__(30); | ||
18183 | var ReactPerf = __webpack_require__(20); | ||
18184 | |||
18185 | var performanceNow = __webpack_require__(146); | ||
18186 | |||
18187 | function roundFloat(val) { | ||
18188 | return Math.floor(val * 100) / 100; | ||
18189 | } | ||
18190 | |||
18191 | function addValue(obj, key, val) { | ||
18192 | obj[key] = (obj[key] || 0) + val; | ||
18193 | } | ||
18194 | |||
18195 | var ReactDefaultPerf = { | ||
18196 | _allMeasurements: [], // last item in the list is the current one | ||
18197 | _mountStack: [0], | ||
18198 | _injected: false, | ||
18199 | |||
18200 | start: function () { | ||
18201 | if (!ReactDefaultPerf._injected) { | ||
18202 | ReactPerf.injection.injectMeasure(ReactDefaultPerf.measure); | ||
18203 | } | ||
18204 | |||
18205 | ReactDefaultPerf._allMeasurements.length = 0; | ||
18206 | ReactPerf.enableMeasure = true; | ||
18207 | }, | ||
18208 | |||
18209 | stop: function () { | ||
18210 | ReactPerf.enableMeasure = false; | ||
18211 | }, | ||
18212 | |||
18213 | getLastMeasurements: function () { | ||
18214 | return ReactDefaultPerf._allMeasurements; | ||
18215 | }, | ||
18216 | |||
18217 | printExclusive: function (measurements) { | ||
18218 | measurements = measurements || ReactDefaultPerf._allMeasurements; | ||
18219 | var summary = ReactDefaultPerfAnalysis.getExclusiveSummary(measurements); | ||
18220 | console.table(summary.map(function (item) { | ||
18221 | return { | ||
18222 | 'Component class name': item.componentName, | ||
18223 | 'Total inclusive time (ms)': roundFloat(item.inclusive), | ||
18224 | 'Exclusive mount time (ms)': roundFloat(item.exclusive), | ||
18225 | 'Exclusive render time (ms)': roundFloat(item.render), | ||
18226 | 'Mount time per instance (ms)': roundFloat(item.exclusive / item.count), | ||
18227 | 'Render time per instance (ms)': roundFloat(item.render / item.count), | ||
18228 | 'Instances': item.count | ||
18229 | }; | ||
18230 | })); | ||
18231 | // TODO: ReactDefaultPerfAnalysis.getTotalTime() does not return the correct | ||
18232 | // number. | ||
18233 | }, | ||
18234 | |||
18235 | printInclusive: function (measurements) { | ||
18236 | measurements = measurements || ReactDefaultPerf._allMeasurements; | ||
18237 | var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements); | ||
18238 | console.table(summary.map(function (item) { | ||
18239 | return { | ||
18240 | 'Owner > component': item.componentName, | ||
18241 | 'Inclusive time (ms)': roundFloat(item.time), | ||
18242 | 'Instances': item.count | ||
18243 | }; | ||
18244 | })); | ||
18245 | console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'); | ||
18246 | }, | ||
18247 | |||
18248 | getMeasurementsSummaryMap: function (measurements) { | ||
18249 | var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements, true); | ||
18250 | return summary.map(function (item) { | ||
18251 | return { | ||
18252 | 'Owner > component': item.componentName, | ||
18253 | 'Wasted time (ms)': item.time, | ||
18254 | 'Instances': item.count | ||
18255 | }; | ||
18256 | }); | ||
18257 | }, | ||
18258 | |||
18259 | printWasted: function (measurements) { | ||
18260 | measurements = measurements || ReactDefaultPerf._allMeasurements; | ||
18261 | console.table(ReactDefaultPerf.getMeasurementsSummaryMap(measurements)); | ||
18262 | console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'); | ||
18263 | }, | ||
18264 | |||
18265 | printDOM: function (measurements) { | ||
18266 | measurements = measurements || ReactDefaultPerf._allMeasurements; | ||
18267 | var summary = ReactDefaultPerfAnalysis.getDOMSummary(measurements); | ||
18268 | console.table(summary.map(function (item) { | ||
18269 | var result = {}; | ||
18270 | result[DOMProperty.ID_ATTRIBUTE_NAME] = item.id; | ||
18271 | result.type = item.type; | ||
18272 | result.args = JSON.stringify(item.args); | ||
18273 | return result; | ||
18274 | })); | ||
18275 | console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'); | ||
18276 | }, | ||
18277 | |||
18278 | _recordWrite: function (id, fnName, totalTime, args) { | ||
18279 | // TODO: totalTime isn't that useful since it doesn't count paints/reflows | ||
18280 | var writes = ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1].writes; | ||
18281 | writes[id] = writes[id] || []; | ||
18282 | writes[id].push({ | ||
18283 | type: fnName, | ||
18284 | time: totalTime, | ||
18285 | args: args | ||
18286 | }); | ||
18287 | }, | ||
18288 | |||
18289 | measure: function (moduleName, fnName, func) { | ||
18290 | return function () { | ||
18291 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
18292 | args[_key] = arguments[_key]; | ||
18293 | } | ||
18294 | |||
18295 | var totalTime; | ||
18296 | var rv; | ||
18297 | var start; | ||
18298 | |||
18299 | if (fnName === '_renderNewRootComponent' || fnName === 'flushBatchedUpdates') { | ||
18300 | // A "measurement" is a set of metrics recorded for each flush. We want | ||
18301 | // to group the metrics for a given flush together so we can look at the | ||
18302 | // components that rendered and the DOM operations that actually | ||
18303 | // happened to determine the amount of "wasted work" performed. | ||
18304 | ReactDefaultPerf._allMeasurements.push({ | ||
18305 | exclusive: {}, | ||
18306 | inclusive: {}, | ||
18307 | render: {}, | ||
18308 | counts: {}, | ||
18309 | writes: {}, | ||
18310 | displayNames: {}, | ||
18311 | totalTime: 0, | ||
18312 | created: {} | ||
18313 | }); | ||
18314 | start = performanceNow(); | ||
18315 | rv = func.apply(this, args); | ||
18316 | ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1].totalTime = performanceNow() - start; | ||
18317 | return rv; | ||
18318 | } else if (fnName === '_mountImageIntoNode' || moduleName === 'ReactBrowserEventEmitter' || moduleName === 'ReactDOMIDOperations' || moduleName === 'CSSPropertyOperations' || moduleName === 'DOMChildrenOperations' || moduleName === 'DOMPropertyOperations') { | ||
18319 | start = performanceNow(); | ||
18320 | rv = func.apply(this, args); | ||
18321 | totalTime = performanceNow() - start; | ||
18322 | |||
18323 | if (fnName === '_mountImageIntoNode') { | ||
18324 | var mountID = ReactMount.getID(args[1]); | ||
18325 | ReactDefaultPerf._recordWrite(mountID, fnName, totalTime, args[0]); | ||
18326 | } else if (fnName === 'dangerouslyProcessChildrenUpdates') { | ||
18327 | // special format | ||
18328 | args[0].forEach(function (update) { | ||
18329 | var writeArgs = {}; | ||
18330 | if (update.fromIndex !== null) { | ||
18331 | writeArgs.fromIndex = update.fromIndex; | ||
18332 | } | ||
18333 | if (update.toIndex !== null) { | ||
18334 | writeArgs.toIndex = update.toIndex; | ||
18335 | } | ||
18336 | if (update.textContent !== null) { | ||
18337 | writeArgs.textContent = update.textContent; | ||
18338 | } | ||
18339 | if (update.markupIndex !== null) { | ||
18340 | writeArgs.markup = args[1][update.markupIndex]; | ||
18341 | } | ||
18342 | ReactDefaultPerf._recordWrite(update.parentID, update.type, totalTime, writeArgs); | ||
18343 | }); | ||
18344 | } else { | ||
18345 | // basic format | ||
18346 | var id = args[0]; | ||
18347 | if (typeof id === 'object') { | ||
18348 | id = ReactMount.getID(args[0]); | ||
18349 | } | ||
18350 | ReactDefaultPerf._recordWrite(id, fnName, totalTime, Array.prototype.slice.call(args, 1)); | ||
18351 | } | ||
18352 | return rv; | ||
18353 | } else if (moduleName === 'ReactCompositeComponent' && (fnName === 'mountComponent' || fnName === 'updateComponent' || // TODO: receiveComponent()? | ||
18354 | fnName === '_renderValidatedComponent')) { | ||
18355 | |||
18356 | if (this._currentElement.type === ReactMount.TopLevelWrapper) { | ||
18357 | return func.apply(this, args); | ||
18358 | } | ||
18359 | |||
18360 | var rootNodeID = fnName === 'mountComponent' ? args[0] : this._rootNodeID; | ||
18361 | var isRender = fnName === '_renderValidatedComponent'; | ||
18362 | var isMount = fnName === 'mountComponent'; | ||
18363 | |||
18364 | var mountStack = ReactDefaultPerf._mountStack; | ||
18365 | var entry = ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1]; | ||
18366 | |||
18367 | if (isRender) { | ||
18368 | addValue(entry.counts, rootNodeID, 1); | ||
18369 | } else if (isMount) { | ||
18370 | entry.created[rootNodeID] = true; | ||
18371 | mountStack.push(0); | ||
18372 | } | ||
18373 | |||
18374 | start = performanceNow(); | ||
18375 | rv = func.apply(this, args); | ||
18376 | totalTime = performanceNow() - start; | ||
18377 | |||
18378 | if (isRender) { | ||
18379 | addValue(entry.render, rootNodeID, totalTime); | ||
18380 | } else if (isMount) { | ||
18381 | var subMountTime = mountStack.pop(); | ||
18382 | mountStack[mountStack.length - 1] += totalTime; | ||
18383 | addValue(entry.exclusive, rootNodeID, totalTime - subMountTime); | ||
18384 | addValue(entry.inclusive, rootNodeID, totalTime); | ||
18385 | } else { | ||
18386 | addValue(entry.inclusive, rootNodeID, totalTime); | ||
18387 | } | ||
18388 | |||
18389 | entry.displayNames[rootNodeID] = { | ||
18390 | current: this.getName(), | ||
18391 | owner: this._currentElement._owner ? this._currentElement._owner.getName() : '<root>' | ||
18392 | }; | ||
18393 | |||
18394 | return rv; | ||
18395 | } else { | ||
18396 | return func.apply(this, args); | ||
18397 | } | ||
18398 | }; | ||
18399 | } | ||
18400 | }; | ||
18401 | |||
18402 | module.exports = ReactDefaultPerf; | ||
18403 | |||
18404 | /***/ }, | ||
18405 | /* 145 */ | ||
18406 | /***/ function(module, exports, __webpack_require__) { | ||
18407 | |||
18408 | /** | ||
18409 | * Copyright 2013-2015, Facebook, Inc. | ||
18410 | * All rights reserved. | ||
18411 | * | ||
18412 | * This source code is licensed under the BSD-style license found in the | ||
18413 | * LICENSE file in the root directory of this source tree. An additional grant | ||
18414 | * of patent rights can be found in the PATENTS file in the same directory. | ||
18415 | * | ||
18416 | * @providesModule ReactDefaultPerfAnalysis | ||
18417 | */ | ||
18418 | |||
18419 | 'use strict'; | ||
18420 | |||
18421 | var assign = __webpack_require__(41); | ||
18422 | |||
18423 | // Don't try to save users less than 1.2ms (a number I made up) | ||
18424 | var DONT_CARE_THRESHOLD = 1.2; | ||
18425 | var DOM_OPERATION_TYPES = { | ||
18426 | '_mountImageIntoNode': 'set innerHTML', | ||
18427 | INSERT_MARKUP: 'set innerHTML', | ||
18428 | MOVE_EXISTING: 'move', | ||
18429 | REMOVE_NODE: 'remove', | ||
18430 | SET_MARKUP: 'set innerHTML', | ||
18431 | TEXT_CONTENT: 'set textContent', | ||
18432 | 'setValueForProperty': 'update attribute', | ||
18433 | 'setValueForAttribute': 'update attribute', | ||
18434 | 'deleteValueForProperty': 'remove attribute', | ||
18435 | 'dangerouslyReplaceNodeWithMarkupByID': 'replace' | ||
18436 | }; | ||
18437 | |||
18438 | function getTotalTime(measurements) { | ||
18439 | // TODO: return number of DOM ops? could be misleading. | ||
18440 | // TODO: measure dropped frames after reconcile? | ||
18441 | // TODO: log total time of each reconcile and the top-level component | ||
18442 | // class that triggered it. | ||
18443 | var totalTime = 0; | ||
18444 | for (var i = 0; i < measurements.length; i++) { | ||
18445 | var measurement = measurements[i]; | ||
18446 | totalTime += measurement.totalTime; | ||
18447 | } | ||
18448 | return totalTime; | ||
18449 | } | ||
18450 | |||
18451 | function getDOMSummary(measurements) { | ||
18452 | var items = []; | ||
18453 | measurements.forEach(function (measurement) { | ||
18454 | Object.keys(measurement.writes).forEach(function (id) { | ||
18455 | measurement.writes[id].forEach(function (write) { | ||
18456 | items.push({ | ||
18457 | id: id, | ||
18458 | type: DOM_OPERATION_TYPES[write.type] || write.type, | ||
18459 | args: write.args | ||
18460 | }); | ||
18461 | }); | ||
18462 | }); | ||
18463 | }); | ||
18464 | return items; | ||
18465 | } | ||
18466 | |||
18467 | function getExclusiveSummary(measurements) { | ||
18468 | var candidates = {}; | ||
18469 | var displayName; | ||
18470 | |||
18471 | for (var i = 0; i < measurements.length; i++) { | ||
18472 | var measurement = measurements[i]; | ||
18473 | var allIDs = assign({}, measurement.exclusive, measurement.inclusive); | ||
18474 | |||
18475 | for (var id in allIDs) { | ||
18476 | displayName = measurement.displayNames[id].current; | ||
18477 | |||
18478 | candidates[displayName] = candidates[displayName] || { | ||
18479 | componentName: displayName, | ||
18480 | inclusive: 0, | ||
18481 | exclusive: 0, | ||
18482 | render: 0, | ||
18483 | count: 0 | ||
18484 | }; | ||
18485 | if (measurement.render[id]) { | ||
18486 | candidates[displayName].render += measurement.render[id]; | ||
18487 | } | ||
18488 | if (measurement.exclusive[id]) { | ||
18489 | candidates[displayName].exclusive += measurement.exclusive[id]; | ||
18490 | } | ||
18491 | if (measurement.inclusive[id]) { | ||
18492 | candidates[displayName].inclusive += measurement.inclusive[id]; | ||
18493 | } | ||
18494 | if (measurement.counts[id]) { | ||
18495 | candidates[displayName].count += measurement.counts[id]; | ||
18496 | } | ||
18497 | } | ||
18498 | } | ||
18499 | |||
18500 | // Now make a sorted array with the results. | ||
18501 | var arr = []; | ||
18502 | for (displayName in candidates) { | ||
18503 | if (candidates[displayName].exclusive >= DONT_CARE_THRESHOLD) { | ||
18504 | arr.push(candidates[displayName]); | ||
18505 | } | ||
18506 | } | ||
18507 | |||
18508 | arr.sort(function (a, b) { | ||
18509 | return b.exclusive - a.exclusive; | ||
18510 | }); | ||
18511 | |||
18512 | return arr; | ||
18513 | } | ||
18514 | |||
18515 | function getInclusiveSummary(measurements, onlyClean) { | ||
18516 | var candidates = {}; | ||
18517 | var inclusiveKey; | ||
18518 | |||
18519 | for (var i = 0; i < measurements.length; i++) { | ||
18520 | var measurement = measurements[i]; | ||
18521 | var allIDs = assign({}, measurement.exclusive, measurement.inclusive); | ||
18522 | var cleanComponents; | ||
18523 | |||
18524 | if (onlyClean) { | ||
18525 | cleanComponents = getUnchangedComponents(measurement); | ||
18526 | } | ||
18527 | |||
18528 | for (var id in allIDs) { | ||
18529 | if (onlyClean && !cleanComponents[id]) { | ||
18530 | continue; | ||
18531 | } | ||
18532 | |||
18533 | var displayName = measurement.displayNames[id]; | ||
18534 | |||
18535 | // Inclusive time is not useful for many components without knowing where | ||
18536 | // they are instantiated. So we aggregate inclusive time with both the | ||
18537 | // owner and current displayName as the key. | ||
18538 | inclusiveKey = displayName.owner + ' > ' + displayName.current; | ||
18539 | |||
18540 | candidates[inclusiveKey] = candidates[inclusiveKey] || { | ||
18541 | componentName: inclusiveKey, | ||
18542 | time: 0, | ||
18543 | count: 0 | ||
18544 | }; | ||
18545 | |||
18546 | if (measurement.inclusive[id]) { | ||
18547 | candidates[inclusiveKey].time += measurement.inclusive[id]; | ||
18548 | } | ||
18549 | if (measurement.counts[id]) { | ||
18550 | candidates[inclusiveKey].count += measurement.counts[id]; | ||
18551 | } | ||
18552 | } | ||
18553 | } | ||
18554 | |||
18555 | // Now make a sorted array with the results. | ||
18556 | var arr = []; | ||
18557 | for (inclusiveKey in candidates) { | ||
18558 | if (candidates[inclusiveKey].time >= DONT_CARE_THRESHOLD) { | ||
18559 | arr.push(candidates[inclusiveKey]); | ||
18560 | } | ||
18561 | } | ||
18562 | |||
18563 | arr.sort(function (a, b) { | ||
18564 | return b.time - a.time; | ||
18565 | }); | ||
18566 | |||
18567 | return arr; | ||
18568 | } | ||
18569 | |||
18570 | function getUnchangedComponents(measurement) { | ||
18571 | // For a given reconcile, look at which components did not actually | ||
18572 | // render anything to the DOM and return a mapping of their ID to | ||
18573 | // the amount of time it took to render the entire subtree. | ||
18574 | var cleanComponents = {}; | ||
18575 | var dirtyLeafIDs = Object.keys(measurement.writes); | ||
18576 | var allIDs = assign({}, measurement.exclusive, measurement.inclusive); | ||
18577 | |||
18578 | for (var id in allIDs) { | ||
18579 | var isDirty = false; | ||
18580 | // For each component that rendered, see if a component that triggered | ||
18581 | // a DOM op is in its subtree. | ||
18582 | for (var i = 0; i < dirtyLeafIDs.length; i++) { | ||
18583 | if (dirtyLeafIDs[i].indexOf(id) === 0) { | ||
18584 | isDirty = true; | ||
18585 | break; | ||
18586 | } | ||
18587 | } | ||
18588 | // check if component newly created | ||
18589 | if (measurement.created[id]) { | ||
18590 | isDirty = true; | ||
18591 | } | ||
18592 | if (!isDirty && measurement.counts[id] > 0) { | ||
18593 | cleanComponents[id] = true; | ||
18594 | } | ||
18595 | } | ||
18596 | return cleanComponents; | ||
18597 | } | ||
18598 | |||
18599 | var ReactDefaultPerfAnalysis = { | ||
18600 | getExclusiveSummary: getExclusiveSummary, | ||
18601 | getInclusiveSummary: getInclusiveSummary, | ||
18602 | getDOMSummary: getDOMSummary, | ||
18603 | getTotalTime: getTotalTime | ||
18604 | }; | ||
18605 | |||
18606 | module.exports = ReactDefaultPerfAnalysis; | ||
18607 | |||
18608 | /***/ }, | ||
18609 | /* 146 */ | ||
18610 | /***/ function(module, exports, __webpack_require__) { | ||
18611 | |||
18612 | /** | ||
18613 | * Copyright 2013-2015, Facebook, Inc. | ||
18614 | * All rights reserved. | ||
18615 | * | ||
18616 | * This source code is licensed under the BSD-style license found in the | ||
18617 | * LICENSE file in the root directory of this source tree. An additional grant | ||
18618 | * of patent rights can be found in the PATENTS file in the same directory. | ||
18619 | * | ||
18620 | * @providesModule performanceNow | ||
18621 | * @typechecks | ||
18622 | */ | ||
18623 | |||
18624 | 'use strict'; | ||
18625 | |||
18626 | var performance = __webpack_require__(147); | ||
18627 | var curPerformance = performance; | ||
18628 | |||
18629 | /** | ||
18630 | * Detect if we can use `window.performance.now()` and gracefully fallback to | ||
18631 | * `Date.now()` if it doesn't exist. We need to support Firefox < 15 for now | ||
18632 | * because of Facebook's testing infrastructure. | ||
18633 | */ | ||
18634 | if (!curPerformance || !curPerformance.now) { | ||
18635 | curPerformance = Date; | ||
18636 | } | ||
18637 | |||
18638 | var performanceNow = curPerformance.now.bind(curPerformance); | ||
18639 | |||
18640 | module.exports = performanceNow; | ||
18641 | |||
18642 | /***/ }, | ||
18643 | /* 147 */ | ||
18644 | /***/ function(module, exports, __webpack_require__) { | ||
18645 | |||
18646 | /** | ||
18647 | * Copyright 2013-2015, Facebook, Inc. | ||
18648 | * All rights reserved. | ||
18649 | * | ||
18650 | * This source code is licensed under the BSD-style license found in the | ||
18651 | * LICENSE file in the root directory of this source tree. An additional grant | ||
18652 | * of patent rights can be found in the PATENTS file in the same directory. | ||
18653 | * | ||
18654 | * @providesModule performance | ||
18655 | * @typechecks | ||
18656 | */ | ||
18657 | |||
18658 | 'use strict'; | ||
18659 | |||
18660 | var ExecutionEnvironment = __webpack_require__(11); | ||
18661 | |||
18662 | var performance; | ||
18663 | |||
18664 | if (ExecutionEnvironment.canUseDOM) { | ||
18665 | performance = window.performance || window.msPerformance || window.webkitPerformance; | ||
18666 | } | ||
18667 | |||
18668 | module.exports = performance || {}; | ||
18669 | |||
18670 | /***/ }, | ||
18671 | /* 148 */ | ||
18672 | /***/ function(module, exports) { | ||
18673 | |||
18674 | /** | ||
18675 | * Copyright 2013-2015, Facebook, Inc. | ||
18676 | * All rights reserved. | ||
18677 | * | ||
18678 | * This source code is licensed under the BSD-style license found in the | ||
18679 | * LICENSE file in the root directory of this source tree. An additional grant | ||
18680 | * of patent rights can be found in the PATENTS file in the same directory. | ||
18681 | * | ||
18682 | * @providesModule ReactVersion | ||
18683 | */ | ||
18684 | |||
18685 | 'use strict'; | ||
18686 | |||
18687 | module.exports = '0.14.3'; | ||
18688 | |||
18689 | /***/ }, | ||
18690 | /* 149 */ | ||
18691 | /***/ function(module, exports, __webpack_require__) { | ||
18692 | |||
18693 | /** | ||
18694 | * Copyright 2013-2015, Facebook, Inc. | ||
18695 | * All rights reserved. | ||
18696 | * | ||
18697 | * This source code is licensed under the BSD-style license found in the | ||
18698 | * LICENSE file in the root directory of this source tree. An additional grant | ||
18699 | * of patent rights can be found in the PATENTS file in the same directory. | ||
18700 | * | ||
18701 | * @providesModule renderSubtreeIntoContainer | ||
18702 | */ | ||
18703 | |||
18704 | 'use strict'; | ||
18705 | |||
18706 | var ReactMount = __webpack_require__(30); | ||
18707 | |||
18708 | module.exports = ReactMount.renderSubtreeIntoContainer; | ||
18709 | |||
18710 | /***/ }, | ||
18711 | /* 150 */ | ||
18712 | /***/ function(module, exports, __webpack_require__) { | ||
18713 | |||
18714 | /** | ||
18715 | * Copyright 2013-2015, Facebook, Inc. | ||
18716 | * All rights reserved. | ||
18717 | * | ||
18718 | * This source code is licensed under the BSD-style license found in the | ||
18719 | * LICENSE file in the root directory of this source tree. An additional grant | ||
18720 | * of patent rights can be found in the PATENTS file in the same directory. | ||
18721 | * | ||
18722 | * @providesModule ReactDOMServer | ||
18723 | */ | ||
18724 | |||
18725 | 'use strict'; | ||
18726 | |||
18727 | var ReactDefaultInjection = __webpack_require__(73); | ||
18728 | var ReactServerRendering = __webpack_require__(151); | ||
18729 | var ReactVersion = __webpack_require__(148); | ||
18730 | |||
18731 | ReactDefaultInjection.inject(); | ||
18732 | |||
18733 | var ReactDOMServer = { | ||
18734 | renderToString: ReactServerRendering.renderToString, | ||
18735 | renderToStaticMarkup: ReactServerRendering.renderToStaticMarkup, | ||
18736 | version: ReactVersion | ||
18737 | }; | ||
18738 | |||
18739 | module.exports = ReactDOMServer; | ||
18740 | |||
18741 | /***/ }, | ||
18742 | /* 151 */ | ||
18743 | /***/ function(module, exports, __webpack_require__) { | ||
18744 | |||
18745 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
18746 | * Copyright 2013-2015, Facebook, Inc. | ||
18747 | * All rights reserved. | ||
18748 | * | ||
18749 | * 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 | ||
18751 | * of patent rights can be found in the PATENTS file in the same directory. | ||
18752 | * | ||
18753 | * @typechecks static-only | ||
18754 | * @providesModule ReactServerRendering | ||
18755 | */ | ||
18756 | 'use strict'; | ||
18757 | |||
18758 | var ReactDefaultBatchingStrategy = __webpack_require__(94); | ||
18759 | var ReactElement = __webpack_require__(44); | ||
18760 | var ReactInstanceHandles = __webpack_require__(47); | ||
18761 | var ReactMarkupChecksum = __webpack_require__(50); | ||
18762 | var ReactServerBatchingStrategy = __webpack_require__(152); | ||
18763 | var ReactServerRenderingTransaction = __webpack_require__(153); | ||
18764 | var ReactUpdates = __webpack_require__(56); | ||
18765 | |||
18766 | var emptyObject = __webpack_require__(60); | ||
18767 | var instantiateReactComponent = __webpack_require__(64); | ||
18768 | var invariant = __webpack_require__(15); | ||
18769 | |||
18770 | /** | ||
18771 | * @param {ReactElement} element | ||
18772 | * @return {string} the HTML markup | ||
18773 | */ | ||
18774 | function renderToString(element) { | ||
18775 | !ReactElement.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'renderToString(): You must pass a valid ReactElement.') : invariant(false) : undefined; | ||
18776 | |||
18777 | var transaction; | ||
18778 | try { | ||
18779 | ReactUpdates.injection.injectBatchingStrategy(ReactServerBatchingStrategy); | ||
18780 | |||
18781 | var id = ReactInstanceHandles.createReactRootID(); | ||
18782 | transaction = ReactServerRenderingTransaction.getPooled(false); | ||
18783 | |||
18784 | return transaction.perform(function () { | ||
18785 | var componentInstance = instantiateReactComponent(element, null); | ||
18786 | var markup = componentInstance.mountComponent(id, transaction, emptyObject); | ||
18787 | return ReactMarkupChecksum.addChecksumToMarkup(markup); | ||
18788 | }, null); | ||
18789 | } finally { | ||
18790 | ReactServerRenderingTransaction.release(transaction); | ||
18791 | // Revert to the DOM batching strategy since these two renderers | ||
18792 | // currently share these stateful modules. | ||
18793 | ReactUpdates.injection.injectBatchingStrategy(ReactDefaultBatchingStrategy); | ||
18794 | } | ||
18795 | } | ||
18796 | |||
18797 | /** | ||
18798 | * @param {ReactElement} element | ||
18799 | * @return {string} the HTML markup, without the extra React ID and checksum | ||
18800 | * (for generating static pages) | ||
18801 | */ | ||
18802 | function renderToStaticMarkup(element) { | ||
18803 | !ReactElement.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'renderToStaticMarkup(): You must pass a valid ReactElement.') : invariant(false) : undefined; | ||
18804 | |||
18805 | var transaction; | ||
18806 | try { | ||
18807 | ReactUpdates.injection.injectBatchingStrategy(ReactServerBatchingStrategy); | ||
18808 | |||
18809 | var id = ReactInstanceHandles.createReactRootID(); | ||
18810 | transaction = ReactServerRenderingTransaction.getPooled(true); | ||
18811 | |||
18812 | return transaction.perform(function () { | ||
18813 | var componentInstance = instantiateReactComponent(element, null); | ||
18814 | return componentInstance.mountComponent(id, transaction, emptyObject); | ||
18815 | }, null); | ||
18816 | } finally { | ||
18817 | ReactServerRenderingTransaction.release(transaction); | ||
18818 | // Revert to the DOM batching strategy since these two renderers | ||
18819 | // currently share these stateful modules. | ||
18820 | ReactUpdates.injection.injectBatchingStrategy(ReactDefaultBatchingStrategy); | ||
18821 | } | ||
18822 | } | ||
18823 | |||
18824 | module.exports = { | ||
18825 | renderToString: renderToString, | ||
18826 | renderToStaticMarkup: renderToStaticMarkup | ||
18827 | }; | ||
18828 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
18829 | |||
18830 | /***/ }, | ||
18831 | /* 152 */ | ||
18832 | /***/ function(module, exports) { | ||
18833 | |||
18834 | /** | ||
18835 | * Copyright 2014-2015, 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 | * @providesModule ReactServerBatchingStrategy | ||
18843 | * @typechecks | ||
18844 | */ | ||
18845 | |||
18846 | 'use strict'; | ||
18847 | |||
18848 | var ReactServerBatchingStrategy = { | ||
18849 | isBatchingUpdates: false, | ||
18850 | batchedUpdates: function (callback) { | ||
18851 | // Don't do anything here. During the server rendering we don't want to | ||
18852 | // schedule any updates. We will simply ignore them. | ||
18853 | } | ||
18854 | }; | ||
18855 | |||
18856 | module.exports = ReactServerBatchingStrategy; | ||
18857 | |||
18858 | /***/ }, | ||
18859 | /* 153 */ | ||
18860 | /***/ function(module, exports, __webpack_require__) { | ||
18861 | |||
18862 | /** | ||
18863 | * Copyright 2014-2015, Facebook, Inc. | ||
18864 | * All rights reserved. | ||
18865 | * | ||
18866 | * This source code is licensed under the BSD-style license found in the | ||
18867 | * LICENSE file in the root directory of this source tree. An additional grant | ||
18868 | * of patent rights can be found in the PATENTS file in the same directory. | ||
18869 | * | ||
18870 | * @providesModule ReactServerRenderingTransaction | ||
18871 | * @typechecks | ||
18872 | */ | ||
18873 | |||
18874 | 'use strict'; | ||
18875 | |||
18876 | var PooledClass = __webpack_require__(58); | ||
18877 | var CallbackQueue = __webpack_require__(57); | ||
18878 | var Transaction = __webpack_require__(59); | ||
18879 | |||
18880 | var assign = __webpack_require__(41); | ||
18881 | var emptyFunction = __webpack_require__(17); | ||
18882 | |||
18883 | /** | ||
18884 | * Provides a `CallbackQueue` queue for collecting `onDOMReady` callbacks | ||
18885 | * during the performing of the transaction. | ||
18886 | */ | ||
18887 | var ON_DOM_READY_QUEUEING = { | ||
18888 | /** | ||
18889 | * Initializes the internal `onDOMReady` queue. | ||
18890 | */ | ||
18891 | initialize: function () { | ||
18892 | this.reactMountReady.reset(); | ||
18893 | }, | ||
18894 | |||
18895 | close: emptyFunction | ||
18896 | }; | ||
18897 | |||
18898 | /** | ||
18899 | * Executed within the scope of the `Transaction` instance. Consider these as | ||
18900 | * being member methods, but with an implied ordering while being isolated from | ||
18901 | * each other. | ||
18902 | */ | ||
18903 | var TRANSACTION_WRAPPERS = [ON_DOM_READY_QUEUEING]; | ||
18904 | |||
18905 | /** | ||
18906 | * @class ReactServerRenderingTransaction | ||
18907 | * @param {boolean} renderToStaticMarkup | ||
18908 | */ | ||
18909 | function ReactServerRenderingTransaction(renderToStaticMarkup) { | ||
18910 | this.reinitializeTransaction(); | ||
18911 | this.renderToStaticMarkup = renderToStaticMarkup; | ||
18912 | this.reactMountReady = CallbackQueue.getPooled(null); | ||
18913 | this.useCreateElement = false; | ||
18914 | } | ||
18915 | |||
18916 | var Mixin = { | ||
18917 | /** | ||
18918 | * @see Transaction | ||
18919 | * @abstract | ||
18920 | * @final | ||
18921 | * @return {array} Empty list of operation wrap procedures. | ||
18922 | */ | ||
18923 | getTransactionWrappers: function () { | ||
18924 | return TRANSACTION_WRAPPERS; | ||
18925 | }, | ||
18926 | |||
18927 | /** | ||
18928 | * @return {object} The queue to collect `onDOMReady` callbacks with. | ||
18929 | */ | ||
18930 | getReactMountReady: function () { | ||
18931 | return this.reactMountReady; | ||
18932 | }, | ||
18933 | |||
18934 | /** | ||
18935 | * `PooledClass` looks for this, and will invoke this before allowing this | ||
18936 | * instance to be reused. | ||
18937 | */ | ||
18938 | destructor: function () { | ||
18939 | CallbackQueue.release(this.reactMountReady); | ||
18940 | this.reactMountReady = null; | ||
18941 | } | ||
18942 | }; | ||
18943 | |||
18944 | assign(ReactServerRenderingTransaction.prototype, Transaction.Mixin, Mixin); | ||
18945 | |||
18946 | PooledClass.addPoolingTo(ReactServerRenderingTransaction); | ||
18947 | |||
18948 | module.exports = ReactServerRenderingTransaction; | ||
18949 | |||
18950 | /***/ }, | ||
18951 | /* 154 */ | ||
18952 | /***/ function(module, exports, __webpack_require__) { | ||
18953 | |||
18954 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
18955 | * Copyright 2013-2015, Facebook, Inc. | ||
18956 | * All rights reserved. | ||
18957 | * | ||
18958 | * This source code is licensed under the BSD-style license found in the | ||
18959 | * LICENSE file in the root directory of this source tree. An additional grant | ||
18960 | * of patent rights can be found in the PATENTS file in the same directory. | ||
18961 | * | ||
18962 | * @providesModule ReactIsomorphic | ||
18963 | */ | ||
18964 | |||
18965 | 'use strict'; | ||
18966 | |||
18967 | var ReactChildren = __webpack_require__(112); | ||
18968 | var ReactComponent = __webpack_require__(125); | ||
18969 | var ReactClass = __webpack_require__(124); | ||
18970 | var ReactDOMFactories = __webpack_require__(155); | ||
18971 | var ReactElement = __webpack_require__(44); | ||
18972 | var ReactElementValidator = __webpack_require__(156); | ||
18973 | var ReactPropTypes = __webpack_require__(109); | ||
18974 | var ReactVersion = __webpack_require__(148); | ||
18975 | |||
18976 | var assign = __webpack_require__(41); | ||
18977 | var onlyChild = __webpack_require__(158); | ||
18978 | |||
18979 | var createElement = ReactElement.createElement; | ||
18980 | var createFactory = ReactElement.createFactory; | ||
18981 | var cloneElement = ReactElement.cloneElement; | ||
18982 | |||
18983 | if (process.env.NODE_ENV !== 'production') { | ||
18984 | createElement = ReactElementValidator.createElement; | ||
18985 | createFactory = ReactElementValidator.createFactory; | ||
18986 | cloneElement = ReactElementValidator.cloneElement; | ||
18987 | } | ||
18988 | |||
18989 | var React = { | ||
18990 | |||
18991 | // Modern | ||
18992 | |||
18993 | Children: { | ||
18994 | map: ReactChildren.map, | ||
18995 | forEach: ReactChildren.forEach, | ||
18996 | count: ReactChildren.count, | ||
18997 | toArray: ReactChildren.toArray, | ||
18998 | only: onlyChild | ||
18999 | }, | ||
19000 | |||
19001 | Component: ReactComponent, | ||
19002 | |||
19003 | createElement: createElement, | ||
19004 | cloneElement: cloneElement, | ||
19005 | isValidElement: ReactElement.isValidElement, | ||
19006 | |||
19007 | // Classic | ||
19008 | |||
19009 | PropTypes: ReactPropTypes, | ||
19010 | createClass: ReactClass.createClass, | ||
19011 | createFactory: createFactory, | ||
19012 | createMixin: function (mixin) { | ||
19013 | // Currently a noop. Will be used to validate and trace mixins. | ||
19014 | return mixin; | ||
19015 | }, | ||
19016 | |||
19017 | // This looks DOM specific but these are actually isomorphic helpers | ||
19018 | // since they are just generating DOM strings. | ||
19019 | DOM: ReactDOMFactories, | ||
19020 | |||
19021 | version: ReactVersion, | ||
19022 | |||
19023 | // Hook for JSX spread, don't use this for anything else. | ||
19024 | __spread: assign | ||
19025 | }; | ||
19026 | |||
19027 | module.exports = React; | ||
19028 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
19029 | |||
19030 | /***/ }, | ||
19031 | /* 155 */ | ||
19032 | /***/ function(module, exports, __webpack_require__) { | ||
19033 | |||
19034 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
19035 | * Copyright 2013-2015, Facebook, Inc. | ||
19036 | * All rights reserved. | ||
19037 | * | ||
19038 | * This source code is licensed under the BSD-style license found in the | ||
19039 | * LICENSE file in the root directory of this source tree. An additional grant | ||
19040 | * of patent rights can be found in the PATENTS file in the same directory. | ||
19041 | * | ||
19042 | * @providesModule ReactDOMFactories | ||
19043 | * @typechecks static-only | ||
19044 | */ | ||
19045 | |||
19046 | 'use strict'; | ||
19047 | |||
19048 | var ReactElement = __webpack_require__(44); | ||
19049 | var ReactElementValidator = __webpack_require__(156); | ||
19050 | |||
19051 | var mapObject = __webpack_require__(157); | ||
19052 | |||
19053 | /** | ||
19054 | * Create a factory that creates HTML tag elements. | ||
19055 | * | ||
19056 | * @param {string} tag Tag name (e.g. `div`). | ||
19057 | * @private | ||
19058 | */ | ||
19059 | function createDOMFactory(tag) { | ||
19060 | if (process.env.NODE_ENV !== 'production') { | ||
19061 | return ReactElementValidator.createFactory(tag); | ||
19062 | } | ||
19063 | return ReactElement.createFactory(tag); | ||
19064 | } | ||
19065 | |||
19066 | /** | ||
19067 | * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes. | ||
19068 | * This is also accessible via `React.DOM`. | ||
19069 | * | ||
19070 | * @public | ||
19071 | */ | ||
19072 | var ReactDOMFactories = mapObject({ | ||
19073 | a: 'a', | ||
19074 | abbr: 'abbr', | ||
19075 | address: 'address', | ||
19076 | area: 'area', | ||
19077 | article: 'article', | ||
19078 | aside: 'aside', | ||
19079 | audio: 'audio', | ||
19080 | b: 'b', | ||
19081 | base: 'base', | ||
19082 | bdi: 'bdi', | ||
19083 | bdo: 'bdo', | ||
19084 | big: 'big', | ||
19085 | blockquote: 'blockquote', | ||
19086 | body: 'body', | ||
19087 | br: 'br', | ||
19088 | button: 'button', | ||
19089 | canvas: 'canvas', | ||
19090 | caption: 'caption', | ||
19091 | cite: 'cite', | ||
19092 | code: 'code', | ||
19093 | col: 'col', | ||
19094 | colgroup: 'colgroup', | ||
19095 | data: 'data', | ||
19096 | datalist: 'datalist', | ||
19097 | dd: 'dd', | ||
19098 | del: 'del', | ||
19099 | details: 'details', | ||
19100 | dfn: 'dfn', | ||
19101 | dialog: 'dialog', | ||
19102 | div: 'div', | ||
19103 | dl: 'dl', | ||
19104 | dt: 'dt', | ||
19105 | em: 'em', | ||
19106 | embed: 'embed', | ||
19107 | fieldset: 'fieldset', | ||
19108 | figcaption: 'figcaption', | ||
19109 | figure: 'figure', | ||
19110 | footer: 'footer', | ||
19111 | form: 'form', | ||
19112 | h1: 'h1', | ||
19113 | h2: 'h2', | ||
19114 | h3: 'h3', | ||
19115 | h4: 'h4', | ||
19116 | h5: 'h5', | ||
19117 | h6: 'h6', | ||
19118 | head: 'head', | ||
19119 | header: 'header', | ||
19120 | hgroup: 'hgroup', | ||
19121 | hr: 'hr', | ||
19122 | html: 'html', | ||
19123 | i: 'i', | ||
19124 | iframe: 'iframe', | ||
19125 | img: 'img', | ||
19126 | input: 'input', | ||
19127 | ins: 'ins', | ||
19128 | kbd: 'kbd', | ||
19129 | keygen: 'keygen', | ||
19130 | label: 'label', | ||
19131 | legend: 'legend', | ||
19132 | li: 'li', | ||
19133 | link: 'link', | ||
19134 | main: 'main', | ||
19135 | map: 'map', | ||
19136 | mark: 'mark', | ||
19137 | menu: 'menu', | ||
19138 | menuitem: 'menuitem', | ||
19139 | meta: 'meta', | ||
19140 | meter: 'meter', | ||
19141 | nav: 'nav', | ||
19142 | noscript: 'noscript', | ||
19143 | object: 'object', | ||
19144 | ol: 'ol', | ||
19145 | optgroup: 'optgroup', | ||
19146 | option: 'option', | ||
19147 | output: 'output', | ||
19148 | p: 'p', | ||
19149 | param: 'param', | ||
19150 | picture: 'picture', | ||
19151 | pre: 'pre', | ||
19152 | progress: 'progress', | ||
19153 | q: 'q', | ||
19154 | rp: 'rp', | ||
19155 | rt: 'rt', | ||
19156 | ruby: 'ruby', | ||
19157 | s: 's', | ||
19158 | samp: 'samp', | ||
19159 | script: 'script', | ||
19160 | section: 'section', | ||
19161 | select: 'select', | ||
19162 | small: 'small', | ||
19163 | source: 'source', | ||
19164 | span: 'span', | ||
19165 | strong: 'strong', | ||
19166 | style: 'style', | ||
19167 | sub: 'sub', | ||
19168 | summary: 'summary', | ||
19169 | sup: 'sup', | ||
19170 | table: 'table', | ||
19171 | tbody: 'tbody', | ||
19172 | td: 'td', | ||
19173 | textarea: 'textarea', | ||
19174 | tfoot: 'tfoot', | ||
19175 | th: 'th', | ||
19176 | thead: 'thead', | ||
19177 | time: 'time', | ||
19178 | title: 'title', | ||
19179 | tr: 'tr', | ||
19180 | track: 'track', | ||
19181 | u: 'u', | ||
19182 | ul: 'ul', | ||
19183 | 'var': 'var', | ||
19184 | video: 'video', | ||
19185 | wbr: 'wbr', | ||
19186 | |||
19187 | // SVG | ||
19188 | circle: 'circle', | ||
19189 | clipPath: 'clipPath', | ||
19190 | defs: 'defs', | ||
19191 | ellipse: 'ellipse', | ||
19192 | g: 'g', | ||
19193 | image: 'image', | ||
19194 | line: 'line', | ||
19195 | linearGradient: 'linearGradient', | ||
19196 | mask: 'mask', | ||
19197 | path: 'path', | ||
19198 | pattern: 'pattern', | ||
19199 | polygon: 'polygon', | ||
19200 | polyline: 'polyline', | ||
19201 | radialGradient: 'radialGradient', | ||
19202 | rect: 'rect', | ||
19203 | stop: 'stop', | ||
19204 | svg: 'svg', | ||
19205 | text: 'text', | ||
19206 | tspan: 'tspan' | ||
19207 | |||
19208 | }, createDOMFactory); | ||
19209 | |||
19210 | module.exports = ReactDOMFactories; | ||
19211 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
19212 | |||
19213 | /***/ }, | ||
19214 | /* 156 */ | ||
19215 | /***/ function(module, exports, __webpack_require__) { | ||
19216 | |||
19217 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
19218 | * Copyright 2014-2015, Facebook, Inc. | ||
19219 | * All rights reserved. | ||
19220 | * | ||
19221 | * This source code is licensed under the BSD-style license found in the | ||
19222 | * LICENSE file in the root directory of this source tree. An additional grant | ||
19223 | * of patent rights can be found in the PATENTS file in the same directory. | ||
19224 | * | ||
19225 | * @providesModule ReactElementValidator | ||
19226 | */ | ||
19227 | |||
19228 | /** | ||
19229 | * ReactElementValidator provides a wrapper around a element factory | ||
19230 | * which validates the props passed to the element. This is intended to be | ||
19231 | * used only in DEV and could be replaced by a static type checker for languages | ||
19232 | * that support it. | ||
19233 | */ | ||
19234 | |||
19235 | 'use strict'; | ||
19236 | |||
19237 | var ReactElement = __webpack_require__(44); | ||
19238 | var ReactPropTypeLocations = __webpack_require__(67); | ||
19239 | var ReactPropTypeLocationNames = __webpack_require__(68); | ||
19240 | var ReactCurrentOwner = __webpack_require__(7); | ||
19241 | |||
19242 | var canDefineProperty = __webpack_require__(45); | ||
19243 | var getIteratorFn = __webpack_require__(110); | ||
19244 | var invariant = __webpack_require__(15); | ||
19245 | var warning = __webpack_require__(27); | ||
19246 | |||
19247 | function getDeclarationErrorAddendum() { | ||
19248 | if (ReactCurrentOwner.current) { | ||
19249 | var name = ReactCurrentOwner.current.getName(); | ||
19250 | if (name) { | ||
19251 | return ' Check the render method of `' + name + '`.'; | ||
19252 | } | ||
19253 | } | ||
19254 | return ''; | ||
19255 | } | ||
19256 | |||
19257 | /** | ||
19258 | * Warn if there's no key explicitly set on dynamic arrays of children or | ||
19259 | * object keys are not valid. This allows us to keep track of children between | ||
19260 | * updates. | ||
19261 | */ | ||
19262 | var ownerHasKeyUseWarning = {}; | ||
19263 | |||
19264 | var loggedTypeFailures = {}; | ||
19265 | |||
19266 | /** | ||
19267 | * Warn if the element doesn't have an explicit key assigned to it. | ||
19268 | * This element is in an array. The array could grow and shrink or be | ||
19269 | * reordered. All children that haven't already been validated are required to | ||
19270 | * have a "key" property assigned to it. | ||
19271 | * | ||
19272 | * @internal | ||
19273 | * @param {ReactElement} element Element that requires a key. | ||
19274 | * @param {*} parentType element's parent's type. | ||
19275 | */ | ||
19276 | function validateExplicitKey(element, parentType) { | ||
19277 | if (!element._store || element._store.validated || element.key != null) { | ||
19278 | return; | ||
19279 | } | ||
19280 | element._store.validated = true; | ||
19281 | |||
19282 | var addenda = getAddendaForKeyUse('uniqueKey', element, parentType); | ||
19283 | if (addenda === null) { | ||
19284 | // we already showed the warning | ||
19285 | return; | ||
19286 | } | ||
19287 | 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; | ||
19288 | } | ||
19289 | |||
19290 | /** | ||
19291 | * Shared warning and monitoring code for the key warnings. | ||
19292 | * | ||
19293 | * @internal | ||
19294 | * @param {string} messageType A key used for de-duping warnings. | ||
19295 | * @param {ReactElement} element Component that requires a key. | ||
19296 | * @param {*} parentType element's parent's type. | ||
19297 | * @returns {?object} A set of addenda to use in the warning message, or null | ||
19298 | * if the warning has already been shown before (and shouldn't be shown again). | ||
19299 | */ | ||
19300 | function getAddendaForKeyUse(messageType, element, parentType) { | ||
19301 | var addendum = getDeclarationErrorAddendum(); | ||
19302 | if (!addendum) { | ||
19303 | var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name; | ||
19304 | if (parentName) { | ||
19305 | addendum = ' Check the top-level render call using <' + parentName + '>.'; | ||
19306 | } | ||
19307 | } | ||
19308 | |||
19309 | var memoizer = ownerHasKeyUseWarning[messageType] || (ownerHasKeyUseWarning[messageType] = {}); | ||
19310 | if (memoizer[addendum]) { | ||
19311 | return null; | ||
19312 | } | ||
19313 | memoizer[addendum] = true; | ||
19314 | |||
19315 | var addenda = { | ||
19316 | parentOrOwner: addendum, | ||
19317 | url: ' See https://fb.me/react-warning-keys for more information.', | ||
19318 | childOwner: null | ||
19319 | }; | ||
19320 | |||
19321 | // Usually the current owner is the offender, but if it accepts children as a | ||
19322 | // property, it may be the creator of the child that's responsible for | ||
19323 | // assigning it a key. | ||
19324 | if (element && element._owner && element._owner !== ReactCurrentOwner.current) { | ||
19325 | // Give the component that originally created this child. | ||
19326 | addenda.childOwner = ' It was passed a child from ' + element._owner.getName() + '.'; | ||
19327 | } | ||
19328 | |||
19329 | return addenda; | ||
19330 | } | ||
19331 | |||
19332 | /** | ||
19333 | * Ensure that every element either is passed in a static location, in an | ||
19334 | * array with an explicit keys property defined, or in an object literal | ||
19335 | * with valid key property. | ||
19336 | * | ||
19337 | * @internal | ||
19338 | * @param {ReactNode} node Statically passed child of any type. | ||
19339 | * @param {*} parentType node's parent's type. | ||
19340 | */ | ||
19341 | function validateChildKeys(node, parentType) { | ||
19342 | if (typeof node !== 'object') { | ||
19343 | return; | ||
19344 | } | ||
19345 | if (Array.isArray(node)) { | ||
19346 | for (var i = 0; i < node.length; i++) { | ||
19347 | var child = node[i]; | ||
19348 | if (ReactElement.isValidElement(child)) { | ||
19349 | validateExplicitKey(child, parentType); | ||
19350 | } | ||
19351 | } | ||
19352 | } else if (ReactElement.isValidElement(node)) { | ||
19353 | // This element was passed in a valid location. | ||
19354 | if (node._store) { | ||
19355 | node._store.validated = true; | ||
19356 | } | ||
19357 | } else if (node) { | ||
19358 | var iteratorFn = getIteratorFn(node); | ||
19359 | // Entry iterators provide implicit keys. | ||
19360 | if (iteratorFn) { | ||
19361 | if (iteratorFn !== node.entries) { | ||
19362 | var iterator = iteratorFn.call(node); | ||
19363 | var step; | ||
19364 | while (!(step = iterator.next()).done) { | ||
19365 | if (ReactElement.isValidElement(step.value)) { | ||
19366 | validateExplicitKey(step.value, parentType); | ||
19367 | } | ||
19368 | } | ||
19369 | } | ||
19370 | } | ||
19371 | } | ||
19372 | } | ||
19373 | |||
19374 | /** | ||
19375 | * Assert that the props are valid | ||
19376 | * | ||
19377 | * @param {string} componentName Name of the component for error messages. | ||
19378 | * @param {object} propTypes Map of prop name to a ReactPropType | ||
19379 | * @param {object} props | ||
19380 | * @param {string} location e.g. "prop", "context", "child context" | ||
19381 | * @private | ||
19382 | */ | ||
19383 | function checkPropTypes(componentName, propTypes, props, location) { | ||
19384 | for (var propName in propTypes) { | ||
19385 | if (propTypes.hasOwnProperty(propName)) { | ||
19386 | var error; | ||
19387 | // Prop type validation may throw. In case they do, we don't want to | ||
19388 | // fail the render phase where it didn't fail before. So we log it. | ||
19389 | // After these have been cleaned up, we'll let them throw. | ||
19390 | try { | ||
19391 | // This is intentionally an invariant that gets caught. It's the same | ||
19392 | // behavior as without this statement except with a better message. | ||
19393 | !(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; | ||
19394 | error = propTypes[propName](props, propName, componentName, location); | ||
19395 | } catch (ex) { | ||
19396 | error = ex; | ||
19397 | } | ||
19398 | 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; | ||
19399 | if (error instanceof Error && !(error.message in loggedTypeFailures)) { | ||
19400 | // Only monitor this failure once because there tends to be a lot of the | ||
19401 | // same error. | ||
19402 | loggedTypeFailures[error.message] = true; | ||
19403 | |||
19404 | var addendum = getDeclarationErrorAddendum(); | ||
19405 | process.env.NODE_ENV !== 'production' ? warning(false, 'Failed propType: %s%s', error.message, addendum) : undefined; | ||
19406 | } | ||
19407 | } | ||
19408 | } | ||
19409 | } | ||
19410 | |||
19411 | /** | ||
19412 | * Given an element, validate that its props follow the propTypes definition, | ||
19413 | * provided by the type. | ||
19414 | * | ||
19415 | * @param {ReactElement} element | ||
19416 | */ | ||
19417 | function validatePropTypes(element) { | ||
19418 | var componentClass = element.type; | ||
19419 | if (typeof componentClass !== 'function') { | ||
19420 | return; | ||
19421 | } | ||
19422 | var name = componentClass.displayName || componentClass.name; | ||
19423 | if (componentClass.propTypes) { | ||
19424 | checkPropTypes(name, componentClass.propTypes, element.props, ReactPropTypeLocations.prop); | ||
19425 | } | ||
19426 | if (typeof componentClass.getDefaultProps === 'function') { | ||
19427 | 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; | ||
19428 | } | ||
19429 | } | ||
19430 | |||
19431 | var ReactElementValidator = { | ||
19432 | |||
19433 | createElement: function (type, props, children) { | ||
19434 | var validType = typeof type === 'string' || typeof type === 'function'; | ||
19435 | // We warn in this case but don't throw. We expect the element creation to | ||
19436 | // succeed and there will likely be errors in render. | ||
19437 | 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; | ||
19438 | |||
19439 | var element = ReactElement.createElement.apply(this, arguments); | ||
19440 | |||
19441 | // The result can be nullish if a mock or a custom function is used. | ||
19442 | // TODO: Drop this when these are no longer allowed as the type argument. | ||
19443 | if (element == null) { | ||
19444 | return element; | ||
19445 | } | ||
19446 | |||
19447 | // Skip key warning if the type isn't valid since our key validation logic | ||
19448 | // doesn't expect a non-string/function type and can throw confusing errors. | ||
19449 | // We don't want exception behavior to differ between dev and prod. | ||
19450 | // (Rendering will throw with a helpful message and as soon as the type is | ||
19451 | // fixed, the key warnings will appear.) | ||
19452 | if (validType) { | ||
19453 | for (var i = 2; i < arguments.length; i++) { | ||
19454 | validateChildKeys(arguments[i], type); | ||
19455 | } | ||
19456 | } | ||
19457 | |||
19458 | validatePropTypes(element); | ||
19459 | |||
19460 | return element; | ||
19461 | }, | ||
19462 | |||
19463 | createFactory: function (type) { | ||
19464 | var validatedFactory = ReactElementValidator.createElement.bind(null, type); | ||
19465 | // Legacy hook TODO: Warn if this is accessed | ||
19466 | validatedFactory.type = type; | ||
19467 | |||
19468 | if (process.env.NODE_ENV !== 'production') { | ||
19469 | if (canDefineProperty) { | ||
19470 | Object.defineProperty(validatedFactory, 'type', { | ||
19471 | enumerable: false, | ||
19472 | get: function () { | ||
19473 | process.env.NODE_ENV !== 'production' ? warning(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.') : undefined; | ||
19474 | Object.defineProperty(this, 'type', { | ||
19475 | value: type | ||
19476 | }); | ||
19477 | return type; | ||
19478 | } | ||
19479 | }); | ||
19480 | } | ||
19481 | } | ||
19482 | |||
19483 | return validatedFactory; | ||
19484 | }, | ||
19485 | |||
19486 | cloneElement: function (element, props, children) { | ||
19487 | var newElement = ReactElement.cloneElement.apply(this, arguments); | ||
19488 | for (var i = 2; i < arguments.length; i++) { | ||
19489 | validateChildKeys(arguments[i], newElement.type); | ||
19490 | } | ||
19491 | validatePropTypes(newElement); | ||
19492 | return newElement; | ||
19493 | } | ||
19494 | |||
19495 | }; | ||
19496 | |||
19497 | module.exports = ReactElementValidator; | ||
19498 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
19499 | |||
19500 | /***/ }, | ||
19501 | /* 157 */ | ||
19502 | /***/ function(module, exports) { | ||
19503 | |||
19504 | /** | ||
19505 | * Copyright 2013-2015, Facebook, Inc. | ||
19506 | * All rights reserved. | ||
19507 | * | ||
19508 | * This source code is licensed under the BSD-style license found in the | ||
19509 | * LICENSE file in the root directory of this source tree. An additional grant | ||
19510 | * of patent rights can be found in the PATENTS file in the same directory. | ||
19511 | * | ||
19512 | * @providesModule mapObject | ||
19513 | */ | ||
19514 | |||
19515 | 'use strict'; | ||
19516 | |||
19517 | var hasOwnProperty = Object.prototype.hasOwnProperty; | ||
19518 | |||
19519 | /** | ||
19520 | * Executes the provided `callback` once for each enumerable own property in the | ||
19521 | * object and constructs a new object from the results. The `callback` is | ||
19522 | * invoked with three arguments: | ||
19523 | * | ||
19524 | * - the property value | ||
19525 | * - the property name | ||
19526 | * - the object being traversed | ||
19527 | * | ||
19528 | * Properties that are added after the call to `mapObject` will not be visited | ||
19529 | * by `callback`. If the values of existing properties are changed, the value | ||
19530 | * passed to `callback` will be the value at the time `mapObject` visits them. | ||
19531 | * Properties that are deleted before being visited are not visited. | ||
19532 | * | ||
19533 | * @grep function objectMap() | ||
19534 | * @grep function objMap() | ||
19535 | * | ||
19536 | * @param {?object} object | ||
19537 | * @param {function} callback | ||
19538 | * @param {*} context | ||
19539 | * @return {?object} | ||
19540 | */ | ||
19541 | function mapObject(object, callback, context) { | ||
19542 | if (!object) { | ||
19543 | return null; | ||
19544 | } | ||
19545 | var result = {}; | ||
19546 | for (var name in object) { | ||
19547 | if (hasOwnProperty.call(object, name)) { | ||
19548 | result[name] = callback.call(context, object[name], name, object); | ||
19549 | } | ||
19550 | } | ||
19551 | return result; | ||
19552 | } | ||
19553 | |||
19554 | module.exports = mapObject; | ||
19555 | |||
19556 | /***/ }, | ||
19557 | /* 158 */ | ||
19558 | /***/ function(module, exports, __webpack_require__) { | ||
19559 | |||
19560 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
19561 | * Copyright 2013-2015, Facebook, Inc. | ||
19562 | * All rights reserved. | ||
19563 | * | ||
19564 | * This source code is licensed under the BSD-style license found in the | ||
19565 | * LICENSE file in the root directory of this source tree. An additional grant | ||
19566 | * of patent rights can be found in the PATENTS file in the same directory. | ||
19567 | * | ||
19568 | * @providesModule onlyChild | ||
19569 | */ | ||
19570 | 'use strict'; | ||
19571 | |||
19572 | var ReactElement = __webpack_require__(44); | ||
19573 | |||
19574 | var invariant = __webpack_require__(15); | ||
19575 | |||
19576 | /** | ||
19577 | * Returns the first child in a collection of children and verifies that there | ||
19578 | * is only one child in the collection. The current implementation of this | ||
19579 | * function assumes that a single child gets passed without a wrapper, but the | ||
19580 | * purpose of this helper function is to abstract away the particular structure | ||
19581 | * of children. | ||
19582 | * | ||
19583 | * @param {?object} children Child collection structure. | ||
19584 | * @return {ReactComponent} The first and only `ReactComponent` contained in the | ||
19585 | * structure. | ||
19586 | */ | ||
19587 | function onlyChild(children) { | ||
19588 | !ReactElement.isValidElement(children) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'onlyChild must be passed a children with exactly one child.') : invariant(false) : undefined; | ||
19589 | return children; | ||
19590 | } | ||
19591 | |||
19592 | module.exports = onlyChild; | ||
19593 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
19594 | |||
19595 | /***/ }, | ||
19596 | /* 159 */ | ||
19597 | /***/ function(module, exports, __webpack_require__) { | ||
19598 | |||
19599 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
19600 | * Copyright 2013-2015, Facebook, Inc. | ||
19601 | * All rights reserved. | ||
19602 | * | ||
19603 | * This source code is licensed under the BSD-style license found in the | ||
19604 | * LICENSE file in the root directory of this source tree. An additional grant | ||
19605 | * of patent rights can be found in the PATENTS file in the same directory. | ||
19606 | * | ||
19607 | * @providesModule deprecated | ||
19608 | */ | ||
19609 | |||
19610 | 'use strict'; | ||
19611 | |||
19612 | var assign = __webpack_require__(41); | ||
19613 | var warning = __webpack_require__(27); | ||
19614 | |||
19615 | /** | ||
19616 | * This will log a single deprecation notice per function and forward the call | ||
19617 | * on to the new API. | ||
19618 | * | ||
19619 | * @param {string} fnName The name of the function | ||
19620 | * @param {string} newModule The module that fn will exist in | ||
19621 | * @param {string} newPackage The module that fn will exist in | ||
19622 | * @param {*} ctx The context this forwarded call should run in | ||
19623 | * @param {function} fn The function to forward on to | ||
19624 | * @return {function} The function that will warn once and then call fn | ||
19625 | */ | ||
19626 | function deprecated(fnName, newModule, newPackage, ctx, fn) { | ||
19627 | var warned = false; | ||
19628 | if (process.env.NODE_ENV !== 'production') { | ||
19629 | var newFn = function () { | ||
19630 | process.env.NODE_ENV !== 'production' ? warning(warned, | ||
19631 | // Require examples in this string must be split to prevent React's | ||
19632 | // build tools from mistaking them for real requires. | ||
19633 | // Otherwise the build tools will attempt to build a '%s' module. | ||
19634 | 'React.%s is deprecated. Please use %s.%s from require' + '(\'%s\') ' + 'instead.', fnName, newModule, fnName, newPackage) : undefined; | ||
19635 | warned = true; | ||
19636 | return fn.apply(ctx, arguments); | ||
19637 | }; | ||
19638 | // We need to make sure all properties of the original fn are copied over. | ||
19639 | // In particular, this is needed to support PropTypes | ||
19640 | return assign(newFn, fn); | ||
19641 | } | ||
19642 | |||
19643 | return fn; | ||
19644 | } | ||
19645 | |||
19646 | module.exports = deprecated; | ||
19647 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
19648 | |||
19649 | /***/ }, | ||
19650 | /* 160 */ | ||
19651 | /***/ function(module, exports, __webpack_require__) { | ||
19652 | |||
19653 | 'use strict'; | ||
19654 | |||
19655 | module.exports = __webpack_require__(5); | ||
19656 | |||
19657 | |||
19658 | /***/ }, | ||
19659 | /* 161 */ | ||
19660 | /***/ function(module, exports, __webpack_require__) { | ||
19661 | |||
19662 | /* | ||
19663 | * GregorianCalendar class | ||
19664 | * @ignore | ||
19665 | * @author yiminghe@gmail.com | ||
19666 | */ | ||
19667 | 'use strict'; | ||
19668 | |||
19669 | var toInt = parseInt; | ||
19670 | var Utils = __webpack_require__(162); | ||
19671 | var defaultLocale = __webpack_require__(164); | ||
19672 | var Const = __webpack_require__(163); | ||
19673 | |||
19674 | /* | ||
19675 | * GregorianCalendar class. | ||
19676 | * | ||
19677 | * - no arguments: | ||
19678 | * Constructs a default GregorianCalendar using the current time | ||
19679 | * in the default time zone with the default locale. | ||
19680 | * - one argument locale: | ||
19681 | * Constructs a GregorianCalendar | ||
19682 | * based on the current time in the default time zone with the given locale. | ||
19683 | * | ||
19684 | * @class Date.Gregorian | ||
19685 | */ | ||
19686 | function GregorianCalendar(loc) { | ||
19687 | var locale = loc || defaultLocale; | ||
19688 | |||
19689 | this.locale = locale; | ||
19690 | |||
19691 | this.fields = []; | ||
19692 | |||
19693 | /* | ||
19694 | * The currently set time for this date. | ||
19695 | * @protected | ||
19696 | * @type Number|undefined | ||
19697 | */ | ||
19698 | this.time = undefined; | ||
19699 | /* | ||
19700 | * The timezoneOffset in minutes used by this date. | ||
19701 | * @type Number | ||
19702 | * @protected | ||
19703 | */ | ||
19704 | |||
19705 | this.timezoneOffset = locale.timezoneOffset; | ||
19706 | |||
19707 | /* | ||
19708 | * The first day of the week | ||
19709 | * @type Number | ||
19710 | * @protected | ||
19711 | */ | ||
19712 | this.firstDayOfWeek = locale.firstDayOfWeek; | ||
19713 | |||
19714 | /* | ||
19715 | * The number of days required for the first week in a month or year, | ||
19716 | * with possible values from 1 to 7. | ||
19717 | * @@protected | ||
19718 | * @type Number | ||
19719 | */ | ||
19720 | this.minimalDaysInFirstWeek = locale.minimalDaysInFirstWeek; | ||
19721 | |||
19722 | this.fieldsComputed = false; | ||
19723 | } | ||
19724 | |||
19725 | Utils.mix(GregorianCalendar, Const); | ||
19726 | |||
19727 | Utils.mix(GregorianCalendar, { | ||
19728 | Utils: Utils, | ||
19729 | |||
19730 | defaultLocale: defaultLocale, | ||
19731 | |||
19732 | /* | ||
19733 | * Determines if the given year is a leap year. | ||
19734 | * Returns true if the given year is a leap year. To specify BC year numbers, | ||
19735 | * 1 - year number must be given. For example, year BC 4 is specified as -3. | ||
19736 | * @param {Number} year the given year. | ||
19737 | * @returns {Boolean} true if the given year is a leap year; false otherwise. | ||
19738 | * @static | ||
19739 | * @method | ||
19740 | */ | ||
19741 | isLeapYear: Utils.isLeapYear, | ||
19742 | |||
19743 | /* | ||
19744 | * Enum indicating year field of date | ||
19745 | * @type Number | ||
19746 | */ | ||
19747 | YEAR: 1, | ||
19748 | /* | ||
19749 | * Enum indicating month field of date | ||
19750 | * @type Number | ||
19751 | */ | ||
19752 | MONTH: 2, | ||
19753 | /* | ||
19754 | * Enum indicating the day of the month | ||
19755 | * @type Number | ||
19756 | */ | ||
19757 | DAY_OF_MONTH: 3, | ||
19758 | /* | ||
19759 | * Enum indicating the hour (24). | ||
19760 | * @type Number | ||
19761 | */ | ||
19762 | HOUR_OF_DAY: 4, | ||
19763 | /* | ||
19764 | * Enum indicating the minute of the day | ||
19765 | * @type Number | ||
19766 | */ | ||
19767 | MINUTES: 5, | ||
19768 | /* | ||
19769 | * Enum indicating the second of the day | ||
19770 | * @type Number | ||
19771 | */ | ||
19772 | SECONDS: 6, | ||
19773 | /* | ||
19774 | * Enum indicating the millisecond of the day | ||
19775 | * @type Number | ||
19776 | */ | ||
19777 | MILLISECONDS: 7, | ||
19778 | /* | ||
19779 | * Enum indicating the week number within the current year | ||
19780 | * @type Number | ||
19781 | */ | ||
19782 | WEEK_OF_YEAR: 8, | ||
19783 | /* | ||
19784 | * Enum indicating the week number within the current month | ||
19785 | * @type Number | ||
19786 | */ | ||
19787 | WEEK_OF_MONTH: 9, | ||
19788 | |||
19789 | /* | ||
19790 | * Enum indicating the day of the day number within the current year | ||
19791 | * @type Number | ||
19792 | */ | ||
19793 | DAY_OF_YEAR: 10, | ||
19794 | /* | ||
19795 | * Enum indicating the day of the week | ||
19796 | * @type Number | ||
19797 | */ | ||
19798 | DAY_OF_WEEK: 11, | ||
19799 | /* | ||
19800 | * Enum indicating the day of the ordinal number of the day of the week | ||
19801 | * @type Number | ||
19802 | */ | ||
19803 | DAY_OF_WEEK_IN_MONTH: 12, | ||
19804 | |||
19805 | /* | ||
19806 | * Enum indicating am | ||
19807 | * @type Number | ||
19808 | */ | ||
19809 | AM: 0, | ||
19810 | /* | ||
19811 | * Enum indicating pm | ||
19812 | * @type Number | ||
19813 | */ | ||
19814 | PM: 1 | ||
19815 | }); | ||
19816 | |||
19817 | var FIELDS = ['', 'Year', 'Month', 'DayOfMonth', 'HourOfDay', 'Minutes', 'Seconds', 'Milliseconds', 'WeekOfYear', 'WeekOfMonth', 'DayOfYear', 'DayOfWeek', 'DayOfWeekInMonth']; | ||
19818 | |||
19819 | var YEAR = GregorianCalendar.YEAR; | ||
19820 | var MONTH = GregorianCalendar.MONTH; | ||
19821 | var DAY_OF_MONTH = GregorianCalendar.DAY_OF_MONTH; | ||
19822 | var HOUR_OF_DAY = GregorianCalendar.HOUR_OF_DAY; | ||
19823 | var MINUTE = GregorianCalendar.MINUTES; | ||
19824 | var SECONDS = GregorianCalendar.SECONDS; | ||
19825 | |||
19826 | var MILLISECONDS = GregorianCalendar.MILLISECONDS; | ||
19827 | var DAY_OF_WEEK_IN_MONTH = GregorianCalendar.DAY_OF_WEEK_IN_MONTH; | ||
19828 | var DAY_OF_YEAR = GregorianCalendar.DAY_OF_YEAR; | ||
19829 | var DAY_OF_WEEK = GregorianCalendar.DAY_OF_WEEK; | ||
19830 | |||
19831 | var WEEK_OF_MONTH = GregorianCalendar.WEEK_OF_MONTH; | ||
19832 | var WEEK_OF_YEAR = GregorianCalendar.WEEK_OF_YEAR; | ||
19833 | |||
19834 | var MONTH_LENGTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; // 0-based | ||
19835 | var LEAP_MONTH_LENGTH = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; // 0-based | ||
19836 | |||
19837 | var ONE_SECOND = 1000; | ||
19838 | var ONE_MINUTE = 60 * ONE_SECOND; | ||
19839 | var ONE_HOUR = 60 * ONE_MINUTE; | ||
19840 | var ONE_DAY = 24 * ONE_HOUR; | ||
19841 | var ONE_WEEK = ONE_DAY * 7; | ||
19842 | |||
19843 | var EPOCH_OFFSET = 719163; // Fixed date of January 1, 1970 (Gregorian) | ||
19844 | |||
19845 | var mod = Utils.mod; | ||
19846 | var _isLeapYear = Utils.isLeapYear; | ||
19847 | var floorDivide = Math.floor; | ||
19848 | |||
19849 | var MIN_VALUES = [undefined, 1, // YEAR | ||
19850 | GregorianCalendar.JANUARY, // MONTH | ||
19851 | 1, // DAY_OF_MONTH | ||
19852 | 0, // HOUR_OF_DAY | ||
19853 | 0, // MINUTE | ||
19854 | 0, // SECONDS | ||
19855 | 0, // MILLISECONDS | ||
19856 | |||
19857 | 1, // WEEK_OF_YEAR | ||
19858 | undefined, // WEEK_OF_MONTH | ||
19859 | |||
19860 | 1, // DAY_OF_YEAR | ||
19861 | GregorianCalendar.SUNDAY, // DAY_OF_WEEK | ||
19862 | 1]; | ||
19863 | |||
19864 | // DAY_OF_WEEK_IN_MONTH | ||
19865 | var MAX_VALUES = [undefined, 292278994, // YEAR | ||
19866 | GregorianCalendar.DECEMBER, // MONTH | ||
19867 | undefined, // DAY_OF_MONTH | ||
19868 | 23, // HOUR_OF_DAY | ||
19869 | 59, // MINUTE | ||
19870 | 59, // SECONDS | ||
19871 | 999, // MILLISECONDS | ||
19872 | undefined, // WEEK_OF_YEAR | ||
19873 | undefined, // WEEK_OF_MONTH | ||
19874 | undefined, // DAY_OF_YEAR | ||
19875 | GregorianCalendar.SATURDAY, // DAY_OF_WEEK | ||
19876 | undefined]; | ||
19877 | |||
19878 | // ------------------- private start | ||
19879 | |||
19880 | // DAY_OF_WEEK_IN_MONTH | ||
19881 | function getMonthLength(year, month) { | ||
19882 | return _isLeapYear(year) ? LEAP_MONTH_LENGTH[month] : MONTH_LENGTH[month]; | ||
19883 | } | ||
19884 | |||
19885 | function getYearLength(year) { | ||
19886 | return _isLeapYear(year) ? 366 : 365; | ||
19887 | } | ||
19888 | |||
19889 | function adjustDayOfMonth(self) { | ||
19890 | var fields = self.fields; | ||
19891 | var year = fields[YEAR]; | ||
19892 | var month = fields[MONTH]; | ||
19893 | var monthLen = getMonthLength(year, month); | ||
19894 | var dayOfMonth = fields[DAY_OF_MONTH]; | ||
19895 | if (dayOfMonth > monthLen) { | ||
19896 | self.set(DAY_OF_MONTH, monthLen); | ||
19897 | } | ||
19898 | } | ||
19899 | |||
19900 | function getDayOfWeekDateOnOrBefore(fixedDate, dayOfWeek) { | ||
19901 | // 1.1.1 is monday | ||
19902 | // one week has 7 days | ||
19903 | return fixedDate - mod(fixedDate - dayOfWeek, 7); | ||
19904 | } | ||
19905 | |||
19906 | function getWeekNumber(self, fixedDay1, fixedDate) { | ||
19907 | var fixedDay1st = getDayOfWeekDateOnOrBefore(fixedDay1 + 6, self.firstDayOfWeek); | ||
19908 | var nDays = fixedDay1st - fixedDay1; | ||
19909 | if (nDays >= self.minimalDaysInFirstWeek) { | ||
19910 | fixedDay1st -= 7; | ||
19911 | } | ||
19912 | var normalizedDayOfPeriod = fixedDate - fixedDay1st; | ||
19913 | return floorDivide(normalizedDayOfPeriod / 7) + 1; | ||
19914 | } | ||
19915 | |||
19916 | // ------------------- private end | ||
19917 | |||
19918 | GregorianCalendar.prototype = { | ||
19919 | constructor: GregorianCalendar, | ||
19920 | |||
19921 | isGregorianCalendar: 1, | ||
19922 | |||
19923 | /* | ||
19924 | * Determines if current year is a leap year. | ||
19925 | * Returns true if the given year is a leap year. To specify BC year numbers, | ||
19926 | * 1 - year number must be given. For example, year BC 4 is specified as -3. | ||
19927 | * @returns {Boolean} true if the given year is a leap year; false otherwise. | ||
19928 | * @method | ||
19929 | * @member Date.Gregorian | ||
19930 | */ | ||
19931 | isLeapYear: function isLeapYear() { | ||
19932 | return _isLeapYear(this.getYear()); | ||
19933 | }, | ||
19934 | |||
19935 | /* | ||
19936 | * Return local info for current date instance | ||
19937 | * @returns {Object} | ||
19938 | */ | ||
19939 | getLocale: function getLocale() { | ||
19940 | return this.locale; | ||
19941 | }, | ||
19942 | |||
19943 | /* | ||
19944 | * Returns the minimum value for | ||
19945 | * the given calendar field of this GregorianCalendar instance. | ||
19946 | * The minimum value is defined as the smallest value | ||
19947 | * returned by the get method for any possible time value, | ||
19948 | * taking into consideration the current values of the getFirstDayOfWeek, | ||
19949 | * getMinimalDaysInFirstWeek. | ||
19950 | * @param field the calendar field. | ||
19951 | * @returns {Number} the minimum value for the given calendar field. | ||
19952 | */ | ||
19953 | getActualMinimum: function getActualMinimum(field) { | ||
19954 | if (MIN_VALUES[field] !== undefined) { | ||
19955 | return MIN_VALUES[field]; | ||
19956 | } | ||
19957 | if (field === WEEK_OF_MONTH) { | ||
19958 | var cal = this.clone(); | ||
19959 | cal.clear(); | ||
19960 | cal.set(this.fields[YEAR], this.fields[MONTH], 1); | ||
19961 | return cal.get(WEEK_OF_MONTH); | ||
19962 | } | ||
19963 | |||
19964 | throw new Error('minimum value not defined!'); | ||
19965 | }, | ||
19966 | |||
19967 | /* | ||
19968 | * Returns the maximum value for the given calendar field | ||
19969 | * of this GregorianCalendar instance. | ||
19970 | * The maximum value is defined as the largest value returned | ||
19971 | * by the get method for any possible time value, taking into consideration | ||
19972 | * the current values of the getFirstDayOfWeek, getMinimalDaysInFirstWeek methods. | ||
19973 | * @param field the calendar field. | ||
19974 | * @returns {Number} the maximum value for the given calendar field. | ||
19975 | */ | ||
19976 | getActualMaximum: function getActualMaximum(field) { | ||
19977 | if (MAX_VALUES[field] !== undefined) { | ||
19978 | return MAX_VALUES[field]; | ||
19979 | } | ||
19980 | var value = undefined; | ||
19981 | var fields = this.fields; | ||
19982 | switch (field) { | ||
19983 | case DAY_OF_MONTH: | ||
19984 | value = getMonthLength(fields[YEAR], fields[MONTH]); | ||
19985 | break; | ||
19986 | |||
19987 | case WEEK_OF_YEAR: | ||
19988 | var endOfYear = this.clone(); | ||
19989 | endOfYear.clear(); | ||
19990 | endOfYear.set(fields[YEAR], GregorianCalendar.DECEMBER, 31); | ||
19991 | value = endOfYear.get(WEEK_OF_YEAR); | ||
19992 | if (value === 1) { | ||
19993 | value = 52; | ||
19994 | } | ||
19995 | break; | ||
19996 | |||
19997 | case WEEK_OF_MONTH: | ||
19998 | var endOfMonth = this.clone(); | ||
19999 | endOfMonth.clear(); | ||
20000 | endOfMonth.set(fields[YEAR], fields[MONTH], getMonthLength(fields[YEAR], fields[MONTH])); | ||
20001 | value = endOfMonth.get(WEEK_OF_MONTH); | ||
20002 | break; | ||
20003 | |||
20004 | case DAY_OF_YEAR: | ||
20005 | value = getYearLength(fields[YEAR]); | ||
20006 | break; | ||
20007 | |||
20008 | case DAY_OF_WEEK_IN_MONTH: | ||
20009 | value = toInt((getMonthLength(fields[YEAR], fields[MONTH]) - 1) / 7) + 1; | ||
20010 | break; | ||
20011 | default: | ||
20012 | break; | ||
20013 | } | ||
20014 | if (value === undefined) { | ||
20015 | throw new Error('maximum value not defined!'); | ||
20016 | } | ||
20017 | return value; | ||
20018 | }, | ||
20019 | |||
20020 | /* | ||
20021 | * Determines if the given calendar field has a value set, | ||
20022 | * including cases that the value has been set by internal fields calculations | ||
20023 | * triggered by a get method call. | ||
20024 | * @param field the calendar field to be cleared. | ||
20025 | * @returns {boolean} true if the given calendar field has a value set; false otherwise. | ||
20026 | */ | ||
20027 | isSet: function isSet(field) { | ||
20028 | return this.fields[field] !== undefined; | ||
20029 | }, | ||
20030 | |||
20031 | /* | ||
20032 | * Converts the time value (millisecond offset from the Epoch) | ||
20033 | * to calendar field values. | ||
20034 | * @protected | ||
20035 | */ | ||
20036 | computeFields: function computeFields() { | ||
20037 | var time = this.time; | ||
20038 | var timezoneOffset = this.timezoneOffset * ONE_MINUTE; | ||
20039 | var fixedDate = toInt(timezoneOffset / ONE_DAY); | ||
20040 | var timeOfDay = timezoneOffset % ONE_DAY; | ||
20041 | fixedDate += toInt(time / ONE_DAY); | ||
20042 | timeOfDay += time % ONE_DAY; | ||
20043 | if (timeOfDay >= ONE_DAY) { | ||
20044 | timeOfDay -= ONE_DAY; | ||
20045 | fixedDate++; | ||
20046 | } else { | ||
20047 | while (timeOfDay < 0) { | ||
20048 | timeOfDay += ONE_DAY; | ||
20049 | fixedDate--; | ||
20050 | } | ||
20051 | } | ||
20052 | |||
20053 | fixedDate += EPOCH_OFFSET; | ||
20054 | |||
20055 | var date = Utils.getGregorianDateFromFixedDate(fixedDate); | ||
20056 | |||
20057 | var year = date.year; | ||
20058 | |||
20059 | var fields = this.fields; | ||
20060 | fields[YEAR] = year; | ||
20061 | fields[MONTH] = date.month; | ||
20062 | fields[DAY_OF_MONTH] = date.dayOfMonth; | ||
20063 | fields[DAY_OF_WEEK] = date.dayOfWeek; | ||
20064 | |||
20065 | if (timeOfDay !== 0) { | ||
20066 | fields[HOUR_OF_DAY] = toInt(timeOfDay / ONE_HOUR); | ||
20067 | var r = timeOfDay % ONE_HOUR; | ||
20068 | fields[MINUTE] = toInt(r / ONE_MINUTE); | ||
20069 | r %= ONE_MINUTE; | ||
20070 | fields[SECONDS] = toInt(r / ONE_SECOND); | ||
20071 | fields[MILLISECONDS] = r % ONE_SECOND; | ||
20072 | } else { | ||
20073 | fields[HOUR_OF_DAY] = fields[MINUTE] = fields[SECONDS] = fields[MILLISECONDS] = 0; | ||
20074 | } | ||
20075 | |||
20076 | var fixedDateJan1 = Utils.getFixedDate(year, GregorianCalendar.JANUARY, 1); | ||
20077 | var dayOfYear = fixedDate - fixedDateJan1 + 1; | ||
20078 | var fixDateMonth1 = fixedDate - date.dayOfMonth + 1; | ||
20079 | |||
20080 | fields[DAY_OF_YEAR] = dayOfYear; | ||
20081 | fields[DAY_OF_WEEK_IN_MONTH] = toInt((date.dayOfMonth - 1) / 7) + 1; | ||
20082 | |||
20083 | var weekOfYear = getWeekNumber(this, fixedDateJan1, fixedDate); | ||
20084 | |||
20085 | // 本周没有足够的时间在当前年 | ||
20086 | if (weekOfYear === 0) { | ||
20087 | // If the date belongs to the last week of the | ||
20088 | // previous year, use the week number of "12/31" of | ||
20089 | // the "previous" year. | ||
20090 | var fixedDec31 = fixedDateJan1 - 1; | ||
20091 | var prevJan1 = fixedDateJan1 - getYearLength(year - 1); | ||
20092 | weekOfYear = getWeekNumber(this, prevJan1, fixedDec31); | ||
20093 | } else | ||
20094 | // 本周是年末最后一周,可能有足够的时间在新的一年 | ||
20095 | if (weekOfYear >= 52) { | ||
20096 | var nextJan1 = fixedDateJan1 + getYearLength(year); | ||
20097 | var nextJan1st = getDayOfWeekDateOnOrBefore(nextJan1 + 6, this.firstDayOfWeek); | ||
20098 | var nDays = nextJan1st - nextJan1; | ||
20099 | // 本周有足够天数在新的一年 | ||
20100 | if (nDays >= this.minimalDaysInFirstWeek && | ||
20101 | // 当天确实在本周,weekOfYear === 53 时是不需要这个判断 | ||
20102 | fixedDate >= nextJan1st - 7) { | ||
20103 | weekOfYear = 1; | ||
20104 | } | ||
20105 | } | ||
20106 | |||
20107 | fields[WEEK_OF_YEAR] = weekOfYear; | ||
20108 | fields[WEEK_OF_MONTH] = getWeekNumber(this, fixDateMonth1, fixedDate); | ||
20109 | |||
20110 | this.fieldsComputed = true; | ||
20111 | }, | ||
20112 | |||
20113 | /* | ||
20114 | * Converts calendar field values to the time value | ||
20115 | * (millisecond offset from the Epoch). | ||
20116 | * @protected | ||
20117 | */ | ||
20118 | computeTime: function computeTime() { | ||
20119 | var year = undefined; | ||
20120 | var fields = this.fields; | ||
20121 | if (this.isSet(YEAR)) { | ||
20122 | year = fields[YEAR]; | ||
20123 | } else { | ||
20124 | year = new Date().getFullYear(); | ||
20125 | } | ||
20126 | var timeOfDay = 0; | ||
20127 | if (this.isSet(HOUR_OF_DAY)) { | ||
20128 | timeOfDay += fields[HOUR_OF_DAY]; | ||
20129 | } | ||
20130 | timeOfDay *= 60; | ||
20131 | timeOfDay += fields[MINUTE] || 0; | ||
20132 | timeOfDay *= 60; | ||
20133 | timeOfDay += fields[SECONDS] || 0; | ||
20134 | timeOfDay *= 1000; | ||
20135 | timeOfDay += fields[MILLISECONDS] || 0; | ||
20136 | var fixedDate = 0; | ||
20137 | fields[YEAR] = year; | ||
20138 | fixedDate = fixedDate + this.getFixedDate(); | ||
20139 | // millis represents local wall-clock time in milliseconds. | ||
20140 | var millis = (fixedDate - EPOCH_OFFSET) * ONE_DAY + timeOfDay; | ||
20141 | millis -= this.timezoneOffset * ONE_MINUTE; | ||
20142 | this.time = millis; | ||
20143 | this.computeFields(); | ||
20144 | }, | ||
20145 | |||
20146 | /* | ||
20147 | * Fills in any unset fields in the calendar fields. First, | ||
20148 | * the computeTime() method is called if the time value (millisecond offset from the Epoch) | ||
20149 | * has not been calculated from calendar field values. | ||
20150 | * Then, the computeFields() method is called to calculate all calendar field values. | ||
20151 | * @protected | ||
20152 | */ | ||
20153 | complete: function complete() { | ||
20154 | if (this.time === undefined) { | ||
20155 | this.computeTime(); | ||
20156 | } | ||
20157 | if (!this.fieldsComputed) { | ||
20158 | this.computeFields(); | ||
20159 | } | ||
20160 | }, | ||
20161 | |||
20162 | getFixedDate: function getFixedDate() { | ||
20163 | var self = this; | ||
20164 | |||
20165 | var fields = self.fields; | ||
20166 | |||
20167 | var firstDayOfWeekCfg = self.firstDayOfWeek; | ||
20168 | |||
20169 | var year = fields[YEAR]; | ||
20170 | |||
20171 | var month = GregorianCalendar.JANUARY; | ||
20172 | |||
20173 | if (self.isSet(MONTH)) { | ||
20174 | month = fields[MONTH]; | ||
20175 | if (month > GregorianCalendar.DECEMBER) { | ||
20176 | year += toInt(month / 12); | ||
20177 | month %= 12; | ||
20178 | } else if (month < GregorianCalendar.JANUARY) { | ||
20179 | year += floorDivide(month / 12); | ||
20180 | month = mod(month, 12); | ||
20181 | } | ||
20182 | } | ||
20183 | |||
20184 | // Get the fixed date since Jan 1, 1 (Gregorian). We are on | ||
20185 | // the first day of either `month' or January in 'year'. | ||
20186 | var fixedDate = Utils.getFixedDate(year, month, 1); | ||
20187 | var firstDayOfWeek = undefined; | ||
20188 | var dayOfWeek = self.firstDayOfWeek; | ||
20189 | |||
20190 | if (self.isSet(DAY_OF_WEEK)) { | ||
20191 | dayOfWeek = fields[DAY_OF_WEEK]; | ||
20192 | } | ||
20193 | |||
20194 | if (self.isSet(MONTH)) { | ||
20195 | if (self.isSet(DAY_OF_MONTH)) { | ||
20196 | fixedDate += fields[DAY_OF_MONTH] - 1; | ||
20197 | } else { | ||
20198 | if (self.isSet(WEEK_OF_MONTH)) { | ||
20199 | firstDayOfWeek = getDayOfWeekDateOnOrBefore(fixedDate + 6, firstDayOfWeekCfg); | ||
20200 | |||
20201 | // If we have enough days in the first week, then | ||
20202 | // move to the previous week. | ||
20203 | if (firstDayOfWeek - fixedDate >= self.minimalDaysInFirstWeek) { | ||
20204 | firstDayOfWeek -= 7; | ||
20205 | } | ||
20206 | |||
20207 | if (dayOfWeek !== firstDayOfWeekCfg) { | ||
20208 | firstDayOfWeek = getDayOfWeekDateOnOrBefore(firstDayOfWeek + 6, dayOfWeek); | ||
20209 | } | ||
20210 | |||
20211 | fixedDate = firstDayOfWeek + 7 * (fields[WEEK_OF_MONTH] - 1); | ||
20212 | } else { | ||
20213 | var dowim = undefined; | ||
20214 | if (self.isSet(DAY_OF_WEEK_IN_MONTH)) { | ||
20215 | dowim = fields[DAY_OF_WEEK_IN_MONTH]; | ||
20216 | } else { | ||
20217 | dowim = 1; | ||
20218 | } | ||
20219 | var lastDate = 7 * dowim; | ||
20220 | if (dowim < 0) { | ||
20221 | lastDate = getMonthLength(year, month) + 7 * (dowim + 1); | ||
20222 | } | ||
20223 | fixedDate = getDayOfWeekDateOnOrBefore(fixedDate + lastDate - 1, dayOfWeek); | ||
20224 | } | ||
20225 | } | ||
20226 | } else { | ||
20227 | // We are on the first day of the year. | ||
20228 | if (self.isSet(DAY_OF_YEAR)) { | ||
20229 | fixedDate += fields[DAY_OF_YEAR] - 1; | ||
20230 | } else if (self.isSet(WEEK_OF_YEAR)) { | ||
20231 | firstDayOfWeek = getDayOfWeekDateOnOrBefore(fixedDate + 6, firstDayOfWeekCfg); | ||
20232 | // If we have enough days in the first week, then move | ||
20233 | // to the previous week. | ||
20234 | if (firstDayOfWeek - fixedDate >= self.minimalDaysInFirstWeek) { | ||
20235 | firstDayOfWeek -= 7; | ||
20236 | } | ||
20237 | if (dayOfWeek !== firstDayOfWeekCfg) { | ||
20238 | firstDayOfWeek = getDayOfWeekDateOnOrBefore(firstDayOfWeek + 6, dayOfWeek); | ||
20239 | } | ||
20240 | fixedDate = firstDayOfWeek + 7 * (fields[WEEK_OF_YEAR] - 1); | ||
20241 | } | ||
20242 | } | ||
20243 | |||
20244 | return fixedDate; | ||
20245 | }, | ||
20246 | |||
20247 | /* | ||
20248 | * Returns this Calendar's time value in milliseconds | ||
20249 | * @member Date.Gregorian | ||
20250 | * @returns {Number} the current time as UTC milliseconds from the epoch. | ||
20251 | */ | ||
20252 | getTime: function getTime() { | ||
20253 | if (this.time === undefined) { | ||
20254 | this.computeTime(); | ||
20255 | } | ||
20256 | return this.time; | ||
20257 | }, | ||
20258 | |||
20259 | /* | ||
20260 | * Sets this Calendar's current time from the given long value. | ||
20261 | * @param time the new time in UTC milliseconds from the epoch. | ||
20262 | */ | ||
20263 | setTime: function setTime(time) { | ||
20264 | this.time = time; | ||
20265 | this.fieldsComputed = false; | ||
20266 | this.complete(); | ||
20267 | }, | ||
20268 | |||
20269 | /* | ||
20270 | * Returns the value of the given calendar field. | ||
20271 | * @param field the given calendar field. | ||
20272 | * @returns {Number} the value for the given calendar field. | ||
20273 | */ | ||
20274 | get: function get(field) { | ||
20275 | this.complete(); | ||
20276 | return this.fields[field]; | ||
20277 | }, | ||
20278 | |||
20279 | /* | ||
20280 | * Returns the year of the given calendar field. | ||
20281 | * @method getYear | ||
20282 | * @returns {Number} the year for the given calendar field. | ||
20283 | */ | ||
20284 | |||
20285 | /* | ||
20286 | * Returns the month of the given calendar field. | ||
20287 | * @method getMonth | ||
20288 | * @returns {Number} the month for the given calendar field. | ||
20289 | */ | ||
20290 | |||
20291 | /* | ||
20292 | * Returns the day of month of the given calendar field. | ||
20293 | * @method getDayOfMonth | ||
20294 | * @returns {Number} the day of month for the given calendar field. | ||
20295 | */ | ||
20296 | |||
20297 | /* | ||
20298 | * Returns the hour of day of the given calendar field. | ||
20299 | * @method getHourOfDay | ||
20300 | * @returns {Number} the hour of day for the given calendar field. | ||
20301 | */ | ||
20302 | |||
20303 | /* | ||
20304 | * Returns the minute of the given calendar field. | ||
20305 | * @method getMinute | ||
20306 | * @returns {Number} the minute for the given calendar field. | ||
20307 | */ | ||
20308 | |||
20309 | /* | ||
20310 | * Returns the second of the given calendar field. | ||
20311 | * @method getSecond | ||
20312 | * @returns {Number} the second for the given calendar field. | ||
20313 | */ | ||
20314 | |||
20315 | /* | ||
20316 | * Returns the millisecond of the given calendar field. | ||
20317 | * @method getMilliSecond | ||
20318 | * @returns {Number} the millisecond for the given calendar field. | ||
20319 | */ | ||
20320 | |||
20321 | /* | ||
20322 | * Returns the week of year of the given calendar field. | ||
20323 | * @method getWeekOfYear | ||
20324 | * @returns {Number} the week of year for the given calendar field. | ||
20325 | */ | ||
20326 | |||
20327 | /* | ||
20328 | * Returns the week of month of the given calendar field. | ||
20329 | * @method getWeekOfMonth | ||
20330 | * @returns {Number} the week of month for the given calendar field. | ||
20331 | */ | ||
20332 | |||
20333 | /* | ||
20334 | * Returns the day of year of the given calendar field. | ||
20335 | * @method getDayOfYear | ||
20336 | * @returns {Number} the day of year for the given calendar field. | ||
20337 | */ | ||
20338 | |||
20339 | /* | ||
20340 | * Returns the day of week of the given calendar field. | ||
20341 | * @method getDayOfWeek | ||
20342 | * @returns {Number} the day of week for the given calendar field. | ||
20343 | */ | ||
20344 | |||
20345 | /* | ||
20346 | * Returns the day of week in month of the given calendar field. | ||
20347 | * @method getDayOfWeekInMonth | ||
20348 | * @returns {Number} the day of week in month for the given calendar field. | ||
20349 | */ | ||
20350 | |||
20351 | /* | ||
20352 | * Sets the given calendar field to the given value. | ||
20353 | * @param field the given calendar field. | ||
20354 | * @param v the value to be set for the given calendar field. | ||
20355 | */ | ||
20356 | set: function set(field, v) { | ||
20357 | var len = arguments.length; | ||
20358 | if (len === 2) { | ||
20359 | this.fields[field] = v; | ||
20360 | } else if (len < MILLISECONDS + 1) { | ||
20361 | for (var i = 0; i < len; i++) { | ||
20362 | this.fields[YEAR + i] = arguments[i]; | ||
20363 | } | ||
20364 | } else { | ||
20365 | throw new Error('illegal arguments for GregorianCalendar set'); | ||
20366 | } | ||
20367 | this.time = undefined; | ||
20368 | }, | ||
20369 | |||
20370 | /* | ||
20371 | * Set the year of the given calendar field. | ||
20372 | * @method setYear | ||
20373 | */ | ||
20374 | |||
20375 | /* | ||
20376 | * Set the month of the given calendar field. | ||
20377 | * @method setMonth | ||
20378 | */ | ||
20379 | |||
20380 | /* | ||
20381 | * Set the day of month of the given calendar field. | ||
20382 | * @method setDayOfMonth | ||
20383 | */ | ||
20384 | |||
20385 | /* | ||
20386 | * Set the hour of day of the given calendar field. | ||
20387 | * @method setHourOfDay | ||
20388 | */ | ||
20389 | |||
20390 | /* | ||
20391 | * Set the minute of the given calendar field. | ||
20392 | * @method setMinute | ||
20393 | */ | ||
20394 | |||
20395 | /* | ||
20396 | * Set the second of the given calendar field. | ||
20397 | * @method setSecond | ||
20398 | */ | ||
20399 | |||
20400 | /* | ||
20401 | * Set the millisecond of the given calendar field. | ||
20402 | * @method setMilliSecond | ||
20403 | */ | ||
20404 | |||
20405 | /* | ||
20406 | * Set the week of year of the given calendar field. | ||
20407 | * @method setWeekOfYear | ||
20408 | */ | ||
20409 | |||
20410 | /* | ||
20411 | * Set the week of month of the given calendar field. | ||
20412 | * @method setWeekOfMonth | ||
20413 | */ | ||
20414 | |||
20415 | /* | ||
20416 | * Set the day of year of the given calendar field. | ||
20417 | * @method setDayOfYear | ||
20418 | */ | ||
20419 | |||
20420 | /* | ||
20421 | * Set the day of week of the given calendar field. | ||
20422 | * @method setDayOfWeek | ||
20423 | */ | ||
20424 | |||
20425 | /* | ||
20426 | * Set the day of week in month of the given calendar field. | ||
20427 | * @method setDayOfWeekInMonth | ||
20428 | */ | ||
20429 | |||
20430 | /* | ||
20431 | * add for specified field based on two rules: | ||
20432 | * | ||
20433 | * - Add rule 1. The value of field after the call minus the value of field before the | ||
20434 | * call is amount, modulo any overflow that has occurred in field | ||
20435 | * Overflow occurs when a field value exceeds its range and, | ||
20436 | * as a result, the next larger field is incremented or | ||
20437 | * decremented and the field value is adjusted back into its range. | ||
20438 | * | ||
20439 | * - Add rule 2. If a smaller field is expected to be invariant, | ||
20440 | * but it is impossible for it to be equal to its | ||
20441 | * prior value because of changes in its minimum or maximum after | ||
20442 | * field is changed, then its value is adjusted to be as close | ||
20443 | * as possible to its expected value. A smaller field represents a | ||
20444 | * smaller unit of time. HOUR_OF_DAY is a smaller field than | ||
20445 | * DAY_OF_MONTH. No adjustment is made to smaller fields | ||
20446 | * that are not expected to be invariant. The calendar system | ||
20447 | * determines what fields are expected to be invariant. | ||
20448 | * | ||
20449 | * | ||
20450 | * @example | ||
20451 | * use('date/gregorian',function(S, GregorianCalendar){ | ||
20452 | * const d = new GregorianCalendar(); | ||
20453 | * d.set(2012, GregorianCalendar.JANUARY, 31); | ||
20454 | * d.add(Gregorian.MONTH,1); | ||
20455 | * // 2012-2-29 | ||
20456 | * document.writeln('<p>'+d.getYear()+'-'+d.getMonth()+'-'+d.getDayOfWeek()) | ||
20457 | * d.add(Gregorian.MONTH,12); | ||
20458 | * // 2013-2-28 | ||
20459 | * document.writeln('<p>'+d.getYear()+'-'+d.getMonth()+'-'+d.getDayOfWeek()) | ||
20460 | * }); | ||
20461 | * | ||
20462 | * @param field the calendar field. | ||
20463 | * @param {Number} amount he amount of date or time to be added to the field. | ||
20464 | */ | ||
20465 | add: function add(field, a) { | ||
20466 | if (!a) { | ||
20467 | return; | ||
20468 | } | ||
20469 | var amount = a; | ||
20470 | var self = this; | ||
20471 | var fields = self.fields; | ||
20472 | // computer and retrieve original value | ||
20473 | var value = self.get(field); | ||
20474 | if (field === YEAR) { | ||
20475 | value += amount; | ||
20476 | self.set(YEAR, value); | ||
20477 | adjustDayOfMonth(self); | ||
20478 | } else if (field === MONTH) { | ||
20479 | value += amount; | ||
20480 | var yearAmount = floorDivide(value / 12); | ||
20481 | value = mod(value, 12); | ||
20482 | if (yearAmount) { | ||
20483 | self.set(YEAR, fields[YEAR] + yearAmount); | ||
20484 | } | ||
20485 | self.set(MONTH, value); | ||
20486 | adjustDayOfMonth(self); | ||
20487 | } else { | ||
20488 | switch (field) { | ||
20489 | case HOUR_OF_DAY: | ||
20490 | amount *= ONE_HOUR; | ||
20491 | break; | ||
20492 | case MINUTE: | ||
20493 | amount *= ONE_MINUTE; | ||
20494 | break; | ||
20495 | case SECONDS: | ||
20496 | amount *= ONE_SECOND; | ||
20497 | break; | ||
20498 | case MILLISECONDS: | ||
20499 | break; | ||
20500 | case WEEK_OF_MONTH: | ||
20501 | case WEEK_OF_YEAR: | ||
20502 | case DAY_OF_WEEK_IN_MONTH: | ||
20503 | amount *= ONE_WEEK; | ||
20504 | break; | ||
20505 | case DAY_OF_WEEK: | ||
20506 | case DAY_OF_YEAR: | ||
20507 | case DAY_OF_MONTH: | ||
20508 | amount *= ONE_DAY; | ||
20509 | break; | ||
20510 | default: | ||
20511 | throw new Error('illegal field for add'); | ||
20512 | } | ||
20513 | self.setTime(self.time + amount); | ||
20514 | } | ||
20515 | }, | ||
20516 | |||
20517 | /* | ||
20518 | * add the year of the given calendar field. | ||
20519 | * @method addYear | ||
20520 | * @param {Number} amount the signed amount to add to field. | ||
20521 | */ | ||
20522 | |||
20523 | /* | ||
20524 | * add the month of the given calendar field. | ||
20525 | * @method addMonth | ||
20526 | * @param {Number} amount the signed amount to add to field. | ||
20527 | */ | ||
20528 | |||
20529 | /* | ||
20530 | * add the day of month of the given calendar field. | ||
20531 | * @method addDayOfMonth | ||
20532 | * @param {Number} amount the signed amount to add to field. | ||
20533 | */ | ||
20534 | |||
20535 | /* | ||
20536 | * add the hour of day of the given calendar field. | ||
20537 | * @method addHourOfDay | ||
20538 | * @param {Number} amount the signed amount to add to field. | ||
20539 | */ | ||
20540 | |||
20541 | /* | ||
20542 | * add the minute of the given calendar field. | ||
20543 | * @method addMinute | ||
20544 | * @param {Number} amount the signed amount to add to field. | ||
20545 | */ | ||
20546 | |||
20547 | /* | ||
20548 | * add the second of the given calendar field. | ||
20549 | * @method addSecond | ||
20550 | * @param {Number} amount the signed amount to add to field. | ||
20551 | */ | ||
20552 | |||
20553 | /* | ||
20554 | * add the millisecond of the given calendar field. | ||
20555 | * @method addMilliSecond | ||
20556 | * @param {Number} amount the signed amount to add to field. | ||
20557 | */ | ||
20558 | |||
20559 | /* | ||
20560 | * add the week of year of the given calendar field. | ||
20561 | * @method addWeekOfYear | ||
20562 | * @param {Number} amount the signed amount to add to field. | ||
20563 | */ | ||
20564 | |||
20565 | /* | ||
20566 | * add the week of month of the given calendar field. | ||
20567 | * @method addWeekOfMonth | ||
20568 | * @param {Number} amount the signed amount to add to field. | ||
20569 | */ | ||
20570 | |||
20571 | /* | ||
20572 | * add the day of year of the given calendar field. | ||
20573 | * @method addDayOfYear | ||
20574 | * @param {Number} amount the signed amount to add to field. | ||
20575 | */ | ||
20576 | |||
20577 | /* | ||
20578 | * add the day of week of the given calendar field. | ||
20579 | * @method addDayOfWeek | ||
20580 | * @param {Number} amount the signed amount to add to field. | ||
20581 | */ | ||
20582 | |||
20583 | /* | ||
20584 | * add the day of week in month of the given calendar field. | ||
20585 | * @method addDayOfWeekInMonth | ||
20586 | * @param {Number} amount the signed amount to add to field. | ||
20587 | */ | ||
20588 | |||
20589 | /* | ||
20590 | * Get rolled value for the field | ||
20591 | * @protected | ||
20592 | */ | ||
20593 | getRolledValue: function getRolledValue(value, a, min, max) { | ||
20594 | var amount = a; | ||
20595 | var diff = value - min; | ||
20596 | var range = max - min + 1; | ||
20597 | amount %= range; | ||
20598 | return min + (diff + amount + range) % range; | ||
20599 | }, | ||
20600 | |||
20601 | /* | ||
20602 | * Adds a signed amount to the specified calendar field without changing larger fields. | ||
20603 | * A negative roll amount means to subtract from field without changing | ||
20604 | * larger fields. If the specified amount is 0, this method performs nothing. | ||
20605 | * | ||
20606 | * | ||
20607 | * | ||
20608 | * @example | ||
20609 | * const d = new GregorianCalendar(); | ||
20610 | * d.set(1999, GregorianCalendar.AUGUST, 31); | ||
20611 | * // 1999-4-30 | ||
20612 | * // Tuesday June 1, 1999 | ||
20613 | * d.set(1999, GregorianCalendar.JUNE, 1); | ||
20614 | * d.add(Gregorian.WEEK_OF_MONTH,-1); // === d.add(Gregorian.WEEK_OF_MONTH, | ||
20615 | * d.get(Gregorian.WEEK_OF_MONTH)); | ||
20616 | * // 1999-06-29 | ||
20617 | * | ||
20618 | * | ||
20619 | * @param field the calendar field. | ||
20620 | * @param {Number} amount the signed amount to add to field. | ||
20621 | */ | ||
20622 | roll: function roll(field, amount) { | ||
20623 | if (!amount) { | ||
20624 | return; | ||
20625 | } | ||
20626 | var self = this; | ||
20627 | // computer and retrieve original value | ||
20628 | var value = self.get(field); | ||
20629 | var min = self.getActualMinimum(field); | ||
20630 | var max = self.getActualMaximum(field); | ||
20631 | value = self.getRolledValue(value, amount, min, max); | ||
20632 | |||
20633 | self.set(field, value); | ||
20634 | |||
20635 | // consider compute time priority | ||
20636 | switch (field) { | ||
20637 | case MONTH: | ||
20638 | adjustDayOfMonth(self); | ||
20639 | break; | ||
20640 | default: | ||
20641 | // other fields are set already when get | ||
20642 | self.updateFieldsBySet(field); | ||
20643 | break; | ||
20644 | } | ||
20645 | }, | ||
20646 | |||
20647 | /* | ||
20648 | * keep field stable. | ||
20649 | * | ||
20650 | * 2015-09-29 setMonth 2 vs rollSetMonth 2 | ||
20651 | * | ||
20652 | */ | ||
20653 | rollSet: function rollSet(field, v) { | ||
20654 | this.set(field, v); | ||
20655 | switch (field) { | ||
20656 | case MONTH: | ||
20657 | adjustDayOfMonth(this); | ||
20658 | break; | ||
20659 | default: | ||
20660 | // other fields are set already when get | ||
20661 | this.updateFieldsBySet(field); | ||
20662 | break; | ||
20663 | } | ||
20664 | }, | ||
20665 | |||
20666 | /* | ||
20667 | * roll the year of the given calendar field. | ||
20668 | * @method rollYear | ||
20669 | * @param {Number} amount the signed amount to add to field. | ||
20670 | */ | ||
20671 | |||
20672 | /* | ||
20673 | * roll the month of the given calendar field. | ||
20674 | * @param {Number} amount the signed amount to add to field. | ||
20675 | * @method rollMonth | ||
20676 | */ | ||
20677 | |||
20678 | /* | ||
20679 | * roll the day of month of the given calendar field. | ||
20680 | * @method rollDayOfMonth | ||
20681 | * @param {Number} amount the signed amount to add to field. | ||
20682 | */ | ||
20683 | |||
20684 | /* | ||
20685 | * roll the hour of day of the given calendar field. | ||
20686 | * @method rollHourOfDay | ||
20687 | * @param {Number} amount the signed amount to add to field. | ||
20688 | */ | ||
20689 | |||
20690 | /* | ||
20691 | * roll the minute of the given calendar field. | ||
20692 | * @method rollMinute | ||
20693 | * @param {Number} amount the signed amount to add to field. | ||
20694 | */ | ||
20695 | |||
20696 | /* | ||
20697 | * roll the second of the given calendar field. | ||
20698 | * @method rollSecond | ||
20699 | * @param {Number} amount the signed amount to add to field. | ||
20700 | */ | ||
20701 | |||
20702 | /* | ||
20703 | * roll the millisecond of the given calendar field. | ||
20704 | * @method rollMilliSecond | ||
20705 | * @param {Number} amount the signed amount to add to field. | ||
20706 | */ | ||
20707 | |||
20708 | /* | ||
20709 | * roll the week of year of the given calendar field. | ||
20710 | * @method rollWeekOfYear | ||
20711 | * @param {Number} amount the signed amount to add to field. | ||
20712 | */ | ||
20713 | |||
20714 | /* | ||
20715 | * roll the week of month of the given calendar field. | ||
20716 | * @method rollWeekOfMonth | ||
20717 | * @param {Number} amount the signed amount to add to field. | ||
20718 | */ | ||
20719 | |||
20720 | /* | ||
20721 | * roll the day of year of the given calendar field. | ||
20722 | * @method rollDayOfYear | ||
20723 | * @param {Number} amount the signed amount to add to field. | ||
20724 | */ | ||
20725 | |||
20726 | /* | ||
20727 | * roll the day of week of the given calendar field. | ||
20728 | * @method rollDayOfWeek | ||
20729 | * @param {Number} amount the signed amount to add to field. | ||
20730 | */ | ||
20731 | |||
20732 | /* | ||
20733 | * remove other priority fields when call getFixedDate | ||
20734 | * precondition: other fields are all set or computed | ||
20735 | * @protected | ||
20736 | */ | ||
20737 | updateFieldsBySet: function updateFieldsBySet(field) { | ||
20738 | var fields = this.fields; | ||
20739 | switch (field) { | ||
20740 | case WEEK_OF_MONTH: | ||
20741 | fields[DAY_OF_MONTH] = undefined; | ||
20742 | break; | ||
20743 | case DAY_OF_YEAR: | ||
20744 | fields[MONTH] = undefined; | ||
20745 | break; | ||
20746 | case DAY_OF_WEEK: | ||
20747 | fields[DAY_OF_MONTH] = undefined; | ||
20748 | break; | ||
20749 | case WEEK_OF_YEAR: | ||
20750 | fields[DAY_OF_YEAR] = undefined; | ||
20751 | fields[MONTH] = undefined; | ||
20752 | break; | ||
20753 | default: | ||
20754 | break; | ||
20755 | } | ||
20756 | }, | ||
20757 | |||
20758 | /* | ||
20759 | * get current date instance's timezone offset | ||
20760 | * @returns {Number} | ||
20761 | */ | ||
20762 | getTimezoneOffset: function getTimezoneOffset() { | ||
20763 | return this.timezoneOffset; | ||
20764 | }, | ||
20765 | |||
20766 | /* | ||
20767 | * set current date instance's timezone offset | ||
20768 | */ | ||
20769 | setTimezoneOffset: function setTimezoneOffset(timezoneOffset) { | ||
20770 | if (this.timezoneOffset !== timezoneOffset) { | ||
20771 | this.fieldsComputed = undefined; | ||
20772 | this.timezoneOffset = timezoneOffset; | ||
20773 | } | ||
20774 | }, | ||
20775 | |||
20776 | /* | ||
20777 | * set first day of week for current date instance | ||
20778 | */ | ||
20779 | setFirstDayOfWeek: function setFirstDayOfWeek(firstDayOfWeek) { | ||
20780 | if (this.firstDayOfWeek !== firstDayOfWeek) { | ||
20781 | this.firstDayOfWeek = firstDayOfWeek; | ||
20782 | this.fieldsComputed = false; | ||
20783 | } | ||
20784 | }, | ||
20785 | |||
20786 | /* | ||
20787 | * Gets what the first day of the week is; e.g., SUNDAY in the U.S., MONDAY in France. | ||
20788 | * @returns {Number} the first day of the week. | ||
20789 | */ | ||
20790 | getFirstDayOfWeek: function getFirstDayOfWeek() { | ||
20791 | return this.firstDayOfWeek; | ||
20792 | }, | ||
20793 | |||
20794 | /* | ||
20795 | * Sets what the minimal days required in the first week of the year are; For example, | ||
20796 | * if the first week is defined as one that contains the first day of the first month of a year, | ||
20797 | * call this method with value 1. | ||
20798 | * If it must be a full week, use value 7. | ||
20799 | * @param minimalDaysInFirstWeek the given minimal days required in the first week of the year. | ||
20800 | */ | ||
20801 | setMinimalDaysInFirstWeek: function setMinimalDaysInFirstWeek(minimalDaysInFirstWeek) { | ||
20802 | if (this.minimalDaysInFirstWeek !== minimalDaysInFirstWeek) { | ||
20803 | this.minimalDaysInFirstWeek = minimalDaysInFirstWeek; | ||
20804 | this.fieldsComputed = false; | ||
20805 | } | ||
20806 | }, | ||
20807 | |||
20808 | /* | ||
20809 | * Gets what the minimal days required in the first week of the year are; e.g., | ||
20810 | * if the first week is defined as one that contains the first day of the first month of a year, | ||
20811 | * this method returns 1. | ||
20812 | * If the minimal days required must be a full week, this method returns 7. | ||
20813 | * @returns {Number} the minimal days required in the first week of the year. | ||
20814 | */ | ||
20815 | getMinimalDaysInFirstWeek: function getMinimalDaysInFirstWeek() { | ||
20816 | return this.minimalDaysInFirstWeek; | ||
20817 | }, | ||
20818 | |||
20819 | /* | ||
20820 | * Returns the number of weeks in the week year | ||
20821 | * represented by this GregorianCalendar. | ||
20822 | * | ||
20823 | * For example, if this GregorianCalendar's date is | ||
20824 | * December 31, 2008 with the ISO | ||
20825 | * 8601 compatible setting, this method will return 53 for the | ||
20826 | * period: December 29, 2008 to January 3, 2010 | ||
20827 | * while getActualMaximum(WEEK_OF_YEAR) will return | ||
20828 | * 52 for the period: December 31, 2007 to December 28, 2008. | ||
20829 | * | ||
20830 | * @return {Number} the number of weeks in the week year. | ||
20831 | */ | ||
20832 | getWeeksInWeekYear: function getWeeksInWeekYear() { | ||
20833 | var weekYear = this.getWeekYear(); | ||
20834 | if (weekYear === this.get(YEAR)) { | ||
20835 | return this.getActualMaximum(WEEK_OF_YEAR); | ||
20836 | } | ||
20837 | // Use the 2nd week for calculating the max of WEEK_OF_YEAR | ||
20838 | var gc = this.clone(); | ||
20839 | gc.clear(); | ||
20840 | gc.setWeekDate(weekYear, 2, this.get(DAY_OF_WEEK)); | ||
20841 | return gc.getActualMaximum(WEEK_OF_YEAR); | ||
20842 | }, | ||
20843 | |||
20844 | /* | ||
20845 | * Returns the week year represented by this GregorianCalendar. | ||
20846 | * The dates in the weeks between 1 and the | ||
20847 | * maximum week number of the week year have the same week year value | ||
20848 | * that may be one year before or after the calendar year value. | ||
20849 | * | ||
20850 | * @return {Number} the week year represented by this GregorianCalendar. | ||
20851 | */ | ||
20852 | getWeekYear: function getWeekYear() { | ||
20853 | var year = this.get(YEAR); // implicitly complete | ||
20854 | var weekOfYear = this.get(WEEK_OF_YEAR); | ||
20855 | var month = this.get(MONTH); | ||
20856 | if (month === GregorianCalendar.JANUARY) { | ||
20857 | if (weekOfYear >= 52) { | ||
20858 | --year; | ||
20859 | } | ||
20860 | } else if (month === GregorianCalendar.DECEMBER) { | ||
20861 | if (weekOfYear === 1) { | ||
20862 | ++year; | ||
20863 | } | ||
20864 | } | ||
20865 | return year; | ||
20866 | }, | ||
20867 | /* | ||
20868 | * Sets this GregorianCalendar to the date given by the date specifiers - weekYear, | ||
20869 | * weekOfYear, and dayOfWeek. weekOfYear follows the WEEK_OF_YEAR numbering. | ||
20870 | * The dayOfWeek value must be one of the DAY_OF_WEEK values: SUNDAY to SATURDAY. | ||
20871 | * | ||
20872 | * @param weekYear the week year | ||
20873 | * @param weekOfYear the week number based on weekYear | ||
20874 | * @param dayOfWeek the day of week value | ||
20875 | */ | ||
20876 | setWeekDate: function setWeekDate(weekYear, weekOfYear, dayOfWeek) { | ||
20877 | if (dayOfWeek < GregorianCalendar.SUNDAY || dayOfWeek > GregorianCalendar.SATURDAY) { | ||
20878 | throw new Error('invalid dayOfWeek: ' + dayOfWeek); | ||
20879 | } | ||
20880 | var fields = this.fields; | ||
20881 | // To avoid changing the time of day fields by date | ||
20882 | // calculations, use a clone with the GMT time zone. | ||
20883 | var gc = this.clone(); | ||
20884 | gc.clear(); | ||
20885 | gc.setTimezoneOffset(0); | ||
20886 | gc.set(YEAR, weekYear); | ||
20887 | gc.set(WEEK_OF_YEAR, 1); | ||
20888 | gc.set(DAY_OF_WEEK, this.getFirstDayOfWeek()); | ||
20889 | var days = dayOfWeek - this.getFirstDayOfWeek(); | ||
20890 | if (days < 0) { | ||
20891 | days += 7; | ||
20892 | } | ||
20893 | days += 7 * (weekOfYear - 1); | ||
20894 | if (days !== 0) { | ||
20895 | gc.add(DAY_OF_YEAR, days); | ||
20896 | } else { | ||
20897 | gc.complete(); | ||
20898 | } | ||
20899 | fields[YEAR] = gc.get(YEAR); | ||
20900 | fields[MONTH] = gc.get(MONTH); | ||
20901 | fields[DAY_OF_MONTH] = gc.get(DAY_OF_MONTH); | ||
20902 | this.complete(); | ||
20903 | }, | ||
20904 | /* | ||
20905 | * Creates and returns a copy of this object. | ||
20906 | * @returns {Date.Gregorian} | ||
20907 | */ | ||
20908 | clone: function clone() { | ||
20909 | if (this.time === undefined) { | ||
20910 | this.computeTime(); | ||
20911 | } | ||
20912 | var cal = new GregorianCalendar(this.locale); | ||
20913 | cal.setTimezoneOffset(cal.getTimezoneOffset()); | ||
20914 | cal.setFirstDayOfWeek(cal.getFirstDayOfWeek()); | ||
20915 | cal.setMinimalDaysInFirstWeek(cal.getMinimalDaysInFirstWeek()); | ||
20916 | cal.setTime(this.time); | ||
20917 | return cal; | ||
20918 | }, | ||
20919 | |||
20920 | /* | ||
20921 | * Compares this GregorianCalendar to the specified Object. | ||
20922 | * The result is true if and only if the argument is a GregorianCalendar object | ||
20923 | * that represents the same time value (millisecond offset from the Epoch) | ||
20924 | * under the same Calendar parameters and Gregorian change date as this object. | ||
20925 | * @param {Date.Gregorian} obj the object to compare with. | ||
20926 | * @returns {boolean} true if this object is equal to obj; false otherwise. | ||
20927 | */ | ||
20928 | equals: function equals(obj) { | ||
20929 | return this.getTime() === obj.getTime() && this.firstDayOfWeek === obj.firstDayOfWeek && this.timezoneOffset === obj.timezoneOffset && this.minimalDaysInFirstWeek === obj.minimalDaysInFirstWeek; | ||
20930 | }, | ||
20931 | |||
20932 | /* | ||
20933 | * Sets all the calendar field values or specified field and the time value | ||
20934 | * (millisecond offset from the Epoch) of this Calendar undefined. | ||
20935 | * This means that isSet() will return false for all the calendar fields, | ||
20936 | * and the date and time calculations will treat the fields as if they had never been set. | ||
20937 | * @param [field] the calendar field to be cleared. | ||
20938 | */ | ||
20939 | clear: function clear(field) { | ||
20940 | if (field === undefined) { | ||
20941 | this.field = []; | ||
20942 | } else { | ||
20943 | this.fields[field] = undefined; | ||
20944 | } | ||
20945 | this.time = undefined; | ||
20946 | this.fieldsComputed = false; | ||
20947 | } | ||
20948 | }; | ||
20949 | |||
20950 | var GregorianCalendarProto = GregorianCalendar.prototype; | ||
20951 | |||
20952 | Utils.each(FIELDS, function (f, index) { | ||
20953 | if (f) { | ||
20954 | GregorianCalendarProto['get' + f] = function get() { | ||
20955 | return this.get(index); | ||
20956 | }; | ||
20957 | |||
20958 | GregorianCalendarProto['isSet' + f] = function isSet() { | ||
20959 | return this.isSet(index); | ||
20960 | }; | ||
20961 | |||
20962 | GregorianCalendarProto['set' + f] = function set(v) { | ||
20963 | return this.set(index, v); | ||
20964 | }; | ||
20965 | |||
20966 | GregorianCalendarProto['add' + f] = function add(v) { | ||
20967 | return this.add(index, v); | ||
20968 | }; | ||
20969 | |||
20970 | GregorianCalendarProto['roll' + f] = function roll(v) { | ||
20971 | return this.roll(index, v); | ||
20972 | }; | ||
20973 | |||
20974 | GregorianCalendarProto['rollSet' + f] = function rollSet(v) { | ||
20975 | return this.rollSet(index, v); | ||
20976 | }; | ||
20977 | } | ||
20978 | }); | ||
20979 | |||
20980 | module.exports = GregorianCalendar; | ||
20981 | /* | ||
20982 | http://docs.oracle.com/javase/7/docs/api/java/util/GregorianCalendar.html | ||
20983 | |||
20984 | TODO | ||
20985 | - day saving time | ||
20986 | - i18n | ||
20987 | - julian calendar | ||
20988 | */ | ||
20989 | |||
20990 | /***/ }, | ||
20991 | /* 162 */ | ||
20992 | /***/ function(module, exports, __webpack_require__) { | ||
20993 | |||
20994 | /* | ||
20995 | * utils for gregorian date | ||
20996 | * @ignore | ||
20997 | * @author yiminghe@gmail.com | ||
20998 | */ | ||
20999 | |||
21000 | 'use strict'; | ||
21001 | |||
21002 | var Const = __webpack_require__(163); | ||
21003 | var floor = Math.floor; | ||
21004 | var ACCUMULATED_DAYS_IN_MONTH | ||
21005 | // 1/1 2/1 3/1 4/1 5/1 6/1 7/1 8/1 9/1 10/1 11/1 12/1 | ||
21006 | = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]; | ||
21007 | |||
21008 | var ACCUMULATED_DAYS_IN_MONTH_LEAP | ||
21009 | // 1/1 2/1 3/1 4/1 5/1 6/1 7/1 8/1 9/1 | ||
21010 | // 10/1 11/1 12/1 | ||
21011 | = [0, 31, 59 + 1, 90 + 1, 120 + 1, 151 + 1, 181 + 1, 212 + 1, 243 + 1, 273 + 1, 304 + 1, 334 + 1]; | ||
21012 | |||
21013 | var DAYS_OF_YEAR = 365; | ||
21014 | var DAYS_OF_4YEAR = 365 * 4 + 1; | ||
21015 | var DAYS_OF_100YEAR = DAYS_OF_4YEAR * 25 - 1; | ||
21016 | var DAYS_OF_400YEAR = DAYS_OF_100YEAR * 4 + 1; | ||
21017 | var _exports = {}; | ||
21018 | |||
21019 | function getDayOfYear(year, month, dayOfMonth) { | ||
21020 | return dayOfMonth + (_exports.isLeapYear(year) ? ACCUMULATED_DAYS_IN_MONTH_LEAP[month] : ACCUMULATED_DAYS_IN_MONTH[month]); | ||
21021 | } | ||
21022 | |||
21023 | function getDayOfWeekFromFixedDate(fixedDate) { | ||
21024 | // The fixed day 1 (January 1, 1 Gregorian) is Monday. | ||
21025 | if (fixedDate >= 0) { | ||
21026 | return fixedDate % 7; | ||
21027 | } | ||
21028 | return _exports.mod(fixedDate, 7); | ||
21029 | } | ||
21030 | |||
21031 | function getGregorianYearFromFixedDate(fixedDate) { | ||
21032 | var d0 = undefined; | ||
21033 | var d1 = undefined; | ||
21034 | var d2 = undefined; | ||
21035 | var d3 = undefined; | ||
21036 | var n400 = undefined; | ||
21037 | var n100 = undefined; | ||
21038 | var n4 = undefined; | ||
21039 | var n1 = undefined; | ||
21040 | var year = undefined; | ||
21041 | d0 = fixedDate - 1; | ||
21042 | |||
21043 | n400 = floor(d0 / DAYS_OF_400YEAR); | ||
21044 | d1 = _exports.mod(d0, DAYS_OF_400YEAR); | ||
21045 | n100 = floor(d1 / DAYS_OF_100YEAR); | ||
21046 | d2 = _exports.mod(d1, DAYS_OF_100YEAR); | ||
21047 | n4 = floor(d2 / DAYS_OF_4YEAR); | ||
21048 | d3 = _exports.mod(d2, DAYS_OF_4YEAR); | ||
21049 | n1 = floor(d3 / DAYS_OF_YEAR); | ||
21050 | |||
21051 | year = 400 * n400 + 100 * n100 + 4 * n4 + n1; | ||
21052 | |||
21053 | // ? | ||
21054 | if (!(n100 === 4 || n1 === 4)) { | ||
21055 | ++year; | ||
21056 | } | ||
21057 | |||
21058 | return year; | ||
21059 | } | ||
21060 | |||
21061 | _exports = module.exports = { | ||
21062 | each: function each(arr, fn) { | ||
21063 | for (var i = 0, len = arr.length; i < len; i++) { | ||
21064 | if (fn(arr[i], i, arr) === false) { | ||
21065 | break; | ||
21066 | } | ||
21067 | } | ||
21068 | }, | ||
21069 | |||
21070 | mix: function mix(t, s) { | ||
21071 | for (var p in s) { | ||
21072 | if (s.hasOwnProperty(p)) { | ||
21073 | t[p] = s[p]; | ||
21074 | } | ||
21075 | } | ||
21076 | }, | ||
21077 | |||
21078 | isLeapYear: function isLeapYear(year) { | ||
21079 | if ((year & 3) !== 0) { | ||
21080 | return false; | ||
21081 | } | ||
21082 | return year % 100 !== 0 || year % 400 === 0; | ||
21083 | }, | ||
21084 | |||
21085 | mod: function mod(x, y) { | ||
21086 | // 负数时不是镜像关系 | ||
21087 | return x - y * floor(x / y); | ||
21088 | }, | ||
21089 | |||
21090 | // month: 0 based | ||
21091 | getFixedDate: function getFixedDate(year, month, dayOfMonth) { | ||
21092 | var prevYear = year - 1; | ||
21093 | // 考虑公元前 | ||
21094 | return DAYS_OF_YEAR * prevYear + floor(prevYear / 4) - floor(prevYear / 100) + floor(prevYear / 400) + getDayOfYear(year, month, dayOfMonth); | ||
21095 | }, | ||
21096 | |||
21097 | getGregorianDateFromFixedDate: function getGregorianDateFromFixedDate(fixedDate) { | ||
21098 | var year = getGregorianYearFromFixedDate(fixedDate); | ||
21099 | var jan1 = _exports.getFixedDate(year, Const.JANUARY, 1); | ||
21100 | var isLeap = _exports.isLeapYear(year); | ||
21101 | var ACCUMULATED_DAYS = isLeap ? ACCUMULATED_DAYS_IN_MONTH_LEAP : ACCUMULATED_DAYS_IN_MONTH; | ||
21102 | var daysDiff = fixedDate - jan1; | ||
21103 | var month = undefined; | ||
21104 | |||
21105 | for (var i = 0; i < ACCUMULATED_DAYS.length; i++) { | ||
21106 | if (ACCUMULATED_DAYS[i] <= daysDiff) { | ||
21107 | month = i; | ||
21108 | } else { | ||
21109 | break; | ||
21110 | } | ||
21111 | } | ||
21112 | |||
21113 | var dayOfMonth = fixedDate - jan1 - ACCUMULATED_DAYS[month] + 1; | ||
21114 | var dayOfWeek = getDayOfWeekFromFixedDate(fixedDate); | ||
21115 | |||
21116 | return { | ||
21117 | year: year, | ||
21118 | month: month, | ||
21119 | dayOfMonth: dayOfMonth, | ||
21120 | dayOfWeek: dayOfWeek, | ||
21121 | isLeap: isLeap | ||
21122 | }; | ||
21123 | } | ||
21124 | }; | ||
21125 | |||
21126 | /***/ }, | ||
21127 | /* 163 */ | ||
21128 | /***/ function(module, exports) { | ||
21129 | |||
21130 | /* | ||
21131 | * @ignore | ||
21132 | * const for gregorian date | ||
21133 | * @author yiminghe@gmail.com | ||
21134 | */ | ||
21135 | |||
21136 | "use strict"; | ||
21137 | |||
21138 | module.exports = { | ||
21139 | /* | ||
21140 | * Enum indicating sunday | ||
21141 | * @type Number | ||
21142 | * @member Date.Gregorian | ||
21143 | */ | ||
21144 | SUNDAY: 0, | ||
21145 | /* | ||
21146 | * Enum indicating monday | ||
21147 | * @type Number | ||
21148 | * @member Date.Gregorian | ||
21149 | */ | ||
21150 | MONDAY: 1, | ||
21151 | /* | ||
21152 | * Enum indicating tuesday | ||
21153 | * @type Number | ||
21154 | * @member Date.Gregorian | ||
21155 | */ | ||
21156 | TUESDAY: 2, | ||
21157 | /* | ||
21158 | * Enum indicating wednesday | ||
21159 | * @type Number | ||
21160 | * @member Date.Gregorian | ||
21161 | */ | ||
21162 | WEDNESDAY: 3, | ||
21163 | /* | ||
21164 | * Enum indicating thursday | ||
21165 | * @type Number | ||
21166 | * @member Date.Gregorian | ||
21167 | */ | ||
21168 | THURSDAY: 4, | ||
21169 | /* | ||
21170 | * Enum indicating friday | ||
21171 | * @type Number | ||
21172 | * @member Date.Gregorian | ||
21173 | */ | ||
21174 | FRIDAY: 5, | ||
21175 | /* | ||
21176 | * Enum indicating saturday | ||
21177 | * @type Number | ||
21178 | * @member Date.Gregorian | ||
21179 | */ | ||
21180 | SATURDAY: 6, | ||
21181 | /* | ||
21182 | * Enum indicating january | ||
21183 | * @type Number | ||
21184 | * @member Date.Gregorian | ||
21185 | */ | ||
21186 | JANUARY: 0, | ||
21187 | /* | ||
21188 | * Enum indicating february | ||
21189 | * @type Number | ||
21190 | * @member Date.Gregorian | ||
21191 | */ | ||
21192 | FEBRUARY: 1, | ||
21193 | /* | ||
21194 | * Enum indicating march | ||
21195 | * @type Number | ||
21196 | * @member Date.Gregorian | ||
21197 | */ | ||
21198 | MARCH: 2, | ||
21199 | /* | ||
21200 | * Enum indicating april | ||
21201 | * @type Number | ||
21202 | * @member Date.Gregorian | ||
21203 | */ | ||
21204 | APRIL: 3, | ||
21205 | /* | ||
21206 | * Enum indicating may | ||
21207 | * @type Number | ||
21208 | * @member Date.Gregorian | ||
21209 | */ | ||
21210 | MAY: 4, | ||
21211 | /* | ||
21212 | * Enum indicating june | ||
21213 | * @type Number | ||
21214 | * @member Date.Gregorian | ||
21215 | */ | ||
21216 | JUNE: 5, | ||
21217 | /* | ||
21218 | * Enum indicating july | ||
21219 | * @type Number | ||
21220 | * @member Date.Gregorian | ||
21221 | */ | ||
21222 | JULY: 6, | ||
21223 | /* | ||
21224 | * Enum indicating august | ||
21225 | * @type Number | ||
21226 | * @member Date.Gregorian | ||
21227 | */ | ||
21228 | AUGUST: 7, | ||
21229 | /* | ||
21230 | * Enum indicating september | ||
21231 | * @type Number | ||
21232 | * @member Date.Gregorian | ||
21233 | */ | ||
21234 | SEPTEMBER: 8, | ||
21235 | /* | ||
21236 | * Enum indicating october | ||
21237 | * @type Number | ||
21238 | * @member Date.Gregorian | ||
21239 | */ | ||
21240 | OCTOBER: 9, | ||
21241 | /* | ||
21242 | * Enum indicating november | ||
21243 | * @type Number | ||
21244 | * @member Date.Gregorian | ||
21245 | */ | ||
21246 | NOVEMBER: 10, | ||
21247 | /* | ||
21248 | * Enum indicating december | ||
21249 | * @type Number | ||
21250 | * @member Date.Gregorian | ||
21251 | */ | ||
21252 | DECEMBER: 11 | ||
21253 | }; | ||
21254 | |||
21255 | /***/ }, | ||
21256 | /* 164 */ | ||
21257 | /***/ function(module, exports) { | ||
21258 | |||
21259 | /* | ||
21260 | * en-us locale | ||
21261 | * @ignore | ||
21262 | * @author yiminghe@gmail.com | ||
21263 | */ | ||
21264 | "use strict"; | ||
21265 | |||
21266 | module.exports = { | ||
21267 | // in minutes | ||
21268 | timezoneOffset: -8 * 60, | ||
21269 | firstDayOfWeek: 0, | ||
21270 | minimalDaysInFirstWeek: 1 | ||
21271 | }; | ||
21272 | |||
21273 | /***/ }, | ||
21274 | /* 165 */ | ||
21275 | /***/ function(module, exports, __webpack_require__) { | ||
21276 | |||
21277 | /** | ||
21278 | * @ignore | ||
21279 | * DateTimeFormat for | ||
21280 | * Inspired by DateTimeFormat from JDK. | ||
21281 | * @author yiminghe@gmail.com | ||
21282 | */ | ||
21283 | |||
21284 | 'use strict'; | ||
21285 | |||
21286 | var GregorianCalendar = __webpack_require__(161); | ||
21287 | var enUsLocale = __webpack_require__(166); | ||
21288 | var MAX_VALUE = Number.MAX_VALUE; | ||
21289 | var warning = __webpack_require__(167); | ||
21290 | |||
21291 | /** | ||
21292 | * date or time style enum | ||
21293 | * @enum {Number} Date.Formatter.Style | ||
21294 | */ | ||
21295 | var DateTimeStyle = { | ||
21296 | /** | ||
21297 | * full style | ||
21298 | */ | ||
21299 | FULL: 0, | ||
21300 | /** | ||
21301 | * long style | ||
21302 | */ | ||
21303 | LONG: 1, | ||
21304 | /** | ||
21305 | * medium style | ||
21306 | */ | ||
21307 | MEDIUM: 2, | ||
21308 | /** | ||
21309 | * short style | ||
21310 | */ | ||
21311 | SHORT: 3 | ||
21312 | }; | ||
21313 | |||
21314 | /* | ||
21315 | Letter Date or Time Component Presentation Examples | ||
21316 | G Era designator Text AD | ||
21317 | y Year Year 1996; 96 | ||
21318 | M Month in year Month July; Jul; 07 | ||
21319 | w Week in year Number 27 | ||
21320 | W Week in month Number 2 | ||
21321 | D Day in year Number 189 | ||
21322 | d Day in month Number 10 | ||
21323 | F Day of week in month Number 2 | ||
21324 | E Day in week Text Tuesday; Tue | ||
21325 | a Am/pm marker Text PM | ||
21326 | H Hour in day (0-23) Number 0 | ||
21327 | k Hour in day (1-24) Number 24 | ||
21328 | K Hour in am/pm (0-11) Number 0 | ||
21329 | h Hour in am/pm (1-12) Number 12 | ||
21330 | m Minute in hour Number 30 | ||
21331 | s Second in minute Number 55 | ||
21332 | S Millisecond Number 978 | ||
21333 | x z Time zone General time zone Pacific Standard Time; PST; GMT-08:00 | ||
21334 | Z Time zone RFC 822 time zone -0800 | ||
21335 | */ | ||
21336 | |||
21337 | var patternChars = new Array(GregorianCalendar.DAY_OF_WEEK_IN_MONTH + 2).join('1'); | ||
21338 | var ERA = 0; | ||
21339 | var calendarIndexMap = {}; | ||
21340 | |||
21341 | patternChars = patternChars.split(''); | ||
21342 | patternChars[ERA] = 'G'; | ||
21343 | patternChars[GregorianCalendar.YEAR] = 'y'; | ||
21344 | patternChars[GregorianCalendar.MONTH] = 'M'; | ||
21345 | patternChars[GregorianCalendar.DAY_OF_MONTH] = 'd'; | ||
21346 | patternChars[GregorianCalendar.HOUR_OF_DAY] = 'H'; | ||
21347 | patternChars[GregorianCalendar.MINUTES] = 'm'; | ||
21348 | patternChars[GregorianCalendar.SECONDS] = 's'; | ||
21349 | patternChars[GregorianCalendar.MILLISECONDS] = 'S'; | ||
21350 | patternChars[GregorianCalendar.WEEK_OF_YEAR] = 'w'; | ||
21351 | patternChars[GregorianCalendar.WEEK_OF_MONTH] = 'W'; | ||
21352 | patternChars[GregorianCalendar.DAY_OF_YEAR] = 'D'; | ||
21353 | patternChars[GregorianCalendar.DAY_OF_WEEK_IN_MONTH] = 'F'; | ||
21354 | |||
21355 | (function init() { | ||
21356 | for (var index in patternChars) { | ||
21357 | if (patternChars.hasOwnProperty(index)) { | ||
21358 | calendarIndexMap[patternChars[index]] = index; | ||
21359 | } | ||
21360 | } | ||
21361 | })(); | ||
21362 | |||
21363 | function mix(t, s) { | ||
21364 | for (var p in s) { | ||
21365 | if (s.hasOwnProperty(p)) { | ||
21366 | t[p] = s[p]; | ||
21367 | } | ||
21368 | } | ||
21369 | } | ||
21370 | |||
21371 | var SUBSTITUTE_REG = /\\?\{([^{}]+)\}/g; | ||
21372 | var EMPTY = ''; | ||
21373 | |||
21374 | function substitute(str, o, regexp) { | ||
21375 | if (typeof str !== 'string' || !o) { | ||
21376 | return str; | ||
21377 | } | ||
21378 | |||
21379 | return str.replace(regexp || SUBSTITUTE_REG, function (match, name) { | ||
21380 | if (match.charAt(0) === '\\') { | ||
21381 | return match.slice(1); | ||
21382 | } | ||
21383 | return o[name] === undefined ? EMPTY : o[name]; | ||
21384 | }); | ||
21385 | } | ||
21386 | |||
21387 | patternChars = patternChars.join('') + 'ahkKZE'; | ||
21388 | |||
21389 | function encode(lastField, count, compiledPattern) { | ||
21390 | compiledPattern.push({ | ||
21391 | field: lastField, | ||
21392 | count: count | ||
21393 | }); | ||
21394 | } | ||
21395 | |||
21396 | function compile(pattern) { | ||
21397 | var length = pattern.length; | ||
21398 | var inQuote = false; | ||
21399 | var compiledPattern = []; | ||
21400 | var tmpBuffer = null; | ||
21401 | var count = 0; | ||
21402 | var lastField = -1; | ||
21403 | |||
21404 | for (var i = 0; i < length; i++) { | ||
21405 | var c = pattern.charAt(i); | ||
21406 | |||
21407 | if (c === '\'') { | ||
21408 | // '' is treated as a single quote regardless of being | ||
21409 | // in a quoted section. | ||
21410 | if (i + 1 < length) { | ||
21411 | c = pattern.charAt(i + 1); | ||
21412 | if (c === '\'') { | ||
21413 | i++; | ||
21414 | if (count !== 0) { | ||
21415 | encode(lastField, count, compiledPattern); | ||
21416 | lastField = -1; | ||
21417 | count = 0; | ||
21418 | } | ||
21419 | if (inQuote) { | ||
21420 | tmpBuffer += c; | ||
21421 | } | ||
21422 | continue; | ||
21423 | } | ||
21424 | } | ||
21425 | if (!inQuote) { | ||
21426 | if (count !== 0) { | ||
21427 | encode(lastField, count, compiledPattern); | ||
21428 | lastField = -1; | ||
21429 | count = 0; | ||
21430 | } | ||
21431 | tmpBuffer = ''; | ||
21432 | inQuote = true; | ||
21433 | } else { | ||
21434 | compiledPattern.push({ | ||
21435 | text: tmpBuffer | ||
21436 | }); | ||
21437 | inQuote = false; | ||
21438 | } | ||
21439 | continue; | ||
21440 | } | ||
21441 | if (inQuote) { | ||
21442 | tmpBuffer += c; | ||
21443 | continue; | ||
21444 | } | ||
21445 | if (!(c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z')) { | ||
21446 | if (count !== 0) { | ||
21447 | encode(lastField, count, compiledPattern); | ||
21448 | lastField = -1; | ||
21449 | count = 0; | ||
21450 | } | ||
21451 | compiledPattern.push({ | ||
21452 | text: c | ||
21453 | }); | ||
21454 | continue; | ||
21455 | } | ||
21456 | |||
21457 | if (patternChars.indexOf(c) === -1) { | ||
21458 | throw new Error('Illegal pattern character "' + c + '"'); | ||
21459 | } | ||
21460 | |||
21461 | if (lastField === -1 || lastField === c) { | ||
21462 | lastField = c; | ||
21463 | count++; | ||
21464 | continue; | ||
21465 | } | ||
21466 | encode(lastField, count, compiledPattern); | ||
21467 | lastField = c; | ||
21468 | count = 1; | ||
21469 | } | ||
21470 | |||
21471 | if (inQuote) { | ||
21472 | throw new Error('Unterminated quote'); | ||
21473 | } | ||
21474 | |||
21475 | if (count !== 0) { | ||
21476 | encode(lastField, count, compiledPattern); | ||
21477 | } | ||
21478 | |||
21479 | return compiledPattern; | ||
21480 | } | ||
21481 | |||
21482 | var zeroDigit = '0'; | ||
21483 | |||
21484 | // TODO zeroDigit localization?? | ||
21485 | function zeroPaddingNumber(_x, _x2, _x3, _x4) { | ||
21486 | var _again = true; | ||
21487 | |||
21488 | _function: while (_again) { | ||
21489 | var value = _x, | ||
21490 | minDigits = _x2, | ||
21491 | maxDigits_ = _x3, | ||
21492 | b = _x4; | ||
21493 | _again = false; | ||
21494 | |||
21495 | // Optimization for 1, 2 and 4 digit numbers. This should | ||
21496 | // cover most cases of formatting date/time related items. | ||
21497 | // Note: This optimization code assumes that maxDigits is | ||
21498 | // either 2 or Integer.MAX_VALUE (maxIntCount in format()). | ||
21499 | var buffer = b || []; | ||
21500 | var maxDigits = maxDigits_ || MAX_VALUE; | ||
21501 | if (value >= 0) { | ||
21502 | if (value < 100 && minDigits >= 1 && minDigits <= 2) { | ||
21503 | if (value < 10 && minDigits === 2) { | ||
21504 | buffer.push(zeroDigit); | ||
21505 | } | ||
21506 | buffer.push(value); | ||
21507 | return buffer.join(''); | ||
21508 | } else if (value >= 1000 && value < 10000) { | ||
21509 | if (minDigits === 4) { | ||
21510 | buffer.push(value); | ||
21511 | return buffer.join(''); | ||
21512 | } | ||
21513 | if (minDigits === 2 && maxDigits === 2) { | ||
21514 | _x = value % 100; | ||
21515 | _x2 = 2; | ||
21516 | _x3 = 2; | ||
21517 | _x4 = buffer; | ||
21518 | _again = true; | ||
21519 | buffer = maxDigits = undefined; | ||
21520 | continue _function; | ||
21521 | } | ||
21522 | } | ||
21523 | } | ||
21524 | buffer.push(value + ''); | ||
21525 | return buffer.join(''); | ||
21526 | } | ||
21527 | } | ||
21528 | |||
21529 | /** | ||
21530 | * | ||
21531 | * date time formatter for GregorianCalendar | ||
21532 | * | ||
21533 | * @example | ||
21534 | * | ||
21535 | * const calendar = new GregorianCalendar(2013,9,24); | ||
21536 | * // ' to escape | ||
21537 | * const formatter = new GregorianCalendarFormat("'today is' ''yyyy/MM/dd a''"); | ||
21538 | * document.write(formatter.format(calendar)); | ||
21539 | * | ||
21540 | * @class GregorianCalendarFormat | ||
21541 | * @param {String} pattern patter string of date formatter | ||
21542 | * | ||
21543 | * <table border="1"> | ||
21544 | * <thead valign="bottom"> | ||
21545 | * <tr><th class="head">Letter</th> | ||
21546 | * <th class="head">Date or Time Component</th> | ||
21547 | * <th class="head">Presentation</th> | ||
21548 | * <th class="head">Examples</th> | ||
21549 | * </tr> | ||
21550 | * </thead> | ||
21551 | * <tbody valign="top"> | ||
21552 | * <tr><td>G</td> | ||
21553 | * <td>Era designator</td> | ||
21554 | * <td>Text</td> | ||
21555 | * <td>AD</td> | ||
21556 | * </tr> | ||
21557 | * <tr><td>y</td> | ||
21558 | * <td>Year</td> | ||
21559 | * <td>Year</td> | ||
21560 | * <td>1996; 96</td> | ||
21561 | * </tr> | ||
21562 | * <tr><td>M</td> | ||
21563 | * <td>Month in year</td> | ||
21564 | * <td>Month</td> | ||
21565 | * <td>July; Jul; 07</td> | ||
21566 | * </tr> | ||
21567 | * <tr><td>w</td> | ||
21568 | * <td>Week in year</td> | ||
21569 | * <td>Number</td> | ||
21570 | * <td>27</td> | ||
21571 | * </tr> | ||
21572 | * <tr><td>W</td> | ||
21573 | * <td>Week in month</td> | ||
21574 | * <td>Number</td> | ||
21575 | * <td>2</td> | ||
21576 | * </tr> | ||
21577 | * <tr><td>D</td> | ||
21578 | * <td>Day in year</td> | ||
21579 | * <td>Number</td> | ||
21580 | * <td>189</td> | ||
21581 | * </tr> | ||
21582 | * <tr><td>d</td> | ||
21583 | * <td>Day in month</td> | ||
21584 | * <td>Number</td> | ||
21585 | * <td>10</td> | ||
21586 | * </tr> | ||
21587 | * <tr><td>F</td> | ||
21588 | * <td>Day of week in month</td> | ||
21589 | * <td>Number</td> | ||
21590 | * <td>2</td> | ||
21591 | * </tr> | ||
21592 | * <tr><td>E</td> | ||
21593 | * <td>Day in week</td> | ||
21594 | * <td>Text</td> | ||
21595 | * <td>Tuesday; Tue</td> | ||
21596 | * </tr> | ||
21597 | * <tr><td>a</td> | ||
21598 | * <td>Am/pm marker</td> | ||
21599 | * <td>Text</td> | ||
21600 | * <td>PM</td> | ||
21601 | * </tr> | ||
21602 | * <tr><td>H</td> | ||
21603 | * <td>Hour in day (0-23)</td> | ||
21604 | * <td>Number</td> | ||
21605 | * <td>0</td> | ||
21606 | * </tr> | ||
21607 | * <tr><td>k</td> | ||
21608 | * <td>Hour in day (1-24)</td> | ||
21609 | * <td>Number</td> | ||
21610 | * <td>24</td> | ||
21611 | * </tr> | ||
21612 | * <tr><td>K</td> | ||
21613 | * <td>Hour in am/pm (0-11)</td> | ||
21614 | * <td>Number</td> | ||
21615 | * <td>0</td> | ||
21616 | * </tr> | ||
21617 | * <tr><td>h</td> | ||
21618 | * <td>Hour in am/pm (1-12)</td> | ||
21619 | * <td>Number</td> | ||
21620 | * <td>12</td> | ||
21621 | * </tr> | ||
21622 | * <tr><td>m</td> | ||
21623 | * <td>Minute in hour</td> | ||
21624 | * <td>Number</td> | ||
21625 | * <td>30</td> | ||
21626 | * </tr> | ||
21627 | * <tr><td>s</td> | ||
21628 | * <td>Second in minute</td> | ||
21629 | * <td>Number</td> | ||
21630 | * <td>55</td> | ||
21631 | * </tr> | ||
21632 | * <tr><td>S</td> | ||
21633 | * <td>Millisecond</td> | ||
21634 | * <td>Number</td> | ||
21635 | * <td>978</td> | ||
21636 | * </tr> | ||
21637 | * <tr><td>x/z</td> | ||
21638 | * <td>Time zone</td> | ||
21639 | * <td>General time zone</td> | ||
21640 | * <td>Pacific Standard Time; PST; GMT-08:00</td> | ||
21641 | * </tr> | ||
21642 | * <tr><td>Z</td> | ||
21643 | * <td>Time zone</td> | ||
21644 | * <td>RFC 822 time zone</td> | ||
21645 | * <td>-0800</td> | ||
21646 | * </tr> | ||
21647 | * </tbody> | ||
21648 | * </table> | ||
21649 | |||
21650 | * @param {Object} locale format locale | ||
21651 | */ | ||
21652 | function DateTimeFormat(pattern, locale) { | ||
21653 | this.locale = locale || enUsLocale; | ||
21654 | this.originalPattern = pattern; | ||
21655 | this.pattern = compile(pattern); | ||
21656 | } | ||
21657 | |||
21658 | function formatField(field, count, locale, calendar) { | ||
21659 | var current = undefined; | ||
21660 | var value = undefined; | ||
21661 | switch (field) { | ||
21662 | case 'G': | ||
21663 | value = calendar.getYear() > 0 ? 1 : 0; | ||
21664 | current = locale.eras[value]; | ||
21665 | break; | ||
21666 | case 'y': | ||
21667 | value = calendar.getYear(); | ||
21668 | if (value <= 0) { | ||
21669 | value = 1 - value; | ||
21670 | } | ||
21671 | current = zeroPaddingNumber(value, 2, count !== 2 ? MAX_VALUE : 2); | ||
21672 | break; | ||
21673 | case 'M': | ||
21674 | value = calendar.getMonth(); | ||
21675 | if (count >= 4) { | ||
21676 | current = locale.months[value]; | ||
21677 | } else if (count === 3) { | ||
21678 | current = locale.shortMonths[value]; | ||
21679 | } else { | ||
21680 | current = zeroPaddingNumber(value + 1, count); | ||
21681 | } | ||
21682 | break; | ||
21683 | case 'k': | ||
21684 | current = zeroPaddingNumber(calendar.getHourOfDay() || 24, count); | ||
21685 | break; | ||
21686 | case 'E': | ||
21687 | value = calendar.getDayOfWeek(); | ||
21688 | current = count >= 4 ? locale.weekdays[value] : locale.shortWeekdays[value]; | ||
21689 | break; | ||
21690 | case 'a': | ||
21691 | current = locale.ampms[calendar.getHourOfDay() >= 12 ? 1 : 0]; | ||
21692 | break; | ||
21693 | case 'h': | ||
21694 | current = zeroPaddingNumber(calendar.getHourOfDay() % 12 || 12, count); | ||
21695 | break; | ||
21696 | case 'K': | ||
21697 | current = zeroPaddingNumber(calendar.getHourOfDay() % 12, count); | ||
21698 | break; | ||
21699 | case 'Z': | ||
21700 | var offset = calendar.getTimezoneOffset(); | ||
21701 | var parts = [offset < 0 ? '-' : '+']; | ||
21702 | offset = Math.abs(offset); | ||
21703 | parts.push(zeroPaddingNumber(Math.floor(offset / 60) % 100, 2), zeroPaddingNumber(offset % 60, 2)); | ||
21704 | current = parts.join(''); | ||
21705 | break; | ||
21706 | default: | ||
21707 | // case 'd': | ||
21708 | // case 'H': | ||
21709 | // case 'm': | ||
21710 | // case 's': | ||
21711 | // case 'S': | ||
21712 | // case 'D': | ||
21713 | // case 'F': | ||
21714 | // case 'w': | ||
21715 | // case 'W': | ||
21716 | var index = calendarIndexMap[field]; | ||
21717 | value = calendar.get(index); | ||
21718 | current = zeroPaddingNumber(value, count); | ||
21719 | } | ||
21720 | return current; | ||
21721 | } | ||
21722 | |||
21723 | function matchPartString(dateStr, startIndex, match, mLen) { | ||
21724 | for (var i = 0; i < mLen; i++) { | ||
21725 | if (dateStr.charAt(startIndex + i) !== match.charAt(i)) { | ||
21726 | return false; | ||
21727 | } | ||
21728 | } | ||
21729 | return true; | ||
21730 | } | ||
21731 | |||
21732 | function matchField(dateStr, startIndex, matches) { | ||
21733 | var matchedLen = -1; | ||
21734 | var index = -1; | ||
21735 | var i = undefined; | ||
21736 | var len = matches.length; | ||
21737 | for (i = 0; i < len; i++) { | ||
21738 | var m = matches[i]; | ||
21739 | var mLen = m.length; | ||
21740 | if (mLen > matchedLen && matchPartString(dateStr, startIndex, m, mLen)) { | ||
21741 | matchedLen = mLen; | ||
21742 | index = i; | ||
21743 | } | ||
21744 | } | ||
21745 | return index >= 0 ? { | ||
21746 | value: index, | ||
21747 | startIndex: startIndex + matchedLen | ||
21748 | } : null; | ||
21749 | } | ||
21750 | |||
21751 | function getLeadingNumberLen(str) { | ||
21752 | var i = undefined; | ||
21753 | var c = undefined; | ||
21754 | var len = str.length; | ||
21755 | for (i = 0; i < len; i++) { | ||
21756 | c = str.charAt(i); | ||
21757 | if (c < '0' || c > '9') { | ||
21758 | break; | ||
21759 | } | ||
21760 | } | ||
21761 | return i; | ||
21762 | } | ||
21763 | |||
21764 | function matchNumber(dateStr, startIndex, count, obeyCount) { | ||
21765 | var str = dateStr; | ||
21766 | var n = undefined; | ||
21767 | if (obeyCount) { | ||
21768 | if (dateStr.length < startIndex + count) { | ||
21769 | return null; | ||
21770 | } | ||
21771 | str = dateStr.slice(startIndex, startIndex + count); | ||
21772 | if (!str.match(/^\d+$/)) { | ||
21773 | throw new Error('GregorianCalendarFormat parse error, dateStr: ' + dateStr + ', patter: ' + this.originalPattern); | ||
21774 | } | ||
21775 | } else { | ||
21776 | str = str.slice(startIndex); | ||
21777 | } | ||
21778 | n = parseInt(str, 10); | ||
21779 | if (isNaN(n)) { | ||
21780 | throw new Error('GregorianCalendarFormat parse error, dateStr: ' + dateStr + ', patter: ' + this.originalPattern); | ||
21781 | } | ||
21782 | return { | ||
21783 | value: n, | ||
21784 | startIndex: startIndex + getLeadingNumberLen(str) | ||
21785 | }; | ||
21786 | } | ||
21787 | |||
21788 | function parseField(calendar, dateStr, startIndex_, field, count, obeyCount, tmp) { | ||
21789 | var match = undefined; | ||
21790 | var year = undefined; | ||
21791 | var hour = undefined; | ||
21792 | var startIndex = startIndex_; | ||
21793 | if (dateStr.length <= startIndex) { | ||
21794 | return startIndex; | ||
21795 | } | ||
21796 | var locale = this.locale; | ||
21797 | switch (field) { | ||
21798 | case 'G': | ||
21799 | match = matchField(dateStr, startIndex, locale.eras); | ||
21800 | if (match) { | ||
21801 | if (calendar.isSetYear()) { | ||
21802 | if (match.value === 0) { | ||
21803 | year = calendar.getYear(); | ||
21804 | calendar.setYear(1 - year); | ||
21805 | } | ||
21806 | } else { | ||
21807 | tmp.era = match.value; | ||
21808 | } | ||
21809 | } | ||
21810 | break; | ||
21811 | case 'y': | ||
21812 | match = matchNumber.call(this, dateStr, startIndex, count, obeyCount); | ||
21813 | if (match) { | ||
21814 | year = match.value; | ||
21815 | if ('era' in tmp) { | ||
21816 | if (tmp.era === 0) { | ||
21817 | year = 1 - year; | ||
21818 | } | ||
21819 | } | ||
21820 | calendar.setYear(year); | ||
21821 | } | ||
21822 | break; | ||
21823 | case 'M': | ||
21824 | var month = undefined; | ||
21825 | if (count >= 3) { | ||
21826 | match = matchField(dateStr, startIndex, locale[count === 3 ? 'shortMonths' : 'months']); | ||
21827 | if (match) { | ||
21828 | month = match.value; | ||
21829 | } | ||
21830 | } else { | ||
21831 | match = matchNumber.call(this, dateStr, startIndex, count, obeyCount); | ||
21832 | if (match) { | ||
21833 | month = match.value - 1; | ||
21834 | } | ||
21835 | } | ||
21836 | if (match) { | ||
21837 | calendar.setMonth(month); | ||
21838 | } | ||
21839 | break; | ||
21840 | case 'k': | ||
21841 | match = matchNumber.call(this, dateStr, startIndex, count, obeyCount); | ||
21842 | if (match) { | ||
21843 | calendar.setHourOfDay(match.value % 24); | ||
21844 | } | ||
21845 | break; | ||
21846 | case 'E': | ||
21847 | match = matchField(dateStr, startIndex, locale[count > 3 ? 'weekdays' : 'shortWeekdays']); | ||
21848 | if (match) { | ||
21849 | calendar.setDayOfWeek(match.value); | ||
21850 | } | ||
21851 | break; | ||
21852 | case 'a': | ||
21853 | match = matchField(dateStr, startIndex, locale.ampms); | ||
21854 | if (match) { | ||
21855 | if (calendar.isSetHourOfDay()) { | ||
21856 | if (match.value) { | ||
21857 | hour = calendar.getHourOfDay(); | ||
21858 | if (hour < 12) { | ||
21859 | calendar.setHourOfDay((hour + 12) % 24); | ||
21860 | } | ||
21861 | } | ||
21862 | } else { | ||
21863 | tmp.ampm = match.value; | ||
21864 | } | ||
21865 | } | ||
21866 | break; | ||
21867 | case 'h': | ||
21868 | match = matchNumber.call(this, dateStr, startIndex, count, obeyCount); | ||
21869 | if (match) { | ||
21870 | hour = match.value %= 12; | ||
21871 | if (tmp.ampm) { | ||
21872 | hour += 12; | ||
21873 | } | ||
21874 | calendar.setHourOfDay(hour); | ||
21875 | } | ||
21876 | break; | ||
21877 | case 'K': | ||
21878 | match = matchNumber.call(this, dateStr, startIndex, count, obeyCount); | ||
21879 | if (match) { | ||
21880 | hour = match.value; | ||
21881 | if (tmp.ampm) { | ||
21882 | hour += 12; | ||
21883 | } | ||
21884 | calendar.setHourOfDay(hour); | ||
21885 | } | ||
21886 | break; | ||
21887 | case 'Z': | ||
21888 | // let sign = 1; | ||
21889 | var zoneChar = dateStr.charAt(startIndex); | ||
21890 | if (zoneChar === '-') { | ||
21891 | // sign = -1; | ||
21892 | startIndex++; | ||
21893 | } else if (zoneChar === '+') { | ||
21894 | startIndex++; | ||
21895 | } else { | ||
21896 | break; | ||
21897 | } | ||
21898 | match = matchNumber.call(this, dateStr, startIndex, 2, true); | ||
21899 | if (match) { | ||
21900 | var zoneOffset = match.value * 60; | ||
21901 | startIndex = match.startIndex; | ||
21902 | match = matchNumber.call(this, dateStr, startIndex, 2, true); | ||
21903 | if (match) { | ||
21904 | zoneOffset += match.value; | ||
21905 | } | ||
21906 | calendar.setTimezoneOffset(zoneOffset); | ||
21907 | } | ||
21908 | break; | ||
21909 | default: | ||
21910 | // case 'd': | ||
21911 | // case 'H': | ||
21912 | // case 'm': | ||
21913 | // case 's': | ||
21914 | // case 'S': | ||
21915 | // case 'D': | ||
21916 | // case 'F': | ||
21917 | // case 'w': | ||
21918 | // case 'W' | ||
21919 | match = matchNumber.call(this, dateStr, startIndex, count, obeyCount); | ||
21920 | if (match) { | ||
21921 | var index = calendarIndexMap[field]; | ||
21922 | calendar.set(index, match.value); | ||
21923 | } | ||
21924 | } | ||
21925 | if (match) { | ||
21926 | startIndex = match.startIndex; | ||
21927 | } | ||
21928 | return startIndex; | ||
21929 | } | ||
21930 | |||
21931 | mix(DateTimeFormat.prototype, { | ||
21932 | /* | ||
21933 | * format a GregorianDate instance according to specified pattern | ||
21934 | * @param {GregorianCalendar} calendar GregorianDate instance | ||
21935 | * @returns {string} formatted string of GregorianDate instance | ||
21936 | */ | ||
21937 | format: function format(calendar) { | ||
21938 | if (!calendar.isGregorianCalendar) { | ||
21939 | throw new Error('calendar must be type of GregorianCalendar'); | ||
21940 | } | ||
21941 | var i = undefined; | ||
21942 | var ret = []; | ||
21943 | var pattern = this.pattern; | ||
21944 | var len = pattern.length; | ||
21945 | for (i = 0; i < len; i++) { | ||
21946 | var comp = pattern[i]; | ||
21947 | if (comp.text) { | ||
21948 | ret.push(comp.text); | ||
21949 | } else if ('field' in comp) { | ||
21950 | ret.push(formatField(comp.field, comp.count, this.locale, calendar)); | ||
21951 | } | ||
21952 | } | ||
21953 | return ret.join(''); | ||
21954 | }, | ||
21955 | |||
21956 | /* | ||
21957 | * parse a formatted string of GregorianDate instance according to specified pattern | ||
21958 | * @param {String} dateStr formatted string of GregorianDate | ||
21959 | * @returns {GregorianCalendar} | ||
21960 | */ | ||
21961 | parse: function parse(dateStr, option_) { | ||
21962 | var option = option_ || {}; | ||
21963 | var calendarLocale = option.locale; | ||
21964 | var calendar = new GregorianCalendar(calendarLocale); | ||
21965 | var i = undefined; | ||
21966 | var j = undefined; | ||
21967 | var tmp = {}; | ||
21968 | var obeyCount = option.obeyCount || false; | ||
21969 | var dateStrLen = dateStr.length; | ||
21970 | var errorIndex = -1; | ||
21971 | var startIndex = 0; | ||
21972 | var oldStartIndex = 0; | ||
21973 | var pattern = this.pattern; | ||
21974 | var len = pattern.length; | ||
21975 | /* eslint no-labels: 0 no-empty-label:0 */ | ||
21976 | loopPattern: { | ||
21977 | for (i = 0; errorIndex < 0 && i < len; i++) { | ||
21978 | var comp = pattern[i]; | ||
21979 | var text = undefined; | ||
21980 | var textLen = undefined; | ||
21981 | oldStartIndex = startIndex; | ||
21982 | text = comp.text; | ||
21983 | if (text) { | ||
21984 | textLen = text.length; | ||
21985 | if (textLen + startIndex > dateStrLen) { | ||
21986 | errorIndex = startIndex; | ||
21987 | } else { | ||
21988 | for (j = 0; j < textLen; j++) { | ||
21989 | if (text.charAt(j) !== dateStr.charAt(j + startIndex)) { | ||
21990 | errorIndex = startIndex; | ||
21991 | break loopPattern; | ||
21992 | } | ||
21993 | } | ||
21994 | startIndex += textLen; | ||
21995 | } | ||
21996 | } else if ('field' in comp) { | ||
21997 | if (!option.obeyCount) { | ||
21998 | var nextComp = pattern[i + 1]; | ||
21999 | obeyCount = false; | ||
22000 | if (nextComp) { | ||
22001 | if ('field' in nextComp) { | ||
22002 | obeyCount = true; | ||
22003 | } else { | ||
22004 | var c = nextComp.text.charAt(0); | ||
22005 | if (c >= '0' && c <= '9') { | ||
22006 | obeyCount = true; | ||
22007 | } | ||
22008 | } | ||
22009 | } | ||
22010 | } | ||
22011 | startIndex = parseField.call(this, calendar, dateStr, startIndex, comp.field, comp.count, obeyCount, tmp); | ||
22012 | if (startIndex === oldStartIndex) { | ||
22013 | errorIndex = startIndex; | ||
22014 | } | ||
22015 | } | ||
22016 | } | ||
22017 | } | ||
22018 | |||
22019 | if (errorIndex >= 0) { | ||
22020 | warning(false, 'error when parsing date: ' + dateStr + ', position: ' + dateStr.slice(0, errorIndex) + '^'); | ||
22021 | return undefined; | ||
22022 | } | ||
22023 | return calendar; | ||
22024 | } | ||
22025 | }); | ||
22026 | |||
22027 | mix(DateTimeFormat, { | ||
22028 | Style: DateTimeStyle, | ||
22029 | |||
22030 | /* | ||
22031 | * get a formatter instance of short style pattern. | ||
22032 | * en-us: M/d/yy h:mm a | ||
22033 | * zh-cn: yy-M-d ah:mm | ||
22034 | * @param {Object} locale locale object | ||
22035 | * @returns {GregorianCalendar} | ||
22036 | * @static | ||
22037 | */ | ||
22038 | getInstance: function getInstance(locale) { | ||
22039 | return this.getDateTimeInstance(DateTimeStyle.SHORT, DateTimeStyle.SHORT, locale); | ||
22040 | }, | ||
22041 | |||
22042 | /* | ||
22043 | * get a formatter instance of specified date style. | ||
22044 | * @param {Date.Formatter.Style} dateStyle date format style | ||
22045 | * @param {Object} locale | ||
22046 | * @returns {GregorianCalendar} | ||
22047 | * @static | ||
22048 | */ | ||
22049 | getDateInstance: function getDateInstance(dateStyle, locale) { | ||
22050 | return this.getDateTimeInstance(dateStyle, undefined, locale); | ||
22051 | }, | ||
22052 | |||
22053 | /* | ||
22054 | * get a formatter instance of specified date style and time style. | ||
22055 | * @param {Date.Formatter.Style} dateStyle date format style | ||
22056 | * @param {Date.Formatter.Style} timeStyle time format style | ||
22057 | * @param {Object} locale | ||
22058 | * @returns {GregorianCalendar} | ||
22059 | * @static | ||
22060 | */ | ||
22061 | getDateTimeInstance: function getDateTimeInstance(dateStyle, timeStyle, locale_) { | ||
22062 | var locale = locale_ || enUsLocale; | ||
22063 | var datePattern = ''; | ||
22064 | if (dateStyle !== undefined) { | ||
22065 | datePattern = locale.datePatterns[dateStyle]; | ||
22066 | } | ||
22067 | var timePattern = ''; | ||
22068 | if (timeStyle !== undefined) { | ||
22069 | timePattern = locale.timePatterns[timeStyle]; | ||
22070 | } | ||
22071 | var pattern = datePattern; | ||
22072 | if (timePattern) { | ||
22073 | if (datePattern) { | ||
22074 | pattern = substitute(locale.dateTimePattern, { | ||
22075 | date: datePattern, | ||
22076 | time: timePattern | ||
22077 | }); | ||
22078 | } else { | ||
22079 | pattern = timePattern; | ||
22080 | } | ||
22081 | } | ||
22082 | return new DateTimeFormat(pattern, locale); | ||
22083 | }, | ||
22084 | |||
22085 | /* | ||
22086 | * get a formatter instance of specified time style. | ||
22087 | * @param {Date.Formatter.Style} timeStyle time format style | ||
22088 | * @param {Object} locale | ||
22089 | * @returns {GregorianCalendar} | ||
22090 | * @static | ||
22091 | */ | ||
22092 | getTimeInstance: function getTimeInstance(timeStyle, locale) { | ||
22093 | return this.getDateTimeInstance(undefined, timeStyle, locale); | ||
22094 | } | ||
22095 | }); | ||
22096 | |||
22097 | module.exports = DateTimeFormat; | ||
22098 | |||
22099 | DateTimeFormat.version = '@VERSION@'; | ||
22100 | |||
22101 | // gc_format@163.com | ||
22102 | |||
22103 | /***/ }, | ||
22104 | /* 166 */ | ||
22105 | /***/ function(module, exports) { | ||
22106 | |||
22107 | 'use strict'; | ||
22108 | |||
22109 | module.exports = { | ||
22110 | eras: ['BC', 'AD'], | ||
22111 | months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], | ||
22112 | shortMonths: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], | ||
22113 | weekdays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], | ||
22114 | shortWeekdays: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], | ||
22115 | veryShortWeekdays: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'], | ||
22116 | ampms: ['AM', 'PM'], | ||
22117 | datePatterns: ['EEEE, MMMM d, yyyy', 'MMMM d, yyyy', 'MMM d, yyyy', 'M/d/yy'], | ||
22118 | timePatterns: ['h:mm:ss a \'GMT\'Z', 'h:mm:ss a', 'h:mm:ss a', 'h:mm a'], | ||
22119 | dateTimePattern: '{date} {time}' | ||
22120 | }; | ||
22121 | |||
22122 | /***/ }, | ||
22123 | /* 167 */ | ||
22124 | /***/ function(module, exports, __webpack_require__) { | ||
22125 | |||
22126 | /* WEBPACK VAR INJECTION */(function(process) {/** | ||
22127 | * Copyright 2014-2015, Facebook, Inc. | ||
22128 | * All rights reserved. | ||
22129 | * | ||
22130 | * This source code is licensed under the BSD-style license found in the | ||
22131 | * LICENSE file in the root directory of this source tree. An additional grant | ||
22132 | * of patent rights can be found in the PATENTS file in the same directory. | ||
22133 | */ | ||
22134 | |||
22135 | 'use strict'; | ||
22136 | |||
22137 | /** | ||
22138 | * Similar to invariant but only logs a warning if the condition is not met. | ||
22139 | * This can be used to log issues in development environments in critical | ||
22140 | * paths. Removing the logging code for production environments will keep the | ||
22141 | * same logic and follow the same code paths. | ||
22142 | */ | ||
22143 | |||
22144 | var warning = function() {}; | ||
22145 | |||
22146 | if (process.env.NODE_ENV !== 'production') { | ||
22147 | warning = function(condition, format, args) { | ||
22148 | var len = arguments.length; | ||
22149 | args = new Array(len > 2 ? len - 2 : 0); | ||
22150 | for (var key = 2; key < len; key++) { | ||
22151 | args[key - 2] = arguments[key]; | ||
22152 | } | ||
22153 | if (format === undefined) { | ||
22154 | throw new Error( | ||
22155 | '`warning(condition, format, ...args)` requires a warning ' + | ||
22156 | 'message argument' | ||
22157 | ); | ||
22158 | } | ||
22159 | |||
22160 | if (format.length < 10 || (/^[s\W]*$/).test(format)) { | ||
22161 | throw new Error( | ||
22162 | 'The warning format should be able to uniquely identify this ' + | ||
22163 | 'warning. Please, use a more descriptive format than: ' + format | ||
22164 | ); | ||
22165 | } | ||
22166 | |||
22167 | if (!condition) { | ||
22168 | var argIndex = 0; | ||
22169 | var message = 'Warning: ' + | ||
22170 | format.replace(/%s/g, function() { | ||
22171 | return args[argIndex++]; | ||
22172 | }); | ||
22173 | if (typeof console !== 'undefined') { | ||
22174 | console.error(message); | ||
22175 | } | ||
22176 | try { | ||
22177 | // This error was thrown as a convenience so that you can use this stack | ||
22178 | // to find the callsite that caused this warning to fire. | ||
22179 | throw new Error(message); | ||
22180 | } catch(x) {} | ||
22181 | } | ||
22182 | }; | ||
22183 | } | ||
22184 | |||
22185 | module.exports = warning; | ||
22186 | |||
22187 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) | ||
22188 | |||
22189 | /***/ }, | ||
22190 | /* 168 */ | ||
22191 | /***/ function(module, exports) { | ||
22192 | |||
22193 | /* | ||
22194 | * zh-cn locale | ||
22195 | * @ignore | ||
22196 | * @author yiminghe@gmail.com | ||
22197 | */ | ||
22198 | "use strict"; | ||
22199 | |||
22200 | module.exports = { | ||
22201 | // in minutes | ||
22202 | timezoneOffset: 8 * 60, | ||
22203 | firstDayOfWeek: 1, | ||
22204 | minimalDaysInFirstWeek: 1 | ||
22205 | }; | ||
22206 | |||
22207 | /***/ }, | ||
22208 | /* 169 */ | ||
22209 | /***/ function(module, exports, __webpack_require__) { | ||
22210 | |||
22211 | 'use strict'; | ||
22212 | |||
22213 | Object.defineProperty(exports, '__esModule', { | ||
22214 | value: true | ||
22215 | }); | ||
22216 | |||
22217 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
22218 | |||
22219 | var _src = __webpack_require__(170); | ||
22220 | |||
22221 | var _src2 = _interopRequireDefault(_src); | ||
22222 | |||
22223 | exports['default'] = _src2['default']; | ||
22224 | module.exports = exports['default']; | ||
22225 | |||
22226 | /***/ }, | ||
22227 | /* 170 */ | ||
22228 | /***/ function(module, exports, __webpack_require__) { | ||
22229 | |||
22230 | 'use strict'; | ||
22231 | |||
22232 | Object.defineProperty(exports, '__esModule', { | ||
22233 | value: true | ||
22234 | }); | ||
22235 | |||
22236 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
22237 | |||
22238 | var _TimePicker = __webpack_require__(171); | ||
22239 | |||
22240 | var _TimePicker2 = _interopRequireDefault(_TimePicker); | ||
22241 | |||
22242 | exports['default'] = _TimePicker2['default']; | ||
22243 | module.exports = exports['default']; | ||
22244 | |||
22245 | /***/ }, | ||
22246 | /* 171 */ | ||
22247 | /***/ function(module, exports, __webpack_require__) { | ||
22248 | |||
22249 | 'use strict'; | ||
22250 | |||
22251 | Object.defineProperty(exports, '__esModule', { | ||
22252 | value: true | ||
22253 | }); | ||
22254 | |||
22255 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
22256 | |||
22257 | var _react = __webpack_require__(3); | ||
22258 | |||
22259 | var _react2 = _interopRequireDefault(_react); | ||
22260 | |||
22261 | var _rcTrigger = __webpack_require__(172); | ||
22262 | |||
22263 | var _rcTrigger2 = _interopRequireDefault(_rcTrigger); | ||
22264 | |||
22265 | var _modulePanel = __webpack_require__(219); | ||
22266 | |||
22267 | var _modulePanel2 = _interopRequireDefault(_modulePanel); | ||
22268 | |||
22269 | var _utilPlacements = __webpack_require__(225); | ||
22270 | |||
22271 | var _utilPlacements2 = _interopRequireDefault(_utilPlacements); | ||
22272 | |||
22273 | var _mixinCommonMixin = __webpack_require__(220); | ||
22274 | |||
22275 | var _mixinCommonMixin2 = _interopRequireDefault(_mixinCommonMixin); | ||
22276 | |||
22277 | var _utilIndex = __webpack_require__(226); | ||
22278 | |||
22279 | var _gregorianCalendarLibLocaleEn_US = __webpack_require__(164); | ||
22280 | |||
22281 | var _gregorianCalendarLibLocaleEn_US2 = _interopRequireDefault(_gregorianCalendarLibLocaleEn_US); | ||
22282 | |||
22283 | function noop() {} | ||
22284 | |||
22285 | function refFn(field, component) { | ||
22286 | this[field] = component; | ||
22287 | } | ||
22288 | |||
22289 | var Picker = _react2['default'].createClass({ | ||
22290 | displayName: 'Picker', | ||
22291 | |||
22292 | propTypes: { | ||
22293 | prefixCls: _react.PropTypes.string, | ||
22294 | locale: _react.PropTypes.object, | ||
22295 | value: _react.PropTypes.object, | ||
22296 | disabled: _react.PropTypes.bool, | ||
22297 | allowEmpty: _react.PropTypes.bool, | ||
22298 | defaultValue: _react.PropTypes.object, | ||
22299 | open: _react.PropTypes.bool, | ||
22300 | defaultOpen: _react.PropTypes.bool, | ||
22301 | align: _react.PropTypes.object, | ||
22302 | placement: _react.PropTypes.any, | ||
22303 | transitionName: _react.PropTypes.string, | ||
22304 | getPopupContainer: _react.PropTypes.func, | ||
22305 | gregorianCalendarLocale: _react.PropTypes.object, | ||
22306 | placeholder: _react.PropTypes.string, | ||
22307 | formatter: _react.PropTypes.any, | ||
22308 | showHour: _react.PropTypes.bool, | ||
22309 | style: _react.PropTypes.object, | ||
22310 | showSecond: _react.PropTypes.bool, | ||
22311 | hourOptions: _react.PropTypes.array, | ||
22312 | minuteOptions: _react.PropTypes.array, | ||
22313 | secondOptions: _react.PropTypes.array, | ||
22314 | onChange: _react.PropTypes.func, | ||
22315 | onOpen: _react.PropTypes.func, | ||
22316 | onClose: _react.PropTypes.func | ||
22317 | }, | ||
22318 | |||
22319 | mixins: [_mixinCommonMixin2['default']], | ||
22320 | |||
22321 | getDefaultProps: function getDefaultProps() { | ||
22322 | return { | ||
22323 | defaultOpen: false, | ||
22324 | style: {}, | ||
22325 | gregorianCalendarLocale: _gregorianCalendarLibLocaleEn_US2['default'], | ||
22326 | align: {}, | ||
22327 | allowEmpty: true, | ||
22328 | showHour: true, | ||
22329 | showSecond: true, | ||
22330 | placement: 'bottomLeft', | ||
22331 | onChange: noop, | ||
22332 | onOpen: noop, | ||
22333 | onClose: noop | ||
22334 | }; | ||
22335 | }, | ||
22336 | |||
22337 | getInitialState: function getInitialState() { | ||
22338 | this.savePanelRef = refFn.bind(this, 'panelInstance'); | ||
22339 | var _props = this.props; | ||
22340 | var defaultOpen = _props.defaultOpen; | ||
22341 | var defaultValue = _props.defaultValue; | ||
22342 | var _props$open = _props.open; | ||
22343 | var open = _props$open === undefined ? defaultOpen : _props$open; | ||
22344 | var _props$value = _props.value; | ||
22345 | var value = _props$value === undefined ? defaultValue : _props$value; | ||
22346 | |||
22347 | return { | ||
22348 | open: open, | ||
22349 | value: value | ||
22350 | }; | ||
22351 | }, | ||
22352 | |||
22353 | componentWillReceiveProps: function componentWillReceiveProps(nextProps) { | ||
22354 | var value = nextProps.value; | ||
22355 | var open = nextProps.open; | ||
22356 | |||
22357 | if (value !== undefined) { | ||
22358 | this.setState({ | ||
22359 | value: value | ||
22360 | }); | ||
22361 | } | ||
22362 | if (open !== undefined) { | ||
22363 | this.setState({ open: open }); | ||
22364 | } | ||
22365 | }, | ||
22366 | |||
22367 | onPanelChange: function onPanelChange(value) { | ||
22368 | this.setValue(value); | ||
22369 | }, | ||
22370 | |||
22371 | onPanelClear: function onPanelClear() { | ||
22372 | this.setValue(null); | ||
22373 | this.setOpen(false); | ||
22374 | }, | ||
22375 | |||
22376 | onVisibleChange: function onVisibleChange(open) { | ||
22377 | this.setOpen(open); | ||
22378 | }, | ||
22379 | |||
22380 | onEsc: function onEsc() { | ||
22381 | this.setOpen(false); | ||
22382 | this.refs.picker.focus(); | ||
22383 | }, | ||
22384 | |||
22385 | onKeyDown: function onKeyDown(e) { | ||
22386 | if (e.keyCode === 40) { | ||
22387 | this.setOpen(true); | ||
22388 | } | ||
22389 | }, | ||
22390 | |||
22391 | setValue: function setValue(value) { | ||
22392 | if (!('value' in this.props)) { | ||
22393 | this.setState({ | ||
22394 | value: value | ||
22395 | }); | ||
22396 | } | ||
22397 | this.props.onChange(value); | ||
22398 | }, | ||
22399 | |||
22400 | getFormatter: function getFormatter() { | ||
22401 | var formatter = this.props.formatter; | ||
22402 | var locale = this.props.locale; | ||
22403 | if (formatter) { | ||
22404 | if (formatter === this.lastFormatter) { | ||
22405 | return this.normalFormatter; | ||
22406 | } | ||
22407 | this.normalFormatter = (0, _utilIndex.getFormatter)(formatter, locale); | ||
22408 | this.lastFormatter = formatter; | ||
22409 | return this.normalFormatter; | ||
22410 | } | ||
22411 | if (!this.props.showSecond) { | ||
22412 | if (!this.notShowSecondFormatter) { | ||
22413 | this.notShowSecondFormatter = (0, _utilIndex.getFormatter)('HH:mm', locale); | ||
22414 | } | ||
22415 | return this.notShowSecondFormatter; | ||
22416 | } | ||
22417 | if (!this.props.showHour) { | ||
22418 | if (!this.notShowHourFormatter) { | ||
22419 | this.notShowHourFormatter = (0, _utilIndex.getFormatter)('mm:ss', locale); | ||
22420 | } | ||
22421 | return this.notShowHourFormatter; | ||
22422 | } | ||
22423 | if (!this.normalFormatter) { | ||
22424 | this.normalFormatter = (0, _utilIndex.getFormatter)('HH:mm:ss', locale); | ||
22425 | } | ||
22426 | return this.normalFormatter; | ||
22427 | }, | ||
22428 | |||
22429 | getPanelElement: function getPanelElement() { | ||
22430 | var _props2 = this.props; | ||
22431 | var prefixCls = _props2.prefixCls; | ||
22432 | var defaultValue = _props2.defaultValue; | ||
22433 | var locale = _props2.locale; | ||
22434 | var placeholder = _props2.placeholder; | ||
22435 | var hourOptions = _props2.hourOptions; | ||
22436 | var minuteOptions = _props2.minuteOptions; | ||
22437 | var secondOptions = _props2.secondOptions; | ||
22438 | var allowEmpty = _props2.allowEmpty; | ||
22439 | var showHour = _props2.showHour; | ||
22440 | var showSecond = _props2.showSecond; | ||
22441 | var gregorianCalendarLocale = _props2.gregorianCalendarLocale; | ||
22442 | var value = _props2.value; | ||
22443 | |||
22444 | var calendarLocale = undefined; | ||
22445 | if (value) { | ||
22446 | calendarLocale = value.locale; | ||
22447 | } else if (defaultValue) { | ||
22448 | calendarLocale = defaultValue.locale; | ||
22449 | } else { | ||
22450 | calendarLocale = gregorianCalendarLocale; | ||
22451 | } | ||
22452 | return _react2['default'].createElement(_modulePanel2['default'], { | ||
22453 | prefixCls: prefixCls + '-panel', | ||
22454 | ref: this.savePanelRef, | ||
22455 | value: this.state.value, | ||
22456 | onChange: this.onPanelChange, | ||
22457 | gregorianCalendarLocale: calendarLocale, | ||
22458 | onClear: this.onPanelClear, | ||
22459 | defaultValue: defaultValue, | ||
22460 | showHour: showHour, | ||
22461 | onEsc: this.onEsc, | ||
22462 | showSecond: showSecond, | ||
22463 | locale: locale, | ||
22464 | allowEmpty: allowEmpty, | ||
22465 | formatter: this.getFormatter(), | ||
22466 | placeholder: placeholder, | ||
22467 | hourOptions: hourOptions, | ||
22468 | minuteOptions: minuteOptions, | ||
22469 | secondOptions: secondOptions | ||
22470 | }); | ||
22471 | }, | ||
22472 | |||
22473 | setOpen: function setOpen(open, callback) { | ||
22474 | var _props3 = this.props; | ||
22475 | var onOpen = _props3.onOpen; | ||
22476 | var onClose = _props3.onClose; | ||
22477 | |||
22478 | if (this.state.open !== open) { | ||
22479 | this.setState({ | ||
22480 | open: open | ||
22481 | }, callback); | ||
22482 | var _event = { | ||
22483 | open: open | ||
22484 | }; | ||
22485 | if (open) { | ||
22486 | onOpen(_event); | ||
22487 | } else { | ||
22488 | onClose(_event); | ||
22489 | } | ||
22490 | } | ||
22491 | }, | ||
22492 | |||
22493 | render: function render() { | ||
22494 | var _props4 = this.props; | ||
22495 | var prefixCls = _props4.prefixCls; | ||
22496 | var placeholder = _props4.placeholder; | ||
22497 | var placement = _props4.placement; | ||
22498 | var align = _props4.align; | ||
22499 | var disabled = _props4.disabled; | ||
22500 | var transitionName = _props4.transitionName; | ||
22501 | var style = _props4.style; | ||
22502 | var showHour = _props4.showHour; | ||
22503 | var showSecond = _props4.showSecond; | ||
22504 | var getPopupContainer = _props4.getPopupContainer; | ||
22505 | var _state = this.state; | ||
22506 | var open = _state.open; | ||
22507 | var value = _state.value; | ||
22508 | |||
22509 | var popupClassName = undefined; | ||
22510 | if (!showHour || !showSecond) { | ||
22511 | popupClassName = prefixCls + '-panel-narrow}'; | ||
22512 | } | ||
22513 | return _react2['default'].createElement( | ||
22514 | _rcTrigger2['default'], | ||
22515 | { | ||
22516 | prefixCls: prefixCls + '-panel', | ||
22517 | popupClassName: popupClassName, | ||
22518 | popup: this.getPanelElement(), | ||
22519 | popupAlign: align, | ||
22520 | builtinPlacements: _utilPlacements2['default'], | ||
22521 | popupPlacement: placement, | ||
22522 | action: disabled ? [] : ['click'], | ||
22523 | destroyPopupOnHide: true, | ||
22524 | getPopupContainer: getPopupContainer, | ||
22525 | popupTransitionName: transitionName, | ||
22526 | popupVisible: open, | ||
22527 | onPopupVisibleChange: this.onVisibleChange | ||
22528 | }, | ||
22529 | _react2['default'].createElement( | ||
22530 | 'span', | ||
22531 | { className: '' + prefixCls, style: style }, | ||
22532 | _react2['default'].createElement('input', { className: prefixCls + '-input', | ||
22533 | ref: 'picker', type: 'text', placeholder: placeholder, | ||
22534 | readOnly: true, | ||
22535 | onKeyDown: this.onKeyDown, | ||
22536 | disabled: disabled, value: value && this.getFormatter().format(value) }), | ||
22537 | _react2['default'].createElement('span', { className: prefixCls + '-icon' }) | ||
22538 | ) | ||
22539 | ); | ||
22540 | } | ||
22541 | }); | ||
22542 | |||
22543 | exports['default'] = Picker; | ||
22544 | module.exports = exports['default']; | ||
22545 | |||
22546 | /***/ }, | ||
22547 | /* 172 */ | ||
22548 | /***/ function(module, exports, __webpack_require__) { | ||
22549 | |||
22550 | 'use strict'; | ||
22551 | |||
22552 | module.exports = __webpack_require__(173); | ||
22553 | |||
22554 | /***/ }, | ||
22555 | /* 173 */ | ||
22556 | /***/ function(module, exports, __webpack_require__) { | ||
22557 | |||
22558 | 'use strict'; | ||
22559 | |||
22560 | Object.defineProperty(exports, '__esModule', { | ||
22561 | value: true | ||
22562 | }); | ||
22563 | |||
22564 | 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; }; | ||
22565 | |||
22566 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
22567 | |||
22568 | var _react = __webpack_require__(3); | ||
22569 | |||
22570 | var _react2 = _interopRequireDefault(_react); | ||
22571 | |||
22572 | var _reactDom = __webpack_require__(160); | ||
22573 | |||
22574 | var _reactDom2 = _interopRequireDefault(_reactDom); | ||
22575 | |||
22576 | var _rcUtil = __webpack_require__(174); | ||
22577 | |||
22578 | var _Popup = __webpack_require__(197); | ||
22579 | |||
22580 | var _Popup2 = _interopRequireDefault(_Popup); | ||
22581 | |||
22582 | var _utils = __webpack_require__(218); | ||
22583 | |||
22584 | function noop() {} | ||
22585 | |||
22586 | function returnEmptyString() { | ||
22587 | return ''; | ||
22588 | } | ||
22589 | |||
22590 | var Trigger = _react2['default'].createClass({ | ||
22591 | displayName: 'Trigger', | ||
22592 | |||
22593 | propTypes: { | ||
22594 | action: _react.PropTypes.any, | ||
22595 | getPopupClassNameFromAlign: _react.PropTypes.any, | ||
22596 | onPopupVisibleChange: _react.PropTypes.func, | ||
22597 | afterPopupVisibleChange: _react.PropTypes.func, | ||
22598 | popup: _react.PropTypes.node.isRequired, | ||
22599 | popupStyle: _react.PropTypes.object, | ||
22600 | popupClassName: _react.PropTypes.string, | ||
22601 | popupPlacement: _react.PropTypes.string, | ||
22602 | builtinPlacements: _react.PropTypes.object, | ||
22603 | popupTransitionName: _react.PropTypes.string, | ||
22604 | popupAnimation: _react.PropTypes.any, | ||
22605 | mouseEnterDelay: _react.PropTypes.number, | ||
22606 | mouseLeaveDelay: _react.PropTypes.number, | ||
22607 | getPopupContainer: _react.PropTypes.func, | ||
22608 | destroyPopupOnHide: _react.PropTypes.bool, | ||
22609 | popupAlign: _react.PropTypes.object, | ||
22610 | popupVisible: _react.PropTypes.bool | ||
22611 | }, | ||
22612 | |||
22613 | getDefaultProps: function getDefaultProps() { | ||
22614 | return { | ||
22615 | prefixCls: 'rc-trigger-popup', | ||
22616 | getPopupClassNameFromAlign: returnEmptyString, | ||
22617 | onPopupVisibleChange: noop, | ||
22618 | afterPopupVisibleChange: noop, | ||
22619 | popupClassName: '', | ||
22620 | mouseEnterDelay: 0, | ||
22621 | mouseLeaveDelay: 0.1, | ||
22622 | popupStyle: {}, | ||
22623 | destroyPopupOnHide: false, | ||
22624 | popupAlign: {}, | ||
22625 | defaultPopupVisible: false, | ||
22626 | action: [] | ||
22627 | }; | ||
22628 | }, | ||
22629 | |||
22630 | getInitialState: function getInitialState() { | ||
22631 | var props = this.props; | ||
22632 | var popupVisible = undefined; | ||
22633 | if ('popupVisible' in props) { | ||
22634 | popupVisible = !!props.popupVisible; | ||
22635 | } else { | ||
22636 | popupVisible = !!props.defaultPopupVisible; | ||
22637 | } | ||
22638 | return { popupVisible: popupVisible }; | ||
22639 | }, | ||
22640 | |||
22641 | componentDidMount: function componentDidMount() { | ||
22642 | this.componentDidUpdate({}, { | ||
22643 | popupVisible: this.state.popupVisible | ||
22644 | }); | ||
22645 | }, | ||
22646 | |||
22647 | componentWillReceiveProps: function componentWillReceiveProps(nextProps) { | ||
22648 | if ('popupVisible' in nextProps) { | ||
22649 | this.setState({ | ||
22650 | popupVisible: !!nextProps.popupVisible | ||
22651 | }); | ||
22652 | } | ||
22653 | }, | ||
22654 | |||
22655 | componentDidUpdate: function componentDidUpdate(prevProps, prevState) { | ||
22656 | var _this = this; | ||
22657 | |||
22658 | var props = this.props; | ||
22659 | var state = this.state; | ||
22660 | if (this.popupRendered) { | ||
22661 | var _ret = (function () { | ||
22662 | var self = _this; | ||
22663 | _reactDom2['default'].unstable_renderSubtreeIntoContainer(_this, _this.getPopupElement(), _this.getPopupContainer(), function renderPopup() { | ||
22664 | if (this.isMounted()) { | ||
22665 | self.popupDomNode = _reactDom2['default'].findDOMNode(this); | ||
22666 | } else { | ||
22667 | self.popupDomNode = null; | ||
22668 | } | ||
22669 | if (prevState.popupVisible !== state.popupVisible) { | ||
22670 | props.afterPopupVisibleChange(state.popupVisible); | ||
22671 | } | ||
22672 | }); | ||
22673 | if (props.action.indexOf('click') !== -1) { | ||
22674 | if (state.popupVisible) { | ||
22675 | if (!_this.clickOutsideHandler) { | ||
22676 | _this.clickOutsideHandler = _rcUtil.Dom.addEventListener(document, 'mousedown', _this.onDocumentClick); | ||
22677 | _this.touchOutsideHandler = _rcUtil.Dom.addEventListener(document, 'touchstart', _this.onDocumentClick); | ||
22678 | } | ||
22679 | return { | ||
22680 | v: undefined | ||
22681 | }; | ||
22682 | } | ||
22683 | } | ||
22684 | if (_this.clickOutsideHandler) { | ||
22685 | _this.clickOutsideHandler.remove(); | ||
22686 | _this.touchOutsideHandler.remove(); | ||
22687 | _this.clickOutsideHandler = null; | ||
22688 | _this.touchOutsideHandler = null; | ||
22689 | } | ||
22690 | })(); | ||
22691 | |||
22692 | if (typeof _ret === 'object') return _ret.v; | ||
22693 | } | ||
22694 | }, | ||
22695 | |||
22696 | componentWillUnmount: function componentWillUnmount() { | ||
22697 | var popupContainer = this.popupContainer; | ||
22698 | if (popupContainer) { | ||
22699 | _reactDom2['default'].unmountComponentAtNode(popupContainer); | ||
22700 | if (this.props.getPopupContainer) { | ||
22701 | var mountNode = this.props.getPopupContainer(); | ||
22702 | mountNode.removeChild(popupContainer); | ||
22703 | } else { | ||
22704 | document.body.removeChild(popupContainer); | ||
22705 | } | ||
22706 | this.popupContainer = null; | ||
22707 | } | ||
22708 | if (this.delayTimer) { | ||
22709 | clearTimeout(this.delayTimer); | ||
22710 | this.delayTimer = null; | ||
22711 | } | ||
22712 | if (this.clickOutsideHandler) { | ||
22713 | this.clickOutsideHandler.remove(); | ||
22714 | this.touchOutsideHandler.remove(); | ||
22715 | this.clickOutsideHandler = null; | ||
22716 | this.touchOutsideHandler = null; | ||
22717 | } | ||
22718 | }, | ||
22719 | |||
22720 | onMouseEnter: function onMouseEnter() { | ||
22721 | this.delaySetPopupVisible(true, this.props.mouseEnterDelay); | ||
22722 | }, | ||
22723 | |||
22724 | onMouseLeave: function onMouseLeave() { | ||
22725 | this.delaySetPopupVisible(false, this.props.mouseLeaveDelay); | ||
22726 | }, | ||
22727 | |||
22728 | onFocus: function onFocus() { | ||
22729 | this.focusTime = Date.now(); | ||
22730 | this.setPopupVisible(true); | ||
22731 | }, | ||
22732 | |||
22733 | onMouseDown: function onMouseDown() { | ||
22734 | this.preClickTime = Date.now(); | ||
22735 | }, | ||
22736 | |||
22737 | onTouchStart: function onTouchStart() { | ||
22738 | this.preTouchTime = Date.now(); | ||
22739 | }, | ||
22740 | |||
22741 | onBlur: function onBlur() { | ||
22742 | this.setPopupVisible(false); | ||
22743 | }, | ||
22744 | |||
22745 | onClick: function onClick(event) { | ||
22746 | // focus will trigger click | ||
22747 | if (this.focusTime) { | ||
22748 | var preTime = undefined; | ||
22749 | if (this.preClickTime && this.preTouchTime) { | ||
22750 | preTime = Math.min(this.preClickTime, this.preTouchTime); | ||
22751 | } else if (this.preClickTime) { | ||
22752 | preTime = this.preClickTime; | ||
22753 | } else if (this.preTouchTime) { | ||
22754 | preTime = this.preTouchTime; | ||
22755 | } | ||
22756 | if (Math.abs(preTime - this.focusTime) < 20) { | ||
22757 | return; | ||
22758 | } | ||
22759 | this.focusTime = 0; | ||
22760 | } | ||
22761 | this.preClickTime = 0; | ||
22762 | this.preTouchTime = 0; | ||
22763 | event.preventDefault(); | ||
22764 | this.setPopupVisible(!this.state.popupVisible); | ||
22765 | }, | ||
22766 | |||
22767 | onDocumentClick: function onDocumentClick(event) { | ||
22768 | var target = event.target; | ||
22769 | var root = _reactDom2['default'].findDOMNode(this); | ||
22770 | var popupNode = this.getPopupDomNode(); | ||
22771 | if (!_rcUtil.Dom.contains(root, target) && !_rcUtil.Dom.contains(popupNode, target)) { | ||
22772 | this.setPopupVisible(false); | ||
22773 | } | ||
22774 | }, | ||
22775 | |||
22776 | getPopupDomNode: function getPopupDomNode() { | ||
22777 | // for test | ||
22778 | return this.popupDomNode; | ||
22779 | }, | ||
22780 | |||
22781 | getPopupContainer: function getPopupContainer() { | ||
22782 | if (!this.popupContainer) { | ||
22783 | this.popupContainer = document.createElement('div'); | ||
22784 | if (this.props.getPopupContainer) { | ||
22785 | var mountNode = this.props.getPopupContainer(); | ||
22786 | mountNode.appendChild(this.popupContainer); | ||
22787 | } else { | ||
22788 | document.body.appendChild(this.popupContainer); | ||
22789 | } | ||
22790 | } | ||
22791 | return this.popupContainer; | ||
22792 | }, | ||
22793 | |||
22794 | getPopupClassNameFromAlign: function getPopupClassNameFromAlign(align) { | ||
22795 | var className = []; | ||
22796 | var props = this.props; | ||
22797 | var popupPlacement = props.popupPlacement; | ||
22798 | var builtinPlacements = props.builtinPlacements; | ||
22799 | var prefixCls = props.prefixCls; | ||
22800 | |||
22801 | if (popupPlacement && builtinPlacements) { | ||
22802 | className.push((0, _utils.getPopupClassNameFromAlign)(builtinPlacements, prefixCls, align)); | ||
22803 | } | ||
22804 | if (props.getPopupClassNameFromAlign) { | ||
22805 | className.push(props.getPopupClassNameFromAlign(align)); | ||
22806 | } | ||
22807 | return className.join(' '); | ||
22808 | }, | ||
22809 | |||
22810 | getPopupAlign: function getPopupAlign() { | ||
22811 | var props = this.props; | ||
22812 | var popupPlacement = props.popupPlacement; | ||
22813 | var popupAlign = props.popupAlign; | ||
22814 | var builtinPlacements = props.builtinPlacements; | ||
22815 | |||
22816 | if (popupPlacement && builtinPlacements) { | ||
22817 | return (0, _utils.getAlignFromPlacement)(builtinPlacements, popupPlacement, popupAlign); | ||
22818 | } | ||
22819 | return popupAlign; | ||
22820 | }, | ||
22821 | |||
22822 | getPopupElement: function getPopupElement() { | ||
22823 | var props = this.props; | ||
22824 | var state = this.state; | ||
22825 | var mouseProps = {}; | ||
22826 | if (props.action.indexOf('hover') !== -1) { | ||
22827 | mouseProps.onMouseEnter = this.onMouseEnter; | ||
22828 | mouseProps.onMouseLeave = this.onMouseLeave; | ||
22829 | } | ||
22830 | return _react2['default'].createElement( | ||
22831 | _Popup2['default'], | ||
22832 | _extends({ prefixCls: props.prefixCls, | ||
22833 | destroyPopupOnHide: props.destroyPopupOnHide, | ||
22834 | visible: state.popupVisible, | ||
22835 | className: props.popupClassName, | ||
22836 | action: props.action, | ||
22837 | align: this.getPopupAlign(), | ||
22838 | animation: props.popupAnimation, | ||
22839 | getClassNameFromAlign: this.getPopupClassNameFromAlign | ||
22840 | }, mouseProps, { | ||
22841 | wrap: this, | ||
22842 | style: props.popupStyle, | ||
22843 | transitionName: props.popupTransitionName }), | ||
22844 | props.popup | ||
22845 | ); | ||
22846 | }, | ||
22847 | |||
22848 | setPopupVisible: function setPopupVisible(popupVisible) { | ||
22849 | if (this.state.popupVisible !== popupVisible) { | ||
22850 | if (!('popupVisible' in this.props)) { | ||
22851 | this.setState({ | ||
22852 | popupVisible: popupVisible | ||
22853 | }); | ||
22854 | } | ||
22855 | this.props.onPopupVisibleChange(popupVisible); | ||
22856 | } | ||
22857 | }, | ||
22858 | |||
22859 | delaySetPopupVisible: function delaySetPopupVisible(visible, delayS) { | ||
22860 | var _this2 = this; | ||
22861 | |||
22862 | var delay = delayS * 1000; | ||
22863 | if (this.delayTimer) { | ||
22864 | clearTimeout(this.delayTimer); | ||
22865 | this.delayTimer = null; | ||
22866 | } | ||
22867 | if (delay) { | ||
22868 | this.delayTimer = setTimeout(function () { | ||
22869 | _this2.setPopupVisible(visible); | ||
22870 | _this2.delayTimer = null; | ||
22871 | }, delay); | ||
22872 | } else { | ||
22873 | this.setPopupVisible(visible); | ||
22874 | } | ||
22875 | }, | ||
22876 | |||
22877 | render: function render() { | ||
22878 | this.popupRendered = this.popupRendered || this.state.popupVisible; | ||
22879 | var props = this.props; | ||
22880 | var children = props.children; | ||
22881 | var child = _react2['default'].Children.only(children); | ||
22882 | var childProps = child.props || {}; | ||
22883 | var newChildProps = {}; | ||
22884 | var trigger = props.action; | ||
22885 | if (trigger.indexOf('click') !== -1) { | ||
22886 | newChildProps.onClick = (0, _rcUtil.createChainedFunction)(this.onClick, childProps.onClick); | ||
22887 | newChildProps.onMouseDown = (0, _rcUtil.createChainedFunction)(this.onMouseDown, childProps.onMouseDown); | ||
22888 | newChildProps.onTouchStart = (0, _rcUtil.createChainedFunction)(this.onTouchStart, childProps.onTouchStart); | ||
22889 | } | ||
22890 | if (trigger.indexOf('hover') !== -1) { | ||
22891 | newChildProps.onMouseEnter = (0, _rcUtil.createChainedFunction)(this.onMouseEnter, childProps.onMouseEnter); | ||
22892 | newChildProps.onMouseLeave = (0, _rcUtil.createChainedFunction)(this.onMouseLeave, childProps.onMouseLeave); | ||
22893 | } | ||
22894 | if (trigger.indexOf('focus') !== -1) { | ||
22895 | newChildProps.onFocus = (0, _rcUtil.createChainedFunction)(this.onFocus, childProps.onFocus); | ||
22896 | newChildProps.onBlur = (0, _rcUtil.createChainedFunction)(this.onBlur, childProps.onBlur); | ||
22897 | } | ||
22898 | |||
22899 | return _react2['default'].cloneElement(child, newChildProps); | ||
22900 | } | ||
22901 | }); | ||
22902 | |||
22903 | exports['default'] = Trigger; | ||
22904 | module.exports = exports['default']; | ||
22905 | |||
22906 | /***/ }, | ||
22907 | /* 174 */ | ||
22908 | /***/ function(module, exports, __webpack_require__) { | ||
22909 | |||
22910 | 'use strict'; | ||
22911 | |||
22912 | module.exports = { | ||
22913 | guid: __webpack_require__(175), | ||
22914 | classSet: __webpack_require__(176), | ||
22915 | joinClasses: __webpack_require__(179), | ||
22916 | KeyCode: __webpack_require__(180), | ||
22917 | PureRenderMixin: __webpack_require__(181), | ||
22918 | shallowEqual: __webpack_require__(182), | ||
22919 | createChainedFunction: __webpack_require__(188), | ||
22920 | Dom: { | ||
22921 | addEventListener: __webpack_require__(189), | ||
22922 | contains: __webpack_require__(194) | ||
22923 | }, | ||
22924 | Children: { | ||
22925 | toArray: __webpack_require__(195), | ||
22926 | mapSelf: __webpack_require__(196) | ||
22927 | } | ||
22928 | }; | ||
22929 | |||
22930 | /***/ }, | ||
22931 | /* 175 */ | ||
22932 | /***/ function(module, exports) { | ||
22933 | |||
22934 | 'use strict'; | ||
22935 | |||
22936 | var seed = 0; | ||
22937 | module.exports = function guid() { | ||
22938 | return Date.now() + '_' + seed++; | ||
22939 | }; | ||
22940 | |||
22941 | /***/ }, | ||
22942 | /* 176 */ | ||
22943 | /***/ function(module, exports, __webpack_require__) { | ||
22944 | |||
22945 | 'use strict'; | ||
22946 | |||
22947 | var deprecate = __webpack_require__(177); | ||
22948 | var classNames = __webpack_require__(178); | ||
22949 | |||
22950 | module.exports = deprecate(classNames, '`rcUtil.classSet()` is deprecated, use `classNames()` by `require(\'classnames\')` instead'); | ||
22951 | |||
22952 | /***/ }, | ||
22953 | /* 177 */ | ||
22954 | /***/ function(module, exports) { | ||
22955 | |||
22956 | /* WEBPACK VAR INJECTION */(function(global) { | ||
22957 | /** | ||
22958 | * Module exports. | ||
22959 | */ | ||
22960 | |||
22961 | module.exports = deprecate; | ||
22962 | |||
22963 | /** | ||
22964 | * Mark that a method should not be used. | ||
22965 | * Returns a modified function which warns once by default. | ||
22966 | * | ||
22967 | * If `localStorage.noDeprecation = true` is set, then it is a no-op. | ||
22968 | * | ||
22969 | * If `localStorage.throwDeprecation = true` is set, then deprecated functions | ||
22970 | * will throw an Error when invoked. | ||
22971 | * | ||
22972 | * If `localStorage.traceDeprecation = true` is set, then deprecated functions | ||
22973 | * will invoke `console.trace()` instead of `console.error()`. | ||
22974 | * | ||
22975 | * @param {Function} fn - the function to deprecate | ||
22976 | * @param {String} msg - the string to print to the console when `fn` is invoked | ||
22977 | * @returns {Function} a new "deprecated" version of `fn` | ||
22978 | * @api public | ||
22979 | */ | ||
22980 | |||
22981 | function deprecate (fn, msg) { | ||
22982 | if (config('noDeprecation')) { | ||
22983 | return fn; | ||
22984 | } | ||
22985 | |||
22986 | var warned = false; | ||
22987 | function deprecated() { | ||
22988 | if (!warned) { | ||
22989 | if (config('throwDeprecation')) { | ||
22990 | throw new Error(msg); | ||
22991 | } else if (config('traceDeprecation')) { | ||
22992 | console.trace(msg); | ||
22993 | } else { | ||
22994 | console.warn(msg); | ||
22995 | } | ||
22996 | warned = true; | ||
22997 | } | ||
22998 | return fn.apply(this, arguments); | ||
22999 | } | ||
23000 | |||
23001 | return deprecated; | ||
23002 | } | ||
23003 | |||
23004 | /** | ||
23005 | * Checks `localStorage` for boolean values for the given `name`. | ||
23006 | * | ||
23007 | * @param {String} name | ||
23008 | * @returns {Boolean} | ||
23009 | * @api private | ||
23010 | */ | ||
23011 | |||
23012 | function config (name) { | ||
23013 | // accessing global.localStorage can trigger a DOMException in sandboxed iframes | ||
23014 | try { | ||
23015 | if (!global.localStorage) return false; | ||
23016 | } catch (_) { | ||
23017 | return false; | ||
23018 | } | ||
23019 | var val = global.localStorage[name]; | ||
23020 | if (null == val) return false; | ||
23021 | return String(val).toLowerCase() === 'true'; | ||
23022 | } | ||
23023 | |||
23024 | /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) | ||
23025 | |||
23026 | /***/ }, | ||
23027 | /* 178 */ | ||
23028 | /***/ function(module, exports, __webpack_require__) { | ||
23029 | |||
23030 | var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! | ||
23031 | Copyright (c) 2015 Jed Watson. | ||
23032 | Licensed under the MIT License (MIT), see | ||
23033 | http://jedwatson.github.io/classnames | ||
23034 | */ | ||
23035 | /* global define */ | ||
23036 | |||
23037 | (function () { | ||
23038 | 'use strict'; | ||
23039 | |||
23040 | var hasOwn = {}.hasOwnProperty; | ||
23041 | |||
23042 | function classNames () { | ||
23043 | var classes = ''; | ||
23044 | |||
23045 | for (var i = 0; i < arguments.length; i++) { | ||
23046 | var arg = arguments[i]; | ||
23047 | if (!arg) continue; | ||
23048 | |||
23049 | var argType = typeof arg; | ||
23050 | |||
23051 | if (argType === 'string' || argType === 'number') { | ||
23052 | classes += ' ' + arg; | ||
23053 | } else if (Array.isArray(arg)) { | ||
23054 | classes += ' ' + classNames.apply(null, arg); | ||
23055 | } else if (argType === 'object') { | ||
23056 | for (var key in arg) { | ||
23057 | if (hasOwn.call(arg, key) && arg[key]) { | ||
23058 | classes += ' ' + key; | ||
23059 | } | ||
23060 | } | ||
23061 | } | ||
23062 | } | ||
23063 | |||
23064 | return classes.substr(1); | ||
23065 | } | ||
23066 | |||
23067 | if (typeof module !== 'undefined' && module.exports) { | ||
23068 | module.exports = classNames; | ||
23069 | } else if (true) { | ||
23070 | // register as 'classnames', consistent with npm package name | ||
23071 | !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () { | ||
23072 | return classNames; | ||
23073 | }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); | ||
23074 | } else { | ||
23075 | window.classNames = classNames; | ||
23076 | } | ||
23077 | }()); | ||
23078 | |||
23079 | |||
23080 | /***/ }, | ||
23081 | /* 179 */ | ||
23082 | /***/ function(module, exports, __webpack_require__) { | ||
23083 | |||
23084 | 'use strict'; | ||
23085 | |||
23086 | var deprecate = __webpack_require__(177); | ||
23087 | var classNames = __webpack_require__(178); | ||
23088 | |||
23089 | module.exports = deprecate(classNames, '`rcUtil.joinClasses()` is deprecated, use `classNames()` by `require(\'classnames\')` instead'); | ||
23090 | |||
23091 | /***/ }, | ||
23092 | /* 180 */ | ||
23093 | /***/ function(module, exports) { | ||
23094 | |||
23095 | /** | ||
23096 | * @ignore | ||
23097 | * some key-codes definition and utils from closure-library | ||
23098 | * @author yiminghe@gmail.com | ||
23099 | */ | ||
23100 | |||
23101 | 'use strict'; | ||
23102 | |||
23103 | var KeyCode = { | ||
23104 | /** | ||
23105 | * MAC_ENTER | ||
23106 | */ | ||
23107 | MAC_ENTER: 3, | ||
23108 | /** | ||
23109 | * BACKSPACE | ||
23110 | */ | ||
23111 | BACKSPACE: 8, | ||
23112 | /** | ||
23113 | * TAB | ||
23114 | */ | ||
23115 | TAB: 9, | ||
23116 | /** | ||
23117 | * NUMLOCK on FF/Safari Mac | ||
23118 | */ | ||
23119 | NUM_CENTER: 12, // NUMLOCK on FF/Safari Mac | ||
23120 | /** | ||
23121 | * ENTER | ||
23122 | */ | ||
23123 | ENTER: 13, | ||
23124 | /** | ||
23125 | * SHIFT | ||
23126 | */ | ||
23127 | SHIFT: 16, | ||
23128 | /** | ||
23129 | * CTRL | ||
23130 | */ | ||
23131 | CTRL: 17, | ||
23132 | /** | ||
23133 | * ALT | ||
23134 | */ | ||
23135 | ALT: 18, | ||
23136 | /** | ||
23137 | * PAUSE | ||
23138 | */ | ||
23139 | PAUSE: 19, | ||
23140 | /** | ||
23141 | * CAPS_LOCK | ||
23142 | */ | ||
23143 | CAPS_LOCK: 20, | ||
23144 | /** | ||
23145 | * ESC | ||
23146 | */ | ||
23147 | ESC: 27, | ||
23148 | /** | ||
23149 | * SPACE | ||
23150 | */ | ||
23151 | SPACE: 32, | ||
23152 | /** | ||
23153 | * PAGE_UP | ||
23154 | */ | ||
23155 | PAGE_UP: 33, // also NUM_NORTH_EAST | ||
23156 | /** | ||
23157 | * PAGE_DOWN | ||
23158 | */ | ||
23159 | PAGE_DOWN: 34, // also NUM_SOUTH_EAST | ||
23160 | /** | ||
23161 | * END | ||
23162 | */ | ||
23163 | END: 35, // also NUM_SOUTH_WEST | ||
23164 | /** | ||
23165 | * HOME | ||
23166 | */ | ||
23167 | HOME: 36, // also NUM_NORTH_WEST | ||
23168 | /** | ||
23169 | * LEFT | ||
23170 | */ | ||
23171 | LEFT: 37, // also NUM_WEST | ||
23172 | /** | ||
23173 | * UP | ||
23174 | */ | ||
23175 | UP: 38, // also NUM_NORTH | ||
23176 | /** | ||
23177 | * RIGHT | ||
23178 | */ | ||
23179 | RIGHT: 39, // also NUM_EAST | ||
23180 | /** | ||
23181 | * DOWN | ||
23182 | */ | ||
23183 | DOWN: 40, // also NUM_SOUTH | ||
23184 | /** | ||
23185 | * PRINT_SCREEN | ||
23186 | */ | ||
23187 | PRINT_SCREEN: 44, | ||
23188 | /** | ||
23189 | * INSERT | ||
23190 | */ | ||
23191 | INSERT: 45, // also NUM_INSERT | ||
23192 | /** | ||
23193 | * DELETE | ||
23194 | */ | ||
23195 | DELETE: 46, // also NUM_DELETE | ||
23196 | /** | ||
23197 | * ZERO | ||
23198 | */ | ||
23199 | ZERO: 48, | ||
23200 | /** | ||
23201 | * ONE | ||
23202 | */ | ||
23203 | ONE: 49, | ||
23204 | /** | ||
23205 | * TWO | ||
23206 | */ | ||
23207 | TWO: 50, | ||
23208 | /** | ||
23209 | * THREE | ||
23210 | */ | ||
23211 | THREE: 51, | ||
23212 | /** | ||
23213 | * FOUR | ||
23214 | */ | ||
23215 | FOUR: 52, | ||
23216 | /** | ||
23217 | * FIVE | ||
23218 | */ | ||
23219 | FIVE: 53, | ||
23220 | /** | ||
23221 | * SIX | ||
23222 | */ | ||
23223 | SIX: 54, | ||
23224 | /** | ||
23225 | * SEVEN | ||
23226 | */ | ||
23227 | SEVEN: 55, | ||
23228 | /** | ||
23229 | * EIGHT | ||
23230 | */ | ||
23231 | EIGHT: 56, | ||
23232 | /** | ||
23233 | * NINE | ||
23234 | */ | ||
23235 | NINE: 57, | ||
23236 | /** | ||
23237 | * QUESTION_MARK | ||
23238 | */ | ||
23239 | QUESTION_MARK: 63, // needs localization | ||
23240 | /** | ||
23241 | * A | ||
23242 | */ | ||
23243 | A: 65, | ||
23244 | /** | ||
23245 | * B | ||
23246 | */ | ||
23247 | B: 66, | ||
23248 | /** | ||
23249 | * C | ||
23250 | */ | ||
23251 | C: 67, | ||
23252 | /** | ||
23253 | * D | ||
23254 | */ | ||
23255 | D: 68, | ||
23256 | /** | ||
23257 | * E | ||
23258 | */ | ||
23259 | E: 69, | ||
23260 | /** | ||
23261 | * F | ||
23262 | */ | ||
23263 | F: 70, | ||
23264 | /** | ||
23265 | * G | ||
23266 | */ | ||
23267 | G: 71, | ||
23268 | /** | ||
23269 | * H | ||
23270 | */ | ||
23271 | H: 72, | ||
23272 | /** | ||
23273 | * I | ||
23274 | */ | ||
23275 | I: 73, | ||
23276 | /** | ||
23277 | * J | ||
23278 | */ | ||
23279 | J: 74, | ||
23280 | /** | ||
23281 | * K | ||
23282 | */ | ||
23283 | K: 75, | ||
23284 | /** | ||
23285 | * L | ||
23286 | */ | ||
23287 | L: 76, | ||
23288 | /** | ||
23289 | * M | ||
23290 | */ | ||
23291 | M: 77, | ||
23292 | /** | ||
23293 | * N | ||
23294 | */ | ||
23295 | N: 78, | ||
23296 | /** | ||
23297 | * O | ||
23298 | */ | ||
23299 | O: 79, | ||
23300 | /** | ||
23301 | * P | ||
23302 | */ | ||
23303 | P: 80, | ||
23304 | /** | ||
23305 | * Q | ||
23306 | */ | ||
23307 | Q: 81, | ||
23308 | /** | ||
23309 | * R | ||
23310 | */ | ||
23311 | R: 82, | ||
23312 | /** | ||
23313 | * S | ||
23314 | */ | ||
23315 | S: 83, | ||
23316 | /** | ||
23317 | * T | ||
23318 | */ | ||
23319 | T: 84, | ||
23320 | /** | ||
23321 | * U | ||
23322 | */ | ||
23323 | U: 85, | ||
23324 | /** | ||
23325 | * V | ||
23326 | */ | ||
23327 | V: 86, | ||
23328 | /** | ||
23329 | * W | ||
23330 | */ | ||
23331 | W: 87, | ||
23332 | /** | ||
23333 | * X | ||
23334 | */ | ||
23335 | X: 88, | ||
23336 | /** | ||
23337 | * Y | ||
23338 | */ | ||
23339 | Y: 89, | ||
23340 | /** | ||
23341 | * Z | ||
23342 | */ | ||
23343 | Z: 90, | ||
23344 | /** | ||
23345 | * META | ||
23346 | */ | ||
23347 | META: 91, // WIN_KEY_LEFT | ||
23348 | /** | ||
23349 | * WIN_KEY_RIGHT | ||
23350 | */ | ||
23351 | WIN_KEY_RIGHT: 92, | ||
23352 | /** | ||
23353 | * CONTEXT_MENU | ||
23354 | */ | ||
23355 | CONTEXT_MENU: 93, | ||
23356 | /** | ||
23357 | * NUM_ZERO | ||
23358 | */ | ||
23359 | NUM_ZERO: 96, | ||
23360 | /** | ||
23361 | * NUM_ONE | ||
23362 | */ | ||
23363 | NUM_ONE: 97, | ||
23364 | /** | ||
23365 | * NUM_TWO | ||
23366 | */ | ||
23367 | NUM_TWO: 98, | ||
23368 | /** | ||
23369 | * NUM_THREE | ||
23370 | */ | ||
23371 | NUM_THREE: 99, | ||
23372 | /** | ||
23373 | * NUM_FOUR | ||
23374 | */ | ||
23375 | NUM_FOUR: 100, | ||
23376 | /** | ||
23377 | * NUM_FIVE | ||
23378 | */ | ||
23379 | NUM_FIVE: 101, | ||
23380 | /** | ||
23381 | * NUM_SIX | ||
23382 | */ | ||
23383 | NUM_SIX: 102, | ||
23384 | /** | ||
23385 | * NUM_SEVEN | ||
23386 | */ | ||
23387 | NUM_SEVEN: 103, | ||
23388 | /** | ||
23389 | * NUM_EIGHT | ||
23390 | */ | ||
23391 | NUM_EIGHT: 104, | ||
23392 | /** | ||
23393 | * NUM_NINE | ||
23394 | */ | ||
23395 | NUM_NINE: 105, | ||
23396 | /** | ||
23397 | * NUM_MULTIPLY | ||
23398 | */ | ||
23399 | NUM_MULTIPLY: 106, | ||
23400 | /** | ||
23401 | * NUM_PLUS | ||
23402 | */ | ||
23403 | NUM_PLUS: 107, | ||
23404 | /** | ||
23405 | * NUM_MINUS | ||
23406 | */ | ||
23407 | NUM_MINUS: 109, | ||
23408 | /** | ||
23409 | * NUM_PERIOD | ||
23410 | */ | ||
23411 | NUM_PERIOD: 110, | ||
23412 | /** | ||
23413 | * NUM_DIVISION | ||
23414 | */ | ||
23415 | NUM_DIVISION: 111, | ||
23416 | /** | ||
23417 | * F1 | ||
23418 | */ | ||
23419 | F1: 112, | ||
23420 | /** | ||
23421 | * F2 | ||
23422 | */ | ||
23423 | F2: 113, | ||
23424 | /** | ||
23425 | * F3 | ||
23426 | */ | ||
23427 | F3: 114, | ||
23428 | /** | ||
23429 | * F4 | ||
23430 | */ | ||
23431 | F4: 115, | ||
23432 | /** | ||
23433 | * F5 | ||
23434 | */ | ||
23435 | F5: 116, | ||
23436 | /** | ||
23437 | * F6 | ||
23438 | */ | ||
23439 | F6: 117, | ||
23440 | /** | ||
23441 | * F7 | ||
23442 | */ | ||
23443 | F7: 118, | ||
23444 | /** | ||
23445 | * F8 | ||
23446 | */ | ||
23447 | F8: 119, | ||
23448 | /** | ||
23449 | * F9 | ||
23450 | */ | ||
23451 | F9: 120, | ||
23452 | /** | ||
23453 | * F10 | ||
23454 | */ | ||
23455 | F10: 121, | ||
23456 | /** | ||
23457 | * F11 | ||
23458 | */ | ||
23459 | F11: 122, | ||
23460 | /** | ||
23461 | * F12 | ||
23462 | */ | ||
23463 | F12: 123, | ||
23464 | /** | ||
23465 | * NUMLOCK | ||
23466 | */ | ||
23467 | NUMLOCK: 144, | ||
23468 | /** | ||
23469 | * SEMICOLON | ||
23470 | */ | ||
23471 | SEMICOLON: 186, // needs localization | ||
23472 | /** | ||
23473 | * DASH | ||
23474 | */ | ||
23475 | DASH: 189, // needs localization | ||
23476 | /** | ||
23477 | * EQUALS | ||
23478 | */ | ||
23479 | EQUALS: 187, // needs localization | ||
23480 | /** | ||
23481 | * COMMA | ||
23482 | */ | ||
23483 | COMMA: 188, // needs localization | ||
23484 | /** | ||
23485 | * PERIOD | ||
23486 | */ | ||
23487 | PERIOD: 190, // needs localization | ||
23488 | /** | ||
23489 | * SLASH | ||
23490 | */ | ||
23491 | SLASH: 191, // needs localization | ||
23492 | /** | ||
23493 | * APOSTROPHE | ||
23494 | */ | ||
23495 | APOSTROPHE: 192, // needs localization | ||
23496 | /** | ||
23497 | * SINGLE_QUOTE | ||
23498 | */ | ||
23499 | SINGLE_QUOTE: 222, // needs localization | ||
23500 | /** | ||
23501 | * OPEN_SQUARE_BRACKET | ||
23502 | */ | ||
23503 | OPEN_SQUARE_BRACKET: 219, // needs localization | ||
23504 | /** | ||
23505 | * BACKSLASH | ||
23506 | */ | ||
23507 | BACKSLASH: 220, // needs localization | ||
23508 | /** | ||
23509 | * CLOSE_SQUARE_BRACKET | ||
23510 | */ | ||
23511 | CLOSE_SQUARE_BRACKET: 221, // needs localization | ||
23512 | /** | ||
23513 | * WIN_KEY | ||
23514 | */ | ||
23515 | WIN_KEY: 224, | ||
23516 | /** | ||
23517 | * MAC_FF_META | ||
23518 | */ | ||
23519 | MAC_FF_META: 224, // Firefox (Gecko) fires this for the meta key instead of 91 | ||
23520 | /** | ||
23521 | * WIN_IME | ||
23522 | */ | ||
23523 | WIN_IME: 229 | ||
23524 | }; | ||
23525 | |||
23526 | /* | ||
23527 | whether text and modified key is entered at the same time. | ||
23528 | */ | ||
23529 | KeyCode.isTextModifyingKeyEvent = function isTextModifyingKeyEvent(e) { | ||
23530 | var keyCode = e.keyCode; | ||
23531 | if (e.altKey && !e.ctrlKey || e.metaKey || | ||
23532 | // Function keys don't generate text | ||
23533 | keyCode >= KeyCode.F1 && keyCode <= KeyCode.F12) { | ||
23534 | return false; | ||
23535 | } | ||
23536 | |||
23537 | // The following keys are quite harmless, even in combination with | ||
23538 | // CTRL, ALT or SHIFT. | ||
23539 | switch (keyCode) { | ||
23540 | case KeyCode.ALT: | ||
23541 | case KeyCode.CAPS_LOCK: | ||
23542 | case KeyCode.CONTEXT_MENU: | ||
23543 | case KeyCode.CTRL: | ||
23544 | case KeyCode.DOWN: | ||
23545 | case KeyCode.END: | ||
23546 | case KeyCode.ESC: | ||
23547 | case KeyCode.HOME: | ||
23548 | case KeyCode.INSERT: | ||
23549 | case KeyCode.LEFT: | ||
23550 | case KeyCode.MAC_FF_META: | ||
23551 | case KeyCode.META: | ||
23552 | case KeyCode.NUMLOCK: | ||
23553 | case KeyCode.NUM_CENTER: | ||
23554 | case KeyCode.PAGE_DOWN: | ||
23555 | case KeyCode.PAGE_UP: | ||
23556 | case KeyCode.PAUSE: | ||
23557 | case KeyCode.PRINT_SCREEN: | ||
23558 | case KeyCode.RIGHT: | ||
23559 | case KeyCode.SHIFT: | ||
23560 | case KeyCode.UP: | ||
23561 | case KeyCode.WIN_KEY: | ||
23562 | case KeyCode.WIN_KEY_RIGHT: | ||
23563 | return false; | ||
23564 | default: | ||
23565 | return true; | ||
23566 | } | ||
23567 | }; | ||
23568 | |||
23569 | /* | ||
23570 | whether character is entered. | ||
23571 | */ | ||
23572 | KeyCode.isCharacterKey = function isCharacterKey(keyCode) { | ||
23573 | if (keyCode >= KeyCode.ZERO && keyCode <= KeyCode.NINE) { | ||
23574 | return true; | ||
23575 | } | ||
23576 | |||
23577 | if (keyCode >= KeyCode.NUM_ZERO && keyCode <= KeyCode.NUM_MULTIPLY) { | ||
23578 | return true; | ||
23579 | } | ||
23580 | |||
23581 | if (keyCode >= KeyCode.A && keyCode <= KeyCode.Z) { | ||
23582 | return true; | ||
23583 | } | ||
23584 | |||
23585 | // Safari sends zero key code for non-latin characters. | ||
23586 | if (window.navigation.userAgent.indexOf('WebKit') !== -1 && keyCode === 0) { | ||
23587 | return true; | ||
23588 | } | ||
23589 | |||
23590 | switch (keyCode) { | ||
23591 | case KeyCode.SPACE: | ||
23592 | case KeyCode.QUESTION_MARK: | ||
23593 | case KeyCode.NUM_PLUS: | ||
23594 | case KeyCode.NUM_MINUS: | ||
23595 | case KeyCode.NUM_PERIOD: | ||
23596 | case KeyCode.NUM_DIVISION: | ||
23597 | case KeyCode.SEMICOLON: | ||
23598 | case KeyCode.DASH: | ||
23599 | case KeyCode.EQUALS: | ||
23600 | case KeyCode.COMMA: | ||
23601 | case KeyCode.PERIOD: | ||
23602 | case KeyCode.SLASH: | ||
23603 | case KeyCode.APOSTROPHE: | ||
23604 | case KeyCode.SINGLE_QUOTE: | ||
23605 | case KeyCode.OPEN_SQUARE_BRACKET: | ||
23606 | case KeyCode.BACKSLASH: | ||
23607 | case KeyCode.CLOSE_SQUARE_BRACKET: | ||
23608 | return true; | ||
23609 | default: | ||
23610 | return false; | ||
23611 | } | ||
23612 | }; | ||
23613 | |||
23614 | module.exports = KeyCode; | ||
23615 | |||
23616 | /***/ }, | ||
23617 | /* 181 */ | ||
23618 | /***/ function(module, exports, __webpack_require__) { | ||
23619 | |||
23620 | 'use strict'; | ||
23621 | |||
23622 | var shallowEqual = __webpack_require__(182); | ||
23623 | |||
23624 | /** | ||
23625 | * If your React component's render function is "pure", e.g. it will render the | ||
23626 | * same result given the same props and state, provide this Mixin for a | ||
23627 | * considerable performance boost. | ||
23628 | * | ||
23629 | * Most React components have pure render functions. | ||
23630 | * | ||
23631 | * Example: | ||
23632 | * | ||
23633 | * const ReactComponentWithPureRenderMixin = | ||
23634 | * require('ReactComponentWithPureRenderMixin'); | ||
23635 | * React.createClass({ | ||
23636 | * mixins: [ReactComponentWithPureRenderMixin], | ||
23637 | * | ||
23638 | * render: function() { | ||
23639 | * return <div className={this.props.className}>foo</div>; | ||
23640 | * } | ||
23641 | * }); | ||
23642 | * | ||
23643 | * Note: This only checks shallow equality for props and state. If these contain | ||
23644 | * complex data structures this mixin may have false-negatives for deeper | ||
23645 | * differences. Only mixin to components which have simple props and state, or | ||
23646 | * use `forceUpdate()` when you know deep data structures have changed. | ||
23647 | */ | ||
23648 | var ReactComponentWithPureRenderMixin = { | ||
23649 | shouldComponentUpdate: function shouldComponentUpdate(nextProps, nextState) { | ||
23650 | return !shallowEqual(this.props, nextProps) || !shallowEqual(this.state, nextState); | ||
23651 | } | ||
23652 | }; | ||
23653 | |||
23654 | module.exports = ReactComponentWithPureRenderMixin; | ||
23655 | |||
23656 | /***/ }, | ||
23657 | /* 182 */ | ||
23658 | /***/ function(module, exports, __webpack_require__) { | ||
23659 | |||
23660 | 'use strict'; | ||
23661 | |||
23662 | var shallowEqual = __webpack_require__(183); | ||
23663 | |||
23664 | module.exports = shallowEqual; | ||
23665 | |||
23666 | /***/ }, | ||
23667 | /* 183 */ | ||
23668 | /***/ function(module, exports, __webpack_require__) { | ||
23669 | |||
23670 | 'use strict'; | ||
23671 | |||
23672 | var fetchKeys = __webpack_require__(184); | ||
23673 | |||
23674 | module.exports = function shallowEqual(objA, objB, compare, compareContext) { | ||
23675 | |||
23676 | var ret = compare ? compare.call(compareContext, objA, objB) : void 0; | ||
23677 | |||
23678 | if (ret !== void 0) { | ||
23679 | return !!ret; | ||
23680 | } | ||
23681 | |||
23682 | if (objA === objB) { | ||
23683 | return true; | ||
23684 | } | ||
23685 | |||
23686 | if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) { | ||
23687 | return false; | ||
23688 | } | ||
23689 | |||
23690 | var keysA = fetchKeys(objA); | ||
23691 | var keysB = fetchKeys(objB); | ||
23692 | |||
23693 | var len = keysA.length; | ||
23694 | if (len !== keysB.length) { | ||
23695 | return false; | ||
23696 | } | ||
23697 | |||
23698 | compareContext = compareContext || null; | ||
23699 | |||
23700 | // Test for A's keys different from B. | ||
23701 | var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB); | ||
23702 | for (var i = 0; i < len; i++) { | ||
23703 | var key = keysA[i]; | ||
23704 | if (!bHasOwnProperty(key)) { | ||
23705 | return false; | ||
23706 | } | ||
23707 | var valueA = objA[key]; | ||
23708 | var valueB = objB[key]; | ||
23709 | |||
23710 | var _ret = compare ? compare.call(compareContext, valueA, valueB, key) : void 0; | ||
23711 | if (_ret === false || _ret === void 0 && valueA !== valueB) { | ||
23712 | return false; | ||
23713 | } | ||
23714 | } | ||
23715 | |||
23716 | return true; | ||
23717 | }; | ||
23718 | |||
23719 | /***/ }, | ||
23720 | /* 184 */ | ||
23721 | /***/ function(module, exports, __webpack_require__) { | ||
23722 | |||
23723 | /** | ||
23724 | * lodash 3.1.2 (Custom Build) <https://lodash.com/> | ||
23725 | * Build: `lodash modern modularize exports="npm" -o ./` | ||
23726 | * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> | ||
23727 | * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> | ||
23728 | * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | ||
23729 | * Available under MIT license <https://lodash.com/license> | ||
23730 | */ | ||
23731 | var getNative = __webpack_require__(185), | ||
23732 | isArguments = __webpack_require__(186), | ||
23733 | isArray = __webpack_require__(187); | ||
23734 | |||
23735 | /** Used to detect unsigned integer values. */ | ||
23736 | var reIsUint = /^\d+$/; | ||
23737 | |||
23738 | /** Used for native method references. */ | ||
23739 | var objectProto = Object.prototype; | ||
23740 | |||
23741 | /** Used to check objects for own properties. */ | ||
23742 | var hasOwnProperty = objectProto.hasOwnProperty; | ||
23743 | |||
23744 | /* Native method references for those with the same name as other `lodash` methods. */ | ||
23745 | var nativeKeys = getNative(Object, 'keys'); | ||
23746 | |||
23747 | /** | ||
23748 | * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) | ||
23749 | * of an array-like value. | ||
23750 | */ | ||
23751 | var MAX_SAFE_INTEGER = 9007199254740991; | ||
23752 | |||
23753 | /** | ||
23754 | * The base implementation of `_.property` without support for deep paths. | ||
23755 | * | ||
23756 | * @private | ||
23757 | * @param {string} key The key of the property to get. | ||
23758 | * @returns {Function} Returns the new function. | ||
23759 | */ | ||
23760 | function baseProperty(key) { | ||
23761 | return function(object) { | ||
23762 | return object == null ? undefined : object[key]; | ||
23763 | }; | ||
23764 | } | ||
23765 | |||
23766 | /** | ||
23767 | * Gets the "length" property value of `object`. | ||
23768 | * | ||
23769 | * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) | ||
23770 | * that affects Safari on at least iOS 8.1-8.3 ARM64. | ||
23771 | * | ||
23772 | * @private | ||
23773 | * @param {Object} object The object to query. | ||
23774 | * @returns {*} Returns the "length" value. | ||
23775 | */ | ||
23776 | var getLength = baseProperty('length'); | ||
23777 | |||
23778 | /** | ||
23779 | * Checks if `value` is array-like. | ||
23780 | * | ||
23781 | * @private | ||
23782 | * @param {*} value The value to check. | ||
23783 | * @returns {boolean} Returns `true` if `value` is array-like, else `false`. | ||
23784 | */ | ||
23785 | function isArrayLike(value) { | ||
23786 | return value != null && isLength(getLength(value)); | ||
23787 | } | ||
23788 | |||
23789 | /** | ||
23790 | * Checks if `value` is a valid array-like index. | ||
23791 | * | ||
23792 | * @private | ||
23793 | * @param {*} value The value to check. | ||
23794 | * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. | ||
23795 | * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. | ||
23796 | */ | ||
23797 | function isIndex(value, length) { | ||
23798 | value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1; | ||
23799 | length = length == null ? MAX_SAFE_INTEGER : length; | ||
23800 | return value > -1 && value % 1 == 0 && value < length; | ||
23801 | } | ||
23802 | |||
23803 | /** | ||
23804 | * Checks if `value` is a valid array-like length. | ||
23805 | * | ||
23806 | * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). | ||
23807 | * | ||
23808 | * @private | ||
23809 | * @param {*} value The value to check. | ||
23810 | * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. | ||
23811 | */ | ||
23812 | function isLength(value) { | ||
23813 | return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; | ||
23814 | } | ||
23815 | |||
23816 | /** | ||
23817 | * A fallback implementation of `Object.keys` which creates an array of the | ||
23818 | * own enumerable property names of `object`. | ||
23819 | * | ||
23820 | * @private | ||
23821 | * @param {Object} object The object to query. | ||
23822 | * @returns {Array} Returns the array of property names. | ||
23823 | */ | ||
23824 | function shimKeys(object) { | ||
23825 | var props = keysIn(object), | ||
23826 | propsLength = props.length, | ||
23827 | length = propsLength && object.length; | ||
23828 | |||
23829 | var allowIndexes = !!length && isLength(length) && | ||
23830 | (isArray(object) || isArguments(object)); | ||
23831 | |||
23832 | var index = -1, | ||
23833 | result = []; | ||
23834 | |||
23835 | while (++index < propsLength) { | ||
23836 | var key = props[index]; | ||
23837 | if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) { | ||
23838 | result.push(key); | ||
23839 | } | ||
23840 | } | ||
23841 | return result; | ||
23842 | } | ||
23843 | |||
23844 | /** | ||
23845 | * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. | ||
23846 | * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) | ||
23847 | * | ||
23848 | * @static | ||
23849 | * @memberOf _ | ||
23850 | * @category Lang | ||
23851 | * @param {*} value The value to check. | ||
23852 | * @returns {boolean} Returns `true` if `value` is an object, else `false`. | ||
23853 | * @example | ||
23854 | * | ||
23855 | * _.isObject({}); | ||
23856 | * // => true | ||
23857 | * | ||
23858 | * _.isObject([1, 2, 3]); | ||
23859 | * // => true | ||
23860 | * | ||
23861 | * _.isObject(1); | ||
23862 | * // => false | ||
23863 | */ | ||
23864 | function isObject(value) { | ||
23865 | // Avoid a V8 JIT bug in Chrome 19-20. | ||
23866 | // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. | ||
23867 | var type = typeof value; | ||
23868 | return !!value && (type == 'object' || type == 'function'); | ||
23869 | } | ||
23870 | |||
23871 | /** | ||
23872 | * Creates an array of the own enumerable property names of `object`. | ||
23873 | * | ||
23874 | * **Note:** Non-object values are coerced to objects. See the | ||
23875 | * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys) | ||
23876 | * for more details. | ||
23877 | * | ||
23878 | * @static | ||
23879 | * @memberOf _ | ||
23880 | * @category Object | ||
23881 | * @param {Object} object The object to query. | ||
23882 | * @returns {Array} Returns the array of property names. | ||
23883 | * @example | ||
23884 | * | ||
23885 | * function Foo() { | ||
23886 | * this.a = 1; | ||
23887 | * this.b = 2; | ||
23888 | * } | ||
23889 | * | ||
23890 | * Foo.prototype.c = 3; | ||
23891 | * | ||
23892 | * _.keys(new Foo); | ||
23893 | * // => ['a', 'b'] (iteration order is not guaranteed) | ||
23894 | * | ||
23895 | * _.keys('hi'); | ||
23896 | * // => ['0', '1'] | ||
23897 | */ | ||
23898 | var keys = !nativeKeys ? shimKeys : function(object) { | ||
23899 | var Ctor = object == null ? undefined : object.constructor; | ||
23900 | if ((typeof Ctor == 'function' && Ctor.prototype === object) || | ||
23901 | (typeof object != 'function' && isArrayLike(object))) { | ||
23902 | return shimKeys(object); | ||
23903 | } | ||
23904 | return isObject(object) ? nativeKeys(object) : []; | ||
23905 | }; | ||
23906 | |||
23907 | /** | ||
23908 | * Creates an array of the own and inherited enumerable property names of `object`. | ||
23909 | * | ||
23910 | * **Note:** Non-object values are coerced to objects. | ||
23911 | * | ||
23912 | * @static | ||
23913 | * @memberOf _ | ||
23914 | * @category Object | ||
23915 | * @param {Object} object The object to query. | ||
23916 | * @returns {Array} Returns the array of property names. | ||
23917 | * @example | ||
23918 | * | ||
23919 | * function Foo() { | ||
23920 | * this.a = 1; | ||
23921 | * this.b = 2; | ||
23922 | * } | ||
23923 | * | ||
23924 | * Foo.prototype.c = 3; | ||
23925 | * | ||
23926 | * _.keysIn(new Foo); | ||
23927 | * // => ['a', 'b', 'c'] (iteration order is not guaranteed) | ||
23928 | */ | ||
23929 | function keysIn(object) { | ||
23930 | if (object == null) { | ||
23931 | return []; | ||
23932 | } | ||
23933 | if (!isObject(object)) { | ||
23934 | object = Object(object); | ||
23935 | } | ||
23936 | var length = object.length; | ||
23937 | length = (length && isLength(length) && | ||
23938 | (isArray(object) || isArguments(object)) && length) || 0; | ||
23939 | |||
23940 | var Ctor = object.constructor, | ||
23941 | index = -1, | ||
23942 | isProto = typeof Ctor == 'function' && Ctor.prototype === object, | ||
23943 | result = Array(length), | ||
23944 | skipIndexes = length > 0; | ||
23945 | |||
23946 | while (++index < length) { | ||
23947 | result[index] = (index + ''); | ||
23948 | } | ||
23949 | for (var key in object) { | ||
23950 | if (!(skipIndexes && isIndex(key, length)) && | ||
23951 | !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { | ||
23952 | result.push(key); | ||
23953 | } | ||
23954 | } | ||
23955 | return result; | ||
23956 | } | ||
23957 | |||
23958 | module.exports = keys; | ||
23959 | |||
23960 | |||
23961 | /***/ }, | ||
23962 | /* 185 */ | ||
23963 | /***/ function(module, exports) { | ||
23964 | |||
23965 | /** | ||
23966 | * lodash 3.9.1 (Custom Build) <https://lodash.com/> | ||
23967 | * Build: `lodash modern modularize exports="npm" -o ./` | ||
23968 | * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> | ||
23969 | * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> | ||
23970 | * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | ||
23971 | * Available under MIT license <https://lodash.com/license> | ||
23972 | */ | ||
23973 | |||
23974 | /** `Object#toString` result references. */ | ||
23975 | var funcTag = '[object Function]'; | ||
23976 | |||
23977 | /** Used to detect host constructors (Safari > 5). */ | ||
23978 | var reIsHostCtor = /^\[object .+?Constructor\]$/; | ||
23979 | |||
23980 | /** | ||
23981 | * Checks if `value` is object-like. | ||
23982 | * | ||
23983 | * @private | ||
23984 | * @param {*} value The value to check. | ||
23985 | * @returns {boolean} Returns `true` if `value` is object-like, else `false`. | ||
23986 | */ | ||
23987 | function isObjectLike(value) { | ||
23988 | return !!value && typeof value == 'object'; | ||
23989 | } | ||
23990 | |||
23991 | /** Used for native method references. */ | ||
23992 | var objectProto = Object.prototype; | ||
23993 | |||
23994 | /** Used to resolve the decompiled source of functions. */ | ||
23995 | var fnToString = Function.prototype.toString; | ||
23996 | |||
23997 | /** Used to check objects for own properties. */ | ||
23998 | var hasOwnProperty = objectProto.hasOwnProperty; | ||
23999 | |||
24000 | /** | ||
24001 | * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) | ||
24002 | * of values. | ||
24003 | */ | ||
24004 | var objToString = objectProto.toString; | ||
24005 | |||
24006 | /** Used to detect if a method is native. */ | ||
24007 | var reIsNative = RegExp('^' + | ||
24008 | fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') | ||
24009 | .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' | ||
24010 | ); | ||
24011 | |||
24012 | /** | ||
24013 | * Gets the native function at `key` of `object`. | ||
24014 | * | ||
24015 | * @private | ||
24016 | * @param {Object} object The object to query. | ||
24017 | * @param {string} key The key of the method to get. | ||
24018 | * @returns {*} Returns the function if it's native, else `undefined`. | ||
24019 | */ | ||
24020 | function getNative(object, key) { | ||
24021 | var value = object == null ? undefined : object[key]; | ||
24022 | return isNative(value) ? value : undefined; | ||
24023 | } | ||
24024 | |||
24025 | /** | ||
24026 | * Checks if `value` is classified as a `Function` object. | ||
24027 | * | ||
24028 | * @static | ||
24029 | * @memberOf _ | ||
24030 | * @category Lang | ||
24031 | * @param {*} value The value to check. | ||
24032 | * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. | ||
24033 | * @example | ||
24034 | * | ||
24035 | * _.isFunction(_); | ||
24036 | * // => true | ||
24037 | * | ||
24038 | * _.isFunction(/abc/); | ||
24039 | * // => false | ||
24040 | */ | ||
24041 | function isFunction(value) { | ||
24042 | // The use of `Object#toString` avoids issues with the `typeof` operator | ||
24043 | // in older versions of Chrome and Safari which return 'function' for regexes | ||
24044 | // and Safari 8 equivalents which return 'object' for typed array constructors. | ||
24045 | return isObject(value) && objToString.call(value) == funcTag; | ||
24046 | } | ||
24047 | |||
24048 | /** | ||
24049 | * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. | ||
24050 | * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) | ||
24051 | * | ||
24052 | * @static | ||
24053 | * @memberOf _ | ||
24054 | * @category Lang | ||
24055 | * @param {*} value The value to check. | ||
24056 | * @returns {boolean} Returns `true` if `value` is an object, else `false`. | ||
24057 | * @example | ||
24058 | * | ||
24059 | * _.isObject({}); | ||
24060 | * // => true | ||
24061 | * | ||
24062 | * _.isObject([1, 2, 3]); | ||
24063 | * // => true | ||
24064 | * | ||
24065 | * _.isObject(1); | ||
24066 | * // => false | ||
24067 | */ | ||
24068 | function isObject(value) { | ||
24069 | // Avoid a V8 JIT bug in Chrome 19-20. | ||
24070 | // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. | ||
24071 | var type = typeof value; | ||
24072 | return !!value && (type == 'object' || type == 'function'); | ||
24073 | } | ||
24074 | |||
24075 | /** | ||
24076 | * Checks if `value` is a native function. | ||
24077 | * | ||
24078 | * @static | ||
24079 | * @memberOf _ | ||
24080 | * @category Lang | ||
24081 | * @param {*} value The value to check. | ||
24082 | * @returns {boolean} Returns `true` if `value` is a native function, else `false`. | ||
24083 | * @example | ||
24084 | * | ||
24085 | * _.isNative(Array.prototype.push); | ||
24086 | * // => true | ||
24087 | * | ||
24088 | * _.isNative(_); | ||
24089 | * // => false | ||
24090 | */ | ||
24091 | function isNative(value) { | ||
24092 | if (value == null) { | ||
24093 | return false; | ||
24094 | } | ||
24095 | if (isFunction(value)) { | ||
24096 | return reIsNative.test(fnToString.call(value)); | ||
24097 | } | ||
24098 | return isObjectLike(value) && reIsHostCtor.test(value); | ||
24099 | } | ||
24100 | |||
24101 | module.exports = getNative; | ||
24102 | |||
24103 | |||
24104 | /***/ }, | ||
24105 | /* 186 */ | ||
24106 | /***/ function(module, exports) { | ||
24107 | |||
24108 | /** | ||
24109 | * lodash 3.0.4 (Custom Build) <https://lodash.com/> | ||
24110 | * Build: `lodash modern modularize exports="npm" -o ./` | ||
24111 | * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> | ||
24112 | * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> | ||
24113 | * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | ||
24114 | * Available under MIT license <https://lodash.com/license> | ||
24115 | */ | ||
24116 | |||
24117 | /** | ||
24118 | * Checks if `value` is object-like. | ||
24119 | * | ||
24120 | * @private | ||
24121 | * @param {*} value The value to check. | ||
24122 | * @returns {boolean} Returns `true` if `value` is object-like, else `false`. | ||
24123 | */ | ||
24124 | function isObjectLike(value) { | ||
24125 | return !!value && typeof value == 'object'; | ||
24126 | } | ||
24127 | |||
24128 | /** Used for native method references. */ | ||
24129 | var objectProto = Object.prototype; | ||
24130 | |||
24131 | /** Used to check objects for own properties. */ | ||
24132 | var hasOwnProperty = objectProto.hasOwnProperty; | ||
24133 | |||
24134 | /** Native method references. */ | ||
24135 | var propertyIsEnumerable = objectProto.propertyIsEnumerable; | ||
24136 | |||
24137 | /** | ||
24138 | * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) | ||
24139 | * of an array-like value. | ||
24140 | */ | ||
24141 | var MAX_SAFE_INTEGER = 9007199254740991; | ||
24142 | |||
24143 | /** | ||
24144 | * The base implementation of `_.property` without support for deep paths. | ||
24145 | * | ||
24146 | * @private | ||
24147 | * @param {string} key The key of the property to get. | ||
24148 | * @returns {Function} Returns the new function. | ||
24149 | */ | ||
24150 | function baseProperty(key) { | ||
24151 | return function(object) { | ||
24152 | return object == null ? undefined : object[key]; | ||
24153 | }; | ||
24154 | } | ||
24155 | |||
24156 | /** | ||
24157 | * Gets the "length" property value of `object`. | ||
24158 | * | ||
24159 | * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) | ||
24160 | * that affects Safari on at least iOS 8.1-8.3 ARM64. | ||
24161 | * | ||
24162 | * @private | ||
24163 | * @param {Object} object The object to query. | ||
24164 | * @returns {*} Returns the "length" value. | ||
24165 | */ | ||
24166 | var getLength = baseProperty('length'); | ||
24167 | |||
24168 | /** | ||
24169 | * Checks if `value` is array-like. | ||
24170 | * | ||
24171 | * @private | ||
24172 | * @param {*} value The value to check. | ||
24173 | * @returns {boolean} Returns `true` if `value` is array-like, else `false`. | ||
24174 | */ | ||
24175 | function isArrayLike(value) { | ||
24176 | return value != null && isLength(getLength(value)); | ||
24177 | } | ||
24178 | |||
24179 | /** | ||
24180 | * Checks if `value` is a valid array-like length. | ||
24181 | * | ||
24182 | * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). | ||
24183 | * | ||
24184 | * @private | ||
24185 | * @param {*} value The value to check. | ||
24186 | * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. | ||
24187 | */ | ||
24188 | function isLength(value) { | ||
24189 | return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; | ||
24190 | } | ||
24191 | |||
24192 | /** | ||
24193 | * Checks if `value` is classified as an `arguments` object. | ||
24194 | * | ||
24195 | * @static | ||
24196 | * @memberOf _ | ||
24197 | * @category Lang | ||
24198 | * @param {*} value The value to check. | ||
24199 | * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. | ||
24200 | * @example | ||
24201 | * | ||
24202 | * _.isArguments(function() { return arguments; }()); | ||
24203 | * // => true | ||
24204 | * | ||
24205 | * _.isArguments([1, 2, 3]); | ||
24206 | * // => false | ||
24207 | */ | ||
24208 | function isArguments(value) { | ||
24209 | return isObjectLike(value) && isArrayLike(value) && | ||
24210 | hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee'); | ||
24211 | } | ||
24212 | |||
24213 | module.exports = isArguments; | ||
24214 | |||
24215 | |||
24216 | /***/ }, | ||
24217 | /* 187 */ | ||
24218 | /***/ function(module, exports) { | ||
24219 | |||
24220 | /** | ||
24221 | * lodash 3.0.4 (Custom Build) <https://lodash.com/> | ||
24222 | * Build: `lodash modern modularize exports="npm" -o ./` | ||
24223 | * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> | ||
24224 | * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> | ||
24225 | * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | ||
24226 | * Available under MIT license <https://lodash.com/license> | ||
24227 | */ | ||
24228 | |||
24229 | /** `Object#toString` result references. */ | ||
24230 | var arrayTag = '[object Array]', | ||
24231 | funcTag = '[object Function]'; | ||
24232 | |||
24233 | /** Used to detect host constructors (Safari > 5). */ | ||
24234 | var reIsHostCtor = /^\[object .+?Constructor\]$/; | ||
24235 | |||
24236 | /** | ||
24237 | * Checks if `value` is object-like. | ||
24238 | * | ||
24239 | * @private | ||
24240 | * @param {*} value The value to check. | ||
24241 | * @returns {boolean} Returns `true` if `value` is object-like, else `false`. | ||
24242 | */ | ||
24243 | function isObjectLike(value) { | ||
24244 | return !!value && typeof value == 'object'; | ||
24245 | } | ||
24246 | |||
24247 | /** Used for native method references. */ | ||
24248 | var objectProto = Object.prototype; | ||
24249 | |||
24250 | /** Used to resolve the decompiled source of functions. */ | ||
24251 | var fnToString = Function.prototype.toString; | ||
24252 | |||
24253 | /** Used to check objects for own properties. */ | ||
24254 | var hasOwnProperty = objectProto.hasOwnProperty; | ||
24255 | |||
24256 | /** | ||
24257 | * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) | ||
24258 | * of values. | ||
24259 | */ | ||
24260 | var objToString = objectProto.toString; | ||
24261 | |||
24262 | /** Used to detect if a method is native. */ | ||
24263 | var reIsNative = RegExp('^' + | ||
24264 | fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') | ||
24265 | .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' | ||
24266 | ); | ||
24267 | |||
24268 | /* Native method references for those with the same name as other `lodash` methods. */ | ||
24269 | var nativeIsArray = getNative(Array, 'isArray'); | ||
24270 | |||
24271 | /** | ||
24272 | * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) | ||
24273 | * of an array-like value. | ||
24274 | */ | ||
24275 | var MAX_SAFE_INTEGER = 9007199254740991; | ||
24276 | |||
24277 | /** | ||
24278 | * Gets the native function at `key` of `object`. | ||
24279 | * | ||
24280 | * @private | ||
24281 | * @param {Object} object The object to query. | ||
24282 | * @param {string} key The key of the method to get. | ||
24283 | * @returns {*} Returns the function if it's native, else `undefined`. | ||
24284 | */ | ||
24285 | function getNative(object, key) { | ||
24286 | var value = object == null ? undefined : object[key]; | ||
24287 | return isNative(value) ? value : undefined; | ||
24288 | } | ||
24289 | |||
24290 | /** | ||
24291 | * Checks if `value` is a valid array-like length. | ||
24292 | * | ||
24293 | * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). | ||
24294 | * | ||
24295 | * @private | ||
24296 | * @param {*} value The value to check. | ||
24297 | * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. | ||
24298 | */ | ||
24299 | function isLength(value) { | ||
24300 | return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; | ||
24301 | } | ||
24302 | |||
24303 | /** | ||
24304 | * Checks if `value` is classified as an `Array` object. | ||
24305 | * | ||
24306 | * @static | ||
24307 | * @memberOf _ | ||
24308 | * @category Lang | ||
24309 | * @param {*} value The value to check. | ||
24310 | * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. | ||
24311 | * @example | ||
24312 | * | ||
24313 | * _.isArray([1, 2, 3]); | ||
24314 | * // => true | ||
24315 | * | ||
24316 | * _.isArray(function() { return arguments; }()); | ||
24317 | * // => false | ||
24318 | */ | ||
24319 | var isArray = nativeIsArray || function(value) { | ||
24320 | return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag; | ||
24321 | }; | ||
24322 | |||
24323 | /** | ||
24324 | * Checks if `value` is classified as a `Function` object. | ||
24325 | * | ||
24326 | * @static | ||
24327 | * @memberOf _ | ||
24328 | * @category Lang | ||
24329 | * @param {*} value The value to check. | ||
24330 | * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. | ||
24331 | * @example | ||
24332 | * | ||
24333 | * _.isFunction(_); | ||
24334 | * // => true | ||
24335 | * | ||
24336 | * _.isFunction(/abc/); | ||
24337 | * // => false | ||
24338 | */ | ||
24339 | function isFunction(value) { | ||
24340 | // The use of `Object#toString` avoids issues with the `typeof` operator | ||
24341 | // in older versions of Chrome and Safari which return 'function' for regexes | ||
24342 | // and Safari 8 equivalents which return 'object' for typed array constructors. | ||
24343 | return isObject(value) && objToString.call(value) == funcTag; | ||
24344 | } | ||
24345 | |||
24346 | /** | ||
24347 | * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. | ||
24348 | * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) | ||
24349 | * | ||
24350 | * @static | ||
24351 | * @memberOf _ | ||
24352 | * @category Lang | ||
24353 | * @param {*} value The value to check. | ||
24354 | * @returns {boolean} Returns `true` if `value` is an object, else `false`. | ||
24355 | * @example | ||
24356 | * | ||
24357 | * _.isObject({}); | ||
24358 | * // => true | ||
24359 | * | ||
24360 | * _.isObject([1, 2, 3]); | ||
24361 | * // => true | ||
24362 | * | ||
24363 | * _.isObject(1); | ||
24364 | * // => false | ||
24365 | */ | ||
24366 | function isObject(value) { | ||
24367 | // Avoid a V8 JIT bug in Chrome 19-20. | ||
24368 | // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. | ||
24369 | var type = typeof value; | ||
24370 | return !!value && (type == 'object' || type == 'function'); | ||
24371 | } | ||
24372 | |||
24373 | /** | ||
24374 | * Checks if `value` is a native function. | ||
24375 | * | ||
24376 | * @static | ||
24377 | * @memberOf _ | ||
24378 | * @category Lang | ||
24379 | * @param {*} value The value to check. | ||
24380 | * @returns {boolean} Returns `true` if `value` is a native function, else `false`. | ||
24381 | * @example | ||
24382 | * | ||
24383 | * _.isNative(Array.prototype.push); | ||
24384 | * // => true | ||
24385 | * | ||
24386 | * _.isNative(_); | ||
24387 | * // => false | ||
24388 | */ | ||
24389 | function isNative(value) { | ||
24390 | if (value == null) { | ||
24391 | return false; | ||
24392 | } | ||
24393 | if (isFunction(value)) { | ||
24394 | return reIsNative.test(fnToString.call(value)); | ||
24395 | } | ||
24396 | return isObjectLike(value) && reIsHostCtor.test(value); | ||
24397 | } | ||
24398 | |||
24399 | module.exports = isArray; | ||
24400 | |||
24401 | |||
24402 | /***/ }, | ||
24403 | /* 188 */ | ||
24404 | /***/ function(module, exports) { | ||
24405 | |||
24406 | /** | ||
24407 | * Safe chained function | ||
24408 | * | ||
24409 | * Will only create a new function if needed, | ||
24410 | * otherwise will pass back existing functions or null. | ||
24411 | * | ||
24412 | * @returns {function|null} | ||
24413 | */ | ||
24414 | "use strict"; | ||
24415 | |||
24416 | function createChainedFunction() { | ||
24417 | var args = arguments; | ||
24418 | return function chainedFunction() { | ||
24419 | for (var i = 0; i < args.length; i++) { | ||
24420 | if (args[i] && args[i].apply) { | ||
24421 | args[i].apply(this, arguments); | ||
24422 | } | ||
24423 | } | ||
24424 | }; | ||
24425 | } | ||
24426 | |||
24427 | module.exports = createChainedFunction; | ||
24428 | |||
24429 | /***/ }, | ||
24430 | /* 189 */ | ||
24431 | /***/ function(module, exports, __webpack_require__) { | ||
24432 | |||
24433 | 'use strict'; | ||
24434 | |||
24435 | Object.defineProperty(exports, '__esModule', { | ||
24436 | value: true | ||
24437 | }); | ||
24438 | exports['default'] = addEventListenerWrap; | ||
24439 | |||
24440 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
24441 | |||
24442 | var _addDomEventListener = __webpack_require__(190); | ||
24443 | |||
24444 | var _addDomEventListener2 = _interopRequireDefault(_addDomEventListener); | ||
24445 | |||
24446 | var _reactDom = __webpack_require__(160); | ||
24447 | |||
24448 | var _reactDom2 = _interopRequireDefault(_reactDom); | ||
24449 | |||
24450 | function addEventListenerWrap(target, eventType, cb) { | ||
24451 | /* eslint camelcase: 2 */ | ||
24452 | var callback = _reactDom2['default'].unstable_batchedUpdates ? function run(e) { | ||
24453 | _reactDom2['default'].unstable_batchedUpdates(cb, e); | ||
24454 | } : cb; | ||
24455 | return (0, _addDomEventListener2['default'])(target, eventType, callback); | ||
24456 | } | ||
24457 | |||
24458 | module.exports = exports['default']; | ||
24459 | |||
24460 | /***/ }, | ||
24461 | /* 190 */ | ||
24462 | /***/ function(module, exports, __webpack_require__) { | ||
24463 | |||
24464 | 'use strict'; | ||
24465 | |||
24466 | Object.defineProperty(exports, '__esModule', { | ||
24467 | value: true | ||
24468 | }); | ||
24469 | exports['default'] = addEventListener; | ||
24470 | |||
24471 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
24472 | |||
24473 | var _EventObject = __webpack_require__(191); | ||
24474 | |||
24475 | var _EventObject2 = _interopRequireDefault(_EventObject); | ||
24476 | |||
24477 | function addEventListener(target, eventType, callback) { | ||
24478 | function wrapCallback(e) { | ||
24479 | var ne = new _EventObject2['default'](e); | ||
24480 | callback.call(target, ne); | ||
24481 | } | ||
24482 | |||
24483 | if (target.addEventListener) { | ||
24484 | target.addEventListener(eventType, wrapCallback, false); | ||
24485 | return { | ||
24486 | remove: function remove() { | ||
24487 | target.removeEventListener(eventType, wrapCallback, false); | ||
24488 | } | ||
24489 | }; | ||
24490 | } else if (target.attachEvent) { | ||
24491 | target.attachEvent('on' + eventType, wrapCallback); | ||
24492 | return { | ||
24493 | remove: function remove() { | ||
24494 | target.detachEvent('on' + eventType, wrapCallback); | ||
24495 | } | ||
24496 | }; | ||
24497 | } | ||
24498 | } | ||
24499 | |||
24500 | module.exports = exports['default']; | ||
24501 | |||
24502 | /***/ }, | ||
24503 | /* 191 */ | ||
24504 | /***/ function(module, exports, __webpack_require__) { | ||
24505 | |||
24506 | /** | ||
24507 | * @ignore | ||
24508 | * event object for dom | ||
24509 | * @author yiminghe@gmail.com | ||
24510 | */ | ||
24511 | |||
24512 | 'use strict'; | ||
24513 | |||
24514 | Object.defineProperty(exports, '__esModule', { | ||
24515 | value: true | ||
24516 | }); | ||
24517 | |||
24518 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
24519 | |||
24520 | var _EventBaseObject = __webpack_require__(192); | ||
24521 | |||
24522 | var _EventBaseObject2 = _interopRequireDefault(_EventBaseObject); | ||
24523 | |||
24524 | var _objectAssign = __webpack_require__(193); | ||
24525 | |||
24526 | var _objectAssign2 = _interopRequireDefault(_objectAssign); | ||
24527 | |||
24528 | var TRUE = true; | ||
24529 | var FALSE = false; | ||
24530 | var commonProps = ['altKey', 'bubbles', 'cancelable', 'ctrlKey', 'currentTarget', 'eventPhase', 'metaKey', 'shiftKey', 'target', 'timeStamp', 'view', 'type']; | ||
24531 | |||
24532 | function isNullOrUndefined(w) { | ||
24533 | return w === null || w === undefined; | ||
24534 | } | ||
24535 | |||
24536 | var eventNormalizers = [{ | ||
24537 | reg: /^key/, | ||
24538 | props: ['char', 'charCode', 'key', 'keyCode', 'which'], | ||
24539 | fix: function fix(event, nativeEvent) { | ||
24540 | if (isNullOrUndefined(event.which)) { | ||
24541 | event.which = !isNullOrUndefined(nativeEvent.charCode) ? nativeEvent.charCode : nativeEvent.keyCode; | ||
24542 | } | ||
24543 | |||
24544 | // add metaKey to non-Mac browsers (use ctrl for PC 's and Meta for Macs) | ||
24545 | if (event.metaKey === undefined) { | ||
24546 | event.metaKey = event.ctrlKey; | ||
24547 | } | ||
24548 | } | ||
24549 | }, { | ||
24550 | reg: /^touch/, | ||
24551 | props: ['touches', 'changedTouches', 'targetTouches'] | ||
24552 | }, { | ||
24553 | reg: /^hashchange$/, | ||
24554 | props: ['newURL', 'oldURL'] | ||
24555 | }, { | ||
24556 | reg: /^gesturechange$/i, | ||
24557 | props: ['rotation', 'scale'] | ||
24558 | }, { | ||
24559 | reg: /^(mousewheel|DOMMouseScroll)$/, | ||
24560 | props: [], | ||
24561 | fix: function fix(event, nativeEvent) { | ||
24562 | var deltaX = undefined; | ||
24563 | var deltaY = undefined; | ||
24564 | var delta = undefined; | ||
24565 | var wheelDelta = nativeEvent.wheelDelta; | ||
24566 | var axis = nativeEvent.axis; | ||
24567 | var wheelDeltaY = nativeEvent.wheelDeltaY; | ||
24568 | var wheelDeltaX = nativeEvent.wheelDeltaX; | ||
24569 | var detail = nativeEvent.detail; | ||
24570 | |||
24571 | // ie/webkit | ||
24572 | if (wheelDelta) { | ||
24573 | delta = wheelDelta / 120; | ||
24574 | } | ||
24575 | |||
24576 | // gecko | ||
24577 | if (detail) { | ||
24578 | // press control e.detail == 1 else e.detail == 3 | ||
24579 | delta = 0 - (detail % 3 === 0 ? detail / 3 : detail); | ||
24580 | } | ||
24581 | |||
24582 | // Gecko | ||
24583 | if (axis !== undefined) { | ||
24584 | if (axis === event.HORIZONTAL_AXIS) { | ||
24585 | deltaY = 0; | ||
24586 | deltaX = 0 - delta; | ||
24587 | } else if (axis === event.VERTICAL_AXIS) { | ||
24588 | deltaX = 0; | ||
24589 | deltaY = delta; | ||
24590 | } | ||
24591 | } | ||
24592 | |||
24593 | // Webkit | ||
24594 | if (wheelDeltaY !== undefined) { | ||
24595 | deltaY = wheelDeltaY / 120; | ||
24596 | } | ||
24597 | if (wheelDeltaX !== undefined) { | ||
24598 | deltaX = -1 * wheelDeltaX / 120; | ||
24599 | } | ||
24600 | |||
24601 | // 默认 deltaY (ie) | ||
24602 | if (!deltaX && !deltaY) { | ||
24603 | deltaY = delta; | ||
24604 | } | ||
24605 | |||
24606 | if (deltaX !== undefined) { | ||
24607 | /** | ||
24608 | * deltaX of mousewheel event | ||
24609 | * @property deltaX | ||
24610 | * @member Event.DomEvent.Object | ||
24611 | */ | ||
24612 | event.deltaX = deltaX; | ||
24613 | } | ||
24614 | |||
24615 | if (deltaY !== undefined) { | ||
24616 | /** | ||
24617 | * deltaY of mousewheel event | ||
24618 | * @property deltaY | ||
24619 | * @member Event.DomEvent.Object | ||
24620 | */ | ||
24621 | event.deltaY = deltaY; | ||
24622 | } | ||
24623 | |||
24624 | if (delta !== undefined) { | ||
24625 | /** | ||
24626 | * delta of mousewheel event | ||
24627 | * @property delta | ||
24628 | * @member Event.DomEvent.Object | ||
24629 | */ | ||
24630 | event.delta = delta; | ||
24631 | } | ||
24632 | } | ||
24633 | }, { | ||
24634 | reg: /^mouse|contextmenu|click|mspointer|(^DOMMouseScroll$)/i, | ||
24635 | props: ['buttons', 'clientX', 'clientY', 'button', 'offsetX', 'relatedTarget', 'which', 'fromElement', 'toElement', 'offsetY', 'pageX', 'pageY', 'screenX', 'screenY'], | ||
24636 | fix: function fix(event, nativeEvent) { | ||
24637 | var eventDoc = undefined; | ||
24638 | var doc = undefined; | ||
24639 | var body = undefined; | ||
24640 | var target = event.target; | ||
24641 | var button = nativeEvent.button; | ||
24642 | |||
24643 | // Calculate pageX/Y if missing and clientX/Y available | ||
24644 | if (target && isNullOrUndefined(event.pageX) && !isNullOrUndefined(nativeEvent.clientX)) { | ||
24645 | eventDoc = target.ownerDocument || document; | ||
24646 | doc = eventDoc.documentElement; | ||
24647 | body = eventDoc.body; | ||
24648 | event.pageX = nativeEvent.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0); | ||
24649 | event.pageY = nativeEvent.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0); | ||
24650 | } | ||
24651 | |||
24652 | // which for click: 1 === left; 2 === middle; 3 === right | ||
24653 | // do not use button | ||
24654 | if (!event.which && button !== undefined) { | ||
24655 | if (button & 1) { | ||
24656 | event.which = 1; | ||
24657 | } else if (button & 2) { | ||
24658 | event.which = 3; | ||
24659 | } else if (button & 4) { | ||
24660 | event.which = 2; | ||
24661 | } else { | ||
24662 | event.which = 0; | ||
24663 | } | ||
24664 | } | ||
24665 | |||
24666 | // add relatedTarget, if necessary | ||
24667 | if (!event.relatedTarget && event.fromElement) { | ||
24668 | event.relatedTarget = event.fromElement === target ? event.toElement : event.fromElement; | ||
24669 | } | ||
24670 | |||
24671 | return event; | ||
24672 | } | ||
24673 | }]; | ||
24674 | |||
24675 | function retTrue() { | ||
24676 | return TRUE; | ||
24677 | } | ||
24678 | |||
24679 | function retFalse() { | ||
24680 | return FALSE; | ||
24681 | } | ||
24682 | |||
24683 | function DomEventObject(nativeEvent) { | ||
24684 | var type = nativeEvent.type; | ||
24685 | |||
24686 | var isNative = typeof nativeEvent.stopPropagation === 'function' || typeof nativeEvent.cancelBubble === 'boolean'; | ||
24687 | |||
24688 | _EventBaseObject2['default'].call(this); | ||
24689 | |||
24690 | this.nativeEvent = nativeEvent; | ||
24691 | |||
24692 | // in case dom event has been mark as default prevented by lower dom node | ||
24693 | var isDefaultPrevented = retFalse; | ||
24694 | if ('defaultPrevented' in nativeEvent) { | ||
24695 | isDefaultPrevented = nativeEvent.defaultPrevented ? retTrue : retFalse; | ||
24696 | } else if ('getPreventDefault' in nativeEvent) { | ||
24697 | // https://bugzilla.mozilla.org/show_bug.cgi?id=691151 | ||
24698 | isDefaultPrevented = nativeEvent.getPreventDefault() ? retTrue : retFalse; | ||
24699 | } else if ('returnValue' in nativeEvent) { | ||
24700 | isDefaultPrevented = nativeEvent.returnValue === FALSE ? retTrue : retFalse; | ||
24701 | } | ||
24702 | |||
24703 | this.isDefaultPrevented = isDefaultPrevented; | ||
24704 | |||
24705 | var fixFns = []; | ||
24706 | var fixFn = undefined; | ||
24707 | var l = undefined; | ||
24708 | var prop = undefined; | ||
24709 | var props = commonProps.concat(); | ||
24710 | |||
24711 | eventNormalizers.forEach(function (normalizer) { | ||
24712 | if (type.match(normalizer.reg)) { | ||
24713 | props = props.concat(normalizer.props); | ||
24714 | if (normalizer.fix) { | ||
24715 | fixFns.push(normalizer.fix); | ||
24716 | } | ||
24717 | } | ||
24718 | }); | ||
24719 | |||
24720 | l = props.length; | ||
24721 | |||
24722 | // clone properties of the original event object | ||
24723 | while (l) { | ||
24724 | prop = props[--l]; | ||
24725 | this[prop] = nativeEvent[prop]; | ||
24726 | } | ||
24727 | |||
24728 | // fix target property, if necessary | ||
24729 | if (!this.target && isNative) { | ||
24730 | this.target = nativeEvent.srcElement || document; // srcElement might not be defined either | ||
24731 | } | ||
24732 | |||
24733 | // check if target is a text node (safari) | ||
24734 | if (this.target && this.target.nodeType === 3) { | ||
24735 | this.target = this.target.parentNode; | ||
24736 | } | ||
24737 | |||
24738 | l = fixFns.length; | ||
24739 | |||
24740 | while (l) { | ||
24741 | fixFn = fixFns[--l]; | ||
24742 | fixFn(this, nativeEvent); | ||
24743 | } | ||
24744 | |||
24745 | this.timeStamp = nativeEvent.timeStamp || Date.now(); | ||
24746 | } | ||
24747 | |||
24748 | var EventBaseObjectProto = _EventBaseObject2['default'].prototype; | ||
24749 | |||
24750 | (0, _objectAssign2['default'])(DomEventObject.prototype, EventBaseObjectProto, { | ||
24751 | constructor: DomEventObject, | ||
24752 | |||
24753 | preventDefault: function preventDefault() { | ||
24754 | var e = this.nativeEvent; | ||
24755 | |||
24756 | // if preventDefault exists run it on the original event | ||
24757 | if (e.preventDefault) { | ||
24758 | e.preventDefault(); | ||
24759 | } else { | ||
24760 | // otherwise set the returnValue property of the original event to FALSE (IE) | ||
24761 | e.returnValue = FALSE; | ||
24762 | } | ||
24763 | |||
24764 | EventBaseObjectProto.preventDefault.call(this); | ||
24765 | }, | ||
24766 | |||
24767 | stopPropagation: function stopPropagation() { | ||
24768 | var e = this.nativeEvent; | ||
24769 | |||
24770 | // if stopPropagation exists run it on the original event | ||
24771 | if (e.stopPropagation) { | ||
24772 | e.stopPropagation(); | ||
24773 | } else { | ||
24774 | // otherwise set the cancelBubble property of the original event to TRUE (IE) | ||
24775 | e.cancelBubble = TRUE; | ||
24776 | } | ||
24777 | |||
24778 | EventBaseObjectProto.stopPropagation.call(this); | ||
24779 | } | ||
24780 | }); | ||
24781 | |||
24782 | exports['default'] = DomEventObject; | ||
24783 | module.exports = exports['default']; | ||
24784 | |||
24785 | /***/ }, | ||
24786 | /* 192 */ | ||
24787 | /***/ function(module, exports) { | ||
24788 | |||
24789 | /** | ||
24790 | * @ignore | ||
24791 | * base event object for custom and dom event. | ||
24792 | * @author yiminghe@gmail.com | ||
24793 | */ | ||
24794 | |||
24795 | "use strict"; | ||
24796 | |||
24797 | Object.defineProperty(exports, "__esModule", { | ||
24798 | value: true | ||
24799 | }); | ||
24800 | function returnFalse() { | ||
24801 | return false; | ||
24802 | } | ||
24803 | |||
24804 | function returnTrue() { | ||
24805 | return true; | ||
24806 | } | ||
24807 | |||
24808 | function EventBaseObject() { | ||
24809 | this.timeStamp = Date.now(); | ||
24810 | this.target = undefined; | ||
24811 | this.currentTarget = undefined; | ||
24812 | } | ||
24813 | |||
24814 | EventBaseObject.prototype = { | ||
24815 | isEventObject: 1, | ||
24816 | |||
24817 | constructor: EventBaseObject, | ||
24818 | |||
24819 | isDefaultPrevented: returnFalse, | ||
24820 | |||
24821 | isPropagationStopped: returnFalse, | ||
24822 | |||
24823 | isImmediatePropagationStopped: returnFalse, | ||
24824 | |||
24825 | preventDefault: function preventDefault() { | ||
24826 | this.isDefaultPrevented = returnTrue; | ||
24827 | }, | ||
24828 | |||
24829 | stopPropagation: function stopPropagation() { | ||
24830 | this.isPropagationStopped = returnTrue; | ||
24831 | }, | ||
24832 | |||
24833 | stopImmediatePropagation: function stopImmediatePropagation() { | ||
24834 | this.isImmediatePropagationStopped = returnTrue; | ||
24835 | // fixed 1.2 | ||
24836 | // call stopPropagation implicitly | ||
24837 | this.stopPropagation(); | ||
24838 | }, | ||
24839 | |||
24840 | halt: function halt(immediate) { | ||
24841 | if (immediate) { | ||
24842 | this.stopImmediatePropagation(); | ||
24843 | } else { | ||
24844 | this.stopPropagation(); | ||
24845 | } | ||
24846 | this.preventDefault(); | ||
24847 | } | ||
24848 | }; | ||
24849 | |||
24850 | exports["default"] = EventBaseObject; | ||
24851 | module.exports = exports["default"]; | ||
24852 | |||
24853 | /***/ }, | ||
24854 | /* 193 */ | ||
24855 | /***/ function(module, exports) { | ||
24856 | |||
24857 | /* eslint-disable no-unused-vars */ | ||
24858 | 'use strict'; | ||
24859 | var hasOwnProperty = Object.prototype.hasOwnProperty; | ||
24860 | var propIsEnumerable = Object.prototype.propertyIsEnumerable; | ||
24861 | |||
24862 | function toObject(val) { | ||
24863 | if (val === null || val === undefined) { | ||
24864 | throw new TypeError('Object.assign cannot be called with null or undefined'); | ||
24865 | } | ||
24866 | |||
24867 | return Object(val); | ||
24868 | } | ||
24869 | |||
24870 | module.exports = Object.assign || function (target, source) { | ||
24871 | var from; | ||
24872 | var to = toObject(target); | ||
24873 | var symbols; | ||
24874 | |||
24875 | for (var s = 1; s < arguments.length; s++) { | ||
24876 | from = Object(arguments[s]); | ||
24877 | |||
24878 | for (var key in from) { | ||
24879 | if (hasOwnProperty.call(from, key)) { | ||
24880 | to[key] = from[key]; | ||
24881 | } | ||
24882 | } | ||
24883 | |||
24884 | if (Object.getOwnPropertySymbols) { | ||
24885 | symbols = Object.getOwnPropertySymbols(from); | ||
24886 | for (var i = 0; i < symbols.length; i++) { | ||
24887 | if (propIsEnumerable.call(from, symbols[i])) { | ||
24888 | to[symbols[i]] = from[symbols[i]]; | ||
24889 | } | ||
24890 | } | ||
24891 | } | ||
24892 | } | ||
24893 | |||
24894 | return to; | ||
24895 | }; | ||
24896 | |||
24897 | |||
24898 | /***/ }, | ||
24899 | /* 194 */ | ||
24900 | /***/ function(module, exports) { | ||
24901 | |||
24902 | "use strict"; | ||
24903 | |||
24904 | module.exports = function contains(root, n) { | ||
24905 | var node = n; | ||
24906 | while (node) { | ||
24907 | if (node === root) { | ||
24908 | return true; | ||
24909 | } | ||
24910 | node = node.parentNode; | ||
24911 | } | ||
24912 | |||
24913 | return false; | ||
24914 | }; | ||
24915 | |||
24916 | /***/ }, | ||
24917 | /* 195 */ | ||
24918 | /***/ function(module, exports, __webpack_require__) { | ||
24919 | |||
24920 | 'use strict'; | ||
24921 | |||
24922 | var React = __webpack_require__(3); | ||
24923 | |||
24924 | module.exports = function toArray(children) { | ||
24925 | var ret = []; | ||
24926 | React.Children.forEach(children, function each(c) { | ||
24927 | ret.push(c); | ||
24928 | }); | ||
24929 | return ret; | ||
24930 | }; | ||
24931 | |||
24932 | /***/ }, | ||
24933 | /* 196 */ | ||
24934 | /***/ function(module, exports, __webpack_require__) { | ||
24935 | |||
24936 | 'use strict'; | ||
24937 | |||
24938 | var React = __webpack_require__(3); | ||
24939 | |||
24940 | function mirror(o) { | ||
24941 | return o; | ||
24942 | } | ||
24943 | |||
24944 | module.exports = function mapSelf(children) { | ||
24945 | // return ReactFragment | ||
24946 | return React.Children.map(children, mirror); | ||
24947 | }; | ||
24948 | |||
24949 | /***/ }, | ||
24950 | /* 197 */ | ||
24951 | /***/ function(module, exports, __webpack_require__) { | ||
24952 | |||
24953 | 'use strict'; | ||
24954 | |||
24955 | Object.defineProperty(exports, '__esModule', { | ||
24956 | value: true | ||
24957 | }); | ||
24958 | |||
24959 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
24960 | |||
24961 | var _react = __webpack_require__(3); | ||
24962 | |||
24963 | var _react2 = _interopRequireDefault(_react); | ||
24964 | |||
24965 | var _reactDom = __webpack_require__(160); | ||
24966 | |||
24967 | var _reactDom2 = _interopRequireDefault(_reactDom); | ||
24968 | |||
24969 | var _rcAlign = __webpack_require__(198); | ||
24970 | |||
24971 | var _rcAlign2 = _interopRequireDefault(_rcAlign); | ||
24972 | |||
24973 | var _rcAnimate = __webpack_require__(209); | ||
24974 | |||
24975 | var _rcAnimate2 = _interopRequireDefault(_rcAnimate); | ||
24976 | |||
24977 | var _PopupInner = __webpack_require__(217); | ||
24978 | |||
24979 | var _PopupInner2 = _interopRequireDefault(_PopupInner); | ||
24980 | |||
24981 | var Popup = _react2['default'].createClass({ | ||
24982 | displayName: 'Popup', | ||
24983 | |||
24984 | propTypes: { | ||
24985 | visible: _react.PropTypes.bool, | ||
24986 | wrap: _react.PropTypes.object, | ||
24987 | style: _react.PropTypes.object, | ||
24988 | getClassNameFromAlign: _react.PropTypes.func, | ||
24989 | onMouseEnter: _react.PropTypes.func, | ||
24990 | className: _react.PropTypes.string, | ||
24991 | onMouseLeave: _react.PropTypes.func | ||
24992 | }, | ||
24993 | |||
24994 | componentDidMount: function componentDidMount() { | ||
24995 | this.rootNode = this.getPopupDomNode(); | ||
24996 | }, | ||
24997 | |||
24998 | onAlign: function onAlign(popupDomNode, align) { | ||
24999 | var props = this.props; | ||
25000 | var alignClassName = props.getClassNameFromAlign(props.align); | ||
25001 | var currentAlignClassName = props.getClassNameFromAlign(align); | ||
25002 | if (alignClassName !== currentAlignClassName) { | ||
25003 | this.currentAlignClassName = currentAlignClassName; | ||
25004 | popupDomNode.className = this.getClassName(currentAlignClassName); | ||
25005 | } | ||
25006 | }, | ||
25007 | |||
25008 | getPopupDomNode: function getPopupDomNode() { | ||
25009 | return _reactDom2['default'].findDOMNode(this); | ||
25010 | }, | ||
25011 | |||
25012 | getTarget: function getTarget() { | ||
25013 | return _reactDom2['default'].findDOMNode(this.props.wrap); | ||
25014 | }, | ||
25015 | |||
25016 | getTransitionName: function getTransitionName() { | ||
25017 | var props = this.props; | ||
25018 | var transitionName = props.transitionName; | ||
25019 | if (!transitionName && props.animation) { | ||
25020 | transitionName = props.prefixCls + '-' + props.animation; | ||
25021 | } | ||
25022 | return transitionName; | ||
25023 | }, | ||
25024 | |||
25025 | getClassName: function getClassName(currentAlignClassName) { | ||
25026 | var props = this.props; | ||
25027 | var prefixCls = props.prefixCls; | ||
25028 | |||
25029 | var className = prefixCls + ' ' + props.className + ' '; | ||
25030 | className += currentAlignClassName; | ||
25031 | return className; | ||
25032 | }, | ||
25033 | |||
25034 | render: function render() { | ||
25035 | var props = this.props; | ||
25036 | var align = props.align; | ||
25037 | var style = props.style; | ||
25038 | var visible = props.visible; | ||
25039 | var prefixCls = props.prefixCls; | ||
25040 | var destroyPopupOnHide = props.destroyPopupOnHide; | ||
25041 | |||
25042 | var className = this.getClassName(this.currentAlignClassName || props.getClassNameFromAlign(align)); | ||
25043 | var hiddenClassName = prefixCls + '-hidden'; | ||
25044 | if (!visible) { | ||
25045 | this.currentAlignClassName = null; | ||
25046 | } | ||
25047 | if (destroyPopupOnHide) { | ||
25048 | return _react2['default'].createElement( | ||
25049 | _rcAnimate2['default'], | ||
25050 | { component: '', | ||
25051 | exclusive: true, | ||
25052 | transitionAppear: true, | ||
25053 | transitionName: this.getTransitionName() }, | ||
25054 | visible ? _react2['default'].createElement( | ||
25055 | _rcAlign2['default'], | ||
25056 | { target: this.getTarget, | ||
25057 | key: 'popup', | ||
25058 | monitorWindowResize: true, | ||
25059 | align: align, | ||
25060 | onAlign: this.onAlign }, | ||
25061 | _react2['default'].createElement( | ||
25062 | _PopupInner2['default'], | ||
25063 | { className: className, | ||
25064 | visible: true, | ||
25065 | onMouseEnter: props.onMouseEnter, | ||
25066 | onMouseLeave: props.onMouseLeave, | ||
25067 | style: style }, | ||
25068 | props.children | ||
25069 | ) | ||
25070 | ) : null | ||
25071 | ); | ||
25072 | } | ||
25073 | return _react2['default'].createElement( | ||
25074 | _rcAnimate2['default'], | ||
25075 | { component: '', | ||
25076 | exclusive: true, | ||
25077 | transitionAppear: true, | ||
25078 | transitionName: this.getTransitionName(), | ||
25079 | showProp: 'xVisible' }, | ||
25080 | _react2['default'].createElement( | ||
25081 | _rcAlign2['default'], | ||
25082 | { target: this.getTarget, | ||
25083 | key: 'popup', | ||
25084 | monitorWindowResize: true, | ||
25085 | xVisible: visible, | ||
25086 | childrenProps: { | ||
25087 | visible: 'xVisible' | ||
25088 | }, | ||
25089 | disabled: !visible, | ||
25090 | align: align, | ||
25091 | onAlign: this.onAlign }, | ||
25092 | _react2['default'].createElement( | ||
25093 | _PopupInner2['default'], | ||
25094 | { className: className, | ||
25095 | hiddenClassName: hiddenClassName, | ||
25096 | onMouseEnter: props.onMouseEnter, | ||
25097 | onMouseLeave: props.onMouseLeave, | ||
25098 | style: style }, | ||
25099 | props.children | ||
25100 | ) | ||
25101 | ) | ||
25102 | ); | ||
25103 | } | ||
25104 | }); | ||
25105 | |||
25106 | exports['default'] = Popup; | ||
25107 | module.exports = exports['default']; | ||
25108 | |||
25109 | /***/ }, | ||
25110 | /* 198 */ | ||
25111 | /***/ function(module, exports, __webpack_require__) { | ||
25112 | |||
25113 | // export this package's api | ||
25114 | 'use strict'; | ||
25115 | |||
25116 | Object.defineProperty(exports, '__esModule', { | ||
25117 | value: true | ||
25118 | }); | ||
25119 | |||
25120 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
25121 | |||
25122 | var _Align = __webpack_require__(199); | ||
25123 | |||
25124 | var _Align2 = _interopRequireDefault(_Align); | ||
25125 | |||
25126 | exports['default'] = _Align2['default']; | ||
25127 | module.exports = exports['default']; | ||
25128 | |||
25129 | /***/ }, | ||
25130 | /* 199 */ | ||
25131 | /***/ function(module, exports, __webpack_require__) { | ||
25132 | |||
25133 | 'use strict'; | ||
25134 | |||
25135 | Object.defineProperty(exports, '__esModule', { | ||
25136 | value: true | ||
25137 | }); | ||
25138 | |||
25139 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
25140 | |||
25141 | var _react = __webpack_require__(3); | ||
25142 | |||
25143 | var _react2 = _interopRequireDefault(_react); | ||
25144 | |||
25145 | var _reactDom = __webpack_require__(160); | ||
25146 | |||
25147 | var _reactDom2 = _interopRequireDefault(_reactDom); | ||
25148 | |||
25149 | var _domAlign = __webpack_require__(200); | ||
25150 | |||
25151 | var _domAlign2 = _interopRequireDefault(_domAlign); | ||
25152 | |||
25153 | var _rcUtil = __webpack_require__(174); | ||
25154 | |||
25155 | var _isWindow = __webpack_require__(208); | ||
25156 | |||
25157 | var _isWindow2 = _interopRequireDefault(_isWindow); | ||
25158 | |||
25159 | function buffer(fn, ms) { | ||
25160 | var timer = undefined; | ||
25161 | return function bufferFn() { | ||
25162 | if (timer) { | ||
25163 | clearTimeout(timer); | ||
25164 | } | ||
25165 | timer = setTimeout(fn, ms); | ||
25166 | }; | ||
25167 | } | ||
25168 | |||
25169 | var Align = _react2['default'].createClass({ | ||
25170 | displayName: 'Align', | ||
25171 | |||
25172 | propTypes: { | ||
25173 | childrenProps: _react.PropTypes.object, | ||
25174 | align: _react.PropTypes.object.isRequired, | ||
25175 | target: _react.PropTypes.func, | ||
25176 | onAlign: _react.PropTypes.func, | ||
25177 | monitorBufferTime: _react.PropTypes.number, | ||
25178 | monitorWindowResize: _react.PropTypes.bool, | ||
25179 | disabled: _react.PropTypes.bool, | ||
25180 | children: _react.PropTypes.any | ||
25181 | }, | ||
25182 | |||
25183 | getDefaultProps: function getDefaultProps() { | ||
25184 | return { | ||
25185 | target: function target() { | ||
25186 | return window; | ||
25187 | }, | ||
25188 | onAlign: function onAlign() {}, | ||
25189 | monitorBufferTime: 50, | ||
25190 | monitorWindowResize: false, | ||
25191 | disabled: false | ||
25192 | }; | ||
25193 | }, | ||
25194 | |||
25195 | componentDidMount: function componentDidMount() { | ||
25196 | var props = this.props; | ||
25197 | // if parent ref not attached .... use document.getElementById | ||
25198 | if (!props.disabled) { | ||
25199 | var source = _reactDom2['default'].findDOMNode(this); | ||
25200 | props.onAlign(source, (0, _domAlign2['default'])(source, props.target(), props.align)); | ||
25201 | if (props.monitorWindowResize) { | ||
25202 | this.startMonitorWindowResize(); | ||
25203 | } | ||
25204 | } | ||
25205 | }, | ||
25206 | |||
25207 | componentDidUpdate: function componentDidUpdate(prevProps) { | ||
25208 | var reAlign = false; | ||
25209 | var props = this.props; | ||
25210 | var currentTarget = undefined; | ||
25211 | |||
25212 | if (!props.disabled) { | ||
25213 | if (prevProps.disabled || prevProps.align !== props.align) { | ||
25214 | reAlign = true; | ||
25215 | currentTarget = props.target(); | ||
25216 | } else { | ||
25217 | var lastTarget = prevProps.target(); | ||
25218 | currentTarget = props.target(); | ||
25219 | if ((0, _isWindow2['default'])(lastTarget) && (0, _isWindow2['default'])(currentTarget)) { | ||
25220 | reAlign = false; | ||
25221 | } else if (lastTarget !== currentTarget) { | ||
25222 | reAlign = true; | ||
25223 | } | ||
25224 | } | ||
25225 | } | ||
25226 | |||
25227 | if (reAlign) { | ||
25228 | var source = _reactDom2['default'].findDOMNode(this); | ||
25229 | props.onAlign(source, (0, _domAlign2['default'])(source, currentTarget, props.align)); | ||
25230 | } | ||
25231 | |||
25232 | if (props.monitorWindowResize && !props.disabled) { | ||
25233 | this.startMonitorWindowResize(); | ||
25234 | } else { | ||
25235 | this.stopMonitorWindowResize(); | ||
25236 | } | ||
25237 | }, | ||
25238 | |||
25239 | componentWillUnmount: function componentWillUnmount() { | ||
25240 | this.stopMonitorWindowResize(); | ||
25241 | }, | ||
25242 | |||
25243 | onWindowResize: function onWindowResize() { | ||
25244 | var props = this.props; | ||
25245 | if (!props.disabled) { | ||
25246 | var source = _reactDom2['default'].findDOMNode(this); | ||
25247 | props.onAlign(source, (0, _domAlign2['default'])(source, props.target(), props.align)); | ||
25248 | } | ||
25249 | }, | ||
25250 | |||
25251 | startMonitorWindowResize: function startMonitorWindowResize() { | ||
25252 | if (!this.resizeHandler) { | ||
25253 | this.resizeHandler = _rcUtil.Dom.addEventListener(window, 'resize', buffer(this.onWindowResize, this.props.monitorBufferTime)); | ||
25254 | } | ||
25255 | }, | ||
25256 | |||
25257 | stopMonitorWindowResize: function stopMonitorWindowResize() { | ||
25258 | if (this.resizeHandler) { | ||
25259 | this.resizeHandler.remove(); | ||
25260 | this.resizeHandler = null; | ||
25261 | } | ||
25262 | }, | ||
25263 | |||
25264 | render: function render() { | ||
25265 | var _props = this.props; | ||
25266 | var childrenProps = _props.childrenProps; | ||
25267 | var children = _props.children; | ||
25268 | |||
25269 | var child = _react2['default'].Children.only(children); | ||
25270 | if (childrenProps) { | ||
25271 | var newProps = {}; | ||
25272 | for (var prop in childrenProps) { | ||
25273 | if (childrenProps.hasOwnProperty(prop)) { | ||
25274 | newProps[prop] = this.props[childrenProps[prop]]; | ||
25275 | } | ||
25276 | } | ||
25277 | return _react2['default'].cloneElement(child, newProps); | ||
25278 | } | ||
25279 | return child; | ||
25280 | } | ||
25281 | }); | ||
25282 | |||
25283 | exports['default'] = Align; | ||
25284 | module.exports = exports['default']; | ||
25285 | |||
25286 | /***/ }, | ||
25287 | /* 200 */ | ||
25288 | /***/ function(module, exports, __webpack_require__) { | ||
25289 | |||
25290 | /** | ||
25291 | * align dom node flexibly | ||
25292 | * @author yiminghe@gmail.com | ||
25293 | */ | ||
25294 | |||
25295 | 'use strict'; | ||
25296 | |||
25297 | Object.defineProperty(exports, '__esModule', { | ||
25298 | value: true | ||
25299 | }); | ||
25300 | |||
25301 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
25302 | |||
25303 | var _utils = __webpack_require__(201); | ||
25304 | |||
25305 | var _utils2 = _interopRequireDefault(_utils); | ||
25306 | |||
25307 | var _getOffsetParent = __webpack_require__(202); | ||
25308 | |||
25309 | var _getOffsetParent2 = _interopRequireDefault(_getOffsetParent); | ||
25310 | |||
25311 | var _getVisibleRectForElement = __webpack_require__(203); | ||
25312 | |||
25313 | var _getVisibleRectForElement2 = _interopRequireDefault(_getVisibleRectForElement); | ||
25314 | |||
25315 | var _adjustForViewport = __webpack_require__(204); | ||
25316 | |||
25317 | var _adjustForViewport2 = _interopRequireDefault(_adjustForViewport); | ||
25318 | |||
25319 | var _getRegion = __webpack_require__(205); | ||
25320 | |||
25321 | var _getRegion2 = _interopRequireDefault(_getRegion); | ||
25322 | |||
25323 | var _getElFuturePos = __webpack_require__(206); | ||
25324 | |||
25325 | var _getElFuturePos2 = _interopRequireDefault(_getElFuturePos); | ||
25326 | |||
25327 | // http://yiminghe.iteye.com/blog/1124720 | ||
25328 | |||
25329 | function isFailX(elFuturePos, elRegion, visibleRect) { | ||
25330 | return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right; | ||
25331 | } | ||
25332 | |||
25333 | function isFailY(elFuturePos, elRegion, visibleRect) { | ||
25334 | return elFuturePos.top < visibleRect.top || elFuturePos.top + elRegion.height > visibleRect.bottom; | ||
25335 | } | ||
25336 | |||
25337 | function flip(points, reg, map) { | ||
25338 | var ret = []; | ||
25339 | _utils2['default'].each(points, function (p) { | ||
25340 | ret.push(p.replace(reg, function (m) { | ||
25341 | return map[m]; | ||
25342 | })); | ||
25343 | }); | ||
25344 | return ret; | ||
25345 | } | ||
25346 | |||
25347 | function flipOffset(offset, index) { | ||
25348 | offset[index] = -offset[index]; | ||
25349 | return offset; | ||
25350 | } | ||
25351 | |||
25352 | function convertOffset(str, offsetLen) { | ||
25353 | var n = undefined; | ||
25354 | if (/%$/.test(str)) { | ||
25355 | n = parseInt(str.substring(0, str.length - 1), 10) / 100 * offsetLen; | ||
25356 | } else { | ||
25357 | n = parseInt(str, 10); | ||
25358 | } | ||
25359 | return n || 0; | ||
25360 | } | ||
25361 | |||
25362 | function normalizeOffset(offset, el) { | ||
25363 | offset[0] = convertOffset(offset[0], el.width); | ||
25364 | offset[1] = convertOffset(offset[1], el.height); | ||
25365 | } | ||
25366 | |||
25367 | function domAlign(el, refNode, align) { | ||
25368 | var points = align.points; | ||
25369 | var offset = align.offset || [0, 0]; | ||
25370 | var targetOffset = align.targetOffset || [0, 0]; | ||
25371 | var overflow = align.overflow; | ||
25372 | var target = align.target || refNode; | ||
25373 | var source = align.source || el; | ||
25374 | offset = [].concat(offset); | ||
25375 | targetOffset = [].concat(targetOffset); | ||
25376 | overflow = overflow || {}; | ||
25377 | var newOverflowCfg = {}; | ||
25378 | |||
25379 | var fail = 0; | ||
25380 | // 当前节点可以被放置的显示区域 | ||
25381 | var visibleRect = (0, _getVisibleRectForElement2['default'])(source); | ||
25382 | // 当前节点所占的区域, left/top/width/height | ||
25383 | var elRegion = (0, _getRegion2['default'])(source); | ||
25384 | // 参照节点所占的区域, left/top/width/height | ||
25385 | var refNodeRegion = (0, _getRegion2['default'])(target); | ||
25386 | // 将 offset 转换成数值,支持百分比 | ||
25387 | normalizeOffset(offset, elRegion); | ||
25388 | normalizeOffset(targetOffset, refNodeRegion); | ||
25389 | // 当前节点将要被放置的位置 | ||
25390 | var elFuturePos = (0, _getElFuturePos2['default'])(elRegion, refNodeRegion, points, offset, targetOffset); | ||
25391 | // 当前节点将要所处的区域 | ||
25392 | var newElRegion = _utils2['default'].merge(elRegion, elFuturePos); | ||
25393 | |||
25394 | // 如果可视区域不能完全放置当前节点时允许调整 | ||
25395 | if (visibleRect && (overflow.adjustX || overflow.adjustY)) { | ||
25396 | if (overflow.adjustX) { | ||
25397 | // 如果横向不能放下 | ||
25398 | if (isFailX(elFuturePos, elRegion, visibleRect)) { | ||
25399 | fail = 1; | ||
25400 | // 对齐位置反下 | ||
25401 | points = flip(points, /[lr]/ig, { | ||
25402 | l: 'r', | ||
25403 | r: 'l' | ||
25404 | }); | ||
25405 | // 偏移量也反下 | ||
25406 | offset = flipOffset(offset, 0); | ||
25407 | targetOffset = flipOffset(targetOffset, 0); | ||
25408 | } | ||
25409 | } | ||
25410 | |||
25411 | if (overflow.adjustY) { | ||
25412 | // 如果纵向不能放下 | ||
25413 | if (isFailY(elFuturePos, elRegion, visibleRect)) { | ||
25414 | fail = 1; | ||
25415 | // 对齐位置反下 | ||
25416 | points = flip(points, /[tb]/ig, { | ||
25417 | t: 'b', | ||
25418 | b: 't' | ||
25419 | }); | ||
25420 | // 偏移量也反下 | ||
25421 | offset = flipOffset(offset, 1); | ||
25422 | targetOffset = flipOffset(targetOffset, 1); | ||
25423 | } | ||
25424 | } | ||
25425 | |||
25426 | // 如果失败,重新计算当前节点将要被放置的位置 | ||
25427 | if (fail) { | ||
25428 | elFuturePos = (0, _getElFuturePos2['default'])(elRegion, refNodeRegion, points, offset, targetOffset); | ||
25429 | _utils2['default'].mix(newElRegion, elFuturePos); | ||
25430 | } | ||
25431 | |||
25432 | // 检查反下后的位置是否可以放下了 | ||
25433 | // 如果仍然放不下只有指定了可以调整当前方向才调整 | ||
25434 | newOverflowCfg.adjustX = overflow.adjustX && isFailX(elFuturePos, elRegion, visibleRect); | ||
25435 | |||
25436 | newOverflowCfg.adjustY = overflow.adjustY && isFailY(elFuturePos, elRegion, visibleRect); | ||
25437 | |||
25438 | // 确实要调整,甚至可能会调整高度宽度 | ||
25439 | if (newOverflowCfg.adjustX || newOverflowCfg.adjustY) { | ||
25440 | newElRegion = (0, _adjustForViewport2['default'])(elFuturePos, elRegion, visibleRect, newOverflowCfg); | ||
25441 | } | ||
25442 | } | ||
25443 | |||
25444 | // need judge to in case set fixed with in css on height auto element | ||
25445 | if (newElRegion.width !== elRegion.width) { | ||
25446 | _utils2['default'].css(source, 'width', source.width() + newElRegion.width - elRegion.width); | ||
25447 | } | ||
25448 | |||
25449 | if (newElRegion.height !== elRegion.height) { | ||
25450 | _utils2['default'].css(source, 'height', source.height() + newElRegion.height - elRegion.height); | ||
25451 | } | ||
25452 | |||
25453 | // https://github.com/kissyteam/kissy/issues/190 | ||
25454 | // http://localhost:8888/kissy/src/overlay/demo/other/relative_align/align.html | ||
25455 | // 相对于屏幕位置没变,而 left/top 变了 | ||
25456 | // 例如 <div 'relative'><el absolute></div> | ||
25457 | _utils2['default'].offset(source, { | ||
25458 | left: newElRegion.left, | ||
25459 | top: newElRegion.top | ||
25460 | }, { | ||
25461 | useCssRight: align.useCssRight, | ||
25462 | useCssBottom: align.useCssBottom | ||
25463 | }); | ||
25464 | |||
25465 | return { | ||
25466 | points: points, | ||
25467 | offset: offset, | ||
25468 | targetOffset: targetOffset, | ||
25469 | overflow: newOverflowCfg | ||
25470 | }; | ||
25471 | } | ||
25472 | |||
25473 | domAlign.__getOffsetParent = _getOffsetParent2['default']; | ||
25474 | |||
25475 | domAlign.__getVisibleRectForElement = _getVisibleRectForElement2['default']; | ||
25476 | |||
25477 | exports['default'] = domAlign; | ||
25478 | |||
25479 | /** | ||
25480 | * 2012-04-26 yiminghe@gmail.com | ||
25481 | * - 优化智能对齐算法 | ||
25482 | * - 慎用 resizeXX | ||
25483 | * | ||
25484 | * 2011-07-13 yiminghe@gmail.com note: | ||
25485 | * - 增加智能对齐,以及大小调整选项 | ||
25486 | **/ | ||
25487 | module.exports = exports['default']; | ||
25488 | |||
25489 | /***/ }, | ||
25490 | /* 201 */ | ||
25491 | /***/ function(module, exports) { | ||
25492 | |||
25493 | 'use strict'; | ||
25494 | |||
25495 | Object.defineProperty(exports, '__esModule', { | ||
25496 | value: true | ||
25497 | }); | ||
25498 | var RE_NUM = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source; | ||
25499 | |||
25500 | var getComputedStyleX = undefined; | ||
25501 | |||
25502 | function css(el, name, v) { | ||
25503 | var value = v; | ||
25504 | if (typeof name === 'object') { | ||
25505 | for (var i in name) { | ||
25506 | if (name.hasOwnProperty(i)) { | ||
25507 | css(el, i, name[i]); | ||
25508 | } | ||
25509 | } | ||
25510 | return undefined; | ||
25511 | } | ||
25512 | if (typeof value !== 'undefined') { | ||
25513 | if (typeof value === 'number') { | ||
25514 | value = value + 'px'; | ||
25515 | } | ||
25516 | el.style[name] = value; | ||
25517 | return undefined; | ||
25518 | } | ||
25519 | return getComputedStyleX(el, name); | ||
25520 | } | ||
25521 | |||
25522 | function getClientPosition(elem) { | ||
25523 | var box = undefined; | ||
25524 | var x = undefined; | ||
25525 | var y = undefined; | ||
25526 | var doc = elem.ownerDocument; | ||
25527 | var body = doc.body; | ||
25528 | var docElem = doc && doc.documentElement; | ||
25529 | // 根据 GBS 最新数据,A-Grade Browsers 都已支持 getBoundingClientRect 方法,不用再考虑传统的实现方式 | ||
25530 | box = elem.getBoundingClientRect(); | ||
25531 | |||
25532 | // 注:jQuery 还考虑减去 docElem.clientLeft/clientTop | ||
25533 | // 但测试发现,这样反而会导致当 html 和 body 有边距/边框样式时,获取的值不正确 | ||
25534 | // 此外,ie6 会忽略 html 的 margin 值,幸运地是没有谁会去设置 html 的 margin | ||
25535 | |||
25536 | x = box.left; | ||
25537 | y = box.top; | ||
25538 | |||
25539 | // In IE, most of the time, 2 extra pixels are added to the top and left | ||
25540 | // due to the implicit 2-pixel inset border. In IE6/7 quirks mode and | ||
25541 | // IE6 standards mode, this border can be overridden by setting the | ||
25542 | // document element's border to zero -- thus, we cannot rely on the | ||
25543 | // offset always being 2 pixels. | ||
25544 | |||
25545 | // In quirks mode, the offset can be determined by querying the body's | ||
25546 | // clientLeft/clientTop, but in standards mode, it is found by querying | ||
25547 | // the document element's clientLeft/clientTop. Since we already called | ||
25548 | // getClientBoundingRect we have already forced a reflow, so it is not | ||
25549 | // too expensive just to query them all. | ||
25550 | |||
25551 | // ie 下应该减去窗口的边框吧,毕竟默认 absolute 都是相对窗口定位的 | ||
25552 | // 窗口边框标准是设 documentElement ,quirks 时设置 body | ||
25553 | // 最好禁止在 body 和 html 上边框 ,但 ie < 9 html 默认有 2px ,减去 | ||
25554 | // 但是非 ie 不可能设置窗口边框,body html 也不是窗口 ,ie 可以通过 html,body 设置 | ||
25555 | // 标准 ie 下 docElem.clientTop 就是 border-top | ||
25556 | // ie7 html 即窗口边框改变不了。永远为 2 | ||
25557 | // 但标准 firefox/chrome/ie9 下 docElem.clientTop 是窗口边框,即使设了 border-top 也为 0 | ||
25558 | |||
25559 | x -= docElem.clientLeft || body.clientLeft || 0; | ||
25560 | y -= docElem.clientTop || body.clientTop || 0; | ||
25561 | |||
25562 | return { left: x, top: y }; | ||
25563 | } | ||
25564 | |||
25565 | function getScroll(w, top) { | ||
25566 | var ret = w['page' + (top ? 'Y' : 'X') + 'Offset']; | ||
25567 | var method = 'scroll' + (top ? 'Top' : 'Left'); | ||
25568 | if (typeof ret !== 'number') { | ||
25569 | var d = w.document; | ||
25570 | // ie6,7,8 standard mode | ||
25571 | ret = d.documentElement[method]; | ||
25572 | if (typeof ret !== 'number') { | ||
25573 | // quirks mode | ||
25574 | ret = d.body[method]; | ||
25575 | } | ||
25576 | } | ||
25577 | return ret; | ||
25578 | } | ||
25579 | |||
25580 | function getScrollLeft(w) { | ||
25581 | return getScroll(w); | ||
25582 | } | ||
25583 | |||
25584 | function getScrollTop(w) { | ||
25585 | return getScroll(w, true); | ||
25586 | } | ||
25587 | |||
25588 | function getOffset(el) { | ||
25589 | var pos = getClientPosition(el); | ||
25590 | var doc = el.ownerDocument; | ||
25591 | var w = doc.defaultView || doc.parentWindow; | ||
25592 | pos.left += getScrollLeft(w); | ||
25593 | pos.top += getScrollTop(w); | ||
25594 | return pos; | ||
25595 | } | ||
25596 | function _getComputedStyle(elem, name, cs) { | ||
25597 | var computedStyle = cs; | ||
25598 | var val = ''; | ||
25599 | var d = elem.ownerDocument; | ||
25600 | computedStyle = computedStyle || d.defaultView.getComputedStyle(elem, null); | ||
25601 | |||
25602 | // https://github.com/kissyteam/kissy/issues/61 | ||
25603 | if (computedStyle) { | ||
25604 | val = computedStyle.getPropertyValue(name) || computedStyle[name]; | ||
25605 | } | ||
25606 | |||
25607 | return val; | ||
25608 | } | ||
25609 | |||
25610 | var _RE_NUM_NO_PX = new RegExp('^(' + RE_NUM + ')(?!px)[a-z%]+$', 'i'); | ||
25611 | var RE_POS = /^(top|right|bottom|left)$/; | ||
25612 | var CURRENT_STYLE = 'currentStyle'; | ||
25613 | var RUNTIME_STYLE = 'runtimeStyle'; | ||
25614 | var LEFT = 'left'; | ||
25615 | var PX = 'px'; | ||
25616 | |||
25617 | function _getComputedStyleIE(elem, name) { | ||
25618 | // currentStyle maybe null | ||
25619 | // http://msdn.microsoft.com/en-us/library/ms535231.aspx | ||
25620 | var ret = elem[CURRENT_STYLE] && elem[CURRENT_STYLE][name]; | ||
25621 | |||
25622 | // 当 width/height 设置为百分比时,通过 pixelLeft 方式转换的 width/height 值 | ||
25623 | // 一开始就处理了! CUSTOM_STYLE.height,CUSTOM_STYLE.width ,cssHook 解决@2011-08-19 | ||
25624 | // 在 ie 下不对,需要直接用 offset 方式 | ||
25625 | // borderWidth 等值也有问题,但考虑到 borderWidth 设为百分比的概率很小,这里就不考虑了 | ||
25626 | |||
25627 | // From the awesome hack by Dean Edwards | ||
25628 | // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 | ||
25629 | // If we're not dealing with a regular pixel number | ||
25630 | // but a number that has a weird ending, we need to convert it to pixels | ||
25631 | // exclude left right for relativity | ||
25632 | if (_RE_NUM_NO_PX.test(ret) && !RE_POS.test(name)) { | ||
25633 | // Remember the original values | ||
25634 | var style = elem.style; | ||
25635 | var left = style[LEFT]; | ||
25636 | var rsLeft = elem[RUNTIME_STYLE][LEFT]; | ||
25637 | |||
25638 | // prevent flashing of content | ||
25639 | elem[RUNTIME_STYLE][LEFT] = elem[CURRENT_STYLE][LEFT]; | ||
25640 | |||
25641 | // Put in the new values to get a computed value out | ||
25642 | style[LEFT] = name === 'fontSize' ? '1em' : ret || 0; | ||
25643 | ret = style.pixelLeft + PX; | ||
25644 | |||
25645 | // Revert the changed values | ||
25646 | style[LEFT] = left; | ||
25647 | |||
25648 | elem[RUNTIME_STYLE][LEFT] = rsLeft; | ||
25649 | } | ||
25650 | return ret === '' ? 'auto' : ret; | ||
25651 | } | ||
25652 | |||
25653 | if (typeof window !== 'undefined') { | ||
25654 | getComputedStyleX = window.getComputedStyle ? _getComputedStyle : _getComputedStyleIE; | ||
25655 | } | ||
25656 | |||
25657 | function getOffsetDirection(dir, option) { | ||
25658 | if (dir === 'left') { | ||
25659 | return option.useCssRight ? 'right' : dir; | ||
25660 | } | ||
25661 | return option.useCssBottom ? 'bottom' : dir; | ||
25662 | } | ||
25663 | |||
25664 | function oppositeOffsetDirection(dir) { | ||
25665 | if (dir === 'left') { | ||
25666 | return 'right'; | ||
25667 | } else if (dir === 'right') { | ||
25668 | return 'left'; | ||
25669 | } else if (dir === 'top') { | ||
25670 | return 'bottom'; | ||
25671 | } else if (dir === 'bottom') { | ||
25672 | return 'top'; | ||
25673 | } | ||
25674 | } | ||
25675 | |||
25676 | // 设置 elem 相对 elem.ownerDocument 的坐标 | ||
25677 | function setOffset(elem, offset, option) { | ||
25678 | // set position first, in-case top/left are set even on static elem | ||
25679 | if (css(elem, 'position') === 'static') { | ||
25680 | elem.style.position = 'relative'; | ||
25681 | } | ||
25682 | var presetH = -999; | ||
25683 | var presetV = -999; | ||
25684 | var horizontalProperty = getOffsetDirection('left', option); | ||
25685 | var verticalProperty = getOffsetDirection('top', option); | ||
25686 | var oppositeHorizontalProperty = oppositeOffsetDirection(horizontalProperty); | ||
25687 | var oppositeVerticalProperty = oppositeOffsetDirection(verticalProperty); | ||
25688 | |||
25689 | if (horizontalProperty !== 'left') { | ||
25690 | presetH = 999; | ||
25691 | } | ||
25692 | |||
25693 | if (verticalProperty !== 'top') { | ||
25694 | presetV = 999; | ||
25695 | } | ||
25696 | |||
25697 | if ('left' in offset) { | ||
25698 | elem.style[oppositeHorizontalProperty] = ''; | ||
25699 | elem.style[horizontalProperty] = presetH + 'px'; | ||
25700 | } | ||
25701 | if ('top' in offset) { | ||
25702 | elem.style[oppositeVerticalProperty] = ''; | ||
25703 | elem.style[verticalProperty] = presetV + 'px'; | ||
25704 | } | ||
25705 | var old = getOffset(elem); | ||
25706 | var ret = {}; | ||
25707 | var key = undefined; | ||
25708 | for (key in offset) { | ||
25709 | if (offset.hasOwnProperty(key)) { | ||
25710 | var dir = getOffsetDirection(key, option); | ||
25711 | var preset = key === 'left' ? presetH : presetV; | ||
25712 | if (dir === key) { | ||
25713 | ret[dir] = preset + offset[key] - old[key]; | ||
25714 | } else { | ||
25715 | ret[dir] = preset + old[key] - offset[key]; | ||
25716 | } | ||
25717 | } | ||
25718 | } | ||
25719 | css(elem, ret); | ||
25720 | } | ||
25721 | |||
25722 | function each(arr, fn) { | ||
25723 | for (var i = 0; i < arr.length; i++) { | ||
25724 | fn(arr[i]); | ||
25725 | } | ||
25726 | } | ||
25727 | |||
25728 | function isBorderBoxFn(elem) { | ||
25729 | return getComputedStyleX(elem, 'boxSizing') === 'border-box'; | ||
25730 | } | ||
25731 | |||
25732 | var BOX_MODELS = ['margin', 'border', 'padding']; | ||
25733 | var CONTENT_INDEX = -1; | ||
25734 | var PADDING_INDEX = 2; | ||
25735 | var BORDER_INDEX = 1; | ||
25736 | var MARGIN_INDEX = 0; | ||
25737 | |||
25738 | function swap(elem, options, callback) { | ||
25739 | var old = {}; | ||
25740 | var style = elem.style; | ||
25741 | var name = undefined; | ||
25742 | |||
25743 | // Remember the old values, and insert the new ones | ||
25744 | for (name in options) { | ||
25745 | if (options.hasOwnProperty(name)) { | ||
25746 | old[name] = style[name]; | ||
25747 | style[name] = options[name]; | ||
25748 | } | ||
25749 | } | ||
25750 | |||
25751 | callback.call(elem); | ||
25752 | |||
25753 | // Revert the old values | ||
25754 | for (name in options) { | ||
25755 | if (options.hasOwnProperty(name)) { | ||
25756 | style[name] = old[name]; | ||
25757 | } | ||
25758 | } | ||
25759 | } | ||
25760 | |||
25761 | function getPBMWidth(elem, props, which) { | ||
25762 | var value = 0; | ||
25763 | var prop = undefined; | ||
25764 | var j = undefined; | ||
25765 | var i = undefined; | ||
25766 | for (j = 0; j < props.length; j++) { | ||
25767 | prop = props[j]; | ||
25768 | if (prop) { | ||
25769 | for (i = 0; i < which.length; i++) { | ||
25770 | var cssProp = undefined; | ||
25771 | if (prop === 'border') { | ||
25772 | cssProp = prop + which[i] + 'Width'; | ||
25773 | } else { | ||
25774 | cssProp = prop + which[i]; | ||
25775 | } | ||
25776 | value += parseFloat(getComputedStyleX(elem, cssProp)) || 0; | ||
25777 | } | ||
25778 | } | ||
25779 | } | ||
25780 | return value; | ||
25781 | } | ||
25782 | |||
25783 | /** | ||
25784 | * A crude way of determining if an object is a window | ||
25785 | * @member util | ||
25786 | */ | ||
25787 | function isWindow(obj) { | ||
25788 | // must use == for ie8 | ||
25789 | /* eslint eqeqeq:0 */ | ||
25790 | return obj !== null && obj !== undefined && obj == obj.window; | ||
25791 | } | ||
25792 | |||
25793 | var domUtils = {}; | ||
25794 | |||
25795 | each(['Width', 'Height'], function (name) { | ||
25796 | domUtils['doc' + name] = function (refWin) { | ||
25797 | var d = refWin.document; | ||
25798 | return Math.max( | ||
25799 | // firefox chrome documentElement.scrollHeight< body.scrollHeight | ||
25800 | // ie standard mode : documentElement.scrollHeight> body.scrollHeight | ||
25801 | d.documentElement['scroll' + name], | ||
25802 | // quirks : documentElement.scrollHeight 最大等于可视窗口多一点? | ||
25803 | d.body['scroll' + name], domUtils['viewport' + name](d)); | ||
25804 | }; | ||
25805 | |||
25806 | domUtils['viewport' + name] = function (win) { | ||
25807 | // pc browser includes scrollbar in window.innerWidth | ||
25808 | var prop = 'client' + name; | ||
25809 | var doc = win.document; | ||
25810 | var body = doc.body; | ||
25811 | var documentElement = doc.documentElement; | ||
25812 | var documentElementProp = documentElement[prop]; | ||
25813 | // 标准模式取 documentElement | ||
25814 | // backcompat 取 body | ||
25815 | return doc.compatMode === 'CSS1Compat' && documentElementProp || body && body[prop] || documentElementProp; | ||
25816 | }; | ||
25817 | }); | ||
25818 | |||
25819 | /* | ||
25820 | 得到元素的大小信息 | ||
25821 | @param elem | ||
25822 | @param name | ||
25823 | @param {String} [extra] 'padding' : (css width) + padding | ||
25824 | 'border' : (css width) + padding + border | ||
25825 | 'margin' : (css width) + padding + border + margin | ||
25826 | */ | ||
25827 | function getWH(elem, name, ex) { | ||
25828 | var extra = ex; | ||
25829 | if (isWindow(elem)) { | ||
25830 | return name === 'width' ? domUtils.viewportWidth(elem) : domUtils.viewportHeight(elem); | ||
25831 | } else if (elem.nodeType === 9) { | ||
25832 | return name === 'width' ? domUtils.docWidth(elem) : domUtils.docHeight(elem); | ||
25833 | } | ||
25834 | var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom']; | ||
25835 | var borderBoxValue = name === 'width' ? elem.offsetWidth : elem.offsetHeight; | ||
25836 | var computedStyle = getComputedStyleX(elem); | ||
25837 | var isBorderBox = isBorderBoxFn(elem, computedStyle); | ||
25838 | var cssBoxValue = 0; | ||
25839 | if (borderBoxValue === null || borderBoxValue === undefined || borderBoxValue <= 0) { | ||
25840 | borderBoxValue = undefined; | ||
25841 | // Fall back to computed then un computed css if necessary | ||
25842 | cssBoxValue = getComputedStyleX(elem, name); | ||
25843 | if (cssBoxValue === null || cssBoxValue === undefined || Number(cssBoxValue) < 0) { | ||
25844 | cssBoxValue = elem.style[name] || 0; | ||
25845 | } | ||
25846 | // Normalize '', auto, and prepare for extra | ||
25847 | cssBoxValue = parseFloat(cssBoxValue) || 0; | ||
25848 | } | ||
25849 | if (extra === undefined) { | ||
25850 | extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX; | ||
25851 | } | ||
25852 | var borderBoxValueOrIsBorderBox = borderBoxValue !== undefined || isBorderBox; | ||
25853 | var val = borderBoxValue || cssBoxValue; | ||
25854 | if (extra === CONTENT_INDEX) { | ||
25855 | if (borderBoxValueOrIsBorderBox) { | ||
25856 | return val - getPBMWidth(elem, ['border', 'padding'], which, computedStyle); | ||
25857 | } | ||
25858 | return cssBoxValue; | ||
25859 | } else if (borderBoxValueOrIsBorderBox) { | ||
25860 | if (extra === BORDER_INDEX) { | ||
25861 | return val; | ||
25862 | } | ||
25863 | return val + (extra === PADDING_INDEX ? -getPBMWidth(elem, ['border'], which, computedStyle) : getPBMWidth(elem, ['margin'], which, computedStyle)); | ||
25864 | } | ||
25865 | return cssBoxValue + getPBMWidth(elem, BOX_MODELS.slice(extra), which, computedStyle); | ||
25866 | } | ||
25867 | |||
25868 | var cssShow = { position: 'absolute', visibility: 'hidden', display: 'block' }; | ||
25869 | |||
25870 | // fix #119 : https://github.com/kissyteam/kissy/issues/119 | ||
25871 | function getWHIgnoreDisplay() { | ||
25872 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
25873 | args[_key] = arguments[_key]; | ||
25874 | } | ||
25875 | |||
25876 | var val = undefined; | ||
25877 | var elem = args[0]; | ||
25878 | // in case elem is window | ||
25879 | // elem.offsetWidth === undefined | ||
25880 | if (elem.offsetWidth !== 0) { | ||
25881 | val = getWH.apply(undefined, args); | ||
25882 | } else { | ||
25883 | swap(elem, cssShow, function () { | ||
25884 | val = getWH.apply(undefined, args); | ||
25885 | }); | ||
25886 | } | ||
25887 | return val; | ||
25888 | } | ||
25889 | |||
25890 | each(['width', 'height'], function (name) { | ||
25891 | var first = name.charAt(0).toUpperCase() + name.slice(1); | ||
25892 | domUtils['outer' + first] = function (el, includeMargin) { | ||
25893 | return el && getWHIgnoreDisplay(el, name, includeMargin ? MARGIN_INDEX : BORDER_INDEX); | ||
25894 | }; | ||
25895 | var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom']; | ||
25896 | |||
25897 | domUtils[name] = function (elem, v) { | ||
25898 | var val = v; | ||
25899 | if (val !== undefined) { | ||
25900 | if (elem) { | ||
25901 | var computedStyle = getComputedStyleX(elem); | ||
25902 | var isBorderBox = isBorderBoxFn(elem); | ||
25903 | if (isBorderBox) { | ||
25904 | val += getPBMWidth(elem, ['padding', 'border'], which, computedStyle); | ||
25905 | } | ||
25906 | return css(elem, name, val); | ||
25907 | } | ||
25908 | return undefined; | ||
25909 | } | ||
25910 | return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX); | ||
25911 | }; | ||
25912 | }); | ||
25913 | |||
25914 | function mix(to, from) { | ||
25915 | for (var i in from) { | ||
25916 | if (from.hasOwnProperty(i)) { | ||
25917 | to[i] = from[i]; | ||
25918 | } | ||
25919 | } | ||
25920 | return to; | ||
25921 | } | ||
25922 | |||
25923 | var utils = { | ||
25924 | getWindow: function getWindow(node) { | ||
25925 | if (node && node.document && node.setTimeout) { | ||
25926 | return node; | ||
25927 | } | ||
25928 | var doc = node.ownerDocument || node; | ||
25929 | return doc.defaultView || doc.parentWindow; | ||
25930 | }, | ||
25931 | offset: function offset(el, value, option) { | ||
25932 | if (typeof value !== 'undefined') { | ||
25933 | setOffset(el, value, option || {}); | ||
25934 | } else { | ||
25935 | return getOffset(el); | ||
25936 | } | ||
25937 | }, | ||
25938 | isWindow: isWindow, | ||
25939 | each: each, | ||
25940 | css: css, | ||
25941 | clone: function clone(obj) { | ||
25942 | var i = undefined; | ||
25943 | var ret = {}; | ||
25944 | for (i in obj) { | ||
25945 | if (obj.hasOwnProperty(i)) { | ||
25946 | ret[i] = obj[i]; | ||
25947 | } | ||
25948 | } | ||
25949 | var overflow = obj.overflow; | ||
25950 | if (overflow) { | ||
25951 | for (i in obj) { | ||
25952 | if (obj.hasOwnProperty(i)) { | ||
25953 | ret.overflow[i] = obj.overflow[i]; | ||
25954 | } | ||
25955 | } | ||
25956 | } | ||
25957 | return ret; | ||
25958 | }, | ||
25959 | mix: mix, | ||
25960 | getWindowScrollLeft: function getWindowScrollLeft(w) { | ||
25961 | return getScrollLeft(w); | ||
25962 | }, | ||
25963 | getWindowScrollTop: function getWindowScrollTop(w) { | ||
25964 | return getScrollTop(w); | ||
25965 | }, | ||
25966 | merge: function merge() { | ||
25967 | var ret = {}; | ||
25968 | |||
25969 | for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | ||
25970 | args[_key2] = arguments[_key2]; | ||
25971 | } | ||
25972 | |||
25973 | for (var i = 0; i < args.length; i++) { | ||
25974 | utils.mix(ret, args[i]); | ||
25975 | } | ||
25976 | return ret; | ||
25977 | }, | ||
25978 | viewportWidth: 0, | ||
25979 | viewportHeight: 0 | ||
25980 | }; | ||
25981 | |||
25982 | mix(utils, domUtils); | ||
25983 | |||
25984 | exports['default'] = utils; | ||
25985 | module.exports = exports['default']; | ||
25986 | |||
25987 | /***/ }, | ||
25988 | /* 202 */ | ||
25989 | /***/ function(module, exports, __webpack_require__) { | ||
25990 | |||
25991 | 'use strict'; | ||
25992 | |||
25993 | Object.defineProperty(exports, '__esModule', { | ||
25994 | value: true | ||
25995 | }); | ||
25996 | |||
25997 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
25998 | |||
25999 | var _utils = __webpack_require__(201); | ||
26000 | |||
26001 | var _utils2 = _interopRequireDefault(_utils); | ||
26002 | |||
26003 | /** | ||
26004 | * 得到会导致元素显示不全的祖先元素 | ||
26005 | */ | ||
26006 | |||
26007 | function getOffsetParent(element) { | ||
26008 | // ie 这个也不是完全可行 | ||
26009 | /* | ||
26010 | <div style="width: 50px;height: 100px;overflow: hidden"> | ||
26011 | <div style="width: 50px;height: 100px;position: relative;" id="d6"> | ||
26012 | 元素 6 高 100px 宽 50px<br/> | ||
26013 | </div> | ||
26014 | </div> | ||
26015 | */ | ||
26016 | // element.offsetParent does the right thing in ie7 and below. Return parent with layout! | ||
26017 | // In other browsers it only includes elements with position absolute, relative or | ||
26018 | // fixed, not elements with overflow set to auto or scroll. | ||
26019 | // if (UA.ie && ieMode < 8) { | ||
26020 | // return element.offsetParent; | ||
26021 | // } | ||
26022 | // 统一的 offsetParent 方法 | ||
26023 | var doc = element.ownerDocument; | ||
26024 | var body = doc.body; | ||
26025 | var parent = undefined; | ||
26026 | var positionStyle = _utils2['default'].css(element, 'position'); | ||
26027 | var skipStatic = positionStyle === 'fixed' || positionStyle === 'absolute'; | ||
26028 | |||
26029 | if (!skipStatic) { | ||
26030 | return element.nodeName.toLowerCase() === 'html' ? null : element.parentNode; | ||
26031 | } | ||
26032 | |||
26033 | for (parent = element.parentNode; parent && parent !== body; parent = parent.parentNode) { | ||
26034 | positionStyle = _utils2['default'].css(parent, 'position'); | ||
26035 | if (positionStyle !== 'static') { | ||
26036 | return parent; | ||
26037 | } | ||
26038 | } | ||
26039 | return null; | ||
26040 | } | ||
26041 | |||
26042 | exports['default'] = getOffsetParent; | ||
26043 | module.exports = exports['default']; | ||
26044 | |||
26045 | /***/ }, | ||
26046 | /* 203 */ | ||
26047 | /***/ function(module, exports, __webpack_require__) { | ||
26048 | |||
26049 | 'use strict'; | ||
26050 | |||
26051 | Object.defineProperty(exports, '__esModule', { | ||
26052 | value: true | ||
26053 | }); | ||
26054 | |||
26055 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
26056 | |||
26057 | var _utils = __webpack_require__(201); | ||
26058 | |||
26059 | var _utils2 = _interopRequireDefault(_utils); | ||
26060 | |||
26061 | var _getOffsetParent = __webpack_require__(202); | ||
26062 | |||
26063 | var _getOffsetParent2 = _interopRequireDefault(_getOffsetParent); | ||
26064 | |||
26065 | /** | ||
26066 | * 获得元素的显示部分的区域 | ||
26067 | */ | ||
26068 | function getVisibleRectForElement(element) { | ||
26069 | var visibleRect = { | ||
26070 | left: 0, | ||
26071 | right: Infinity, | ||
26072 | top: 0, | ||
26073 | bottom: Infinity | ||
26074 | }; | ||
26075 | var el = (0, _getOffsetParent2['default'])(element); | ||
26076 | var scrollX = undefined; | ||
26077 | var scrollY = undefined; | ||
26078 | var winSize = undefined; | ||
26079 | var doc = element.ownerDocument; | ||
26080 | var win = doc.defaultView || doc.parentWindow; | ||
26081 | var body = doc.body; | ||
26082 | var documentElement = doc.documentElement; | ||
26083 | |||
26084 | // Determine the size of the visible rect by climbing the dom accounting for | ||
26085 | // all scrollable containers. | ||
26086 | while (el) { | ||
26087 | // clientWidth is zero for inline block elements in ie. | ||
26088 | if ((navigator.userAgent.indexOf('MSIE') === -1 || el.clientWidth !== 0) && | ||
26089 | // body may have overflow set on it, yet we still get the entire | ||
26090 | // viewport. In some browsers, el.offsetParent may be | ||
26091 | // document.documentElement, so check for that too. | ||
26092 | el !== body && el !== documentElement && _utils2['default'].css(el, 'overflow') !== 'visible') { | ||
26093 | var pos = _utils2['default'].offset(el); | ||
26094 | // add border | ||
26095 | pos.left += el.clientLeft; | ||
26096 | pos.top += el.clientTop; | ||
26097 | visibleRect.top = Math.max(visibleRect.top, pos.top); | ||
26098 | visibleRect.right = Math.min(visibleRect.right, | ||
26099 | // consider area without scrollBar | ||
26100 | pos.left + el.clientWidth); | ||
26101 | visibleRect.bottom = Math.min(visibleRect.bottom, pos.top + el.clientHeight); | ||
26102 | visibleRect.left = Math.max(visibleRect.left, pos.left); | ||
26103 | } else if (el === body || el === documentElement) { | ||
26104 | break; | ||
26105 | } | ||
26106 | el = (0, _getOffsetParent2['default'])(el); | ||
26107 | } | ||
26108 | |||
26109 | // Clip by window's viewport. | ||
26110 | scrollX = _utils2['default'].getWindowScrollLeft(win); | ||
26111 | scrollY = _utils2['default'].getWindowScrollTop(win); | ||
26112 | visibleRect.left = Math.max(visibleRect.left, scrollX); | ||
26113 | visibleRect.top = Math.max(visibleRect.top, scrollY); | ||
26114 | winSize = { | ||
26115 | width: _utils2['default'].viewportWidth(win), | ||
26116 | height: _utils2['default'].viewportHeight(win) | ||
26117 | }; | ||
26118 | visibleRect.right = Math.min(visibleRect.right, scrollX + winSize.width); | ||
26119 | visibleRect.bottom = Math.min(visibleRect.bottom, scrollY + winSize.height); | ||
26120 | return visibleRect.top >= 0 && visibleRect.left >= 0 && visibleRect.bottom > visibleRect.top && visibleRect.right > visibleRect.left ? visibleRect : null; | ||
26121 | } | ||
26122 | |||
26123 | exports['default'] = getVisibleRectForElement; | ||
26124 | module.exports = exports['default']; | ||
26125 | |||
26126 | /***/ }, | ||
26127 | /* 204 */ | ||
26128 | /***/ function(module, exports, __webpack_require__) { | ||
26129 | |||
26130 | 'use strict'; | ||
26131 | |||
26132 | Object.defineProperty(exports, '__esModule', { | ||
26133 | value: true | ||
26134 | }); | ||
26135 | |||
26136 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
26137 | |||
26138 | var _utils = __webpack_require__(201); | ||
26139 | |||
26140 | var _utils2 = _interopRequireDefault(_utils); | ||
26141 | |||
26142 | function adjustForViewport(elFuturePos, elRegion, visibleRect, overflow) { | ||
26143 | var pos = _utils2['default'].clone(elFuturePos); | ||
26144 | var size = { | ||
26145 | width: elRegion.width, | ||
26146 | height: elRegion.height | ||
26147 | }; | ||
26148 | |||
26149 | if (overflow.adjustX && pos.left < visibleRect.left) { | ||
26150 | pos.left = visibleRect.left; | ||
26151 | } | ||
26152 | |||
26153 | // Left edge inside and right edge outside viewport, try to resize it. | ||
26154 | if (overflow.resizeWidth && pos.left >= visibleRect.left && pos.left + size.width > visibleRect.right) { | ||
26155 | size.width -= pos.left + size.width - visibleRect.right; | ||
26156 | } | ||
26157 | |||
26158 | // Right edge outside viewport, try to move it. | ||
26159 | if (overflow.adjustX && pos.left + size.width > visibleRect.right) { | ||
26160 | // 保证左边界和可视区域左边界对齐 | ||
26161 | pos.left = Math.max(visibleRect.right - size.width, visibleRect.left); | ||
26162 | } | ||
26163 | |||
26164 | // Top edge outside viewport, try to move it. | ||
26165 | if (overflow.adjustY && pos.top < visibleRect.top) { | ||
26166 | pos.top = visibleRect.top; | ||
26167 | } | ||
26168 | |||
26169 | // Top edge inside and bottom edge outside viewport, try to resize it. | ||
26170 | if (overflow.resizeHeight && pos.top >= visibleRect.top && pos.top + size.height > visibleRect.bottom) { | ||
26171 | size.height -= pos.top + size.height - visibleRect.bottom; | ||
26172 | } | ||
26173 | |||
26174 | // Bottom edge outside viewport, try to move it. | ||
26175 | if (overflow.adjustY && pos.top + size.height > visibleRect.bottom) { | ||
26176 | // 保证上边界和可视区域上边界对齐 | ||
26177 | pos.top = Math.max(visibleRect.bottom - size.height, visibleRect.top); | ||
26178 | } | ||
26179 | |||
26180 | return _utils2['default'].mix(pos, size); | ||
26181 | } | ||
26182 | |||
26183 | exports['default'] = adjustForViewport; | ||
26184 | module.exports = exports['default']; | ||
26185 | |||
26186 | /***/ }, | ||
26187 | /* 205 */ | ||
26188 | /***/ function(module, exports, __webpack_require__) { | ||
26189 | |||
26190 | 'use strict'; | ||
26191 | |||
26192 | Object.defineProperty(exports, '__esModule', { | ||
26193 | value: true | ||
26194 | }); | ||
26195 | |||
26196 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
26197 | |||
26198 | var _utils = __webpack_require__(201); | ||
26199 | |||
26200 | var _utils2 = _interopRequireDefault(_utils); | ||
26201 | |||
26202 | function getRegion(node) { | ||
26203 | var offset = undefined; | ||
26204 | var w = undefined; | ||
26205 | var h = undefined; | ||
26206 | if (!_utils2['default'].isWindow(node) && node.nodeType !== 9) { | ||
26207 | offset = _utils2['default'].offset(node); | ||
26208 | w = _utils2['default'].outerWidth(node); | ||
26209 | h = _utils2['default'].outerHeight(node); | ||
26210 | } else { | ||
26211 | var win = _utils2['default'].getWindow(node); | ||
26212 | offset = { | ||
26213 | left: _utils2['default'].getWindowScrollLeft(win), | ||
26214 | top: _utils2['default'].getWindowScrollTop(win) | ||
26215 | }; | ||
26216 | w = _utils2['default'].viewportWidth(win); | ||
26217 | h = _utils2['default'].viewportHeight(win); | ||
26218 | } | ||
26219 | offset.width = w; | ||
26220 | offset.height = h; | ||
26221 | return offset; | ||
26222 | } | ||
26223 | |||
26224 | exports['default'] = getRegion; | ||
26225 | module.exports = exports['default']; | ||
26226 | |||
26227 | /***/ }, | ||
26228 | /* 206 */ | ||
26229 | /***/ function(module, exports, __webpack_require__) { | ||
26230 | |||
26231 | 'use strict'; | ||
26232 | |||
26233 | Object.defineProperty(exports, '__esModule', { | ||
26234 | value: true | ||
26235 | }); | ||
26236 | |||
26237 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
26238 | |||
26239 | var _getAlignOffset = __webpack_require__(207); | ||
26240 | |||
26241 | var _getAlignOffset2 = _interopRequireDefault(_getAlignOffset); | ||
26242 | |||
26243 | function getElFuturePos(elRegion, refNodeRegion, points, offset, targetOffset) { | ||
26244 | var xy = undefined; | ||
26245 | var diff = undefined; | ||
26246 | var p1 = undefined; | ||
26247 | var p2 = undefined; | ||
26248 | |||
26249 | xy = { | ||
26250 | left: elRegion.left, | ||
26251 | top: elRegion.top | ||
26252 | }; | ||
26253 | |||
26254 | p1 = (0, _getAlignOffset2['default'])(refNodeRegion, points[1]); | ||
26255 | p2 = (0, _getAlignOffset2['default'])(elRegion, points[0]); | ||
26256 | |||
26257 | diff = [p2.left - p1.left, p2.top - p1.top]; | ||
26258 | |||
26259 | return { | ||
26260 | left: xy.left - diff[0] + offset[0] - targetOffset[0], | ||
26261 | top: xy.top - diff[1] + offset[1] - targetOffset[1] | ||
26262 | }; | ||
26263 | } | ||
26264 | |||
26265 | exports['default'] = getElFuturePos; | ||
26266 | module.exports = exports['default']; | ||
26267 | |||
26268 | /***/ }, | ||
26269 | /* 207 */ | ||
26270 | /***/ function(module, exports) { | ||
26271 | |||
26272 | /** | ||
26273 | * 获取 node 上的 align 对齐点 相对于页面的坐标 | ||
26274 | */ | ||
26275 | |||
26276 | 'use strict'; | ||
26277 | |||
26278 | Object.defineProperty(exports, '__esModule', { | ||
26279 | value: true | ||
26280 | }); | ||
26281 | function getAlignOffset(region, align) { | ||
26282 | var V = align.charAt(0); | ||
26283 | var H = align.charAt(1); | ||
26284 | var w = region.width; | ||
26285 | var h = region.height; | ||
26286 | var x = undefined; | ||
26287 | var y = undefined; | ||
26288 | |||
26289 | x = region.left; | ||
26290 | y = region.top; | ||
26291 | |||
26292 | if (V === 'c') { | ||
26293 | y += h / 2; | ||
26294 | } else if (V === 'b') { | ||
26295 | y += h; | ||
26296 | } | ||
26297 | |||
26298 | if (H === 'c') { | ||
26299 | x += w / 2; | ||
26300 | } else if (H === 'r') { | ||
26301 | x += w; | ||
26302 | } | ||
26303 | |||
26304 | return { | ||
26305 | left: x, | ||
26306 | top: y | ||
26307 | }; | ||
26308 | } | ||
26309 | |||
26310 | exports['default'] = getAlignOffset; | ||
26311 | module.exports = exports['default']; | ||
26312 | |||
26313 | /***/ }, | ||
26314 | /* 208 */ | ||
26315 | /***/ function(module, exports) { | ||
26316 | |||
26317 | "use strict"; | ||
26318 | |||
26319 | Object.defineProperty(exports, "__esModule", { | ||
26320 | value: true | ||
26321 | }); | ||
26322 | exports["default"] = isWindow; | ||
26323 | |||
26324 | function isWindow(obj) { | ||
26325 | /* eslint no-eq-null: 0 */ | ||
26326 | /* eslint eqeqeq: 0 */ | ||
26327 | return obj != null && obj == obj.window; | ||
26328 | } | ||
26329 | |||
26330 | module.exports = exports["default"]; | ||
26331 | |||
26332 | /***/ }, | ||
26333 | /* 209 */ | ||
26334 | /***/ function(module, exports, __webpack_require__) { | ||
26335 | |||
26336 | // export this package's api | ||
26337 | 'use strict'; | ||
26338 | |||
26339 | module.exports = __webpack_require__(210); | ||
26340 | |||
26341 | /***/ }, | ||
26342 | /* 210 */ | ||
26343 | /***/ function(module, exports, __webpack_require__) { | ||
26344 | |||
26345 | 'use strict'; | ||
26346 | |||
26347 | Object.defineProperty(exports, '__esModule', { | ||
26348 | value: true | ||
26349 | }); | ||
26350 | |||
26351 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
26352 | |||
26353 | 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; } | ||
26354 | |||
26355 | var _react = __webpack_require__(3); | ||
26356 | |||
26357 | var _react2 = _interopRequireDefault(_react); | ||
26358 | |||
26359 | var _ChildrenUtils = __webpack_require__(211); | ||
26360 | |||
26361 | var _AnimateChild = __webpack_require__(212); | ||
26362 | |||
26363 | var _AnimateChild2 = _interopRequireDefault(_AnimateChild); | ||
26364 | |||
26365 | var _util = __webpack_require__(216); | ||
26366 | |||
26367 | var _util2 = _interopRequireDefault(_util); | ||
26368 | |||
26369 | var defaultKey = 'rc_animate_' + Date.now(); | ||
26370 | |||
26371 | function getChildrenFromProps(props) { | ||
26372 | var children = props.children; | ||
26373 | if (_react2['default'].isValidElement(children)) { | ||
26374 | if (!children.key) { | ||
26375 | return _react2['default'].cloneElement(children, { | ||
26376 | key: defaultKey | ||
26377 | }); | ||
26378 | } | ||
26379 | } | ||
26380 | return children; | ||
26381 | } | ||
26382 | |||
26383 | function noop() {} | ||
26384 | |||
26385 | var Animate = _react2['default'].createClass({ | ||
26386 | displayName: 'Animate', | ||
26387 | |||
26388 | propTypes: { | ||
26389 | component: _react2['default'].PropTypes.any, | ||
26390 | animation: _react2['default'].PropTypes.object, | ||
26391 | transitionName: _react2['default'].PropTypes.string, | ||
26392 | transitionEnter: _react2['default'].PropTypes.bool, | ||
26393 | transitionAppear: _react2['default'].PropTypes.bool, | ||
26394 | exclusive: _react2['default'].PropTypes.bool, | ||
26395 | transitionLeave: _react2['default'].PropTypes.bool, | ||
26396 | onEnd: _react2['default'].PropTypes.func, | ||
26397 | onEnter: _react2['default'].PropTypes.func, | ||
26398 | onLeave: _react2['default'].PropTypes.func, | ||
26399 | onAppear: _react2['default'].PropTypes.func, | ||
26400 | showProp: _react2['default'].PropTypes.string | ||
26401 | }, | ||
26402 | |||
26403 | getDefaultProps: function getDefaultProps() { | ||
26404 | return { | ||
26405 | animation: {}, | ||
26406 | component: 'span', | ||
26407 | transitionEnter: true, | ||
26408 | transitionLeave: true, | ||
26409 | transitionAppear: false, | ||
26410 | onEnd: noop, | ||
26411 | onEnter: noop, | ||
26412 | onLeave: noop, | ||
26413 | onAppear: noop | ||
26414 | }; | ||
26415 | }, | ||
26416 | |||
26417 | getInitialState: function getInitialState() { | ||
26418 | this.currentlyAnimatingKeys = {}; | ||
26419 | this.keysToEnter = []; | ||
26420 | this.keysToLeave = []; | ||
26421 | return { | ||
26422 | children: (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(this.props)) | ||
26423 | }; | ||
26424 | }, | ||
26425 | |||
26426 | componentDidMount: function componentDidMount() { | ||
26427 | var _this = this; | ||
26428 | |||
26429 | var showProp = this.props.showProp; | ||
26430 | var children = this.state.children; | ||
26431 | if (showProp) { | ||
26432 | children = children.filter(function (child) { | ||
26433 | return !!child.props[showProp]; | ||
26434 | }); | ||
26435 | } | ||
26436 | children.forEach(function (child) { | ||
26437 | _this.performAppear(child.key); | ||
26438 | }); | ||
26439 | }, | ||
26440 | |||
26441 | componentWillReceiveProps: function componentWillReceiveProps(nextProps) { | ||
26442 | var _this2 = this; | ||
26443 | |||
26444 | var nextChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(nextProps)); | ||
26445 | var props = this.props; | ||
26446 | var showProp = props.showProp; | ||
26447 | var currentlyAnimatingKeys = this.currentlyAnimatingKeys; | ||
26448 | // last props children if exclusive | ||
26449 | // exclusive needs immediate response | ||
26450 | var currentChildren = this.state.children; | ||
26451 | // in case destroy in showProp mode | ||
26452 | var newChildren = []; | ||
26453 | if (showProp) { | ||
26454 | currentChildren.forEach(function (currentChild) { | ||
26455 | var nextChild = (0, _ChildrenUtils.findChildInChildrenByKey)(nextChildren, currentChild.key); | ||
26456 | var newChild = undefined; | ||
26457 | if ((!nextChild || !nextChild.props[showProp]) && currentChild.props[showProp]) { | ||
26458 | newChild = _react2['default'].cloneElement(nextChild || currentChild, _defineProperty({}, showProp, true)); | ||
26459 | } else { | ||
26460 | newChild = nextChild; | ||
26461 | } | ||
26462 | if (newChild) { | ||
26463 | newChildren.push(newChild); | ||
26464 | } | ||
26465 | }); | ||
26466 | nextChildren.forEach(function (nextChild) { | ||
26467 | if (!(0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, nextChild.key)) { | ||
26468 | newChildren.push(nextChild); | ||
26469 | } | ||
26470 | }); | ||
26471 | } else { | ||
26472 | newChildren = (0, _ChildrenUtils.mergeChildren)(currentChildren, nextChildren); | ||
26473 | } | ||
26474 | |||
26475 | // need render to avoid update | ||
26476 | this.setState({ | ||
26477 | children: newChildren | ||
26478 | }); | ||
26479 | |||
26480 | nextChildren.forEach(function (child) { | ||
26481 | var key = child.key; | ||
26482 | if (currentlyAnimatingKeys[key]) { | ||
26483 | return; | ||
26484 | } | ||
26485 | var hasPrev = (0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, key); | ||
26486 | if (showProp) { | ||
26487 | var showInNext = child.props[showProp]; | ||
26488 | if (hasPrev) { | ||
26489 | var showInNow = (0, _ChildrenUtils.findShownChildInChildrenByKey)(currentChildren, key, showProp); | ||
26490 | if (!showInNow && showInNext) { | ||
26491 | _this2.keysToEnter.push(key); | ||
26492 | } | ||
26493 | } else if (showInNext) { | ||
26494 | _this2.keysToEnter.push(key); | ||
26495 | } | ||
26496 | } else if (!hasPrev) { | ||
26497 | _this2.keysToEnter.push(key); | ||
26498 | } | ||
26499 | }); | ||
26500 | |||
26501 | currentChildren.forEach(function (child) { | ||
26502 | var key = child.key; | ||
26503 | if (currentlyAnimatingKeys[key]) { | ||
26504 | return; | ||
26505 | } | ||
26506 | var hasNext = (0, _ChildrenUtils.findChildInChildrenByKey)(nextChildren, key); | ||
26507 | if (showProp) { | ||
26508 | var showInNow = child.props[showProp]; | ||
26509 | if (hasNext) { | ||
26510 | var showInNext = (0, _ChildrenUtils.findShownChildInChildrenByKey)(nextChildren, key, showProp); | ||
26511 | if (!showInNext && showInNow) { | ||
26512 | _this2.keysToLeave.push(key); | ||
26513 | } | ||
26514 | } else if (showInNow) { | ||
26515 | _this2.keysToLeave.push(key); | ||
26516 | } | ||
26517 | } else if (!hasNext) { | ||
26518 | _this2.keysToLeave.push(key); | ||
26519 | } | ||
26520 | }); | ||
26521 | }, | ||
26522 | |||
26523 | componentDidUpdate: function componentDidUpdate(prevProps) { | ||
26524 | var _this3 = this; | ||
26525 | |||
26526 | // exclusive needs immediate response | ||
26527 | if (this.props.exclusive && this.props !== prevProps) { | ||
26528 | Object.keys(this.currentlyAnimatingKeys).forEach(function (key) { | ||
26529 | _this3.stop(key); | ||
26530 | }); | ||
26531 | } | ||
26532 | if (this.isMounted()) { | ||
26533 | var keysToEnter = this.keysToEnter; | ||
26534 | this.keysToEnter = []; | ||
26535 | keysToEnter.forEach(this.performEnter); | ||
26536 | var keysToLeave = this.keysToLeave; | ||
26537 | this.keysToLeave = []; | ||
26538 | keysToLeave.forEach(this.performLeave); | ||
26539 | } | ||
26540 | }, | ||
26541 | |||
26542 | performEnter: function performEnter(key) { | ||
26543 | // may already remove by exclusive | ||
26544 | if (this.refs[key]) { | ||
26545 | this.currentlyAnimatingKeys[key] = true; | ||
26546 | this.refs[key].componentWillEnter(this.handleDoneAdding.bind(this, key, 'enter')); | ||
26547 | } | ||
26548 | }, | ||
26549 | |||
26550 | performAppear: function performAppear(key) { | ||
26551 | if (this.refs[key]) { | ||
26552 | this.currentlyAnimatingKeys[key] = true; | ||
26553 | this.refs[key].componentWillAppear(this.handleDoneAdding.bind(this, key, 'appear')); | ||
26554 | } | ||
26555 | }, | ||
26556 | |||
26557 | handleDoneAdding: function handleDoneAdding(key, type) { | ||
26558 | var props = this.props; | ||
26559 | delete this.currentlyAnimatingKeys[key]; | ||
26560 | var currentChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props)); | ||
26561 | if (!this.isValidChildByKey(currentChildren, key)) { | ||
26562 | // exclusive will not need this | ||
26563 | this.performLeave(key); | ||
26564 | } else { | ||
26565 | if (type === 'appear') { | ||
26566 | if (_util2['default'].allowAppearCallback(props)) { | ||
26567 | props.onAppear(key); | ||
26568 | props.onEnd(key, true); | ||
26569 | } | ||
26570 | } else { | ||
26571 | if (_util2['default'].allowEnterCallback(props)) { | ||
26572 | props.onEnter(key); | ||
26573 | props.onEnd(key, true); | ||
26574 | } | ||
26575 | } | ||
26576 | } | ||
26577 | }, | ||
26578 | |||
26579 | performLeave: function performLeave(key) { | ||
26580 | // may already remove by exclusive | ||
26581 | if (this.refs[key]) { | ||
26582 | this.currentlyAnimatingKeys[key] = true; | ||
26583 | this.refs[key].componentWillLeave(this.handleDoneLeaving.bind(this, key)); | ||
26584 | } | ||
26585 | }, | ||
26586 | |||
26587 | handleDoneLeaving: function handleDoneLeaving(key) { | ||
26588 | var props = this.props; | ||
26589 | delete this.currentlyAnimatingKeys[key]; | ||
26590 | var currentChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props)); | ||
26591 | // in case state change is too fast | ||
26592 | if (this.isValidChildByKey(currentChildren, key)) { | ||
26593 | this.performEnter(key); | ||
26594 | } else { | ||
26595 | if (_util2['default'].allowLeaveCallback(props)) { | ||
26596 | props.onLeave(key); | ||
26597 | props.onEnd(key, false); | ||
26598 | } | ||
26599 | if (this.isMounted() && !(0, _ChildrenUtils.isSameChildren)(this.state.children, currentChildren, props.showProp)) { | ||
26600 | this.setState({ | ||
26601 | children: currentChildren | ||
26602 | }); | ||
26603 | } | ||
26604 | } | ||
26605 | }, | ||
26606 | |||
26607 | isValidChildByKey: function isValidChildByKey(currentChildren, key) { | ||
26608 | var showProp = this.props.showProp; | ||
26609 | if (showProp) { | ||
26610 | return (0, _ChildrenUtils.findShownChildInChildrenByKey)(currentChildren, key, showProp); | ||
26611 | } | ||
26612 | return (0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, key); | ||
26613 | }, | ||
26614 | |||
26615 | stop: function stop(key) { | ||
26616 | delete this.currentlyAnimatingKeys[key]; | ||
26617 | var component = this.refs[key]; | ||
26618 | if (component) { | ||
26619 | component.stop(); | ||
26620 | } | ||
26621 | }, | ||
26622 | |||
26623 | render: function render() { | ||
26624 | var props = this.props; | ||
26625 | var stateChildren = this.state.children; | ||
26626 | var children = null; | ||
26627 | if (stateChildren) { | ||
26628 | children = stateChildren.map(function (child) { | ||
26629 | if (!child.key) { | ||
26630 | throw new Error('must set key for <rc-animate> children'); | ||
26631 | } | ||
26632 | return _react2['default'].createElement( | ||
26633 | _AnimateChild2['default'], | ||
26634 | { | ||
26635 | key: child.key, | ||
26636 | ref: child.key, | ||
26637 | animation: props.animation, | ||
26638 | transitionName: props.transitionName, | ||
26639 | transitionEnter: props.transitionEnter, | ||
26640 | transitionAppear: props.transitionAppear, | ||
26641 | transitionLeave: props.transitionLeave }, | ||
26642 | child | ||
26643 | ); | ||
26644 | }); | ||
26645 | } | ||
26646 | var Component = props.component; | ||
26647 | if (Component) { | ||
26648 | return _react2['default'].createElement( | ||
26649 | Component, | ||
26650 | this.props, | ||
26651 | children | ||
26652 | ); | ||
26653 | } | ||
26654 | return children[0] || null; | ||
26655 | } | ||
26656 | }); | ||
26657 | |||
26658 | exports['default'] = Animate; | ||
26659 | module.exports = exports['default']; | ||
26660 | |||
26661 | /***/ }, | ||
26662 | /* 211 */ | ||
26663 | /***/ function(module, exports, __webpack_require__) { | ||
26664 | |||
26665 | 'use strict'; | ||
26666 | |||
26667 | Object.defineProperty(exports, '__esModule', { | ||
26668 | value: true | ||
26669 | }); | ||
26670 | exports.toArrayChildren = toArrayChildren; | ||
26671 | exports.findChildInChildrenByKey = findChildInChildrenByKey; | ||
26672 | exports.findShownChildInChildrenByKey = findShownChildInChildrenByKey; | ||
26673 | exports.findHiddenChildInChildrenByKey = findHiddenChildInChildrenByKey; | ||
26674 | exports.isSameChildren = isSameChildren; | ||
26675 | exports.mergeChildren = mergeChildren; | ||
26676 | |||
26677 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
26678 | |||
26679 | var _react = __webpack_require__(3); | ||
26680 | |||
26681 | var _react2 = _interopRequireDefault(_react); | ||
26682 | |||
26683 | function toArrayChildren(children) { | ||
26684 | var ret = []; | ||
26685 | _react2['default'].Children.forEach(children, function (child) { | ||
26686 | ret.push(child); | ||
26687 | }); | ||
26688 | return ret; | ||
26689 | } | ||
26690 | |||
26691 | function findChildInChildrenByKey(children, key) { | ||
26692 | var ret = null; | ||
26693 | if (children) { | ||
26694 | children.forEach(function (child) { | ||
26695 | if (ret) { | ||
26696 | return; | ||
26697 | } | ||
26698 | if (child.key === key) { | ||
26699 | ret = child; | ||
26700 | } | ||
26701 | }); | ||
26702 | } | ||
26703 | return ret; | ||
26704 | } | ||
26705 | |||
26706 | function findShownChildInChildrenByKey(children, key, showProp) { | ||
26707 | var ret = null; | ||
26708 | if (children) { | ||
26709 | children.forEach(function (child) { | ||
26710 | if (child.key === key && child.props[showProp]) { | ||
26711 | if (ret) { | ||
26712 | throw new Error('two child with same key for <rc-animate> children'); | ||
26713 | } | ||
26714 | ret = child; | ||
26715 | } | ||
26716 | }); | ||
26717 | } | ||
26718 | return ret; | ||
26719 | } | ||
26720 | |||
26721 | function findHiddenChildInChildrenByKey(children, key, showProp) { | ||
26722 | var found = 0; | ||
26723 | if (children) { | ||
26724 | children.forEach(function (child) { | ||
26725 | if (found) { | ||
26726 | return; | ||
26727 | } | ||
26728 | found = child.key === key && !child.props[showProp]; | ||
26729 | }); | ||
26730 | } | ||
26731 | return found; | ||
26732 | } | ||
26733 | |||
26734 | function isSameChildren(c1, c2, showProp) { | ||
26735 | var same = c1.length === c2.length; | ||
26736 | if (same) { | ||
26737 | c1.forEach(function (child, index) { | ||
26738 | var child2 = c2[index]; | ||
26739 | if (child.key !== child2.key) { | ||
26740 | same = false; | ||
26741 | } else if (showProp && child.props[showProp] !== child2.props[showProp]) { | ||
26742 | same = false; | ||
26743 | } | ||
26744 | }); | ||
26745 | } | ||
26746 | return same; | ||
26747 | } | ||
26748 | |||
26749 | function mergeChildren(prev, next) { | ||
26750 | var ret = []; | ||
26751 | |||
26752 | // For each key of `next`, the list of keys to insert before that key in | ||
26753 | // the combined list | ||
26754 | var nextChildrenPending = {}; | ||
26755 | var pendingChildren = []; | ||
26756 | prev.forEach(function (child) { | ||
26757 | if (findChildInChildrenByKey(next, child.key)) { | ||
26758 | if (pendingChildren.length) { | ||
26759 | nextChildrenPending[child.key] = pendingChildren; | ||
26760 | pendingChildren = []; | ||
26761 | } | ||
26762 | } else { | ||
26763 | pendingChildren.push(child); | ||
26764 | } | ||
26765 | }); | ||
26766 | |||
26767 | next.forEach(function (child) { | ||
26768 | if (nextChildrenPending.hasOwnProperty(child.key)) { | ||
26769 | ret = ret.concat(nextChildrenPending[child.key]); | ||
26770 | } | ||
26771 | ret.push(child); | ||
26772 | }); | ||
26773 | |||
26774 | ret = ret.concat(pendingChildren); | ||
26775 | |||
26776 | return ret; | ||
26777 | } | ||
26778 | |||
26779 | /***/ }, | ||
26780 | /* 212 */ | ||
26781 | /***/ function(module, exports, __webpack_require__) { | ||
26782 | |||
26783 | 'use strict'; | ||
26784 | |||
26785 | Object.defineProperty(exports, '__esModule', { | ||
26786 | value: true | ||
26787 | }); | ||
26788 | |||
26789 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
26790 | |||
26791 | var _react = __webpack_require__(3); | ||
26792 | |||
26793 | var _react2 = _interopRequireDefault(_react); | ||
26794 | |||
26795 | var _reactDom = __webpack_require__(160); | ||
26796 | |||
26797 | var _reactDom2 = _interopRequireDefault(_reactDom); | ||
26798 | |||
26799 | var _cssAnimation = __webpack_require__(213); | ||
26800 | |||
26801 | var _cssAnimation2 = _interopRequireDefault(_cssAnimation); | ||
26802 | |||
26803 | var _util = __webpack_require__(216); | ||
26804 | |||
26805 | var _util2 = _interopRequireDefault(_util); | ||
26806 | |||
26807 | var transitionMap = { | ||
26808 | enter: 'transitionEnter', | ||
26809 | appear: 'transitionAppear', | ||
26810 | leave: 'transitionLeave' | ||
26811 | }; | ||
26812 | |||
26813 | var AnimateChild = _react2['default'].createClass({ | ||
26814 | displayName: 'AnimateChild', | ||
26815 | |||
26816 | propTypes: { | ||
26817 | children: _react2['default'].PropTypes.any | ||
26818 | }, | ||
26819 | |||
26820 | componentWillUnmount: function componentWillUnmount() { | ||
26821 | this.stop(); | ||
26822 | }, | ||
26823 | |||
26824 | componentWillEnter: function componentWillEnter(done) { | ||
26825 | if (_util2['default'].isEnterSupported(this.props)) { | ||
26826 | this.transition('enter', done); | ||
26827 | } else { | ||
26828 | done(); | ||
26829 | } | ||
26830 | }, | ||
26831 | |||
26832 | componentWillAppear: function componentWillAppear(done) { | ||
26833 | if (_util2['default'].isAppearSupported(this.props)) { | ||
26834 | this.transition('appear', done); | ||
26835 | } else { | ||
26836 | done(); | ||
26837 | } | ||
26838 | }, | ||
26839 | |||
26840 | componentWillLeave: function componentWillLeave(done) { | ||
26841 | if (_util2['default'].isLeaveSupported(this.props)) { | ||
26842 | this.transition('leave', done); | ||
26843 | } else { | ||
26844 | done(); | ||
26845 | } | ||
26846 | }, | ||
26847 | |||
26848 | transition: function transition(animationType, finishCallback) { | ||
26849 | var _this = this; | ||
26850 | |||
26851 | var node = _reactDom2['default'].findDOMNode(this); | ||
26852 | var props = this.props; | ||
26853 | var transitionName = props.transitionName; | ||
26854 | this.stop(); | ||
26855 | var end = function end() { | ||
26856 | _this.stopper = null; | ||
26857 | finishCallback(); | ||
26858 | }; | ||
26859 | if ((_cssAnimation.isCssAnimationSupported || !props.animation[animationType]) && transitionName && props[transitionMap[animationType]]) { | ||
26860 | this.stopper = (0, _cssAnimation2['default'])(node, transitionName + '-' + animationType, end); | ||
26861 | } else { | ||
26862 | this.stopper = props.animation[animationType](node, end); | ||
26863 | } | ||
26864 | }, | ||
26865 | |||
26866 | stop: function stop() { | ||
26867 | var stopper = this.stopper; | ||
26868 | if (stopper) { | ||
26869 | this.stopper = null; | ||
26870 | stopper.stop(); | ||
26871 | } | ||
26872 | }, | ||
26873 | |||
26874 | render: function render() { | ||
26875 | return this.props.children; | ||
26876 | } | ||
26877 | }); | ||
26878 | |||
26879 | exports['default'] = AnimateChild; | ||
26880 | module.exports = exports['default']; | ||
26881 | |||
26882 | /***/ }, | ||
26883 | /* 213 */ | ||
26884 | /***/ function(module, exports, __webpack_require__) { | ||
26885 | |||
26886 | 'use strict'; | ||
26887 | |||
26888 | var Event = __webpack_require__(214); | ||
26889 | var Css = __webpack_require__(215); | ||
26890 | var isCssAnimationSupported = Event.endEvents.length !== 0; | ||
26891 | |||
26892 | function getDuration(node, name) { | ||
26893 | var style = window.getComputedStyle(node); | ||
26894 | var prefixes = ['-webkit-', '-moz-', '-o-', 'ms-', '']; | ||
26895 | var ret = ''; | ||
26896 | for (var i = 0; i < prefixes.length; i++) { | ||
26897 | ret = style.getPropertyValue(prefixes[i] + name); | ||
26898 | if (ret) { | ||
26899 | break; | ||
26900 | } | ||
26901 | } | ||
26902 | return ret; | ||
26903 | } | ||
26904 | |||
26905 | function fixBrowserByTimeout(node) { | ||
26906 | if (isCssAnimationSupported) { | ||
26907 | var transitionDuration = parseFloat(getDuration(node, 'transition-duration')) || 0; | ||
26908 | var animationDuration = parseFloat(getDuration(node, 'animation-duration')) || 0; | ||
26909 | var time = Math.max(transitionDuration, animationDuration); | ||
26910 | // sometimes, browser bug | ||
26911 | node.rcEndAnimTimeout = setTimeout(function () { | ||
26912 | node.rcEndAnimTimeout = null; | ||
26913 | if (node.rcEndListener) { | ||
26914 | node.rcEndListener(); | ||
26915 | } | ||
26916 | }, time * 1000 + 200); | ||
26917 | } | ||
26918 | } | ||
26919 | |||
26920 | function clearBrowserBugTimeout(node) { | ||
26921 | if (node.rcEndAnimTimeout) { | ||
26922 | clearTimeout(node.rcEndAnimTimeout); | ||
26923 | node.rcEndAnimTimeout = null; | ||
26924 | } | ||
26925 | } | ||
26926 | |||
26927 | var cssAnimation = function cssAnimation(node, transitionName, callback) { | ||
26928 | var className = transitionName; | ||
26929 | var activeClassName = className + '-active'; | ||
26930 | |||
26931 | if (node.rcEndListener) { | ||
26932 | node.rcEndListener(); | ||
26933 | } | ||
26934 | |||
26935 | node.rcEndListener = function (e) { | ||
26936 | if (e && e.target !== node) { | ||
26937 | return; | ||
26938 | } | ||
26939 | |||
26940 | if (node.rcAnimTimeout) { | ||
26941 | clearTimeout(node.rcAnimTimeout); | ||
26942 | node.rcAnimTimeout = null; | ||
26943 | } | ||
26944 | |||
26945 | clearBrowserBugTimeout(node); | ||
26946 | |||
26947 | Css.removeClass(node, className); | ||
26948 | Css.removeClass(node, activeClassName); | ||
26949 | |||
26950 | Event.removeEndEventListener(node, node.rcEndListener); | ||
26951 | node.rcEndListener = null; | ||
26952 | |||
26953 | // Usually this optional callback is used for informing an owner of | ||
26954 | // a leave animation and telling it to remove the child. | ||
26955 | if (callback) { | ||
26956 | callback(); | ||
26957 | } | ||
26958 | }; | ||
26959 | |||
26960 | Event.addEndEventListener(node, node.rcEndListener); | ||
26961 | |||
26962 | Css.addClass(node, className); | ||
26963 | |||
26964 | node.rcAnimTimeout = setTimeout(function () { | ||
26965 | node.rcAnimTimeout = null; | ||
26966 | Css.addClass(node, activeClassName); | ||
26967 | fixBrowserByTimeout(node); | ||
26968 | }, 0); | ||
26969 | |||
26970 | return { | ||
26971 | stop: function stop() { | ||
26972 | if (node.rcEndListener) { | ||
26973 | node.rcEndListener(); | ||
26974 | } | ||
26975 | } | ||
26976 | }; | ||
26977 | }; | ||
26978 | |||
26979 | cssAnimation.style = function (node, style, callback) { | ||
26980 | if (node.rcEndListener) { | ||
26981 | node.rcEndListener(); | ||
26982 | } | ||
26983 | |||
26984 | node.rcEndListener = function (e) { | ||
26985 | if (e && e.target !== node) { | ||
26986 | return; | ||
26987 | } | ||
26988 | |||
26989 | if (node.rcAnimTimeout) { | ||
26990 | clearTimeout(node.rcAnimTimeout); | ||
26991 | node.rcAnimTimeout = null; | ||
26992 | } | ||
26993 | |||
26994 | clearBrowserBugTimeout(node); | ||
26995 | |||
26996 | Event.removeEndEventListener(node, node.rcEndListener); | ||
26997 | node.rcEndListener = null; | ||
26998 | |||
26999 | // Usually this optional callback is used for informing an owner of | ||
27000 | // a leave animation and telling it to remove the child. | ||
27001 | if (callback) { | ||
27002 | callback(); | ||
27003 | } | ||
27004 | }; | ||
27005 | |||
27006 | Event.addEndEventListener(node, node.rcEndListener); | ||
27007 | |||
27008 | node.rcAnimTimeout = setTimeout(function () { | ||
27009 | for (var s in style) { | ||
27010 | if (style.hasOwnProperty(s)) { | ||
27011 | node.style[s] = style[s]; | ||
27012 | } | ||
27013 | } | ||
27014 | node.rcAnimTimeout = null; | ||
27015 | fixBrowserByTimeout(node); | ||
27016 | }, 0); | ||
27017 | }; | ||
27018 | |||
27019 | cssAnimation.setTransition = function (node, p, value) { | ||
27020 | var property = p; | ||
27021 | var v = value; | ||
27022 | if (value === undefined) { | ||
27023 | v = property; | ||
27024 | property = ''; | ||
27025 | } | ||
27026 | property = property || ''; | ||
27027 | ['Webkit', 'Moz', 'O', | ||
27028 | // ms is special .... ! | ||
27029 | 'ms'].forEach(function (prefix) { | ||
27030 | node.style[prefix + 'Transition' + property] = v; | ||
27031 | }); | ||
27032 | }; | ||
27033 | |||
27034 | cssAnimation.addClass = Css.addClass; | ||
27035 | cssAnimation.removeClass = Css.removeClass; | ||
27036 | cssAnimation.isCssAnimationSupported = isCssAnimationSupported; | ||
27037 | |||
27038 | module.exports = cssAnimation; | ||
27039 | |||
27040 | /***/ }, | ||
27041 | /* 214 */ | ||
27042 | /***/ function(module, exports) { | ||
27043 | |||
27044 | 'use strict'; | ||
27045 | |||
27046 | var EVENT_NAME_MAP = { | ||
27047 | transitionend: { | ||
27048 | transition: 'transitionend', | ||
27049 | WebkitTransition: 'webkitTransitionEnd', | ||
27050 | MozTransition: 'mozTransitionEnd', | ||
27051 | OTransition: 'oTransitionEnd', | ||
27052 | msTransition: 'MSTransitionEnd' | ||
27053 | }, | ||
27054 | |||
27055 | animationend: { | ||
27056 | animation: 'animationend', | ||
27057 | WebkitAnimation: 'webkitAnimationEnd', | ||
27058 | MozAnimation: 'mozAnimationEnd', | ||
27059 | OAnimation: 'oAnimationEnd', | ||
27060 | msAnimation: 'MSAnimationEnd' | ||
27061 | } | ||
27062 | }; | ||
27063 | |||
27064 | var endEvents = []; | ||
27065 | |||
27066 | function detectEvents() { | ||
27067 | var testEl = document.createElement('div'); | ||
27068 | var style = testEl.style; | ||
27069 | |||
27070 | if (!('AnimationEvent' in window)) { | ||
27071 | delete EVENT_NAME_MAP.animationend.animation; | ||
27072 | } | ||
27073 | |||
27074 | if (!('TransitionEvent' in window)) { | ||
27075 | delete EVENT_NAME_MAP.transitionend.transition; | ||
27076 | } | ||
27077 | |||
27078 | for (var baseEventName in EVENT_NAME_MAP) { | ||
27079 | if (EVENT_NAME_MAP.hasOwnProperty(baseEventName)) { | ||
27080 | var baseEvents = EVENT_NAME_MAP[baseEventName]; | ||
27081 | for (var styleName in baseEvents) { | ||
27082 | if (styleName in style) { | ||
27083 | endEvents.push(baseEvents[styleName]); | ||
27084 | break; | ||
27085 | } | ||
27086 | } | ||
27087 | } | ||
27088 | } | ||
27089 | } | ||
27090 | |||
27091 | if (typeof window !== 'undefined') { | ||
27092 | detectEvents(); | ||
27093 | } | ||
27094 | |||
27095 | function addEventListener(node, eventName, eventListener) { | ||
27096 | node.addEventListener(eventName, eventListener, false); | ||
27097 | } | ||
27098 | |||
27099 | function removeEventListener(node, eventName, eventListener) { | ||
27100 | node.removeEventListener(eventName, eventListener, false); | ||
27101 | } | ||
27102 | |||
27103 | var TransitionEvents = { | ||
27104 | addEndEventListener: function addEndEventListener(node, eventListener) { | ||
27105 | if (endEvents.length === 0) { | ||
27106 | window.setTimeout(eventListener, 0); | ||
27107 | return; | ||
27108 | } | ||
27109 | endEvents.forEach(function (endEvent) { | ||
27110 | addEventListener(node, endEvent, eventListener); | ||
27111 | }); | ||
27112 | }, | ||
27113 | |||
27114 | endEvents: endEvents, | ||
27115 | |||
27116 | removeEndEventListener: function removeEndEventListener(node, eventListener) { | ||
27117 | if (endEvents.length === 0) { | ||
27118 | return; | ||
27119 | } | ||
27120 | endEvents.forEach(function (endEvent) { | ||
27121 | removeEventListener(node, endEvent, eventListener); | ||
27122 | }); | ||
27123 | } | ||
27124 | }; | ||
27125 | |||
27126 | module.exports = TransitionEvents; | ||
27127 | |||
27128 | /***/ }, | ||
27129 | /* 215 */ | ||
27130 | /***/ function(module, exports) { | ||
27131 | |||
27132 | 'use strict'; | ||
27133 | |||
27134 | var SPACE = ' '; | ||
27135 | var RE_CLASS = /[\n\t\r]/g; | ||
27136 | |||
27137 | function norm(elemClass) { | ||
27138 | return (SPACE + elemClass + SPACE).replace(RE_CLASS, SPACE); | ||
27139 | } | ||
27140 | |||
27141 | module.exports = { | ||
27142 | addClass: function addClass(elem, className) { | ||
27143 | elem.className += ' ' + className; | ||
27144 | }, | ||
27145 | |||
27146 | removeClass: function removeClass(elem, n) { | ||
27147 | var elemClass = elem.className.trim(); | ||
27148 | var className = norm(elemClass); | ||
27149 | var needle = n.trim(); | ||
27150 | needle = SPACE + needle + SPACE; | ||
27151 | // 一个 cls 有可能多次出现:'link link2 link link3 link' | ||
27152 | while (className.indexOf(needle) >= 0) { | ||
27153 | className = className.replace(needle, SPACE); | ||
27154 | } | ||
27155 | elem.className = className.trim(); | ||
27156 | } | ||
27157 | }; | ||
27158 | |||
27159 | /***/ }, | ||
27160 | /* 216 */ | ||
27161 | /***/ function(module, exports) { | ||
27162 | |||
27163 | "use strict"; | ||
27164 | |||
27165 | Object.defineProperty(exports, "__esModule", { | ||
27166 | value: true | ||
27167 | }); | ||
27168 | var util = { | ||
27169 | isAppearSupported: function isAppearSupported(props) { | ||
27170 | return props.transitionName && props.transitionAppear || props.animation.appear; | ||
27171 | }, | ||
27172 | isEnterSupported: function isEnterSupported(props) { | ||
27173 | return props.transitionName && props.transitionEnter || props.animation.enter; | ||
27174 | }, | ||
27175 | isLeaveSupported: function isLeaveSupported(props) { | ||
27176 | return props.transitionName && props.transitionLeave || props.animation.leave; | ||
27177 | }, | ||
27178 | |||
27179 | allowAppearCallback: function allowAppearCallback(props) { | ||
27180 | return props.transitionAppear || props.animation.appear; | ||
27181 | }, | ||
27182 | allowEnterCallback: function allowEnterCallback(props) { | ||
27183 | return props.transitionEnter || props.animation.enter; | ||
27184 | }, | ||
27185 | allowLeaveCallback: function allowLeaveCallback(props) { | ||
27186 | return props.transitionLeave || props.animation.leave; | ||
27187 | } | ||
27188 | }; | ||
27189 | exports["default"] = util; | ||
27190 | module.exports = exports["default"]; | ||
27191 | |||
27192 | /***/ }, | ||
27193 | /* 217 */ | ||
27194 | /***/ function(module, exports, __webpack_require__) { | ||
27195 | |||
27196 | 'use strict'; | ||
27197 | |||
27198 | Object.defineProperty(exports, '__esModule', { | ||
27199 | value: true | ||
27200 | }); | ||
27201 | |||
27202 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
27203 | |||
27204 | var _react = __webpack_require__(3); | ||
27205 | |||
27206 | var _react2 = _interopRequireDefault(_react); | ||
27207 | |||
27208 | var PopupInner = _react2['default'].createClass({ | ||
27209 | displayName: 'PopupInner', | ||
27210 | |||
27211 | propTypes: { | ||
27212 | hiddenClassName: _react.PropTypes.string, | ||
27213 | className: _react.PropTypes.string, | ||
27214 | onMouseEnter: _react.PropTypes.func, | ||
27215 | onMouseLeave: _react.PropTypes.func, | ||
27216 | children: _react.PropTypes.any | ||
27217 | }, | ||
27218 | render: function render() { | ||
27219 | var props = this.props; | ||
27220 | var className = props.className; | ||
27221 | if (!props.visible) { | ||
27222 | className += ' ' + props.hiddenClassName; | ||
27223 | } | ||
27224 | return _react2['default'].createElement( | ||
27225 | 'div', | ||
27226 | { className: className, | ||
27227 | onMouseEnter: props.onMouseEnter, | ||
27228 | onMouseLeave: props.onMouseLeave, | ||
27229 | style: props.style }, | ||
27230 | props.children | ||
27231 | ); | ||
27232 | } | ||
27233 | }); | ||
27234 | |||
27235 | exports['default'] = PopupInner; | ||
27236 | module.exports = exports['default']; | ||
27237 | |||
27238 | /***/ }, | ||
27239 | /* 218 */ | ||
27240 | /***/ function(module, exports, __webpack_require__) { | ||
27241 | |||
27242 | 'use strict'; | ||
27243 | |||
27244 | Object.defineProperty(exports, '__esModule', { | ||
27245 | value: true | ||
27246 | }); | ||
27247 | exports.getAlignFromPlacement = getAlignFromPlacement; | ||
27248 | exports.getPopupClassNameFromAlign = getPopupClassNameFromAlign; | ||
27249 | |||
27250 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
27251 | |||
27252 | var _objectAssign = __webpack_require__(193); | ||
27253 | |||
27254 | var _objectAssign2 = _interopRequireDefault(_objectAssign); | ||
27255 | |||
27256 | function isPointsEq(a1, a2) { | ||
27257 | return a1[0] === a2[0] && a1[1] === a2[1]; | ||
27258 | } | ||
27259 | |||
27260 | function getAlignFromPlacement(builtinPlacements, placementStr, align) { | ||
27261 | var baseAlign = builtinPlacements[placementStr] || {}; | ||
27262 | return (0, _objectAssign2['default'])({}, baseAlign, align); | ||
27263 | } | ||
27264 | |||
27265 | function getPopupClassNameFromAlign(builtinPlacements, prefixCls, align) { | ||
27266 | var points = align.points; | ||
27267 | for (var placement in builtinPlacements) { | ||
27268 | if (builtinPlacements.hasOwnProperty(placement)) { | ||
27269 | if (isPointsEq(builtinPlacements[placement].points, points)) { | ||
27270 | return prefixCls + '-placement-' + placement; | ||
27271 | } | ||
27272 | } | ||
27273 | } | ||
27274 | return ''; | ||
27275 | } | ||
27276 | |||
27277 | /***/ }, | ||
27278 | /* 219 */ | ||
27279 | /***/ function(module, exports, __webpack_require__) { | ||
27280 | |||
27281 | 'use strict'; | ||
27282 | |||
27283 | Object.defineProperty(exports, '__esModule', { | ||
27284 | value: true | ||
27285 | }); | ||
27286 | |||
27287 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
27288 | |||
27289 | var _react = __webpack_require__(3); | ||
27290 | |||
27291 | var _react2 = _interopRequireDefault(_react); | ||
27292 | |||
27293 | var _mixinCommonMixin = __webpack_require__(220); | ||
27294 | |||
27295 | var _mixinCommonMixin2 = _interopRequireDefault(_mixinCommonMixin); | ||
27296 | |||
27297 | var _Header = __webpack_require__(222); | ||
27298 | |||
27299 | var _Header2 = _interopRequireDefault(_Header); | ||
27300 | |||
27301 | var _Combobox = __webpack_require__(223); | ||
27302 | |||
27303 | var _Combobox2 = _interopRequireDefault(_Combobox); | ||
27304 | |||
27305 | function noop() {} | ||
27306 | |||
27307 | function generateOptions(length) { | ||
27308 | var arr = []; | ||
27309 | for (var i = 0; i < length; i++) { | ||
27310 | arr.push(i); | ||
27311 | } | ||
27312 | return arr; | ||
27313 | } | ||
27314 | |||
27315 | var Panel = _react2['default'].createClass({ | ||
27316 | displayName: 'Panel', | ||
27317 | |||
27318 | propTypes: { | ||
27319 | prefixCls: _react.PropTypes.string, | ||
27320 | value: _react.PropTypes.object, | ||
27321 | locale: _react.PropTypes.object, | ||
27322 | placeholder: _react.PropTypes.string, | ||
27323 | gregorianCalendarLocale: _react.PropTypes.object, | ||
27324 | formatter: _react.PropTypes.object, | ||
27325 | hourOptions: _react.PropTypes.array, | ||
27326 | minuteOptions: _react.PropTypes.array, | ||
27327 | secondOptions: _react.PropTypes.array, | ||
27328 | onChange: _react.PropTypes.func, | ||
27329 | onEsc: _react.PropTypes.func, | ||
27330 | allowEmpty: _react.PropTypes.bool, | ||
27331 | showHour: _react.PropTypes.bool, | ||
27332 | showSecond: _react.PropTypes.bool, | ||
27333 | onClear: _react.PropTypes.func | ||
27334 | }, | ||
27335 | |||
27336 | mixins: [_mixinCommonMixin2['default']], | ||
27337 | |||
27338 | getDefaultProps: function getDefaultProps() { | ||
27339 | return { | ||
27340 | hourOptions: generateOptions(24), | ||
27341 | minuteOptions: generateOptions(60), | ||
27342 | secondOptions: generateOptions(60), | ||
27343 | onChange: noop, | ||
27344 | onClear: noop | ||
27345 | }; | ||
27346 | }, | ||
27347 | |||
27348 | getInitialState: function getInitialState() { | ||
27349 | return { | ||
27350 | value: this.props.value | ||
27351 | }; | ||
27352 | }, | ||
27353 | |||
27354 | componentWillReceiveProps: function componentWillReceiveProps(nextProps) { | ||
27355 | var value = nextProps.value; | ||
27356 | if (value) { | ||
27357 | this.setState({ | ||
27358 | value: value | ||
27359 | }); | ||
27360 | } | ||
27361 | }, | ||
27362 | |||
27363 | onChange: function onChange(newValue) { | ||
27364 | this.setState({ value: newValue }); | ||
27365 | this.props.onChange(newValue); | ||
27366 | }, | ||
27367 | |||
27368 | onClear: function onClear() { | ||
27369 | this.props.onClear(); | ||
27370 | }, | ||
27371 | |||
27372 | render: function render() { | ||
27373 | var _props = this.props; | ||
27374 | var locale = _props.locale; | ||
27375 | var prefixCls = _props.prefixCls; | ||
27376 | var placeholder = _props.placeholder; | ||
27377 | var hourOptions = _props.hourOptions; | ||
27378 | var minuteOptions = _props.minuteOptions; | ||
27379 | var secondOptions = _props.secondOptions; | ||
27380 | var allowEmpty = _props.allowEmpty; | ||
27381 | var showHour = _props.showHour; | ||
27382 | var showSecond = _props.showSecond; | ||
27383 | var formatter = _props.formatter; | ||
27384 | var gregorianCalendarLocale = _props.gregorianCalendarLocale; | ||
27385 | |||
27386 | var value = this.state.value; | ||
27387 | return _react2['default'].createElement( | ||
27388 | 'div', | ||
27389 | { className: prefixCls + '-inner' }, | ||
27390 | _react2['default'].createElement(_Header2['default'], { | ||
27391 | prefixCls: prefixCls, | ||
27392 | gregorianCalendarLocale: gregorianCalendarLocale, | ||
27393 | locale: locale, | ||
27394 | value: value, | ||
27395 | onEsc: this.props.onEsc, | ||
27396 | formatter: formatter, | ||
27397 | placeholder: placeholder, | ||
27398 | hourOptions: hourOptions, | ||
27399 | minuteOptions: minuteOptions, | ||
27400 | secondOptions: secondOptions, | ||
27401 | onChange: this.onChange, | ||
27402 | onClear: this.onClear, | ||
27403 | allowEmpty: allowEmpty | ||
27404 | }), | ||
27405 | _react2['default'].createElement(_Combobox2['default'], { | ||
27406 | prefixCls: prefixCls, | ||
27407 | value: value, | ||
27408 | gregorianCalendarLocale: gregorianCalendarLocale, | ||
27409 | formatter: formatter, | ||
27410 | onChange: this.onChange, | ||
27411 | showHour: showHour, | ||
27412 | showSecond: showSecond, | ||
27413 | hourOptions: hourOptions, | ||
27414 | minuteOptions: minuteOptions, | ||
27415 | secondOptions: secondOptions | ||
27416 | }) | ||
27417 | ); | ||
27418 | } | ||
27419 | }); | ||
27420 | |||
27421 | exports['default'] = Panel; | ||
27422 | module.exports = exports['default']; | ||
27423 | |||
27424 | /***/ }, | ||
27425 | /* 220 */ | ||
27426 | /***/ function(module, exports, __webpack_require__) { | ||
27427 | |||
27428 | 'use strict'; | ||
27429 | |||
27430 | Object.defineProperty(exports, '__esModule', { | ||
27431 | value: true | ||
27432 | }); | ||
27433 | |||
27434 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
27435 | |||
27436 | var _react = __webpack_require__(3); | ||
27437 | |||
27438 | var _localeEn_US = __webpack_require__(221); | ||
27439 | |||
27440 | var _localeEn_US2 = _interopRequireDefault(_localeEn_US); | ||
27441 | |||
27442 | exports['default'] = { | ||
27443 | propTypes: { | ||
27444 | prefixCls: _react.PropTypes.string, | ||
27445 | locale: _react.PropTypes.object | ||
27446 | }, | ||
27447 | |||
27448 | getDefaultProps: function getDefaultProps() { | ||
27449 | return { | ||
27450 | prefixCls: 'rc-time-picker', | ||
27451 | locale: _localeEn_US2['default'] | ||
27452 | }; | ||
27453 | } | ||
27454 | }; | ||
27455 | module.exports = exports['default']; | ||
27456 | |||
27457 | /***/ }, | ||
27458 | /* 221 */ | ||
27459 | /***/ function(module, exports, __webpack_require__) { | ||
27460 | |||
27461 | 'use strict'; | ||
27462 | |||
27463 | Object.defineProperty(exports, '__esModule', { | ||
27464 | value: true | ||
27465 | }); | ||
27466 | |||
27467 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
27468 | |||
27469 | var _gregorianCalendarFormatLibLocaleEn_US = __webpack_require__(166); | ||
27470 | |||
27471 | var _gregorianCalendarFormatLibLocaleEn_US2 = _interopRequireDefault(_gregorianCalendarFormatLibLocaleEn_US); | ||
27472 | |||
27473 | exports['default'] = { | ||
27474 | clear: 'Clear', | ||
27475 | format: _gregorianCalendarFormatLibLocaleEn_US2['default'] | ||
27476 | }; | ||
27477 | module.exports = exports['default']; | ||
27478 | |||
27479 | /***/ }, | ||
27480 | /* 222 */ | ||
27481 | /***/ function(module, exports, __webpack_require__) { | ||
27482 | |||
27483 | 'use strict'; | ||
27484 | |||
27485 | Object.defineProperty(exports, '__esModule', { | ||
27486 | value: true | ||
27487 | }); | ||
27488 | |||
27489 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
27490 | |||
27491 | var _react = __webpack_require__(3); | ||
27492 | |||
27493 | var _react2 = _interopRequireDefault(_react); | ||
27494 | |||
27495 | var Header = _react2['default'].createClass({ | ||
27496 | displayName: 'Header', | ||
27497 | |||
27498 | propTypes: { | ||
27499 | formatter: _react.PropTypes.object, | ||
27500 | prefixCls: _react.PropTypes.string, | ||
27501 | gregorianCalendarLocale: _react.PropTypes.object, | ||
27502 | locale: _react.PropTypes.object, | ||
27503 | disabledDate: _react.PropTypes.func, | ||
27504 | placeholder: _react.PropTypes.string, | ||
27505 | value: _react.PropTypes.object, | ||
27506 | hourOptions: _react.PropTypes.array, | ||
27507 | minuteOptions: _react.PropTypes.array, | ||
27508 | secondOptions: _react.PropTypes.array, | ||
27509 | onChange: _react.PropTypes.func, | ||
27510 | onClear: _react.PropTypes.func, | ||
27511 | onEsc: _react.PropTypes.func, | ||
27512 | allowEmpty: _react.PropTypes.bool | ||
27513 | }, | ||
27514 | |||
27515 | getInitialState: function getInitialState() { | ||
27516 | var value = this.props.value; | ||
27517 | return { | ||
27518 | str: value && this.props.formatter.format(value) || '', | ||
27519 | invalid: false | ||
27520 | }; | ||
27521 | }, | ||
27522 | |||
27523 | componentDidMount: function componentDidMount() { | ||
27524 | var _this = this; | ||
27525 | |||
27526 | this.timer = setTimeout(function () { | ||
27527 | _this.refs.input.focus(); | ||
27528 | }, 0); | ||
27529 | }, | ||
27530 | |||
27531 | componentWillReceiveProps: function componentWillReceiveProps(nextProps) { | ||
27532 | var value = nextProps.value; | ||
27533 | this.setState({ | ||
27534 | str: value && nextProps.formatter.format(value) || '', | ||
27535 | invalid: false | ||
27536 | }); | ||
27537 | }, | ||
27538 | |||
27539 | componentWillUnmount: function componentWillUnmount() { | ||
27540 | clearTimeout(this.timer); | ||
27541 | }, | ||
27542 | |||
27543 | onInputChange: function onInputChange(event) { | ||
27544 | var str = event.target.value; | ||
27545 | this.setState({ | ||
27546 | str: str | ||
27547 | }); | ||
27548 | var value = null; | ||
27549 | var _props = this.props; | ||
27550 | var formatter = _props.formatter; | ||
27551 | var gregorianCalendarLocale = _props.gregorianCalendarLocale; | ||
27552 | var hourOptions = _props.hourOptions; | ||
27553 | var minuteOptions = _props.minuteOptions; | ||
27554 | var secondOptions = _props.secondOptions; | ||
27555 | var onChange = _props.onChange; | ||
27556 | var allowEmpty = _props.allowEmpty; | ||
27557 | |||
27558 | if (str) { | ||
27559 | var originalValue = this.props.value; | ||
27560 | try { | ||
27561 | value = formatter.parse(str, { | ||
27562 | locale: gregorianCalendarLocale, | ||
27563 | obeyCount: true | ||
27564 | }); | ||
27565 | } catch (ex) { | ||
27566 | this.setState({ | ||
27567 | invalid: true | ||
27568 | }); | ||
27569 | return; | ||
27570 | } | ||
27571 | |||
27572 | if (value) { | ||
27573 | if (hourOptions.indexOf(value.getHourOfDay()) < 0 || minuteOptions.indexOf(value.getMinutes()) < 0 || secondOptions.indexOf(value.getSeconds()) < 0) { | ||
27574 | this.setState({ | ||
27575 | invalid: true | ||
27576 | }); | ||
27577 | return; | ||
27578 | } | ||
27579 | |||
27580 | if (originalValue && value) { | ||
27581 | if (originalValue.getHourOfDay() !== value.getHourOfDay() || originalValue.getMinutes() !== value.getMinutes() || originalValue.getSeconds() !== value.getSeconds()) { | ||
27582 | onChange(value); | ||
27583 | } | ||
27584 | } else if (originalValue !== value) { | ||
27585 | onChange(value); | ||
27586 | } | ||
27587 | } else { | ||
27588 | this.setState({ | ||
27589 | invalid: true | ||
27590 | }); | ||
27591 | return; | ||
27592 | } | ||
27593 | } else if (allowEmpty) { | ||
27594 | onChange(null); | ||
27595 | } else { | ||
27596 | this.setState({ | ||
27597 | invalid: true | ||
27598 | }); | ||
27599 | return; | ||
27600 | } | ||
27601 | |||
27602 | this.setState({ | ||
27603 | invalid: false | ||
27604 | }); | ||
27605 | }, | ||
27606 | |||
27607 | onKeyDown: function onKeyDown(e) { | ||
27608 | if (e.keyCode === 27) { | ||
27609 | this.props.onEsc(); | ||
27610 | } | ||
27611 | }, | ||
27612 | |||
27613 | onClear: function onClear() { | ||
27614 | this.setState({ str: '' }); | ||
27615 | this.props.onClear(); | ||
27616 | }, | ||
27617 | |||
27618 | getClearButton: function getClearButton() { | ||
27619 | var _props2 = this.props; | ||
27620 | var locale = _props2.locale; | ||
27621 | var prefixCls = _props2.prefixCls; | ||
27622 | var allowEmpty = _props2.allowEmpty; | ||
27623 | |||
27624 | if (!allowEmpty) { | ||
27625 | return null; | ||
27626 | } | ||
27627 | return _react2['default'].createElement('a', { className: prefixCls + '-clear-btn', role: 'button', title: locale.clear, onMouseDown: this.onClear }); | ||
27628 | }, | ||
27629 | |||
27630 | getInput: function getInput() { | ||
27631 | var _props3 = this.props; | ||
27632 | var prefixCls = _props3.prefixCls; | ||
27633 | var placeholder = _props3.placeholder; | ||
27634 | var _state = this.state; | ||
27635 | var invalid = _state.invalid; | ||
27636 | var str = _state.str; | ||
27637 | |||
27638 | var invalidClass = invalid ? prefixCls + '-input-invalid' : ''; | ||
27639 | return _react2['default'].createElement('input', { className: prefixCls + '-input ' + invalidClass, | ||
27640 | ref: 'input', | ||
27641 | onKeyDown: this.onKeyDown, | ||
27642 | value: str, | ||
27643 | placeholder: placeholder, onChange: this.onInputChange }); | ||
27644 | }, | ||
27645 | |||
27646 | render: function render() { | ||
27647 | var prefixCls = this.props.prefixCls; | ||
27648 | |||
27649 | return _react2['default'].createElement( | ||
27650 | 'div', | ||
27651 | { className: prefixCls + '-input-wrap' }, | ||
27652 | this.getInput(), | ||
27653 | this.getClearButton() | ||
27654 | ); | ||
27655 | } | ||
27656 | }); | ||
27657 | |||
27658 | exports['default'] = Header; | ||
27659 | module.exports = exports['default']; | ||
27660 | |||
27661 | /***/ }, | ||
27662 | /* 223 */ | ||
27663 | /***/ function(module, exports, __webpack_require__) { | ||
27664 | |||
27665 | 'use strict'; | ||
27666 | |||
27667 | Object.defineProperty(exports, '__esModule', { | ||
27668 | value: true | ||
27669 | }); | ||
27670 | |||
27671 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
27672 | |||
27673 | var _react = __webpack_require__(3); | ||
27674 | |||
27675 | var _react2 = _interopRequireDefault(_react); | ||
27676 | |||
27677 | var _Select = __webpack_require__(224); | ||
27678 | |||
27679 | var _Select2 = _interopRequireDefault(_Select); | ||
27680 | |||
27681 | var _gregorianCalendar = __webpack_require__(161); | ||
27682 | |||
27683 | var _gregorianCalendar2 = _interopRequireDefault(_gregorianCalendar); | ||
27684 | |||
27685 | var formatOption = function formatOption(option) { | ||
27686 | if (option < 10) { | ||
27687 | return '0' + option; | ||
27688 | } | ||
27689 | return '' + option; | ||
27690 | }; | ||
27691 | |||
27692 | var Combobox = _react2['default'].createClass({ | ||
27693 | displayName: 'Combobox', | ||
27694 | |||
27695 | propTypes: { | ||
27696 | formatter: _react.PropTypes.object, | ||
27697 | prefixCls: _react.PropTypes.string, | ||
27698 | value: _react.PropTypes.object, | ||
27699 | onChange: _react.PropTypes.func, | ||
27700 | showHour: _react.PropTypes.bool, | ||
27701 | gregorianCalendarLocale: _react.PropTypes.object, | ||
27702 | showSecond: _react.PropTypes.bool, | ||
27703 | hourOptions: _react.PropTypes.array, | ||
27704 | minuteOptions: _react.PropTypes.array, | ||
27705 | secondOptions: _react.PropTypes.array | ||
27706 | }, | ||
27707 | |||
27708 | onItemChange: function onItemChange(type, itemValue) { | ||
27709 | var onChange = this.props.onChange; | ||
27710 | |||
27711 | var value = this.props.value; | ||
27712 | if (value) { | ||
27713 | value = value.clone(); | ||
27714 | } else { | ||
27715 | value = this.getNow().clone(); | ||
27716 | } | ||
27717 | if (type === 'hour') { | ||
27718 | value.setHourOfDay(itemValue); | ||
27719 | } else if (type === 'minute') { | ||
27720 | value.setMinutes(itemValue); | ||
27721 | } else { | ||
27722 | value.setSeconds(itemValue); | ||
27723 | } | ||
27724 | onChange(value); | ||
27725 | }, | ||
27726 | |||
27727 | getHourSelect: function getHourSelect(hour) { | ||
27728 | var _props = this.props; | ||
27729 | var prefixCls = _props.prefixCls; | ||
27730 | var hourOptions = _props.hourOptions; | ||
27731 | var showHour = _props.showHour; | ||
27732 | |||
27733 | if (!showHour) { | ||
27734 | return null; | ||
27735 | } | ||
27736 | return _react2['default'].createElement(_Select2['default'], { | ||
27737 | prefixCls: prefixCls, | ||
27738 | options: hourOptions.map(function (option) { | ||
27739 | return formatOption(option); | ||
27740 | }), | ||
27741 | selectedIndex: hourOptions.indexOf(hour), | ||
27742 | type: 'hour', | ||
27743 | onSelect: this.onItemChange | ||
27744 | }); | ||
27745 | }, | ||
27746 | |||
27747 | getMinuteSelect: function getMinuteSelect(minute) { | ||
27748 | var _props2 = this.props; | ||
27749 | var prefixCls = _props2.prefixCls; | ||
27750 | var minuteOptions = _props2.minuteOptions; | ||
27751 | |||
27752 | return _react2['default'].createElement(_Select2['default'], { | ||
27753 | prefixCls: prefixCls, | ||
27754 | options: minuteOptions.map(function (option) { | ||
27755 | return formatOption(option); | ||
27756 | }), | ||
27757 | selectedIndex: minuteOptions.indexOf(minute), | ||
27758 | type: 'minute', | ||
27759 | onSelect: this.onItemChange | ||
27760 | }); | ||
27761 | }, | ||
27762 | |||
27763 | getSectionSelect: function getSectionSelect(second) { | ||
27764 | var _props3 = this.props; | ||
27765 | var prefixCls = _props3.prefixCls; | ||
27766 | var secondOptions = _props3.secondOptions; | ||
27767 | var showSecond = _props3.showSecond; | ||
27768 | |||
27769 | if (!showSecond) { | ||
27770 | return null; | ||
27771 | } | ||
27772 | return _react2['default'].createElement(_Select2['default'], { | ||
27773 | prefixCls: prefixCls, | ||
27774 | options: secondOptions.map(function (option) { | ||
27775 | return formatOption(option); | ||
27776 | }), | ||
27777 | selectedIndex: secondOptions.indexOf(second), | ||
27778 | type: 'second', | ||
27779 | onSelect: this.onItemChange | ||
27780 | }); | ||
27781 | }, | ||
27782 | |||
27783 | getNow: function getNow() { | ||
27784 | if (this.showNow) { | ||
27785 | return this.showNow; | ||
27786 | } | ||
27787 | var value = new _gregorianCalendar2['default'](this.props.gregorianCalendarLocale); | ||
27788 | value.setTime(Date.now()); | ||
27789 | this.showNow = value; | ||
27790 | return value; | ||
27791 | }, | ||
27792 | |||
27793 | render: function render() { | ||
27794 | var prefixCls = this.props.prefixCls; | ||
27795 | |||
27796 | var value = this.props.value || this.getNow(); | ||
27797 | return _react2['default'].createElement( | ||
27798 | 'div', | ||
27799 | { className: prefixCls + '-combobox' }, | ||
27800 | this.getHourSelect(value.getHourOfDay()), | ||
27801 | this.getMinuteSelect(value.getMinutes()), | ||
27802 | this.getSectionSelect(value.getSeconds()) | ||
27803 | ); | ||
27804 | } | ||
27805 | }); | ||
27806 | |||
27807 | exports['default'] = Combobox; | ||
27808 | module.exports = exports['default']; | ||
27809 | |||
27810 | /***/ }, | ||
27811 | /* 224 */ | ||
27812 | /***/ function(module, exports, __webpack_require__) { | ||
27813 | |||
27814 | 'use strict'; | ||
27815 | |||
27816 | Object.defineProperty(exports, '__esModule', { | ||
27817 | value: true | ||
27818 | }); | ||
27819 | |||
27820 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
27821 | |||
27822 | 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; } | ||
27823 | |||
27824 | var _react = __webpack_require__(3); | ||
27825 | |||
27826 | var _react2 = _interopRequireDefault(_react); | ||
27827 | |||
27828 | var _reactDom = __webpack_require__(160); | ||
27829 | |||
27830 | var _reactDom2 = _interopRequireDefault(_reactDom); | ||
27831 | |||
27832 | var _classnames2 = __webpack_require__(178); | ||
27833 | |||
27834 | var _classnames3 = _interopRequireDefault(_classnames2); | ||
27835 | |||
27836 | var scrollTo = function scrollTo(element, to, duration) { | ||
27837 | var requestAnimationFrame = window.requestAnimationFrame || function requestAnimationFrameTimeout() { | ||
27838 | return setTimeout(arguments[0], 10); | ||
27839 | }; | ||
27840 | // jump to target if duration zero | ||
27841 | if (duration <= 0) { | ||
27842 | element.scrollTop = to; | ||
27843 | return; | ||
27844 | } | ||
27845 | var difference = to - element.scrollTop; | ||
27846 | var perTick = difference / duration * 10; | ||
27847 | |||
27848 | requestAnimationFrame(function () { | ||
27849 | element.scrollTop = element.scrollTop + perTick; | ||
27850 | if (element.scrollTop === to) return; | ||
27851 | scrollTo(element, to, duration - 10); | ||
27852 | }); | ||
27853 | }; | ||
27854 | |||
27855 | var Select = _react2['default'].createClass({ | ||
27856 | displayName: 'Select', | ||
27857 | |||
27858 | propTypes: { | ||
27859 | prefixCls: _react.PropTypes.string, | ||
27860 | options: _react.PropTypes.array, | ||
27861 | gregorianCalendarLocale: _react.PropTypes.object, | ||
27862 | selectedIndex: _react.PropTypes.number, | ||
27863 | type: _react.PropTypes.string, | ||
27864 | onSelect: _react.PropTypes.func | ||
27865 | }, | ||
27866 | |||
27867 | componentDidMount: function componentDidMount() { | ||
27868 | // jump to selected option | ||
27869 | this.scrollToSelected(0); | ||
27870 | }, | ||
27871 | |||
27872 | componentDidUpdate: function componentDidUpdate() { | ||
27873 | // smooth scroll to selected option | ||
27874 | this.scrollToSelected(120); | ||
27875 | }, | ||
27876 | |||
27877 | onSelect: function onSelect(value) { | ||
27878 | var _props = this.props; | ||
27879 | var onSelect = _props.onSelect; | ||
27880 | var type = _props.type; | ||
27881 | |||
27882 | onSelect(type, value); | ||
27883 | }, | ||
27884 | |||
27885 | getOptions: function getOptions() { | ||
27886 | var _this = this; | ||
27887 | |||
27888 | var _props2 = this.props; | ||
27889 | var options = _props2.options; | ||
27890 | var selectedIndex = _props2.selectedIndex; | ||
27891 | var prefixCls = _props2.prefixCls; | ||
27892 | |||
27893 | return options.map(function (item, index) { | ||
27894 | var selected = selectedIndex === index; | ||
27895 | var cls = (0, _classnames3['default'])(_defineProperty({}, prefixCls + '-select-option-selected', selected)); | ||
27896 | return _react2['default'].createElement( | ||
27897 | 'li', | ||
27898 | { className: cls, key: index, onClick: _this.onSelect.bind(_this, +item) }, | ||
27899 | item | ||
27900 | ); | ||
27901 | }); | ||
27902 | }, | ||
27903 | |||
27904 | scrollToSelected: function scrollToSelected(duration) { | ||
27905 | // move to selected item | ||
27906 | var select = _reactDom2['default'].findDOMNode(this); | ||
27907 | var list = _reactDom2['default'].findDOMNode(this.refs.list); | ||
27908 | var index = this.props.selectedIndex - 1; | ||
27909 | if (index < 0) { | ||
27910 | index = 0; | ||
27911 | } | ||
27912 | var topOption = list.children[index]; | ||
27913 | var to = topOption.offsetTop - select.offsetTop; | ||
27914 | scrollTo(select, to, duration); | ||
27915 | }, | ||
27916 | |||
27917 | render: function render() { | ||
27918 | if (this.props.options.length === 0) { | ||
27919 | return null; | ||
27920 | } | ||
27921 | |||
27922 | var prefixCls = this.props.prefixCls; | ||
27923 | |||
27924 | return _react2['default'].createElement( | ||
27925 | 'div', | ||
27926 | { className: prefixCls + '-select' }, | ||
27927 | _react2['default'].createElement( | ||
27928 | 'ul', | ||
27929 | { ref: 'list' }, | ||
27930 | this.getOptions() | ||
27931 | ) | ||
27932 | ); | ||
27933 | } | ||
27934 | }); | ||
27935 | |||
27936 | exports['default'] = Select; | ||
27937 | module.exports = exports['default']; | ||
27938 | |||
27939 | /***/ }, | ||
27940 | /* 225 */ | ||
27941 | /***/ function(module, exports) { | ||
27942 | |||
27943 | 'use strict'; | ||
27944 | |||
27945 | Object.defineProperty(exports, '__esModule', { | ||
27946 | value: true | ||
27947 | }); | ||
27948 | var autoAdjustOverflow = { | ||
27949 | adjustX: 1, | ||
27950 | adjustY: 1 | ||
27951 | }; | ||
27952 | |||
27953 | var targetOffset = [0, 0]; | ||
27954 | |||
27955 | var placements = { | ||
27956 | bottomLeft: { | ||
27957 | points: ['tl', 'tl'], | ||
27958 | overflow: autoAdjustOverflow, | ||
27959 | offset: [0, -3], | ||
27960 | targetOffset: targetOffset | ||
27961 | }, | ||
27962 | bottomRight: { | ||
27963 | points: ['tr', 'tr'], | ||
27964 | overflow: autoAdjustOverflow, | ||
27965 | offset: [0, -3], | ||
27966 | targetOffset: targetOffset | ||
27967 | }, | ||
27968 | topRight: { | ||
27969 | points: ['br', 'br'], | ||
27970 | overflow: autoAdjustOverflow, | ||
27971 | offset: [0, 3], | ||
27972 | targetOffset: targetOffset | ||
27973 | }, | ||
27974 | topLeft: { | ||
27975 | points: ['bl', 'bl'], | ||
27976 | overflow: autoAdjustOverflow, | ||
27977 | offset: [0, 3], | ||
27978 | targetOffset: targetOffset | ||
27979 | } | ||
27980 | }; | ||
27981 | |||
27982 | exports['default'] = placements; | ||
27983 | module.exports = exports['default']; | ||
27984 | |||
27985 | /***/ }, | ||
27986 | /* 226 */ | ||
27987 | /***/ function(module, exports, __webpack_require__) { | ||
27988 | |||
27989 | 'use strict'; | ||
27990 | |||
27991 | Object.defineProperty(exports, '__esModule', { | ||
27992 | value: true | ||
27993 | }); | ||
27994 | exports.getFormatter = getFormatter; | ||
27995 | |||
27996 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
27997 | |||
27998 | var _gregorianCalendarFormat = __webpack_require__(165); | ||
27999 | |||
28000 | var _gregorianCalendarFormat2 = _interopRequireDefault(_gregorianCalendarFormat); | ||
28001 | |||
28002 | function getFormatter(format, locale) { | ||
28003 | if (typeof format === 'string') { | ||
28004 | return new _gregorianCalendarFormat2['default'](format, locale.format); | ||
28005 | } | ||
28006 | return format; | ||
28007 | } | ||
28008 | |||
28009 | /***/ }, | ||
28010 | /* 227 */ | ||
28011 | /***/ function(module, exports, __webpack_require__) { | ||
28012 | |||
28013 | 'use strict'; | ||
28014 | |||
28015 | Object.defineProperty(exports, '__esModule', { | ||
28016 | value: true | ||
28017 | }); | ||
28018 | |||
28019 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
28020 | |||
28021 | var _gregorianCalendarFormatLibLocaleZh_CN = __webpack_require__(228); | ||
28022 | |||
28023 | var _gregorianCalendarFormatLibLocaleZh_CN2 = _interopRequireDefault(_gregorianCalendarFormatLibLocaleZh_CN); | ||
28024 | |||
28025 | exports['default'] = { | ||
28026 | clear: '清除', | ||
28027 | format: _gregorianCalendarFormatLibLocaleZh_CN2['default'] | ||
28028 | }; | ||
28029 | module.exports = exports['default']; | ||
28030 | |||
28031 | /***/ }, | ||
28032 | /* 228 */ | ||
28033 | /***/ function(module, exports) { | ||
28034 | |||
28035 | 'use strict'; | ||
28036 | |||
28037 | module.exports = { | ||
28038 | eras: ['公元前', '公元'], | ||
28039 | months: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'], | ||
28040 | shortMonths: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'], | ||
28041 | weekdays: ['星期天', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'], | ||
28042 | shortWeekdays: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'], | ||
28043 | veryShortWeekdays: ['日', '一', '二', '三', '四', '五', '六'], | ||
28044 | ampms: ['上午', '下午'], | ||
28045 | datePatterns: ['yyyy\'年\'M\'月\'d\'日\' EEEE', 'yyyy\'年\'M\'月\'d\'日\'', 'yyyy-M-d', 'yy-M-d'], | ||
28046 | timePatterns: ['ahh\'时\'mm\'分\'ss\'秒\' \'GMT\'Z', 'ahh\'时\'mm\'分\'ss\'秒\'', 'H:mm:ss', 'ah:mm'], | ||
28047 | dateTimePattern: '{date} {time}' | ||
28048 | }; | ||
28049 | |||
28050 | /***/ } | 66 | /***/ } |
28051 | ]); | 67 | ]); |
28052 | //# sourceMappingURL=pick-time.js.map \ No newline at end of file | 68 | //# sourceMappingURL=pick-time.js.map \ No newline at end of file |