seeder-st2110-components 1.0.4 → 1.0.6
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/dist/index.esm.js +1079 -1104
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1079 -1104
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -722,19 +722,117 @@ var reactIs_production_min = {};
|
|
|
722
722
|
* This source code is licensed under the MIT license found in the
|
|
723
723
|
* LICENSE file in the root directory of this source tree.
|
|
724
724
|
*/
|
|
725
|
-
|
|
726
725
|
var hasRequiredReactIs_production_min;
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
726
|
+
function requireReactIs_production_min() {
|
|
727
|
+
if (hasRequiredReactIs_production_min) return reactIs_production_min;
|
|
728
|
+
hasRequiredReactIs_production_min = 1;
|
|
729
|
+
var b = "function" === typeof Symbol && Symbol.for,
|
|
730
|
+
c = b ? Symbol.for("react.element") : 60103,
|
|
731
|
+
d = b ? Symbol.for("react.portal") : 60106,
|
|
732
|
+
e = b ? Symbol.for("react.fragment") : 60107,
|
|
733
|
+
f = b ? Symbol.for("react.strict_mode") : 60108,
|
|
734
|
+
g = b ? Symbol.for("react.profiler") : 60114,
|
|
735
|
+
h = b ? Symbol.for("react.provider") : 60109,
|
|
736
|
+
k = b ? Symbol.for("react.context") : 60110,
|
|
737
|
+
l = b ? Symbol.for("react.async_mode") : 60111,
|
|
738
|
+
m = b ? Symbol.for("react.concurrent_mode") : 60111,
|
|
739
|
+
n = b ? Symbol.for("react.forward_ref") : 60112,
|
|
740
|
+
p = b ? Symbol.for("react.suspense") : 60113,
|
|
741
|
+
q = b ? Symbol.for("react.suspense_list") : 60120,
|
|
742
|
+
r = b ? Symbol.for("react.memo") : 60115,
|
|
743
|
+
t = b ? Symbol.for("react.lazy") : 60116,
|
|
744
|
+
v = b ? Symbol.for("react.block") : 60121,
|
|
745
|
+
w = b ? Symbol.for("react.fundamental") : 60117,
|
|
746
|
+
x = b ? Symbol.for("react.responder") : 60118,
|
|
747
|
+
y = b ? Symbol.for("react.scope") : 60119;
|
|
748
|
+
function z(a) {
|
|
749
|
+
if ("object" === typeof a && null !== a) {
|
|
750
|
+
var u = a.$$typeof;
|
|
751
|
+
switch (u) {
|
|
752
|
+
case c:
|
|
753
|
+
switch (a = a.type, a) {
|
|
754
|
+
case l:
|
|
755
|
+
case m:
|
|
756
|
+
case e:
|
|
757
|
+
case g:
|
|
758
|
+
case f:
|
|
759
|
+
case p:
|
|
760
|
+
return a;
|
|
761
|
+
default:
|
|
762
|
+
switch (a = a && a.$$typeof, a) {
|
|
763
|
+
case k:
|
|
764
|
+
case n:
|
|
765
|
+
case t:
|
|
766
|
+
case r:
|
|
767
|
+
case h:
|
|
768
|
+
return a;
|
|
769
|
+
default:
|
|
770
|
+
return u;
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
case d:
|
|
774
|
+
return u;
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
function A(a) {
|
|
779
|
+
return z(a) === m;
|
|
780
|
+
}
|
|
781
|
+
reactIs_production_min.AsyncMode = l;
|
|
782
|
+
reactIs_production_min.ConcurrentMode = m;
|
|
783
|
+
reactIs_production_min.ContextConsumer = k;
|
|
784
|
+
reactIs_production_min.ContextProvider = h;
|
|
785
|
+
reactIs_production_min.Element = c;
|
|
786
|
+
reactIs_production_min.ForwardRef = n;
|
|
787
|
+
reactIs_production_min.Fragment = e;
|
|
788
|
+
reactIs_production_min.Lazy = t;
|
|
789
|
+
reactIs_production_min.Memo = r;
|
|
790
|
+
reactIs_production_min.Portal = d;
|
|
791
|
+
reactIs_production_min.Profiler = g;
|
|
792
|
+
reactIs_production_min.StrictMode = f;
|
|
793
|
+
reactIs_production_min.Suspense = p;
|
|
794
|
+
reactIs_production_min.isAsyncMode = function (a) {
|
|
795
|
+
return A(a) || z(a) === l;
|
|
796
|
+
};
|
|
797
|
+
reactIs_production_min.isConcurrentMode = A;
|
|
798
|
+
reactIs_production_min.isContextConsumer = function (a) {
|
|
799
|
+
return z(a) === k;
|
|
800
|
+
};
|
|
801
|
+
reactIs_production_min.isContextProvider = function (a) {
|
|
802
|
+
return z(a) === h;
|
|
803
|
+
};
|
|
804
|
+
reactIs_production_min.isElement = function (a) {
|
|
805
|
+
return "object" === typeof a && null !== a && a.$$typeof === c;
|
|
806
|
+
};
|
|
807
|
+
reactIs_production_min.isForwardRef = function (a) {
|
|
808
|
+
return z(a) === n;
|
|
809
|
+
};
|
|
810
|
+
reactIs_production_min.isFragment = function (a) {
|
|
811
|
+
return z(a) === e;
|
|
812
|
+
};
|
|
813
|
+
reactIs_production_min.isLazy = function (a) {
|
|
814
|
+
return z(a) === t;
|
|
815
|
+
};
|
|
816
|
+
reactIs_production_min.isMemo = function (a) {
|
|
817
|
+
return z(a) === r;
|
|
818
|
+
};
|
|
819
|
+
reactIs_production_min.isPortal = function (a) {
|
|
820
|
+
return z(a) === d;
|
|
821
|
+
};
|
|
822
|
+
reactIs_production_min.isProfiler = function (a) {
|
|
823
|
+
return z(a) === g;
|
|
824
|
+
};
|
|
825
|
+
reactIs_production_min.isStrictMode = function (a) {
|
|
826
|
+
return z(a) === f;
|
|
827
|
+
};
|
|
828
|
+
reactIs_production_min.isSuspense = function (a) {
|
|
829
|
+
return z(a) === p;
|
|
830
|
+
};
|
|
831
|
+
reactIs_production_min.isValidElementType = function (a) {
|
|
832
|
+
return "string" === typeof a || "function" === typeof a || a === e || a === m || a === g || a === f || a === p || a === q || "object" === typeof a && null !== a && (a.$$typeof === t || a.$$typeof === r || a.$$typeof === h || a.$$typeof === k || a.$$typeof === n || a.$$typeof === w || a.$$typeof === x || a.$$typeof === y || a.$$typeof === v);
|
|
833
|
+
};
|
|
834
|
+
reactIs_production_min.typeOf = z;
|
|
835
|
+
return reactIs_production_min;
|
|
738
836
|
}
|
|
739
837
|
|
|
740
838
|
var reactIs_development = {};
|
|
@@ -747,197 +845,179 @@ var reactIs_development = {};
|
|
|
747
845
|
* This source code is licensed under the MIT license found in the
|
|
748
846
|
* LICENSE file in the root directory of this source tree.
|
|
749
847
|
*/
|
|
750
|
-
|
|
751
848
|
var hasRequiredReactIs_development;
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
reactIs_development.isContextProvider = isContextProvider;
|
|
913
|
-
reactIs_development.isElement = isElement;
|
|
914
|
-
reactIs_development.isForwardRef = isForwardRef;
|
|
915
|
-
reactIs_development.isFragment = isFragment;
|
|
916
|
-
reactIs_development.isLazy = isLazy;
|
|
917
|
-
reactIs_development.isMemo = isMemo;
|
|
918
|
-
reactIs_development.isPortal = isPortal;
|
|
919
|
-
reactIs_development.isProfiler = isProfiler;
|
|
920
|
-
reactIs_development.isStrictMode = isStrictMode;
|
|
921
|
-
reactIs_development.isSuspense = isSuspense;
|
|
922
|
-
reactIs_development.isValidElementType = isValidElementType;
|
|
923
|
-
reactIs_development.typeOf = typeOf;
|
|
924
|
-
})();
|
|
925
|
-
}
|
|
926
|
-
return reactIs_development;
|
|
849
|
+
function requireReactIs_development() {
|
|
850
|
+
if (hasRequiredReactIs_development) return reactIs_development;
|
|
851
|
+
hasRequiredReactIs_development = 1;
|
|
852
|
+
if (process.env.NODE_ENV !== "production") {
|
|
853
|
+
(function () {
|
|
854
|
+
|
|
855
|
+
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
856
|
+
// nor polyfill, then a plain number is used for performance.
|
|
857
|
+
var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
858
|
+
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
|
|
859
|
+
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
|
860
|
+
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
|
861
|
+
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
|
862
|
+
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
|
863
|
+
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
|
864
|
+
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
|
|
865
|
+
// (unstable) APIs that have been removed. Can we remove the symbols?
|
|
866
|
+
|
|
867
|
+
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
|
|
868
|
+
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
|
869
|
+
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
870
|
+
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
871
|
+
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
|
|
872
|
+
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
873
|
+
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
|
874
|
+
var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
|
|
875
|
+
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
|
|
876
|
+
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
|
|
877
|
+
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
|
|
878
|
+
function isValidElementType(type) {
|
|
879
|
+
return typeof type === 'string' || typeof type === 'function' ||
|
|
880
|
+
// Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
881
|
+
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
|
|
882
|
+
}
|
|
883
|
+
function typeOf(object) {
|
|
884
|
+
if (typeof object === 'object' && object !== null) {
|
|
885
|
+
var $$typeof = object.$$typeof;
|
|
886
|
+
switch ($$typeof) {
|
|
887
|
+
case REACT_ELEMENT_TYPE:
|
|
888
|
+
var type = object.type;
|
|
889
|
+
switch (type) {
|
|
890
|
+
case REACT_ASYNC_MODE_TYPE:
|
|
891
|
+
case REACT_CONCURRENT_MODE_TYPE:
|
|
892
|
+
case REACT_FRAGMENT_TYPE:
|
|
893
|
+
case REACT_PROFILER_TYPE:
|
|
894
|
+
case REACT_STRICT_MODE_TYPE:
|
|
895
|
+
case REACT_SUSPENSE_TYPE:
|
|
896
|
+
return type;
|
|
897
|
+
default:
|
|
898
|
+
var $$typeofType = type && type.$$typeof;
|
|
899
|
+
switch ($$typeofType) {
|
|
900
|
+
case REACT_CONTEXT_TYPE:
|
|
901
|
+
case REACT_FORWARD_REF_TYPE:
|
|
902
|
+
case REACT_LAZY_TYPE:
|
|
903
|
+
case REACT_MEMO_TYPE:
|
|
904
|
+
case REACT_PROVIDER_TYPE:
|
|
905
|
+
return $$typeofType;
|
|
906
|
+
default:
|
|
907
|
+
return $$typeof;
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
case REACT_PORTAL_TYPE:
|
|
911
|
+
return $$typeof;
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
return undefined;
|
|
915
|
+
} // AsyncMode is deprecated along with isAsyncMode
|
|
916
|
+
|
|
917
|
+
var AsyncMode = REACT_ASYNC_MODE_TYPE;
|
|
918
|
+
var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
|
919
|
+
var ContextConsumer = REACT_CONTEXT_TYPE;
|
|
920
|
+
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
921
|
+
var Element = REACT_ELEMENT_TYPE;
|
|
922
|
+
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
923
|
+
var Fragment = REACT_FRAGMENT_TYPE;
|
|
924
|
+
var Lazy = REACT_LAZY_TYPE;
|
|
925
|
+
var Memo = REACT_MEMO_TYPE;
|
|
926
|
+
var Portal = REACT_PORTAL_TYPE;
|
|
927
|
+
var Profiler = REACT_PROFILER_TYPE;
|
|
928
|
+
var StrictMode = REACT_STRICT_MODE_TYPE;
|
|
929
|
+
var Suspense = REACT_SUSPENSE_TYPE;
|
|
930
|
+
var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
|
|
931
|
+
|
|
932
|
+
function isAsyncMode(object) {
|
|
933
|
+
{
|
|
934
|
+
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
|
935
|
+
hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
|
|
936
|
+
|
|
937
|
+
console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
|
|
941
|
+
}
|
|
942
|
+
function isConcurrentMode(object) {
|
|
943
|
+
return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
|
|
944
|
+
}
|
|
945
|
+
function isContextConsumer(object) {
|
|
946
|
+
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
947
|
+
}
|
|
948
|
+
function isContextProvider(object) {
|
|
949
|
+
return typeOf(object) === REACT_PROVIDER_TYPE;
|
|
950
|
+
}
|
|
951
|
+
function isElement(object) {
|
|
952
|
+
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
953
|
+
}
|
|
954
|
+
function isForwardRef(object) {
|
|
955
|
+
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|
956
|
+
}
|
|
957
|
+
function isFragment(object) {
|
|
958
|
+
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|
959
|
+
}
|
|
960
|
+
function isLazy(object) {
|
|
961
|
+
return typeOf(object) === REACT_LAZY_TYPE;
|
|
962
|
+
}
|
|
963
|
+
function isMemo(object) {
|
|
964
|
+
return typeOf(object) === REACT_MEMO_TYPE;
|
|
965
|
+
}
|
|
966
|
+
function isPortal(object) {
|
|
967
|
+
return typeOf(object) === REACT_PORTAL_TYPE;
|
|
968
|
+
}
|
|
969
|
+
function isProfiler(object) {
|
|
970
|
+
return typeOf(object) === REACT_PROFILER_TYPE;
|
|
971
|
+
}
|
|
972
|
+
function isStrictMode(object) {
|
|
973
|
+
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|
974
|
+
}
|
|
975
|
+
function isSuspense(object) {
|
|
976
|
+
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
977
|
+
}
|
|
978
|
+
reactIs_development.AsyncMode = AsyncMode;
|
|
979
|
+
reactIs_development.ConcurrentMode = ConcurrentMode;
|
|
980
|
+
reactIs_development.ContextConsumer = ContextConsumer;
|
|
981
|
+
reactIs_development.ContextProvider = ContextProvider;
|
|
982
|
+
reactIs_development.Element = Element;
|
|
983
|
+
reactIs_development.ForwardRef = ForwardRef;
|
|
984
|
+
reactIs_development.Fragment = Fragment;
|
|
985
|
+
reactIs_development.Lazy = Lazy;
|
|
986
|
+
reactIs_development.Memo = Memo;
|
|
987
|
+
reactIs_development.Portal = Portal;
|
|
988
|
+
reactIs_development.Profiler = Profiler;
|
|
989
|
+
reactIs_development.StrictMode = StrictMode;
|
|
990
|
+
reactIs_development.Suspense = Suspense;
|
|
991
|
+
reactIs_development.isAsyncMode = isAsyncMode;
|
|
992
|
+
reactIs_development.isConcurrentMode = isConcurrentMode;
|
|
993
|
+
reactIs_development.isContextConsumer = isContextConsumer;
|
|
994
|
+
reactIs_development.isContextProvider = isContextProvider;
|
|
995
|
+
reactIs_development.isElement = isElement;
|
|
996
|
+
reactIs_development.isForwardRef = isForwardRef;
|
|
997
|
+
reactIs_development.isFragment = isFragment;
|
|
998
|
+
reactIs_development.isLazy = isLazy;
|
|
999
|
+
reactIs_development.isMemo = isMemo;
|
|
1000
|
+
reactIs_development.isPortal = isPortal;
|
|
1001
|
+
reactIs_development.isProfiler = isProfiler;
|
|
1002
|
+
reactIs_development.isStrictMode = isStrictMode;
|
|
1003
|
+
reactIs_development.isSuspense = isSuspense;
|
|
1004
|
+
reactIs_development.isValidElementType = isValidElementType;
|
|
1005
|
+
reactIs_development.typeOf = typeOf;
|
|
1006
|
+
})();
|
|
1007
|
+
}
|
|
1008
|
+
return reactIs_development;
|
|
927
1009
|
}
|
|
928
1010
|
|
|
929
1011
|
var hasRequiredReactIs;
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
}
|
|
940
|
-
return reactIs.exports;
|
|
1012
|
+
function requireReactIs() {
|
|
1013
|
+
if (hasRequiredReactIs) return reactIs.exports;
|
|
1014
|
+
hasRequiredReactIs = 1;
|
|
1015
|
+
if (process.env.NODE_ENV === 'production') {
|
|
1016
|
+
reactIs.exports = requireReactIs_production_min();
|
|
1017
|
+
} else {
|
|
1018
|
+
reactIs.exports = requireReactIs_development();
|
|
1019
|
+
}
|
|
1020
|
+
return reactIs.exports;
|
|
941
1021
|
}
|
|
942
1022
|
|
|
943
1023
|
/*
|
|
@@ -945,97 +1025,85 @@ object-assign
|
|
|
945
1025
|
(c) Sindre Sorhus
|
|
946
1026
|
@license MIT
|
|
947
1027
|
*/
|
|
948
|
-
|
|
949
1028
|
var objectAssign;
|
|
950
1029
|
var hasRequiredObjectAssign;
|
|
1030
|
+
function requireObjectAssign() {
|
|
1031
|
+
if (hasRequiredObjectAssign) return objectAssign;
|
|
1032
|
+
hasRequiredObjectAssign = 1;
|
|
1033
|
+
/* eslint-disable no-unused-vars */
|
|
1034
|
+
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
1035
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
1036
|
+
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
1037
|
+
function toObject(val) {
|
|
1038
|
+
if (val === null || val === undefined) {
|
|
1039
|
+
throw new TypeError('Object.assign cannot be called with null or undefined');
|
|
1040
|
+
}
|
|
1041
|
+
return Object(val);
|
|
1042
|
+
}
|
|
1043
|
+
function shouldUseNative() {
|
|
1044
|
+
try {
|
|
1045
|
+
if (!Object.assign) {
|
|
1046
|
+
return false;
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
// Detect buggy property enumeration order in older V8 versions.
|
|
1050
|
+
|
|
1051
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
|
|
1052
|
+
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
|
|
1053
|
+
test1[5] = 'de';
|
|
1054
|
+
if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
|
1055
|
+
return false;
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
1059
|
+
var test2 = {};
|
|
1060
|
+
for (var i = 0; i < 10; i++) {
|
|
1061
|
+
test2['_' + String.fromCharCode(i)] = i;
|
|
1062
|
+
}
|
|
1063
|
+
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
|
1064
|
+
return test2[n];
|
|
1065
|
+
});
|
|
1066
|
+
if (order2.join('') !== '0123456789') {
|
|
1067
|
+
return false;
|
|
1068
|
+
}
|
|
951
1069
|
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
return test2[n];
|
|
990
|
-
});
|
|
991
|
-
if (order2.join('') !== '0123456789') {
|
|
992
|
-
return false;
|
|
993
|
-
}
|
|
994
|
-
|
|
995
|
-
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
996
|
-
var test3 = {};
|
|
997
|
-
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
|
998
|
-
test3[letter] = letter;
|
|
999
|
-
});
|
|
1000
|
-
if (Object.keys(Object.assign({}, test3)).join('') !==
|
|
1001
|
-
'abcdefghijklmnopqrst') {
|
|
1002
|
-
return false;
|
|
1003
|
-
}
|
|
1004
|
-
|
|
1005
|
-
return true;
|
|
1006
|
-
} catch (err) {
|
|
1007
|
-
// We don't expect any of the above to throw, but better to be safe.
|
|
1008
|
-
return false;
|
|
1009
|
-
}
|
|
1010
|
-
}
|
|
1011
|
-
|
|
1012
|
-
objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
|
|
1013
|
-
var from;
|
|
1014
|
-
var to = toObject(target);
|
|
1015
|
-
var symbols;
|
|
1016
|
-
|
|
1017
|
-
for (var s = 1; s < arguments.length; s++) {
|
|
1018
|
-
from = Object(arguments[s]);
|
|
1019
|
-
|
|
1020
|
-
for (var key in from) {
|
|
1021
|
-
if (hasOwnProperty.call(from, key)) {
|
|
1022
|
-
to[key] = from[key];
|
|
1023
|
-
}
|
|
1024
|
-
}
|
|
1025
|
-
|
|
1026
|
-
if (getOwnPropertySymbols) {
|
|
1027
|
-
symbols = getOwnPropertySymbols(from);
|
|
1028
|
-
for (var i = 0; i < symbols.length; i++) {
|
|
1029
|
-
if (propIsEnumerable.call(from, symbols[i])) {
|
|
1030
|
-
to[symbols[i]] = from[symbols[i]];
|
|
1031
|
-
}
|
|
1032
|
-
}
|
|
1033
|
-
}
|
|
1034
|
-
}
|
|
1035
|
-
|
|
1036
|
-
return to;
|
|
1037
|
-
};
|
|
1038
|
-
return objectAssign;
|
|
1070
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
1071
|
+
var test3 = {};
|
|
1072
|
+
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
|
1073
|
+
test3[letter] = letter;
|
|
1074
|
+
});
|
|
1075
|
+
if (Object.keys(Object.assign({}, test3)).join('') !== 'abcdefghijklmnopqrst') {
|
|
1076
|
+
return false;
|
|
1077
|
+
}
|
|
1078
|
+
return true;
|
|
1079
|
+
} catch (err) {
|
|
1080
|
+
// We don't expect any of the above to throw, but better to be safe.
|
|
1081
|
+
return false;
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
|
|
1085
|
+
var from;
|
|
1086
|
+
var to = toObject(target);
|
|
1087
|
+
var symbols;
|
|
1088
|
+
for (var s = 1; s < arguments.length; s++) {
|
|
1089
|
+
from = Object(arguments[s]);
|
|
1090
|
+
for (var key in from) {
|
|
1091
|
+
if (hasOwnProperty.call(from, key)) {
|
|
1092
|
+
to[key] = from[key];
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
if (getOwnPropertySymbols) {
|
|
1096
|
+
symbols = getOwnPropertySymbols(from);
|
|
1097
|
+
for (var i = 0; i < symbols.length; i++) {
|
|
1098
|
+
if (propIsEnumerable.call(from, symbols[i])) {
|
|
1099
|
+
to[symbols[i]] = from[symbols[i]];
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
return to;
|
|
1105
|
+
};
|
|
1106
|
+
return objectAssign;
|
|
1039
1107
|
}
|
|
1040
1108
|
|
|
1041
1109
|
/**
|
|
@@ -1044,28 +1112,23 @@ function requireObjectAssign () {
|
|
|
1044
1112
|
* This source code is licensed under the MIT license found in the
|
|
1045
1113
|
* LICENSE file in the root directory of this source tree.
|
|
1046
1114
|
*/
|
|
1047
|
-
|
|
1048
1115
|
var ReactPropTypesSecret_1;
|
|
1049
1116
|
var hasRequiredReactPropTypesSecret;
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
ReactPropTypesSecret_1 = ReactPropTypesSecret;
|
|
1058
|
-
return ReactPropTypesSecret_1;
|
|
1117
|
+
function requireReactPropTypesSecret() {
|
|
1118
|
+
if (hasRequiredReactPropTypesSecret) return ReactPropTypesSecret_1;
|
|
1119
|
+
hasRequiredReactPropTypesSecret = 1;
|
|
1120
|
+
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
1121
|
+
ReactPropTypesSecret_1 = ReactPropTypesSecret;
|
|
1122
|
+
return ReactPropTypesSecret_1;
|
|
1059
1123
|
}
|
|
1060
1124
|
|
|
1061
1125
|
var has;
|
|
1062
1126
|
var hasRequiredHas;
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
return has;
|
|
1127
|
+
function requireHas() {
|
|
1128
|
+
if (hasRequiredHas) return has;
|
|
1129
|
+
hasRequiredHas = 1;
|
|
1130
|
+
has = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
1131
|
+
return has;
|
|
1069
1132
|
}
|
|
1070
1133
|
|
|
1071
1134
|
/**
|
|
@@ -1074,109 +1137,88 @@ function requireHas () {
|
|
|
1074
1137
|
* This source code is licensed under the MIT license found in the
|
|
1075
1138
|
* LICENSE file in the root directory of this source tree.
|
|
1076
1139
|
*/
|
|
1077
|
-
|
|
1078
1140
|
var checkPropTypes_1;
|
|
1079
1141
|
var hasRequiredCheckPropTypes;
|
|
1142
|
+
function requireCheckPropTypes() {
|
|
1143
|
+
if (hasRequiredCheckPropTypes) return checkPropTypes_1;
|
|
1144
|
+
hasRequiredCheckPropTypes = 1;
|
|
1145
|
+
var printWarning = function () {};
|
|
1146
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1147
|
+
var ReactPropTypesSecret = /*@__PURE__*/requireReactPropTypesSecret();
|
|
1148
|
+
var loggedTypeFailures = {};
|
|
1149
|
+
var has = /*@__PURE__*/requireHas();
|
|
1150
|
+
printWarning = function (text) {
|
|
1151
|
+
var message = 'Warning: ' + text;
|
|
1152
|
+
if (typeof console !== 'undefined') {
|
|
1153
|
+
console.error(message);
|
|
1154
|
+
}
|
|
1155
|
+
try {
|
|
1156
|
+
// --- Welcome to debugging React ---
|
|
1157
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
1158
|
+
// to find the callsite that caused this warning to fire.
|
|
1159
|
+
throw new Error(message);
|
|
1160
|
+
} catch (x) {/**/}
|
|
1161
|
+
};
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
/**
|
|
1165
|
+
* Assert that the values match with the type specs.
|
|
1166
|
+
* Error messages are memorized and will only be shown once.
|
|
1167
|
+
*
|
|
1168
|
+
* @param {object} typeSpecs Map of name to a ReactPropType
|
|
1169
|
+
* @param {object} values Runtime values that need to be type-checked
|
|
1170
|
+
* @param {string} location e.g. "prop", "context", "child context"
|
|
1171
|
+
* @param {string} componentName Name of the component for error messages.
|
|
1172
|
+
* @param {?Function} getStack Returns the component stack.
|
|
1173
|
+
* @private
|
|
1174
|
+
*/
|
|
1175
|
+
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
1176
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1177
|
+
for (var typeSpecName in typeSpecs) {
|
|
1178
|
+
if (has(typeSpecs, typeSpecName)) {
|
|
1179
|
+
var error;
|
|
1180
|
+
// Prop type validation may throw. In case they do, we don't want to
|
|
1181
|
+
// fail the render phase where it didn't fail before. So we log it.
|
|
1182
|
+
// After these have been cleaned up, we'll let them throw.
|
|
1183
|
+
try {
|
|
1184
|
+
// This is intentionally an invariant that gets caught. It's the same
|
|
1185
|
+
// behavior as without this statement except with a better message.
|
|
1186
|
+
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
1187
|
+
var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
|
|
1188
|
+
err.name = 'Invariant Violation';
|
|
1189
|
+
throw err;
|
|
1190
|
+
}
|
|
1191
|
+
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
|
|
1192
|
+
} catch (ex) {
|
|
1193
|
+
error = ex;
|
|
1194
|
+
}
|
|
1195
|
+
if (error && !(error instanceof Error)) {
|
|
1196
|
+
printWarning((componentName || 'React class') + ': type specification of ' + location + ' `' + typeSpecName + '` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).');
|
|
1197
|
+
}
|
|
1198
|
+
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
1199
|
+
// Only monitor this failure once because there tends to be a lot of the
|
|
1200
|
+
// same error.
|
|
1201
|
+
loggedTypeFailures[error.message] = true;
|
|
1202
|
+
var stack = getStack ? getStack() : '';
|
|
1203
|
+
printWarning('Failed ' + location + ' type: ' + error.message + (stack != null ? stack : ''));
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1080
1209
|
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
var message = 'Warning: ' + text;
|
|
1094
|
-
if (typeof console !== 'undefined') {
|
|
1095
|
-
console.error(message);
|
|
1096
|
-
}
|
|
1097
|
-
try {
|
|
1098
|
-
// --- Welcome to debugging React ---
|
|
1099
|
-
// This error was thrown as a convenience so that you can use this stack
|
|
1100
|
-
// to find the callsite that caused this warning to fire.
|
|
1101
|
-
throw new Error(message);
|
|
1102
|
-
} catch (x) { /**/ }
|
|
1103
|
-
};
|
|
1104
|
-
}
|
|
1105
|
-
|
|
1106
|
-
/**
|
|
1107
|
-
* Assert that the values match with the type specs.
|
|
1108
|
-
* Error messages are memorized and will only be shown once.
|
|
1109
|
-
*
|
|
1110
|
-
* @param {object} typeSpecs Map of name to a ReactPropType
|
|
1111
|
-
* @param {object} values Runtime values that need to be type-checked
|
|
1112
|
-
* @param {string} location e.g. "prop", "context", "child context"
|
|
1113
|
-
* @param {string} componentName Name of the component for error messages.
|
|
1114
|
-
* @param {?Function} getStack Returns the component stack.
|
|
1115
|
-
* @private
|
|
1116
|
-
*/
|
|
1117
|
-
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
1118
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1119
|
-
for (var typeSpecName in typeSpecs) {
|
|
1120
|
-
if (has(typeSpecs, typeSpecName)) {
|
|
1121
|
-
var error;
|
|
1122
|
-
// Prop type validation may throw. In case they do, we don't want to
|
|
1123
|
-
// fail the render phase where it didn't fail before. So we log it.
|
|
1124
|
-
// After these have been cleaned up, we'll let them throw.
|
|
1125
|
-
try {
|
|
1126
|
-
// This is intentionally an invariant that gets caught. It's the same
|
|
1127
|
-
// behavior as without this statement except with a better message.
|
|
1128
|
-
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
1129
|
-
var err = Error(
|
|
1130
|
-
(componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
|
|
1131
|
-
'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
|
|
1132
|
-
'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
|
|
1133
|
-
);
|
|
1134
|
-
err.name = 'Invariant Violation';
|
|
1135
|
-
throw err;
|
|
1136
|
-
}
|
|
1137
|
-
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
|
|
1138
|
-
} catch (ex) {
|
|
1139
|
-
error = ex;
|
|
1140
|
-
}
|
|
1141
|
-
if (error && !(error instanceof Error)) {
|
|
1142
|
-
printWarning(
|
|
1143
|
-
(componentName || 'React class') + ': type specification of ' +
|
|
1144
|
-
location + ' `' + typeSpecName + '` is invalid; the type checker ' +
|
|
1145
|
-
'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
|
|
1146
|
-
'You may have forgotten to pass an argument to the type checker ' +
|
|
1147
|
-
'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
|
|
1148
|
-
'shape all require an argument).'
|
|
1149
|
-
);
|
|
1150
|
-
}
|
|
1151
|
-
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
1152
|
-
// Only monitor this failure once because there tends to be a lot of the
|
|
1153
|
-
// same error.
|
|
1154
|
-
loggedTypeFailures[error.message] = true;
|
|
1155
|
-
|
|
1156
|
-
var stack = getStack ? getStack() : '';
|
|
1157
|
-
|
|
1158
|
-
printWarning(
|
|
1159
|
-
'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
|
|
1160
|
-
);
|
|
1161
|
-
}
|
|
1162
|
-
}
|
|
1163
|
-
}
|
|
1164
|
-
}
|
|
1165
|
-
}
|
|
1166
|
-
|
|
1167
|
-
/**
|
|
1168
|
-
* Resets warning cache when testing.
|
|
1169
|
-
*
|
|
1170
|
-
* @private
|
|
1171
|
-
*/
|
|
1172
|
-
checkPropTypes.resetWarningCache = function() {
|
|
1173
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1174
|
-
loggedTypeFailures = {};
|
|
1175
|
-
}
|
|
1176
|
-
};
|
|
1177
|
-
|
|
1178
|
-
checkPropTypes_1 = checkPropTypes;
|
|
1179
|
-
return checkPropTypes_1;
|
|
1210
|
+
/**
|
|
1211
|
+
* Resets warning cache when testing.
|
|
1212
|
+
*
|
|
1213
|
+
* @private
|
|
1214
|
+
*/
|
|
1215
|
+
checkPropTypes.resetWarningCache = function () {
|
|
1216
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1217
|
+
loggedTypeFailures = {};
|
|
1218
|
+
}
|
|
1219
|
+
};
|
|
1220
|
+
checkPropTypes_1 = checkPropTypes;
|
|
1221
|
+
return checkPropTypes_1;
|
|
1180
1222
|
}
|
|
1181
1223
|
|
|
1182
1224
|
/**
|
|
@@ -1185,616 +1227,551 @@ function requireCheckPropTypes () {
|
|
|
1185
1227
|
* This source code is licensed under the MIT license found in the
|
|
1186
1228
|
* LICENSE file in the root directory of this source tree.
|
|
1187
1229
|
*/
|
|
1188
|
-
|
|
1189
1230
|
var factoryWithTypeCheckers;
|
|
1190
1231
|
var hasRequiredFactoryWithTypeCheckers;
|
|
1232
|
+
function requireFactoryWithTypeCheckers() {
|
|
1233
|
+
if (hasRequiredFactoryWithTypeCheckers) return factoryWithTypeCheckers;
|
|
1234
|
+
hasRequiredFactoryWithTypeCheckers = 1;
|
|
1235
|
+
var ReactIs = requireReactIs();
|
|
1236
|
+
var assign = requireObjectAssign();
|
|
1237
|
+
var ReactPropTypesSecret = /*@__PURE__*/requireReactPropTypesSecret();
|
|
1238
|
+
var has = /*@__PURE__*/requireHas();
|
|
1239
|
+
var checkPropTypes = /*@__PURE__*/requireCheckPropTypes();
|
|
1240
|
+
var printWarning = function () {};
|
|
1241
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1242
|
+
printWarning = function (text) {
|
|
1243
|
+
var message = 'Warning: ' + text;
|
|
1244
|
+
if (typeof console !== 'undefined') {
|
|
1245
|
+
console.error(message);
|
|
1246
|
+
}
|
|
1247
|
+
try {
|
|
1248
|
+
// --- Welcome to debugging React ---
|
|
1249
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
1250
|
+
// to find the callsite that caused this warning to fire.
|
|
1251
|
+
throw new Error(message);
|
|
1252
|
+
} catch (x) {}
|
|
1253
|
+
};
|
|
1254
|
+
}
|
|
1255
|
+
function emptyFunctionThatReturnsNull() {
|
|
1256
|
+
return null;
|
|
1257
|
+
}
|
|
1258
|
+
factoryWithTypeCheckers = function (isValidElement, throwOnDirectAccess) {
|
|
1259
|
+
/* global Symbol */
|
|
1260
|
+
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
1261
|
+
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
|
|
1262
|
+
|
|
1263
|
+
/**
|
|
1264
|
+
* Returns the iterator method function contained on the iterable object.
|
|
1265
|
+
*
|
|
1266
|
+
* Be sure to invoke the function with the iterable as context:
|
|
1267
|
+
*
|
|
1268
|
+
* var iteratorFn = getIteratorFn(myIterable);
|
|
1269
|
+
* if (iteratorFn) {
|
|
1270
|
+
* var iterator = iteratorFn.call(myIterable);
|
|
1271
|
+
* ...
|
|
1272
|
+
* }
|
|
1273
|
+
*
|
|
1274
|
+
* @param {?object} maybeIterable
|
|
1275
|
+
* @return {?function}
|
|
1276
|
+
*/
|
|
1277
|
+
function getIteratorFn(maybeIterable) {
|
|
1278
|
+
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
|
|
1279
|
+
if (typeof iteratorFn === 'function') {
|
|
1280
|
+
return iteratorFn;
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
|
|
1284
|
+
/**
|
|
1285
|
+
* Collection of methods that allow declaration and validation of props that are
|
|
1286
|
+
* supplied to React components. Example usage:
|
|
1287
|
+
*
|
|
1288
|
+
* var Props = require('ReactPropTypes');
|
|
1289
|
+
* var MyArticle = React.createClass({
|
|
1290
|
+
* propTypes: {
|
|
1291
|
+
* // An optional string prop named "description".
|
|
1292
|
+
* description: Props.string,
|
|
1293
|
+
*
|
|
1294
|
+
* // A required enum prop named "category".
|
|
1295
|
+
* category: Props.oneOf(['News','Photos']).isRequired,
|
|
1296
|
+
*
|
|
1297
|
+
* // A prop named "dialog" that requires an instance of Dialog.
|
|
1298
|
+
* dialog: Props.instanceOf(Dialog).isRequired
|
|
1299
|
+
* },
|
|
1300
|
+
* render: function() { ... }
|
|
1301
|
+
* });
|
|
1302
|
+
*
|
|
1303
|
+
* A more formal specification of how these methods are used:
|
|
1304
|
+
*
|
|
1305
|
+
* type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
|
|
1306
|
+
* decl := ReactPropTypes.{type}(.isRequired)?
|
|
1307
|
+
*
|
|
1308
|
+
* Each and every declaration produces a function with the same signature. This
|
|
1309
|
+
* allows the creation of custom validation functions. For example:
|
|
1310
|
+
*
|
|
1311
|
+
* var MyLink = React.createClass({
|
|
1312
|
+
* propTypes: {
|
|
1313
|
+
* // An optional string or URI prop named "href".
|
|
1314
|
+
* href: function(props, propName, componentName) {
|
|
1315
|
+
* var propValue = props[propName];
|
|
1316
|
+
* if (propValue != null && typeof propValue !== 'string' &&
|
|
1317
|
+
* !(propValue instanceof URI)) {
|
|
1318
|
+
* return new Error(
|
|
1319
|
+
* 'Expected a string or an URI for ' + propName + ' in ' +
|
|
1320
|
+
* componentName
|
|
1321
|
+
* );
|
|
1322
|
+
* }
|
|
1323
|
+
* }
|
|
1324
|
+
* },
|
|
1325
|
+
* render: function() {...}
|
|
1326
|
+
* });
|
|
1327
|
+
*
|
|
1328
|
+
* @internal
|
|
1329
|
+
*/
|
|
1330
|
+
|
|
1331
|
+
var ANONYMOUS = '<<anonymous>>';
|
|
1332
|
+
|
|
1333
|
+
// Important!
|
|
1334
|
+
// Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
|
|
1335
|
+
var ReactPropTypes = {
|
|
1336
|
+
array: createPrimitiveTypeChecker('array'),
|
|
1337
|
+
bigint: createPrimitiveTypeChecker('bigint'),
|
|
1338
|
+
bool: createPrimitiveTypeChecker('boolean'),
|
|
1339
|
+
func: createPrimitiveTypeChecker('function'),
|
|
1340
|
+
number: createPrimitiveTypeChecker('number'),
|
|
1341
|
+
object: createPrimitiveTypeChecker('object'),
|
|
1342
|
+
string: createPrimitiveTypeChecker('string'),
|
|
1343
|
+
symbol: createPrimitiveTypeChecker('symbol'),
|
|
1344
|
+
any: createAnyTypeChecker(),
|
|
1345
|
+
arrayOf: createArrayOfTypeChecker,
|
|
1346
|
+
element: createElementTypeChecker(),
|
|
1347
|
+
elementType: createElementTypeTypeChecker(),
|
|
1348
|
+
instanceOf: createInstanceTypeChecker,
|
|
1349
|
+
node: createNodeChecker(),
|
|
1350
|
+
objectOf: createObjectOfTypeChecker,
|
|
1351
|
+
oneOf: createEnumTypeChecker,
|
|
1352
|
+
oneOfType: createUnionTypeChecker,
|
|
1353
|
+
shape: createShapeTypeChecker,
|
|
1354
|
+
exact: createStrictShapeTypeChecker
|
|
1355
|
+
};
|
|
1356
|
+
|
|
1357
|
+
/**
|
|
1358
|
+
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
|
1359
|
+
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
1360
|
+
*/
|
|
1361
|
+
/*eslint-disable no-self-compare*/
|
|
1362
|
+
function is(x, y) {
|
|
1363
|
+
// SameValue algorithm
|
|
1364
|
+
if (x === y) {
|
|
1365
|
+
// Steps 1-5, 7-10
|
|
1366
|
+
// Steps 6.b-6.e: +0 != -0
|
|
1367
|
+
return x !== 0 || 1 / x === 1 / y;
|
|
1368
|
+
} else {
|
|
1369
|
+
// Step 6.a: NaN == NaN
|
|
1370
|
+
return x !== x && y !== y;
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
/*eslint-enable no-self-compare*/
|
|
1374
|
+
|
|
1375
|
+
/**
|
|
1376
|
+
* We use an Error-like object for backward compatibility as people may call
|
|
1377
|
+
* PropTypes directly and inspect their output. However, we don't use real
|
|
1378
|
+
* Errors anymore. We don't inspect their stack anyway, and creating them
|
|
1379
|
+
* is prohibitively expensive if they are created too often, such as what
|
|
1380
|
+
* happens in oneOfType() for any type before the one that matched.
|
|
1381
|
+
*/
|
|
1382
|
+
function PropTypeError(message, data) {
|
|
1383
|
+
this.message = message;
|
|
1384
|
+
this.data = data && typeof data === 'object' ? data : {};
|
|
1385
|
+
this.stack = '';
|
|
1386
|
+
}
|
|
1387
|
+
// Make `instanceof Error` still work for returned errors.
|
|
1388
|
+
PropTypeError.prototype = Error.prototype;
|
|
1389
|
+
function createChainableTypeChecker(validate) {
|
|
1390
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1391
|
+
var manualPropTypeCallCache = {};
|
|
1392
|
+
var manualPropTypeWarningCount = 0;
|
|
1393
|
+
}
|
|
1394
|
+
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
|
|
1395
|
+
componentName = componentName || ANONYMOUS;
|
|
1396
|
+
propFullName = propFullName || propName;
|
|
1397
|
+
if (secret !== ReactPropTypesSecret) {
|
|
1398
|
+
if (throwOnDirectAccess) {
|
|
1399
|
+
// New behavior only for users of `prop-types` package
|
|
1400
|
+
var err = new Error('Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use `PropTypes.checkPropTypes()` to call them. ' + 'Read more at http://fb.me/use-check-prop-types');
|
|
1401
|
+
err.name = 'Invariant Violation';
|
|
1402
|
+
throw err;
|
|
1403
|
+
} else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
|
|
1404
|
+
// Old behavior for people using React.PropTypes
|
|
1405
|
+
var cacheKey = componentName + ':' + propName;
|
|
1406
|
+
if (!manualPropTypeCallCache[cacheKey] &&
|
|
1407
|
+
// Avoid spamming the console because they are often not actionable except for lib authors
|
|
1408
|
+
manualPropTypeWarningCount < 3) {
|
|
1409
|
+
printWarning('You are manually calling a React.PropTypes validation ' + 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' + 'and will throw in the standalone `prop-types` package. ' + 'You may be seeing this warning due to a third-party PropTypes ' + 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.');
|
|
1410
|
+
manualPropTypeCallCache[cacheKey] = true;
|
|
1411
|
+
manualPropTypeWarningCount++;
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
}
|
|
1415
|
+
if (props[propName] == null) {
|
|
1416
|
+
if (isRequired) {
|
|
1417
|
+
if (props[propName] === null) {
|
|
1418
|
+
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
|
|
1419
|
+
}
|
|
1420
|
+
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
|
|
1421
|
+
}
|
|
1422
|
+
return null;
|
|
1423
|
+
} else {
|
|
1424
|
+
return validate(props, propName, componentName, location, propFullName);
|
|
1425
|
+
}
|
|
1426
|
+
}
|
|
1427
|
+
var chainedCheckType = checkType.bind(null, false);
|
|
1428
|
+
chainedCheckType.isRequired = checkType.bind(null, true);
|
|
1429
|
+
return chainedCheckType;
|
|
1430
|
+
}
|
|
1431
|
+
function createPrimitiveTypeChecker(expectedType) {
|
|
1432
|
+
function validate(props, propName, componentName, location, propFullName, secret) {
|
|
1433
|
+
var propValue = props[propName];
|
|
1434
|
+
var propType = getPropType(propValue);
|
|
1435
|
+
if (propType !== expectedType) {
|
|
1436
|
+
// `propValue` being instance of, say, date/regexp, pass the 'object'
|
|
1437
|
+
// check, but we can offer a more precise error message here rather than
|
|
1438
|
+
// 'of type `object`'.
|
|
1439
|
+
var preciseType = getPreciseType(propValue);
|
|
1440
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'), {
|
|
1441
|
+
expectedType: expectedType
|
|
1442
|
+
});
|
|
1443
|
+
}
|
|
1444
|
+
return null;
|
|
1445
|
+
}
|
|
1446
|
+
return createChainableTypeChecker(validate);
|
|
1447
|
+
}
|
|
1448
|
+
function createAnyTypeChecker() {
|
|
1449
|
+
return createChainableTypeChecker(emptyFunctionThatReturnsNull);
|
|
1450
|
+
}
|
|
1451
|
+
function createArrayOfTypeChecker(typeChecker) {
|
|
1452
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
1453
|
+
if (typeof typeChecker !== 'function') {
|
|
1454
|
+
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
|
|
1455
|
+
}
|
|
1456
|
+
var propValue = props[propName];
|
|
1457
|
+
if (!Array.isArray(propValue)) {
|
|
1458
|
+
var propType = getPropType(propValue);
|
|
1459
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
|
|
1460
|
+
}
|
|
1461
|
+
for (var i = 0; i < propValue.length; i++) {
|
|
1462
|
+
var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
|
|
1463
|
+
if (error instanceof Error) {
|
|
1464
|
+
return error;
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
return null;
|
|
1468
|
+
}
|
|
1469
|
+
return createChainableTypeChecker(validate);
|
|
1470
|
+
}
|
|
1471
|
+
function createElementTypeChecker() {
|
|
1472
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
1473
|
+
var propValue = props[propName];
|
|
1474
|
+
if (!isValidElement(propValue)) {
|
|
1475
|
+
var propType = getPropType(propValue);
|
|
1476
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
|
|
1477
|
+
}
|
|
1478
|
+
return null;
|
|
1479
|
+
}
|
|
1480
|
+
return createChainableTypeChecker(validate);
|
|
1481
|
+
}
|
|
1482
|
+
function createElementTypeTypeChecker() {
|
|
1483
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
1484
|
+
var propValue = props[propName];
|
|
1485
|
+
if (!ReactIs.isValidElementType(propValue)) {
|
|
1486
|
+
var propType = getPropType(propValue);
|
|
1487
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
|
|
1488
|
+
}
|
|
1489
|
+
return null;
|
|
1490
|
+
}
|
|
1491
|
+
return createChainableTypeChecker(validate);
|
|
1492
|
+
}
|
|
1493
|
+
function createInstanceTypeChecker(expectedClass) {
|
|
1494
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
1495
|
+
if (!(props[propName] instanceof expectedClass)) {
|
|
1496
|
+
var expectedClassName = expectedClass.name || ANONYMOUS;
|
|
1497
|
+
var actualClassName = getClassName(props[propName]);
|
|
1498
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
|
|
1499
|
+
}
|
|
1500
|
+
return null;
|
|
1501
|
+
}
|
|
1502
|
+
return createChainableTypeChecker(validate);
|
|
1503
|
+
}
|
|
1504
|
+
function createEnumTypeChecker(expectedValues) {
|
|
1505
|
+
if (!Array.isArray(expectedValues)) {
|
|
1506
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1507
|
+
if (arguments.length > 1) {
|
|
1508
|
+
printWarning('Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' + 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).');
|
|
1509
|
+
} else {
|
|
1510
|
+
printWarning('Invalid argument supplied to oneOf, expected an array.');
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
return emptyFunctionThatReturnsNull;
|
|
1514
|
+
}
|
|
1515
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
1516
|
+
var propValue = props[propName];
|
|
1517
|
+
for (var i = 0; i < expectedValues.length; i++) {
|
|
1518
|
+
if (is(propValue, expectedValues[i])) {
|
|
1519
|
+
return null;
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1522
|
+
var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
|
|
1523
|
+
var type = getPreciseType(value);
|
|
1524
|
+
if (type === 'symbol') {
|
|
1525
|
+
return String(value);
|
|
1526
|
+
}
|
|
1527
|
+
return value;
|
|
1528
|
+
});
|
|
1529
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
|
|
1530
|
+
}
|
|
1531
|
+
return createChainableTypeChecker(validate);
|
|
1532
|
+
}
|
|
1533
|
+
function createObjectOfTypeChecker(typeChecker) {
|
|
1534
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
1535
|
+
if (typeof typeChecker !== 'function') {
|
|
1536
|
+
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
|
|
1537
|
+
}
|
|
1538
|
+
var propValue = props[propName];
|
|
1539
|
+
var propType = getPropType(propValue);
|
|
1540
|
+
if (propType !== 'object') {
|
|
1541
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
|
1542
|
+
}
|
|
1543
|
+
for (var key in propValue) {
|
|
1544
|
+
if (has(propValue, key)) {
|
|
1545
|
+
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
|
1546
|
+
if (error instanceof Error) {
|
|
1547
|
+
return error;
|
|
1548
|
+
}
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
return null;
|
|
1552
|
+
}
|
|
1553
|
+
return createChainableTypeChecker(validate);
|
|
1554
|
+
}
|
|
1555
|
+
function createUnionTypeChecker(arrayOfTypeCheckers) {
|
|
1556
|
+
if (!Array.isArray(arrayOfTypeCheckers)) {
|
|
1557
|
+
process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
|
|
1558
|
+
return emptyFunctionThatReturnsNull;
|
|
1559
|
+
}
|
|
1560
|
+
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
1561
|
+
var checker = arrayOfTypeCheckers[i];
|
|
1562
|
+
if (typeof checker !== 'function') {
|
|
1563
|
+
printWarning('Invalid argument supplied to oneOfType. Expected an array of check functions, but ' + 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.');
|
|
1564
|
+
return emptyFunctionThatReturnsNull;
|
|
1565
|
+
}
|
|
1566
|
+
}
|
|
1567
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
1568
|
+
var expectedTypes = [];
|
|
1569
|
+
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
1570
|
+
var checker = arrayOfTypeCheckers[i];
|
|
1571
|
+
var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
|
|
1572
|
+
if (checkerResult == null) {
|
|
1573
|
+
return null;
|
|
1574
|
+
}
|
|
1575
|
+
if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
|
|
1576
|
+
expectedTypes.push(checkerResult.data.expectedType);
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
var expectedTypesMessage = expectedTypes.length > 0 ? ', expected one of type [' + expectedTypes.join(', ') + ']' : '';
|
|
1580
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
|
|
1581
|
+
}
|
|
1582
|
+
return createChainableTypeChecker(validate);
|
|
1583
|
+
}
|
|
1584
|
+
function createNodeChecker() {
|
|
1585
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
1586
|
+
if (!isNode(props[propName])) {
|
|
1587
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
|
|
1588
|
+
}
|
|
1589
|
+
return null;
|
|
1590
|
+
}
|
|
1591
|
+
return createChainableTypeChecker(validate);
|
|
1592
|
+
}
|
|
1593
|
+
function invalidValidatorError(componentName, location, propFullName, key, type) {
|
|
1594
|
+
return new PropTypeError((componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.');
|
|
1595
|
+
}
|
|
1596
|
+
function createShapeTypeChecker(shapeTypes) {
|
|
1597
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
1598
|
+
var propValue = props[propName];
|
|
1599
|
+
var propType = getPropType(propValue);
|
|
1600
|
+
if (propType !== 'object') {
|
|
1601
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
|
1602
|
+
}
|
|
1603
|
+
for (var key in shapeTypes) {
|
|
1604
|
+
var checker = shapeTypes[key];
|
|
1605
|
+
if (typeof checker !== 'function') {
|
|
1606
|
+
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
1607
|
+
}
|
|
1608
|
+
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
|
1609
|
+
if (error) {
|
|
1610
|
+
return error;
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
return null;
|
|
1614
|
+
}
|
|
1615
|
+
return createChainableTypeChecker(validate);
|
|
1616
|
+
}
|
|
1617
|
+
function createStrictShapeTypeChecker(shapeTypes) {
|
|
1618
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
1619
|
+
var propValue = props[propName];
|
|
1620
|
+
var propType = getPropType(propValue);
|
|
1621
|
+
if (propType !== 'object') {
|
|
1622
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
|
1623
|
+
}
|
|
1624
|
+
// We need to check all keys in case some are required but missing from props.
|
|
1625
|
+
var allKeys = assign({}, props[propName], shapeTypes);
|
|
1626
|
+
for (var key in allKeys) {
|
|
1627
|
+
var checker = shapeTypes[key];
|
|
1628
|
+
if (has(shapeTypes, key) && typeof checker !== 'function') {
|
|
1629
|
+
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
1630
|
+
}
|
|
1631
|
+
if (!checker) {
|
|
1632
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' + '\nBad object: ' + JSON.stringify(props[propName], null, ' ') + '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' '));
|
|
1633
|
+
}
|
|
1634
|
+
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
|
1635
|
+
if (error) {
|
|
1636
|
+
return error;
|
|
1637
|
+
}
|
|
1638
|
+
}
|
|
1639
|
+
return null;
|
|
1640
|
+
}
|
|
1641
|
+
return createChainableTypeChecker(validate);
|
|
1642
|
+
}
|
|
1643
|
+
function isNode(propValue) {
|
|
1644
|
+
switch (typeof propValue) {
|
|
1645
|
+
case 'number':
|
|
1646
|
+
case 'string':
|
|
1647
|
+
case 'undefined':
|
|
1648
|
+
return true;
|
|
1649
|
+
case 'boolean':
|
|
1650
|
+
return !propValue;
|
|
1651
|
+
case 'object':
|
|
1652
|
+
if (Array.isArray(propValue)) {
|
|
1653
|
+
return propValue.every(isNode);
|
|
1654
|
+
}
|
|
1655
|
+
if (propValue === null || isValidElement(propValue)) {
|
|
1656
|
+
return true;
|
|
1657
|
+
}
|
|
1658
|
+
var iteratorFn = getIteratorFn(propValue);
|
|
1659
|
+
if (iteratorFn) {
|
|
1660
|
+
var iterator = iteratorFn.call(propValue);
|
|
1661
|
+
var step;
|
|
1662
|
+
if (iteratorFn !== propValue.entries) {
|
|
1663
|
+
while (!(step = iterator.next()).done) {
|
|
1664
|
+
if (!isNode(step.value)) {
|
|
1665
|
+
return false;
|
|
1666
|
+
}
|
|
1667
|
+
}
|
|
1668
|
+
} else {
|
|
1669
|
+
// Iterator will provide entry [k,v] tuples rather than values.
|
|
1670
|
+
while (!(step = iterator.next()).done) {
|
|
1671
|
+
var entry = step.value;
|
|
1672
|
+
if (entry) {
|
|
1673
|
+
if (!isNode(entry[1])) {
|
|
1674
|
+
return false;
|
|
1675
|
+
}
|
|
1676
|
+
}
|
|
1677
|
+
}
|
|
1678
|
+
}
|
|
1679
|
+
} else {
|
|
1680
|
+
return false;
|
|
1681
|
+
}
|
|
1682
|
+
return true;
|
|
1683
|
+
default:
|
|
1684
|
+
return false;
|
|
1685
|
+
}
|
|
1686
|
+
}
|
|
1687
|
+
function isSymbol(propType, propValue) {
|
|
1688
|
+
// Native Symbol.
|
|
1689
|
+
if (propType === 'symbol') {
|
|
1690
|
+
return true;
|
|
1691
|
+
}
|
|
1692
|
+
|
|
1693
|
+
// falsy value can't be a Symbol
|
|
1694
|
+
if (!propValue) {
|
|
1695
|
+
return false;
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1698
|
+
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
|
|
1699
|
+
if (propValue['@@toStringTag'] === 'Symbol') {
|
|
1700
|
+
return true;
|
|
1701
|
+
}
|
|
1702
|
+
|
|
1703
|
+
// Fallback for non-spec compliant Symbols which are polyfilled.
|
|
1704
|
+
if (typeof Symbol === 'function' && propValue instanceof Symbol) {
|
|
1705
|
+
return true;
|
|
1706
|
+
}
|
|
1707
|
+
return false;
|
|
1708
|
+
}
|
|
1709
|
+
|
|
1710
|
+
// Equivalent of `typeof` but with special handling for array and regexp.
|
|
1711
|
+
function getPropType(propValue) {
|
|
1712
|
+
var propType = typeof propValue;
|
|
1713
|
+
if (Array.isArray(propValue)) {
|
|
1714
|
+
return 'array';
|
|
1715
|
+
}
|
|
1716
|
+
if (propValue instanceof RegExp) {
|
|
1717
|
+
// Old webkits (at least until Android 4.0) return 'function' rather than
|
|
1718
|
+
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/
|
|
1719
|
+
// passes PropTypes.object.
|
|
1720
|
+
return 'object';
|
|
1721
|
+
}
|
|
1722
|
+
if (isSymbol(propType, propValue)) {
|
|
1723
|
+
return 'symbol';
|
|
1724
|
+
}
|
|
1725
|
+
return propType;
|
|
1726
|
+
}
|
|
1727
|
+
|
|
1728
|
+
// This handles more types than `getPropType`. Only used for error messages.
|
|
1729
|
+
// See `createPrimitiveTypeChecker`.
|
|
1730
|
+
function getPreciseType(propValue) {
|
|
1731
|
+
if (typeof propValue === 'undefined' || propValue === null) {
|
|
1732
|
+
return '' + propValue;
|
|
1733
|
+
}
|
|
1734
|
+
var propType = getPropType(propValue);
|
|
1735
|
+
if (propType === 'object') {
|
|
1736
|
+
if (propValue instanceof Date) {
|
|
1737
|
+
return 'date';
|
|
1738
|
+
} else if (propValue instanceof RegExp) {
|
|
1739
|
+
return 'regexp';
|
|
1740
|
+
}
|
|
1741
|
+
}
|
|
1742
|
+
return propType;
|
|
1743
|
+
}
|
|
1744
|
+
|
|
1745
|
+
// Returns a string that is postfixed to a warning about an invalid type.
|
|
1746
|
+
// For example, "undefined" or "of type array"
|
|
1747
|
+
function getPostfixForTypeWarning(value) {
|
|
1748
|
+
var type = getPreciseType(value);
|
|
1749
|
+
switch (type) {
|
|
1750
|
+
case 'array':
|
|
1751
|
+
case 'object':
|
|
1752
|
+
return 'an ' + type;
|
|
1753
|
+
case 'boolean':
|
|
1754
|
+
case 'date':
|
|
1755
|
+
case 'regexp':
|
|
1756
|
+
return 'a ' + type;
|
|
1757
|
+
default:
|
|
1758
|
+
return type;
|
|
1759
|
+
}
|
|
1760
|
+
}
|
|
1191
1761
|
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1206
|
-
printWarning = function(text) {
|
|
1207
|
-
var message = 'Warning: ' + text;
|
|
1208
|
-
if (typeof console !== 'undefined') {
|
|
1209
|
-
console.error(message);
|
|
1210
|
-
}
|
|
1211
|
-
try {
|
|
1212
|
-
// --- Welcome to debugging React ---
|
|
1213
|
-
// This error was thrown as a convenience so that you can use this stack
|
|
1214
|
-
// to find the callsite that caused this warning to fire.
|
|
1215
|
-
throw new Error(message);
|
|
1216
|
-
} catch (x) {}
|
|
1217
|
-
};
|
|
1218
|
-
}
|
|
1219
|
-
|
|
1220
|
-
function emptyFunctionThatReturnsNull() {
|
|
1221
|
-
return null;
|
|
1222
|
-
}
|
|
1223
|
-
|
|
1224
|
-
factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
1225
|
-
/* global Symbol */
|
|
1226
|
-
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
1227
|
-
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
|
|
1228
|
-
|
|
1229
|
-
/**
|
|
1230
|
-
* Returns the iterator method function contained on the iterable object.
|
|
1231
|
-
*
|
|
1232
|
-
* Be sure to invoke the function with the iterable as context:
|
|
1233
|
-
*
|
|
1234
|
-
* var iteratorFn = getIteratorFn(myIterable);
|
|
1235
|
-
* if (iteratorFn) {
|
|
1236
|
-
* var iterator = iteratorFn.call(myIterable);
|
|
1237
|
-
* ...
|
|
1238
|
-
* }
|
|
1239
|
-
*
|
|
1240
|
-
* @param {?object} maybeIterable
|
|
1241
|
-
* @return {?function}
|
|
1242
|
-
*/
|
|
1243
|
-
function getIteratorFn(maybeIterable) {
|
|
1244
|
-
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
|
|
1245
|
-
if (typeof iteratorFn === 'function') {
|
|
1246
|
-
return iteratorFn;
|
|
1247
|
-
}
|
|
1248
|
-
}
|
|
1249
|
-
|
|
1250
|
-
/**
|
|
1251
|
-
* Collection of methods that allow declaration and validation of props that are
|
|
1252
|
-
* supplied to React components. Example usage:
|
|
1253
|
-
*
|
|
1254
|
-
* var Props = require('ReactPropTypes');
|
|
1255
|
-
* var MyArticle = React.createClass({
|
|
1256
|
-
* propTypes: {
|
|
1257
|
-
* // An optional string prop named "description".
|
|
1258
|
-
* description: Props.string,
|
|
1259
|
-
*
|
|
1260
|
-
* // A required enum prop named "category".
|
|
1261
|
-
* category: Props.oneOf(['News','Photos']).isRequired,
|
|
1262
|
-
*
|
|
1263
|
-
* // A prop named "dialog" that requires an instance of Dialog.
|
|
1264
|
-
* dialog: Props.instanceOf(Dialog).isRequired
|
|
1265
|
-
* },
|
|
1266
|
-
* render: function() { ... }
|
|
1267
|
-
* });
|
|
1268
|
-
*
|
|
1269
|
-
* A more formal specification of how these methods are used:
|
|
1270
|
-
*
|
|
1271
|
-
* type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
|
|
1272
|
-
* decl := ReactPropTypes.{type}(.isRequired)?
|
|
1273
|
-
*
|
|
1274
|
-
* Each and every declaration produces a function with the same signature. This
|
|
1275
|
-
* allows the creation of custom validation functions. For example:
|
|
1276
|
-
*
|
|
1277
|
-
* var MyLink = React.createClass({
|
|
1278
|
-
* propTypes: {
|
|
1279
|
-
* // An optional string or URI prop named "href".
|
|
1280
|
-
* href: function(props, propName, componentName) {
|
|
1281
|
-
* var propValue = props[propName];
|
|
1282
|
-
* if (propValue != null && typeof propValue !== 'string' &&
|
|
1283
|
-
* !(propValue instanceof URI)) {
|
|
1284
|
-
* return new Error(
|
|
1285
|
-
* 'Expected a string or an URI for ' + propName + ' in ' +
|
|
1286
|
-
* componentName
|
|
1287
|
-
* );
|
|
1288
|
-
* }
|
|
1289
|
-
* }
|
|
1290
|
-
* },
|
|
1291
|
-
* render: function() {...}
|
|
1292
|
-
* });
|
|
1293
|
-
*
|
|
1294
|
-
* @internal
|
|
1295
|
-
*/
|
|
1296
|
-
|
|
1297
|
-
var ANONYMOUS = '<<anonymous>>';
|
|
1298
|
-
|
|
1299
|
-
// Important!
|
|
1300
|
-
// Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
|
|
1301
|
-
var ReactPropTypes = {
|
|
1302
|
-
array: createPrimitiveTypeChecker('array'),
|
|
1303
|
-
bigint: createPrimitiveTypeChecker('bigint'),
|
|
1304
|
-
bool: createPrimitiveTypeChecker('boolean'),
|
|
1305
|
-
func: createPrimitiveTypeChecker('function'),
|
|
1306
|
-
number: createPrimitiveTypeChecker('number'),
|
|
1307
|
-
object: createPrimitiveTypeChecker('object'),
|
|
1308
|
-
string: createPrimitiveTypeChecker('string'),
|
|
1309
|
-
symbol: createPrimitiveTypeChecker('symbol'),
|
|
1310
|
-
|
|
1311
|
-
any: createAnyTypeChecker(),
|
|
1312
|
-
arrayOf: createArrayOfTypeChecker,
|
|
1313
|
-
element: createElementTypeChecker(),
|
|
1314
|
-
elementType: createElementTypeTypeChecker(),
|
|
1315
|
-
instanceOf: createInstanceTypeChecker,
|
|
1316
|
-
node: createNodeChecker(),
|
|
1317
|
-
objectOf: createObjectOfTypeChecker,
|
|
1318
|
-
oneOf: createEnumTypeChecker,
|
|
1319
|
-
oneOfType: createUnionTypeChecker,
|
|
1320
|
-
shape: createShapeTypeChecker,
|
|
1321
|
-
exact: createStrictShapeTypeChecker,
|
|
1322
|
-
};
|
|
1323
|
-
|
|
1324
|
-
/**
|
|
1325
|
-
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
|
1326
|
-
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
1327
|
-
*/
|
|
1328
|
-
/*eslint-disable no-self-compare*/
|
|
1329
|
-
function is(x, y) {
|
|
1330
|
-
// SameValue algorithm
|
|
1331
|
-
if (x === y) {
|
|
1332
|
-
// Steps 1-5, 7-10
|
|
1333
|
-
// Steps 6.b-6.e: +0 != -0
|
|
1334
|
-
return x !== 0 || 1 / x === 1 / y;
|
|
1335
|
-
} else {
|
|
1336
|
-
// Step 6.a: NaN == NaN
|
|
1337
|
-
return x !== x && y !== y;
|
|
1338
|
-
}
|
|
1339
|
-
}
|
|
1340
|
-
/*eslint-enable no-self-compare*/
|
|
1341
|
-
|
|
1342
|
-
/**
|
|
1343
|
-
* We use an Error-like object for backward compatibility as people may call
|
|
1344
|
-
* PropTypes directly and inspect their output. However, we don't use real
|
|
1345
|
-
* Errors anymore. We don't inspect their stack anyway, and creating them
|
|
1346
|
-
* is prohibitively expensive if they are created too often, such as what
|
|
1347
|
-
* happens in oneOfType() for any type before the one that matched.
|
|
1348
|
-
*/
|
|
1349
|
-
function PropTypeError(message, data) {
|
|
1350
|
-
this.message = message;
|
|
1351
|
-
this.data = data && typeof data === 'object' ? data: {};
|
|
1352
|
-
this.stack = '';
|
|
1353
|
-
}
|
|
1354
|
-
// Make `instanceof Error` still work for returned errors.
|
|
1355
|
-
PropTypeError.prototype = Error.prototype;
|
|
1356
|
-
|
|
1357
|
-
function createChainableTypeChecker(validate) {
|
|
1358
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1359
|
-
var manualPropTypeCallCache = {};
|
|
1360
|
-
var manualPropTypeWarningCount = 0;
|
|
1361
|
-
}
|
|
1362
|
-
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
|
|
1363
|
-
componentName = componentName || ANONYMOUS;
|
|
1364
|
-
propFullName = propFullName || propName;
|
|
1365
|
-
|
|
1366
|
-
if (secret !== ReactPropTypesSecret) {
|
|
1367
|
-
if (throwOnDirectAccess) {
|
|
1368
|
-
// New behavior only for users of `prop-types` package
|
|
1369
|
-
var err = new Error(
|
|
1370
|
-
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
|
1371
|
-
'Use `PropTypes.checkPropTypes()` to call them. ' +
|
|
1372
|
-
'Read more at http://fb.me/use-check-prop-types'
|
|
1373
|
-
);
|
|
1374
|
-
err.name = 'Invariant Violation';
|
|
1375
|
-
throw err;
|
|
1376
|
-
} else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
|
|
1377
|
-
// Old behavior for people using React.PropTypes
|
|
1378
|
-
var cacheKey = componentName + ':' + propName;
|
|
1379
|
-
if (
|
|
1380
|
-
!manualPropTypeCallCache[cacheKey] &&
|
|
1381
|
-
// Avoid spamming the console because they are often not actionable except for lib authors
|
|
1382
|
-
manualPropTypeWarningCount < 3
|
|
1383
|
-
) {
|
|
1384
|
-
printWarning(
|
|
1385
|
-
'You are manually calling a React.PropTypes validation ' +
|
|
1386
|
-
'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
|
|
1387
|
-
'and will throw in the standalone `prop-types` package. ' +
|
|
1388
|
-
'You may be seeing this warning due to a third-party PropTypes ' +
|
|
1389
|
-
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
|
|
1390
|
-
);
|
|
1391
|
-
manualPropTypeCallCache[cacheKey] = true;
|
|
1392
|
-
manualPropTypeWarningCount++;
|
|
1393
|
-
}
|
|
1394
|
-
}
|
|
1395
|
-
}
|
|
1396
|
-
if (props[propName] == null) {
|
|
1397
|
-
if (isRequired) {
|
|
1398
|
-
if (props[propName] === null) {
|
|
1399
|
-
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
|
|
1400
|
-
}
|
|
1401
|
-
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
|
|
1402
|
-
}
|
|
1403
|
-
return null;
|
|
1404
|
-
} else {
|
|
1405
|
-
return validate(props, propName, componentName, location, propFullName);
|
|
1406
|
-
}
|
|
1407
|
-
}
|
|
1408
|
-
|
|
1409
|
-
var chainedCheckType = checkType.bind(null, false);
|
|
1410
|
-
chainedCheckType.isRequired = checkType.bind(null, true);
|
|
1411
|
-
|
|
1412
|
-
return chainedCheckType;
|
|
1413
|
-
}
|
|
1414
|
-
|
|
1415
|
-
function createPrimitiveTypeChecker(expectedType) {
|
|
1416
|
-
function validate(props, propName, componentName, location, propFullName, secret) {
|
|
1417
|
-
var propValue = props[propName];
|
|
1418
|
-
var propType = getPropType(propValue);
|
|
1419
|
-
if (propType !== expectedType) {
|
|
1420
|
-
// `propValue` being instance of, say, date/regexp, pass the 'object'
|
|
1421
|
-
// check, but we can offer a more precise error message here rather than
|
|
1422
|
-
// 'of type `object`'.
|
|
1423
|
-
var preciseType = getPreciseType(propValue);
|
|
1424
|
-
|
|
1425
|
-
return new PropTypeError(
|
|
1426
|
-
'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
|
|
1427
|
-
{expectedType: expectedType}
|
|
1428
|
-
);
|
|
1429
|
-
}
|
|
1430
|
-
return null;
|
|
1431
|
-
}
|
|
1432
|
-
return createChainableTypeChecker(validate);
|
|
1433
|
-
}
|
|
1434
|
-
|
|
1435
|
-
function createAnyTypeChecker() {
|
|
1436
|
-
return createChainableTypeChecker(emptyFunctionThatReturnsNull);
|
|
1437
|
-
}
|
|
1438
|
-
|
|
1439
|
-
function createArrayOfTypeChecker(typeChecker) {
|
|
1440
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
1441
|
-
if (typeof typeChecker !== 'function') {
|
|
1442
|
-
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
|
|
1443
|
-
}
|
|
1444
|
-
var propValue = props[propName];
|
|
1445
|
-
if (!Array.isArray(propValue)) {
|
|
1446
|
-
var propType = getPropType(propValue);
|
|
1447
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
|
|
1448
|
-
}
|
|
1449
|
-
for (var i = 0; i < propValue.length; i++) {
|
|
1450
|
-
var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
|
|
1451
|
-
if (error instanceof Error) {
|
|
1452
|
-
return error;
|
|
1453
|
-
}
|
|
1454
|
-
}
|
|
1455
|
-
return null;
|
|
1456
|
-
}
|
|
1457
|
-
return createChainableTypeChecker(validate);
|
|
1458
|
-
}
|
|
1459
|
-
|
|
1460
|
-
function createElementTypeChecker() {
|
|
1461
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
1462
|
-
var propValue = props[propName];
|
|
1463
|
-
if (!isValidElement(propValue)) {
|
|
1464
|
-
var propType = getPropType(propValue);
|
|
1465
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
|
|
1466
|
-
}
|
|
1467
|
-
return null;
|
|
1468
|
-
}
|
|
1469
|
-
return createChainableTypeChecker(validate);
|
|
1470
|
-
}
|
|
1471
|
-
|
|
1472
|
-
function createElementTypeTypeChecker() {
|
|
1473
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
1474
|
-
var propValue = props[propName];
|
|
1475
|
-
if (!ReactIs.isValidElementType(propValue)) {
|
|
1476
|
-
var propType = getPropType(propValue);
|
|
1477
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
|
|
1478
|
-
}
|
|
1479
|
-
return null;
|
|
1480
|
-
}
|
|
1481
|
-
return createChainableTypeChecker(validate);
|
|
1482
|
-
}
|
|
1483
|
-
|
|
1484
|
-
function createInstanceTypeChecker(expectedClass) {
|
|
1485
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
1486
|
-
if (!(props[propName] instanceof expectedClass)) {
|
|
1487
|
-
var expectedClassName = expectedClass.name || ANONYMOUS;
|
|
1488
|
-
var actualClassName = getClassName(props[propName]);
|
|
1489
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
|
|
1490
|
-
}
|
|
1491
|
-
return null;
|
|
1492
|
-
}
|
|
1493
|
-
return createChainableTypeChecker(validate);
|
|
1494
|
-
}
|
|
1495
|
-
|
|
1496
|
-
function createEnumTypeChecker(expectedValues) {
|
|
1497
|
-
if (!Array.isArray(expectedValues)) {
|
|
1498
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1499
|
-
if (arguments.length > 1) {
|
|
1500
|
-
printWarning(
|
|
1501
|
-
'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
|
|
1502
|
-
'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
|
|
1503
|
-
);
|
|
1504
|
-
} else {
|
|
1505
|
-
printWarning('Invalid argument supplied to oneOf, expected an array.');
|
|
1506
|
-
}
|
|
1507
|
-
}
|
|
1508
|
-
return emptyFunctionThatReturnsNull;
|
|
1509
|
-
}
|
|
1510
|
-
|
|
1511
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
1512
|
-
var propValue = props[propName];
|
|
1513
|
-
for (var i = 0; i < expectedValues.length; i++) {
|
|
1514
|
-
if (is(propValue, expectedValues[i])) {
|
|
1515
|
-
return null;
|
|
1516
|
-
}
|
|
1517
|
-
}
|
|
1518
|
-
|
|
1519
|
-
var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
|
|
1520
|
-
var type = getPreciseType(value);
|
|
1521
|
-
if (type === 'symbol') {
|
|
1522
|
-
return String(value);
|
|
1523
|
-
}
|
|
1524
|
-
return value;
|
|
1525
|
-
});
|
|
1526
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
|
|
1527
|
-
}
|
|
1528
|
-
return createChainableTypeChecker(validate);
|
|
1529
|
-
}
|
|
1530
|
-
|
|
1531
|
-
function createObjectOfTypeChecker(typeChecker) {
|
|
1532
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
1533
|
-
if (typeof typeChecker !== 'function') {
|
|
1534
|
-
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
|
|
1535
|
-
}
|
|
1536
|
-
var propValue = props[propName];
|
|
1537
|
-
var propType = getPropType(propValue);
|
|
1538
|
-
if (propType !== 'object') {
|
|
1539
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
|
1540
|
-
}
|
|
1541
|
-
for (var key in propValue) {
|
|
1542
|
-
if (has(propValue, key)) {
|
|
1543
|
-
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
|
1544
|
-
if (error instanceof Error) {
|
|
1545
|
-
return error;
|
|
1546
|
-
}
|
|
1547
|
-
}
|
|
1548
|
-
}
|
|
1549
|
-
return null;
|
|
1550
|
-
}
|
|
1551
|
-
return createChainableTypeChecker(validate);
|
|
1552
|
-
}
|
|
1553
|
-
|
|
1554
|
-
function createUnionTypeChecker(arrayOfTypeCheckers) {
|
|
1555
|
-
if (!Array.isArray(arrayOfTypeCheckers)) {
|
|
1556
|
-
process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
|
|
1557
|
-
return emptyFunctionThatReturnsNull;
|
|
1558
|
-
}
|
|
1559
|
-
|
|
1560
|
-
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
1561
|
-
var checker = arrayOfTypeCheckers[i];
|
|
1562
|
-
if (typeof checker !== 'function') {
|
|
1563
|
-
printWarning(
|
|
1564
|
-
'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
|
|
1565
|
-
'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
|
|
1566
|
-
);
|
|
1567
|
-
return emptyFunctionThatReturnsNull;
|
|
1568
|
-
}
|
|
1569
|
-
}
|
|
1570
|
-
|
|
1571
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
1572
|
-
var expectedTypes = [];
|
|
1573
|
-
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
1574
|
-
var checker = arrayOfTypeCheckers[i];
|
|
1575
|
-
var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
|
|
1576
|
-
if (checkerResult == null) {
|
|
1577
|
-
return null;
|
|
1578
|
-
}
|
|
1579
|
-
if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
|
|
1580
|
-
expectedTypes.push(checkerResult.data.expectedType);
|
|
1581
|
-
}
|
|
1582
|
-
}
|
|
1583
|
-
var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
|
|
1584
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
|
|
1585
|
-
}
|
|
1586
|
-
return createChainableTypeChecker(validate);
|
|
1587
|
-
}
|
|
1588
|
-
|
|
1589
|
-
function createNodeChecker() {
|
|
1590
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
1591
|
-
if (!isNode(props[propName])) {
|
|
1592
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
|
|
1593
|
-
}
|
|
1594
|
-
return null;
|
|
1595
|
-
}
|
|
1596
|
-
return createChainableTypeChecker(validate);
|
|
1597
|
-
}
|
|
1598
|
-
|
|
1599
|
-
function invalidValidatorError(componentName, location, propFullName, key, type) {
|
|
1600
|
-
return new PropTypeError(
|
|
1601
|
-
(componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
|
|
1602
|
-
'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
|
|
1603
|
-
);
|
|
1604
|
-
}
|
|
1605
|
-
|
|
1606
|
-
function createShapeTypeChecker(shapeTypes) {
|
|
1607
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
1608
|
-
var propValue = props[propName];
|
|
1609
|
-
var propType = getPropType(propValue);
|
|
1610
|
-
if (propType !== 'object') {
|
|
1611
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
|
1612
|
-
}
|
|
1613
|
-
for (var key in shapeTypes) {
|
|
1614
|
-
var checker = shapeTypes[key];
|
|
1615
|
-
if (typeof checker !== 'function') {
|
|
1616
|
-
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
1617
|
-
}
|
|
1618
|
-
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
|
1619
|
-
if (error) {
|
|
1620
|
-
return error;
|
|
1621
|
-
}
|
|
1622
|
-
}
|
|
1623
|
-
return null;
|
|
1624
|
-
}
|
|
1625
|
-
return createChainableTypeChecker(validate);
|
|
1626
|
-
}
|
|
1627
|
-
|
|
1628
|
-
function createStrictShapeTypeChecker(shapeTypes) {
|
|
1629
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
1630
|
-
var propValue = props[propName];
|
|
1631
|
-
var propType = getPropType(propValue);
|
|
1632
|
-
if (propType !== 'object') {
|
|
1633
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
|
1634
|
-
}
|
|
1635
|
-
// We need to check all keys in case some are required but missing from props.
|
|
1636
|
-
var allKeys = assign({}, props[propName], shapeTypes);
|
|
1637
|
-
for (var key in allKeys) {
|
|
1638
|
-
var checker = shapeTypes[key];
|
|
1639
|
-
if (has(shapeTypes, key) && typeof checker !== 'function') {
|
|
1640
|
-
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
1641
|
-
}
|
|
1642
|
-
if (!checker) {
|
|
1643
|
-
return new PropTypeError(
|
|
1644
|
-
'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
|
|
1645
|
-
'\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
|
|
1646
|
-
'\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
|
|
1647
|
-
);
|
|
1648
|
-
}
|
|
1649
|
-
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
|
1650
|
-
if (error) {
|
|
1651
|
-
return error;
|
|
1652
|
-
}
|
|
1653
|
-
}
|
|
1654
|
-
return null;
|
|
1655
|
-
}
|
|
1656
|
-
|
|
1657
|
-
return createChainableTypeChecker(validate);
|
|
1658
|
-
}
|
|
1659
|
-
|
|
1660
|
-
function isNode(propValue) {
|
|
1661
|
-
switch (typeof propValue) {
|
|
1662
|
-
case 'number':
|
|
1663
|
-
case 'string':
|
|
1664
|
-
case 'undefined':
|
|
1665
|
-
return true;
|
|
1666
|
-
case 'boolean':
|
|
1667
|
-
return !propValue;
|
|
1668
|
-
case 'object':
|
|
1669
|
-
if (Array.isArray(propValue)) {
|
|
1670
|
-
return propValue.every(isNode);
|
|
1671
|
-
}
|
|
1672
|
-
if (propValue === null || isValidElement(propValue)) {
|
|
1673
|
-
return true;
|
|
1674
|
-
}
|
|
1675
|
-
|
|
1676
|
-
var iteratorFn = getIteratorFn(propValue);
|
|
1677
|
-
if (iteratorFn) {
|
|
1678
|
-
var iterator = iteratorFn.call(propValue);
|
|
1679
|
-
var step;
|
|
1680
|
-
if (iteratorFn !== propValue.entries) {
|
|
1681
|
-
while (!(step = iterator.next()).done) {
|
|
1682
|
-
if (!isNode(step.value)) {
|
|
1683
|
-
return false;
|
|
1684
|
-
}
|
|
1685
|
-
}
|
|
1686
|
-
} else {
|
|
1687
|
-
// Iterator will provide entry [k,v] tuples rather than values.
|
|
1688
|
-
while (!(step = iterator.next()).done) {
|
|
1689
|
-
var entry = step.value;
|
|
1690
|
-
if (entry) {
|
|
1691
|
-
if (!isNode(entry[1])) {
|
|
1692
|
-
return false;
|
|
1693
|
-
}
|
|
1694
|
-
}
|
|
1695
|
-
}
|
|
1696
|
-
}
|
|
1697
|
-
} else {
|
|
1698
|
-
return false;
|
|
1699
|
-
}
|
|
1700
|
-
|
|
1701
|
-
return true;
|
|
1702
|
-
default:
|
|
1703
|
-
return false;
|
|
1704
|
-
}
|
|
1705
|
-
}
|
|
1706
|
-
|
|
1707
|
-
function isSymbol(propType, propValue) {
|
|
1708
|
-
// Native Symbol.
|
|
1709
|
-
if (propType === 'symbol') {
|
|
1710
|
-
return true;
|
|
1711
|
-
}
|
|
1712
|
-
|
|
1713
|
-
// falsy value can't be a Symbol
|
|
1714
|
-
if (!propValue) {
|
|
1715
|
-
return false;
|
|
1716
|
-
}
|
|
1717
|
-
|
|
1718
|
-
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
|
|
1719
|
-
if (propValue['@@toStringTag'] === 'Symbol') {
|
|
1720
|
-
return true;
|
|
1721
|
-
}
|
|
1722
|
-
|
|
1723
|
-
// Fallback for non-spec compliant Symbols which are polyfilled.
|
|
1724
|
-
if (typeof Symbol === 'function' && propValue instanceof Symbol) {
|
|
1725
|
-
return true;
|
|
1726
|
-
}
|
|
1727
|
-
|
|
1728
|
-
return false;
|
|
1729
|
-
}
|
|
1730
|
-
|
|
1731
|
-
// Equivalent of `typeof` but with special handling for array and regexp.
|
|
1732
|
-
function getPropType(propValue) {
|
|
1733
|
-
var propType = typeof propValue;
|
|
1734
|
-
if (Array.isArray(propValue)) {
|
|
1735
|
-
return 'array';
|
|
1736
|
-
}
|
|
1737
|
-
if (propValue instanceof RegExp) {
|
|
1738
|
-
// Old webkits (at least until Android 4.0) return 'function' rather than
|
|
1739
|
-
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/
|
|
1740
|
-
// passes PropTypes.object.
|
|
1741
|
-
return 'object';
|
|
1742
|
-
}
|
|
1743
|
-
if (isSymbol(propType, propValue)) {
|
|
1744
|
-
return 'symbol';
|
|
1745
|
-
}
|
|
1746
|
-
return propType;
|
|
1747
|
-
}
|
|
1748
|
-
|
|
1749
|
-
// This handles more types than `getPropType`. Only used for error messages.
|
|
1750
|
-
// See `createPrimitiveTypeChecker`.
|
|
1751
|
-
function getPreciseType(propValue) {
|
|
1752
|
-
if (typeof propValue === 'undefined' || propValue === null) {
|
|
1753
|
-
return '' + propValue;
|
|
1754
|
-
}
|
|
1755
|
-
var propType = getPropType(propValue);
|
|
1756
|
-
if (propType === 'object') {
|
|
1757
|
-
if (propValue instanceof Date) {
|
|
1758
|
-
return 'date';
|
|
1759
|
-
} else if (propValue instanceof RegExp) {
|
|
1760
|
-
return 'regexp';
|
|
1761
|
-
}
|
|
1762
|
-
}
|
|
1763
|
-
return propType;
|
|
1764
|
-
}
|
|
1765
|
-
|
|
1766
|
-
// Returns a string that is postfixed to a warning about an invalid type.
|
|
1767
|
-
// For example, "undefined" or "of type array"
|
|
1768
|
-
function getPostfixForTypeWarning(value) {
|
|
1769
|
-
var type = getPreciseType(value);
|
|
1770
|
-
switch (type) {
|
|
1771
|
-
case 'array':
|
|
1772
|
-
case 'object':
|
|
1773
|
-
return 'an ' + type;
|
|
1774
|
-
case 'boolean':
|
|
1775
|
-
case 'date':
|
|
1776
|
-
case 'regexp':
|
|
1777
|
-
return 'a ' + type;
|
|
1778
|
-
default:
|
|
1779
|
-
return type;
|
|
1780
|
-
}
|
|
1781
|
-
}
|
|
1782
|
-
|
|
1783
|
-
// Returns class name of the object, if any.
|
|
1784
|
-
function getClassName(propValue) {
|
|
1785
|
-
if (!propValue.constructor || !propValue.constructor.name) {
|
|
1786
|
-
return ANONYMOUS;
|
|
1787
|
-
}
|
|
1788
|
-
return propValue.constructor.name;
|
|
1789
|
-
}
|
|
1790
|
-
|
|
1791
|
-
ReactPropTypes.checkPropTypes = checkPropTypes;
|
|
1792
|
-
ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
|
|
1793
|
-
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
1794
|
-
|
|
1795
|
-
return ReactPropTypes;
|
|
1796
|
-
};
|
|
1797
|
-
return factoryWithTypeCheckers;
|
|
1762
|
+
// Returns class name of the object, if any.
|
|
1763
|
+
function getClassName(propValue) {
|
|
1764
|
+
if (!propValue.constructor || !propValue.constructor.name) {
|
|
1765
|
+
return ANONYMOUS;
|
|
1766
|
+
}
|
|
1767
|
+
return propValue.constructor.name;
|
|
1768
|
+
}
|
|
1769
|
+
ReactPropTypes.checkPropTypes = checkPropTypes;
|
|
1770
|
+
ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
|
|
1771
|
+
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
1772
|
+
return ReactPropTypes;
|
|
1773
|
+
};
|
|
1774
|
+
return factoryWithTypeCheckers;
|
|
1798
1775
|
}
|
|
1799
1776
|
|
|
1800
1777
|
/**
|
|
@@ -1803,69 +1780,58 @@ function requireFactoryWithTypeCheckers () {
|
|
|
1803
1780
|
* This source code is licensed under the MIT license found in the
|
|
1804
1781
|
* LICENSE file in the root directory of this source tree.
|
|
1805
1782
|
*/
|
|
1806
|
-
|
|
1807
1783
|
var factoryWithThrowingShims;
|
|
1808
1784
|
var hasRequiredFactoryWithThrowingShims;
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
checkPropTypes: emptyFunctionWithReset,
|
|
1861
|
-
resetWarningCache: emptyFunction
|
|
1862
|
-
};
|
|
1863
|
-
|
|
1864
|
-
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
1865
|
-
|
|
1866
|
-
return ReactPropTypes;
|
|
1867
|
-
};
|
|
1868
|
-
return factoryWithThrowingShims;
|
|
1785
|
+
function requireFactoryWithThrowingShims() {
|
|
1786
|
+
if (hasRequiredFactoryWithThrowingShims) return factoryWithThrowingShims;
|
|
1787
|
+
hasRequiredFactoryWithThrowingShims = 1;
|
|
1788
|
+
var ReactPropTypesSecret = /*@__PURE__*/requireReactPropTypesSecret();
|
|
1789
|
+
function emptyFunction() {}
|
|
1790
|
+
function emptyFunctionWithReset() {}
|
|
1791
|
+
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
1792
|
+
factoryWithThrowingShims = function () {
|
|
1793
|
+
function shim(props, propName, componentName, location, propFullName, secret) {
|
|
1794
|
+
if (secret === ReactPropTypesSecret) {
|
|
1795
|
+
// It is still safe when called from React.
|
|
1796
|
+
return;
|
|
1797
|
+
}
|
|
1798
|
+
var err = new Error('Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use PropTypes.checkPropTypes() to call them. ' + 'Read more at http://fb.me/use-check-prop-types');
|
|
1799
|
+
err.name = 'Invariant Violation';
|
|
1800
|
+
throw err;
|
|
1801
|
+
}
|
|
1802
|
+
shim.isRequired = shim;
|
|
1803
|
+
function getShim() {
|
|
1804
|
+
return shim;
|
|
1805
|
+
}
|
|
1806
|
+
// Important!
|
|
1807
|
+
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
|
|
1808
|
+
var ReactPropTypes = {
|
|
1809
|
+
array: shim,
|
|
1810
|
+
bigint: shim,
|
|
1811
|
+
bool: shim,
|
|
1812
|
+
func: shim,
|
|
1813
|
+
number: shim,
|
|
1814
|
+
object: shim,
|
|
1815
|
+
string: shim,
|
|
1816
|
+
symbol: shim,
|
|
1817
|
+
any: shim,
|
|
1818
|
+
arrayOf: getShim,
|
|
1819
|
+
element: shim,
|
|
1820
|
+
elementType: shim,
|
|
1821
|
+
instanceOf: getShim,
|
|
1822
|
+
node: shim,
|
|
1823
|
+
objectOf: getShim,
|
|
1824
|
+
oneOf: getShim,
|
|
1825
|
+
oneOfType: getShim,
|
|
1826
|
+
shape: getShim,
|
|
1827
|
+
exact: getShim,
|
|
1828
|
+
checkPropTypes: emptyFunctionWithReset,
|
|
1829
|
+
resetWarningCache: emptyFunction
|
|
1830
|
+
};
|
|
1831
|
+
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
1832
|
+
return ReactPropTypes;
|
|
1833
|
+
};
|
|
1834
|
+
return factoryWithThrowingShims;
|
|
1869
1835
|
}
|
|
1870
1836
|
|
|
1871
1837
|
/**
|
|
@@ -1874,25 +1840,23 @@ function requireFactoryWithThrowingShims () {
|
|
|
1874
1840
|
* This source code is licensed under the MIT license found in the
|
|
1875
1841
|
* LICENSE file in the root directory of this source tree.
|
|
1876
1842
|
*/
|
|
1877
|
-
|
|
1878
1843
|
var hasRequiredPropTypes;
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
return propTypes.exports;
|
|
1844
|
+
function requirePropTypes() {
|
|
1845
|
+
if (hasRequiredPropTypes) return propTypes.exports;
|
|
1846
|
+
hasRequiredPropTypes = 1;
|
|
1847
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1848
|
+
var ReactIs = requireReactIs();
|
|
1849
|
+
|
|
1850
|
+
// By explicitly using `prop-types` you are opting into new development behavior.
|
|
1851
|
+
// http://fb.me/prop-types-in-prod
|
|
1852
|
+
var throwOnDirectAccess = true;
|
|
1853
|
+
propTypes.exports = /*@__PURE__*/requireFactoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
|
|
1854
|
+
} else {
|
|
1855
|
+
// By explicitly using `prop-types` you are opting into new production behavior.
|
|
1856
|
+
// http://fb.me/prop-types-in-prod
|
|
1857
|
+
propTypes.exports = /*@__PURE__*/requireFactoryWithThrowingShims()();
|
|
1858
|
+
}
|
|
1859
|
+
return propTypes.exports;
|
|
1896
1860
|
}
|
|
1897
1861
|
|
|
1898
1862
|
var propTypesExports = /*@__PURE__*/ requirePropTypes();
|
|
@@ -2304,9 +2268,11 @@ const NetworkSettingsModal = _ref2 => {
|
|
|
2304
2268
|
const [lanConfigs, setLanConfigs] = useState([]);
|
|
2305
2269
|
const [submitLoading, setSubmitLoading] = useState(false);
|
|
2306
2270
|
const [isInitialized, setIsInitialized] = useState(false);
|
|
2271
|
+
const hasFetchedRef = useRef(false);
|
|
2307
2272
|
const fetchData = useCallback(async () => {
|
|
2308
|
-
if (!open ||
|
|
2273
|
+
if (!open || hasFetchedRef.current) return;
|
|
2309
2274
|
try {
|
|
2275
|
+
hasFetchedRef.current = true;
|
|
2310
2276
|
const promises = [];
|
|
2311
2277
|
if (sections.includes('LAN')) {
|
|
2312
2278
|
promises.push(getLanConfig());
|
|
@@ -2318,7 +2284,7 @@ const NetworkSettingsModal = _ref2 => {
|
|
|
2318
2284
|
if (sections.includes('LAN')) {
|
|
2319
2285
|
const lanResult = results[0];
|
|
2320
2286
|
if (lanResult.status === 'fulfilled') {
|
|
2321
|
-
setLanConfigs(lanResult.value);
|
|
2287
|
+
setLanConfigs(lanResult.value || []);
|
|
2322
2288
|
}
|
|
2323
2289
|
}
|
|
2324
2290
|
if (sections.includes('QSFP')) {
|
|
@@ -2330,44 +2296,54 @@ const NetworkSettingsModal = _ref2 => {
|
|
|
2330
2296
|
setIsInitialized(true);
|
|
2331
2297
|
} catch (error) {
|
|
2332
2298
|
console.error('Failed to fetch data:', error);
|
|
2299
|
+
hasFetchedRef.current = false; // 出错时重置标志
|
|
2333
2300
|
}
|
|
2334
|
-
}, [open,
|
|
2301
|
+
}, [open, getLanConfig, getSysConfig, sections]);
|
|
2335
2302
|
useEffect(() => {
|
|
2336
2303
|
if (open) {
|
|
2304
|
+
console.log(123456);
|
|
2337
2305
|
fetchData();
|
|
2338
2306
|
}
|
|
2339
2307
|
}, [open, fetchData]);
|
|
2340
2308
|
|
|
2341
|
-
//
|
|
2309
|
+
// 当模态框关闭时重置状态
|
|
2342
2310
|
useEffect(() => {
|
|
2343
2311
|
if (!open) {
|
|
2344
2312
|
setIsInitialized(false);
|
|
2345
2313
|
setLanConfigs([]);
|
|
2346
2314
|
setSt2110Interfaces([]);
|
|
2347
2315
|
form.resetFields();
|
|
2316
|
+
hasFetchedRef.current = false; // 重置fetch标志
|
|
2348
2317
|
}
|
|
2349
2318
|
}, [open, form]);
|
|
2350
2319
|
|
|
2351
2320
|
// 动态初始值配置
|
|
2352
2321
|
const initialValues = useMemo(() => {
|
|
2353
2322
|
const values = {};
|
|
2354
|
-
if (sections.includes('LAN')) {
|
|
2323
|
+
if (sections.includes('LAN') && lanConfigs.length > 0) {
|
|
2355
2324
|
values.LAN = lanConfigs.map(config => ({
|
|
2356
2325
|
connection_id: config.connection_id,
|
|
2357
2326
|
display_name: config.display_name,
|
|
2358
2327
|
ip_address: config.ip_address,
|
|
2359
2328
|
netmask: config.netmask
|
|
2360
|
-
}))
|
|
2329
|
+
}));
|
|
2361
2330
|
}
|
|
2362
|
-
if (sections.includes('QSFP')) {
|
|
2363
|
-
values.QSFP = st2110Interfaces
|
|
2331
|
+
if (sections.includes('QSFP') && st2110Interfaces.length > 0) {
|
|
2332
|
+
values.QSFP = st2110Interfaces.map(iface => ({
|
|
2364
2333
|
id: iface.id,
|
|
2365
2334
|
display_name: iface.display_name,
|
|
2366
2335
|
ip_address: iface.ip_address
|
|
2367
|
-
}))
|
|
2336
|
+
}));
|
|
2368
2337
|
}
|
|
2369
2338
|
return values;
|
|
2370
2339
|
}, [lanConfigs, st2110Interfaces, sections]);
|
|
2340
|
+
|
|
2341
|
+
// 当初始值准备好后设置表单值
|
|
2342
|
+
useEffect(() => {
|
|
2343
|
+
if (isInitialized && Object.keys(initialValues).length > 0) {
|
|
2344
|
+
form.setFieldsValue(initialValues);
|
|
2345
|
+
}
|
|
2346
|
+
}, [initialValues, isInitialized, form]);
|
|
2371
2347
|
const handleSuccess = useCallback(async function () {
|
|
2372
2348
|
let isPopup = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
2373
2349
|
let messageText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'Success';
|
|
@@ -2456,7 +2432,6 @@ const NetworkSettingsModal = _ref2 => {
|
|
|
2456
2432
|
// 合并默认表单属性和传入的属性
|
|
2457
2433
|
const mergedFormProps = {
|
|
2458
2434
|
form: form,
|
|
2459
|
-
initialValues: initialValues,
|
|
2460
2435
|
labelCol: {
|
|
2461
2436
|
span: 6
|
|
2462
2437
|
},
|
|
@@ -2470,15 +2445,15 @@ const NetworkSettingsModal = _ref2 => {
|
|
|
2470
2445
|
...mergedModalProps,
|
|
2471
2446
|
children: /*#__PURE__*/jsxs(Form, {
|
|
2472
2447
|
...mergedFormProps,
|
|
2473
|
-
children: [sections.includes('LAN') &&
|
|
2448
|
+
children: [sections.includes('LAN') && lanConfigs.length > 0 && /*#__PURE__*/jsxs(Fragment, {
|
|
2474
2449
|
children: [/*#__PURE__*/jsx(NetworkFieldGroup, {
|
|
2475
2450
|
prefix: "LAN",
|
|
2476
|
-
interfaces:
|
|
2451
|
+
interfaces: lanConfigs,
|
|
2477
2452
|
fieldConfig: fieldConfig.LAN
|
|
2478
|
-
}), sections.includes('QSFP') &&
|
|
2479
|
-
}), sections.includes('QSFP') &&
|
|
2453
|
+
}), sections.includes('QSFP') && st2110Interfaces.length > 0 && /*#__PURE__*/jsx(Divider, {})]
|
|
2454
|
+
}), sections.includes('QSFP') && st2110Interfaces.length > 0 && /*#__PURE__*/jsx(NetworkFieldGroup, {
|
|
2480
2455
|
prefix: "QSFP",
|
|
2481
|
-
interfaces:
|
|
2456
|
+
interfaces: st2110Interfaces,
|
|
2482
2457
|
fieldConfig: fieldConfig.QSFP
|
|
2483
2458
|
})]
|
|
2484
2459
|
})
|