react 16.0.0-alpha.12 → 16.0.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/react.development.js +197 -478
- package/cjs/react.production.min.js +1 -1
- package/package.json +1 -2
- package/umd/react.development.js +233 -1712
- package/umd/react.production.min.js +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function e(e){for(var t=arguments.length-1,
|
|
1
|
+
"use strict";function e(e){for(var t=arguments.length-1,n="Minified React error #"+e+"; visit http://facebook.github.io/react/docs/error-decoder.html?invariant="+e,r=0;r<t;r++)n+="&args[]="+encodeURIComponent(arguments[r+1]);n+=" for the full message or use the non-minified dev environment for full errors and additional helpful warnings.";var o=new Error(n);throw o.name="Invariant Violation",o.framesToPop=1,o}function t(e,t){}function n(e,t,n){this.props=e,this.context=t,this.refs=A,this.updater=n||x}function r(e,t,n){this.props=e,this.context=t,this.refs=A,this.updater=n||x}function o(){}function l(e){return void 0!==e.ref}function u(e){return void 0!==e.key}function i(e){var t={"=":"=0",":":"=2"};return"$"+(""+e).replace(/[=:]/g,function(e){return t[e]})}function c(e,t){return"object"==typeof e&&null!==e&&null!=e.key?i(e.key):t.toString(36)}function a(e,t,n,r){var o=typeof e;if("undefined"!==o&&"boolean"!==o||(e=null),null===e||"string"===o||"number"===o||"object"===o&&e.$$typeof===H)return n(r,e,""===t?J+c(e,0):t,X),1;var l,u,i=0,f=""===t?J:t+Q;if(Array.isArray(e))for(var s=0;s<e.length;s++)l=e[s],u=f+c(l,s),i+=a(l,u,n,r);else{var p=Y&&e[Y]||e[G];if("function"==typeof p)for(var y,h=p.call(e),d=0;!(y=h.next()).done;)l=y.value,u=f+c(l,d++),i+=a(l,u,n,r);else if("object"===o){var v=""+e;k("31","[object Object]"===v?"object with keys {"+Object.keys(e).join(", ")+"}":v,"")}}return i}function f(e,t,n){return null==e?0:a(e,"",t,n)}function s(e){return(""+e).replace(ne,"$&/")}function p(e,t){this.func=e,this.context=t,this.count=0}function y(e,t,n){var r=e.func,o=e.context;r.call(o,t,e.count++)}function h(e,t,n){if(null==e)return e;var r=p.getPooled(t,n);Z(e,y,r),p.release(r)}function d(e,t,n,r){this.result=e,this.keyPrefix=t,this.func=n,this.context=r,this.count=0}function v(e,t,n){var r=e.result,o=e.keyPrefix,l=e.func,u=e.context,i=l.call(u,t,e.count++);Array.isArray(i)?m(i,r,n,w.thatReturnsArgument):null!=i&&(B.isValidElement(i)&&(i=B.cloneAndReplaceKey(i,o+(!i.key||t&&t.key===i.key?"":s(i.key)+"/")+n)),r.push(i))}function m(e,t,n,r,o){var l="";null!=n&&(l=s(n)+"/");var u=d.getPooled(t,l,r,o);Z(e,v,u),d.release(u)}function P(e,t,n){if(null==e)return e;var r=[];return m(e,r,null,t,n),r}function b(e,t,n){return null}function g(e,t){return Z(e,b,null)}function _(e){var t=[];return m(e,t,null,w.thatReturnsArgument),t}function S(e){return B.isValidElement(e)||k("143"),e}var E=require("object-assign");require("fbjs/lib/warning");var A=require("fbjs/lib/emptyObject");require("fbjs/lib/invariant");var w=require("fbjs/lib/emptyFunction"),k=e,j={isMounted:function(e){return!1},enqueueForceUpdate:function(e,n,r){t(e,"forceUpdate")},enqueueReplaceState:function(e,n,r,o){t(e,"replaceState")},enqueueSetState:function(e,n,r,o){t(e,"setState")}},x=j;n.prototype.isReactComponent={},n.prototype.setState=function(e,t){"object"!=typeof e&&"function"!=typeof e&&null!=e&&k("85"),this.updater.enqueueSetState(this,e,t,"setState")},n.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},o.prototype=n.prototype,r.prototype=new o,r.prototype.constructor=r,E(r.prototype,n.prototype),r.prototype.isPureReactComponent=!0;var R={Component:n,PureComponent:r},C=function(e){var t=this;if(t.instancePool.length){var n=t.instancePool.pop();return t.call(n,e),n}return new t(e)},O=function(e,t){var n=this;if(n.instancePool.length){var r=n.instancePool.pop();return n.call(r,e,t),r}return new n(e,t)},q=function(e,t,n){var r=this;if(r.instancePool.length){var o=r.instancePool.pop();return r.call(o,e,t,n),o}return new r(e,t,n)},U=function(e,t,n,r){var o=this;if(o.instancePool.length){var l=o.instancePool.pop();return o.call(l,e,t,n,r),l}return new o(e,t,n,r)},$=function(e){var t=this;e instanceof t||k("25"),e.destructor(),t.instancePool.length<t.poolSize&&t.instancePool.push(e)},F=10,I=C,T=function(e,t){var n=e;return n.instancePool=[],n.getPooled=t||I,n.poolSize||(n.poolSize=F),n.release=$,n},V={addPoolingTo:T,oneArgumentPooler:C,twoArgumentPooler:O,threeArgumentPooler:q,fourArgumentPooler:U},z=V,K={current:null},L=K,N=Object.prototype.hasOwnProperty,D="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,M={key:!0,ref:!0,__self:!0,__source:!0},W=function(e,t,n,r,o,l,u){return{$$typeof:D,type:e,key:t,ref:n,props:u,_owner:l}};W.createElement=function(e,t,n){var r,o={},i=null,c=null,a=null,f=null;if(null!=t){l(t)&&(c=t.ref),u(t)&&(i=""+t.key),a=void 0===t.__self?null:t.__self,f=void 0===t.__source?null:t.__source;for(r in t)N.call(t,r)&&!M.hasOwnProperty(r)&&(o[r]=t[r])}var s=arguments.length-2;if(1===s)o.children=n;else if(s>1){for(var p=Array(s),y=0;y<s;y++)p[y]=arguments[y+2];o.children=p}if(e&&e.defaultProps){var h=e.defaultProps;for(r in h)void 0===o[r]&&(o[r]=h[r])}return W(e,i,c,a,f,L.current,o)},W.createFactory=function(e){var t=W.createElement.bind(null,e);return t.type=e,t},W.cloneAndReplaceKey=function(e,t){return W(e.type,t,e.ref,e._self,e._source,e._owner,e.props)},W.cloneElement=function(e,t,n){var r,o=E({},e.props),i=e.key,c=e.ref,a=e._self,f=e._source,s=e._owner;if(null!=t){l(t)&&(c=t.ref,s=L.current),u(t)&&(i=""+t.key);var p;e.type&&e.type.defaultProps&&(p=e.type.defaultProps);for(r in t)N.call(t,r)&&!M.hasOwnProperty(r)&&(void 0===t[r]&&void 0!==p?o[r]=p[r]:o[r]=t[r])}var y=arguments.length-2;if(1===y)o.children=n;else if(y>1){for(var h=Array(y),d=0;d<y;d++)h[d]=arguments[d+2];o.children=h}return W(e.type,i,c,a,f,s,o)},W.isValidElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===D};var B=W,Y="function"==typeof Symbol&&Symbol.iterator,G="@@iterator",H="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,J=".",Q=":",X=w,Z=f,ee=z.twoArgumentPooler,te=z.fourArgumentPooler,ne=/\/+/g;p.prototype.destructor=function(){this.func=null,this.context=null,this.count=0},z.addPoolingTo(p,ee),d.prototype.destructor=function(){this.result=null,this.keyPrefix=null,this.func=null,this.context=null,this.count=0},z.addPoolingTo(d,te);var re={forEach:h,map:P,mapIntoWithKeyPrefixInternal:m,count:g,toArray:_},oe=re,le="16.0.0-alpha.13",ue=S,ie=B.createElement,ce=B.createFactory,ae=B.cloneElement,fe={Children:{map:oe.map,forEach:oe.forEach,count:oe.count,toArray:oe.toArray,only:ue},Component:R.Component,PureComponent:R.PureComponent,createElement:ie,cloneElement:ae,isValidElement:B.isValidElement,createFactory:ce,version:le,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentOwner:L}},se=fe;module.exports=se;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react",
|
|
3
3
|
"description": "React is a JavaScript library for building user interfaces.",
|
|
4
|
-
"version": "16.0.0-alpha.
|
|
4
|
+
"version": "16.0.0-alpha.13",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react"
|
|
7
7
|
],
|
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
"node": ">=0.10.0"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"create-react-class": "^15.5.2",
|
|
26
25
|
"fbjs": "^0.8.9",
|
|
27
26
|
"loose-envify": "^1.1.0",
|
|
28
27
|
"object-assign": "^4.1.0",
|
package/umd/react.development.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react.development.js v16.0.0-alpha.
|
|
2
|
+
* react.development.js v16.0.0-alpha.13
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
(function (global, factory) {
|
|
@@ -154,7 +154,7 @@ var emptyFunction_1 = emptyFunction;
|
|
|
154
154
|
* same logic and follow the same code paths.
|
|
155
155
|
*/
|
|
156
156
|
|
|
157
|
-
var warning
|
|
157
|
+
var warning = emptyFunction_1;
|
|
158
158
|
|
|
159
159
|
{
|
|
160
160
|
(function () {
|
|
@@ -178,7 +178,7 @@ var warning$1 = emptyFunction_1;
|
|
|
178
178
|
} catch (x) {}
|
|
179
179
|
};
|
|
180
180
|
|
|
181
|
-
warning
|
|
181
|
+
warning = function warning(condition, format) {
|
|
182
182
|
if (format === undefined) {
|
|
183
183
|
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
184
184
|
}
|
|
@@ -198,7 +198,7 @@ var warning$1 = emptyFunction_1;
|
|
|
198
198
|
})();
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
var warning_1 = warning
|
|
201
|
+
var warning_1 = warning;
|
|
202
202
|
|
|
203
203
|
function warnNoop(publicInstance, callerName) {
|
|
204
204
|
{
|
|
@@ -277,31 +277,6 @@ var ReactNoopUpdateQueue = {
|
|
|
277
277
|
|
|
278
278
|
var ReactNoopUpdateQueue_1 = ReactNoopUpdateQueue;
|
|
279
279
|
|
|
280
|
-
/**
|
|
281
|
-
* Copyright 2013-present, Facebook, Inc.
|
|
282
|
-
* All rights reserved.
|
|
283
|
-
*
|
|
284
|
-
* This source code is licensed under the BSD-style license found in the
|
|
285
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
286
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
287
|
-
*
|
|
288
|
-
*
|
|
289
|
-
* @providesModule canDefineProperty
|
|
290
|
-
*/
|
|
291
|
-
|
|
292
|
-
var canDefineProperty$1 = false;
|
|
293
|
-
{
|
|
294
|
-
try {
|
|
295
|
-
// $FlowFixMe https://github.com/facebook/flow/issues/285
|
|
296
|
-
Object.defineProperty({}, 'x', { get: function () {} });
|
|
297
|
-
canDefineProperty$1 = true;
|
|
298
|
-
} catch (x) {
|
|
299
|
-
// IE will fail on defineProperty
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
var canDefineProperty_1 = canDefineProperty$1;
|
|
304
|
-
|
|
305
280
|
/**
|
|
306
281
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
307
282
|
* All rights reserved.
|
|
@@ -374,6 +349,70 @@ function invariant(condition, format, a, b, c, d, e, f) {
|
|
|
374
349
|
|
|
375
350
|
var invariant_1 = invariant;
|
|
376
351
|
|
|
352
|
+
/**
|
|
353
|
+
* Copyright 2014-2015, Facebook, Inc.
|
|
354
|
+
* All rights reserved.
|
|
355
|
+
*
|
|
356
|
+
* This source code is licensed under the BSD-style license found in the
|
|
357
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
358
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
359
|
+
*
|
|
360
|
+
* @providesModule lowPriorityWarning
|
|
361
|
+
*/
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* Forked from fbjs/warning:
|
|
365
|
+
* https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
|
|
366
|
+
*
|
|
367
|
+
* Only change is we use console.warn instead of console.error,
|
|
368
|
+
* and do nothing when 'console' is not supported.
|
|
369
|
+
* This really simplifies the code.
|
|
370
|
+
* ---
|
|
371
|
+
* Similar to invariant but only logs a warning if the condition is not met.
|
|
372
|
+
* This can be used to log issues in development environments in critical
|
|
373
|
+
* paths. Removing the logging code for production environments will keep the
|
|
374
|
+
* same logic and follow the same code paths.
|
|
375
|
+
*/
|
|
376
|
+
|
|
377
|
+
var lowPriorityWarning = function () {};
|
|
378
|
+
|
|
379
|
+
{
|
|
380
|
+
var printWarning = function (format) {
|
|
381
|
+
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
382
|
+
args[_key - 1] = arguments[_key];
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
var argIndex = 0;
|
|
386
|
+
var message = 'Warning: ' + format.replace(/%s/g, function () {
|
|
387
|
+
return args[argIndex++];
|
|
388
|
+
});
|
|
389
|
+
if (typeof console !== 'undefined') {
|
|
390
|
+
console.warn(message);
|
|
391
|
+
}
|
|
392
|
+
try {
|
|
393
|
+
// --- Welcome to debugging React ---
|
|
394
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
395
|
+
// to find the callsite that caused this warning to fire.
|
|
396
|
+
throw new Error(message);
|
|
397
|
+
} catch (x) {}
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
lowPriorityWarning = function (condition, format) {
|
|
401
|
+
if (format === undefined) {
|
|
402
|
+
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
403
|
+
}
|
|
404
|
+
if (!condition) {
|
|
405
|
+
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
406
|
+
args[_key2 - 2] = arguments[_key2];
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
printWarning.apply(undefined, [format].concat(args));
|
|
410
|
+
}
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
var lowPriorityWarning_1 = lowPriorityWarning;
|
|
415
|
+
|
|
377
416
|
/**
|
|
378
417
|
* Base class helpers for the updating state of a component.
|
|
379
418
|
*/
|
|
@@ -447,14 +486,12 @@ ReactComponent.prototype.forceUpdate = function (callback) {
|
|
|
447
486
|
replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
|
|
448
487
|
};
|
|
449
488
|
var defineDeprecationWarning = function (methodName, info) {
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
});
|
|
457
|
-
}
|
|
489
|
+
Object.defineProperty(ReactComponent.prototype, methodName, {
|
|
490
|
+
get: function () {
|
|
491
|
+
lowPriorityWarning_1(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
|
|
492
|
+
return undefined;
|
|
493
|
+
}
|
|
494
|
+
});
|
|
458
495
|
};
|
|
459
496
|
for (var fnName in deprecatedAPIs) {
|
|
460
497
|
if (deprecatedAPIs.hasOwnProperty(fnName)) {
|
|
@@ -612,29 +649,12 @@ var ReactCurrentOwner = {
|
|
|
612
649
|
|
|
613
650
|
var ReactCurrentOwner_1 = ReactCurrentOwner;
|
|
614
651
|
|
|
615
|
-
|
|
616
|
-
* Copyright 2014-present, Facebook, Inc.
|
|
617
|
-
* All rights reserved.
|
|
618
|
-
*
|
|
619
|
-
* This source code is licensed under the BSD-style license found in the
|
|
620
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
621
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
622
|
-
*
|
|
623
|
-
* @providesModule ReactElementSymbol
|
|
624
|
-
*
|
|
625
|
-
*/
|
|
652
|
+
var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
626
653
|
|
|
627
654
|
// The Symbol used to tag the ReactElement type. If there is no native Symbol
|
|
628
655
|
// nor polyfill, then a plain number is used for performance.
|
|
629
|
-
|
|
630
656
|
var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
|
|
631
657
|
|
|
632
|
-
var ReactElementSymbol = REACT_ELEMENT_TYPE;
|
|
633
|
-
|
|
634
|
-
var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
658
|
var RESERVED_PROPS = {
|
|
639
659
|
key: true,
|
|
640
660
|
ref: true,
|
|
@@ -720,7 +740,7 @@ function defineRefPropWarningGetter(props, displayName) {
|
|
|
720
740
|
var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
721
741
|
var element = {
|
|
722
742
|
// This tag allow us to uniquely identify this as a React Element
|
|
723
|
-
$$typeof:
|
|
743
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
|
724
744
|
|
|
725
745
|
// Built-in properties that belong on the element
|
|
726
746
|
type: type,
|
|
@@ -743,33 +763,27 @@ var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
|
743
763
|
// the validation flag non-enumerable (where possible, which should
|
|
744
764
|
// include every environment we run tests in), so the test framework
|
|
745
765
|
// ignores it.
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
});
|
|
768
|
-
} else {
|
|
769
|
-
element._store.validated = false;
|
|
770
|
-
element._self = self;
|
|
771
|
-
element._source = source;
|
|
772
|
-
}
|
|
766
|
+
Object.defineProperty(element._store, 'validated', {
|
|
767
|
+
configurable: false,
|
|
768
|
+
enumerable: false,
|
|
769
|
+
writable: true,
|
|
770
|
+
value: false
|
|
771
|
+
});
|
|
772
|
+
// self and source are DEV only properties.
|
|
773
|
+
Object.defineProperty(element, '_self', {
|
|
774
|
+
configurable: false,
|
|
775
|
+
enumerable: false,
|
|
776
|
+
writable: false,
|
|
777
|
+
value: self
|
|
778
|
+
});
|
|
779
|
+
// Two elements created in two different places should be considered
|
|
780
|
+
// equal for testing purposes and therefore we hide it from enumeration.
|
|
781
|
+
Object.defineProperty(element, '_source', {
|
|
782
|
+
configurable: false,
|
|
783
|
+
enumerable: false,
|
|
784
|
+
writable: false,
|
|
785
|
+
value: source
|
|
786
|
+
});
|
|
773
787
|
if (Object.freeze) {
|
|
774
788
|
Object.freeze(element.props);
|
|
775
789
|
Object.freeze(element);
|
|
@@ -841,7 +855,7 @@ ReactElement.createElement = function (type, config, children) {
|
|
|
841
855
|
}
|
|
842
856
|
{
|
|
843
857
|
if (key || ref) {
|
|
844
|
-
if (typeof props.$$typeof === 'undefined' || props.$$typeof !==
|
|
858
|
+
if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE) {
|
|
845
859
|
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
|
846
860
|
if (key) {
|
|
847
861
|
defineKeyPropWarningGetter(props, displayName);
|
|
@@ -950,109 +964,11 @@ ReactElement.cloneElement = function (element, config, children) {
|
|
|
950
964
|
* @final
|
|
951
965
|
*/
|
|
952
966
|
ReactElement.isValidElement = function (object) {
|
|
953
|
-
return typeof object === 'object' && object !== null && object.$$typeof ===
|
|
967
|
+
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
954
968
|
};
|
|
955
969
|
|
|
956
970
|
var ReactElement_1 = ReactElement;
|
|
957
971
|
|
|
958
|
-
/**
|
|
959
|
-
* Copyright 2013-present, Facebook, Inc.
|
|
960
|
-
* All rights reserved.
|
|
961
|
-
*
|
|
962
|
-
* This source code is licensed under the BSD-style license found in the
|
|
963
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
964
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
965
|
-
*
|
|
966
|
-
* @providesModule getIteratorFn
|
|
967
|
-
*
|
|
968
|
-
*/
|
|
969
|
-
|
|
970
|
-
/* global Symbol */
|
|
971
|
-
|
|
972
|
-
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
973
|
-
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
|
|
974
|
-
|
|
975
|
-
/**
|
|
976
|
-
* Returns the iterator method function contained on the iterable object.
|
|
977
|
-
*
|
|
978
|
-
* Be sure to invoke the function with the iterable as context:
|
|
979
|
-
*
|
|
980
|
-
* var iteratorFn = getIteratorFn(myIterable);
|
|
981
|
-
* if (iteratorFn) {
|
|
982
|
-
* var iterator = iteratorFn.call(myIterable);
|
|
983
|
-
* ...
|
|
984
|
-
* }
|
|
985
|
-
*
|
|
986
|
-
* @param {?object} maybeIterable
|
|
987
|
-
* @return {?function}
|
|
988
|
-
*/
|
|
989
|
-
function getIteratorFn(maybeIterable) {
|
|
990
|
-
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
|
|
991
|
-
if (typeof iteratorFn === 'function') {
|
|
992
|
-
return iteratorFn;
|
|
993
|
-
}
|
|
994
|
-
}
|
|
995
|
-
|
|
996
|
-
var getIteratorFn_1 = getIteratorFn;
|
|
997
|
-
|
|
998
|
-
/**
|
|
999
|
-
* Copyright 2013-present, Facebook, Inc.
|
|
1000
|
-
* All rights reserved.
|
|
1001
|
-
*
|
|
1002
|
-
* This source code is licensed under the BSD-style license found in the
|
|
1003
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
1004
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
1005
|
-
*
|
|
1006
|
-
* @providesModule KeyEscapeUtils
|
|
1007
|
-
*
|
|
1008
|
-
*/
|
|
1009
|
-
|
|
1010
|
-
/**
|
|
1011
|
-
* Escape and wrap key so it is safe to use as a reactid
|
|
1012
|
-
*
|
|
1013
|
-
* @param {string} key to be escaped.
|
|
1014
|
-
* @return {string} the escaped key.
|
|
1015
|
-
*/
|
|
1016
|
-
|
|
1017
|
-
function escape(key) {
|
|
1018
|
-
var escapeRegex = /[=:]/g;
|
|
1019
|
-
var escaperLookup = {
|
|
1020
|
-
'=': '=0',
|
|
1021
|
-
':': '=2'
|
|
1022
|
-
};
|
|
1023
|
-
var escapedString = ('' + key).replace(escapeRegex, function (match) {
|
|
1024
|
-
return escaperLookup[match];
|
|
1025
|
-
});
|
|
1026
|
-
|
|
1027
|
-
return '$' + escapedString;
|
|
1028
|
-
}
|
|
1029
|
-
|
|
1030
|
-
/**
|
|
1031
|
-
* Unescape and unwrap key for human-readable display
|
|
1032
|
-
*
|
|
1033
|
-
* @param {string} key to unescape.
|
|
1034
|
-
* @return {string} the unescaped key.
|
|
1035
|
-
*/
|
|
1036
|
-
function unescape(key) {
|
|
1037
|
-
var unescapeRegex = /(=0|=2)/g;
|
|
1038
|
-
var unescaperLookup = {
|
|
1039
|
-
'=0': '=',
|
|
1040
|
-
'=2': ':'
|
|
1041
|
-
};
|
|
1042
|
-
var keySubstring = key[0] === '.' && key[1] === '$' ? key.substring(2) : key.substring(1);
|
|
1043
|
-
|
|
1044
|
-
return ('' + keySubstring).replace(unescapeRegex, function (match) {
|
|
1045
|
-
return unescaperLookup[match];
|
|
1046
|
-
});
|
|
1047
|
-
}
|
|
1048
|
-
|
|
1049
|
-
var KeyEscapeUtils = {
|
|
1050
|
-
escape: escape,
|
|
1051
|
-
unescape: unescape
|
|
1052
|
-
};
|
|
1053
|
-
|
|
1054
|
-
var KeyEscapeUtils_1 = KeyEscapeUtils;
|
|
1055
|
-
|
|
1056
972
|
/**
|
|
1057
973
|
* Copyright 2013-present, Facebook, Inc.
|
|
1058
974
|
* All rights reserved.
|
|
@@ -1487,6 +1403,12 @@ var ReactComponentTreeHook = {
|
|
|
1487
1403
|
|
|
1488
1404
|
var ReactComponentTreeHook_1 = ReactComponentTreeHook;
|
|
1489
1405
|
|
|
1406
|
+
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
1407
|
+
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
|
|
1408
|
+
// The Symbol used to tag the ReactElement type. If there is no native Symbol
|
|
1409
|
+
// nor polyfill, then a plain number is used for performance.
|
|
1410
|
+
var REACT_ELEMENT_TYPE$1 = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
|
|
1411
|
+
|
|
1490
1412
|
{
|
|
1491
1413
|
var _require = ReactComponentTreeHook_1,
|
|
1492
1414
|
getCurrentStackAddendum = _require.getCurrentStackAddendum;
|
|
@@ -1496,10 +1418,45 @@ var SEPARATOR = '.';
|
|
|
1496
1418
|
var SUBSEPARATOR = ':';
|
|
1497
1419
|
|
|
1498
1420
|
/**
|
|
1499
|
-
*
|
|
1500
|
-
* isomorphic and renderers. We could extract this to a
|
|
1421
|
+
* Escape and wrap key so it is safe to use as a reactid
|
|
1501
1422
|
*
|
|
1423
|
+
* @param {string} key to be escaped.
|
|
1424
|
+
* @return {string} the escaped key.
|
|
1502
1425
|
*/
|
|
1426
|
+
function escape(key) {
|
|
1427
|
+
var escapeRegex = /[=:]/g;
|
|
1428
|
+
var escaperLookup = {
|
|
1429
|
+
'=': '=0',
|
|
1430
|
+
':': '=2'
|
|
1431
|
+
};
|
|
1432
|
+
var escapedString = ('' + key).replace(escapeRegex, function (match) {
|
|
1433
|
+
return escaperLookup[match];
|
|
1434
|
+
});
|
|
1435
|
+
|
|
1436
|
+
return '$' + escapedString;
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
var unescapeInDev = emptyFunction_1;
|
|
1440
|
+
{
|
|
1441
|
+
/**
|
|
1442
|
+
* Unescape and unwrap key for human-readable display
|
|
1443
|
+
*
|
|
1444
|
+
* @param {string} key to unescape.
|
|
1445
|
+
* @return {string} the unescaped key.
|
|
1446
|
+
*/
|
|
1447
|
+
unescapeInDev = function (key) {
|
|
1448
|
+
var unescapeRegex = /(=0|=2)/g;
|
|
1449
|
+
var unescaperLookup = {
|
|
1450
|
+
'=0': '=',
|
|
1451
|
+
'=2': ':'
|
|
1452
|
+
};
|
|
1453
|
+
var keySubstring = key[0] === '.' && key[1] === '$' ? key.substring(2) : key.substring(1);
|
|
1454
|
+
|
|
1455
|
+
return ('' + keySubstring).replace(unescapeRegex, function (match) {
|
|
1456
|
+
return unescaperLookup[match];
|
|
1457
|
+
});
|
|
1458
|
+
};
|
|
1459
|
+
}
|
|
1503
1460
|
|
|
1504
1461
|
/**
|
|
1505
1462
|
* TODO: Test that a single child and an array with one item have the same key
|
|
@@ -1520,7 +1477,7 @@ function getComponentKey(component, index) {
|
|
|
1520
1477
|
// that we don't block potential future ES APIs.
|
|
1521
1478
|
if (typeof component === 'object' && component !== null && component.key != null) {
|
|
1522
1479
|
// Explicit key
|
|
1523
|
-
return
|
|
1480
|
+
return escape(component.key);
|
|
1524
1481
|
}
|
|
1525
1482
|
// Implicit key determined by the index in the set
|
|
1526
1483
|
return index.toString(36);
|
|
@@ -1545,11 +1502,11 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
1545
1502
|
if (children === null || type === 'string' || type === 'number' ||
|
|
1546
1503
|
// The following is inlined from ReactElement. This means we can optimize
|
|
1547
1504
|
// some checks. React Fiber also inlines this logic for similar purposes.
|
|
1548
|
-
type === 'object' && children.$$typeof ===
|
|
1505
|
+
type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE$1) {
|
|
1549
1506
|
callback(traverseContext, children,
|
|
1550
1507
|
// If it's the only child, treat the name as if it was wrapped in an array
|
|
1551
1508
|
// so that it's consistent if the number of children grows.
|
|
1552
|
-
nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
|
|
1509
|
+
nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar, unescapeInDev);
|
|
1553
1510
|
return 1;
|
|
1554
1511
|
}
|
|
1555
1512
|
|
|
@@ -1565,8 +1522,8 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
1565
1522
|
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
|
1566
1523
|
}
|
|
1567
1524
|
} else {
|
|
1568
|
-
var iteratorFn =
|
|
1569
|
-
if (iteratorFn) {
|
|
1525
|
+
var iteratorFn = ITERATOR_SYMBOL && children[ITERATOR_SYMBOL] || children[FAUX_ITERATOR_SYMBOL];
|
|
1526
|
+
if (typeof iteratorFn === 'function') {
|
|
1570
1527
|
{
|
|
1571
1528
|
// Warn about using Maps as children
|
|
1572
1529
|
if (iteratorFn === children.entries) {
|
|
@@ -1795,6 +1752,40 @@ var ReactChildren = {
|
|
|
1795
1752
|
|
|
1796
1753
|
var ReactChildren_1 = ReactChildren;
|
|
1797
1754
|
|
|
1755
|
+
/**
|
|
1756
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
1757
|
+
* All rights reserved.
|
|
1758
|
+
*
|
|
1759
|
+
* This source code is licensed under the BSD-style license found in the
|
|
1760
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
1761
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
1762
|
+
*
|
|
1763
|
+
* @providesModule ReactVersion
|
|
1764
|
+
*/
|
|
1765
|
+
|
|
1766
|
+
var ReactVersion = '16.0.0-alpha.13';
|
|
1767
|
+
|
|
1768
|
+
/**
|
|
1769
|
+
* Returns the first child in a collection of children and verifies that there
|
|
1770
|
+
* is only one child in the collection.
|
|
1771
|
+
*
|
|
1772
|
+
* See https://facebook.github.io/react/docs/react-api.html#react.children.only
|
|
1773
|
+
*
|
|
1774
|
+
* The current implementation of this function assumes that a single child gets
|
|
1775
|
+
* passed without a wrapper, but the purpose of this helper function is to
|
|
1776
|
+
* abstract away the particular structure of children.
|
|
1777
|
+
*
|
|
1778
|
+
* @param {?object} children Child collection structure.
|
|
1779
|
+
* @return {ReactElement} The first and only `ReactElement` contained in the
|
|
1780
|
+
* structure.
|
|
1781
|
+
*/
|
|
1782
|
+
function onlyChild(children) {
|
|
1783
|
+
!ReactElement_1.isValidElement(children) ? invariant_1(false, 'React.Children.only expected to receive a single React element child.') : void 0;
|
|
1784
|
+
return children;
|
|
1785
|
+
}
|
|
1786
|
+
|
|
1787
|
+
var onlyChild_1 = onlyChild;
|
|
1788
|
+
|
|
1798
1789
|
/**
|
|
1799
1790
|
* Copyright 2013-present, Facebook, Inc.
|
|
1800
1791
|
* All rights reserved.
|
|
@@ -1810,7 +1801,7 @@ var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
|
|
|
1810
1801
|
|
|
1811
1802
|
{
|
|
1812
1803
|
var invariant$1 = invariant_1;
|
|
1813
|
-
var warning$
|
|
1804
|
+
var warning$2 = warning_1;
|
|
1814
1805
|
var ReactPropTypesSecret = ReactPropTypesSecret_1;
|
|
1815
1806
|
var loggedTypeFailures = {};
|
|
1816
1807
|
}
|
|
@@ -1842,7 +1833,7 @@ function checkPropTypes$1(typeSpecs, values, location, componentName, getStack)
|
|
|
1842
1833
|
} catch (ex) {
|
|
1843
1834
|
error = ex;
|
|
1844
1835
|
}
|
|
1845
|
-
warning$
|
|
1836
|
+
warning$2(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error);
|
|
1846
1837
|
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
1847
1838
|
// Only monitor this failure once because there tends to be a lot of the
|
|
1848
1839
|
// same error.
|
|
@@ -1850,7 +1841,7 @@ function checkPropTypes$1(typeSpecs, values, location, componentName, getStack)
|
|
|
1850
1841
|
|
|
1851
1842
|
var stack = getStack ? getStack() : '';
|
|
1852
1843
|
|
|
1853
|
-
warning$
|
|
1844
|
+
warning$2(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : '');
|
|
1854
1845
|
}
|
|
1855
1846
|
}
|
|
1856
1847
|
}
|
|
@@ -1866,8 +1857,8 @@ var ReactDebugCurrentFrame$1 = {};
|
|
|
1866
1857
|
getStackAddendumByID = _require$2.getStackAddendumByID,
|
|
1867
1858
|
getCurrentStackAddendum$2 = _require$2.getCurrentStackAddendum;
|
|
1868
1859
|
|
|
1869
|
-
var _require2
|
|
1870
|
-
getStackAddendumByWorkInProgressFiber$2 = _require2
|
|
1860
|
+
var _require2 = ReactFiberComponentTreeHook,
|
|
1861
|
+
getStackAddendumByWorkInProgressFiber$2 = _require2.getStackAddendumByWorkInProgressFiber;
|
|
1871
1862
|
|
|
1872
1863
|
// Component that is being worked on
|
|
1873
1864
|
|
|
@@ -1904,13 +1895,17 @@ var ReactDebugCurrentFrame_1 = ReactDebugCurrentFrame$1;
|
|
|
1904
1895
|
|
|
1905
1896
|
{
|
|
1906
1897
|
var checkPropTypes = checkPropTypes_1;
|
|
1907
|
-
var
|
|
1898
|
+
var lowPriorityWarning$1 = lowPriorityWarning_1;
|
|
1908
1899
|
var ReactDebugCurrentFrame = ReactDebugCurrentFrame_1;
|
|
1900
|
+
var warning$1 = warning_1;
|
|
1909
1901
|
|
|
1910
1902
|
var _require$1 = ReactComponentTreeHook_1,
|
|
1911
1903
|
getCurrentStackAddendum$1 = _require$1.getCurrentStackAddendum;
|
|
1912
1904
|
}
|
|
1913
1905
|
|
|
1906
|
+
var ITERATOR_SYMBOL$1 = typeof Symbol === 'function' && Symbol.iterator;
|
|
1907
|
+
var FAUX_ITERATOR_SYMBOL$1 = '@@iterator'; // Before Symbol spec.
|
|
1908
|
+
|
|
1914
1909
|
function getDeclarationErrorAddendum() {
|
|
1915
1910
|
if (ReactCurrentOwner_1.current) {
|
|
1916
1911
|
var name = getComponentName_1(ReactCurrentOwner_1.current);
|
|
@@ -1982,7 +1977,7 @@ function validateExplicitKey(element, parentType) {
|
|
|
1982
1977
|
childOwner = ' It was passed a child from ' + getComponentName_1(element._owner) + '.';
|
|
1983
1978
|
}
|
|
1984
1979
|
|
|
1985
|
-
warning$
|
|
1980
|
+
warning$1(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.%s', currentComponentErrorInfo, childOwner, getCurrentStackAddendum$1(element));
|
|
1986
1981
|
}
|
|
1987
1982
|
|
|
1988
1983
|
/**
|
|
@@ -2011,9 +2006,10 @@ function validateChildKeys(node, parentType) {
|
|
|
2011
2006
|
node._store.validated = true;
|
|
2012
2007
|
}
|
|
2013
2008
|
} else if (node) {
|
|
2014
|
-
var iteratorFn =
|
|
2015
|
-
|
|
2016
|
-
|
|
2009
|
+
var iteratorFn = ITERATOR_SYMBOL$1 && node[ITERATOR_SYMBOL$1] || node[FAUX_ITERATOR_SYMBOL$1];
|
|
2010
|
+
if (typeof iteratorFn === 'function') {
|
|
2011
|
+
// Entry iterators used to provide implicit keys,
|
|
2012
|
+
// but now we print a separate warning for them later.
|
|
2017
2013
|
if (iteratorFn !== node.entries) {
|
|
2018
2014
|
var iterator = iteratorFn.call(node);
|
|
2019
2015
|
var step;
|
|
@@ -2051,11 +2047,11 @@ function validatePropTypes(element) {
|
|
|
2051
2047
|
checkPropTypes(propTypes, element.props, 'prop', name, ReactDebugCurrentFrame.getStackAddendum);
|
|
2052
2048
|
}
|
|
2053
2049
|
if (typeof componentClass.getDefaultProps === 'function') {
|
|
2054
|
-
warning$
|
|
2050
|
+
warning$1(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
|
2055
2051
|
}
|
|
2056
2052
|
}
|
|
2057
2053
|
|
|
2058
|
-
var ReactElementValidator$
|
|
2054
|
+
var ReactElementValidator$1 = {
|
|
2059
2055
|
createElement: function (type, props, children) {
|
|
2060
2056
|
var validType = typeof type === 'string' || typeof type === 'function';
|
|
2061
2057
|
// We warn in this case but don't throw. We expect the element creation to
|
|
@@ -2075,7 +2071,7 @@ var ReactElementValidator$2 = {
|
|
|
2075
2071
|
|
|
2076
2072
|
info += getCurrentStackAddendum$1();
|
|
2077
2073
|
|
|
2078
|
-
warning$
|
|
2074
|
+
warning$1(false, 'React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', type == null ? type : typeof type, info);
|
|
2079
2075
|
}
|
|
2080
2076
|
|
|
2081
2077
|
var element = ReactElement_1.createElement.apply(this, arguments);
|
|
@@ -2111,23 +2107,21 @@ var ReactElementValidator$2 = {
|
|
|
2111
2107
|
},
|
|
2112
2108
|
|
|
2113
2109
|
createFactory: function (type) {
|
|
2114
|
-
var validatedFactory = ReactElementValidator$
|
|
2110
|
+
var validatedFactory = ReactElementValidator$1.createElement.bind(null, type);
|
|
2115
2111
|
// Legacy hook TODO: Warn if this is accessed
|
|
2116
2112
|
validatedFactory.type = type;
|
|
2117
2113
|
|
|
2118
2114
|
{
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
});
|
|
2130
|
-
}
|
|
2115
|
+
Object.defineProperty(validatedFactory, 'type', {
|
|
2116
|
+
enumerable: false,
|
|
2117
|
+
get: function () {
|
|
2118
|
+
lowPriorityWarning$1(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
|
|
2119
|
+
Object.defineProperty(this, 'type', {
|
|
2120
|
+
value: type
|
|
2121
|
+
});
|
|
2122
|
+
return type;
|
|
2123
|
+
}
|
|
2124
|
+
});
|
|
2131
2125
|
}
|
|
2132
2126
|
|
|
2133
2127
|
return validatedFactory;
|
|
@@ -2149,1456 +2143,36 @@ var ReactElementValidator$2 = {
|
|
|
2149
2143
|
}
|
|
2150
2144
|
};
|
|
2151
2145
|
|
|
2152
|
-
var ReactElementValidator_1 = ReactElementValidator$
|
|
2146
|
+
var ReactElementValidator_1 = ReactElementValidator$1;
|
|
2147
|
+
|
|
2148
|
+
var createElement = ReactElement_1.createElement;
|
|
2149
|
+
var createFactory = ReactElement_1.createFactory;
|
|
2150
|
+
var cloneElement = ReactElement_1.cloneElement;
|
|
2153
2151
|
|
|
2154
|
-
/**
|
|
2155
|
-
* Create a factory that creates HTML tag elements.
|
|
2156
|
-
*
|
|
2157
|
-
* @private
|
|
2158
|
-
*/
|
|
2159
|
-
var createDOMFactory = ReactElement_1.createFactory;
|
|
2160
2152
|
{
|
|
2161
|
-
var ReactElementValidator
|
|
2162
|
-
|
|
2153
|
+
var ReactElementValidator = ReactElementValidator_1;
|
|
2154
|
+
createElement = ReactElementValidator.createElement;
|
|
2155
|
+
createFactory = ReactElementValidator.createFactory;
|
|
2156
|
+
cloneElement = ReactElementValidator.cloneElement;
|
|
2163
2157
|
}
|
|
2164
2158
|
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
address: createDOMFactory('address'),
|
|
2174
|
-
area: createDOMFactory('area'),
|
|
2175
|
-
article: createDOMFactory('article'),
|
|
2176
|
-
aside: createDOMFactory('aside'),
|
|
2177
|
-
audio: createDOMFactory('audio'),
|
|
2178
|
-
b: createDOMFactory('b'),
|
|
2179
|
-
base: createDOMFactory('base'),
|
|
2180
|
-
bdi: createDOMFactory('bdi'),
|
|
2181
|
-
bdo: createDOMFactory('bdo'),
|
|
2182
|
-
big: createDOMFactory('big'),
|
|
2183
|
-
blockquote: createDOMFactory('blockquote'),
|
|
2184
|
-
body: createDOMFactory('body'),
|
|
2185
|
-
br: createDOMFactory('br'),
|
|
2186
|
-
button: createDOMFactory('button'),
|
|
2187
|
-
canvas: createDOMFactory('canvas'),
|
|
2188
|
-
caption: createDOMFactory('caption'),
|
|
2189
|
-
cite: createDOMFactory('cite'),
|
|
2190
|
-
code: createDOMFactory('code'),
|
|
2191
|
-
col: createDOMFactory('col'),
|
|
2192
|
-
colgroup: createDOMFactory('colgroup'),
|
|
2193
|
-
data: createDOMFactory('data'),
|
|
2194
|
-
datalist: createDOMFactory('datalist'),
|
|
2195
|
-
dd: createDOMFactory('dd'),
|
|
2196
|
-
del: createDOMFactory('del'),
|
|
2197
|
-
details: createDOMFactory('details'),
|
|
2198
|
-
dfn: createDOMFactory('dfn'),
|
|
2199
|
-
dialog: createDOMFactory('dialog'),
|
|
2200
|
-
div: createDOMFactory('div'),
|
|
2201
|
-
dl: createDOMFactory('dl'),
|
|
2202
|
-
dt: createDOMFactory('dt'),
|
|
2203
|
-
em: createDOMFactory('em'),
|
|
2204
|
-
embed: createDOMFactory('embed'),
|
|
2205
|
-
fieldset: createDOMFactory('fieldset'),
|
|
2206
|
-
figcaption: createDOMFactory('figcaption'),
|
|
2207
|
-
figure: createDOMFactory('figure'),
|
|
2208
|
-
footer: createDOMFactory('footer'),
|
|
2209
|
-
form: createDOMFactory('form'),
|
|
2210
|
-
h1: createDOMFactory('h1'),
|
|
2211
|
-
h2: createDOMFactory('h2'),
|
|
2212
|
-
h3: createDOMFactory('h3'),
|
|
2213
|
-
h4: createDOMFactory('h4'),
|
|
2214
|
-
h5: createDOMFactory('h5'),
|
|
2215
|
-
h6: createDOMFactory('h6'),
|
|
2216
|
-
head: createDOMFactory('head'),
|
|
2217
|
-
header: createDOMFactory('header'),
|
|
2218
|
-
hgroup: createDOMFactory('hgroup'),
|
|
2219
|
-
hr: createDOMFactory('hr'),
|
|
2220
|
-
html: createDOMFactory('html'),
|
|
2221
|
-
i: createDOMFactory('i'),
|
|
2222
|
-
iframe: createDOMFactory('iframe'),
|
|
2223
|
-
img: createDOMFactory('img'),
|
|
2224
|
-
input: createDOMFactory('input'),
|
|
2225
|
-
ins: createDOMFactory('ins'),
|
|
2226
|
-
kbd: createDOMFactory('kbd'),
|
|
2227
|
-
keygen: createDOMFactory('keygen'),
|
|
2228
|
-
label: createDOMFactory('label'),
|
|
2229
|
-
legend: createDOMFactory('legend'),
|
|
2230
|
-
li: createDOMFactory('li'),
|
|
2231
|
-
link: createDOMFactory('link'),
|
|
2232
|
-
main: createDOMFactory('main'),
|
|
2233
|
-
map: createDOMFactory('map'),
|
|
2234
|
-
mark: createDOMFactory('mark'),
|
|
2235
|
-
menu: createDOMFactory('menu'),
|
|
2236
|
-
menuitem: createDOMFactory('menuitem'),
|
|
2237
|
-
meta: createDOMFactory('meta'),
|
|
2238
|
-
meter: createDOMFactory('meter'),
|
|
2239
|
-
nav: createDOMFactory('nav'),
|
|
2240
|
-
noscript: createDOMFactory('noscript'),
|
|
2241
|
-
object: createDOMFactory('object'),
|
|
2242
|
-
ol: createDOMFactory('ol'),
|
|
2243
|
-
optgroup: createDOMFactory('optgroup'),
|
|
2244
|
-
option: createDOMFactory('option'),
|
|
2245
|
-
output: createDOMFactory('output'),
|
|
2246
|
-
p: createDOMFactory('p'),
|
|
2247
|
-
param: createDOMFactory('param'),
|
|
2248
|
-
picture: createDOMFactory('picture'),
|
|
2249
|
-
pre: createDOMFactory('pre'),
|
|
2250
|
-
progress: createDOMFactory('progress'),
|
|
2251
|
-
q: createDOMFactory('q'),
|
|
2252
|
-
rp: createDOMFactory('rp'),
|
|
2253
|
-
rt: createDOMFactory('rt'),
|
|
2254
|
-
ruby: createDOMFactory('ruby'),
|
|
2255
|
-
s: createDOMFactory('s'),
|
|
2256
|
-
samp: createDOMFactory('samp'),
|
|
2257
|
-
script: createDOMFactory('script'),
|
|
2258
|
-
section: createDOMFactory('section'),
|
|
2259
|
-
select: createDOMFactory('select'),
|
|
2260
|
-
small: createDOMFactory('small'),
|
|
2261
|
-
source: createDOMFactory('source'),
|
|
2262
|
-
span: createDOMFactory('span'),
|
|
2263
|
-
strong: createDOMFactory('strong'),
|
|
2264
|
-
style: createDOMFactory('style'),
|
|
2265
|
-
sub: createDOMFactory('sub'),
|
|
2266
|
-
summary: createDOMFactory('summary'),
|
|
2267
|
-
sup: createDOMFactory('sup'),
|
|
2268
|
-
table: createDOMFactory('table'),
|
|
2269
|
-
tbody: createDOMFactory('tbody'),
|
|
2270
|
-
td: createDOMFactory('td'),
|
|
2271
|
-
textarea: createDOMFactory('textarea'),
|
|
2272
|
-
tfoot: createDOMFactory('tfoot'),
|
|
2273
|
-
th: createDOMFactory('th'),
|
|
2274
|
-
thead: createDOMFactory('thead'),
|
|
2275
|
-
time: createDOMFactory('time'),
|
|
2276
|
-
title: createDOMFactory('title'),
|
|
2277
|
-
tr: createDOMFactory('tr'),
|
|
2278
|
-
track: createDOMFactory('track'),
|
|
2279
|
-
u: createDOMFactory('u'),
|
|
2280
|
-
ul: createDOMFactory('ul'),
|
|
2281
|
-
'var': createDOMFactory('var'),
|
|
2282
|
-
video: createDOMFactory('video'),
|
|
2283
|
-
wbr: createDOMFactory('wbr'),
|
|
2284
|
-
|
|
2285
|
-
// SVG
|
|
2286
|
-
circle: createDOMFactory('circle'),
|
|
2287
|
-
clipPath: createDOMFactory('clipPath'),
|
|
2288
|
-
defs: createDOMFactory('defs'),
|
|
2289
|
-
ellipse: createDOMFactory('ellipse'),
|
|
2290
|
-
g: createDOMFactory('g'),
|
|
2291
|
-
image: createDOMFactory('image'),
|
|
2292
|
-
line: createDOMFactory('line'),
|
|
2293
|
-
linearGradient: createDOMFactory('linearGradient'),
|
|
2294
|
-
mask: createDOMFactory('mask'),
|
|
2295
|
-
path: createDOMFactory('path'),
|
|
2296
|
-
pattern: createDOMFactory('pattern'),
|
|
2297
|
-
polygon: createDOMFactory('polygon'),
|
|
2298
|
-
polyline: createDOMFactory('polyline'),
|
|
2299
|
-
radialGradient: createDOMFactory('radialGradient'),
|
|
2300
|
-
rect: createDOMFactory('rect'),
|
|
2301
|
-
stop: createDOMFactory('stop'),
|
|
2302
|
-
svg: createDOMFactory('svg'),
|
|
2303
|
-
text: createDOMFactory('text'),
|
|
2304
|
-
tspan: createDOMFactory('tspan')
|
|
2305
|
-
};
|
|
2159
|
+
var React = {
|
|
2160
|
+
Children: {
|
|
2161
|
+
map: ReactChildren_1.map,
|
|
2162
|
+
forEach: ReactChildren_1.forEach,
|
|
2163
|
+
count: ReactChildren_1.count,
|
|
2164
|
+
toArray: ReactChildren_1.toArray,
|
|
2165
|
+
only: onlyChild_1
|
|
2166
|
+
},
|
|
2306
2167
|
|
|
2307
|
-
|
|
2168
|
+
Component: ReactBaseClasses.Component,
|
|
2169
|
+
PureComponent: ReactBaseClasses.PureComponent,
|
|
2308
2170
|
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2171
|
+
createElement: createElement,
|
|
2172
|
+
cloneElement: cloneElement,
|
|
2173
|
+
isValidElement: ReactElement_1.isValidElement,
|
|
2312
2174
|
|
|
2313
|
-
|
|
2314
|
-
/* global Symbol */
|
|
2315
|
-
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
2316
|
-
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
|
|
2317
|
-
|
|
2318
|
-
/**
|
|
2319
|
-
* Returns the iterator method function contained on the iterable object.
|
|
2320
|
-
*
|
|
2321
|
-
* Be sure to invoke the function with the iterable as context:
|
|
2322
|
-
*
|
|
2323
|
-
* var iteratorFn = getIteratorFn(myIterable);
|
|
2324
|
-
* if (iteratorFn) {
|
|
2325
|
-
* var iterator = iteratorFn.call(myIterable);
|
|
2326
|
-
* ...
|
|
2327
|
-
* }
|
|
2328
|
-
*
|
|
2329
|
-
* @param {?object} maybeIterable
|
|
2330
|
-
* @return {?function}
|
|
2331
|
-
*/
|
|
2332
|
-
function getIteratorFn(maybeIterable) {
|
|
2333
|
-
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
|
|
2334
|
-
if (typeof iteratorFn === 'function') {
|
|
2335
|
-
return iteratorFn;
|
|
2336
|
-
}
|
|
2337
|
-
}
|
|
2338
|
-
|
|
2339
|
-
/**
|
|
2340
|
-
* Collection of methods that allow declaration and validation of props that are
|
|
2341
|
-
* supplied to React components. Example usage:
|
|
2342
|
-
*
|
|
2343
|
-
* var Props = require('ReactPropTypes');
|
|
2344
|
-
* var MyArticle = React.createClass({
|
|
2345
|
-
* propTypes: {
|
|
2346
|
-
* // An optional string prop named "description".
|
|
2347
|
-
* description: Props.string,
|
|
2348
|
-
*
|
|
2349
|
-
* // A required enum prop named "category".
|
|
2350
|
-
* category: Props.oneOf(['News','Photos']).isRequired,
|
|
2351
|
-
*
|
|
2352
|
-
* // A prop named "dialog" that requires an instance of Dialog.
|
|
2353
|
-
* dialog: Props.instanceOf(Dialog).isRequired
|
|
2354
|
-
* },
|
|
2355
|
-
* render: function() { ... }
|
|
2356
|
-
* });
|
|
2357
|
-
*
|
|
2358
|
-
* A more formal specification of how these methods are used:
|
|
2359
|
-
*
|
|
2360
|
-
* type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
|
|
2361
|
-
* decl := ReactPropTypes.{type}(.isRequired)?
|
|
2362
|
-
*
|
|
2363
|
-
* Each and every declaration produces a function with the same signature. This
|
|
2364
|
-
* allows the creation of custom validation functions. For example:
|
|
2365
|
-
*
|
|
2366
|
-
* var MyLink = React.createClass({
|
|
2367
|
-
* propTypes: {
|
|
2368
|
-
* // An optional string or URI prop named "href".
|
|
2369
|
-
* href: function(props, propName, componentName) {
|
|
2370
|
-
* var propValue = props[propName];
|
|
2371
|
-
* if (propValue != null && typeof propValue !== 'string' &&
|
|
2372
|
-
* !(propValue instanceof URI)) {
|
|
2373
|
-
* return new Error(
|
|
2374
|
-
* 'Expected a string or an URI for ' + propName + ' in ' +
|
|
2375
|
-
* componentName
|
|
2376
|
-
* );
|
|
2377
|
-
* }
|
|
2378
|
-
* }
|
|
2379
|
-
* },
|
|
2380
|
-
* render: function() {...}
|
|
2381
|
-
* });
|
|
2382
|
-
*
|
|
2383
|
-
* @internal
|
|
2384
|
-
*/
|
|
2385
|
-
|
|
2386
|
-
var ANONYMOUS = '<<anonymous>>';
|
|
2387
|
-
|
|
2388
|
-
// Important!
|
|
2389
|
-
// Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
|
|
2390
|
-
var ReactPropTypes = {
|
|
2391
|
-
array: createPrimitiveTypeChecker('array'),
|
|
2392
|
-
bool: createPrimitiveTypeChecker('boolean'),
|
|
2393
|
-
func: createPrimitiveTypeChecker('function'),
|
|
2394
|
-
number: createPrimitiveTypeChecker('number'),
|
|
2395
|
-
object: createPrimitiveTypeChecker('object'),
|
|
2396
|
-
string: createPrimitiveTypeChecker('string'),
|
|
2397
|
-
symbol: createPrimitiveTypeChecker('symbol'),
|
|
2398
|
-
|
|
2399
|
-
any: createAnyTypeChecker(),
|
|
2400
|
-
arrayOf: createArrayOfTypeChecker,
|
|
2401
|
-
element: createElementTypeChecker(),
|
|
2402
|
-
instanceOf: createInstanceTypeChecker,
|
|
2403
|
-
node: createNodeChecker(),
|
|
2404
|
-
objectOf: createObjectOfTypeChecker,
|
|
2405
|
-
oneOf: createEnumTypeChecker,
|
|
2406
|
-
oneOfType: createUnionTypeChecker,
|
|
2407
|
-
shape: createShapeTypeChecker
|
|
2408
|
-
};
|
|
2409
|
-
|
|
2410
|
-
/**
|
|
2411
|
-
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
|
2412
|
-
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
2413
|
-
*/
|
|
2414
|
-
/*eslint-disable no-self-compare*/
|
|
2415
|
-
function is(x, y) {
|
|
2416
|
-
// SameValue algorithm
|
|
2417
|
-
if (x === y) {
|
|
2418
|
-
// Steps 1-5, 7-10
|
|
2419
|
-
// Steps 6.b-6.e: +0 != -0
|
|
2420
|
-
return x !== 0 || 1 / x === 1 / y;
|
|
2421
|
-
} else {
|
|
2422
|
-
// Step 6.a: NaN == NaN
|
|
2423
|
-
return x !== x && y !== y;
|
|
2424
|
-
}
|
|
2425
|
-
}
|
|
2426
|
-
/*eslint-enable no-self-compare*/
|
|
2427
|
-
|
|
2428
|
-
/**
|
|
2429
|
-
* We use an Error-like object for backward compatibility as people may call
|
|
2430
|
-
* PropTypes directly and inspect their output. However, we don't use real
|
|
2431
|
-
* Errors anymore. We don't inspect their stack anyway, and creating them
|
|
2432
|
-
* is prohibitively expensive if they are created too often, such as what
|
|
2433
|
-
* happens in oneOfType() for any type before the one that matched.
|
|
2434
|
-
*/
|
|
2435
|
-
function PropTypeError(message) {
|
|
2436
|
-
this.message = message;
|
|
2437
|
-
this.stack = '';
|
|
2438
|
-
}
|
|
2439
|
-
// Make `instanceof Error` still work for returned errors.
|
|
2440
|
-
PropTypeError.prototype = Error.prototype;
|
|
2441
|
-
|
|
2442
|
-
function createChainableTypeChecker(validate) {
|
|
2443
|
-
{
|
|
2444
|
-
var manualPropTypeCallCache = {};
|
|
2445
|
-
var manualPropTypeWarningCount = 0;
|
|
2446
|
-
}
|
|
2447
|
-
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
|
|
2448
|
-
componentName = componentName || ANONYMOUS;
|
|
2449
|
-
propFullName = propFullName || propName;
|
|
2450
|
-
|
|
2451
|
-
if (secret !== ReactPropTypesSecret_1) {
|
|
2452
|
-
if (throwOnDirectAccess) {
|
|
2453
|
-
// New behavior only for users of `prop-types` package
|
|
2454
|
-
invariant_1(
|
|
2455
|
-
false,
|
|
2456
|
-
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
|
2457
|
-
'Use `PropTypes.checkPropTypes()` to call them. ' +
|
|
2458
|
-
'Read more at http://fb.me/use-check-prop-types'
|
|
2459
|
-
);
|
|
2460
|
-
} else if ('development' !== 'production' && typeof console !== 'undefined') {
|
|
2461
|
-
// Old behavior for people using React.PropTypes
|
|
2462
|
-
var cacheKey = componentName + ':' + propName;
|
|
2463
|
-
if (
|
|
2464
|
-
!manualPropTypeCallCache[cacheKey] &&
|
|
2465
|
-
// Avoid spamming the console because they are often not actionable except for lib authors
|
|
2466
|
-
manualPropTypeWarningCount < 3
|
|
2467
|
-
) {
|
|
2468
|
-
warning_1(
|
|
2469
|
-
false,
|
|
2470
|
-
'You are manually calling a React.PropTypes validation ' +
|
|
2471
|
-
'function for the `%s` prop on `%s`. This is deprecated ' +
|
|
2472
|
-
'and will throw in the standalone `prop-types` package. ' +
|
|
2473
|
-
'You may be seeing this warning due to a third-party PropTypes ' +
|
|
2474
|
-
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.',
|
|
2475
|
-
propFullName,
|
|
2476
|
-
componentName
|
|
2477
|
-
);
|
|
2478
|
-
manualPropTypeCallCache[cacheKey] = true;
|
|
2479
|
-
manualPropTypeWarningCount++;
|
|
2480
|
-
}
|
|
2481
|
-
}
|
|
2482
|
-
}
|
|
2483
|
-
if (props[propName] == null) {
|
|
2484
|
-
if (isRequired) {
|
|
2485
|
-
if (props[propName] === null) {
|
|
2486
|
-
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
|
|
2487
|
-
}
|
|
2488
|
-
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
|
|
2489
|
-
}
|
|
2490
|
-
return null;
|
|
2491
|
-
} else {
|
|
2492
|
-
return validate(props, propName, componentName, location, propFullName);
|
|
2493
|
-
}
|
|
2494
|
-
}
|
|
2495
|
-
|
|
2496
|
-
var chainedCheckType = checkType.bind(null, false);
|
|
2497
|
-
chainedCheckType.isRequired = checkType.bind(null, true);
|
|
2498
|
-
|
|
2499
|
-
return chainedCheckType;
|
|
2500
|
-
}
|
|
2501
|
-
|
|
2502
|
-
function createPrimitiveTypeChecker(expectedType) {
|
|
2503
|
-
function validate(props, propName, componentName, location, propFullName, secret) {
|
|
2504
|
-
var propValue = props[propName];
|
|
2505
|
-
var propType = getPropType(propValue);
|
|
2506
|
-
if (propType !== expectedType) {
|
|
2507
|
-
// `propValue` being instance of, say, date/regexp, pass the 'object'
|
|
2508
|
-
// check, but we can offer a more precise error message here rather than
|
|
2509
|
-
// 'of type `object`'.
|
|
2510
|
-
var preciseType = getPreciseType(propValue);
|
|
2511
|
-
|
|
2512
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
|
|
2513
|
-
}
|
|
2514
|
-
return null;
|
|
2515
|
-
}
|
|
2516
|
-
return createChainableTypeChecker(validate);
|
|
2517
|
-
}
|
|
2518
|
-
|
|
2519
|
-
function createAnyTypeChecker() {
|
|
2520
|
-
return createChainableTypeChecker(emptyFunction_1.thatReturnsNull);
|
|
2521
|
-
}
|
|
2522
|
-
|
|
2523
|
-
function createArrayOfTypeChecker(typeChecker) {
|
|
2524
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
2525
|
-
if (typeof typeChecker !== 'function') {
|
|
2526
|
-
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
|
|
2527
|
-
}
|
|
2528
|
-
var propValue = props[propName];
|
|
2529
|
-
if (!Array.isArray(propValue)) {
|
|
2530
|
-
var propType = getPropType(propValue);
|
|
2531
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
|
|
2532
|
-
}
|
|
2533
|
-
for (var i = 0; i < propValue.length; i++) {
|
|
2534
|
-
var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret_1);
|
|
2535
|
-
if (error instanceof Error) {
|
|
2536
|
-
return error;
|
|
2537
|
-
}
|
|
2538
|
-
}
|
|
2539
|
-
return null;
|
|
2540
|
-
}
|
|
2541
|
-
return createChainableTypeChecker(validate);
|
|
2542
|
-
}
|
|
2543
|
-
|
|
2544
|
-
function createElementTypeChecker() {
|
|
2545
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
2546
|
-
var propValue = props[propName];
|
|
2547
|
-
if (!isValidElement(propValue)) {
|
|
2548
|
-
var propType = getPropType(propValue);
|
|
2549
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
|
|
2550
|
-
}
|
|
2551
|
-
return null;
|
|
2552
|
-
}
|
|
2553
|
-
return createChainableTypeChecker(validate);
|
|
2554
|
-
}
|
|
2555
|
-
|
|
2556
|
-
function createInstanceTypeChecker(expectedClass) {
|
|
2557
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
2558
|
-
if (!(props[propName] instanceof expectedClass)) {
|
|
2559
|
-
var expectedClassName = expectedClass.name || ANONYMOUS;
|
|
2560
|
-
var actualClassName = getClassName(props[propName]);
|
|
2561
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
|
|
2562
|
-
}
|
|
2563
|
-
return null;
|
|
2564
|
-
}
|
|
2565
|
-
return createChainableTypeChecker(validate);
|
|
2566
|
-
}
|
|
2567
|
-
|
|
2568
|
-
function createEnumTypeChecker(expectedValues) {
|
|
2569
|
-
if (!Array.isArray(expectedValues)) {
|
|
2570
|
-
warning_1(false, 'Invalid argument supplied to oneOf, expected an instance of array.');
|
|
2571
|
-
return emptyFunction_1.thatReturnsNull;
|
|
2572
|
-
}
|
|
2573
|
-
|
|
2574
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
2575
|
-
var propValue = props[propName];
|
|
2576
|
-
for (var i = 0; i < expectedValues.length; i++) {
|
|
2577
|
-
if (is(propValue, expectedValues[i])) {
|
|
2578
|
-
return null;
|
|
2579
|
-
}
|
|
2580
|
-
}
|
|
2581
|
-
|
|
2582
|
-
var valuesString = JSON.stringify(expectedValues);
|
|
2583
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
|
|
2584
|
-
}
|
|
2585
|
-
return createChainableTypeChecker(validate);
|
|
2586
|
-
}
|
|
2587
|
-
|
|
2588
|
-
function createObjectOfTypeChecker(typeChecker) {
|
|
2589
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
2590
|
-
if (typeof typeChecker !== 'function') {
|
|
2591
|
-
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
|
|
2592
|
-
}
|
|
2593
|
-
var propValue = props[propName];
|
|
2594
|
-
var propType = getPropType(propValue);
|
|
2595
|
-
if (propType !== 'object') {
|
|
2596
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
|
2597
|
-
}
|
|
2598
|
-
for (var key in propValue) {
|
|
2599
|
-
if (propValue.hasOwnProperty(key)) {
|
|
2600
|
-
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
|
|
2601
|
-
if (error instanceof Error) {
|
|
2602
|
-
return error;
|
|
2603
|
-
}
|
|
2604
|
-
}
|
|
2605
|
-
}
|
|
2606
|
-
return null;
|
|
2607
|
-
}
|
|
2608
|
-
return createChainableTypeChecker(validate);
|
|
2609
|
-
}
|
|
2610
|
-
|
|
2611
|
-
function createUnionTypeChecker(arrayOfTypeCheckers) {
|
|
2612
|
-
if (!Array.isArray(arrayOfTypeCheckers)) {
|
|
2613
|
-
warning_1(false, 'Invalid argument supplied to oneOfType, expected an instance of array.');
|
|
2614
|
-
return emptyFunction_1.thatReturnsNull;
|
|
2615
|
-
}
|
|
2616
|
-
|
|
2617
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
2618
|
-
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
2619
|
-
var checker = arrayOfTypeCheckers[i];
|
|
2620
|
-
if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret_1) == null) {
|
|
2621
|
-
return null;
|
|
2622
|
-
}
|
|
2623
|
-
}
|
|
2624
|
-
|
|
2625
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
|
|
2626
|
-
}
|
|
2627
|
-
return createChainableTypeChecker(validate);
|
|
2628
|
-
}
|
|
2629
|
-
|
|
2630
|
-
function createNodeChecker() {
|
|
2631
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
2632
|
-
if (!isNode(props[propName])) {
|
|
2633
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
|
|
2634
|
-
}
|
|
2635
|
-
return null;
|
|
2636
|
-
}
|
|
2637
|
-
return createChainableTypeChecker(validate);
|
|
2638
|
-
}
|
|
2639
|
-
|
|
2640
|
-
function createShapeTypeChecker(shapeTypes) {
|
|
2641
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
2642
|
-
var propValue = props[propName];
|
|
2643
|
-
var propType = getPropType(propValue);
|
|
2644
|
-
if (propType !== 'object') {
|
|
2645
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
|
2646
|
-
}
|
|
2647
|
-
for (var key in shapeTypes) {
|
|
2648
|
-
var checker = shapeTypes[key];
|
|
2649
|
-
if (!checker) {
|
|
2650
|
-
continue;
|
|
2651
|
-
}
|
|
2652
|
-
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
|
|
2653
|
-
if (error) {
|
|
2654
|
-
return error;
|
|
2655
|
-
}
|
|
2656
|
-
}
|
|
2657
|
-
return null;
|
|
2658
|
-
}
|
|
2659
|
-
return createChainableTypeChecker(validate);
|
|
2660
|
-
}
|
|
2661
|
-
|
|
2662
|
-
function isNode(propValue) {
|
|
2663
|
-
switch (typeof propValue) {
|
|
2664
|
-
case 'number':
|
|
2665
|
-
case 'string':
|
|
2666
|
-
case 'undefined':
|
|
2667
|
-
return true;
|
|
2668
|
-
case 'boolean':
|
|
2669
|
-
return !propValue;
|
|
2670
|
-
case 'object':
|
|
2671
|
-
if (Array.isArray(propValue)) {
|
|
2672
|
-
return propValue.every(isNode);
|
|
2673
|
-
}
|
|
2674
|
-
if (propValue === null || isValidElement(propValue)) {
|
|
2675
|
-
return true;
|
|
2676
|
-
}
|
|
2677
|
-
|
|
2678
|
-
var iteratorFn = getIteratorFn(propValue);
|
|
2679
|
-
if (iteratorFn) {
|
|
2680
|
-
var iterator = iteratorFn.call(propValue);
|
|
2681
|
-
var step;
|
|
2682
|
-
if (iteratorFn !== propValue.entries) {
|
|
2683
|
-
while (!(step = iterator.next()).done) {
|
|
2684
|
-
if (!isNode(step.value)) {
|
|
2685
|
-
return false;
|
|
2686
|
-
}
|
|
2687
|
-
}
|
|
2688
|
-
} else {
|
|
2689
|
-
// Iterator will provide entry [k,v] tuples rather than values.
|
|
2690
|
-
while (!(step = iterator.next()).done) {
|
|
2691
|
-
var entry = step.value;
|
|
2692
|
-
if (entry) {
|
|
2693
|
-
if (!isNode(entry[1])) {
|
|
2694
|
-
return false;
|
|
2695
|
-
}
|
|
2696
|
-
}
|
|
2697
|
-
}
|
|
2698
|
-
}
|
|
2699
|
-
} else {
|
|
2700
|
-
return false;
|
|
2701
|
-
}
|
|
2702
|
-
|
|
2703
|
-
return true;
|
|
2704
|
-
default:
|
|
2705
|
-
return false;
|
|
2706
|
-
}
|
|
2707
|
-
}
|
|
2708
|
-
|
|
2709
|
-
function isSymbol(propType, propValue) {
|
|
2710
|
-
// Native Symbol.
|
|
2711
|
-
if (propType === 'symbol') {
|
|
2712
|
-
return true;
|
|
2713
|
-
}
|
|
2714
|
-
|
|
2715
|
-
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
|
|
2716
|
-
if (propValue['@@toStringTag'] === 'Symbol') {
|
|
2717
|
-
return true;
|
|
2718
|
-
}
|
|
2719
|
-
|
|
2720
|
-
// Fallback for non-spec compliant Symbols which are polyfilled.
|
|
2721
|
-
if (typeof Symbol === 'function' && propValue instanceof Symbol) {
|
|
2722
|
-
return true;
|
|
2723
|
-
}
|
|
2724
|
-
|
|
2725
|
-
return false;
|
|
2726
|
-
}
|
|
2727
|
-
|
|
2728
|
-
// Equivalent of `typeof` but with special handling for array and regexp.
|
|
2729
|
-
function getPropType(propValue) {
|
|
2730
|
-
var propType = typeof propValue;
|
|
2731
|
-
if (Array.isArray(propValue)) {
|
|
2732
|
-
return 'array';
|
|
2733
|
-
}
|
|
2734
|
-
if (propValue instanceof RegExp) {
|
|
2735
|
-
// Old webkits (at least until Android 4.0) return 'function' rather than
|
|
2736
|
-
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/
|
|
2737
|
-
// passes PropTypes.object.
|
|
2738
|
-
return 'object';
|
|
2739
|
-
}
|
|
2740
|
-
if (isSymbol(propType, propValue)) {
|
|
2741
|
-
return 'symbol';
|
|
2742
|
-
}
|
|
2743
|
-
return propType;
|
|
2744
|
-
}
|
|
2745
|
-
|
|
2746
|
-
// This handles more types than `getPropType`. Only used for error messages.
|
|
2747
|
-
// See `createPrimitiveTypeChecker`.
|
|
2748
|
-
function getPreciseType(propValue) {
|
|
2749
|
-
var propType = getPropType(propValue);
|
|
2750
|
-
if (propType === 'object') {
|
|
2751
|
-
if (propValue instanceof Date) {
|
|
2752
|
-
return 'date';
|
|
2753
|
-
} else if (propValue instanceof RegExp) {
|
|
2754
|
-
return 'regexp';
|
|
2755
|
-
}
|
|
2756
|
-
}
|
|
2757
|
-
return propType;
|
|
2758
|
-
}
|
|
2759
|
-
|
|
2760
|
-
// Returns class name of the object, if any.
|
|
2761
|
-
function getClassName(propValue) {
|
|
2762
|
-
if (!propValue.constructor || !propValue.constructor.name) {
|
|
2763
|
-
return ANONYMOUS;
|
|
2764
|
-
}
|
|
2765
|
-
return propValue.constructor.name;
|
|
2766
|
-
}
|
|
2767
|
-
|
|
2768
|
-
ReactPropTypes.checkPropTypes = checkPropTypes_1;
|
|
2769
|
-
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
2770
|
-
|
|
2771
|
-
return ReactPropTypes;
|
|
2772
|
-
};
|
|
2773
|
-
|
|
2774
|
-
var index$2 = createCommonjsModule(function (module) {
|
|
2775
|
-
/**
|
|
2776
|
-
* Copyright 2013-present, Facebook, Inc.
|
|
2777
|
-
* All rights reserved.
|
|
2778
|
-
*
|
|
2779
|
-
* This source code is licensed under the BSD-style license found in the
|
|
2780
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
2781
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
2782
|
-
*/
|
|
2783
|
-
|
|
2784
|
-
{
|
|
2785
|
-
var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&
|
|
2786
|
-
Symbol.for &&
|
|
2787
|
-
Symbol.for('react.element')) ||
|
|
2788
|
-
0xeac7;
|
|
2789
|
-
|
|
2790
|
-
var isValidElement = function(object) {
|
|
2791
|
-
return typeof object === 'object' &&
|
|
2792
|
-
object !== null &&
|
|
2793
|
-
object.$$typeof === REACT_ELEMENT_TYPE;
|
|
2794
|
-
};
|
|
2795
|
-
|
|
2796
|
-
// By explicitly using `prop-types` you are opting into new development behavior.
|
|
2797
|
-
// http://fb.me/prop-types-in-prod
|
|
2798
|
-
var throwOnDirectAccess = true;
|
|
2799
|
-
module.exports = factoryWithTypeCheckers(isValidElement, throwOnDirectAccess);
|
|
2800
|
-
}
|
|
2801
|
-
});
|
|
2802
|
-
|
|
2803
|
-
var ReactPropTypes = index$2;
|
|
2804
|
-
|
|
2805
|
-
/**
|
|
2806
|
-
* Copyright 2013-present, Facebook, Inc.
|
|
2807
|
-
* All rights reserved.
|
|
2808
|
-
*
|
|
2809
|
-
* This source code is licensed under the BSD-style license found in the
|
|
2810
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
2811
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
2812
|
-
*
|
|
2813
|
-
* @providesModule ReactVersion
|
|
2814
|
-
*/
|
|
2815
|
-
|
|
2816
|
-
var ReactVersion = '16.0.0-alpha.12';
|
|
2817
|
-
|
|
2818
|
-
/**
|
|
2819
|
-
* Returns the first child in a collection of children and verifies that there
|
|
2820
|
-
* is only one child in the collection.
|
|
2821
|
-
*
|
|
2822
|
-
* See https://facebook.github.io/react/docs/react-api.html#react.children.only
|
|
2823
|
-
*
|
|
2824
|
-
* The current implementation of this function assumes that a single child gets
|
|
2825
|
-
* passed without a wrapper, but the purpose of this helper function is to
|
|
2826
|
-
* abstract away the particular structure of children.
|
|
2827
|
-
*
|
|
2828
|
-
* @param {?object} children Child collection structure.
|
|
2829
|
-
* @return {ReactElement} The first and only `ReactElement` contained in the
|
|
2830
|
-
* structure.
|
|
2831
|
-
*/
|
|
2832
|
-
function onlyChild(children) {
|
|
2833
|
-
!ReactElement_1.isValidElement(children) ? invariant_1(false, 'React.Children.only expected to receive a single React element child.') : void 0;
|
|
2834
|
-
return children;
|
|
2835
|
-
}
|
|
2836
|
-
|
|
2837
|
-
var onlyChild_1 = onlyChild;
|
|
2838
|
-
|
|
2839
|
-
{
|
|
2840
|
-
var warning$4 = warning_1;
|
|
2841
|
-
}
|
|
2842
|
-
|
|
2843
|
-
var MIXINS_KEY = 'mixins';
|
|
2844
|
-
|
|
2845
|
-
// Helper function to allow the creation of anonymous functions which do not
|
|
2846
|
-
// have .name set to the name of the variable being assigned to.
|
|
2847
|
-
function identity(fn) {
|
|
2848
|
-
return fn;
|
|
2849
|
-
}
|
|
2850
|
-
|
|
2851
|
-
var ReactPropTypeLocationNames;
|
|
2852
|
-
{
|
|
2853
|
-
ReactPropTypeLocationNames = {
|
|
2854
|
-
prop: 'prop',
|
|
2855
|
-
context: 'context',
|
|
2856
|
-
childContext: 'child context',
|
|
2857
|
-
};
|
|
2858
|
-
}
|
|
2859
|
-
|
|
2860
|
-
function factory(ReactComponent, isValidElement, ReactNoopUpdateQueue) {
|
|
2861
|
-
/**
|
|
2862
|
-
* Policies that describe methods in `ReactClassInterface`.
|
|
2863
|
-
*/
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
var injectedMixins = [];
|
|
2867
|
-
|
|
2868
|
-
/**
|
|
2869
|
-
* Composite components are higher-level components that compose other composite
|
|
2870
|
-
* or host components.
|
|
2871
|
-
*
|
|
2872
|
-
* To create a new type of `ReactClass`, pass a specification of
|
|
2873
|
-
* your new class to `React.createClass`. The only requirement of your class
|
|
2874
|
-
* specification is that you implement a `render` method.
|
|
2875
|
-
*
|
|
2876
|
-
* var MyComponent = React.createClass({
|
|
2877
|
-
* render: function() {
|
|
2878
|
-
* return <div>Hello World</div>;
|
|
2879
|
-
* }
|
|
2880
|
-
* });
|
|
2881
|
-
*
|
|
2882
|
-
* The class specification supports a specific protocol of methods that have
|
|
2883
|
-
* special meaning (e.g. `render`). See `ReactClassInterface` for
|
|
2884
|
-
* more the comprehensive protocol. Any other properties and methods in the
|
|
2885
|
-
* class specification will be available on the prototype.
|
|
2886
|
-
*
|
|
2887
|
-
* @interface ReactClassInterface
|
|
2888
|
-
* @internal
|
|
2889
|
-
*/
|
|
2890
|
-
var ReactClassInterface = {
|
|
2891
|
-
|
|
2892
|
-
/**
|
|
2893
|
-
* An array of Mixin objects to include when defining your component.
|
|
2894
|
-
*
|
|
2895
|
-
* @type {array}
|
|
2896
|
-
* @optional
|
|
2897
|
-
*/
|
|
2898
|
-
mixins: 'DEFINE_MANY',
|
|
2899
|
-
|
|
2900
|
-
/**
|
|
2901
|
-
* An object containing properties and methods that should be defined on
|
|
2902
|
-
* the component's constructor instead of its prototype (static methods).
|
|
2903
|
-
*
|
|
2904
|
-
* @type {object}
|
|
2905
|
-
* @optional
|
|
2906
|
-
*/
|
|
2907
|
-
statics: 'DEFINE_MANY',
|
|
2908
|
-
|
|
2909
|
-
/**
|
|
2910
|
-
* Definition of prop types for this component.
|
|
2911
|
-
*
|
|
2912
|
-
* @type {object}
|
|
2913
|
-
* @optional
|
|
2914
|
-
*/
|
|
2915
|
-
propTypes: 'DEFINE_MANY',
|
|
2916
|
-
|
|
2917
|
-
/**
|
|
2918
|
-
* Definition of context types for this component.
|
|
2919
|
-
*
|
|
2920
|
-
* @type {object}
|
|
2921
|
-
* @optional
|
|
2922
|
-
*/
|
|
2923
|
-
contextTypes: 'DEFINE_MANY',
|
|
2924
|
-
|
|
2925
|
-
/**
|
|
2926
|
-
* Definition of context types this component sets for its children.
|
|
2927
|
-
*
|
|
2928
|
-
* @type {object}
|
|
2929
|
-
* @optional
|
|
2930
|
-
*/
|
|
2931
|
-
childContextTypes: 'DEFINE_MANY',
|
|
2932
|
-
|
|
2933
|
-
// ==== Definition methods ====
|
|
2934
|
-
|
|
2935
|
-
/**
|
|
2936
|
-
* Invoked when the component is mounted. Values in the mapping will be set on
|
|
2937
|
-
* `this.props` if that prop is not specified (i.e. using an `in` check).
|
|
2938
|
-
*
|
|
2939
|
-
* This method is invoked before `getInitialState` and therefore cannot rely
|
|
2940
|
-
* on `this.state` or use `this.setState`.
|
|
2941
|
-
*
|
|
2942
|
-
* @return {object}
|
|
2943
|
-
* @optional
|
|
2944
|
-
*/
|
|
2945
|
-
getDefaultProps: 'DEFINE_MANY_MERGED',
|
|
2946
|
-
|
|
2947
|
-
/**
|
|
2948
|
-
* Invoked once before the component is mounted. The return value will be used
|
|
2949
|
-
* as the initial value of `this.state`.
|
|
2950
|
-
*
|
|
2951
|
-
* getInitialState: function() {
|
|
2952
|
-
* return {
|
|
2953
|
-
* isOn: false,
|
|
2954
|
-
* fooBaz: new BazFoo()
|
|
2955
|
-
* }
|
|
2956
|
-
* }
|
|
2957
|
-
*
|
|
2958
|
-
* @return {object}
|
|
2959
|
-
* @optional
|
|
2960
|
-
*/
|
|
2961
|
-
getInitialState: 'DEFINE_MANY_MERGED',
|
|
2962
|
-
|
|
2963
|
-
/**
|
|
2964
|
-
* @return {object}
|
|
2965
|
-
* @optional
|
|
2966
|
-
*/
|
|
2967
|
-
getChildContext: 'DEFINE_MANY_MERGED',
|
|
2968
|
-
|
|
2969
|
-
/**
|
|
2970
|
-
* Uses props from `this.props` and state from `this.state` to render the
|
|
2971
|
-
* structure of the component.
|
|
2972
|
-
*
|
|
2973
|
-
* No guarantees are made about when or how often this method is invoked, so
|
|
2974
|
-
* it must not have side effects.
|
|
2975
|
-
*
|
|
2976
|
-
* render: function() {
|
|
2977
|
-
* var name = this.props.name;
|
|
2978
|
-
* return <div>Hello, {name}!</div>;
|
|
2979
|
-
* }
|
|
2980
|
-
*
|
|
2981
|
-
* @return {ReactComponent}
|
|
2982
|
-
* @nosideeffects
|
|
2983
|
-
* @required
|
|
2984
|
-
*/
|
|
2985
|
-
render: 'DEFINE_ONCE',
|
|
2986
|
-
|
|
2987
|
-
// ==== Delegate methods ====
|
|
2988
|
-
|
|
2989
|
-
/**
|
|
2990
|
-
* Invoked when the component is initially created and about to be mounted.
|
|
2991
|
-
* This may have side effects, but any external subscriptions or data created
|
|
2992
|
-
* by this method must be cleaned up in `componentWillUnmount`.
|
|
2993
|
-
*
|
|
2994
|
-
* @optional
|
|
2995
|
-
*/
|
|
2996
|
-
componentWillMount: 'DEFINE_MANY',
|
|
2997
|
-
|
|
2998
|
-
/**
|
|
2999
|
-
* Invoked when the component has been mounted and has a DOM representation.
|
|
3000
|
-
* However, there is no guarantee that the DOM node is in the document.
|
|
3001
|
-
*
|
|
3002
|
-
* Use this as an opportunity to operate on the DOM when the component has
|
|
3003
|
-
* been mounted (initialized and rendered) for the first time.
|
|
3004
|
-
*
|
|
3005
|
-
* @param {DOMElement} rootNode DOM element representing the component.
|
|
3006
|
-
* @optional
|
|
3007
|
-
*/
|
|
3008
|
-
componentDidMount: 'DEFINE_MANY',
|
|
3009
|
-
|
|
3010
|
-
/**
|
|
3011
|
-
* Invoked before the component receives new props.
|
|
3012
|
-
*
|
|
3013
|
-
* Use this as an opportunity to react to a prop transition by updating the
|
|
3014
|
-
* state using `this.setState`. Current props are accessed via `this.props`.
|
|
3015
|
-
*
|
|
3016
|
-
* componentWillReceiveProps: function(nextProps, nextContext) {
|
|
3017
|
-
* this.setState({
|
|
3018
|
-
* likesIncreasing: nextProps.likeCount > this.props.likeCount
|
|
3019
|
-
* });
|
|
3020
|
-
* }
|
|
3021
|
-
*
|
|
3022
|
-
* NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop
|
|
3023
|
-
* transition may cause a state change, but the opposite is not true. If you
|
|
3024
|
-
* need it, you are probably looking for `componentWillUpdate`.
|
|
3025
|
-
*
|
|
3026
|
-
* @param {object} nextProps
|
|
3027
|
-
* @optional
|
|
3028
|
-
*/
|
|
3029
|
-
componentWillReceiveProps: 'DEFINE_MANY',
|
|
3030
|
-
|
|
3031
|
-
/**
|
|
3032
|
-
* Invoked while deciding if the component should be updated as a result of
|
|
3033
|
-
* receiving new props, state and/or context.
|
|
3034
|
-
*
|
|
3035
|
-
* Use this as an opportunity to `return false` when you're certain that the
|
|
3036
|
-
* transition to the new props/state/context will not require a component
|
|
3037
|
-
* update.
|
|
3038
|
-
*
|
|
3039
|
-
* shouldComponentUpdate: function(nextProps, nextState, nextContext) {
|
|
3040
|
-
* return !equal(nextProps, this.props) ||
|
|
3041
|
-
* !equal(nextState, this.state) ||
|
|
3042
|
-
* !equal(nextContext, this.context);
|
|
3043
|
-
* }
|
|
3044
|
-
*
|
|
3045
|
-
* @param {object} nextProps
|
|
3046
|
-
* @param {?object} nextState
|
|
3047
|
-
* @param {?object} nextContext
|
|
3048
|
-
* @return {boolean} True if the component should update.
|
|
3049
|
-
* @optional
|
|
3050
|
-
*/
|
|
3051
|
-
shouldComponentUpdate: 'DEFINE_ONCE',
|
|
3052
|
-
|
|
3053
|
-
/**
|
|
3054
|
-
* Invoked when the component is about to update due to a transition from
|
|
3055
|
-
* `this.props`, `this.state` and `this.context` to `nextProps`, `nextState`
|
|
3056
|
-
* and `nextContext`.
|
|
3057
|
-
*
|
|
3058
|
-
* Use this as an opportunity to perform preparation before an update occurs.
|
|
3059
|
-
*
|
|
3060
|
-
* NOTE: You **cannot** use `this.setState()` in this method.
|
|
3061
|
-
*
|
|
3062
|
-
* @param {object} nextProps
|
|
3063
|
-
* @param {?object} nextState
|
|
3064
|
-
* @param {?object} nextContext
|
|
3065
|
-
* @param {ReactReconcileTransaction} transaction
|
|
3066
|
-
* @optional
|
|
3067
|
-
*/
|
|
3068
|
-
componentWillUpdate: 'DEFINE_MANY',
|
|
3069
|
-
|
|
3070
|
-
/**
|
|
3071
|
-
* Invoked when the component's DOM representation has been updated.
|
|
3072
|
-
*
|
|
3073
|
-
* Use this as an opportunity to operate on the DOM when the component has
|
|
3074
|
-
* been updated.
|
|
3075
|
-
*
|
|
3076
|
-
* @param {object} prevProps
|
|
3077
|
-
* @param {?object} prevState
|
|
3078
|
-
* @param {?object} prevContext
|
|
3079
|
-
* @param {DOMElement} rootNode DOM element representing the component.
|
|
3080
|
-
* @optional
|
|
3081
|
-
*/
|
|
3082
|
-
componentDidUpdate: 'DEFINE_MANY',
|
|
3083
|
-
|
|
3084
|
-
/**
|
|
3085
|
-
* Invoked when the component is about to be removed from its parent and have
|
|
3086
|
-
* its DOM representation destroyed.
|
|
3087
|
-
*
|
|
3088
|
-
* Use this as an opportunity to deallocate any external resources.
|
|
3089
|
-
*
|
|
3090
|
-
* NOTE: There is no `componentDidUnmount` since your component will have been
|
|
3091
|
-
* destroyed by that point.
|
|
3092
|
-
*
|
|
3093
|
-
* @optional
|
|
3094
|
-
*/
|
|
3095
|
-
componentWillUnmount: 'DEFINE_MANY',
|
|
3096
|
-
|
|
3097
|
-
// ==== Advanced methods ====
|
|
3098
|
-
|
|
3099
|
-
/**
|
|
3100
|
-
* Updates the component's currently mounted DOM representation.
|
|
3101
|
-
*
|
|
3102
|
-
* By default, this implements React's rendering and reconciliation algorithm.
|
|
3103
|
-
* Sophisticated clients may wish to override this.
|
|
3104
|
-
*
|
|
3105
|
-
* @param {ReactReconcileTransaction} transaction
|
|
3106
|
-
* @internal
|
|
3107
|
-
* @overridable
|
|
3108
|
-
*/
|
|
3109
|
-
updateComponent: 'OVERRIDE_BASE'
|
|
3110
|
-
|
|
3111
|
-
};
|
|
3112
|
-
|
|
3113
|
-
/**
|
|
3114
|
-
* Mapping from class specification keys to special processing functions.
|
|
3115
|
-
*
|
|
3116
|
-
* Although these are declared like instance properties in the specification
|
|
3117
|
-
* when defining classes using `React.createClass`, they are actually static
|
|
3118
|
-
* and are accessible on the constructor instead of the prototype. Despite
|
|
3119
|
-
* being static, they must be defined outside of the "statics" key under
|
|
3120
|
-
* which all other static methods are defined.
|
|
3121
|
-
*/
|
|
3122
|
-
var RESERVED_SPEC_KEYS = {
|
|
3123
|
-
displayName: function (Constructor, displayName) {
|
|
3124
|
-
Constructor.displayName = displayName;
|
|
3125
|
-
},
|
|
3126
|
-
mixins: function (Constructor, mixins) {
|
|
3127
|
-
if (mixins) {
|
|
3128
|
-
for (var i = 0; i < mixins.length; i++) {
|
|
3129
|
-
mixSpecIntoComponent(Constructor, mixins[i]);
|
|
3130
|
-
}
|
|
3131
|
-
}
|
|
3132
|
-
},
|
|
3133
|
-
childContextTypes: function (Constructor, childContextTypes) {
|
|
3134
|
-
{
|
|
3135
|
-
validateTypeDef(Constructor, childContextTypes, 'childContext');
|
|
3136
|
-
}
|
|
3137
|
-
Constructor.childContextTypes = index({}, Constructor.childContextTypes, childContextTypes);
|
|
3138
|
-
},
|
|
3139
|
-
contextTypes: function (Constructor, contextTypes) {
|
|
3140
|
-
{
|
|
3141
|
-
validateTypeDef(Constructor, contextTypes, 'context');
|
|
3142
|
-
}
|
|
3143
|
-
Constructor.contextTypes = index({}, Constructor.contextTypes, contextTypes);
|
|
3144
|
-
},
|
|
3145
|
-
/**
|
|
3146
|
-
* Special case getDefaultProps which should move into statics but requires
|
|
3147
|
-
* automatic merging.
|
|
3148
|
-
*/
|
|
3149
|
-
getDefaultProps: function (Constructor, getDefaultProps) {
|
|
3150
|
-
if (Constructor.getDefaultProps) {
|
|
3151
|
-
Constructor.getDefaultProps = createMergedResultFunction(Constructor.getDefaultProps, getDefaultProps);
|
|
3152
|
-
} else {
|
|
3153
|
-
Constructor.getDefaultProps = getDefaultProps;
|
|
3154
|
-
}
|
|
3155
|
-
},
|
|
3156
|
-
propTypes: function (Constructor, propTypes) {
|
|
3157
|
-
{
|
|
3158
|
-
validateTypeDef(Constructor, propTypes, 'prop');
|
|
3159
|
-
}
|
|
3160
|
-
Constructor.propTypes = index({}, Constructor.propTypes, propTypes);
|
|
3161
|
-
},
|
|
3162
|
-
statics: function (Constructor, statics) {
|
|
3163
|
-
mixStaticSpecIntoComponent(Constructor, statics);
|
|
3164
|
-
},
|
|
3165
|
-
autobind: function () {} };
|
|
3166
|
-
|
|
3167
|
-
function validateTypeDef(Constructor, typeDef, location) {
|
|
3168
|
-
for (var propName in typeDef) {
|
|
3169
|
-
if (typeDef.hasOwnProperty(propName)) {
|
|
3170
|
-
// use a warning instead of an _invariant so components
|
|
3171
|
-
// don't show up in prod but only in true
|
|
3172
|
-
warning$4(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);
|
|
3173
|
-
}
|
|
3174
|
-
}
|
|
3175
|
-
}
|
|
3176
|
-
|
|
3177
|
-
function validateMethodOverride(isAlreadyDefined, name) {
|
|
3178
|
-
var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null;
|
|
3179
|
-
|
|
3180
|
-
// Disallow overriding of base class methods unless explicitly allowed.
|
|
3181
|
-
if (ReactClassMixin.hasOwnProperty(name)) {
|
|
3182
|
-
invariant_1(specPolicy === 'OVERRIDE_BASE', 'ReactClassInterface: You are attempting to override ' + '`%s` from your class specification. Ensure that your method names ' + 'do not overlap with React methods.', name);
|
|
3183
|
-
}
|
|
3184
|
-
|
|
3185
|
-
// Disallow defining methods more than once unless explicitly allowed.
|
|
3186
|
-
if (isAlreadyDefined) {
|
|
3187
|
-
invariant_1(specPolicy === 'DEFINE_MANY' || specPolicy === 'DEFINE_MANY_MERGED', 'ReactClassInterface: You are attempting to define ' + '`%s` on your component more than once. This conflict may be due ' + 'to a mixin.', name);
|
|
3188
|
-
}
|
|
3189
|
-
}
|
|
3190
|
-
|
|
3191
|
-
/**
|
|
3192
|
-
* Mixin helper which handles policy validation and reserved
|
|
3193
|
-
* specification keys when building React classes.
|
|
3194
|
-
*/
|
|
3195
|
-
function mixSpecIntoComponent(Constructor, spec) {
|
|
3196
|
-
if (!spec) {
|
|
3197
|
-
{
|
|
3198
|
-
var typeofSpec = typeof spec;
|
|
3199
|
-
var isMixinValid = typeofSpec === 'object' && spec !== null;
|
|
3200
|
-
|
|
3201
|
-
warning$4(isMixinValid, '%s: You\'re attempting to include a mixin that is either null ' + 'or not an object. Check the mixins included by the component, ' + 'as well as any mixins they include themselves. ' + 'Expected object but got %s.', Constructor.displayName || 'ReactClass', spec === null ? null : typeofSpec);
|
|
3202
|
-
}
|
|
3203
|
-
|
|
3204
|
-
return;
|
|
3205
|
-
}
|
|
3206
|
-
|
|
3207
|
-
invariant_1(typeof spec !== 'function', 'ReactClass: You\'re attempting to ' + 'use a component class or function as a mixin. Instead, just use a ' + 'regular object.');
|
|
3208
|
-
invariant_1(!isValidElement(spec), 'ReactClass: You\'re attempting to ' + 'use a component as a mixin. Instead, just use a regular object.');
|
|
3209
|
-
|
|
3210
|
-
var proto = Constructor.prototype;
|
|
3211
|
-
var autoBindPairs = proto.__reactAutoBindPairs;
|
|
3212
|
-
|
|
3213
|
-
// By handling mixins before any other properties, we ensure the same
|
|
3214
|
-
// chaining order is applied to methods with DEFINE_MANY policy, whether
|
|
3215
|
-
// mixins are listed before or after these methods in the spec.
|
|
3216
|
-
if (spec.hasOwnProperty(MIXINS_KEY)) {
|
|
3217
|
-
RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins);
|
|
3218
|
-
}
|
|
3219
|
-
|
|
3220
|
-
for (var name in spec) {
|
|
3221
|
-
if (!spec.hasOwnProperty(name)) {
|
|
3222
|
-
continue;
|
|
3223
|
-
}
|
|
3224
|
-
|
|
3225
|
-
if (name === MIXINS_KEY) {
|
|
3226
|
-
// We have already handled mixins in a special case above.
|
|
3227
|
-
continue;
|
|
3228
|
-
}
|
|
3229
|
-
|
|
3230
|
-
var property = spec[name];
|
|
3231
|
-
var isAlreadyDefined = proto.hasOwnProperty(name);
|
|
3232
|
-
validateMethodOverride(isAlreadyDefined, name);
|
|
3233
|
-
|
|
3234
|
-
if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) {
|
|
3235
|
-
RESERVED_SPEC_KEYS[name](Constructor, property);
|
|
3236
|
-
} else {
|
|
3237
|
-
// Setup methods on prototype:
|
|
3238
|
-
// The following member methods should not be automatically bound:
|
|
3239
|
-
// 1. Expected ReactClass methods (in the "interface").
|
|
3240
|
-
// 2. Overridden methods (that were mixed in).
|
|
3241
|
-
var isReactClassMethod = ReactClassInterface.hasOwnProperty(name);
|
|
3242
|
-
var isFunction = typeof property === 'function';
|
|
3243
|
-
var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false;
|
|
3244
|
-
|
|
3245
|
-
if (shouldAutoBind) {
|
|
3246
|
-
autoBindPairs.push(name, property);
|
|
3247
|
-
proto[name] = property;
|
|
3248
|
-
} else {
|
|
3249
|
-
if (isAlreadyDefined) {
|
|
3250
|
-
var specPolicy = ReactClassInterface[name];
|
|
3251
|
-
|
|
3252
|
-
// These cases should already be caught by validateMethodOverride.
|
|
3253
|
-
invariant_1(isReactClassMethod && (specPolicy === 'DEFINE_MANY_MERGED' || specPolicy === 'DEFINE_MANY'), 'ReactClass: Unexpected spec policy %s for key %s ' + 'when mixing in component specs.', specPolicy, name);
|
|
3254
|
-
|
|
3255
|
-
// For methods which are defined more than once, call the existing
|
|
3256
|
-
// methods before calling the new property, merging if appropriate.
|
|
3257
|
-
if (specPolicy === 'DEFINE_MANY_MERGED') {
|
|
3258
|
-
proto[name] = createMergedResultFunction(proto[name], property);
|
|
3259
|
-
} else if (specPolicy === 'DEFINE_MANY') {
|
|
3260
|
-
proto[name] = createChainedFunction(proto[name], property);
|
|
3261
|
-
}
|
|
3262
|
-
} else {
|
|
3263
|
-
proto[name] = property;
|
|
3264
|
-
{
|
|
3265
|
-
// Add verbose displayName to the function, which helps when looking
|
|
3266
|
-
// at profiling tools.
|
|
3267
|
-
if (typeof property === 'function' && spec.displayName) {
|
|
3268
|
-
proto[name].displayName = spec.displayName + '_' + name;
|
|
3269
|
-
}
|
|
3270
|
-
}
|
|
3271
|
-
}
|
|
3272
|
-
}
|
|
3273
|
-
}
|
|
3274
|
-
}
|
|
3275
|
-
}
|
|
3276
|
-
|
|
3277
|
-
function mixStaticSpecIntoComponent(Constructor, statics) {
|
|
3278
|
-
if (!statics) {
|
|
3279
|
-
return;
|
|
3280
|
-
}
|
|
3281
|
-
for (var name in statics) {
|
|
3282
|
-
var property = statics[name];
|
|
3283
|
-
if (!statics.hasOwnProperty(name)) {
|
|
3284
|
-
continue;
|
|
3285
|
-
}
|
|
3286
|
-
|
|
3287
|
-
var isReserved = name in RESERVED_SPEC_KEYS;
|
|
3288
|
-
invariant_1(!isReserved, 'ReactClass: You are attempting to define a reserved ' + 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' + 'as an instance property instead; it will still be accessible on the ' + 'constructor.', name);
|
|
3289
|
-
|
|
3290
|
-
var isInherited = name in Constructor;
|
|
3291
|
-
invariant_1(!isInherited, 'ReactClass: You are attempting to define ' + '`%s` on your component more than once. This conflict may be ' + 'due to a mixin.', name);
|
|
3292
|
-
Constructor[name] = property;
|
|
3293
|
-
}
|
|
3294
|
-
}
|
|
3295
|
-
|
|
3296
|
-
/**
|
|
3297
|
-
* Merge two objects, but throw if both contain the same key.
|
|
3298
|
-
*
|
|
3299
|
-
* @param {object} one The first object, which is mutated.
|
|
3300
|
-
* @param {object} two The second object
|
|
3301
|
-
* @return {object} one after it has been mutated to contain everything in two.
|
|
3302
|
-
*/
|
|
3303
|
-
function mergeIntoWithNoDuplicateKeys(one, two) {
|
|
3304
|
-
invariant_1(one && two && typeof one === 'object' && typeof two === 'object', 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.');
|
|
3305
|
-
|
|
3306
|
-
for (var key in two) {
|
|
3307
|
-
if (two.hasOwnProperty(key)) {
|
|
3308
|
-
invariant_1(one[key] === undefined, 'mergeIntoWithNoDuplicateKeys(): ' + 'Tried to merge two objects with the same key: `%s`. This conflict ' + 'may be due to a mixin; in particular, this may be caused by two ' + 'getInitialState() or getDefaultProps() methods returning objects ' + 'with clashing keys.', key);
|
|
3309
|
-
one[key] = two[key];
|
|
3310
|
-
}
|
|
3311
|
-
}
|
|
3312
|
-
return one;
|
|
3313
|
-
}
|
|
3314
|
-
|
|
3315
|
-
/**
|
|
3316
|
-
* Creates a function that invokes two functions and merges their return values.
|
|
3317
|
-
*
|
|
3318
|
-
* @param {function} one Function to invoke first.
|
|
3319
|
-
* @param {function} two Function to invoke second.
|
|
3320
|
-
* @return {function} Function that invokes the two argument functions.
|
|
3321
|
-
* @private
|
|
3322
|
-
*/
|
|
3323
|
-
function createMergedResultFunction(one, two) {
|
|
3324
|
-
return function mergedResult() {
|
|
3325
|
-
var a = one.apply(this, arguments);
|
|
3326
|
-
var b = two.apply(this, arguments);
|
|
3327
|
-
if (a == null) {
|
|
3328
|
-
return b;
|
|
3329
|
-
} else if (b == null) {
|
|
3330
|
-
return a;
|
|
3331
|
-
}
|
|
3332
|
-
var c = {};
|
|
3333
|
-
mergeIntoWithNoDuplicateKeys(c, a);
|
|
3334
|
-
mergeIntoWithNoDuplicateKeys(c, b);
|
|
3335
|
-
return c;
|
|
3336
|
-
};
|
|
3337
|
-
}
|
|
3338
|
-
|
|
3339
|
-
/**
|
|
3340
|
-
* Creates a function that invokes two functions and ignores their return vales.
|
|
3341
|
-
*
|
|
3342
|
-
* @param {function} one Function to invoke first.
|
|
3343
|
-
* @param {function} two Function to invoke second.
|
|
3344
|
-
* @return {function} Function that invokes the two argument functions.
|
|
3345
|
-
* @private
|
|
3346
|
-
*/
|
|
3347
|
-
function createChainedFunction(one, two) {
|
|
3348
|
-
return function chainedFunction() {
|
|
3349
|
-
one.apply(this, arguments);
|
|
3350
|
-
two.apply(this, arguments);
|
|
3351
|
-
};
|
|
3352
|
-
}
|
|
3353
|
-
|
|
3354
|
-
/**
|
|
3355
|
-
* Binds a method to the component.
|
|
3356
|
-
*
|
|
3357
|
-
* @param {object} component Component whose method is going to be bound.
|
|
3358
|
-
* @param {function} method Method to be bound.
|
|
3359
|
-
* @return {function} The bound method.
|
|
3360
|
-
*/
|
|
3361
|
-
function bindAutoBindMethod(component, method) {
|
|
3362
|
-
var boundMethod = method.bind(component);
|
|
3363
|
-
{
|
|
3364
|
-
boundMethod.__reactBoundContext = component;
|
|
3365
|
-
boundMethod.__reactBoundMethod = method;
|
|
3366
|
-
boundMethod.__reactBoundArguments = null;
|
|
3367
|
-
var componentName = component.constructor.displayName;
|
|
3368
|
-
var _bind = boundMethod.bind;
|
|
3369
|
-
boundMethod.bind = function (newThis) {
|
|
3370
|
-
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
3371
|
-
args[_key - 1] = arguments[_key];
|
|
3372
|
-
}
|
|
3373
|
-
|
|
3374
|
-
// User is trying to bind() an autobound method; we effectively will
|
|
3375
|
-
// ignore the value of "this" that the user is trying to use, so
|
|
3376
|
-
// let's warn.
|
|
3377
|
-
if (newThis !== component && newThis !== null) {
|
|
3378
|
-
warning$4(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName);
|
|
3379
|
-
} else if (!args.length) {
|
|
3380
|
-
warning$4(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);
|
|
3381
|
-
return boundMethod;
|
|
3382
|
-
}
|
|
3383
|
-
var reboundMethod = _bind.apply(boundMethod, arguments);
|
|
3384
|
-
reboundMethod.__reactBoundContext = component;
|
|
3385
|
-
reboundMethod.__reactBoundMethod = method;
|
|
3386
|
-
reboundMethod.__reactBoundArguments = args;
|
|
3387
|
-
return reboundMethod;
|
|
3388
|
-
};
|
|
3389
|
-
}
|
|
3390
|
-
return boundMethod;
|
|
3391
|
-
}
|
|
3392
|
-
|
|
3393
|
-
/**
|
|
3394
|
-
* Binds all auto-bound methods in a component.
|
|
3395
|
-
*
|
|
3396
|
-
* @param {object} component Component whose method is going to be bound.
|
|
3397
|
-
*/
|
|
3398
|
-
function bindAutoBindMethods(component) {
|
|
3399
|
-
var pairs = component.__reactAutoBindPairs;
|
|
3400
|
-
for (var i = 0; i < pairs.length; i += 2) {
|
|
3401
|
-
var autoBindKey = pairs[i];
|
|
3402
|
-
var method = pairs[i + 1];
|
|
3403
|
-
component[autoBindKey] = bindAutoBindMethod(component, method);
|
|
3404
|
-
}
|
|
3405
|
-
}
|
|
3406
|
-
|
|
3407
|
-
var IsMountedMixin = {
|
|
3408
|
-
componentDidMount: function () {
|
|
3409
|
-
this.__isMounted = true;
|
|
3410
|
-
},
|
|
3411
|
-
componentWillUnmount: function () {
|
|
3412
|
-
this.__isMounted = false;
|
|
3413
|
-
}
|
|
3414
|
-
};
|
|
3415
|
-
|
|
3416
|
-
/**
|
|
3417
|
-
* Add more to the ReactClass base class. These are all legacy features and
|
|
3418
|
-
* therefore not already part of the modern ReactComponent.
|
|
3419
|
-
*/
|
|
3420
|
-
var ReactClassMixin = {
|
|
3421
|
-
|
|
3422
|
-
/**
|
|
3423
|
-
* TODO: This will be deprecated because state should always keep a consistent
|
|
3424
|
-
* type signature and the only use case for this, is to avoid that.
|
|
3425
|
-
*/
|
|
3426
|
-
replaceState: function (newState, callback) {
|
|
3427
|
-
this.updater.enqueueReplaceState(this, newState, callback);
|
|
3428
|
-
},
|
|
3429
|
-
|
|
3430
|
-
/**
|
|
3431
|
-
* Checks whether or not this composite component is mounted.
|
|
3432
|
-
* @return {boolean} True if mounted, false otherwise.
|
|
3433
|
-
* @protected
|
|
3434
|
-
* @final
|
|
3435
|
-
*/
|
|
3436
|
-
isMounted: function () {
|
|
3437
|
-
{
|
|
3438
|
-
warning$4(this.__didWarnIsMounted, '%s: isMounted is deprecated. Instead, make sure to clean up ' + 'subscriptions and pending requests in componentWillUnmount to ' + 'prevent memory leaks.', this.constructor && this.constructor.displayName || this.name || 'Component');
|
|
3439
|
-
this.__didWarnIsMounted = true;
|
|
3440
|
-
}
|
|
3441
|
-
return !!this.__isMounted;
|
|
3442
|
-
}
|
|
3443
|
-
};
|
|
3444
|
-
|
|
3445
|
-
var ReactClassComponent = function () {};
|
|
3446
|
-
index(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin);
|
|
3447
|
-
|
|
3448
|
-
/**
|
|
3449
|
-
* Creates a composite component class given a class specification.
|
|
3450
|
-
* See https://facebook.github.io/react/docs/top-level-api.html#react.createclass
|
|
3451
|
-
*
|
|
3452
|
-
* @param {object} spec Class specification (which must define `render`).
|
|
3453
|
-
* @return {function} Component constructor function.
|
|
3454
|
-
* @public
|
|
3455
|
-
*/
|
|
3456
|
-
function createClass(spec) {
|
|
3457
|
-
// To keep our warnings more understandable, we'll use a little hack here to
|
|
3458
|
-
// ensure that Constructor.name !== 'Constructor'. This makes sure we don't
|
|
3459
|
-
// unnecessarily identify a class without displayName as 'Constructor'.
|
|
3460
|
-
var Constructor = identity(function (props, context, updater) {
|
|
3461
|
-
// This constructor gets overridden by mocks. The argument is used
|
|
3462
|
-
// by mocks to assert on what gets mounted.
|
|
3463
|
-
|
|
3464
|
-
{
|
|
3465
|
-
warning$4(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory');
|
|
3466
|
-
}
|
|
3467
|
-
|
|
3468
|
-
// Wire up auto-binding
|
|
3469
|
-
if (this.__reactAutoBindPairs.length) {
|
|
3470
|
-
bindAutoBindMethods(this);
|
|
3471
|
-
}
|
|
3472
|
-
|
|
3473
|
-
this.props = props;
|
|
3474
|
-
this.context = context;
|
|
3475
|
-
this.refs = emptyObject_1;
|
|
3476
|
-
this.updater = updater || ReactNoopUpdateQueue;
|
|
3477
|
-
|
|
3478
|
-
this.state = null;
|
|
3479
|
-
|
|
3480
|
-
// ReactClasses doesn't have constructors. Instead, they use the
|
|
3481
|
-
// getInitialState and componentWillMount methods for initialization.
|
|
3482
|
-
|
|
3483
|
-
var initialState = this.getInitialState ? this.getInitialState() : null;
|
|
3484
|
-
{
|
|
3485
|
-
// We allow auto-mocks to proceed as if they're returning null.
|
|
3486
|
-
if (initialState === undefined && this.getInitialState._isMockFunction) {
|
|
3487
|
-
// This is probably bad practice. Consider warning here and
|
|
3488
|
-
// deprecating this convenience.
|
|
3489
|
-
initialState = null;
|
|
3490
|
-
}
|
|
3491
|
-
}
|
|
3492
|
-
invariant_1(typeof initialState === 'object' && !Array.isArray(initialState), '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent');
|
|
3493
|
-
|
|
3494
|
-
this.state = initialState;
|
|
3495
|
-
});
|
|
3496
|
-
Constructor.prototype = new ReactClassComponent();
|
|
3497
|
-
Constructor.prototype.constructor = Constructor;
|
|
3498
|
-
Constructor.prototype.__reactAutoBindPairs = [];
|
|
3499
|
-
|
|
3500
|
-
injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor));
|
|
3501
|
-
|
|
3502
|
-
mixSpecIntoComponent(Constructor, IsMountedMixin);
|
|
3503
|
-
mixSpecIntoComponent(Constructor, spec);
|
|
3504
|
-
|
|
3505
|
-
// Initialize the defaultProps property after all mixins have been merged.
|
|
3506
|
-
if (Constructor.getDefaultProps) {
|
|
3507
|
-
Constructor.defaultProps = Constructor.getDefaultProps();
|
|
3508
|
-
}
|
|
3509
|
-
|
|
3510
|
-
{
|
|
3511
|
-
// This is a tag to indicate that the use of these method names is ok,
|
|
3512
|
-
// since it's used with createClass. If it's not, then it's likely a
|
|
3513
|
-
// mistake so we'll warn you to use the static property, property
|
|
3514
|
-
// initializer or constructor respectively.
|
|
3515
|
-
if (Constructor.getDefaultProps) {
|
|
3516
|
-
Constructor.getDefaultProps.isReactClassApproved = {};
|
|
3517
|
-
}
|
|
3518
|
-
if (Constructor.prototype.getInitialState) {
|
|
3519
|
-
Constructor.prototype.getInitialState.isReactClassApproved = {};
|
|
3520
|
-
}
|
|
3521
|
-
}
|
|
3522
|
-
|
|
3523
|
-
invariant_1(Constructor.prototype.render, 'createClass(...): Class specification must implement a `render` method.');
|
|
3524
|
-
|
|
3525
|
-
{
|
|
3526
|
-
warning$4(!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');
|
|
3527
|
-
warning$4(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component');
|
|
3528
|
-
}
|
|
3529
|
-
|
|
3530
|
-
// Reduce time spent doing lookups by setting these on the prototype.
|
|
3531
|
-
for (var methodName in ReactClassInterface) {
|
|
3532
|
-
if (!Constructor.prototype[methodName]) {
|
|
3533
|
-
Constructor.prototype[methodName] = null;
|
|
3534
|
-
}
|
|
3535
|
-
}
|
|
3536
|
-
|
|
3537
|
-
return Constructor;
|
|
3538
|
-
}
|
|
3539
|
-
|
|
3540
|
-
return createClass;
|
|
3541
|
-
}
|
|
3542
|
-
|
|
3543
|
-
var factory_1 = factory;
|
|
3544
|
-
|
|
3545
|
-
var Component = ReactBaseClasses.Component;
|
|
3546
|
-
|
|
3547
|
-
var isValidElement = ReactElement_1.isValidElement;
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
var createClass = factory_1(Component, isValidElement, ReactNoopUpdateQueue_1);
|
|
3553
|
-
|
|
3554
|
-
var createElement = ReactElement_1.createElement;
|
|
3555
|
-
var createFactory = ReactElement_1.createFactory;
|
|
3556
|
-
var cloneElement = ReactElement_1.cloneElement;
|
|
3557
|
-
|
|
3558
|
-
{
|
|
3559
|
-
var warning = warning_1;
|
|
3560
|
-
var canDefineProperty = canDefineProperty_1;
|
|
3561
|
-
var ReactElementValidator = ReactElementValidator_1;
|
|
3562
|
-
createElement = ReactElementValidator.createElement;
|
|
3563
|
-
createFactory = ReactElementValidator.createFactory;
|
|
3564
|
-
cloneElement = ReactElementValidator.cloneElement;
|
|
3565
|
-
}
|
|
3566
|
-
|
|
3567
|
-
var createMixin = function (mixin) {
|
|
3568
|
-
return mixin;
|
|
3569
|
-
};
|
|
3570
|
-
|
|
3571
|
-
var React = {
|
|
3572
|
-
// Modern
|
|
3573
|
-
|
|
3574
|
-
Children: {
|
|
3575
|
-
map: ReactChildren_1.map,
|
|
3576
|
-
forEach: ReactChildren_1.forEach,
|
|
3577
|
-
count: ReactChildren_1.count,
|
|
3578
|
-
toArray: ReactChildren_1.toArray,
|
|
3579
|
-
only: onlyChild_1
|
|
3580
|
-
},
|
|
3581
|
-
|
|
3582
|
-
Component: ReactBaseClasses.Component,
|
|
3583
|
-
PureComponent: ReactBaseClasses.PureComponent,
|
|
3584
|
-
|
|
3585
|
-
createElement: createElement,
|
|
3586
|
-
cloneElement: cloneElement,
|
|
3587
|
-
isValidElement: ReactElement_1.isValidElement,
|
|
3588
|
-
|
|
3589
|
-
// TODO (bvaughn) Remove these getters before 16.0.0
|
|
3590
|
-
PropTypes: ReactPropTypes,
|
|
3591
|
-
checkPropTypes: checkPropTypes_1,
|
|
3592
|
-
createClass: createClass,
|
|
3593
|
-
|
|
3594
|
-
// Classic
|
|
3595
|
-
|
|
3596
|
-
createFactory: createFactory,
|
|
3597
|
-
createMixin: createMixin,
|
|
3598
|
-
|
|
3599
|
-
// This looks DOM specific but these are actually isomorphic helpers
|
|
3600
|
-
// since they are just generating DOM strings.
|
|
3601
|
-
DOM: ReactDOMFactories_1,
|
|
2175
|
+
createFactory: createFactory,
|
|
3602
2176
|
|
|
3603
2177
|
version: ReactVersion,
|
|
3604
2178
|
|
|
@@ -3613,59 +2187,6 @@ var React = {
|
|
|
3613
2187
|
ReactComponentTreeHook: ReactComponentTreeHook_1,
|
|
3614
2188
|
ReactDebugCurrentFrame: ReactDebugCurrentFrame_1
|
|
3615
2189
|
});
|
|
3616
|
-
|
|
3617
|
-
var warnedForCheckPropTypes = false;
|
|
3618
|
-
var warnedForCreateMixin = false;
|
|
3619
|
-
var warnedForCreateClass = false;
|
|
3620
|
-
var warnedForPropTypes = false;
|
|
3621
|
-
|
|
3622
|
-
React.createMixin = function (mixin) {
|
|
3623
|
-
warning(warnedForCreateMixin, 'React.createMixin is deprecated and should not be used. You ' + 'can use this mixin directly instead.');
|
|
3624
|
-
warnedForCreateMixin = true;
|
|
3625
|
-
return mixin;
|
|
3626
|
-
};
|
|
3627
|
-
|
|
3628
|
-
// TODO (bvaughn) Remove all of these accessors before 16.0.0
|
|
3629
|
-
if (canDefineProperty) {
|
|
3630
|
-
Object.defineProperty(React, 'checkPropTypes', {
|
|
3631
|
-
get: function () {
|
|
3632
|
-
warning(warnedForCheckPropTypes, 'checkPropTypes has been moved to a separate package. ' + 'Accessing React.checkPropTypes is no longer supported ' + 'and will be removed completely in React 16. ' + 'Use the prop-types package on npm instead. ' + '(https://fb.me/migrating-from-react-proptypes)');
|
|
3633
|
-
warnedForCheckPropTypes = true;
|
|
3634
|
-
return checkPropTypes_1;
|
|
3635
|
-
}
|
|
3636
|
-
});
|
|
3637
|
-
|
|
3638
|
-
Object.defineProperty(React, 'createClass', {
|
|
3639
|
-
get: function () {
|
|
3640
|
-
warning(warnedForCreateClass, 'React.createClass is no longer supported. Use a plain JavaScript ' + "class instead. If you're not yet ready to migrate, " + 'create-react-class is available on npm as a drop-in replacement. ' + '(https://fb.me/migrating-from-react-create-class)');
|
|
3641
|
-
warnedForCreateClass = true;
|
|
3642
|
-
return createClass;
|
|
3643
|
-
}
|
|
3644
|
-
});
|
|
3645
|
-
|
|
3646
|
-
Object.defineProperty(React, 'PropTypes', {
|
|
3647
|
-
get: function () {
|
|
3648
|
-
warning(warnedForPropTypes, 'PropTypes has been moved to a separate package. ' + 'Accessing React.PropTypes is no longer supported ' + 'and will be removed completely in React 16. ' + 'Use the prop-types package on npm instead. ' + '(https://fb.me/migrating-from-react-proptypes)');
|
|
3649
|
-
warnedForPropTypes = true;
|
|
3650
|
-
return ReactPropTypes;
|
|
3651
|
-
}
|
|
3652
|
-
});
|
|
3653
|
-
}
|
|
3654
|
-
|
|
3655
|
-
// React.DOM factories are deprecated. Wrap these methods so that
|
|
3656
|
-
// invocations of the React.DOM namespace and alert users to switch
|
|
3657
|
-
// to the `react-addons-dom-factories` package.
|
|
3658
|
-
React.DOM = {};
|
|
3659
|
-
var warnedForFactories = false;
|
|
3660
|
-
Object.keys(ReactDOMFactories_1).forEach(function (factory) {
|
|
3661
|
-
React.DOM[factory] = function () {
|
|
3662
|
-
if (!warnedForFactories) {
|
|
3663
|
-
warning(false, 'Accessing factories like React.DOM.%s has been deprecated ' + 'and will be removed in the future. Use the ' + 'react-addons-dom-factories package instead.', factory);
|
|
3664
|
-
warnedForFactories = true;
|
|
3665
|
-
}
|
|
3666
|
-
return ReactDOMFactories_1[factory].apply(ReactDOMFactories_1, arguments);
|
|
3667
|
-
};
|
|
3668
|
-
});
|
|
3669
2190
|
}
|
|
3670
2191
|
|
|
3671
2192
|
var React_1 = React;
|