jrs-react 1.2.12 → 1.2.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.es.js +164 -2976
- package/build/index.js +182 -2974
- package/package.json +5 -1
- package/src/app/App.css +3 -2
- package/src/app/window/WindowApp.jsx +21 -11
- package/src/assets/icon/index.jsx +0 -13
- package/src/components/JRWindow/JRWindow.jsx +6 -0
- package/src/components/JRWindow/Slider.jsx +18 -17
- package/src/components/JRWindow/TitleBar.jsx +33 -14
- package/src/index.js +2 -1
package/build/index.js
CHANGED
|
@@ -2,2820 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var React = require('react');
|
|
5
6
|
var styled = require('styled-components');
|
|
6
7
|
|
|
7
8
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
* This source code is licensed under the MIT license found in the
|
|
26
|
-
* LICENSE file in the root directory of this source tree.
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
var hasRequiredReact_production_min;
|
|
30
|
-
|
|
31
|
-
function requireReact_production_min () {
|
|
32
|
-
if (hasRequiredReact_production_min) return react_production_min;
|
|
33
|
-
hasRequiredReact_production_min = 1;
|
|
34
|
-
var l=Symbol.for("react.element"),n=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),q=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),t=Symbol.for("react.provider"),u=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),w=Symbol.for("react.suspense"),x=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),z=Symbol.iterator;function A(a){if(null===a||"object"!==typeof a)return null;a=z&&a[z]||a["@@iterator"];return "function"===typeof a?a:null}
|
|
35
|
-
var B={isMounted:function(){return !1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,D={};function E(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B;}E.prototype.isReactComponent={};
|
|
36
|
-
E.prototype.setState=function(a,b){if("object"!==typeof a&&"function"!==typeof a&&null!=a)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,a,b,"setState");};E.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,"forceUpdate");};function F(){}F.prototype=E.prototype;function G(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B;}var H=G.prototype=new F;
|
|
37
|
-
H.constructor=G;C(H,E.prototype);H.isPureReactComponent=!0;var I=Array.isArray,J=Object.prototype.hasOwnProperty,K={current:null},L={key:!0,ref:!0,__self:!0,__source:!0};
|
|
38
|
-
function M(a,b,e){var d,c={},k=null,h=null;if(null!=b)for(d in void 0!==b.ref&&(h=b.ref),void 0!==b.key&&(k=""+b.key),b)J.call(b,d)&&!L.hasOwnProperty(d)&&(c[d]=b[d]);var g=arguments.length-2;if(1===g)c.children=e;else if(1<g){for(var f=Array(g),m=0;m<g;m++)f[m]=arguments[m+2];c.children=f;}if(a&&a.defaultProps)for(d in g=a.defaultProps,g)void 0===c[d]&&(c[d]=g[d]);return {$$typeof:l,type:a,key:k,ref:h,props:c,_owner:K.current}}
|
|
39
|
-
function N(a,b){return {$$typeof:l,type:a.type,key:b,ref:a.ref,props:a.props,_owner:a._owner}}function O(a){return "object"===typeof a&&null!==a&&a.$$typeof===l}function escape(a){var b={"=":"=0",":":"=2"};return "$"+a.replace(/[=:]/g,function(a){return b[a]})}var P=/\/+/g;function Q(a,b){return "object"===typeof a&&null!==a&&null!=a.key?escape(""+a.key):b.toString(36)}
|
|
40
|
-
function R(a,b,e,d,c){var k=typeof a;if("undefined"===k||"boolean"===k)a=null;var h=!1;if(null===a)h=!0;else switch(k){case "string":case "number":h=!0;break;case "object":switch(a.$$typeof){case l:case n:h=!0;}}if(h)return h=a,c=c(h),a=""===d?"."+Q(h,0):d,I(c)?(e="",null!=a&&(e=a.replace(P,"$&/")+"/"),R(c,b,e,"",function(a){return a})):null!=c&&(O(c)&&(c=N(c,e+(!c.key||h&&h.key===c.key?"":(""+c.key).replace(P,"$&/")+"/")+a)),b.push(c)),1;h=0;d=""===d?".":d+":";if(I(a))for(var g=0;g<a.length;g++){k=
|
|
41
|
-
a[g];var f=d+Q(k,g);h+=R(k,b,e,f,c);}else if(f=A(a),"function"===typeof f)for(a=f.call(a),g=0;!(k=a.next()).done;)k=k.value,f=d+Q(k,g++),h+=R(k,b,e,f,c);else if("object"===k)throw b=String(a),Error("Objects are not valid as a React child (found: "+("[object Object]"===b?"object with keys {"+Object.keys(a).join(", ")+"}":b)+"). If you meant to render a collection of children, use an array instead.");return h}
|
|
42
|
-
function S(a,b,e){if(null==a)return a;var d=[],c=0;R(a,d,"","",function(a){return b.call(e,a,c++)});return d}function T(a){if(-1===a._status){var b=a._result;b=b();b.then(function(b){if(0===a._status||-1===a._status)a._status=1,a._result=b;},function(b){if(0===a._status||-1===a._status)a._status=2,a._result=b;});-1===a._status&&(a._status=0,a._result=b);}if(1===a._status)return a._result.default;throw a._result;}
|
|
43
|
-
var U={current:null},V={transition:null},W={ReactCurrentDispatcher:U,ReactCurrentBatchConfig:V,ReactCurrentOwner:K};react_production_min.Children={map:S,forEach:function(a,b,e){S(a,function(){b.apply(this,arguments);},e);},count:function(a){var b=0;S(a,function(){b++;});return b},toArray:function(a){return S(a,function(a){return a})||[]},only:function(a){if(!O(a))throw Error("React.Children.only expected to receive a single React element child.");return a}};react_production_min.Component=E;react_production_min.Fragment=p;
|
|
44
|
-
react_production_min.Profiler=r;react_production_min.PureComponent=G;react_production_min.StrictMode=q;react_production_min.Suspense=w;react_production_min.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=W;
|
|
45
|
-
react_production_min.cloneElement=function(a,b,e){if(null===a||void 0===a)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+a+".");var d=C({},a.props),c=a.key,k=a.ref,h=a._owner;if(null!=b){void 0!==b.ref&&(k=b.ref,h=K.current);void 0!==b.key&&(c=""+b.key);if(a.type&&a.type.defaultProps)var g=a.type.defaultProps;for(f in b)J.call(b,f)&&!L.hasOwnProperty(f)&&(d[f]=void 0===b[f]&&void 0!==g?g[f]:b[f]);}var f=arguments.length-2;if(1===f)d.children=e;else if(1<f){g=Array(f);
|
|
46
|
-
for(var m=0;m<f;m++)g[m]=arguments[m+2];d.children=g;}return {$$typeof:l,type:a.type,key:c,ref:k,props:d,_owner:h}};react_production_min.createContext=function(a){a={$$typeof:u,_currentValue:a,_currentValue2:a,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null};a.Provider={$$typeof:t,_context:a};return a.Consumer=a};react_production_min.createElement=M;react_production_min.createFactory=function(a){var b=M.bind(null,a);b.type=a;return b};react_production_min.createRef=function(){return {current:null}};
|
|
47
|
-
react_production_min.forwardRef=function(a){return {$$typeof:v,render:a}};react_production_min.isValidElement=O;react_production_min.lazy=function(a){return {$$typeof:y,_payload:{_status:-1,_result:a},_init:T}};react_production_min.memo=function(a,b){return {$$typeof:x,type:a,compare:void 0===b?null:b}};react_production_min.startTransition=function(a){var b=V.transition;V.transition={};try{a();}finally{V.transition=b;}};react_production_min.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.");};
|
|
48
|
-
react_production_min.useCallback=function(a,b){return U.current.useCallback(a,b)};react_production_min.useContext=function(a){return U.current.useContext(a)};react_production_min.useDebugValue=function(){};react_production_min.useDeferredValue=function(a){return U.current.useDeferredValue(a)};react_production_min.useEffect=function(a,b){return U.current.useEffect(a,b)};react_production_min.useId=function(){return U.current.useId()};react_production_min.useImperativeHandle=function(a,b,e){return U.current.useImperativeHandle(a,b,e)};
|
|
49
|
-
react_production_min.useInsertionEffect=function(a,b){return U.current.useInsertionEffect(a,b)};react_production_min.useLayoutEffect=function(a,b){return U.current.useLayoutEffect(a,b)};react_production_min.useMemo=function(a,b){return U.current.useMemo(a,b)};react_production_min.useReducer=function(a,b,e){return U.current.useReducer(a,b,e)};react_production_min.useRef=function(a){return U.current.useRef(a)};react_production_min.useState=function(a){return U.current.useState(a)};react_production_min.useSyncExternalStore=function(a,b,e){return U.current.useSyncExternalStore(a,b,e)};
|
|
50
|
-
react_production_min.useTransition=function(){return U.current.useTransition()};react_production_min.version="18.2.0";
|
|
51
|
-
return react_production_min;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
var react_development = {exports: {}};
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* @license React
|
|
58
|
-
* react.development.js
|
|
59
|
-
*
|
|
60
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
61
|
-
*
|
|
62
|
-
* This source code is licensed under the MIT license found in the
|
|
63
|
-
* LICENSE file in the root directory of this source tree.
|
|
64
|
-
*/
|
|
65
|
-
react_development.exports;
|
|
66
|
-
|
|
67
|
-
var hasRequiredReact_development;
|
|
68
|
-
|
|
69
|
-
function requireReact_development () {
|
|
70
|
-
if (hasRequiredReact_development) return react_development.exports;
|
|
71
|
-
hasRequiredReact_development = 1;
|
|
72
|
-
(function (module, exports) {
|
|
73
|
-
|
|
74
|
-
if (process.env.NODE_ENV !== "production") {
|
|
75
|
-
(function() {
|
|
76
|
-
|
|
77
|
-
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
|
78
|
-
if (
|
|
79
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
|
80
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===
|
|
81
|
-
'function'
|
|
82
|
-
) {
|
|
83
|
-
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
84
|
-
}
|
|
85
|
-
var ReactVersion = '18.2.0';
|
|
86
|
-
|
|
87
|
-
// ATTENTION
|
|
88
|
-
// When adding new symbols to this file,
|
|
89
|
-
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
|
|
90
|
-
// The Symbol used to tag the ReactElement-like types.
|
|
91
|
-
var REACT_ELEMENT_TYPE = Symbol.for('react.element');
|
|
92
|
-
var REACT_PORTAL_TYPE = Symbol.for('react.portal');
|
|
93
|
-
var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
|
|
94
|
-
var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
|
|
95
|
-
var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
|
|
96
|
-
var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
|
|
97
|
-
var REACT_CONTEXT_TYPE = Symbol.for('react.context');
|
|
98
|
-
var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
|
|
99
|
-
var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
|
|
100
|
-
var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
|
|
101
|
-
var REACT_MEMO_TYPE = Symbol.for('react.memo');
|
|
102
|
-
var REACT_LAZY_TYPE = Symbol.for('react.lazy');
|
|
103
|
-
var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
|
|
104
|
-
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
|
105
|
-
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
106
|
-
function getIteratorFn(maybeIterable) {
|
|
107
|
-
if (maybeIterable === null || typeof maybeIterable !== 'object') {
|
|
108
|
-
return null;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
112
|
-
|
|
113
|
-
if (typeof maybeIterator === 'function') {
|
|
114
|
-
return maybeIterator;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
return null;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Keeps track of the current dispatcher.
|
|
122
|
-
*/
|
|
123
|
-
var ReactCurrentDispatcher = {
|
|
124
|
-
/**
|
|
125
|
-
* @internal
|
|
126
|
-
* @type {ReactComponent}
|
|
127
|
-
*/
|
|
128
|
-
current: null
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Keeps track of the current batch's configuration such as how long an update
|
|
133
|
-
* should suspend for if it needs to.
|
|
134
|
-
*/
|
|
135
|
-
var ReactCurrentBatchConfig = {
|
|
136
|
-
transition: null
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
var ReactCurrentActQueue = {
|
|
140
|
-
current: null,
|
|
141
|
-
// Used to reproduce behavior of `batchedUpdates` in legacy mode.
|
|
142
|
-
isBatchingLegacy: false,
|
|
143
|
-
didScheduleLegacyUpdate: false
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Keeps track of the current owner.
|
|
148
|
-
*
|
|
149
|
-
* The current owner is the component who should own any components that are
|
|
150
|
-
* currently being constructed.
|
|
151
|
-
*/
|
|
152
|
-
var ReactCurrentOwner = {
|
|
153
|
-
/**
|
|
154
|
-
* @internal
|
|
155
|
-
* @type {ReactComponent}
|
|
156
|
-
*/
|
|
157
|
-
current: null
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
var ReactDebugCurrentFrame = {};
|
|
161
|
-
var currentExtraStackFrame = null;
|
|
162
|
-
function setExtraStackFrame(stack) {
|
|
163
|
-
{
|
|
164
|
-
currentExtraStackFrame = stack;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
{
|
|
169
|
-
ReactDebugCurrentFrame.setExtraStackFrame = function (stack) {
|
|
170
|
-
{
|
|
171
|
-
currentExtraStackFrame = stack;
|
|
172
|
-
}
|
|
173
|
-
}; // Stack implementation injected by the current renderer.
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
ReactDebugCurrentFrame.getCurrentStack = null;
|
|
177
|
-
|
|
178
|
-
ReactDebugCurrentFrame.getStackAddendum = function () {
|
|
179
|
-
var stack = ''; // Add an extra top frame while an element is being validated
|
|
180
|
-
|
|
181
|
-
if (currentExtraStackFrame) {
|
|
182
|
-
stack += currentExtraStackFrame;
|
|
183
|
-
} // Delegate to the injected renderer-specific implementation
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
var impl = ReactDebugCurrentFrame.getCurrentStack;
|
|
187
|
-
|
|
188
|
-
if (impl) {
|
|
189
|
-
stack += impl() || '';
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
return stack;
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
// -----------------------------------------------------------------------------
|
|
197
|
-
|
|
198
|
-
var enableScopeAPI = false; // Experimental Create Event Handle API.
|
|
199
|
-
var enableCacheElement = false;
|
|
200
|
-
var enableTransitionTracing = false; // No known bugs, but needs performance testing
|
|
201
|
-
|
|
202
|
-
var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
|
|
203
|
-
// stuff. Intended to enable React core members to more easily debug scheduling
|
|
204
|
-
// issues in DEV builds.
|
|
205
|
-
|
|
206
|
-
var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
|
|
207
|
-
|
|
208
|
-
var ReactSharedInternals = {
|
|
209
|
-
ReactCurrentDispatcher: ReactCurrentDispatcher,
|
|
210
|
-
ReactCurrentBatchConfig: ReactCurrentBatchConfig,
|
|
211
|
-
ReactCurrentOwner: ReactCurrentOwner
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
{
|
|
215
|
-
ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame;
|
|
216
|
-
ReactSharedInternals.ReactCurrentActQueue = ReactCurrentActQueue;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
// by calls to these methods by a Babel plugin.
|
|
220
|
-
//
|
|
221
|
-
// In PROD (or in packages without access to React internals),
|
|
222
|
-
// they are left as they are instead.
|
|
223
|
-
|
|
224
|
-
function warn(format) {
|
|
225
|
-
{
|
|
226
|
-
{
|
|
227
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
228
|
-
args[_key - 1] = arguments[_key];
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
printWarning('warn', format, args);
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
function error(format) {
|
|
236
|
-
{
|
|
237
|
-
{
|
|
238
|
-
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
239
|
-
args[_key2 - 1] = arguments[_key2];
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
printWarning('error', format, args);
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
function printWarning(level, format, args) {
|
|
248
|
-
// When changing this logic, you might want to also
|
|
249
|
-
// update consoleWithStackDev.www.js as well.
|
|
250
|
-
{
|
|
251
|
-
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
252
|
-
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
253
|
-
|
|
254
|
-
if (stack !== '') {
|
|
255
|
-
format += '%s';
|
|
256
|
-
args = args.concat([stack]);
|
|
257
|
-
} // eslint-disable-next-line react-internal/safe-string-coercion
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
var argsWithFormat = args.map(function (item) {
|
|
261
|
-
return String(item);
|
|
262
|
-
}); // Careful: RN currently depends on this prefix
|
|
263
|
-
|
|
264
|
-
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
|
265
|
-
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
266
|
-
// eslint-disable-next-line react-internal/no-production-logging
|
|
267
|
-
|
|
268
|
-
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
var didWarnStateUpdateForUnmountedComponent = {};
|
|
273
|
-
|
|
274
|
-
function warnNoop(publicInstance, callerName) {
|
|
275
|
-
{
|
|
276
|
-
var _constructor = publicInstance.constructor;
|
|
277
|
-
var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
|
|
278
|
-
var warningKey = componentName + "." + callerName;
|
|
279
|
-
|
|
280
|
-
if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
|
|
281
|
-
return;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
error("Can't call %s on a component that is not yet mounted. " + 'This is a no-op, but it might indicate a bug in your application. ' + 'Instead, assign to `this.state` directly or define a `state = {};` ' + 'class property with the desired state in the %s component.', callerName, componentName);
|
|
285
|
-
|
|
286
|
-
didWarnStateUpdateForUnmountedComponent[warningKey] = true;
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* This is the abstract API for an update queue.
|
|
291
|
-
*/
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
var ReactNoopUpdateQueue = {
|
|
295
|
-
/**
|
|
296
|
-
* Checks whether or not this composite component is mounted.
|
|
297
|
-
* @param {ReactClass} publicInstance The instance we want to test.
|
|
298
|
-
* @return {boolean} True if mounted, false otherwise.
|
|
299
|
-
* @protected
|
|
300
|
-
* @final
|
|
301
|
-
*/
|
|
302
|
-
isMounted: function (publicInstance) {
|
|
303
|
-
return false;
|
|
304
|
-
},
|
|
305
|
-
|
|
306
|
-
/**
|
|
307
|
-
* Forces an update. This should only be invoked when it is known with
|
|
308
|
-
* certainty that we are **not** in a DOM transaction.
|
|
309
|
-
*
|
|
310
|
-
* You may want to call this when you know that some deeper aspect of the
|
|
311
|
-
* component's state has changed but `setState` was not called.
|
|
312
|
-
*
|
|
313
|
-
* This will not invoke `shouldComponentUpdate`, but it will invoke
|
|
314
|
-
* `componentWillUpdate` and `componentDidUpdate`.
|
|
315
|
-
*
|
|
316
|
-
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
317
|
-
* @param {?function} callback Called after component is updated.
|
|
318
|
-
* @param {?string} callerName name of the calling function in the public API.
|
|
319
|
-
* @internal
|
|
320
|
-
*/
|
|
321
|
-
enqueueForceUpdate: function (publicInstance, callback, callerName) {
|
|
322
|
-
warnNoop(publicInstance, 'forceUpdate');
|
|
323
|
-
},
|
|
324
|
-
|
|
325
|
-
/**
|
|
326
|
-
* Replaces all of the state. Always use this or `setState` to mutate state.
|
|
327
|
-
* You should treat `this.state` as immutable.
|
|
328
|
-
*
|
|
329
|
-
* There is no guarantee that `this.state` will be immediately updated, so
|
|
330
|
-
* accessing `this.state` after calling this method may return the old value.
|
|
331
|
-
*
|
|
332
|
-
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
333
|
-
* @param {object} completeState Next state.
|
|
334
|
-
* @param {?function} callback Called after component is updated.
|
|
335
|
-
* @param {?string} callerName name of the calling function in the public API.
|
|
336
|
-
* @internal
|
|
337
|
-
*/
|
|
338
|
-
enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
|
|
339
|
-
warnNoop(publicInstance, 'replaceState');
|
|
340
|
-
},
|
|
341
|
-
|
|
342
|
-
/**
|
|
343
|
-
* Sets a subset of the state. This only exists because _pendingState is
|
|
344
|
-
* internal. This provides a merging strategy that is not available to deep
|
|
345
|
-
* properties which is confusing. TODO: Expose pendingState or don't use it
|
|
346
|
-
* during the merge.
|
|
347
|
-
*
|
|
348
|
-
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
349
|
-
* @param {object} partialState Next partial state to be merged with state.
|
|
350
|
-
* @param {?function} callback Called after component is updated.
|
|
351
|
-
* @param {?string} Name of the calling function in the public API.
|
|
352
|
-
* @internal
|
|
353
|
-
*/
|
|
354
|
-
enqueueSetState: function (publicInstance, partialState, callback, callerName) {
|
|
355
|
-
warnNoop(publicInstance, 'setState');
|
|
356
|
-
}
|
|
357
|
-
};
|
|
358
|
-
|
|
359
|
-
var assign = Object.assign;
|
|
360
|
-
|
|
361
|
-
var emptyObject = {};
|
|
362
|
-
|
|
363
|
-
{
|
|
364
|
-
Object.freeze(emptyObject);
|
|
365
|
-
}
|
|
366
|
-
/**
|
|
367
|
-
* Base class helpers for the updating state of a component.
|
|
368
|
-
*/
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
function Component(props, context, updater) {
|
|
372
|
-
this.props = props;
|
|
373
|
-
this.context = context; // If a component has string refs, we will assign a different object later.
|
|
374
|
-
|
|
375
|
-
this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the
|
|
376
|
-
// renderer.
|
|
377
|
-
|
|
378
|
-
this.updater = updater || ReactNoopUpdateQueue;
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
Component.prototype.isReactComponent = {};
|
|
382
|
-
/**
|
|
383
|
-
* Sets a subset of the state. Always use this to mutate
|
|
384
|
-
* state. You should treat `this.state` as immutable.
|
|
385
|
-
*
|
|
386
|
-
* There is no guarantee that `this.state` will be immediately updated, so
|
|
387
|
-
* accessing `this.state` after calling this method may return the old value.
|
|
388
|
-
*
|
|
389
|
-
* There is no guarantee that calls to `setState` will run synchronously,
|
|
390
|
-
* as they may eventually be batched together. You can provide an optional
|
|
391
|
-
* callback that will be executed when the call to setState is actually
|
|
392
|
-
* completed.
|
|
393
|
-
*
|
|
394
|
-
* When a function is provided to setState, it will be called at some point in
|
|
395
|
-
* the future (not synchronously). It will be called with the up to date
|
|
396
|
-
* component arguments (state, props, context). These values can be different
|
|
397
|
-
* from this.* because your function may be called after receiveProps but before
|
|
398
|
-
* shouldComponentUpdate, and this new state, props, and context will not yet be
|
|
399
|
-
* assigned to this.
|
|
400
|
-
*
|
|
401
|
-
* @param {object|function} partialState Next partial state or function to
|
|
402
|
-
* produce next partial state to be merged with current state.
|
|
403
|
-
* @param {?function} callback Called after state is updated.
|
|
404
|
-
* @final
|
|
405
|
-
* @protected
|
|
406
|
-
*/
|
|
407
|
-
|
|
408
|
-
Component.prototype.setState = function (partialState, callback) {
|
|
409
|
-
if (typeof partialState !== 'object' && typeof partialState !== 'function' && partialState != null) {
|
|
410
|
-
throw new Error('setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.');
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
this.updater.enqueueSetState(this, partialState, callback, 'setState');
|
|
414
|
-
};
|
|
415
|
-
/**
|
|
416
|
-
* Forces an update. This should only be invoked when it is known with
|
|
417
|
-
* certainty that we are **not** in a DOM transaction.
|
|
418
|
-
*
|
|
419
|
-
* You may want to call this when you know that some deeper aspect of the
|
|
420
|
-
* component's state has changed but `setState` was not called.
|
|
421
|
-
*
|
|
422
|
-
* This will not invoke `shouldComponentUpdate`, but it will invoke
|
|
423
|
-
* `componentWillUpdate` and `componentDidUpdate`.
|
|
424
|
-
*
|
|
425
|
-
* @param {?function} callback Called after update is complete.
|
|
426
|
-
* @final
|
|
427
|
-
* @protected
|
|
428
|
-
*/
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
Component.prototype.forceUpdate = function (callback) {
|
|
432
|
-
this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
|
|
433
|
-
};
|
|
434
|
-
/**
|
|
435
|
-
* Deprecated APIs. These APIs used to exist on classic React classes but since
|
|
436
|
-
* we would like to deprecate them, we're not going to move them over to this
|
|
437
|
-
* modern base class. Instead, we define a getter that warns if it's accessed.
|
|
438
|
-
*/
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
{
|
|
442
|
-
var deprecatedAPIs = {
|
|
443
|
-
isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
|
|
444
|
-
replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
|
|
445
|
-
};
|
|
446
|
-
|
|
447
|
-
var defineDeprecationWarning = function (methodName, info) {
|
|
448
|
-
Object.defineProperty(Component.prototype, methodName, {
|
|
449
|
-
get: function () {
|
|
450
|
-
warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
|
|
451
|
-
|
|
452
|
-
return undefined;
|
|
453
|
-
}
|
|
454
|
-
});
|
|
455
|
-
};
|
|
456
|
-
|
|
457
|
-
for (var fnName in deprecatedAPIs) {
|
|
458
|
-
if (deprecatedAPIs.hasOwnProperty(fnName)) {
|
|
459
|
-
defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
function ComponentDummy() {}
|
|
465
|
-
|
|
466
|
-
ComponentDummy.prototype = Component.prototype;
|
|
467
|
-
/**
|
|
468
|
-
* Convenience component with default shallow equality check for sCU.
|
|
469
|
-
*/
|
|
470
|
-
|
|
471
|
-
function PureComponent(props, context, updater) {
|
|
472
|
-
this.props = props;
|
|
473
|
-
this.context = context; // If a component has string refs, we will assign a different object later.
|
|
474
|
-
|
|
475
|
-
this.refs = emptyObject;
|
|
476
|
-
this.updater = updater || ReactNoopUpdateQueue;
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
|
|
480
|
-
pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods.
|
|
481
|
-
|
|
482
|
-
assign(pureComponentPrototype, Component.prototype);
|
|
483
|
-
pureComponentPrototype.isPureReactComponent = true;
|
|
484
|
-
|
|
485
|
-
// an immutable object with a single mutable value
|
|
486
|
-
function createRef() {
|
|
487
|
-
var refObject = {
|
|
488
|
-
current: null
|
|
489
|
-
};
|
|
490
|
-
|
|
491
|
-
{
|
|
492
|
-
Object.seal(refObject);
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
return refObject;
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
|
|
499
|
-
|
|
500
|
-
function isArray(a) {
|
|
501
|
-
return isArrayImpl(a);
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
/*
|
|
505
|
-
* The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol
|
|
506
|
-
* and Temporal.* types. See https://github.com/facebook/react/pull/22064.
|
|
507
|
-
*
|
|
508
|
-
* The functions in this module will throw an easier-to-understand,
|
|
509
|
-
* easier-to-debug exception with a clear errors message message explaining the
|
|
510
|
-
* problem. (Instead of a confusing exception thrown inside the implementation
|
|
511
|
-
* of the `value` object).
|
|
512
|
-
*/
|
|
513
|
-
// $FlowFixMe only called in DEV, so void return is not possible.
|
|
514
|
-
function typeName(value) {
|
|
515
|
-
{
|
|
516
|
-
// toStringTag is needed for namespaced types like Temporal.Instant
|
|
517
|
-
var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
|
|
518
|
-
var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
|
|
519
|
-
return type;
|
|
520
|
-
}
|
|
521
|
-
} // $FlowFixMe only called in DEV, so void return is not possible.
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
function willCoercionThrow(value) {
|
|
525
|
-
{
|
|
526
|
-
try {
|
|
527
|
-
testStringCoercion(value);
|
|
528
|
-
return false;
|
|
529
|
-
} catch (e) {
|
|
530
|
-
return true;
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
function testStringCoercion(value) {
|
|
536
|
-
// If you ended up here by following an exception call stack, here's what's
|
|
537
|
-
// happened: you supplied an object or symbol value to React (as a prop, key,
|
|
538
|
-
// DOM attribute, CSS property, string ref, etc.) and when React tried to
|
|
539
|
-
// coerce it to a string using `'' + value`, an exception was thrown.
|
|
540
|
-
//
|
|
541
|
-
// The most common types that will cause this exception are `Symbol` instances
|
|
542
|
-
// and Temporal objects like `Temporal.Instant`. But any object that has a
|
|
543
|
-
// `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
|
|
544
|
-
// exception. (Library authors do this to prevent users from using built-in
|
|
545
|
-
// numeric operators like `+` or comparison operators like `>=` because custom
|
|
546
|
-
// methods are needed to perform accurate arithmetic or comparison.)
|
|
547
|
-
//
|
|
548
|
-
// To fix the problem, coerce this object or symbol value to a string before
|
|
549
|
-
// passing it to React. The most reliable way is usually `String(value)`.
|
|
550
|
-
//
|
|
551
|
-
// To find which value is throwing, check the browser or debugger console.
|
|
552
|
-
// Before this exception was thrown, there should be `console.error` output
|
|
553
|
-
// that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
|
|
554
|
-
// problem and how that type was used: key, atrribute, input value prop, etc.
|
|
555
|
-
// In most cases, this console output also shows the component and its
|
|
556
|
-
// ancestor components where the exception happened.
|
|
557
|
-
//
|
|
558
|
-
// eslint-disable-next-line react-internal/safe-string-coercion
|
|
559
|
-
return '' + value;
|
|
560
|
-
}
|
|
561
|
-
function checkKeyStringCoercion(value) {
|
|
562
|
-
{
|
|
563
|
-
if (willCoercionThrow(value)) {
|
|
564
|
-
error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
|
|
565
|
-
|
|
566
|
-
return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
function getWrappedName(outerType, innerType, wrapperName) {
|
|
572
|
-
var displayName = outerType.displayName;
|
|
573
|
-
|
|
574
|
-
if (displayName) {
|
|
575
|
-
return displayName;
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
var functionName = innerType.displayName || innerType.name || '';
|
|
579
|
-
return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
|
|
580
|
-
} // Keep in sync with react-reconciler/getComponentNameFromFiber
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
function getContextName(type) {
|
|
584
|
-
return type.displayName || 'Context';
|
|
585
|
-
} // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
function getComponentNameFromType(type) {
|
|
589
|
-
if (type == null) {
|
|
590
|
-
// Host root, text node or just invalid type.
|
|
591
|
-
return null;
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
{
|
|
595
|
-
if (typeof type.tag === 'number') {
|
|
596
|
-
error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
if (typeof type === 'function') {
|
|
601
|
-
return type.displayName || type.name || null;
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
if (typeof type === 'string') {
|
|
605
|
-
return type;
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
switch (type) {
|
|
609
|
-
case REACT_FRAGMENT_TYPE:
|
|
610
|
-
return 'Fragment';
|
|
611
|
-
|
|
612
|
-
case REACT_PORTAL_TYPE:
|
|
613
|
-
return 'Portal';
|
|
614
|
-
|
|
615
|
-
case REACT_PROFILER_TYPE:
|
|
616
|
-
return 'Profiler';
|
|
617
|
-
|
|
618
|
-
case REACT_STRICT_MODE_TYPE:
|
|
619
|
-
return 'StrictMode';
|
|
620
|
-
|
|
621
|
-
case REACT_SUSPENSE_TYPE:
|
|
622
|
-
return 'Suspense';
|
|
623
|
-
|
|
624
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
625
|
-
return 'SuspenseList';
|
|
626
|
-
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
if (typeof type === 'object') {
|
|
630
|
-
switch (type.$$typeof) {
|
|
631
|
-
case REACT_CONTEXT_TYPE:
|
|
632
|
-
var context = type;
|
|
633
|
-
return getContextName(context) + '.Consumer';
|
|
634
|
-
|
|
635
|
-
case REACT_PROVIDER_TYPE:
|
|
636
|
-
var provider = type;
|
|
637
|
-
return getContextName(provider._context) + '.Provider';
|
|
638
|
-
|
|
639
|
-
case REACT_FORWARD_REF_TYPE:
|
|
640
|
-
return getWrappedName(type, type.render, 'ForwardRef');
|
|
641
|
-
|
|
642
|
-
case REACT_MEMO_TYPE:
|
|
643
|
-
var outerName = type.displayName || null;
|
|
644
|
-
|
|
645
|
-
if (outerName !== null) {
|
|
646
|
-
return outerName;
|
|
647
|
-
}
|
|
648
|
-
|
|
649
|
-
return getComponentNameFromType(type.type) || 'Memo';
|
|
650
|
-
|
|
651
|
-
case REACT_LAZY_TYPE:
|
|
652
|
-
{
|
|
653
|
-
var lazyComponent = type;
|
|
654
|
-
var payload = lazyComponent._payload;
|
|
655
|
-
var init = lazyComponent._init;
|
|
656
|
-
|
|
657
|
-
try {
|
|
658
|
-
return getComponentNameFromType(init(payload));
|
|
659
|
-
} catch (x) {
|
|
660
|
-
return null;
|
|
661
|
-
}
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
// eslint-disable-next-line no-fallthrough
|
|
665
|
-
}
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
return null;
|
|
669
|
-
}
|
|
670
|
-
|
|
671
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
672
|
-
|
|
673
|
-
var RESERVED_PROPS = {
|
|
674
|
-
key: true,
|
|
675
|
-
ref: true,
|
|
676
|
-
__self: true,
|
|
677
|
-
__source: true
|
|
678
|
-
};
|
|
679
|
-
var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs;
|
|
680
|
-
|
|
681
|
-
{
|
|
682
|
-
didWarnAboutStringRefs = {};
|
|
683
|
-
}
|
|
684
|
-
|
|
685
|
-
function hasValidRef(config) {
|
|
686
|
-
{
|
|
687
|
-
if (hasOwnProperty.call(config, 'ref')) {
|
|
688
|
-
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
|
|
689
|
-
|
|
690
|
-
if (getter && getter.isReactWarning) {
|
|
691
|
-
return false;
|
|
692
|
-
}
|
|
693
|
-
}
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
return config.ref !== undefined;
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
function hasValidKey(config) {
|
|
700
|
-
{
|
|
701
|
-
if (hasOwnProperty.call(config, 'key')) {
|
|
702
|
-
var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
|
|
703
|
-
|
|
704
|
-
if (getter && getter.isReactWarning) {
|
|
705
|
-
return false;
|
|
706
|
-
}
|
|
707
|
-
}
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
return config.key !== undefined;
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
function defineKeyPropWarningGetter(props, displayName) {
|
|
714
|
-
var warnAboutAccessingKey = function () {
|
|
715
|
-
{
|
|
716
|
-
if (!specialPropKeyWarningShown) {
|
|
717
|
-
specialPropKeyWarningShown = true;
|
|
718
|
-
|
|
719
|
-
error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
|
|
720
|
-
}
|
|
721
|
-
}
|
|
722
|
-
};
|
|
723
|
-
|
|
724
|
-
warnAboutAccessingKey.isReactWarning = true;
|
|
725
|
-
Object.defineProperty(props, 'key', {
|
|
726
|
-
get: warnAboutAccessingKey,
|
|
727
|
-
configurable: true
|
|
728
|
-
});
|
|
729
|
-
}
|
|
730
|
-
|
|
731
|
-
function defineRefPropWarningGetter(props, displayName) {
|
|
732
|
-
var warnAboutAccessingRef = function () {
|
|
733
|
-
{
|
|
734
|
-
if (!specialPropRefWarningShown) {
|
|
735
|
-
specialPropRefWarningShown = true;
|
|
736
|
-
|
|
737
|
-
error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
};
|
|
741
|
-
|
|
742
|
-
warnAboutAccessingRef.isReactWarning = true;
|
|
743
|
-
Object.defineProperty(props, 'ref', {
|
|
744
|
-
get: warnAboutAccessingRef,
|
|
745
|
-
configurable: true
|
|
746
|
-
});
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
function warnIfStringRefCannotBeAutoConverted(config) {
|
|
750
|
-
{
|
|
751
|
-
if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {
|
|
752
|
-
var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
|
|
753
|
-
|
|
754
|
-
if (!didWarnAboutStringRefs[componentName]) {
|
|
755
|
-
error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', componentName, config.ref);
|
|
756
|
-
|
|
757
|
-
didWarnAboutStringRefs[componentName] = true;
|
|
758
|
-
}
|
|
759
|
-
}
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
/**
|
|
763
|
-
* Factory method to create a new React element. This no longer adheres to
|
|
764
|
-
* the class pattern, so do not use new to call it. Also, instanceof check
|
|
765
|
-
* will not work. Instead test $$typeof field against Symbol.for('react.element') to check
|
|
766
|
-
* if something is a React Element.
|
|
767
|
-
*
|
|
768
|
-
* @param {*} type
|
|
769
|
-
* @param {*} props
|
|
770
|
-
* @param {*} key
|
|
771
|
-
* @param {string|object} ref
|
|
772
|
-
* @param {*} owner
|
|
773
|
-
* @param {*} self A *temporary* helper to detect places where `this` is
|
|
774
|
-
* different from the `owner` when React.createElement is called, so that we
|
|
775
|
-
* can warn. We want to get rid of owner and replace string `ref`s with arrow
|
|
776
|
-
* functions, and as long as `this` and owner are the same, there will be no
|
|
777
|
-
* change in behavior.
|
|
778
|
-
* @param {*} source An annotation object (added by a transpiler or otherwise)
|
|
779
|
-
* indicating filename, line number, and/or other information.
|
|
780
|
-
* @internal
|
|
781
|
-
*/
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
785
|
-
var element = {
|
|
786
|
-
// This tag allows us to uniquely identify this as a React Element
|
|
787
|
-
$$typeof: REACT_ELEMENT_TYPE,
|
|
788
|
-
// Built-in properties that belong on the element
|
|
789
|
-
type: type,
|
|
790
|
-
key: key,
|
|
791
|
-
ref: ref,
|
|
792
|
-
props: props,
|
|
793
|
-
// Record the component responsible for creating this element.
|
|
794
|
-
_owner: owner
|
|
795
|
-
};
|
|
796
|
-
|
|
797
|
-
{
|
|
798
|
-
// The validation flag is currently mutative. We put it on
|
|
799
|
-
// an external backing store so that we can freeze the whole object.
|
|
800
|
-
// This can be replaced with a WeakMap once they are implemented in
|
|
801
|
-
// commonly used development environments.
|
|
802
|
-
element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
|
|
803
|
-
// the validation flag non-enumerable (where possible, which should
|
|
804
|
-
// include every environment we run tests in), so the test framework
|
|
805
|
-
// ignores it.
|
|
806
|
-
|
|
807
|
-
Object.defineProperty(element._store, 'validated', {
|
|
808
|
-
configurable: false,
|
|
809
|
-
enumerable: false,
|
|
810
|
-
writable: true,
|
|
811
|
-
value: false
|
|
812
|
-
}); // self and source are DEV only properties.
|
|
813
|
-
|
|
814
|
-
Object.defineProperty(element, '_self', {
|
|
815
|
-
configurable: false,
|
|
816
|
-
enumerable: false,
|
|
817
|
-
writable: false,
|
|
818
|
-
value: self
|
|
819
|
-
}); // Two elements created in two different places should be considered
|
|
820
|
-
// equal for testing purposes and therefore we hide it from enumeration.
|
|
821
|
-
|
|
822
|
-
Object.defineProperty(element, '_source', {
|
|
823
|
-
configurable: false,
|
|
824
|
-
enumerable: false,
|
|
825
|
-
writable: false,
|
|
826
|
-
value: source
|
|
827
|
-
});
|
|
828
|
-
|
|
829
|
-
if (Object.freeze) {
|
|
830
|
-
Object.freeze(element.props);
|
|
831
|
-
Object.freeze(element);
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
|
|
835
|
-
return element;
|
|
836
|
-
};
|
|
837
|
-
/**
|
|
838
|
-
* Create and return a new ReactElement of the given type.
|
|
839
|
-
* See https://reactjs.org/docs/react-api.html#createelement
|
|
840
|
-
*/
|
|
841
|
-
|
|
842
|
-
function createElement(type, config, children) {
|
|
843
|
-
var propName; // Reserved names are extracted
|
|
844
|
-
|
|
845
|
-
var props = {};
|
|
846
|
-
var key = null;
|
|
847
|
-
var ref = null;
|
|
848
|
-
var self = null;
|
|
849
|
-
var source = null;
|
|
850
|
-
|
|
851
|
-
if (config != null) {
|
|
852
|
-
if (hasValidRef(config)) {
|
|
853
|
-
ref = config.ref;
|
|
854
|
-
|
|
855
|
-
{
|
|
856
|
-
warnIfStringRefCannotBeAutoConverted(config);
|
|
857
|
-
}
|
|
858
|
-
}
|
|
859
|
-
|
|
860
|
-
if (hasValidKey(config)) {
|
|
861
|
-
{
|
|
862
|
-
checkKeyStringCoercion(config.key);
|
|
863
|
-
}
|
|
864
|
-
|
|
865
|
-
key = '' + config.key;
|
|
866
|
-
}
|
|
867
|
-
|
|
868
|
-
self = config.__self === undefined ? null : config.__self;
|
|
869
|
-
source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object
|
|
870
|
-
|
|
871
|
-
for (propName in config) {
|
|
872
|
-
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
873
|
-
props[propName] = config[propName];
|
|
874
|
-
}
|
|
875
|
-
}
|
|
876
|
-
} // Children can be more than one argument, and those are transferred onto
|
|
877
|
-
// the newly allocated props object.
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
var childrenLength = arguments.length - 2;
|
|
881
|
-
|
|
882
|
-
if (childrenLength === 1) {
|
|
883
|
-
props.children = children;
|
|
884
|
-
} else if (childrenLength > 1) {
|
|
885
|
-
var childArray = Array(childrenLength);
|
|
886
|
-
|
|
887
|
-
for (var i = 0; i < childrenLength; i++) {
|
|
888
|
-
childArray[i] = arguments[i + 2];
|
|
889
|
-
}
|
|
890
|
-
|
|
891
|
-
{
|
|
892
|
-
if (Object.freeze) {
|
|
893
|
-
Object.freeze(childArray);
|
|
894
|
-
}
|
|
895
|
-
}
|
|
896
|
-
|
|
897
|
-
props.children = childArray;
|
|
898
|
-
} // Resolve default props
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
if (type && type.defaultProps) {
|
|
902
|
-
var defaultProps = type.defaultProps;
|
|
903
|
-
|
|
904
|
-
for (propName in defaultProps) {
|
|
905
|
-
if (props[propName] === undefined) {
|
|
906
|
-
props[propName] = defaultProps[propName];
|
|
907
|
-
}
|
|
908
|
-
}
|
|
909
|
-
}
|
|
910
|
-
|
|
911
|
-
{
|
|
912
|
-
if (key || ref) {
|
|
913
|
-
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
|
914
|
-
|
|
915
|
-
if (key) {
|
|
916
|
-
defineKeyPropWarningGetter(props, displayName);
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
if (ref) {
|
|
920
|
-
defineRefPropWarningGetter(props, displayName);
|
|
921
|
-
}
|
|
922
|
-
}
|
|
923
|
-
}
|
|
924
|
-
|
|
925
|
-
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
|
926
|
-
}
|
|
927
|
-
function cloneAndReplaceKey(oldElement, newKey) {
|
|
928
|
-
var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
|
|
929
|
-
return newElement;
|
|
930
|
-
}
|
|
931
|
-
/**
|
|
932
|
-
* Clone and return a new ReactElement using element as the starting point.
|
|
933
|
-
* See https://reactjs.org/docs/react-api.html#cloneelement
|
|
934
|
-
*/
|
|
935
|
-
|
|
936
|
-
function cloneElement(element, config, children) {
|
|
937
|
-
if (element === null || element === undefined) {
|
|
938
|
-
throw new Error("React.cloneElement(...): The argument must be a React element, but you passed " + element + ".");
|
|
939
|
-
}
|
|
940
|
-
|
|
941
|
-
var propName; // Original props are copied
|
|
942
|
-
|
|
943
|
-
var props = assign({}, element.props); // Reserved names are extracted
|
|
944
|
-
|
|
945
|
-
var key = element.key;
|
|
946
|
-
var ref = element.ref; // Self is preserved since the owner is preserved.
|
|
947
|
-
|
|
948
|
-
var self = element._self; // Source is preserved since cloneElement is unlikely to be targeted by a
|
|
949
|
-
// transpiler, and the original source is probably a better indicator of the
|
|
950
|
-
// true owner.
|
|
951
|
-
|
|
952
|
-
var source = element._source; // Owner will be preserved, unless ref is overridden
|
|
953
|
-
|
|
954
|
-
var owner = element._owner;
|
|
955
|
-
|
|
956
|
-
if (config != null) {
|
|
957
|
-
if (hasValidRef(config)) {
|
|
958
|
-
// Silently steal the ref from the parent.
|
|
959
|
-
ref = config.ref;
|
|
960
|
-
owner = ReactCurrentOwner.current;
|
|
961
|
-
}
|
|
962
|
-
|
|
963
|
-
if (hasValidKey(config)) {
|
|
964
|
-
{
|
|
965
|
-
checkKeyStringCoercion(config.key);
|
|
966
|
-
}
|
|
967
|
-
|
|
968
|
-
key = '' + config.key;
|
|
969
|
-
} // Remaining properties override existing props
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
var defaultProps;
|
|
973
|
-
|
|
974
|
-
if (element.type && element.type.defaultProps) {
|
|
975
|
-
defaultProps = element.type.defaultProps;
|
|
976
|
-
}
|
|
977
|
-
|
|
978
|
-
for (propName in config) {
|
|
979
|
-
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
980
|
-
if (config[propName] === undefined && defaultProps !== undefined) {
|
|
981
|
-
// Resolve default props
|
|
982
|
-
props[propName] = defaultProps[propName];
|
|
983
|
-
} else {
|
|
984
|
-
props[propName] = config[propName];
|
|
985
|
-
}
|
|
986
|
-
}
|
|
987
|
-
}
|
|
988
|
-
} // Children can be more than one argument, and those are transferred onto
|
|
989
|
-
// the newly allocated props object.
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
var childrenLength = arguments.length - 2;
|
|
993
|
-
|
|
994
|
-
if (childrenLength === 1) {
|
|
995
|
-
props.children = children;
|
|
996
|
-
} else if (childrenLength > 1) {
|
|
997
|
-
var childArray = Array(childrenLength);
|
|
998
|
-
|
|
999
|
-
for (var i = 0; i < childrenLength; i++) {
|
|
1000
|
-
childArray[i] = arguments[i + 2];
|
|
1001
|
-
}
|
|
1002
|
-
|
|
1003
|
-
props.children = childArray;
|
|
1004
|
-
}
|
|
1005
|
-
|
|
1006
|
-
return ReactElement(element.type, key, ref, self, source, owner, props);
|
|
1007
|
-
}
|
|
1008
|
-
/**
|
|
1009
|
-
* Verifies the object is a ReactElement.
|
|
1010
|
-
* See https://reactjs.org/docs/react-api.html#isvalidelement
|
|
1011
|
-
* @param {?object} object
|
|
1012
|
-
* @return {boolean} True if `object` is a ReactElement.
|
|
1013
|
-
* @final
|
|
1014
|
-
*/
|
|
1015
|
-
|
|
1016
|
-
function isValidElement(object) {
|
|
1017
|
-
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
1018
|
-
}
|
|
1019
|
-
|
|
1020
|
-
var SEPARATOR = '.';
|
|
1021
|
-
var SUBSEPARATOR = ':';
|
|
1022
|
-
/**
|
|
1023
|
-
* Escape and wrap key so it is safe to use as a reactid
|
|
1024
|
-
*
|
|
1025
|
-
* @param {string} key to be escaped.
|
|
1026
|
-
* @return {string} the escaped key.
|
|
1027
|
-
*/
|
|
1028
|
-
|
|
1029
|
-
function escape(key) {
|
|
1030
|
-
var escapeRegex = /[=:]/g;
|
|
1031
|
-
var escaperLookup = {
|
|
1032
|
-
'=': '=0',
|
|
1033
|
-
':': '=2'
|
|
1034
|
-
};
|
|
1035
|
-
var escapedString = key.replace(escapeRegex, function (match) {
|
|
1036
|
-
return escaperLookup[match];
|
|
1037
|
-
});
|
|
1038
|
-
return '$' + escapedString;
|
|
1039
|
-
}
|
|
1040
|
-
/**
|
|
1041
|
-
* TODO: Test that a single child and an array with one item have the same key
|
|
1042
|
-
* pattern.
|
|
1043
|
-
*/
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
var didWarnAboutMaps = false;
|
|
1047
|
-
var userProvidedKeyEscapeRegex = /\/+/g;
|
|
1048
|
-
|
|
1049
|
-
function escapeUserProvidedKey(text) {
|
|
1050
|
-
return text.replace(userProvidedKeyEscapeRegex, '$&/');
|
|
1051
|
-
}
|
|
1052
|
-
/**
|
|
1053
|
-
* Generate a key string that identifies a element within a set.
|
|
1054
|
-
*
|
|
1055
|
-
* @param {*} element A element that could contain a manual key.
|
|
1056
|
-
* @param {number} index Index that is used if a manual key is not provided.
|
|
1057
|
-
* @return {string}
|
|
1058
|
-
*/
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
function getElementKey(element, index) {
|
|
1062
|
-
// Do some typechecking here since we call this blindly. We want to ensure
|
|
1063
|
-
// that we don't block potential future ES APIs.
|
|
1064
|
-
if (typeof element === 'object' && element !== null && element.key != null) {
|
|
1065
|
-
// Explicit key
|
|
1066
|
-
{
|
|
1067
|
-
checkKeyStringCoercion(element.key);
|
|
1068
|
-
}
|
|
1069
|
-
|
|
1070
|
-
return escape('' + element.key);
|
|
1071
|
-
} // Implicit key determined by the index in the set
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
return index.toString(36);
|
|
1075
|
-
}
|
|
1076
|
-
|
|
1077
|
-
function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
|
|
1078
|
-
var type = typeof children;
|
|
1079
|
-
|
|
1080
|
-
if (type === 'undefined' || type === 'boolean') {
|
|
1081
|
-
// All of the above are perceived as null.
|
|
1082
|
-
children = null;
|
|
1083
|
-
}
|
|
1084
|
-
|
|
1085
|
-
var invokeCallback = false;
|
|
1086
|
-
|
|
1087
|
-
if (children === null) {
|
|
1088
|
-
invokeCallback = true;
|
|
1089
|
-
} else {
|
|
1090
|
-
switch (type) {
|
|
1091
|
-
case 'string':
|
|
1092
|
-
case 'number':
|
|
1093
|
-
invokeCallback = true;
|
|
1094
|
-
break;
|
|
1095
|
-
|
|
1096
|
-
case 'object':
|
|
1097
|
-
switch (children.$$typeof) {
|
|
1098
|
-
case REACT_ELEMENT_TYPE:
|
|
1099
|
-
case REACT_PORTAL_TYPE:
|
|
1100
|
-
invokeCallback = true;
|
|
1101
|
-
}
|
|
1102
|
-
|
|
1103
|
-
}
|
|
1104
|
-
}
|
|
1105
|
-
|
|
1106
|
-
if (invokeCallback) {
|
|
1107
|
-
var _child = children;
|
|
1108
|
-
var mappedChild = callback(_child); // If it's the only child, treat the name as if it was wrapped in an array
|
|
1109
|
-
// so that it's consistent if the number of children grows:
|
|
1110
|
-
|
|
1111
|
-
var childKey = nameSoFar === '' ? SEPARATOR + getElementKey(_child, 0) : nameSoFar;
|
|
1112
|
-
|
|
1113
|
-
if (isArray(mappedChild)) {
|
|
1114
|
-
var escapedChildKey = '';
|
|
1115
|
-
|
|
1116
|
-
if (childKey != null) {
|
|
1117
|
-
escapedChildKey = escapeUserProvidedKey(childKey) + '/';
|
|
1118
|
-
}
|
|
1119
|
-
|
|
1120
|
-
mapIntoArray(mappedChild, array, escapedChildKey, '', function (c) {
|
|
1121
|
-
return c;
|
|
1122
|
-
});
|
|
1123
|
-
} else if (mappedChild != null) {
|
|
1124
|
-
if (isValidElement(mappedChild)) {
|
|
1125
|
-
{
|
|
1126
|
-
// The `if` statement here prevents auto-disabling of the safe
|
|
1127
|
-
// coercion ESLint rule, so we must manually disable it below.
|
|
1128
|
-
// $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
|
|
1129
|
-
if (mappedChild.key && (!_child || _child.key !== mappedChild.key)) {
|
|
1130
|
-
checkKeyStringCoercion(mappedChild.key);
|
|
1131
|
-
}
|
|
1132
|
-
}
|
|
1133
|
-
|
|
1134
|
-
mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as
|
|
1135
|
-
// traverseAllChildren used to do for objects as children
|
|
1136
|
-
escapedPrefix + ( // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
|
|
1137
|
-
mappedChild.key && (!_child || _child.key !== mappedChild.key) ? // $FlowFixMe Flow incorrectly thinks existing element's key can be a number
|
|
1138
|
-
// eslint-disable-next-line react-internal/safe-string-coercion
|
|
1139
|
-
escapeUserProvidedKey('' + mappedChild.key) + '/' : '') + childKey);
|
|
1140
|
-
}
|
|
1141
|
-
|
|
1142
|
-
array.push(mappedChild);
|
|
1143
|
-
}
|
|
1144
|
-
|
|
1145
|
-
return 1;
|
|
1146
|
-
}
|
|
1147
|
-
|
|
1148
|
-
var child;
|
|
1149
|
-
var nextName;
|
|
1150
|
-
var subtreeCount = 0; // Count of children found in the current subtree.
|
|
1151
|
-
|
|
1152
|
-
var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
|
|
1153
|
-
|
|
1154
|
-
if (isArray(children)) {
|
|
1155
|
-
for (var i = 0; i < children.length; i++) {
|
|
1156
|
-
child = children[i];
|
|
1157
|
-
nextName = nextNamePrefix + getElementKey(child, i);
|
|
1158
|
-
subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
|
|
1159
|
-
}
|
|
1160
|
-
} else {
|
|
1161
|
-
var iteratorFn = getIteratorFn(children);
|
|
1162
|
-
|
|
1163
|
-
if (typeof iteratorFn === 'function') {
|
|
1164
|
-
var iterableChildren = children;
|
|
1165
|
-
|
|
1166
|
-
{
|
|
1167
|
-
// Warn about using Maps as children
|
|
1168
|
-
if (iteratorFn === iterableChildren.entries) {
|
|
1169
|
-
if (!didWarnAboutMaps) {
|
|
1170
|
-
warn('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.');
|
|
1171
|
-
}
|
|
1172
|
-
|
|
1173
|
-
didWarnAboutMaps = true;
|
|
1174
|
-
}
|
|
1175
|
-
}
|
|
1176
|
-
|
|
1177
|
-
var iterator = iteratorFn.call(iterableChildren);
|
|
1178
|
-
var step;
|
|
1179
|
-
var ii = 0;
|
|
1180
|
-
|
|
1181
|
-
while (!(step = iterator.next()).done) {
|
|
1182
|
-
child = step.value;
|
|
1183
|
-
nextName = nextNamePrefix + getElementKey(child, ii++);
|
|
1184
|
-
subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
|
|
1185
|
-
}
|
|
1186
|
-
} else if (type === 'object') {
|
|
1187
|
-
// eslint-disable-next-line react-internal/safe-string-coercion
|
|
1188
|
-
var childrenString = String(children);
|
|
1189
|
-
throw new Error("Objects are not valid as a React child (found: " + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + "). " + 'If you meant to render a collection of children, use an array ' + 'instead.');
|
|
1190
|
-
}
|
|
1191
|
-
}
|
|
1192
|
-
|
|
1193
|
-
return subtreeCount;
|
|
1194
|
-
}
|
|
1195
|
-
|
|
1196
|
-
/**
|
|
1197
|
-
* Maps children that are typically specified as `props.children`.
|
|
1198
|
-
*
|
|
1199
|
-
* See https://reactjs.org/docs/react-api.html#reactchildrenmap
|
|
1200
|
-
*
|
|
1201
|
-
* The provided mapFunction(child, index) will be called for each
|
|
1202
|
-
* leaf child.
|
|
1203
|
-
*
|
|
1204
|
-
* @param {?*} children Children tree container.
|
|
1205
|
-
* @param {function(*, int)} func The map function.
|
|
1206
|
-
* @param {*} context Context for mapFunction.
|
|
1207
|
-
* @return {object} Object containing the ordered map of results.
|
|
1208
|
-
*/
|
|
1209
|
-
function mapChildren(children, func, context) {
|
|
1210
|
-
if (children == null) {
|
|
1211
|
-
return children;
|
|
1212
|
-
}
|
|
1213
|
-
|
|
1214
|
-
var result = [];
|
|
1215
|
-
var count = 0;
|
|
1216
|
-
mapIntoArray(children, result, '', '', function (child) {
|
|
1217
|
-
return func.call(context, child, count++);
|
|
1218
|
-
});
|
|
1219
|
-
return result;
|
|
1220
|
-
}
|
|
1221
|
-
/**
|
|
1222
|
-
* Count the number of children that are typically specified as
|
|
1223
|
-
* `props.children`.
|
|
1224
|
-
*
|
|
1225
|
-
* See https://reactjs.org/docs/react-api.html#reactchildrencount
|
|
1226
|
-
*
|
|
1227
|
-
* @param {?*} children Children tree container.
|
|
1228
|
-
* @return {number} The number of children.
|
|
1229
|
-
*/
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
function countChildren(children) {
|
|
1233
|
-
var n = 0;
|
|
1234
|
-
mapChildren(children, function () {
|
|
1235
|
-
n++; // Don't return anything
|
|
1236
|
-
});
|
|
1237
|
-
return n;
|
|
1238
|
-
}
|
|
1239
|
-
|
|
1240
|
-
/**
|
|
1241
|
-
* Iterates through children that are typically specified as `props.children`.
|
|
1242
|
-
*
|
|
1243
|
-
* See https://reactjs.org/docs/react-api.html#reactchildrenforeach
|
|
1244
|
-
*
|
|
1245
|
-
* The provided forEachFunc(child, index) will be called for each
|
|
1246
|
-
* leaf child.
|
|
1247
|
-
*
|
|
1248
|
-
* @param {?*} children Children tree container.
|
|
1249
|
-
* @param {function(*, int)} forEachFunc
|
|
1250
|
-
* @param {*} forEachContext Context for forEachContext.
|
|
1251
|
-
*/
|
|
1252
|
-
function forEachChildren(children, forEachFunc, forEachContext) {
|
|
1253
|
-
mapChildren(children, function () {
|
|
1254
|
-
forEachFunc.apply(this, arguments); // Don't return anything.
|
|
1255
|
-
}, forEachContext);
|
|
1256
|
-
}
|
|
1257
|
-
/**
|
|
1258
|
-
* Flatten a children object (typically specified as `props.children`) and
|
|
1259
|
-
* return an array with appropriately re-keyed children.
|
|
1260
|
-
*
|
|
1261
|
-
* See https://reactjs.org/docs/react-api.html#reactchildrentoarray
|
|
1262
|
-
*/
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
function toArray(children) {
|
|
1266
|
-
return mapChildren(children, function (child) {
|
|
1267
|
-
return child;
|
|
1268
|
-
}) || [];
|
|
1269
|
-
}
|
|
1270
|
-
/**
|
|
1271
|
-
* Returns the first child in a collection of children and verifies that there
|
|
1272
|
-
* is only one child in the collection.
|
|
1273
|
-
*
|
|
1274
|
-
* See https://reactjs.org/docs/react-api.html#reactchildrenonly
|
|
1275
|
-
*
|
|
1276
|
-
* The current implementation of this function assumes that a single child gets
|
|
1277
|
-
* passed without a wrapper, but the purpose of this helper function is to
|
|
1278
|
-
* abstract away the particular structure of children.
|
|
1279
|
-
*
|
|
1280
|
-
* @param {?object} children Child collection structure.
|
|
1281
|
-
* @return {ReactElement} The first and only `ReactElement` contained in the
|
|
1282
|
-
* structure.
|
|
1283
|
-
*/
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
function onlyChild(children) {
|
|
1287
|
-
if (!isValidElement(children)) {
|
|
1288
|
-
throw new Error('React.Children.only expected to receive a single React element child.');
|
|
1289
|
-
}
|
|
1290
|
-
|
|
1291
|
-
return children;
|
|
1292
|
-
}
|
|
1293
|
-
|
|
1294
|
-
function createContext(defaultValue) {
|
|
1295
|
-
// TODO: Second argument used to be an optional `calculateChangedBits`
|
|
1296
|
-
// function. Warn to reserve for future use?
|
|
1297
|
-
var context = {
|
|
1298
|
-
$$typeof: REACT_CONTEXT_TYPE,
|
|
1299
|
-
// As a workaround to support multiple concurrent renderers, we categorize
|
|
1300
|
-
// some renderers as primary and others as secondary. We only expect
|
|
1301
|
-
// there to be two concurrent renderers at most: React Native (primary) and
|
|
1302
|
-
// Fabric (secondary); React DOM (primary) and React ART (secondary).
|
|
1303
|
-
// Secondary renderers store their context values on separate fields.
|
|
1304
|
-
_currentValue: defaultValue,
|
|
1305
|
-
_currentValue2: defaultValue,
|
|
1306
|
-
// Used to track how many concurrent renderers this context currently
|
|
1307
|
-
// supports within in a single renderer. Such as parallel server rendering.
|
|
1308
|
-
_threadCount: 0,
|
|
1309
|
-
// These are circular
|
|
1310
|
-
Provider: null,
|
|
1311
|
-
Consumer: null,
|
|
1312
|
-
// Add these to use same hidden class in VM as ServerContext
|
|
1313
|
-
_defaultValue: null,
|
|
1314
|
-
_globalName: null
|
|
1315
|
-
};
|
|
1316
|
-
context.Provider = {
|
|
1317
|
-
$$typeof: REACT_PROVIDER_TYPE,
|
|
1318
|
-
_context: context
|
|
1319
|
-
};
|
|
1320
|
-
var hasWarnedAboutUsingNestedContextConsumers = false;
|
|
1321
|
-
var hasWarnedAboutUsingConsumerProvider = false;
|
|
1322
|
-
var hasWarnedAboutDisplayNameOnConsumer = false;
|
|
1323
|
-
|
|
1324
|
-
{
|
|
1325
|
-
// A separate object, but proxies back to the original context object for
|
|
1326
|
-
// backwards compatibility. It has a different $$typeof, so we can properly
|
|
1327
|
-
// warn for the incorrect usage of Context as a Consumer.
|
|
1328
|
-
var Consumer = {
|
|
1329
|
-
$$typeof: REACT_CONTEXT_TYPE,
|
|
1330
|
-
_context: context
|
|
1331
|
-
}; // $FlowFixMe: Flow complains about not setting a value, which is intentional here
|
|
1332
|
-
|
|
1333
|
-
Object.defineProperties(Consumer, {
|
|
1334
|
-
Provider: {
|
|
1335
|
-
get: function () {
|
|
1336
|
-
if (!hasWarnedAboutUsingConsumerProvider) {
|
|
1337
|
-
hasWarnedAboutUsingConsumerProvider = true;
|
|
1338
|
-
|
|
1339
|
-
error('Rendering <Context.Consumer.Provider> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Provider> instead?');
|
|
1340
|
-
}
|
|
1341
|
-
|
|
1342
|
-
return context.Provider;
|
|
1343
|
-
},
|
|
1344
|
-
set: function (_Provider) {
|
|
1345
|
-
context.Provider = _Provider;
|
|
1346
|
-
}
|
|
1347
|
-
},
|
|
1348
|
-
_currentValue: {
|
|
1349
|
-
get: function () {
|
|
1350
|
-
return context._currentValue;
|
|
1351
|
-
},
|
|
1352
|
-
set: function (_currentValue) {
|
|
1353
|
-
context._currentValue = _currentValue;
|
|
1354
|
-
}
|
|
1355
|
-
},
|
|
1356
|
-
_currentValue2: {
|
|
1357
|
-
get: function () {
|
|
1358
|
-
return context._currentValue2;
|
|
1359
|
-
},
|
|
1360
|
-
set: function (_currentValue2) {
|
|
1361
|
-
context._currentValue2 = _currentValue2;
|
|
1362
|
-
}
|
|
1363
|
-
},
|
|
1364
|
-
_threadCount: {
|
|
1365
|
-
get: function () {
|
|
1366
|
-
return context._threadCount;
|
|
1367
|
-
},
|
|
1368
|
-
set: function (_threadCount) {
|
|
1369
|
-
context._threadCount = _threadCount;
|
|
1370
|
-
}
|
|
1371
|
-
},
|
|
1372
|
-
Consumer: {
|
|
1373
|
-
get: function () {
|
|
1374
|
-
if (!hasWarnedAboutUsingNestedContextConsumers) {
|
|
1375
|
-
hasWarnedAboutUsingNestedContextConsumers = true;
|
|
1376
|
-
|
|
1377
|
-
error('Rendering <Context.Consumer.Consumer> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
|
|
1378
|
-
}
|
|
1379
|
-
|
|
1380
|
-
return context.Consumer;
|
|
1381
|
-
}
|
|
1382
|
-
},
|
|
1383
|
-
displayName: {
|
|
1384
|
-
get: function () {
|
|
1385
|
-
return context.displayName;
|
|
1386
|
-
},
|
|
1387
|
-
set: function (displayName) {
|
|
1388
|
-
if (!hasWarnedAboutDisplayNameOnConsumer) {
|
|
1389
|
-
warn('Setting `displayName` on Context.Consumer has no effect. ' + "You should set it directly on the context with Context.displayName = '%s'.", displayName);
|
|
1390
|
-
|
|
1391
|
-
hasWarnedAboutDisplayNameOnConsumer = true;
|
|
1392
|
-
}
|
|
1393
|
-
}
|
|
1394
|
-
}
|
|
1395
|
-
}); // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty
|
|
1396
|
-
|
|
1397
|
-
context.Consumer = Consumer;
|
|
1398
|
-
}
|
|
1399
|
-
|
|
1400
|
-
{
|
|
1401
|
-
context._currentRenderer = null;
|
|
1402
|
-
context._currentRenderer2 = null;
|
|
1403
|
-
}
|
|
1404
|
-
|
|
1405
|
-
return context;
|
|
1406
|
-
}
|
|
1407
|
-
|
|
1408
|
-
var Uninitialized = -1;
|
|
1409
|
-
var Pending = 0;
|
|
1410
|
-
var Resolved = 1;
|
|
1411
|
-
var Rejected = 2;
|
|
1412
|
-
|
|
1413
|
-
function lazyInitializer(payload) {
|
|
1414
|
-
if (payload._status === Uninitialized) {
|
|
1415
|
-
var ctor = payload._result;
|
|
1416
|
-
var thenable = ctor(); // Transition to the next state.
|
|
1417
|
-
// This might throw either because it's missing or throws. If so, we treat it
|
|
1418
|
-
// as still uninitialized and try again next time. Which is the same as what
|
|
1419
|
-
// happens if the ctor or any wrappers processing the ctor throws. This might
|
|
1420
|
-
// end up fixing it if the resolution was a concurrency bug.
|
|
1421
|
-
|
|
1422
|
-
thenable.then(function (moduleObject) {
|
|
1423
|
-
if (payload._status === Pending || payload._status === Uninitialized) {
|
|
1424
|
-
// Transition to the next state.
|
|
1425
|
-
var resolved = payload;
|
|
1426
|
-
resolved._status = Resolved;
|
|
1427
|
-
resolved._result = moduleObject;
|
|
1428
|
-
}
|
|
1429
|
-
}, function (error) {
|
|
1430
|
-
if (payload._status === Pending || payload._status === Uninitialized) {
|
|
1431
|
-
// Transition to the next state.
|
|
1432
|
-
var rejected = payload;
|
|
1433
|
-
rejected._status = Rejected;
|
|
1434
|
-
rejected._result = error;
|
|
1435
|
-
}
|
|
1436
|
-
});
|
|
1437
|
-
|
|
1438
|
-
if (payload._status === Uninitialized) {
|
|
1439
|
-
// In case, we're still uninitialized, then we're waiting for the thenable
|
|
1440
|
-
// to resolve. Set it as pending in the meantime.
|
|
1441
|
-
var pending = payload;
|
|
1442
|
-
pending._status = Pending;
|
|
1443
|
-
pending._result = thenable;
|
|
1444
|
-
}
|
|
1445
|
-
}
|
|
1446
|
-
|
|
1447
|
-
if (payload._status === Resolved) {
|
|
1448
|
-
var moduleObject = payload._result;
|
|
1449
|
-
|
|
1450
|
-
{
|
|
1451
|
-
if (moduleObject === undefined) {
|
|
1452
|
-
error('lazy: Expected the result of a dynamic imp' + 'ort() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + // Break up imports to avoid accidentally parsing them as dependencies.
|
|
1453
|
-
'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))\n\n" + 'Did you accidentally put curly braces around the import?', moduleObject);
|
|
1454
|
-
}
|
|
1455
|
-
}
|
|
1456
|
-
|
|
1457
|
-
{
|
|
1458
|
-
if (!('default' in moduleObject)) {
|
|
1459
|
-
error('lazy: Expected the result of a dynamic imp' + 'ort() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + // Break up imports to avoid accidentally parsing them as dependencies.
|
|
1460
|
-
'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))", moduleObject);
|
|
1461
|
-
}
|
|
1462
|
-
}
|
|
1463
|
-
|
|
1464
|
-
return moduleObject.default;
|
|
1465
|
-
} else {
|
|
1466
|
-
throw payload._result;
|
|
1467
|
-
}
|
|
1468
|
-
}
|
|
1469
|
-
|
|
1470
|
-
function lazy(ctor) {
|
|
1471
|
-
var payload = {
|
|
1472
|
-
// We use these fields to store the result.
|
|
1473
|
-
_status: Uninitialized,
|
|
1474
|
-
_result: ctor
|
|
1475
|
-
};
|
|
1476
|
-
var lazyType = {
|
|
1477
|
-
$$typeof: REACT_LAZY_TYPE,
|
|
1478
|
-
_payload: payload,
|
|
1479
|
-
_init: lazyInitializer
|
|
1480
|
-
};
|
|
1481
|
-
|
|
1482
|
-
{
|
|
1483
|
-
// In production, this would just set it on the object.
|
|
1484
|
-
var defaultProps;
|
|
1485
|
-
var propTypes; // $FlowFixMe
|
|
1486
|
-
|
|
1487
|
-
Object.defineProperties(lazyType, {
|
|
1488
|
-
defaultProps: {
|
|
1489
|
-
configurable: true,
|
|
1490
|
-
get: function () {
|
|
1491
|
-
return defaultProps;
|
|
1492
|
-
},
|
|
1493
|
-
set: function (newDefaultProps) {
|
|
1494
|
-
error('React.lazy(...): It is not supported to assign `defaultProps` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
|
|
1495
|
-
|
|
1496
|
-
defaultProps = newDefaultProps; // Match production behavior more closely:
|
|
1497
|
-
// $FlowFixMe
|
|
1498
|
-
|
|
1499
|
-
Object.defineProperty(lazyType, 'defaultProps', {
|
|
1500
|
-
enumerable: true
|
|
1501
|
-
});
|
|
1502
|
-
}
|
|
1503
|
-
},
|
|
1504
|
-
propTypes: {
|
|
1505
|
-
configurable: true,
|
|
1506
|
-
get: function () {
|
|
1507
|
-
return propTypes;
|
|
1508
|
-
},
|
|
1509
|
-
set: function (newPropTypes) {
|
|
1510
|
-
error('React.lazy(...): It is not supported to assign `propTypes` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
|
|
1511
|
-
|
|
1512
|
-
propTypes = newPropTypes; // Match production behavior more closely:
|
|
1513
|
-
// $FlowFixMe
|
|
1514
|
-
|
|
1515
|
-
Object.defineProperty(lazyType, 'propTypes', {
|
|
1516
|
-
enumerable: true
|
|
1517
|
-
});
|
|
1518
|
-
}
|
|
1519
|
-
}
|
|
1520
|
-
});
|
|
1521
|
-
}
|
|
1522
|
-
|
|
1523
|
-
return lazyType;
|
|
1524
|
-
}
|
|
1525
|
-
|
|
1526
|
-
function forwardRef(render) {
|
|
1527
|
-
{
|
|
1528
|
-
if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
|
|
1529
|
-
error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
|
|
1530
|
-
} else if (typeof render !== 'function') {
|
|
1531
|
-
error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
|
|
1532
|
-
} else {
|
|
1533
|
-
if (render.length !== 0 && render.length !== 2) {
|
|
1534
|
-
error('forwardRef render functions accept exactly two parameters: props and ref. %s', render.length === 1 ? 'Did you forget to use the ref parameter?' : 'Any additional parameter will be undefined.');
|
|
1535
|
-
}
|
|
1536
|
-
}
|
|
1537
|
-
|
|
1538
|
-
if (render != null) {
|
|
1539
|
-
if (render.defaultProps != null || render.propTypes != null) {
|
|
1540
|
-
error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?');
|
|
1541
|
-
}
|
|
1542
|
-
}
|
|
1543
|
-
}
|
|
1544
|
-
|
|
1545
|
-
var elementType = {
|
|
1546
|
-
$$typeof: REACT_FORWARD_REF_TYPE,
|
|
1547
|
-
render: render
|
|
1548
|
-
};
|
|
1549
|
-
|
|
1550
|
-
{
|
|
1551
|
-
var ownName;
|
|
1552
|
-
Object.defineProperty(elementType, 'displayName', {
|
|
1553
|
-
enumerable: false,
|
|
1554
|
-
configurable: true,
|
|
1555
|
-
get: function () {
|
|
1556
|
-
return ownName;
|
|
1557
|
-
},
|
|
1558
|
-
set: function (name) {
|
|
1559
|
-
ownName = name; // The inner component shouldn't inherit this display name in most cases,
|
|
1560
|
-
// because the component may be used elsewhere.
|
|
1561
|
-
// But it's nice for anonymous functions to inherit the name,
|
|
1562
|
-
// so that our component-stack generation logic will display their frames.
|
|
1563
|
-
// An anonymous function generally suggests a pattern like:
|
|
1564
|
-
// React.forwardRef((props, ref) => {...});
|
|
1565
|
-
// This kind of inner function is not used elsewhere so the side effect is okay.
|
|
1566
|
-
|
|
1567
|
-
if (!render.name && !render.displayName) {
|
|
1568
|
-
render.displayName = name;
|
|
1569
|
-
}
|
|
1570
|
-
}
|
|
1571
|
-
});
|
|
1572
|
-
}
|
|
1573
|
-
|
|
1574
|
-
return elementType;
|
|
1575
|
-
}
|
|
1576
|
-
|
|
1577
|
-
var REACT_MODULE_REFERENCE;
|
|
1578
|
-
|
|
1579
|
-
{
|
|
1580
|
-
REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
|
|
1581
|
-
}
|
|
1582
|
-
|
|
1583
|
-
function isValidElementType(type) {
|
|
1584
|
-
if (typeof type === 'string' || typeof type === 'function') {
|
|
1585
|
-
return true;
|
|
1586
|
-
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {
|
|
1590
|
-
return true;
|
|
1591
|
-
}
|
|
1592
|
-
|
|
1593
|
-
if (typeof type === 'object' && type !== null) {
|
|
1594
|
-
if (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 || // This needs to include all possible module reference object
|
|
1595
|
-
// types supported by any Flight configuration anywhere since
|
|
1596
|
-
// we don't know which Flight build this will end up being used
|
|
1597
|
-
// with.
|
|
1598
|
-
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
|
|
1599
|
-
return true;
|
|
1600
|
-
}
|
|
1601
|
-
}
|
|
1602
|
-
|
|
1603
|
-
return false;
|
|
1604
|
-
}
|
|
1605
|
-
|
|
1606
|
-
function memo(type, compare) {
|
|
1607
|
-
{
|
|
1608
|
-
if (!isValidElementType(type)) {
|
|
1609
|
-
error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
|
|
1610
|
-
}
|
|
1611
|
-
}
|
|
1612
|
-
|
|
1613
|
-
var elementType = {
|
|
1614
|
-
$$typeof: REACT_MEMO_TYPE,
|
|
1615
|
-
type: type,
|
|
1616
|
-
compare: compare === undefined ? null : compare
|
|
1617
|
-
};
|
|
1618
|
-
|
|
1619
|
-
{
|
|
1620
|
-
var ownName;
|
|
1621
|
-
Object.defineProperty(elementType, 'displayName', {
|
|
1622
|
-
enumerable: false,
|
|
1623
|
-
configurable: true,
|
|
1624
|
-
get: function () {
|
|
1625
|
-
return ownName;
|
|
1626
|
-
},
|
|
1627
|
-
set: function (name) {
|
|
1628
|
-
ownName = name; // The inner component shouldn't inherit this display name in most cases,
|
|
1629
|
-
// because the component may be used elsewhere.
|
|
1630
|
-
// But it's nice for anonymous functions to inherit the name,
|
|
1631
|
-
// so that our component-stack generation logic will display their frames.
|
|
1632
|
-
// An anonymous function generally suggests a pattern like:
|
|
1633
|
-
// React.memo((props) => {...});
|
|
1634
|
-
// This kind of inner function is not used elsewhere so the side effect is okay.
|
|
1635
|
-
|
|
1636
|
-
if (!type.name && !type.displayName) {
|
|
1637
|
-
type.displayName = name;
|
|
1638
|
-
}
|
|
1639
|
-
}
|
|
1640
|
-
});
|
|
1641
|
-
}
|
|
1642
|
-
|
|
1643
|
-
return elementType;
|
|
1644
|
-
}
|
|
1645
|
-
|
|
1646
|
-
function resolveDispatcher() {
|
|
1647
|
-
var dispatcher = ReactCurrentDispatcher.current;
|
|
1648
|
-
|
|
1649
|
-
{
|
|
1650
|
-
if (dispatcher === null) {
|
|
1651
|
-
error('Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for' + ' one of the following reasons:\n' + '1. You might have mismatching versions of React and the renderer (such as React DOM)\n' + '2. You might be breaking the Rules of Hooks\n' + '3. You might have more than one copy of React in the same app\n' + 'See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.');
|
|
1652
|
-
}
|
|
1653
|
-
} // Will result in a null access error if accessed outside render phase. We
|
|
1654
|
-
// intentionally don't throw our own error because this is in a hot path.
|
|
1655
|
-
// Also helps ensure this is inlined.
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
return dispatcher;
|
|
1659
|
-
}
|
|
1660
|
-
function useContext(Context) {
|
|
1661
|
-
var dispatcher = resolveDispatcher();
|
|
1662
|
-
|
|
1663
|
-
{
|
|
1664
|
-
// TODO: add a more generic warning for invalid values.
|
|
1665
|
-
if (Context._context !== undefined) {
|
|
1666
|
-
var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs
|
|
1667
|
-
// and nobody should be using this in existing code.
|
|
1668
|
-
|
|
1669
|
-
if (realContext.Consumer === Context) {
|
|
1670
|
-
error('Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be ' + 'removed in a future major release. Did you mean to call useContext(Context) instead?');
|
|
1671
|
-
} else if (realContext.Provider === Context) {
|
|
1672
|
-
error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
|
|
1673
|
-
}
|
|
1674
|
-
}
|
|
1675
|
-
}
|
|
1676
|
-
|
|
1677
|
-
return dispatcher.useContext(Context);
|
|
1678
|
-
}
|
|
1679
|
-
function useState(initialState) {
|
|
1680
|
-
var dispatcher = resolveDispatcher();
|
|
1681
|
-
return dispatcher.useState(initialState);
|
|
1682
|
-
}
|
|
1683
|
-
function useReducer(reducer, initialArg, init) {
|
|
1684
|
-
var dispatcher = resolveDispatcher();
|
|
1685
|
-
return dispatcher.useReducer(reducer, initialArg, init);
|
|
1686
|
-
}
|
|
1687
|
-
function useRef(initialValue) {
|
|
1688
|
-
var dispatcher = resolveDispatcher();
|
|
1689
|
-
return dispatcher.useRef(initialValue);
|
|
1690
|
-
}
|
|
1691
|
-
function useEffect(create, deps) {
|
|
1692
|
-
var dispatcher = resolveDispatcher();
|
|
1693
|
-
return dispatcher.useEffect(create, deps);
|
|
1694
|
-
}
|
|
1695
|
-
function useInsertionEffect(create, deps) {
|
|
1696
|
-
var dispatcher = resolveDispatcher();
|
|
1697
|
-
return dispatcher.useInsertionEffect(create, deps);
|
|
1698
|
-
}
|
|
1699
|
-
function useLayoutEffect(create, deps) {
|
|
1700
|
-
var dispatcher = resolveDispatcher();
|
|
1701
|
-
return dispatcher.useLayoutEffect(create, deps);
|
|
1702
|
-
}
|
|
1703
|
-
function useCallback(callback, deps) {
|
|
1704
|
-
var dispatcher = resolveDispatcher();
|
|
1705
|
-
return dispatcher.useCallback(callback, deps);
|
|
1706
|
-
}
|
|
1707
|
-
function useMemo(create, deps) {
|
|
1708
|
-
var dispatcher = resolveDispatcher();
|
|
1709
|
-
return dispatcher.useMemo(create, deps);
|
|
1710
|
-
}
|
|
1711
|
-
function useImperativeHandle(ref, create, deps) {
|
|
1712
|
-
var dispatcher = resolveDispatcher();
|
|
1713
|
-
return dispatcher.useImperativeHandle(ref, create, deps);
|
|
1714
|
-
}
|
|
1715
|
-
function useDebugValue(value, formatterFn) {
|
|
1716
|
-
{
|
|
1717
|
-
var dispatcher = resolveDispatcher();
|
|
1718
|
-
return dispatcher.useDebugValue(value, formatterFn);
|
|
1719
|
-
}
|
|
1720
|
-
}
|
|
1721
|
-
function useTransition() {
|
|
1722
|
-
var dispatcher = resolveDispatcher();
|
|
1723
|
-
return dispatcher.useTransition();
|
|
1724
|
-
}
|
|
1725
|
-
function useDeferredValue(value) {
|
|
1726
|
-
var dispatcher = resolveDispatcher();
|
|
1727
|
-
return dispatcher.useDeferredValue(value);
|
|
1728
|
-
}
|
|
1729
|
-
function useId() {
|
|
1730
|
-
var dispatcher = resolveDispatcher();
|
|
1731
|
-
return dispatcher.useId();
|
|
1732
|
-
}
|
|
1733
|
-
function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
|
1734
|
-
var dispatcher = resolveDispatcher();
|
|
1735
|
-
return dispatcher.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
1736
|
-
}
|
|
1737
|
-
|
|
1738
|
-
// Helpers to patch console.logs to avoid logging during side-effect free
|
|
1739
|
-
// replaying on render function. This currently only patches the object
|
|
1740
|
-
// lazily which won't cover if the log function was extracted eagerly.
|
|
1741
|
-
// We could also eagerly patch the method.
|
|
1742
|
-
var disabledDepth = 0;
|
|
1743
|
-
var prevLog;
|
|
1744
|
-
var prevInfo;
|
|
1745
|
-
var prevWarn;
|
|
1746
|
-
var prevError;
|
|
1747
|
-
var prevGroup;
|
|
1748
|
-
var prevGroupCollapsed;
|
|
1749
|
-
var prevGroupEnd;
|
|
1750
|
-
|
|
1751
|
-
function disabledLog() {}
|
|
1752
|
-
|
|
1753
|
-
disabledLog.__reactDisabledLog = true;
|
|
1754
|
-
function disableLogs() {
|
|
1755
|
-
{
|
|
1756
|
-
if (disabledDepth === 0) {
|
|
1757
|
-
/* eslint-disable react-internal/no-production-logging */
|
|
1758
|
-
prevLog = console.log;
|
|
1759
|
-
prevInfo = console.info;
|
|
1760
|
-
prevWarn = console.warn;
|
|
1761
|
-
prevError = console.error;
|
|
1762
|
-
prevGroup = console.group;
|
|
1763
|
-
prevGroupCollapsed = console.groupCollapsed;
|
|
1764
|
-
prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
|
|
1765
|
-
|
|
1766
|
-
var props = {
|
|
1767
|
-
configurable: true,
|
|
1768
|
-
enumerable: true,
|
|
1769
|
-
value: disabledLog,
|
|
1770
|
-
writable: true
|
|
1771
|
-
}; // $FlowFixMe Flow thinks console is immutable.
|
|
1772
|
-
|
|
1773
|
-
Object.defineProperties(console, {
|
|
1774
|
-
info: props,
|
|
1775
|
-
log: props,
|
|
1776
|
-
warn: props,
|
|
1777
|
-
error: props,
|
|
1778
|
-
group: props,
|
|
1779
|
-
groupCollapsed: props,
|
|
1780
|
-
groupEnd: props
|
|
1781
|
-
});
|
|
1782
|
-
/* eslint-enable react-internal/no-production-logging */
|
|
1783
|
-
}
|
|
1784
|
-
|
|
1785
|
-
disabledDepth++;
|
|
1786
|
-
}
|
|
1787
|
-
}
|
|
1788
|
-
function reenableLogs() {
|
|
1789
|
-
{
|
|
1790
|
-
disabledDepth--;
|
|
1791
|
-
|
|
1792
|
-
if (disabledDepth === 0) {
|
|
1793
|
-
/* eslint-disable react-internal/no-production-logging */
|
|
1794
|
-
var props = {
|
|
1795
|
-
configurable: true,
|
|
1796
|
-
enumerable: true,
|
|
1797
|
-
writable: true
|
|
1798
|
-
}; // $FlowFixMe Flow thinks console is immutable.
|
|
1799
|
-
|
|
1800
|
-
Object.defineProperties(console, {
|
|
1801
|
-
log: assign({}, props, {
|
|
1802
|
-
value: prevLog
|
|
1803
|
-
}),
|
|
1804
|
-
info: assign({}, props, {
|
|
1805
|
-
value: prevInfo
|
|
1806
|
-
}),
|
|
1807
|
-
warn: assign({}, props, {
|
|
1808
|
-
value: prevWarn
|
|
1809
|
-
}),
|
|
1810
|
-
error: assign({}, props, {
|
|
1811
|
-
value: prevError
|
|
1812
|
-
}),
|
|
1813
|
-
group: assign({}, props, {
|
|
1814
|
-
value: prevGroup
|
|
1815
|
-
}),
|
|
1816
|
-
groupCollapsed: assign({}, props, {
|
|
1817
|
-
value: prevGroupCollapsed
|
|
1818
|
-
}),
|
|
1819
|
-
groupEnd: assign({}, props, {
|
|
1820
|
-
value: prevGroupEnd
|
|
1821
|
-
})
|
|
1822
|
-
});
|
|
1823
|
-
/* eslint-enable react-internal/no-production-logging */
|
|
1824
|
-
}
|
|
1825
|
-
|
|
1826
|
-
if (disabledDepth < 0) {
|
|
1827
|
-
error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
|
|
1828
|
-
}
|
|
1829
|
-
}
|
|
1830
|
-
}
|
|
1831
|
-
|
|
1832
|
-
var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
|
|
1833
|
-
var prefix;
|
|
1834
|
-
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
|
1835
|
-
{
|
|
1836
|
-
if (prefix === undefined) {
|
|
1837
|
-
// Extract the VM specific prefix used by each line.
|
|
1838
|
-
try {
|
|
1839
|
-
throw Error();
|
|
1840
|
-
} catch (x) {
|
|
1841
|
-
var match = x.stack.trim().match(/\n( *(at )?)/);
|
|
1842
|
-
prefix = match && match[1] || '';
|
|
1843
|
-
}
|
|
1844
|
-
} // We use the prefix to ensure our stacks line up with native stack frames.
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
return '\n' + prefix + name;
|
|
1848
|
-
}
|
|
1849
|
-
}
|
|
1850
|
-
var reentry = false;
|
|
1851
|
-
var componentFrameCache;
|
|
1852
|
-
|
|
1853
|
-
{
|
|
1854
|
-
var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
|
|
1855
|
-
componentFrameCache = new PossiblyWeakMap();
|
|
1856
|
-
}
|
|
1857
|
-
|
|
1858
|
-
function describeNativeComponentFrame(fn, construct) {
|
|
1859
|
-
// If something asked for a stack inside a fake render, it should get ignored.
|
|
1860
|
-
if ( !fn || reentry) {
|
|
1861
|
-
return '';
|
|
1862
|
-
}
|
|
1863
|
-
|
|
1864
|
-
{
|
|
1865
|
-
var frame = componentFrameCache.get(fn);
|
|
1866
|
-
|
|
1867
|
-
if (frame !== undefined) {
|
|
1868
|
-
return frame;
|
|
1869
|
-
}
|
|
1870
|
-
}
|
|
1871
|
-
|
|
1872
|
-
var control;
|
|
1873
|
-
reentry = true;
|
|
1874
|
-
var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
|
|
1875
|
-
|
|
1876
|
-
Error.prepareStackTrace = undefined;
|
|
1877
|
-
var previousDispatcher;
|
|
1878
|
-
|
|
1879
|
-
{
|
|
1880
|
-
previousDispatcher = ReactCurrentDispatcher$1.current; // Set the dispatcher in DEV because this might be call in the render function
|
|
1881
|
-
// for warnings.
|
|
1882
|
-
|
|
1883
|
-
ReactCurrentDispatcher$1.current = null;
|
|
1884
|
-
disableLogs();
|
|
1885
|
-
}
|
|
1886
|
-
|
|
1887
|
-
try {
|
|
1888
|
-
// This should throw.
|
|
1889
|
-
if (construct) {
|
|
1890
|
-
// Something should be setting the props in the constructor.
|
|
1891
|
-
var Fake = function () {
|
|
1892
|
-
throw Error();
|
|
1893
|
-
}; // $FlowFixMe
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
Object.defineProperty(Fake.prototype, 'props', {
|
|
1897
|
-
set: function () {
|
|
1898
|
-
// We use a throwing setter instead of frozen or non-writable props
|
|
1899
|
-
// because that won't throw in a non-strict mode function.
|
|
1900
|
-
throw Error();
|
|
1901
|
-
}
|
|
1902
|
-
});
|
|
1903
|
-
|
|
1904
|
-
if (typeof Reflect === 'object' && Reflect.construct) {
|
|
1905
|
-
// We construct a different control for this case to include any extra
|
|
1906
|
-
// frames added by the construct call.
|
|
1907
|
-
try {
|
|
1908
|
-
Reflect.construct(Fake, []);
|
|
1909
|
-
} catch (x) {
|
|
1910
|
-
control = x;
|
|
1911
|
-
}
|
|
1912
|
-
|
|
1913
|
-
Reflect.construct(fn, [], Fake);
|
|
1914
|
-
} else {
|
|
1915
|
-
try {
|
|
1916
|
-
Fake.call();
|
|
1917
|
-
} catch (x) {
|
|
1918
|
-
control = x;
|
|
1919
|
-
}
|
|
1920
|
-
|
|
1921
|
-
fn.call(Fake.prototype);
|
|
1922
|
-
}
|
|
1923
|
-
} else {
|
|
1924
|
-
try {
|
|
1925
|
-
throw Error();
|
|
1926
|
-
} catch (x) {
|
|
1927
|
-
control = x;
|
|
1928
|
-
}
|
|
1929
|
-
|
|
1930
|
-
fn();
|
|
1931
|
-
}
|
|
1932
|
-
} catch (sample) {
|
|
1933
|
-
// This is inlined manually because closure doesn't do it for us.
|
|
1934
|
-
if (sample && control && typeof sample.stack === 'string') {
|
|
1935
|
-
// This extracts the first frame from the sample that isn't also in the control.
|
|
1936
|
-
// Skipping one frame that we assume is the frame that calls the two.
|
|
1937
|
-
var sampleLines = sample.stack.split('\n');
|
|
1938
|
-
var controlLines = control.stack.split('\n');
|
|
1939
|
-
var s = sampleLines.length - 1;
|
|
1940
|
-
var c = controlLines.length - 1;
|
|
1941
|
-
|
|
1942
|
-
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
|
1943
|
-
// We expect at least one stack frame to be shared.
|
|
1944
|
-
// Typically this will be the root most one. However, stack frames may be
|
|
1945
|
-
// cut off due to maximum stack limits. In this case, one maybe cut off
|
|
1946
|
-
// earlier than the other. We assume that the sample is longer or the same
|
|
1947
|
-
// and there for cut off earlier. So we should find the root most frame in
|
|
1948
|
-
// the sample somewhere in the control.
|
|
1949
|
-
c--;
|
|
1950
|
-
}
|
|
1951
|
-
|
|
1952
|
-
for (; s >= 1 && c >= 0; s--, c--) {
|
|
1953
|
-
// Next we find the first one that isn't the same which should be the
|
|
1954
|
-
// frame that called our sample function and the control.
|
|
1955
|
-
if (sampleLines[s] !== controlLines[c]) {
|
|
1956
|
-
// In V8, the first line is describing the message but other VMs don't.
|
|
1957
|
-
// If we're about to return the first line, and the control is also on the same
|
|
1958
|
-
// line, that's a pretty good indicator that our sample threw at same line as
|
|
1959
|
-
// the control. I.e. before we entered the sample frame. So we ignore this result.
|
|
1960
|
-
// This can happen if you passed a class to function component, or non-function.
|
|
1961
|
-
if (s !== 1 || c !== 1) {
|
|
1962
|
-
do {
|
|
1963
|
-
s--;
|
|
1964
|
-
c--; // We may still have similar intermediate frames from the construct call.
|
|
1965
|
-
// The next one that isn't the same should be our match though.
|
|
1966
|
-
|
|
1967
|
-
if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
|
1968
|
-
// V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
|
|
1969
|
-
var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>"
|
|
1970
|
-
// but we have a user-provided "displayName"
|
|
1971
|
-
// splice it in to make the stack more readable.
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
if (fn.displayName && _frame.includes('<anonymous>')) {
|
|
1975
|
-
_frame = _frame.replace('<anonymous>', fn.displayName);
|
|
1976
|
-
}
|
|
1977
|
-
|
|
1978
|
-
{
|
|
1979
|
-
if (typeof fn === 'function') {
|
|
1980
|
-
componentFrameCache.set(fn, _frame);
|
|
1981
|
-
}
|
|
1982
|
-
} // Return the line we found.
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
return _frame;
|
|
1986
|
-
}
|
|
1987
|
-
} while (s >= 1 && c >= 0);
|
|
1988
|
-
}
|
|
1989
|
-
|
|
1990
|
-
break;
|
|
1991
|
-
}
|
|
1992
|
-
}
|
|
1993
|
-
}
|
|
1994
|
-
} finally {
|
|
1995
|
-
reentry = false;
|
|
1996
|
-
|
|
1997
|
-
{
|
|
1998
|
-
ReactCurrentDispatcher$1.current = previousDispatcher;
|
|
1999
|
-
reenableLogs();
|
|
2000
|
-
}
|
|
2001
|
-
|
|
2002
|
-
Error.prepareStackTrace = previousPrepareStackTrace;
|
|
2003
|
-
} // Fallback to just using the name if we couldn't make it throw.
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
var name = fn ? fn.displayName || fn.name : '';
|
|
2007
|
-
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
|
|
2008
|
-
|
|
2009
|
-
{
|
|
2010
|
-
if (typeof fn === 'function') {
|
|
2011
|
-
componentFrameCache.set(fn, syntheticFrame);
|
|
2012
|
-
}
|
|
2013
|
-
}
|
|
2014
|
-
|
|
2015
|
-
return syntheticFrame;
|
|
2016
|
-
}
|
|
2017
|
-
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
|
2018
|
-
{
|
|
2019
|
-
return describeNativeComponentFrame(fn, false);
|
|
2020
|
-
}
|
|
2021
|
-
}
|
|
2022
|
-
|
|
2023
|
-
function shouldConstruct(Component) {
|
|
2024
|
-
var prototype = Component.prototype;
|
|
2025
|
-
return !!(prototype && prototype.isReactComponent);
|
|
2026
|
-
}
|
|
2027
|
-
|
|
2028
|
-
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
|
2029
|
-
|
|
2030
|
-
if (type == null) {
|
|
2031
|
-
return '';
|
|
2032
|
-
}
|
|
2033
|
-
|
|
2034
|
-
if (typeof type === 'function') {
|
|
2035
|
-
{
|
|
2036
|
-
return describeNativeComponentFrame(type, shouldConstruct(type));
|
|
2037
|
-
}
|
|
2038
|
-
}
|
|
2039
|
-
|
|
2040
|
-
if (typeof type === 'string') {
|
|
2041
|
-
return describeBuiltInComponentFrame(type);
|
|
2042
|
-
}
|
|
2043
|
-
|
|
2044
|
-
switch (type) {
|
|
2045
|
-
case REACT_SUSPENSE_TYPE:
|
|
2046
|
-
return describeBuiltInComponentFrame('Suspense');
|
|
2047
|
-
|
|
2048
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
2049
|
-
return describeBuiltInComponentFrame('SuspenseList');
|
|
2050
|
-
}
|
|
2051
|
-
|
|
2052
|
-
if (typeof type === 'object') {
|
|
2053
|
-
switch (type.$$typeof) {
|
|
2054
|
-
case REACT_FORWARD_REF_TYPE:
|
|
2055
|
-
return describeFunctionComponentFrame(type.render);
|
|
2056
|
-
|
|
2057
|
-
case REACT_MEMO_TYPE:
|
|
2058
|
-
// Memo may contain any component type so we recursively resolve it.
|
|
2059
|
-
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
|
2060
|
-
|
|
2061
|
-
case REACT_LAZY_TYPE:
|
|
2062
|
-
{
|
|
2063
|
-
var lazyComponent = type;
|
|
2064
|
-
var payload = lazyComponent._payload;
|
|
2065
|
-
var init = lazyComponent._init;
|
|
2066
|
-
|
|
2067
|
-
try {
|
|
2068
|
-
// Lazy may contain any component type so we recursively resolve it.
|
|
2069
|
-
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
|
2070
|
-
} catch (x) {}
|
|
2071
|
-
}
|
|
2072
|
-
}
|
|
2073
|
-
}
|
|
2074
|
-
|
|
2075
|
-
return '';
|
|
2076
|
-
}
|
|
2077
|
-
|
|
2078
|
-
var loggedTypeFailures = {};
|
|
2079
|
-
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
2080
|
-
|
|
2081
|
-
function setCurrentlyValidatingElement(element) {
|
|
2082
|
-
{
|
|
2083
|
-
if (element) {
|
|
2084
|
-
var owner = element._owner;
|
|
2085
|
-
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
2086
|
-
ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
|
|
2087
|
-
} else {
|
|
2088
|
-
ReactDebugCurrentFrame$1.setExtraStackFrame(null);
|
|
2089
|
-
}
|
|
2090
|
-
}
|
|
2091
|
-
}
|
|
2092
|
-
|
|
2093
|
-
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
|
2094
|
-
{
|
|
2095
|
-
// $FlowFixMe This is okay but Flow doesn't know it.
|
|
2096
|
-
var has = Function.call.bind(hasOwnProperty);
|
|
2097
|
-
|
|
2098
|
-
for (var typeSpecName in typeSpecs) {
|
|
2099
|
-
if (has(typeSpecs, typeSpecName)) {
|
|
2100
|
-
var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
|
|
2101
|
-
// fail the render phase where it didn't fail before. So we log it.
|
|
2102
|
-
// After these have been cleaned up, we'll let them throw.
|
|
2103
|
-
|
|
2104
|
-
try {
|
|
2105
|
-
// This is intentionally an invariant that gets caught. It's the same
|
|
2106
|
-
// behavior as without this statement except with a better message.
|
|
2107
|
-
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
2108
|
-
// eslint-disable-next-line react-internal/prod-error-codes
|
|
2109
|
-
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`.');
|
|
2110
|
-
err.name = 'Invariant Violation';
|
|
2111
|
-
throw err;
|
|
2112
|
-
}
|
|
2113
|
-
|
|
2114
|
-
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
|
|
2115
|
-
} catch (ex) {
|
|
2116
|
-
error$1 = ex;
|
|
2117
|
-
}
|
|
2118
|
-
|
|
2119
|
-
if (error$1 && !(error$1 instanceof Error)) {
|
|
2120
|
-
setCurrentlyValidatingElement(element);
|
|
2121
|
-
|
|
2122
|
-
error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);
|
|
2123
|
-
|
|
2124
|
-
setCurrentlyValidatingElement(null);
|
|
2125
|
-
}
|
|
2126
|
-
|
|
2127
|
-
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
|
2128
|
-
// Only monitor this failure once because there tends to be a lot of the
|
|
2129
|
-
// same error.
|
|
2130
|
-
loggedTypeFailures[error$1.message] = true;
|
|
2131
|
-
setCurrentlyValidatingElement(element);
|
|
2132
|
-
|
|
2133
|
-
error('Failed %s type: %s', location, error$1.message);
|
|
2134
|
-
|
|
2135
|
-
setCurrentlyValidatingElement(null);
|
|
2136
|
-
}
|
|
2137
|
-
}
|
|
2138
|
-
}
|
|
2139
|
-
}
|
|
2140
|
-
}
|
|
2141
|
-
|
|
2142
|
-
function setCurrentlyValidatingElement$1(element) {
|
|
2143
|
-
{
|
|
2144
|
-
if (element) {
|
|
2145
|
-
var owner = element._owner;
|
|
2146
|
-
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
2147
|
-
setExtraStackFrame(stack);
|
|
2148
|
-
} else {
|
|
2149
|
-
setExtraStackFrame(null);
|
|
2150
|
-
}
|
|
2151
|
-
}
|
|
2152
|
-
}
|
|
2153
|
-
|
|
2154
|
-
var propTypesMisspellWarningShown;
|
|
2155
|
-
|
|
2156
|
-
{
|
|
2157
|
-
propTypesMisspellWarningShown = false;
|
|
2158
|
-
}
|
|
2159
|
-
|
|
2160
|
-
function getDeclarationErrorAddendum() {
|
|
2161
|
-
if (ReactCurrentOwner.current) {
|
|
2162
|
-
var name = getComponentNameFromType(ReactCurrentOwner.current.type);
|
|
2163
|
-
|
|
2164
|
-
if (name) {
|
|
2165
|
-
return '\n\nCheck the render method of `' + name + '`.';
|
|
2166
|
-
}
|
|
2167
|
-
}
|
|
2168
|
-
|
|
2169
|
-
return '';
|
|
2170
|
-
}
|
|
2171
|
-
|
|
2172
|
-
function getSourceInfoErrorAddendum(source) {
|
|
2173
|
-
if (source !== undefined) {
|
|
2174
|
-
var fileName = source.fileName.replace(/^.*[\\\/]/, '');
|
|
2175
|
-
var lineNumber = source.lineNumber;
|
|
2176
|
-
return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
|
|
2177
|
-
}
|
|
2178
|
-
|
|
2179
|
-
return '';
|
|
2180
|
-
}
|
|
2181
|
-
|
|
2182
|
-
function getSourceInfoErrorAddendumForProps(elementProps) {
|
|
2183
|
-
if (elementProps !== null && elementProps !== undefined) {
|
|
2184
|
-
return getSourceInfoErrorAddendum(elementProps.__source);
|
|
2185
|
-
}
|
|
2186
|
-
|
|
2187
|
-
return '';
|
|
2188
|
-
}
|
|
2189
|
-
/**
|
|
2190
|
-
* Warn if there's no key explicitly set on dynamic arrays of children or
|
|
2191
|
-
* object keys are not valid. This allows us to keep track of children between
|
|
2192
|
-
* updates.
|
|
2193
|
-
*/
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
var ownerHasKeyUseWarning = {};
|
|
2197
|
-
|
|
2198
|
-
function getCurrentComponentErrorInfo(parentType) {
|
|
2199
|
-
var info = getDeclarationErrorAddendum();
|
|
2200
|
-
|
|
2201
|
-
if (!info) {
|
|
2202
|
-
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
|
2203
|
-
|
|
2204
|
-
if (parentName) {
|
|
2205
|
-
info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
|
2206
|
-
}
|
|
2207
|
-
}
|
|
2208
|
-
|
|
2209
|
-
return info;
|
|
2210
|
-
}
|
|
2211
|
-
/**
|
|
2212
|
-
* Warn if the element doesn't have an explicit key assigned to it.
|
|
2213
|
-
* This element is in an array. The array could grow and shrink or be
|
|
2214
|
-
* reordered. All children that haven't already been validated are required to
|
|
2215
|
-
* have a "key" property assigned to it. Error statuses are cached so a warning
|
|
2216
|
-
* will only be shown once.
|
|
2217
|
-
*
|
|
2218
|
-
* @internal
|
|
2219
|
-
* @param {ReactElement} element Element that requires a key.
|
|
2220
|
-
* @param {*} parentType element's parent's type.
|
|
2221
|
-
*/
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
function validateExplicitKey(element, parentType) {
|
|
2225
|
-
if (!element._store || element._store.validated || element.key != null) {
|
|
2226
|
-
return;
|
|
2227
|
-
}
|
|
2228
|
-
|
|
2229
|
-
element._store.validated = true;
|
|
2230
|
-
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
2231
|
-
|
|
2232
|
-
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
|
2233
|
-
return;
|
|
2234
|
-
}
|
|
2235
|
-
|
|
2236
|
-
ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
|
|
2237
|
-
// property, it may be the creator of the child that's responsible for
|
|
2238
|
-
// assigning it a key.
|
|
2239
|
-
|
|
2240
|
-
var childOwner = '';
|
|
2241
|
-
|
|
2242
|
-
if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
|
|
2243
|
-
// Give the component that originally created this child.
|
|
2244
|
-
childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
|
|
2245
|
-
}
|
|
2246
|
-
|
|
2247
|
-
{
|
|
2248
|
-
setCurrentlyValidatingElement$1(element);
|
|
2249
|
-
|
|
2250
|
-
error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
|
|
2251
|
-
|
|
2252
|
-
setCurrentlyValidatingElement$1(null);
|
|
2253
|
-
}
|
|
2254
|
-
}
|
|
2255
|
-
/**
|
|
2256
|
-
* Ensure that every element either is passed in a static location, in an
|
|
2257
|
-
* array with an explicit keys property defined, or in an object literal
|
|
2258
|
-
* with valid key property.
|
|
2259
|
-
*
|
|
2260
|
-
* @internal
|
|
2261
|
-
* @param {ReactNode} node Statically passed child of any type.
|
|
2262
|
-
* @param {*} parentType node's parent's type.
|
|
2263
|
-
*/
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
function validateChildKeys(node, parentType) {
|
|
2267
|
-
if (typeof node !== 'object') {
|
|
2268
|
-
return;
|
|
2269
|
-
}
|
|
2270
|
-
|
|
2271
|
-
if (isArray(node)) {
|
|
2272
|
-
for (var i = 0; i < node.length; i++) {
|
|
2273
|
-
var child = node[i];
|
|
2274
|
-
|
|
2275
|
-
if (isValidElement(child)) {
|
|
2276
|
-
validateExplicitKey(child, parentType);
|
|
2277
|
-
}
|
|
2278
|
-
}
|
|
2279
|
-
} else if (isValidElement(node)) {
|
|
2280
|
-
// This element was passed in a valid location.
|
|
2281
|
-
if (node._store) {
|
|
2282
|
-
node._store.validated = true;
|
|
2283
|
-
}
|
|
2284
|
-
} else if (node) {
|
|
2285
|
-
var iteratorFn = getIteratorFn(node);
|
|
2286
|
-
|
|
2287
|
-
if (typeof iteratorFn === 'function') {
|
|
2288
|
-
// Entry iterators used to provide implicit keys,
|
|
2289
|
-
// but now we print a separate warning for them later.
|
|
2290
|
-
if (iteratorFn !== node.entries) {
|
|
2291
|
-
var iterator = iteratorFn.call(node);
|
|
2292
|
-
var step;
|
|
2293
|
-
|
|
2294
|
-
while (!(step = iterator.next()).done) {
|
|
2295
|
-
if (isValidElement(step.value)) {
|
|
2296
|
-
validateExplicitKey(step.value, parentType);
|
|
2297
|
-
}
|
|
2298
|
-
}
|
|
2299
|
-
}
|
|
2300
|
-
}
|
|
2301
|
-
}
|
|
2302
|
-
}
|
|
2303
|
-
/**
|
|
2304
|
-
* Given an element, validate that its props follow the propTypes definition,
|
|
2305
|
-
* provided by the type.
|
|
2306
|
-
*
|
|
2307
|
-
* @param {ReactElement} element
|
|
2308
|
-
*/
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
function validatePropTypes(element) {
|
|
2312
|
-
{
|
|
2313
|
-
var type = element.type;
|
|
2314
|
-
|
|
2315
|
-
if (type === null || type === undefined || typeof type === 'string') {
|
|
2316
|
-
return;
|
|
2317
|
-
}
|
|
2318
|
-
|
|
2319
|
-
var propTypes;
|
|
2320
|
-
|
|
2321
|
-
if (typeof type === 'function') {
|
|
2322
|
-
propTypes = type.propTypes;
|
|
2323
|
-
} else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
|
|
2324
|
-
// Inner props are checked in the reconciler.
|
|
2325
|
-
type.$$typeof === REACT_MEMO_TYPE)) {
|
|
2326
|
-
propTypes = type.propTypes;
|
|
2327
|
-
} else {
|
|
2328
|
-
return;
|
|
2329
|
-
}
|
|
2330
|
-
|
|
2331
|
-
if (propTypes) {
|
|
2332
|
-
// Intentionally inside to avoid triggering lazy initializers:
|
|
2333
|
-
var name = getComponentNameFromType(type);
|
|
2334
|
-
checkPropTypes(propTypes, element.props, 'prop', name, element);
|
|
2335
|
-
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
|
2336
|
-
propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
|
|
2337
|
-
|
|
2338
|
-
var _name = getComponentNameFromType(type);
|
|
2339
|
-
|
|
2340
|
-
error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
|
|
2341
|
-
}
|
|
2342
|
-
|
|
2343
|
-
if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
|
|
2344
|
-
error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
|
2345
|
-
}
|
|
2346
|
-
}
|
|
2347
|
-
}
|
|
2348
|
-
/**
|
|
2349
|
-
* Given a fragment, validate that it can only be provided with fragment props
|
|
2350
|
-
* @param {ReactElement} fragment
|
|
2351
|
-
*/
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
function validateFragmentProps(fragment) {
|
|
2355
|
-
{
|
|
2356
|
-
var keys = Object.keys(fragment.props);
|
|
2357
|
-
|
|
2358
|
-
for (var i = 0; i < keys.length; i++) {
|
|
2359
|
-
var key = keys[i];
|
|
2360
|
-
|
|
2361
|
-
if (key !== 'children' && key !== 'key') {
|
|
2362
|
-
setCurrentlyValidatingElement$1(fragment);
|
|
2363
|
-
|
|
2364
|
-
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
|
2365
|
-
|
|
2366
|
-
setCurrentlyValidatingElement$1(null);
|
|
2367
|
-
break;
|
|
2368
|
-
}
|
|
2369
|
-
}
|
|
2370
|
-
|
|
2371
|
-
if (fragment.ref !== null) {
|
|
2372
|
-
setCurrentlyValidatingElement$1(fragment);
|
|
2373
|
-
|
|
2374
|
-
error('Invalid attribute `ref` supplied to `React.Fragment`.');
|
|
2375
|
-
|
|
2376
|
-
setCurrentlyValidatingElement$1(null);
|
|
2377
|
-
}
|
|
2378
|
-
}
|
|
2379
|
-
}
|
|
2380
|
-
function createElementWithValidation(type, props, children) {
|
|
2381
|
-
var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
|
|
2382
|
-
// succeed and there will likely be errors in render.
|
|
2383
|
-
|
|
2384
|
-
if (!validType) {
|
|
2385
|
-
var info = '';
|
|
2386
|
-
|
|
2387
|
-
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
|
2388
|
-
info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
|
|
2389
|
-
}
|
|
2390
|
-
|
|
2391
|
-
var sourceInfo = getSourceInfoErrorAddendumForProps(props);
|
|
2392
|
-
|
|
2393
|
-
if (sourceInfo) {
|
|
2394
|
-
info += sourceInfo;
|
|
2395
|
-
} else {
|
|
2396
|
-
info += getDeclarationErrorAddendum();
|
|
2397
|
-
}
|
|
2398
|
-
|
|
2399
|
-
var typeString;
|
|
2400
|
-
|
|
2401
|
-
if (type === null) {
|
|
2402
|
-
typeString = 'null';
|
|
2403
|
-
} else if (isArray(type)) {
|
|
2404
|
-
typeString = 'array';
|
|
2405
|
-
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
2406
|
-
typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
|
|
2407
|
-
info = ' Did you accidentally export a JSX literal instead of a component?';
|
|
2408
|
-
} else {
|
|
2409
|
-
typeString = typeof type;
|
|
2410
|
-
}
|
|
2411
|
-
|
|
2412
|
-
{
|
|
2413
|
-
error('React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
|
|
2414
|
-
}
|
|
2415
|
-
}
|
|
2416
|
-
|
|
2417
|
-
var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used.
|
|
2418
|
-
// TODO: Drop this when these are no longer allowed as the type argument.
|
|
2419
|
-
|
|
2420
|
-
if (element == null) {
|
|
2421
|
-
return element;
|
|
2422
|
-
} // Skip key warning if the type isn't valid since our key validation logic
|
|
2423
|
-
// doesn't expect a non-string/function type and can throw confusing errors.
|
|
2424
|
-
// We don't want exception behavior to differ between dev and prod.
|
|
2425
|
-
// (Rendering will throw with a helpful message and as soon as the type is
|
|
2426
|
-
// fixed, the key warnings will appear.)
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
if (validType) {
|
|
2430
|
-
for (var i = 2; i < arguments.length; i++) {
|
|
2431
|
-
validateChildKeys(arguments[i], type);
|
|
2432
|
-
}
|
|
2433
|
-
}
|
|
2434
|
-
|
|
2435
|
-
if (type === REACT_FRAGMENT_TYPE) {
|
|
2436
|
-
validateFragmentProps(element);
|
|
2437
|
-
} else {
|
|
2438
|
-
validatePropTypes(element);
|
|
2439
|
-
}
|
|
2440
|
-
|
|
2441
|
-
return element;
|
|
2442
|
-
}
|
|
2443
|
-
var didWarnAboutDeprecatedCreateFactory = false;
|
|
2444
|
-
function createFactoryWithValidation(type) {
|
|
2445
|
-
var validatedFactory = createElementWithValidation.bind(null, type);
|
|
2446
|
-
validatedFactory.type = type;
|
|
2447
|
-
|
|
2448
|
-
{
|
|
2449
|
-
if (!didWarnAboutDeprecatedCreateFactory) {
|
|
2450
|
-
didWarnAboutDeprecatedCreateFactory = true;
|
|
2451
|
-
|
|
2452
|
-
warn('React.createFactory() is deprecated and will be removed in ' + 'a future major release. Consider using JSX ' + 'or use React.createElement() directly instead.');
|
|
2453
|
-
} // Legacy hook: remove it
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
Object.defineProperty(validatedFactory, 'type', {
|
|
2457
|
-
enumerable: false,
|
|
2458
|
-
get: function () {
|
|
2459
|
-
warn('Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
|
|
2460
|
-
|
|
2461
|
-
Object.defineProperty(this, 'type', {
|
|
2462
|
-
value: type
|
|
2463
|
-
});
|
|
2464
|
-
return type;
|
|
2465
|
-
}
|
|
2466
|
-
});
|
|
2467
|
-
}
|
|
2468
|
-
|
|
2469
|
-
return validatedFactory;
|
|
2470
|
-
}
|
|
2471
|
-
function cloneElementWithValidation(element, props, children) {
|
|
2472
|
-
var newElement = cloneElement.apply(this, arguments);
|
|
2473
|
-
|
|
2474
|
-
for (var i = 2; i < arguments.length; i++) {
|
|
2475
|
-
validateChildKeys(arguments[i], newElement.type);
|
|
2476
|
-
}
|
|
2477
|
-
|
|
2478
|
-
validatePropTypes(newElement);
|
|
2479
|
-
return newElement;
|
|
2480
|
-
}
|
|
2481
|
-
|
|
2482
|
-
function startTransition(scope, options) {
|
|
2483
|
-
var prevTransition = ReactCurrentBatchConfig.transition;
|
|
2484
|
-
ReactCurrentBatchConfig.transition = {};
|
|
2485
|
-
var currentTransition = ReactCurrentBatchConfig.transition;
|
|
2486
|
-
|
|
2487
|
-
{
|
|
2488
|
-
ReactCurrentBatchConfig.transition._updatedFibers = new Set();
|
|
2489
|
-
}
|
|
2490
|
-
|
|
2491
|
-
try {
|
|
2492
|
-
scope();
|
|
2493
|
-
} finally {
|
|
2494
|
-
ReactCurrentBatchConfig.transition = prevTransition;
|
|
2495
|
-
|
|
2496
|
-
{
|
|
2497
|
-
if (prevTransition === null && currentTransition._updatedFibers) {
|
|
2498
|
-
var updatedFibersCount = currentTransition._updatedFibers.size;
|
|
2499
|
-
|
|
2500
|
-
if (updatedFibersCount > 10) {
|
|
2501
|
-
warn('Detected a large number of updates inside startTransition. ' + 'If this is due to a subscription please re-write it to use React provided hooks. ' + 'Otherwise concurrent mode guarantees are off the table.');
|
|
2502
|
-
}
|
|
2503
|
-
|
|
2504
|
-
currentTransition._updatedFibers.clear();
|
|
2505
|
-
}
|
|
2506
|
-
}
|
|
2507
|
-
}
|
|
2508
|
-
}
|
|
2509
|
-
|
|
2510
|
-
var didWarnAboutMessageChannel = false;
|
|
2511
|
-
var enqueueTaskImpl = null;
|
|
2512
|
-
function enqueueTask(task) {
|
|
2513
|
-
if (enqueueTaskImpl === null) {
|
|
2514
|
-
try {
|
|
2515
|
-
// read require off the module object to get around the bundlers.
|
|
2516
|
-
// we don't want them to detect a require and bundle a Node polyfill.
|
|
2517
|
-
var requireString = ('require' + Math.random()).slice(0, 7);
|
|
2518
|
-
var nodeRequire = module && module[requireString]; // assuming we're in node, let's try to get node's
|
|
2519
|
-
// version of setImmediate, bypassing fake timers if any.
|
|
2520
|
-
|
|
2521
|
-
enqueueTaskImpl = nodeRequire.call(module, 'timers').setImmediate;
|
|
2522
|
-
} catch (_err) {
|
|
2523
|
-
// we're in a browser
|
|
2524
|
-
// we can't use regular timers because they may still be faked
|
|
2525
|
-
// so we try MessageChannel+postMessage instead
|
|
2526
|
-
enqueueTaskImpl = function (callback) {
|
|
2527
|
-
{
|
|
2528
|
-
if (didWarnAboutMessageChannel === false) {
|
|
2529
|
-
didWarnAboutMessageChannel = true;
|
|
2530
|
-
|
|
2531
|
-
if (typeof MessageChannel === 'undefined') {
|
|
2532
|
-
error('This browser does not have a MessageChannel implementation, ' + 'so enqueuing tasks via await act(async () => ...) will fail. ' + 'Please file an issue at https://github.com/facebook/react/issues ' + 'if you encounter this warning.');
|
|
2533
|
-
}
|
|
2534
|
-
}
|
|
2535
|
-
}
|
|
2536
|
-
|
|
2537
|
-
var channel = new MessageChannel();
|
|
2538
|
-
channel.port1.onmessage = callback;
|
|
2539
|
-
channel.port2.postMessage(undefined);
|
|
2540
|
-
};
|
|
2541
|
-
}
|
|
2542
|
-
}
|
|
2543
|
-
|
|
2544
|
-
return enqueueTaskImpl(task);
|
|
2545
|
-
}
|
|
2546
|
-
|
|
2547
|
-
var actScopeDepth = 0;
|
|
2548
|
-
var didWarnNoAwaitAct = false;
|
|
2549
|
-
function act(callback) {
|
|
2550
|
-
{
|
|
2551
|
-
// `act` calls can be nested, so we track the depth. This represents the
|
|
2552
|
-
// number of `act` scopes on the stack.
|
|
2553
|
-
var prevActScopeDepth = actScopeDepth;
|
|
2554
|
-
actScopeDepth++;
|
|
2555
|
-
|
|
2556
|
-
if (ReactCurrentActQueue.current === null) {
|
|
2557
|
-
// This is the outermost `act` scope. Initialize the queue. The reconciler
|
|
2558
|
-
// will detect the queue and use it instead of Scheduler.
|
|
2559
|
-
ReactCurrentActQueue.current = [];
|
|
2560
|
-
}
|
|
2561
|
-
|
|
2562
|
-
var prevIsBatchingLegacy = ReactCurrentActQueue.isBatchingLegacy;
|
|
2563
|
-
var result;
|
|
2564
|
-
|
|
2565
|
-
try {
|
|
2566
|
-
// Used to reproduce behavior of `batchedUpdates` in legacy mode. Only
|
|
2567
|
-
// set to `true` while the given callback is executed, not for updates
|
|
2568
|
-
// triggered during an async event, because this is how the legacy
|
|
2569
|
-
// implementation of `act` behaved.
|
|
2570
|
-
ReactCurrentActQueue.isBatchingLegacy = true;
|
|
2571
|
-
result = callback(); // Replicate behavior of original `act` implementation in legacy mode,
|
|
2572
|
-
// which flushed updates immediately after the scope function exits, even
|
|
2573
|
-
// if it's an async function.
|
|
2574
|
-
|
|
2575
|
-
if (!prevIsBatchingLegacy && ReactCurrentActQueue.didScheduleLegacyUpdate) {
|
|
2576
|
-
var queue = ReactCurrentActQueue.current;
|
|
2577
|
-
|
|
2578
|
-
if (queue !== null) {
|
|
2579
|
-
ReactCurrentActQueue.didScheduleLegacyUpdate = false;
|
|
2580
|
-
flushActQueue(queue);
|
|
2581
|
-
}
|
|
2582
|
-
}
|
|
2583
|
-
} catch (error) {
|
|
2584
|
-
popActScope(prevActScopeDepth);
|
|
2585
|
-
throw error;
|
|
2586
|
-
} finally {
|
|
2587
|
-
ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy;
|
|
2588
|
-
}
|
|
2589
|
-
|
|
2590
|
-
if (result !== null && typeof result === 'object' && typeof result.then === 'function') {
|
|
2591
|
-
var thenableResult = result; // The callback is an async function (i.e. returned a promise). Wait
|
|
2592
|
-
// for it to resolve before exiting the current scope.
|
|
2593
|
-
|
|
2594
|
-
var wasAwaited = false;
|
|
2595
|
-
var thenable = {
|
|
2596
|
-
then: function (resolve, reject) {
|
|
2597
|
-
wasAwaited = true;
|
|
2598
|
-
thenableResult.then(function (returnValue) {
|
|
2599
|
-
popActScope(prevActScopeDepth);
|
|
2600
|
-
|
|
2601
|
-
if (actScopeDepth === 0) {
|
|
2602
|
-
// We've exited the outermost act scope. Recursively flush the
|
|
2603
|
-
// queue until there's no remaining work.
|
|
2604
|
-
recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
|
2605
|
-
} else {
|
|
2606
|
-
resolve(returnValue);
|
|
2607
|
-
}
|
|
2608
|
-
}, function (error) {
|
|
2609
|
-
// The callback threw an error.
|
|
2610
|
-
popActScope(prevActScopeDepth);
|
|
2611
|
-
reject(error);
|
|
2612
|
-
});
|
|
2613
|
-
}
|
|
2614
|
-
};
|
|
2615
|
-
|
|
2616
|
-
{
|
|
2617
|
-
if (!didWarnNoAwaitAct && typeof Promise !== 'undefined') {
|
|
2618
|
-
// eslint-disable-next-line no-undef
|
|
2619
|
-
Promise.resolve().then(function () {}).then(function () {
|
|
2620
|
-
if (!wasAwaited) {
|
|
2621
|
-
didWarnNoAwaitAct = true;
|
|
2622
|
-
|
|
2623
|
-
error('You called act(async () => ...) without await. ' + 'This could lead to unexpected testing behaviour, ' + 'interleaving multiple act calls and mixing their ' + 'scopes. ' + 'You should - await act(async () => ...);');
|
|
2624
|
-
}
|
|
2625
|
-
});
|
|
2626
|
-
}
|
|
2627
|
-
}
|
|
2628
|
-
|
|
2629
|
-
return thenable;
|
|
2630
|
-
} else {
|
|
2631
|
-
var returnValue = result; // The callback is not an async function. Exit the current scope
|
|
2632
|
-
// immediately, without awaiting.
|
|
2633
|
-
|
|
2634
|
-
popActScope(prevActScopeDepth);
|
|
2635
|
-
|
|
2636
|
-
if (actScopeDepth === 0) {
|
|
2637
|
-
// Exiting the outermost act scope. Flush the queue.
|
|
2638
|
-
var _queue = ReactCurrentActQueue.current;
|
|
2639
|
-
|
|
2640
|
-
if (_queue !== null) {
|
|
2641
|
-
flushActQueue(_queue);
|
|
2642
|
-
ReactCurrentActQueue.current = null;
|
|
2643
|
-
} // Return a thenable. If the user awaits it, we'll flush again in
|
|
2644
|
-
// case additional work was scheduled by a microtask.
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
var _thenable = {
|
|
2648
|
-
then: function (resolve, reject) {
|
|
2649
|
-
// Confirm we haven't re-entered another `act` scope, in case
|
|
2650
|
-
// the user does something weird like await the thenable
|
|
2651
|
-
// multiple times.
|
|
2652
|
-
if (ReactCurrentActQueue.current === null) {
|
|
2653
|
-
// Recursively flush the queue until there's no remaining work.
|
|
2654
|
-
ReactCurrentActQueue.current = [];
|
|
2655
|
-
recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
|
2656
|
-
} else {
|
|
2657
|
-
resolve(returnValue);
|
|
2658
|
-
}
|
|
2659
|
-
}
|
|
2660
|
-
};
|
|
2661
|
-
return _thenable;
|
|
2662
|
-
} else {
|
|
2663
|
-
// Since we're inside a nested `act` scope, the returned thenable
|
|
2664
|
-
// immediately resolves. The outer scope will flush the queue.
|
|
2665
|
-
var _thenable2 = {
|
|
2666
|
-
then: function (resolve, reject) {
|
|
2667
|
-
resolve(returnValue);
|
|
2668
|
-
}
|
|
2669
|
-
};
|
|
2670
|
-
return _thenable2;
|
|
2671
|
-
}
|
|
2672
|
-
}
|
|
2673
|
-
}
|
|
2674
|
-
}
|
|
2675
|
-
|
|
2676
|
-
function popActScope(prevActScopeDepth) {
|
|
2677
|
-
{
|
|
2678
|
-
if (prevActScopeDepth !== actScopeDepth - 1) {
|
|
2679
|
-
error('You seem to have overlapping act() calls, this is not supported. ' + 'Be sure to await previous act() calls before making a new one. ');
|
|
2680
|
-
}
|
|
2681
|
-
|
|
2682
|
-
actScopeDepth = prevActScopeDepth;
|
|
2683
|
-
}
|
|
2684
|
-
}
|
|
2685
|
-
|
|
2686
|
-
function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
|
|
2687
|
-
{
|
|
2688
|
-
var queue = ReactCurrentActQueue.current;
|
|
2689
|
-
|
|
2690
|
-
if (queue !== null) {
|
|
2691
|
-
try {
|
|
2692
|
-
flushActQueue(queue);
|
|
2693
|
-
enqueueTask(function () {
|
|
2694
|
-
if (queue.length === 0) {
|
|
2695
|
-
// No additional work was scheduled. Finish.
|
|
2696
|
-
ReactCurrentActQueue.current = null;
|
|
2697
|
-
resolve(returnValue);
|
|
2698
|
-
} else {
|
|
2699
|
-
// Keep flushing work until there's none left.
|
|
2700
|
-
recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
|
2701
|
-
}
|
|
2702
|
-
});
|
|
2703
|
-
} catch (error) {
|
|
2704
|
-
reject(error);
|
|
2705
|
-
}
|
|
2706
|
-
} else {
|
|
2707
|
-
resolve(returnValue);
|
|
2708
|
-
}
|
|
2709
|
-
}
|
|
2710
|
-
}
|
|
2711
|
-
|
|
2712
|
-
var isFlushing = false;
|
|
2713
|
-
|
|
2714
|
-
function flushActQueue(queue) {
|
|
2715
|
-
{
|
|
2716
|
-
if (!isFlushing) {
|
|
2717
|
-
// Prevent re-entrance.
|
|
2718
|
-
isFlushing = true;
|
|
2719
|
-
var i = 0;
|
|
2720
|
-
|
|
2721
|
-
try {
|
|
2722
|
-
for (; i < queue.length; i++) {
|
|
2723
|
-
var callback = queue[i];
|
|
2724
|
-
|
|
2725
|
-
do {
|
|
2726
|
-
callback = callback(true);
|
|
2727
|
-
} while (callback !== null);
|
|
2728
|
-
}
|
|
2729
|
-
|
|
2730
|
-
queue.length = 0;
|
|
2731
|
-
} catch (error) {
|
|
2732
|
-
// If something throws, leave the remaining callbacks on the queue.
|
|
2733
|
-
queue = queue.slice(i + 1);
|
|
2734
|
-
throw error;
|
|
2735
|
-
} finally {
|
|
2736
|
-
isFlushing = false;
|
|
2737
|
-
}
|
|
2738
|
-
}
|
|
2739
|
-
}
|
|
2740
|
-
}
|
|
2741
|
-
|
|
2742
|
-
var createElement$1 = createElementWithValidation ;
|
|
2743
|
-
var cloneElement$1 = cloneElementWithValidation ;
|
|
2744
|
-
var createFactory = createFactoryWithValidation ;
|
|
2745
|
-
var Children = {
|
|
2746
|
-
map: mapChildren,
|
|
2747
|
-
forEach: forEachChildren,
|
|
2748
|
-
count: countChildren,
|
|
2749
|
-
toArray: toArray,
|
|
2750
|
-
only: onlyChild
|
|
2751
|
-
};
|
|
2752
|
-
|
|
2753
|
-
exports.Children = Children;
|
|
2754
|
-
exports.Component = Component;
|
|
2755
|
-
exports.Fragment = REACT_FRAGMENT_TYPE;
|
|
2756
|
-
exports.Profiler = REACT_PROFILER_TYPE;
|
|
2757
|
-
exports.PureComponent = PureComponent;
|
|
2758
|
-
exports.StrictMode = REACT_STRICT_MODE_TYPE;
|
|
2759
|
-
exports.Suspense = REACT_SUSPENSE_TYPE;
|
|
2760
|
-
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
|
|
2761
|
-
exports.cloneElement = cloneElement$1;
|
|
2762
|
-
exports.createContext = createContext;
|
|
2763
|
-
exports.createElement = createElement$1;
|
|
2764
|
-
exports.createFactory = createFactory;
|
|
2765
|
-
exports.createRef = createRef;
|
|
2766
|
-
exports.forwardRef = forwardRef;
|
|
2767
|
-
exports.isValidElement = isValidElement;
|
|
2768
|
-
exports.lazy = lazy;
|
|
2769
|
-
exports.memo = memo;
|
|
2770
|
-
exports.startTransition = startTransition;
|
|
2771
|
-
exports.unstable_act = act;
|
|
2772
|
-
exports.useCallback = useCallback;
|
|
2773
|
-
exports.useContext = useContext;
|
|
2774
|
-
exports.useDebugValue = useDebugValue;
|
|
2775
|
-
exports.useDeferredValue = useDeferredValue;
|
|
2776
|
-
exports.useEffect = useEffect;
|
|
2777
|
-
exports.useId = useId;
|
|
2778
|
-
exports.useImperativeHandle = useImperativeHandle;
|
|
2779
|
-
exports.useInsertionEffect = useInsertionEffect;
|
|
2780
|
-
exports.useLayoutEffect = useLayoutEffect;
|
|
2781
|
-
exports.useMemo = useMemo;
|
|
2782
|
-
exports.useReducer = useReducer;
|
|
2783
|
-
exports.useRef = useRef;
|
|
2784
|
-
exports.useState = useState;
|
|
2785
|
-
exports.useSyncExternalStore = useSyncExternalStore;
|
|
2786
|
-
exports.useTransition = useTransition;
|
|
2787
|
-
exports.version = ReactVersion;
|
|
2788
|
-
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
|
2789
|
-
if (
|
|
2790
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
|
2791
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===
|
|
2792
|
-
'function'
|
|
2793
|
-
) {
|
|
2794
|
-
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
2795
|
-
}
|
|
2796
|
-
|
|
2797
|
-
})();
|
|
2798
|
-
}
|
|
2799
|
-
} (react_development, react_development.exports));
|
|
2800
|
-
return react_development.exports;
|
|
2801
|
-
}
|
|
2802
|
-
|
|
2803
|
-
var hasRequiredReact;
|
|
2804
|
-
|
|
2805
|
-
function requireReact () {
|
|
2806
|
-
if (hasRequiredReact) return react.exports;
|
|
2807
|
-
hasRequiredReact = 1;
|
|
2808
|
-
|
|
2809
|
-
if (process.env.NODE_ENV === 'production') {
|
|
2810
|
-
react.exports = requireReact_production_min();
|
|
2811
|
-
} else {
|
|
2812
|
-
react.exports = requireReact_development();
|
|
2813
|
-
}
|
|
2814
|
-
return react.exports;
|
|
10
|
+
function _interopNamespace(e) {
|
|
11
|
+
if (e && e.__esModule) return e;
|
|
12
|
+
var n = Object.create(null);
|
|
13
|
+
if (e) {
|
|
14
|
+
Object.keys(e).forEach(function (k) {
|
|
15
|
+
if (k !== 'default') {
|
|
16
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
17
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return e[k]; }
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
n["default"] = e;
|
|
25
|
+
return Object.freeze(n);
|
|
2815
26
|
}
|
|
2816
27
|
|
|
2817
|
-
var
|
|
2818
|
-
var
|
|
28
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
29
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
30
|
+
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
2819
31
|
|
|
2820
32
|
function bind(fn, thisArg) {
|
|
2821
33
|
return function wrap() {
|
|
@@ -4097,10 +1309,10 @@ const hasStandardBrowserWebWorkerEnv = (() => {
|
|
|
4097
1309
|
})();
|
|
4098
1310
|
|
|
4099
1311
|
var utils = /*#__PURE__*/Object.freeze({
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
1312
|
+
__proto__: null,
|
|
1313
|
+
hasBrowserEnv: hasBrowserEnv,
|
|
1314
|
+
hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
|
|
1315
|
+
hasStandardBrowserEnv: hasStandardBrowserEnv
|
|
4104
1316
|
});
|
|
4105
1317
|
|
|
4106
1318
|
var platform = {
|
|
@@ -6074,7 +3286,7 @@ const whatType = ({
|
|
|
6074
3286
|
// const style=flexType(typeStyle,me,{},{})
|
|
6075
3287
|
// return 'type'
|
|
6076
3288
|
const typeStyle = typeof _typeStyle === 'function' ? _typeStyle?.bind(me)() : _typeStyle;
|
|
6077
|
-
return /*#__PURE__*/
|
|
3289
|
+
return /*#__PURE__*/React__default["default"].createElement(type, {
|
|
6078
3290
|
style: typeStyle
|
|
6079
3291
|
});
|
|
6080
3292
|
} else if (render) {
|
|
@@ -6225,9 +3437,9 @@ const StyledCover = styled__default["default"].div`
|
|
|
6225
3437
|
const Cover = ({
|
|
6226
3438
|
children
|
|
6227
3439
|
}) => {
|
|
6228
|
-
return /*#__PURE__*/
|
|
3440
|
+
return /*#__PURE__*/React__default["default"].createElement(StyledCover, null, children);
|
|
6229
3441
|
};
|
|
6230
|
-
class JRSubmit extends
|
|
3442
|
+
class JRSubmit extends React__default["default"].Component {
|
|
6231
3443
|
#methods = ['get', 'post', 'put', 'patch', 'delete', 'download'];
|
|
6232
3444
|
constructor(props) {
|
|
6233
3445
|
super(props);
|
|
@@ -6484,7 +3696,7 @@ class JRSubmit extends React.Component {
|
|
|
6484
3696
|
return;
|
|
6485
3697
|
}
|
|
6486
3698
|
render() {
|
|
6487
|
-
return this.props.cover != null && this.state?.lodaing ? /*#__PURE__*/
|
|
3699
|
+
return this.props.cover != null && this.state?.lodaing ? /*#__PURE__*/React__default["default"].createElement(Cover, null, flexType(this.props.cover, this, null, null)) : this.renderer();
|
|
6488
3700
|
}
|
|
6489
3701
|
}
|
|
6490
3702
|
|
|
@@ -6502,12 +3714,12 @@ const FreeType$1 = ({
|
|
|
6502
3714
|
const content = config.bind(me)({
|
|
6503
3715
|
setStyle
|
|
6504
3716
|
});
|
|
6505
|
-
return /*#__PURE__*/
|
|
3717
|
+
return /*#__PURE__*/React__default["default"].createElement(Tag, {
|
|
6506
3718
|
className: className,
|
|
6507
3719
|
style: style
|
|
6508
3720
|
}, content);
|
|
6509
3721
|
} else if (typeof config === 'string') {
|
|
6510
|
-
return /*#__PURE__*/
|
|
3722
|
+
return /*#__PURE__*/React__default["default"].createElement(Tag, {
|
|
6511
3723
|
className: className
|
|
6512
3724
|
}, config);
|
|
6513
3725
|
}
|
|
@@ -6549,33 +3761,33 @@ const StyledJRFrame$1 = styled__default["default"].div`
|
|
|
6549
3761
|
`;
|
|
6550
3762
|
class JRFrame extends JRSubmit {
|
|
6551
3763
|
renderer() {
|
|
6552
|
-
return /*#__PURE__*/
|
|
3764
|
+
return /*#__PURE__*/React__default["default"].createElement(StyledJRFrame$1, {
|
|
6553
3765
|
style: this.props.style,
|
|
6554
3766
|
className: `${this.props.className} jr-frame`
|
|
6555
|
-
}, /*#__PURE__*/
|
|
3767
|
+
}, /*#__PURE__*/React__default["default"].createElement(FreeType$1, {
|
|
6556
3768
|
tag: "div",
|
|
6557
3769
|
config: this.props.start,
|
|
6558
3770
|
me: this,
|
|
6559
3771
|
className: 'start'
|
|
6560
|
-
}), /*#__PURE__*/
|
|
3772
|
+
}), /*#__PURE__*/React__default["default"].createElement("main", null, /*#__PURE__*/React__default["default"].createElement(FreeType$1, {
|
|
6561
3773
|
tag: "header",
|
|
6562
3774
|
config: this.props.top,
|
|
6563
3775
|
me: this
|
|
6564
|
-
}), /*#__PURE__*/
|
|
3776
|
+
}), /*#__PURE__*/React__default["default"].createElement("main", null, /*#__PURE__*/React__default["default"].createElement(FreeType$1, {
|
|
6565
3777
|
tag: "div",
|
|
6566
3778
|
config: this.props.left,
|
|
6567
3779
|
me: this,
|
|
6568
3780
|
className: 'left'
|
|
6569
|
-
}), this.renderMe?.() ?? this.props.children, /*#__PURE__*/
|
|
3781
|
+
}), this.renderMe?.() ?? this.props.children, /*#__PURE__*/React__default["default"].createElement(FreeType$1, {
|
|
6570
3782
|
tag: "div",
|
|
6571
3783
|
config: this.props.right,
|
|
6572
3784
|
me: this,
|
|
6573
3785
|
className: 'right'
|
|
6574
|
-
})), /*#__PURE__*/
|
|
3786
|
+
})), /*#__PURE__*/React__default["default"].createElement(FreeType$1, {
|
|
6575
3787
|
tag: "footer",
|
|
6576
3788
|
config: this.props.bottom,
|
|
6577
3789
|
me: this
|
|
6578
|
-
})), /*#__PURE__*/
|
|
3790
|
+
})), /*#__PURE__*/React__default["default"].createElement(FreeType$1, {
|
|
6579
3791
|
tag: "div",
|
|
6580
3792
|
config: this.props.end,
|
|
6581
3793
|
me: this,
|
|
@@ -6602,10 +3814,10 @@ const StyledSlider$1 = styled__default["default"].div`
|
|
|
6602
3814
|
border-right:1px dashed gray;
|
|
6603
3815
|
}
|
|
6604
3816
|
`;
|
|
6605
|
-
class Slider$1 extends
|
|
3817
|
+
class Slider$1 extends React__default["default"].Component {
|
|
6606
3818
|
constructor() {
|
|
6607
3819
|
super();
|
|
6608
|
-
this.sliderRef = /*#__PURE__*/
|
|
3820
|
+
this.sliderRef = /*#__PURE__*/React__default["default"].createRef();
|
|
6609
3821
|
}
|
|
6610
3822
|
stop = e => {
|
|
6611
3823
|
this.sliderRef.current.classList.remove('resizing');
|
|
@@ -6654,7 +3866,7 @@ class Slider$1 extends React.Component {
|
|
|
6654
3866
|
}
|
|
6655
3867
|
render() {
|
|
6656
3868
|
const column = this.props.column;
|
|
6657
|
-
return /*#__PURE__*/
|
|
3869
|
+
return /*#__PURE__*/React__default["default"].createElement(StyledSlider$1, {
|
|
6658
3870
|
ref: this.sliderRef,
|
|
6659
3871
|
onMouseDown: e => {
|
|
6660
3872
|
this.start(this.props.thRef, column);
|
|
@@ -6667,7 +3879,7 @@ const Colgroup = ({
|
|
|
6667
3879
|
leafColumns,
|
|
6668
3880
|
colGroupRef
|
|
6669
3881
|
}) => {
|
|
6670
|
-
return /*#__PURE__*/
|
|
3882
|
+
return /*#__PURE__*/React__default["default"].createElement("colgroup", {
|
|
6671
3883
|
ref: colGroupRef
|
|
6672
3884
|
}, leafColumns?.map((_column, index) => {
|
|
6673
3885
|
const {
|
|
@@ -6677,7 +3889,7 @@ const Colgroup = ({
|
|
|
6677
3889
|
const style = {
|
|
6678
3890
|
width
|
|
6679
3891
|
};
|
|
6680
|
-
return /*#__PURE__*/
|
|
3892
|
+
return /*#__PURE__*/React__default["default"].createElement("col", {
|
|
6681
3893
|
style: style,
|
|
6682
3894
|
key: index
|
|
6683
3895
|
});
|
|
@@ -6690,13 +3902,13 @@ const Ths$1 = ({
|
|
|
6690
3902
|
table
|
|
6691
3903
|
}) => {
|
|
6692
3904
|
return rowColumn?.map((column, colIndex) => {
|
|
6693
|
-
const thRef = /*#__PURE__*/
|
|
6694
|
-
return /*#__PURE__*/
|
|
3905
|
+
const thRef = /*#__PURE__*/React__default["default"].createRef();
|
|
3906
|
+
return /*#__PURE__*/React__default["default"].createElement("th", {
|
|
6695
3907
|
key: colIndex,
|
|
6696
3908
|
ref: thRef,
|
|
6697
3909
|
colSpan: column.colSpan,
|
|
6698
3910
|
rowSpan: column.rowSpan ?? (column.isLeaf && deep > rowIndex ? deep - rowIndex + 1 : null)
|
|
6699
|
-
}, flexType(column.label, table), table.props.resizableColumns === true && /*#__PURE__*/
|
|
3911
|
+
}, flexType(column.label, table), table.props.resizableColumns === true && /*#__PURE__*/React__default["default"].createElement(Slider$1, {
|
|
6700
3912
|
table: table,
|
|
6701
3913
|
thRef: thRef,
|
|
6702
3914
|
column: column
|
|
@@ -6710,10 +3922,10 @@ const HeadTrs = ({
|
|
|
6710
3922
|
}) => {
|
|
6711
3923
|
const columns = Array.isArray(_columns?.[0]) ? _columns : [_columns];
|
|
6712
3924
|
return columns?.map((rowColumn, rowIndex) => {
|
|
6713
|
-
return /*#__PURE__*/
|
|
3925
|
+
return /*#__PURE__*/React__default["default"].createElement("tr", {
|
|
6714
3926
|
className: trClassName,
|
|
6715
3927
|
key: rowIndex
|
|
6716
|
-
}, /*#__PURE__*/
|
|
3928
|
+
}, /*#__PURE__*/React__default["default"].createElement(Ths$1, {
|
|
6717
3929
|
deep: columns.length - 1,
|
|
6718
3930
|
rowColumn: rowColumn,
|
|
6719
3931
|
rowIndex: rowIndex,
|
|
@@ -6726,10 +3938,10 @@ const THead = ({
|
|
|
6726
3938
|
leafColumns,
|
|
6727
3939
|
table
|
|
6728
3940
|
}) => {
|
|
6729
|
-
return /*#__PURE__*/
|
|
3941
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("thead", null, /*#__PURE__*/React__default["default"].createElement(HeadTrs, {
|
|
6730
3942
|
columns: columns,
|
|
6731
3943
|
table: table
|
|
6732
|
-
})), /*#__PURE__*/
|
|
3944
|
+
})), /*#__PURE__*/React__default["default"].createElement(Colgroup, {
|
|
6733
3945
|
leafColumns: leafColumns,
|
|
6734
3946
|
colGroupRef: table.colGroupRef
|
|
6735
3947
|
}));
|
|
@@ -6754,7 +3966,7 @@ const FootThs = ({
|
|
|
6754
3966
|
// }
|
|
6755
3967
|
let style = flexType(column.style, table, {}, {});
|
|
6756
3968
|
const content = whatType(column, table, column.label);
|
|
6757
|
-
return /*#__PURE__*/
|
|
3969
|
+
return /*#__PURE__*/React__default["default"].createElement("th", {
|
|
6758
3970
|
style: style,
|
|
6759
3971
|
colSpan: column.colSpan,
|
|
6760
3972
|
rowSpan: column.rowSpan
|
|
@@ -6766,24 +3978,24 @@ const TFoot = ({
|
|
|
6766
3978
|
columns
|
|
6767
3979
|
}) => {
|
|
6768
3980
|
const trs = columns?.map((rowColumn, rowIndex) => {
|
|
6769
|
-
return /*#__PURE__*/
|
|
3981
|
+
return /*#__PURE__*/React__default["default"].createElement("tr", {
|
|
6770
3982
|
key: rowIndex
|
|
6771
|
-
}, /*#__PURE__*/
|
|
3983
|
+
}, /*#__PURE__*/React__default["default"].createElement(FootThs, {
|
|
6772
3984
|
columns: rowColumn,
|
|
6773
3985
|
table: table
|
|
6774
3986
|
}));
|
|
6775
3987
|
});
|
|
6776
|
-
return /*#__PURE__*/
|
|
3988
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("tfoot", null, trs));
|
|
6777
3989
|
};
|
|
6778
3990
|
|
|
6779
|
-
function _extends$
|
|
6780
|
-
return _extends$
|
|
3991
|
+
function _extends$1() {
|
|
3992
|
+
return _extends$1 = Object.assign ? Object.assign.bind() : function (n) {
|
|
6781
3993
|
for (var e = 1; e < arguments.length; e++) {
|
|
6782
3994
|
var t = arguments[e];
|
|
6783
3995
|
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
6784
3996
|
}
|
|
6785
3997
|
return n;
|
|
6786
|
-
}, _extends$
|
|
3998
|
+
}, _extends$1.apply(null, arguments);
|
|
6787
3999
|
}
|
|
6788
4000
|
|
|
6789
4001
|
styled__default["default"].tbody`
|
|
@@ -6824,7 +4036,7 @@ const Ths = ({
|
|
|
6824
4036
|
content = column.label;
|
|
6825
4037
|
}
|
|
6826
4038
|
// style.textAlign=align
|
|
6827
|
-
return /*#__PURE__*/
|
|
4039
|
+
return /*#__PURE__*/React__default["default"].createElement("th", {
|
|
6828
4040
|
key: colIndex,
|
|
6829
4041
|
style: {
|
|
6830
4042
|
textAlign: align,
|
|
@@ -6844,10 +4056,10 @@ const GroupColumns = ({
|
|
|
6844
4056
|
}) => {
|
|
6845
4057
|
const columns = Array.isArray(_columns?.[0]) ? _columns : [_columns];
|
|
6846
4058
|
return columns?.map((rowColumn, rowIndex) => {
|
|
6847
|
-
return /*#__PURE__*/
|
|
4059
|
+
return /*#__PURE__*/React__default["default"].createElement("tr", {
|
|
6848
4060
|
className: trClassName,
|
|
6849
4061
|
key: rowIndex
|
|
6850
|
-
}, /*#__PURE__*/
|
|
4062
|
+
}, /*#__PURE__*/React__default["default"].createElement(Ths, {
|
|
6851
4063
|
table: table,
|
|
6852
4064
|
groupData: groupData,
|
|
6853
4065
|
groupIndex: tbodyIndex,
|
|
@@ -6867,7 +4079,7 @@ styled__default["default"].tr`
|
|
|
6867
4079
|
}
|
|
6868
4080
|
`;
|
|
6869
4081
|
const GroupHeader = props => {
|
|
6870
|
-
return /*#__PURE__*/
|
|
4082
|
+
return /*#__PURE__*/React__default["default"].createElement(GroupColumns, _extends$1({
|
|
6871
4083
|
trClassName: 'jr-group-header'
|
|
6872
4084
|
}, props));
|
|
6873
4085
|
};
|
|
@@ -6878,7 +4090,7 @@ styled__default["default"].tr`
|
|
|
6878
4090
|
}
|
|
6879
4091
|
`;
|
|
6880
4092
|
const GroupFooter = props => {
|
|
6881
|
-
return /*#__PURE__*/
|
|
4093
|
+
return /*#__PURE__*/React__default["default"].createElement(GroupColumns, _extends$1({
|
|
6882
4094
|
trClassName: 'jr-group-footer'
|
|
6883
4095
|
}, props));
|
|
6884
4096
|
};
|
|
@@ -6925,7 +4137,7 @@ const Td = ({
|
|
|
6925
4137
|
const typeStyle = flexType(_typeStyle, table, {
|
|
6926
4138
|
record
|
|
6927
4139
|
}, {});
|
|
6928
|
-
content = /*#__PURE__*/
|
|
4140
|
+
content = /*#__PURE__*/React__default["default"].createElement(type, {
|
|
6929
4141
|
onChange: _onChange ? e => {
|
|
6930
4142
|
_onChange?.bind(table)(e, {
|
|
6931
4143
|
value,
|
|
@@ -6953,7 +4165,7 @@ const Td = ({
|
|
|
6953
4165
|
} else {
|
|
6954
4166
|
content = value;
|
|
6955
4167
|
}
|
|
6956
|
-
return /*#__PURE__*/
|
|
4168
|
+
return /*#__PURE__*/React__default["default"].createElement("td", {
|
|
6957
4169
|
colSpan: style.colSpan,
|
|
6958
4170
|
rowSpan: style.rowSpan,
|
|
6959
4171
|
style: {
|
|
@@ -6972,7 +4184,7 @@ const Tds = ({
|
|
|
6972
4184
|
trIndex
|
|
6973
4185
|
}) => {
|
|
6974
4186
|
return leafColumns?.map((column, tdIndex) => {
|
|
6975
|
-
return /*#__PURE__*/
|
|
4187
|
+
return /*#__PURE__*/React__default["default"].createElement(Td, {
|
|
6976
4188
|
column: column,
|
|
6977
4189
|
key: tdIndex,
|
|
6978
4190
|
record: record,
|
|
@@ -6997,14 +4209,14 @@ const TBody = ({
|
|
|
6997
4209
|
table,
|
|
6998
4210
|
tbodyIndex
|
|
6999
4211
|
};
|
|
7000
|
-
return /*#__PURE__*/
|
|
4212
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("tbody", {
|
|
7001
4213
|
key: `tbody${tbodyIndex}`
|
|
7002
|
-
}, groupData?.length > 0 && /*#__PURE__*/
|
|
4214
|
+
}, groupData?.length > 0 && /*#__PURE__*/React__default["default"].createElement(GroupHeader, _extends$1({
|
|
7003
4215
|
groupData: groupData,
|
|
7004
4216
|
columns: groupHeader
|
|
7005
4217
|
}, neededProps)), groupData?.map?.((record, trIndex) => {
|
|
7006
4218
|
const onRowClick = table.props.onRowClick?.bind(table);
|
|
7007
|
-
return /*#__PURE__*/
|
|
4219
|
+
return /*#__PURE__*/React__default["default"].createElement("tr", {
|
|
7008
4220
|
key: trIndex,
|
|
7009
4221
|
onClick: () => {
|
|
7010
4222
|
onRowClick?.({
|
|
@@ -7013,13 +4225,13 @@ const TBody = ({
|
|
|
7013
4225
|
groupIndex: tbodyIndex
|
|
7014
4226
|
});
|
|
7015
4227
|
}
|
|
7016
|
-
}, /*#__PURE__*/
|
|
4228
|
+
}, /*#__PURE__*/React__default["default"].createElement(Tds, _extends$1({
|
|
7017
4229
|
record: record,
|
|
7018
4230
|
trIndex: trIndex
|
|
7019
4231
|
}, neededProps, {
|
|
7020
4232
|
leafColumns: leafColumns
|
|
7021
4233
|
})));
|
|
7022
|
-
}), groupData?.length > 0 && /*#__PURE__*/
|
|
4234
|
+
}), groupData?.length > 0 && /*#__PURE__*/React__default["default"].createElement(GroupFooter, _extends$1({
|
|
7023
4235
|
groupData: groupData,
|
|
7024
4236
|
columns: groupFooter
|
|
7025
4237
|
}, neededProps))));
|
|
@@ -7037,7 +4249,7 @@ const TBodies = ({
|
|
|
7037
4249
|
|
|
7038
4250
|
// po('dataSource',dataSource)
|
|
7039
4251
|
return dataSource?.map((groupData, tbodyIndex, c) => {
|
|
7040
|
-
return /*#__PURE__*/
|
|
4252
|
+
return /*#__PURE__*/React__default["default"].createElement(TBody, {
|
|
7041
4253
|
key: `tbody${tbodyIndex}`,
|
|
7042
4254
|
table: table
|
|
7043
4255
|
// dataSource={dataSource}
|
|
@@ -7185,49 +4397,10 @@ const StyledJRTable = styled__default["default"].div`
|
|
|
7185
4397
|
}
|
|
7186
4398
|
`;
|
|
7187
4399
|
|
|
7188
|
-
var _path$1;
|
|
7189
|
-
function _extends$2() { return _extends$2 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$2.apply(null, arguments); }
|
|
7190
|
-
var SvgX = function SvgX(props) {
|
|
7191
|
-
return /*#__PURE__*/reactExports.createElement("svg", _extends$2({
|
|
7192
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
7193
|
-
width: 24,
|
|
7194
|
-
height: 24,
|
|
7195
|
-
fill: "none",
|
|
7196
|
-
stroke: "currentColor",
|
|
7197
|
-
strokeLinecap: "round",
|
|
7198
|
-
strokeLinejoin: "round",
|
|
7199
|
-
strokeWidth: 2
|
|
7200
|
-
}, props), _path$1 || (_path$1 = /*#__PURE__*/reactExports.createElement("path", {
|
|
7201
|
-
d: "M18 6 6 18M6 6l12 12"
|
|
7202
|
-
})));
|
|
7203
|
-
};
|
|
7204
|
-
|
|
7205
|
-
var _rect;
|
|
7206
|
-
function _extends$1() { return _extends$1 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$1.apply(null, arguments); }
|
|
7207
|
-
var SvgSquare = function SvgSquare(props) {
|
|
7208
|
-
return /*#__PURE__*/reactExports.createElement("svg", _extends$1({
|
|
7209
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
7210
|
-
width: 24,
|
|
7211
|
-
height: 24,
|
|
7212
|
-
fill: "none",
|
|
7213
|
-
stroke: "currentColor",
|
|
7214
|
-
strokeLinecap: "round",
|
|
7215
|
-
strokeLinejoin: "round",
|
|
7216
|
-
strokeWidth: 2
|
|
7217
|
-
}, props), _rect || (_rect = /*#__PURE__*/reactExports.createElement("rect", {
|
|
7218
|
-
width: 18,
|
|
7219
|
-
height: 18,
|
|
7220
|
-
x: 3,
|
|
7221
|
-
y: 3,
|
|
7222
|
-
rx: 2,
|
|
7223
|
-
ry: 2
|
|
7224
|
-
})));
|
|
7225
|
-
};
|
|
7226
|
-
|
|
7227
4400
|
var _path;
|
|
7228
4401
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
7229
|
-
var
|
|
7230
|
-
return /*#__PURE__*/
|
|
4402
|
+
var SvgX = function SvgX(props) {
|
|
4403
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends({
|
|
7231
4404
|
xmlns: "http://www.w3.org/2000/svg",
|
|
7232
4405
|
width: 24,
|
|
7233
4406
|
height: 24,
|
|
@@ -7235,9 +4408,10 @@ var SvgMinus = function SvgMinus(props) {
|
|
|
7235
4408
|
stroke: "currentColor",
|
|
7236
4409
|
strokeLinecap: "round",
|
|
7237
4410
|
strokeLinejoin: "round",
|
|
7238
|
-
strokeWidth: 2
|
|
7239
|
-
|
|
7240
|
-
|
|
4411
|
+
strokeWidth: 2,
|
|
4412
|
+
viewBox: "0 0 24 24"
|
|
4413
|
+
}, props), _path || (_path = /*#__PURE__*/React__namespace.createElement("path", {
|
|
4414
|
+
d: "M18 6 6 18M6 6l12 12"
|
|
7241
4415
|
})));
|
|
7242
4416
|
};
|
|
7243
4417
|
|
|
@@ -7246,7 +4420,7 @@ function JRButton({
|
|
|
7246
4420
|
children,
|
|
7247
4421
|
...props
|
|
7248
4422
|
}) {
|
|
7249
|
-
return /*#__PURE__*/
|
|
4423
|
+
return /*#__PURE__*/React__default["default"].createElement("button", props, icon, children);
|
|
7250
4424
|
}
|
|
7251
4425
|
|
|
7252
4426
|
const StyledTitle = styled__default["default"].div`
|
|
@@ -7295,6 +4469,7 @@ const StyledTitle = styled__default["default"].div`
|
|
|
7295
4469
|
color:white;
|
|
7296
4470
|
}
|
|
7297
4471
|
>svg{
|
|
4472
|
+
color:black;
|
|
7298
4473
|
width:14px;
|
|
7299
4474
|
height:14px;
|
|
7300
4475
|
cursor: pointer;
|
|
@@ -7302,11 +4477,13 @@ const StyledTitle = styled__default["default"].div`
|
|
|
7302
4477
|
}
|
|
7303
4478
|
>button.danger:hover{
|
|
7304
4479
|
background: red;
|
|
7305
|
-
|
|
4480
|
+
>svg{
|
|
4481
|
+
color:white;
|
|
4482
|
+
}
|
|
7306
4483
|
}
|
|
7307
4484
|
}
|
|
7308
4485
|
`;
|
|
7309
|
-
class TitleBar extends
|
|
4486
|
+
class TitleBar extends React__default["default"].Component {
|
|
7310
4487
|
pos1 = 0;
|
|
7311
4488
|
pos2 = 0;
|
|
7312
4489
|
pos3 = 0;
|
|
@@ -7316,6 +4493,10 @@ class TitleBar extends React.Component {
|
|
|
7316
4493
|
stop = e => {
|
|
7317
4494
|
e.preventDefault();
|
|
7318
4495
|
if (this.moved) {
|
|
4496
|
+
const {
|
|
4497
|
+
clientX,
|
|
4498
|
+
clientY
|
|
4499
|
+
} = e;
|
|
7319
4500
|
const {
|
|
7320
4501
|
height: titleBarHeight
|
|
7321
4502
|
} = this.props.titleBarRef.current.getBoundingClientRect();
|
|
@@ -7325,7 +4506,6 @@ class TitleBar extends React.Component {
|
|
|
7325
4506
|
width,
|
|
7326
4507
|
height
|
|
7327
4508
|
} = this.props.windowRef.current.getBoundingClientRect();
|
|
7328
|
-
po('y', y);
|
|
7329
4509
|
if (y < 1) {
|
|
7330
4510
|
this.props.windowRef.current.style.transition = 'var(--transition-x-y), left .1s ease-in';
|
|
7331
4511
|
this.props.windowRef.current.style.left = `${-this.props.thick}px`;
|
|
@@ -7334,6 +4514,7 @@ class TitleBar extends React.Component {
|
|
|
7334
4514
|
|
|
7335
4515
|
this.props.window.orgHeight = height;
|
|
7336
4516
|
this.props.window.orgWidth = width;
|
|
4517
|
+
this.props.window.orgXd = clientX - x;
|
|
7337
4518
|
}
|
|
7338
4519
|
if (y > window.innerHeight) this.props.windowRef.current.style.top = `${window.innerHeight - titleBarHeight}px`;
|
|
7339
4520
|
if (x + width - this.props.thick < 0) this.props.windowRef.current.style.left = 0;
|
|
@@ -7342,6 +4523,7 @@ class TitleBar extends React.Component {
|
|
|
7342
4523
|
}
|
|
7343
4524
|
window.removeEventListener('mousemove', this.move);
|
|
7344
4525
|
window.removeEventListener('mouseup', this.stop);
|
|
4526
|
+
window.removeEventListener('mousemove', this.preMove);
|
|
7345
4527
|
};
|
|
7346
4528
|
move = e => {
|
|
7347
4529
|
e.preventDefault();
|
|
@@ -7356,12 +4538,8 @@ class TitleBar extends React.Component {
|
|
|
7356
4538
|
this.pos3 = clientX;
|
|
7357
4539
|
this.pos4 = y;
|
|
7358
4540
|
const w = this.props.windowRef.current;
|
|
7359
|
-
this.x = w.offsetLeft - this.pos1;
|
|
7360
4541
|
this.y = w.offsetTop - this.pos2;
|
|
7361
|
-
|
|
7362
|
-
w.style.height = `${this.props.window.orgHeight}px`;
|
|
7363
|
-
this.props.window.orgHeight = null;
|
|
7364
|
-
}
|
|
4542
|
+
this.x = w.offsetLeft - this.pos1;
|
|
7365
4543
|
if (this.props.window.orgWidth) {
|
|
7366
4544
|
if (clientX > this.props.window.orgWidth) {
|
|
7367
4545
|
this.x = clientX - this.props.window.orgWidth / 2;
|
|
@@ -7370,8 +4548,29 @@ class TitleBar extends React.Component {
|
|
|
7370
4548
|
this.props.window.orgWidth = null;
|
|
7371
4549
|
}
|
|
7372
4550
|
this.y = this.y < -this.props.thick ? -this.props.thick : this.y;
|
|
7373
|
-
w.style.
|
|
7374
|
-
w.style.
|
|
4551
|
+
w.style.transition = 'unset';
|
|
4552
|
+
w.style.top = `${this.y}px`;
|
|
4553
|
+
w.style.left = `${this.x}px`;
|
|
4554
|
+
};
|
|
4555
|
+
preMove = e => {
|
|
4556
|
+
const w = this.props.windowRef.current;
|
|
4557
|
+
const {
|
|
4558
|
+
clientX,
|
|
4559
|
+
clientY
|
|
4560
|
+
} = e;
|
|
4561
|
+
if (this.props.window.orgXd) {
|
|
4562
|
+
w.style.left = `${clientX - this.props.window.orgXd}px`;
|
|
4563
|
+
this.props.window.orgXd = null;
|
|
4564
|
+
}
|
|
4565
|
+
if (this.props.window.orgHeight) {
|
|
4566
|
+
w.style.height = `${this.props.window.orgHeight}px`;
|
|
4567
|
+
this.props.window.orgHeight = null;
|
|
4568
|
+
}
|
|
4569
|
+
w.style.transition = 'left .1s ease-in, height .1s ease-in';
|
|
4570
|
+
setTimeout(() => {
|
|
4571
|
+
window.addEventListener('mousemove', this.move);
|
|
4572
|
+
}, 100);
|
|
4573
|
+
window.removeEventListener('mousemove', this.preMove);
|
|
7375
4574
|
};
|
|
7376
4575
|
start(e) {
|
|
7377
4576
|
e.preventDefault();
|
|
@@ -7380,27 +4579,23 @@ class TitleBar extends React.Component {
|
|
|
7380
4579
|
this.pos4 = e.clientY;
|
|
7381
4580
|
this.props.windowRef.current.style.transition = 'var(--transition-x-y)';
|
|
7382
4581
|
document.body.style.cursor = 'grabbing';
|
|
7383
|
-
window.addEventListener('mousemove', this.
|
|
4582
|
+
window.addEventListener('mousemove', this.preMove);
|
|
7384
4583
|
window.addEventListener('mouseup', this.stop);
|
|
7385
4584
|
}
|
|
7386
4585
|
render() {
|
|
7387
|
-
return /*#__PURE__*/
|
|
4586
|
+
return /*#__PURE__*/React__default["default"].createElement(StyledTitle, {
|
|
7388
4587
|
ref: this.props.titleBarRef,
|
|
7389
4588
|
draggable: "false",
|
|
7390
4589
|
onMouseDown: e => {
|
|
7391
4590
|
this.start(e);
|
|
7392
4591
|
}
|
|
7393
|
-
}, /*#__PURE__*/
|
|
4592
|
+
}, /*#__PURE__*/React__default["default"].createElement(FreeType$1, {
|
|
7394
4593
|
tag: "div",
|
|
7395
4594
|
config: this.props.title ?? '',
|
|
7396
4595
|
me: this.props.window,
|
|
7397
4596
|
className: 'title'
|
|
7398
|
-
}), /*#__PURE__*/
|
|
7399
|
-
icon: /*#__PURE__*/
|
|
7400
|
-
}), /*#__PURE__*/React.createElement(JRButton, {
|
|
7401
|
-
icon: /*#__PURE__*/React.createElement(SvgSquare, null)
|
|
7402
|
-
}), this.props.window.props.setOpen ? /*#__PURE__*/React.createElement(JRButton, {
|
|
7403
|
-
icon: /*#__PURE__*/React.createElement(SvgX, null),
|
|
4597
|
+
}), /*#__PURE__*/React__default["default"].createElement("nav", null, this.props.window.props.setOpen ? /*#__PURE__*/React__default["default"].createElement(JRButton, {
|
|
4598
|
+
icon: /*#__PURE__*/React__default["default"].createElement(SvgX, null),
|
|
7404
4599
|
className: 'danger',
|
|
7405
4600
|
onClick: () => {
|
|
7406
4601
|
this.props.window.props.setOpen(false);
|
|
@@ -7410,9 +4605,9 @@ class TitleBar extends React.Component {
|
|
|
7410
4605
|
}
|
|
7411
4606
|
|
|
7412
4607
|
const directions = ['n', 'e', 's', 'w', 'nww', 'nnw', 'nne', 'nee', 'sse', 'see', 'sww', 'ssw'];
|
|
7413
|
-
class Sliders extends
|
|
4608
|
+
class Sliders extends React__default["default"].Component {
|
|
7414
4609
|
render() {
|
|
7415
|
-
return directions.map((direction, index) => /*#__PURE__*/
|
|
4610
|
+
return directions.map((direction, index) => /*#__PURE__*/React__default["default"].createElement(Slider, {
|
|
7416
4611
|
direction: direction,
|
|
7417
4612
|
thick: this.props.thick,
|
|
7418
4613
|
windowRef: this.props.windowRef,
|
|
@@ -7477,13 +4672,13 @@ const StyledSlider = styled__default["default"].div`
|
|
|
7477
4672
|
user-select: none;
|
|
7478
4673
|
|
|
7479
4674
|
`;
|
|
7480
|
-
class Slider extends
|
|
4675
|
+
class Slider extends React__default["default"].Component {
|
|
7481
4676
|
width = '3px';
|
|
7482
4677
|
borderWidth = 'px';
|
|
7483
|
-
borderLong =
|
|
4678
|
+
borderLong = 5;
|
|
7484
4679
|
constructor(props) {
|
|
7485
4680
|
super(props);
|
|
7486
|
-
this.sliderRef = /*#__PURE__*/
|
|
4681
|
+
this.sliderRef = /*#__PURE__*/React__default["default"].createRef();
|
|
7487
4682
|
}
|
|
7488
4683
|
directions = {
|
|
7489
4684
|
n: {
|
|
@@ -7710,10 +4905,12 @@ class Slider extends React.Component {
|
|
|
7710
4905
|
if (x > window.innerWidth) this.props.windowRef.current.style.left = `${window.innerWidth - width}px`;
|
|
7711
4906
|
document.body.style.cursor = 'default';
|
|
7712
4907
|
window.removeEventListener('mousemove', this.move);
|
|
4908
|
+
window.removeEventListener('mousemove', this.preMove);
|
|
7713
4909
|
window.removeEventListener('mouseup', this.stop);
|
|
7714
4910
|
};
|
|
7715
4911
|
move = e => {
|
|
7716
4912
|
e.preventDefault();
|
|
4913
|
+
this.props.windowRef.current.style.transition = 'unset';
|
|
7717
4914
|
const {
|
|
7718
4915
|
clientX,
|
|
7719
4916
|
clientY,
|
|
@@ -7725,7 +4922,7 @@ class Slider extends React.Component {
|
|
|
7725
4922
|
left,
|
|
7726
4923
|
top
|
|
7727
4924
|
} = window.getBoundingClientRect();
|
|
7728
|
-
|
|
4925
|
+
let {
|
|
7729
4926
|
x: startX,
|
|
7730
4927
|
width: startWidth,
|
|
7731
4928
|
y: startY,
|
|
@@ -7747,6 +4944,15 @@ class Slider extends React.Component {
|
|
|
7747
4944
|
top
|
|
7748
4945
|
});
|
|
7749
4946
|
};
|
|
4947
|
+
preMove = () => {
|
|
4948
|
+
this.props.windowRef.current.style.height = `${this.props.window.orgHeight}px`;
|
|
4949
|
+
this.data.height = this.props.window.orgHeight;
|
|
4950
|
+
this.props.window.orgHeight = null;
|
|
4951
|
+
window.removeEventListener('mousemove', this.preMove);
|
|
4952
|
+
setTimeout(() => {
|
|
4953
|
+
window.addEventListener('mousemove', this.move);
|
|
4954
|
+
}, 100);
|
|
4955
|
+
};
|
|
7750
4956
|
start = (e, direction) => {
|
|
7751
4957
|
e.preventDefault();
|
|
7752
4958
|
const {
|
|
@@ -7758,14 +4964,6 @@ class Slider extends React.Component {
|
|
|
7758
4964
|
width,
|
|
7759
4965
|
height
|
|
7760
4966
|
} = this.props.windowRef.current.getBoundingClientRect();
|
|
7761
|
-
if (direction.indexOf('n') > -1) {
|
|
7762
|
-
if (this.props.window.orgHeight) {
|
|
7763
|
-
height = this.props.window.orgHeight;
|
|
7764
|
-
this.props.window.orgHeight = null;
|
|
7765
|
-
}
|
|
7766
|
-
} else if (direction.indexOf('s') > -1) {
|
|
7767
|
-
this.props.window.orgHeight = null;
|
|
7768
|
-
}
|
|
7769
4967
|
this.data = {
|
|
7770
4968
|
x,
|
|
7771
4969
|
y,
|
|
@@ -7774,13 +4972,16 @@ class Slider extends React.Component {
|
|
|
7774
4972
|
titleBarHeight,
|
|
7775
4973
|
direction
|
|
7776
4974
|
};
|
|
7777
|
-
this.props.windowRef.current.style.transition = 'unset';
|
|
7778
4975
|
document.body.style.cursor = this.directions[this.props.direction].cursor;
|
|
7779
|
-
|
|
4976
|
+
if (this.props.window.orgHeight) {
|
|
4977
|
+
window.addEventListener('mousemove', this.preMove);
|
|
4978
|
+
} else {
|
|
4979
|
+
window.addEventListener('mousemove', this.move);
|
|
4980
|
+
}
|
|
7780
4981
|
window.addEventListener('mouseup', this.stop);
|
|
7781
4982
|
};
|
|
7782
4983
|
render() {
|
|
7783
|
-
return /*#__PURE__*/
|
|
4984
|
+
return /*#__PURE__*/React__default["default"].createElement(StyledSlider, {
|
|
7784
4985
|
$direction: this.directions[this.props.direction],
|
|
7785
4986
|
$padding: this.props.padding,
|
|
7786
4987
|
onMouseDown: e => {
|
|
@@ -7835,6 +5036,12 @@ const StyledJRWindow = styled__default["default"].div`
|
|
|
7835
5036
|
display: flex;
|
|
7836
5037
|
}
|
|
7837
5038
|
}
|
|
5039
|
+
|
|
5040
|
+
@container (min-width: 700px) {
|
|
5041
|
+
&{
|
|
5042
|
+
border: 1px solid red;
|
|
5043
|
+
}
|
|
5044
|
+
}
|
|
7838
5045
|
`;
|
|
7839
5046
|
class JRWindow extends JRFrame {
|
|
7840
5047
|
x = 0;
|
|
@@ -7845,8 +5052,8 @@ class JRWindow extends JRFrame {
|
|
|
7845
5052
|
thick = 5;
|
|
7846
5053
|
constructor(props) {
|
|
7847
5054
|
super(props);
|
|
7848
|
-
this.ref = /*#__PURE__*/
|
|
7849
|
-
this.titleBarRef = /*#__PURE__*/
|
|
5055
|
+
this.ref = /*#__PURE__*/React__default["default"].createRef();
|
|
5056
|
+
this.titleBarRef = /*#__PURE__*/React__default["default"].createRef();
|
|
7850
5057
|
this.init();
|
|
7851
5058
|
}
|
|
7852
5059
|
componentWillUpdate(prevProps, prevState, snapshot) {
|
|
@@ -7861,7 +5068,7 @@ class JRWindow extends JRFrame {
|
|
|
7861
5068
|
this.y = this.props.y ?? (window.innerHeight - (this.height ?? 300)) / 2;
|
|
7862
5069
|
}
|
|
7863
5070
|
renderer() {
|
|
7864
|
-
return this.props.popup === true ? this.props.open === true ? /*#__PURE__*/
|
|
5071
|
+
return this.props.popup === true ? this.props.open === true ? /*#__PURE__*/React__default["default"].createElement(StyledJRWindow, {
|
|
7865
5072
|
ref: this.ref,
|
|
7866
5073
|
className: `jr-window ${this.props.className ?? ''}`,
|
|
7867
5074
|
$x: this.x,
|
|
@@ -7869,13 +5076,13 @@ class JRWindow extends JRFrame {
|
|
|
7869
5076
|
$width: this.width,
|
|
7870
5077
|
$height: this.height,
|
|
7871
5078
|
$thick: this.thick
|
|
7872
|
-
}, /*#__PURE__*/
|
|
5079
|
+
}, /*#__PURE__*/React__default["default"].createElement("main", null, /*#__PURE__*/React__default["default"].createElement(TitleBar, {
|
|
7873
5080
|
titleBarRef: this.titleBarRef,
|
|
7874
5081
|
windowRef: this.ref,
|
|
7875
5082
|
window: this,
|
|
7876
5083
|
title: this.props.title,
|
|
7877
5084
|
thick: this.thick
|
|
7878
|
-
}), /*#__PURE__*/
|
|
5085
|
+
}), /*#__PURE__*/React__default["default"].createElement("main", null, super.renderer())), /*#__PURE__*/React__default["default"].createElement(Sliders, {
|
|
7879
5086
|
thick: this.thick,
|
|
7880
5087
|
windowRef: this.ref,
|
|
7881
5088
|
window: this,
|
|
@@ -7906,7 +5113,7 @@ const setMapObject = (map, names, value) => {
|
|
|
7906
5113
|
class JRTable extends JRWindow {
|
|
7907
5114
|
constructor(props) {
|
|
7908
5115
|
super(props);
|
|
7909
|
-
this.colGroupRef = /*#__PURE__*/
|
|
5116
|
+
this.colGroupRef = /*#__PURE__*/React__default["default"].createRef();
|
|
7910
5117
|
}
|
|
7911
5118
|
UNSAFE_componentWillMount() {
|
|
7912
5119
|
this.setColumns(this.props.columns ?? []);
|
|
@@ -7923,7 +5130,7 @@ class JRTable extends JRWindow {
|
|
|
7923
5130
|
value,
|
|
7924
5131
|
onChange
|
|
7925
5132
|
}) {
|
|
7926
|
-
return /*#__PURE__*/
|
|
5133
|
+
return /*#__PURE__*/React__default["default"].createElement("checkbox", {
|
|
7927
5134
|
checked: value,
|
|
7928
5135
|
onChange: e => {
|
|
7929
5136
|
onChange(e.target.checked);
|
|
@@ -7962,7 +5169,7 @@ class JRTable extends JRWindow {
|
|
|
7962
5169
|
value,
|
|
7963
5170
|
onChange
|
|
7964
5171
|
}) {
|
|
7965
|
-
return /*#__PURE__*/
|
|
5172
|
+
return /*#__PURE__*/React__default["default"].createElement("checkbox", {
|
|
7966
5173
|
checked: value,
|
|
7967
5174
|
onChange: e => {
|
|
7968
5175
|
onChange(e.target.checked);
|
|
@@ -7972,7 +5179,7 @@ class JRTable extends JRWindow {
|
|
|
7972
5179
|
align: 'center',
|
|
7973
5180
|
name,
|
|
7974
5181
|
label() {
|
|
7975
|
-
return /*#__PURE__*/
|
|
5182
|
+
return /*#__PURE__*/React__default["default"].createElement("button", {
|
|
7976
5183
|
onClick: () => {
|
|
7977
5184
|
const value = this.props.delete.value ?? this.getDataSource()?.filter(record => record[name]).map(record => sendValue ? record[sendValue] : record);
|
|
7978
5185
|
const callback = this.props.delete.callback ?? function (a, b, c) {
|
|
@@ -8095,25 +5302,25 @@ class JRTable extends JRWindow {
|
|
|
8095
5302
|
}
|
|
8096
5303
|
//------------------------------------------------------------------------------------
|
|
8097
5304
|
renderMe() {
|
|
8098
|
-
return /*#__PURE__*/
|
|
5305
|
+
return /*#__PURE__*/React__default["default"].createElement(StyledJRTable, {
|
|
8099
5306
|
className: `${this.props.className ?? ''} jr-table ${this.props.onRowClick ? 'row-highlightable' : ''}`
|
|
8100
|
-
}, /*#__PURE__*/
|
|
5307
|
+
}, /*#__PURE__*/React__default["default"].createElement("table", {
|
|
8101
5308
|
className: 'jr-table-table'
|
|
8102
|
-
}, /*#__PURE__*/
|
|
5309
|
+
}, /*#__PURE__*/React__default["default"].createElement(TBodies, {
|
|
8103
5310
|
table: this,
|
|
8104
5311
|
leafColumns: this.state.leafColumns,
|
|
8105
5312
|
groupHeader: this.props.groupHeader,
|
|
8106
5313
|
groupFooter: this.props.groupFooter,
|
|
8107
5314
|
dataSource: this.getDataSource(),
|
|
8108
5315
|
onRowClick: this.props.onRowClick
|
|
8109
|
-
}), /*#__PURE__*/
|
|
5316
|
+
}), /*#__PURE__*/React__default["default"].createElement(TFoot, {
|
|
8110
5317
|
columns: this.props.footColumns,
|
|
8111
5318
|
table: this
|
|
8112
|
-
}), /*#__PURE__*/
|
|
5319
|
+
}), /*#__PURE__*/React__default["default"].createElement(THead, {
|
|
8113
5320
|
columns: this.state.columns,
|
|
8114
5321
|
leafColumns: this.state.leafColumns,
|
|
8115
5322
|
table: this
|
|
8116
|
-
})), /*#__PURE__*/
|
|
5323
|
+
})), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
8117
5324
|
className: 'empty'
|
|
8118
5325
|
}, this.noData() && '無資料'));
|
|
8119
5326
|
}
|
|
@@ -8462,12 +5669,12 @@ class JRFields extends JRWindow {
|
|
|
8462
5669
|
}
|
|
8463
5670
|
if (type) {
|
|
8464
5671
|
const typeStyle = flexType(_typeStyle, this, null);
|
|
8465
|
-
content = /*#__PURE__*/
|
|
5672
|
+
content = /*#__PURE__*/React__default["default"].createElement(StyledColumnValue, {
|
|
8466
5673
|
className: 'jr-column-value',
|
|
8467
5674
|
style: {
|
|
8468
5675
|
gridColumn: label == null ? 'span 2' : null
|
|
8469
5676
|
}
|
|
8470
|
-
}, /*#__PURE__*/
|
|
5677
|
+
}, /*#__PURE__*/React__default["default"].createElement(type, {
|
|
8471
5678
|
value: value,
|
|
8472
5679
|
onChange,
|
|
8473
5680
|
record: parentValue,
|
|
@@ -8478,13 +5685,13 @@ class JRFields extends JRWindow {
|
|
|
8478
5685
|
...column
|
|
8479
5686
|
}));
|
|
8480
5687
|
} else if (column.columns) {
|
|
8481
|
-
content = /*#__PURE__*/
|
|
5688
|
+
content = /*#__PURE__*/React__default["default"].createElement(StyledGrid, {
|
|
8482
5689
|
cols: column.cols,
|
|
8483
5690
|
className: 'jr-grid',
|
|
8484
5691
|
$gap: gap
|
|
8485
5692
|
}, this.createColumns(value, column.columns, _parentName, fullname));
|
|
8486
5693
|
} else if (name || column.render) {
|
|
8487
|
-
content = /*#__PURE__*/
|
|
5694
|
+
content = /*#__PURE__*/React__default["default"].createElement(StyledColumnValue, {
|
|
8488
5695
|
className: 'jr-column-value',
|
|
8489
5696
|
style: {
|
|
8490
5697
|
gridColumn: label == null ? 'span 2' : null,
|
|
@@ -8498,7 +5705,7 @@ class JRFields extends JRWindow {
|
|
|
8498
5705
|
}
|
|
8499
5706
|
const layout = column.labelProps?.layout === undefined ? this.props.labelProps?.layout : column.labelProps?.layout;
|
|
8500
5707
|
const labelStyle = column.labelProps?.style ?? this.props.labelProps?.style ?? {};
|
|
8501
|
-
return /*#__PURE__*/
|
|
5708
|
+
return /*#__PURE__*/React__default["default"].createElement(StyledColumn, {
|
|
8502
5709
|
$layout: layout,
|
|
8503
5710
|
$hasLabel: label != null,
|
|
8504
5711
|
key: `f${index}`,
|
|
@@ -8506,18 +5713,18 @@ class JRFields extends JRWindow {
|
|
|
8506
5713
|
className: 'jr-column',
|
|
8507
5714
|
$labelWidth: column.labelProps?.width ?? this.props.labelProps?.width ?? '120px',
|
|
8508
5715
|
$valueWidth: column.valueProps?.width ?? this.props.valueProps?.width ?? '1fr'
|
|
8509
|
-
}, label != null && /*#__PURE__*/
|
|
5716
|
+
}, label != null && /*#__PURE__*/React__default["default"].createElement(StyledColumnLabel, {
|
|
8510
5717
|
style: labelStyle,
|
|
8511
5718
|
$required: required,
|
|
8512
5719
|
className: 'label',
|
|
8513
5720
|
$layout: layout,
|
|
8514
5721
|
$colon: column.labelProps?.colon === undefined ? this.colon : column.labelProps?.colon
|
|
8515
|
-
}, label), content, this.props.debugMode && /*#__PURE__*/
|
|
5722
|
+
}, label), content, this.props.debugMode && /*#__PURE__*/React__default["default"].createElement(StyledColumnFooter, null, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
8516
5723
|
className: "left"
|
|
8517
|
-
}, /*#__PURE__*/
|
|
5724
|
+
}, /*#__PURE__*/React__default["default"].createElement(ColumnMessage, {
|
|
8518
5725
|
value: this.getValidateValue(_parentName.join('.')),
|
|
8519
5726
|
record: this.getValue()
|
|
8520
|
-
})), /*#__PURE__*/
|
|
5727
|
+
})), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
8521
5728
|
className: "right"
|
|
8522
5729
|
}))
|
|
8523
5730
|
// validateValue?.[name]!==undefined && <StyledColumnFooter $layout={layout}>
|
|
@@ -8532,10 +5739,10 @@ class JRFields extends JRWindow {
|
|
|
8532
5739
|
});
|
|
8533
5740
|
}
|
|
8534
5741
|
renderMe() {
|
|
8535
|
-
return /*#__PURE__*/
|
|
5742
|
+
return /*#__PURE__*/React__default["default"].createElement(StyleJRFields, {
|
|
8536
5743
|
className: 'jr-fields',
|
|
8537
5744
|
style: this.props.typeStyle
|
|
8538
|
-
}, /*#__PURE__*/
|
|
5745
|
+
}, /*#__PURE__*/React__default["default"].createElement(StyledGrid, {
|
|
8539
5746
|
cols: this.props.cols,
|
|
8540
5747
|
style: this.props.gridStyle,
|
|
8541
5748
|
className: 'jr-grid',
|
|
@@ -8597,7 +5804,7 @@ const FreeType = ({
|
|
|
8597
5804
|
const content = config.bind(me)({
|
|
8598
5805
|
setStyle
|
|
8599
5806
|
});
|
|
8600
|
-
return /*#__PURE__*/
|
|
5807
|
+
return /*#__PURE__*/React__default["default"].createElement(Tag, {
|
|
8601
5808
|
className: className,
|
|
8602
5809
|
style: style
|
|
8603
5810
|
}, content);
|
|
@@ -8605,33 +5812,33 @@ const FreeType = ({
|
|
|
8605
5812
|
};
|
|
8606
5813
|
class JRTestReact extends JRSubmit {
|
|
8607
5814
|
renderer() {
|
|
8608
|
-
return /*#__PURE__*/
|
|
5815
|
+
return /*#__PURE__*/React__default["default"].createElement(StyledJRFrame, {
|
|
8609
5816
|
style: this.props.style,
|
|
8610
5817
|
className: `${this.props.className} jr-frame`
|
|
8611
|
-
}, /*#__PURE__*/
|
|
5818
|
+
}, /*#__PURE__*/React__default["default"].createElement(FreeType, {
|
|
8612
5819
|
tag: "div",
|
|
8613
5820
|
config: this.props.start,
|
|
8614
5821
|
me: this,
|
|
8615
5822
|
className: 'start'
|
|
8616
|
-
}), /*#__PURE__*/
|
|
5823
|
+
}), /*#__PURE__*/React__default["default"].createElement("main", null, /*#__PURE__*/React__default["default"].createElement(FreeType, {
|
|
8617
5824
|
tag: "header",
|
|
8618
5825
|
config: this.props.top,
|
|
8619
5826
|
me: this
|
|
8620
|
-
}), /*#__PURE__*/
|
|
5827
|
+
}), /*#__PURE__*/React__default["default"].createElement("main", null, /*#__PURE__*/React__default["default"].createElement(FreeType, {
|
|
8621
5828
|
tag: "div",
|
|
8622
5829
|
config: this.props.left,
|
|
8623
5830
|
me: this,
|
|
8624
5831
|
className: 'left'
|
|
8625
|
-
}), this.renderMe(), /*#__PURE__*/
|
|
5832
|
+
}), this.renderMe(), /*#__PURE__*/React__default["default"].createElement(FreeType, {
|
|
8626
5833
|
tag: "div",
|
|
8627
5834
|
config: this.props.right,
|
|
8628
5835
|
me: this,
|
|
8629
5836
|
className: 'right'
|
|
8630
|
-
})), /*#__PURE__*/
|
|
5837
|
+
})), /*#__PURE__*/React__default["default"].createElement(FreeType, {
|
|
8631
5838
|
tag: "footer",
|
|
8632
5839
|
config: this.props.bottom,
|
|
8633
5840
|
me: this
|
|
8634
|
-
})), /*#__PURE__*/
|
|
5841
|
+
})), /*#__PURE__*/React__default["default"].createElement(FreeType, {
|
|
8635
5842
|
tag: "div",
|
|
8636
5843
|
config: this.props.end,
|
|
8637
5844
|
me: this,
|
|
@@ -8639,7 +5846,7 @@ class JRTestReact extends JRSubmit {
|
|
|
8639
5846
|
}));
|
|
8640
5847
|
}
|
|
8641
5848
|
renderMe() {
|
|
8642
|
-
return /*#__PURE__*/
|
|
5849
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
8643
5850
|
style: {
|
|
8644
5851
|
flex: 1
|
|
8645
5852
|
}
|
|
@@ -8653,3 +5860,4 @@ exports.JRFrame = JRFrame;
|
|
|
8653
5860
|
exports.JRSubmit = JRSubmit;
|
|
8654
5861
|
exports.JRTable = JRTable;
|
|
8655
5862
|
exports.JRTestReact = JRTestReact;
|
|
5863
|
+
exports.JRWindow = JRWindow;
|