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.es.js
CHANGED
|
@@ -1,2814 +1,7 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import React__default from 'react';
|
|
1
3
|
import styled from 'styled-components';
|
|
2
4
|
|
|
3
|
-
function getDefaultExportFromCjs (x) {
|
|
4
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
var react = {exports: {}};
|
|
8
|
-
|
|
9
|
-
var react_production_min = {};
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @license React
|
|
13
|
-
* react.production.min.js
|
|
14
|
-
*
|
|
15
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
16
|
-
*
|
|
17
|
-
* This source code is licensed under the MIT license found in the
|
|
18
|
-
* LICENSE file in the root directory of this source tree.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
var hasRequiredReact_production_min;
|
|
22
|
-
|
|
23
|
-
function requireReact_production_min () {
|
|
24
|
-
if (hasRequiredReact_production_min) return react_production_min;
|
|
25
|
-
hasRequiredReact_production_min = 1;
|
|
26
|
-
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}
|
|
27
|
-
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={};
|
|
28
|
-
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;
|
|
29
|
-
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};
|
|
30
|
-
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}}
|
|
31
|
-
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)}
|
|
32
|
-
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=
|
|
33
|
-
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}
|
|
34
|
-
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;}
|
|
35
|
-
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;
|
|
36
|
-
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;
|
|
37
|
-
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);
|
|
38
|
-
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}};
|
|
39
|
-
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.");};
|
|
40
|
-
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)};
|
|
41
|
-
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)};
|
|
42
|
-
react_production_min.useTransition=function(){return U.current.useTransition()};react_production_min.version="18.2.0";
|
|
43
|
-
return react_production_min;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
var react_development = {exports: {}};
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* @license React
|
|
50
|
-
* react.development.js
|
|
51
|
-
*
|
|
52
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
53
|
-
*
|
|
54
|
-
* This source code is licensed under the MIT license found in the
|
|
55
|
-
* LICENSE file in the root directory of this source tree.
|
|
56
|
-
*/
|
|
57
|
-
react_development.exports;
|
|
58
|
-
|
|
59
|
-
var hasRequiredReact_development;
|
|
60
|
-
|
|
61
|
-
function requireReact_development () {
|
|
62
|
-
if (hasRequiredReact_development) return react_development.exports;
|
|
63
|
-
hasRequiredReact_development = 1;
|
|
64
|
-
(function (module, exports) {
|
|
65
|
-
|
|
66
|
-
if (process.env.NODE_ENV !== "production") {
|
|
67
|
-
(function() {
|
|
68
|
-
|
|
69
|
-
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
|
70
|
-
if (
|
|
71
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
|
72
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===
|
|
73
|
-
'function'
|
|
74
|
-
) {
|
|
75
|
-
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
76
|
-
}
|
|
77
|
-
var ReactVersion = '18.2.0';
|
|
78
|
-
|
|
79
|
-
// ATTENTION
|
|
80
|
-
// When adding new symbols to this file,
|
|
81
|
-
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
|
|
82
|
-
// The Symbol used to tag the ReactElement-like types.
|
|
83
|
-
var REACT_ELEMENT_TYPE = Symbol.for('react.element');
|
|
84
|
-
var REACT_PORTAL_TYPE = Symbol.for('react.portal');
|
|
85
|
-
var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
|
|
86
|
-
var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
|
|
87
|
-
var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
|
|
88
|
-
var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
|
|
89
|
-
var REACT_CONTEXT_TYPE = Symbol.for('react.context');
|
|
90
|
-
var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
|
|
91
|
-
var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
|
|
92
|
-
var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
|
|
93
|
-
var REACT_MEMO_TYPE = Symbol.for('react.memo');
|
|
94
|
-
var REACT_LAZY_TYPE = Symbol.for('react.lazy');
|
|
95
|
-
var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
|
|
96
|
-
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
|
97
|
-
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
98
|
-
function getIteratorFn(maybeIterable) {
|
|
99
|
-
if (maybeIterable === null || typeof maybeIterable !== 'object') {
|
|
100
|
-
return null;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
104
|
-
|
|
105
|
-
if (typeof maybeIterator === 'function') {
|
|
106
|
-
return maybeIterator;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
return null;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Keeps track of the current dispatcher.
|
|
114
|
-
*/
|
|
115
|
-
var ReactCurrentDispatcher = {
|
|
116
|
-
/**
|
|
117
|
-
* @internal
|
|
118
|
-
* @type {ReactComponent}
|
|
119
|
-
*/
|
|
120
|
-
current: null
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Keeps track of the current batch's configuration such as how long an update
|
|
125
|
-
* should suspend for if it needs to.
|
|
126
|
-
*/
|
|
127
|
-
var ReactCurrentBatchConfig = {
|
|
128
|
-
transition: null
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
var ReactCurrentActQueue = {
|
|
132
|
-
current: null,
|
|
133
|
-
// Used to reproduce behavior of `batchedUpdates` in legacy mode.
|
|
134
|
-
isBatchingLegacy: false,
|
|
135
|
-
didScheduleLegacyUpdate: false
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Keeps track of the current owner.
|
|
140
|
-
*
|
|
141
|
-
* The current owner is the component who should own any components that are
|
|
142
|
-
* currently being constructed.
|
|
143
|
-
*/
|
|
144
|
-
var ReactCurrentOwner = {
|
|
145
|
-
/**
|
|
146
|
-
* @internal
|
|
147
|
-
* @type {ReactComponent}
|
|
148
|
-
*/
|
|
149
|
-
current: null
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
var ReactDebugCurrentFrame = {};
|
|
153
|
-
var currentExtraStackFrame = null;
|
|
154
|
-
function setExtraStackFrame(stack) {
|
|
155
|
-
{
|
|
156
|
-
currentExtraStackFrame = stack;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
{
|
|
161
|
-
ReactDebugCurrentFrame.setExtraStackFrame = function (stack) {
|
|
162
|
-
{
|
|
163
|
-
currentExtraStackFrame = stack;
|
|
164
|
-
}
|
|
165
|
-
}; // Stack implementation injected by the current renderer.
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
ReactDebugCurrentFrame.getCurrentStack = null;
|
|
169
|
-
|
|
170
|
-
ReactDebugCurrentFrame.getStackAddendum = function () {
|
|
171
|
-
var stack = ''; // Add an extra top frame while an element is being validated
|
|
172
|
-
|
|
173
|
-
if (currentExtraStackFrame) {
|
|
174
|
-
stack += currentExtraStackFrame;
|
|
175
|
-
} // Delegate to the injected renderer-specific implementation
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
var impl = ReactDebugCurrentFrame.getCurrentStack;
|
|
179
|
-
|
|
180
|
-
if (impl) {
|
|
181
|
-
stack += impl() || '';
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
return stack;
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
// -----------------------------------------------------------------------------
|
|
189
|
-
|
|
190
|
-
var enableScopeAPI = false; // Experimental Create Event Handle API.
|
|
191
|
-
var enableCacheElement = false;
|
|
192
|
-
var enableTransitionTracing = false; // No known bugs, but needs performance testing
|
|
193
|
-
|
|
194
|
-
var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
|
|
195
|
-
// stuff. Intended to enable React core members to more easily debug scheduling
|
|
196
|
-
// issues in DEV builds.
|
|
197
|
-
|
|
198
|
-
var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
|
|
199
|
-
|
|
200
|
-
var ReactSharedInternals = {
|
|
201
|
-
ReactCurrentDispatcher: ReactCurrentDispatcher,
|
|
202
|
-
ReactCurrentBatchConfig: ReactCurrentBatchConfig,
|
|
203
|
-
ReactCurrentOwner: ReactCurrentOwner
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
{
|
|
207
|
-
ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame;
|
|
208
|
-
ReactSharedInternals.ReactCurrentActQueue = ReactCurrentActQueue;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
// by calls to these methods by a Babel plugin.
|
|
212
|
-
//
|
|
213
|
-
// In PROD (or in packages without access to React internals),
|
|
214
|
-
// they are left as they are instead.
|
|
215
|
-
|
|
216
|
-
function warn(format) {
|
|
217
|
-
{
|
|
218
|
-
{
|
|
219
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
220
|
-
args[_key - 1] = arguments[_key];
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
printWarning('warn', format, args);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
function error(format) {
|
|
228
|
-
{
|
|
229
|
-
{
|
|
230
|
-
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
231
|
-
args[_key2 - 1] = arguments[_key2];
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
printWarning('error', format, args);
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
function printWarning(level, format, args) {
|
|
240
|
-
// When changing this logic, you might want to also
|
|
241
|
-
// update consoleWithStackDev.www.js as well.
|
|
242
|
-
{
|
|
243
|
-
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
244
|
-
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
245
|
-
|
|
246
|
-
if (stack !== '') {
|
|
247
|
-
format += '%s';
|
|
248
|
-
args = args.concat([stack]);
|
|
249
|
-
} // eslint-disable-next-line react-internal/safe-string-coercion
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
var argsWithFormat = args.map(function (item) {
|
|
253
|
-
return String(item);
|
|
254
|
-
}); // Careful: RN currently depends on this prefix
|
|
255
|
-
|
|
256
|
-
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
|
257
|
-
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
258
|
-
// eslint-disable-next-line react-internal/no-production-logging
|
|
259
|
-
|
|
260
|
-
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
var didWarnStateUpdateForUnmountedComponent = {};
|
|
265
|
-
|
|
266
|
-
function warnNoop(publicInstance, callerName) {
|
|
267
|
-
{
|
|
268
|
-
var _constructor = publicInstance.constructor;
|
|
269
|
-
var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
|
|
270
|
-
var warningKey = componentName + "." + callerName;
|
|
271
|
-
|
|
272
|
-
if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
|
|
273
|
-
return;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
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);
|
|
277
|
-
|
|
278
|
-
didWarnStateUpdateForUnmountedComponent[warningKey] = true;
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
/**
|
|
282
|
-
* This is the abstract API for an update queue.
|
|
283
|
-
*/
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
var ReactNoopUpdateQueue = {
|
|
287
|
-
/**
|
|
288
|
-
* Checks whether or not this composite component is mounted.
|
|
289
|
-
* @param {ReactClass} publicInstance The instance we want to test.
|
|
290
|
-
* @return {boolean} True if mounted, false otherwise.
|
|
291
|
-
* @protected
|
|
292
|
-
* @final
|
|
293
|
-
*/
|
|
294
|
-
isMounted: function (publicInstance) {
|
|
295
|
-
return false;
|
|
296
|
-
},
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* Forces an update. This should only be invoked when it is known with
|
|
300
|
-
* certainty that we are **not** in a DOM transaction.
|
|
301
|
-
*
|
|
302
|
-
* You may want to call this when you know that some deeper aspect of the
|
|
303
|
-
* component's state has changed but `setState` was not called.
|
|
304
|
-
*
|
|
305
|
-
* This will not invoke `shouldComponentUpdate`, but it will invoke
|
|
306
|
-
* `componentWillUpdate` and `componentDidUpdate`.
|
|
307
|
-
*
|
|
308
|
-
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
309
|
-
* @param {?function} callback Called after component is updated.
|
|
310
|
-
* @param {?string} callerName name of the calling function in the public API.
|
|
311
|
-
* @internal
|
|
312
|
-
*/
|
|
313
|
-
enqueueForceUpdate: function (publicInstance, callback, callerName) {
|
|
314
|
-
warnNoop(publicInstance, 'forceUpdate');
|
|
315
|
-
},
|
|
316
|
-
|
|
317
|
-
/**
|
|
318
|
-
* Replaces all of the state. Always use this or `setState` to mutate state.
|
|
319
|
-
* You should treat `this.state` as immutable.
|
|
320
|
-
*
|
|
321
|
-
* There is no guarantee that `this.state` will be immediately updated, so
|
|
322
|
-
* accessing `this.state` after calling this method may return the old value.
|
|
323
|
-
*
|
|
324
|
-
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
325
|
-
* @param {object} completeState Next state.
|
|
326
|
-
* @param {?function} callback Called after component is updated.
|
|
327
|
-
* @param {?string} callerName name of the calling function in the public API.
|
|
328
|
-
* @internal
|
|
329
|
-
*/
|
|
330
|
-
enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
|
|
331
|
-
warnNoop(publicInstance, 'replaceState');
|
|
332
|
-
},
|
|
333
|
-
|
|
334
|
-
/**
|
|
335
|
-
* Sets a subset of the state. This only exists because _pendingState is
|
|
336
|
-
* internal. This provides a merging strategy that is not available to deep
|
|
337
|
-
* properties which is confusing. TODO: Expose pendingState or don't use it
|
|
338
|
-
* during the merge.
|
|
339
|
-
*
|
|
340
|
-
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
341
|
-
* @param {object} partialState Next partial state to be merged with state.
|
|
342
|
-
* @param {?function} callback Called after component is updated.
|
|
343
|
-
* @param {?string} Name of the calling function in the public API.
|
|
344
|
-
* @internal
|
|
345
|
-
*/
|
|
346
|
-
enqueueSetState: function (publicInstance, partialState, callback, callerName) {
|
|
347
|
-
warnNoop(publicInstance, 'setState');
|
|
348
|
-
}
|
|
349
|
-
};
|
|
350
|
-
|
|
351
|
-
var assign = Object.assign;
|
|
352
|
-
|
|
353
|
-
var emptyObject = {};
|
|
354
|
-
|
|
355
|
-
{
|
|
356
|
-
Object.freeze(emptyObject);
|
|
357
|
-
}
|
|
358
|
-
/**
|
|
359
|
-
* Base class helpers for the updating state of a component.
|
|
360
|
-
*/
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
function Component(props, context, updater) {
|
|
364
|
-
this.props = props;
|
|
365
|
-
this.context = context; // If a component has string refs, we will assign a different object later.
|
|
366
|
-
|
|
367
|
-
this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the
|
|
368
|
-
// renderer.
|
|
369
|
-
|
|
370
|
-
this.updater = updater || ReactNoopUpdateQueue;
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
Component.prototype.isReactComponent = {};
|
|
374
|
-
/**
|
|
375
|
-
* Sets a subset of the state. Always use this to mutate
|
|
376
|
-
* state. You should treat `this.state` as immutable.
|
|
377
|
-
*
|
|
378
|
-
* There is no guarantee that `this.state` will be immediately updated, so
|
|
379
|
-
* accessing `this.state` after calling this method may return the old value.
|
|
380
|
-
*
|
|
381
|
-
* There is no guarantee that calls to `setState` will run synchronously,
|
|
382
|
-
* as they may eventually be batched together. You can provide an optional
|
|
383
|
-
* callback that will be executed when the call to setState is actually
|
|
384
|
-
* completed.
|
|
385
|
-
*
|
|
386
|
-
* When a function is provided to setState, it will be called at some point in
|
|
387
|
-
* the future (not synchronously). It will be called with the up to date
|
|
388
|
-
* component arguments (state, props, context). These values can be different
|
|
389
|
-
* from this.* because your function may be called after receiveProps but before
|
|
390
|
-
* shouldComponentUpdate, and this new state, props, and context will not yet be
|
|
391
|
-
* assigned to this.
|
|
392
|
-
*
|
|
393
|
-
* @param {object|function} partialState Next partial state or function to
|
|
394
|
-
* produce next partial state to be merged with current state.
|
|
395
|
-
* @param {?function} callback Called after state is updated.
|
|
396
|
-
* @final
|
|
397
|
-
* @protected
|
|
398
|
-
*/
|
|
399
|
-
|
|
400
|
-
Component.prototype.setState = function (partialState, callback) {
|
|
401
|
-
if (typeof partialState !== 'object' && typeof partialState !== 'function' && partialState != null) {
|
|
402
|
-
throw new Error('setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.');
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
this.updater.enqueueSetState(this, partialState, callback, 'setState');
|
|
406
|
-
};
|
|
407
|
-
/**
|
|
408
|
-
* Forces an update. This should only be invoked when it is known with
|
|
409
|
-
* certainty that we are **not** in a DOM transaction.
|
|
410
|
-
*
|
|
411
|
-
* You may want to call this when you know that some deeper aspect of the
|
|
412
|
-
* component's state has changed but `setState` was not called.
|
|
413
|
-
*
|
|
414
|
-
* This will not invoke `shouldComponentUpdate`, but it will invoke
|
|
415
|
-
* `componentWillUpdate` and `componentDidUpdate`.
|
|
416
|
-
*
|
|
417
|
-
* @param {?function} callback Called after update is complete.
|
|
418
|
-
* @final
|
|
419
|
-
* @protected
|
|
420
|
-
*/
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
Component.prototype.forceUpdate = function (callback) {
|
|
424
|
-
this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
|
|
425
|
-
};
|
|
426
|
-
/**
|
|
427
|
-
* Deprecated APIs. These APIs used to exist on classic React classes but since
|
|
428
|
-
* we would like to deprecate them, we're not going to move them over to this
|
|
429
|
-
* modern base class. Instead, we define a getter that warns if it's accessed.
|
|
430
|
-
*/
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
{
|
|
434
|
-
var deprecatedAPIs = {
|
|
435
|
-
isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
|
|
436
|
-
replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
|
|
437
|
-
};
|
|
438
|
-
|
|
439
|
-
var defineDeprecationWarning = function (methodName, info) {
|
|
440
|
-
Object.defineProperty(Component.prototype, methodName, {
|
|
441
|
-
get: function () {
|
|
442
|
-
warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
|
|
443
|
-
|
|
444
|
-
return undefined;
|
|
445
|
-
}
|
|
446
|
-
});
|
|
447
|
-
};
|
|
448
|
-
|
|
449
|
-
for (var fnName in deprecatedAPIs) {
|
|
450
|
-
if (deprecatedAPIs.hasOwnProperty(fnName)) {
|
|
451
|
-
defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
function ComponentDummy() {}
|
|
457
|
-
|
|
458
|
-
ComponentDummy.prototype = Component.prototype;
|
|
459
|
-
/**
|
|
460
|
-
* Convenience component with default shallow equality check for sCU.
|
|
461
|
-
*/
|
|
462
|
-
|
|
463
|
-
function PureComponent(props, context, updater) {
|
|
464
|
-
this.props = props;
|
|
465
|
-
this.context = context; // If a component has string refs, we will assign a different object later.
|
|
466
|
-
|
|
467
|
-
this.refs = emptyObject;
|
|
468
|
-
this.updater = updater || ReactNoopUpdateQueue;
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
|
|
472
|
-
pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods.
|
|
473
|
-
|
|
474
|
-
assign(pureComponentPrototype, Component.prototype);
|
|
475
|
-
pureComponentPrototype.isPureReactComponent = true;
|
|
476
|
-
|
|
477
|
-
// an immutable object with a single mutable value
|
|
478
|
-
function createRef() {
|
|
479
|
-
var refObject = {
|
|
480
|
-
current: null
|
|
481
|
-
};
|
|
482
|
-
|
|
483
|
-
{
|
|
484
|
-
Object.seal(refObject);
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
return refObject;
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
|
|
491
|
-
|
|
492
|
-
function isArray(a) {
|
|
493
|
-
return isArrayImpl(a);
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
/*
|
|
497
|
-
* The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol
|
|
498
|
-
* and Temporal.* types. See https://github.com/facebook/react/pull/22064.
|
|
499
|
-
*
|
|
500
|
-
* The functions in this module will throw an easier-to-understand,
|
|
501
|
-
* easier-to-debug exception with a clear errors message message explaining the
|
|
502
|
-
* problem. (Instead of a confusing exception thrown inside the implementation
|
|
503
|
-
* of the `value` object).
|
|
504
|
-
*/
|
|
505
|
-
// $FlowFixMe only called in DEV, so void return is not possible.
|
|
506
|
-
function typeName(value) {
|
|
507
|
-
{
|
|
508
|
-
// toStringTag is needed for namespaced types like Temporal.Instant
|
|
509
|
-
var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
|
|
510
|
-
var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
|
|
511
|
-
return type;
|
|
512
|
-
}
|
|
513
|
-
} // $FlowFixMe only called in DEV, so void return is not possible.
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
function willCoercionThrow(value) {
|
|
517
|
-
{
|
|
518
|
-
try {
|
|
519
|
-
testStringCoercion(value);
|
|
520
|
-
return false;
|
|
521
|
-
} catch (e) {
|
|
522
|
-
return true;
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
function testStringCoercion(value) {
|
|
528
|
-
// If you ended up here by following an exception call stack, here's what's
|
|
529
|
-
// happened: you supplied an object or symbol value to React (as a prop, key,
|
|
530
|
-
// DOM attribute, CSS property, string ref, etc.) and when React tried to
|
|
531
|
-
// coerce it to a string using `'' + value`, an exception was thrown.
|
|
532
|
-
//
|
|
533
|
-
// The most common types that will cause this exception are `Symbol` instances
|
|
534
|
-
// and Temporal objects like `Temporal.Instant`. But any object that has a
|
|
535
|
-
// `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
|
|
536
|
-
// exception. (Library authors do this to prevent users from using built-in
|
|
537
|
-
// numeric operators like `+` or comparison operators like `>=` because custom
|
|
538
|
-
// methods are needed to perform accurate arithmetic or comparison.)
|
|
539
|
-
//
|
|
540
|
-
// To fix the problem, coerce this object or symbol value to a string before
|
|
541
|
-
// passing it to React. The most reliable way is usually `String(value)`.
|
|
542
|
-
//
|
|
543
|
-
// To find which value is throwing, check the browser or debugger console.
|
|
544
|
-
// Before this exception was thrown, there should be `console.error` output
|
|
545
|
-
// that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
|
|
546
|
-
// problem and how that type was used: key, atrribute, input value prop, etc.
|
|
547
|
-
// In most cases, this console output also shows the component and its
|
|
548
|
-
// ancestor components where the exception happened.
|
|
549
|
-
//
|
|
550
|
-
// eslint-disable-next-line react-internal/safe-string-coercion
|
|
551
|
-
return '' + value;
|
|
552
|
-
}
|
|
553
|
-
function checkKeyStringCoercion(value) {
|
|
554
|
-
{
|
|
555
|
-
if (willCoercionThrow(value)) {
|
|
556
|
-
error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
|
|
557
|
-
|
|
558
|
-
return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
function getWrappedName(outerType, innerType, wrapperName) {
|
|
564
|
-
var displayName = outerType.displayName;
|
|
565
|
-
|
|
566
|
-
if (displayName) {
|
|
567
|
-
return displayName;
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
var functionName = innerType.displayName || innerType.name || '';
|
|
571
|
-
return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
|
|
572
|
-
} // Keep in sync with react-reconciler/getComponentNameFromFiber
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
function getContextName(type) {
|
|
576
|
-
return type.displayName || 'Context';
|
|
577
|
-
} // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
function getComponentNameFromType(type) {
|
|
581
|
-
if (type == null) {
|
|
582
|
-
// Host root, text node or just invalid type.
|
|
583
|
-
return null;
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
{
|
|
587
|
-
if (typeof type.tag === 'number') {
|
|
588
|
-
error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
if (typeof type === 'function') {
|
|
593
|
-
return type.displayName || type.name || null;
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
if (typeof type === 'string') {
|
|
597
|
-
return type;
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
switch (type) {
|
|
601
|
-
case REACT_FRAGMENT_TYPE:
|
|
602
|
-
return 'Fragment';
|
|
603
|
-
|
|
604
|
-
case REACT_PORTAL_TYPE:
|
|
605
|
-
return 'Portal';
|
|
606
|
-
|
|
607
|
-
case REACT_PROFILER_TYPE:
|
|
608
|
-
return 'Profiler';
|
|
609
|
-
|
|
610
|
-
case REACT_STRICT_MODE_TYPE:
|
|
611
|
-
return 'StrictMode';
|
|
612
|
-
|
|
613
|
-
case REACT_SUSPENSE_TYPE:
|
|
614
|
-
return 'Suspense';
|
|
615
|
-
|
|
616
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
617
|
-
return 'SuspenseList';
|
|
618
|
-
|
|
619
|
-
}
|
|
620
|
-
|
|
621
|
-
if (typeof type === 'object') {
|
|
622
|
-
switch (type.$$typeof) {
|
|
623
|
-
case REACT_CONTEXT_TYPE:
|
|
624
|
-
var context = type;
|
|
625
|
-
return getContextName(context) + '.Consumer';
|
|
626
|
-
|
|
627
|
-
case REACT_PROVIDER_TYPE:
|
|
628
|
-
var provider = type;
|
|
629
|
-
return getContextName(provider._context) + '.Provider';
|
|
630
|
-
|
|
631
|
-
case REACT_FORWARD_REF_TYPE:
|
|
632
|
-
return getWrappedName(type, type.render, 'ForwardRef');
|
|
633
|
-
|
|
634
|
-
case REACT_MEMO_TYPE:
|
|
635
|
-
var outerName = type.displayName || null;
|
|
636
|
-
|
|
637
|
-
if (outerName !== null) {
|
|
638
|
-
return outerName;
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
return getComponentNameFromType(type.type) || 'Memo';
|
|
642
|
-
|
|
643
|
-
case REACT_LAZY_TYPE:
|
|
644
|
-
{
|
|
645
|
-
var lazyComponent = type;
|
|
646
|
-
var payload = lazyComponent._payload;
|
|
647
|
-
var init = lazyComponent._init;
|
|
648
|
-
|
|
649
|
-
try {
|
|
650
|
-
return getComponentNameFromType(init(payload));
|
|
651
|
-
} catch (x) {
|
|
652
|
-
return null;
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
// eslint-disable-next-line no-fallthrough
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
return null;
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
664
|
-
|
|
665
|
-
var RESERVED_PROPS = {
|
|
666
|
-
key: true,
|
|
667
|
-
ref: true,
|
|
668
|
-
__self: true,
|
|
669
|
-
__source: true
|
|
670
|
-
};
|
|
671
|
-
var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs;
|
|
672
|
-
|
|
673
|
-
{
|
|
674
|
-
didWarnAboutStringRefs = {};
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
function hasValidRef(config) {
|
|
678
|
-
{
|
|
679
|
-
if (hasOwnProperty.call(config, 'ref')) {
|
|
680
|
-
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
|
|
681
|
-
|
|
682
|
-
if (getter && getter.isReactWarning) {
|
|
683
|
-
return false;
|
|
684
|
-
}
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
return config.ref !== undefined;
|
|
689
|
-
}
|
|
690
|
-
|
|
691
|
-
function hasValidKey(config) {
|
|
692
|
-
{
|
|
693
|
-
if (hasOwnProperty.call(config, 'key')) {
|
|
694
|
-
var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
|
|
695
|
-
|
|
696
|
-
if (getter && getter.isReactWarning) {
|
|
697
|
-
return false;
|
|
698
|
-
}
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
return config.key !== undefined;
|
|
703
|
-
}
|
|
704
|
-
|
|
705
|
-
function defineKeyPropWarningGetter(props, displayName) {
|
|
706
|
-
var warnAboutAccessingKey = function () {
|
|
707
|
-
{
|
|
708
|
-
if (!specialPropKeyWarningShown) {
|
|
709
|
-
specialPropKeyWarningShown = true;
|
|
710
|
-
|
|
711
|
-
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);
|
|
712
|
-
}
|
|
713
|
-
}
|
|
714
|
-
};
|
|
715
|
-
|
|
716
|
-
warnAboutAccessingKey.isReactWarning = true;
|
|
717
|
-
Object.defineProperty(props, 'key', {
|
|
718
|
-
get: warnAboutAccessingKey,
|
|
719
|
-
configurable: true
|
|
720
|
-
});
|
|
721
|
-
}
|
|
722
|
-
|
|
723
|
-
function defineRefPropWarningGetter(props, displayName) {
|
|
724
|
-
var warnAboutAccessingRef = function () {
|
|
725
|
-
{
|
|
726
|
-
if (!specialPropRefWarningShown) {
|
|
727
|
-
specialPropRefWarningShown = true;
|
|
728
|
-
|
|
729
|
-
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);
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
};
|
|
733
|
-
|
|
734
|
-
warnAboutAccessingRef.isReactWarning = true;
|
|
735
|
-
Object.defineProperty(props, 'ref', {
|
|
736
|
-
get: warnAboutAccessingRef,
|
|
737
|
-
configurable: true
|
|
738
|
-
});
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
function warnIfStringRefCannotBeAutoConverted(config) {
|
|
742
|
-
{
|
|
743
|
-
if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {
|
|
744
|
-
var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
|
|
745
|
-
|
|
746
|
-
if (!didWarnAboutStringRefs[componentName]) {
|
|
747
|
-
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);
|
|
748
|
-
|
|
749
|
-
didWarnAboutStringRefs[componentName] = true;
|
|
750
|
-
}
|
|
751
|
-
}
|
|
752
|
-
}
|
|
753
|
-
}
|
|
754
|
-
/**
|
|
755
|
-
* Factory method to create a new React element. This no longer adheres to
|
|
756
|
-
* the class pattern, so do not use new to call it. Also, instanceof check
|
|
757
|
-
* will not work. Instead test $$typeof field against Symbol.for('react.element') to check
|
|
758
|
-
* if something is a React Element.
|
|
759
|
-
*
|
|
760
|
-
* @param {*} type
|
|
761
|
-
* @param {*} props
|
|
762
|
-
* @param {*} key
|
|
763
|
-
* @param {string|object} ref
|
|
764
|
-
* @param {*} owner
|
|
765
|
-
* @param {*} self A *temporary* helper to detect places where `this` is
|
|
766
|
-
* different from the `owner` when React.createElement is called, so that we
|
|
767
|
-
* can warn. We want to get rid of owner and replace string `ref`s with arrow
|
|
768
|
-
* functions, and as long as `this` and owner are the same, there will be no
|
|
769
|
-
* change in behavior.
|
|
770
|
-
* @param {*} source An annotation object (added by a transpiler or otherwise)
|
|
771
|
-
* indicating filename, line number, and/or other information.
|
|
772
|
-
* @internal
|
|
773
|
-
*/
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
777
|
-
var element = {
|
|
778
|
-
// This tag allows us to uniquely identify this as a React Element
|
|
779
|
-
$$typeof: REACT_ELEMENT_TYPE,
|
|
780
|
-
// Built-in properties that belong on the element
|
|
781
|
-
type: type,
|
|
782
|
-
key: key,
|
|
783
|
-
ref: ref,
|
|
784
|
-
props: props,
|
|
785
|
-
// Record the component responsible for creating this element.
|
|
786
|
-
_owner: owner
|
|
787
|
-
};
|
|
788
|
-
|
|
789
|
-
{
|
|
790
|
-
// The validation flag is currently mutative. We put it on
|
|
791
|
-
// an external backing store so that we can freeze the whole object.
|
|
792
|
-
// This can be replaced with a WeakMap once they are implemented in
|
|
793
|
-
// commonly used development environments.
|
|
794
|
-
element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
|
|
795
|
-
// the validation flag non-enumerable (where possible, which should
|
|
796
|
-
// include every environment we run tests in), so the test framework
|
|
797
|
-
// ignores it.
|
|
798
|
-
|
|
799
|
-
Object.defineProperty(element._store, 'validated', {
|
|
800
|
-
configurable: false,
|
|
801
|
-
enumerable: false,
|
|
802
|
-
writable: true,
|
|
803
|
-
value: false
|
|
804
|
-
}); // self and source are DEV only properties.
|
|
805
|
-
|
|
806
|
-
Object.defineProperty(element, '_self', {
|
|
807
|
-
configurable: false,
|
|
808
|
-
enumerable: false,
|
|
809
|
-
writable: false,
|
|
810
|
-
value: self
|
|
811
|
-
}); // Two elements created in two different places should be considered
|
|
812
|
-
// equal for testing purposes and therefore we hide it from enumeration.
|
|
813
|
-
|
|
814
|
-
Object.defineProperty(element, '_source', {
|
|
815
|
-
configurable: false,
|
|
816
|
-
enumerable: false,
|
|
817
|
-
writable: false,
|
|
818
|
-
value: source
|
|
819
|
-
});
|
|
820
|
-
|
|
821
|
-
if (Object.freeze) {
|
|
822
|
-
Object.freeze(element.props);
|
|
823
|
-
Object.freeze(element);
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
|
|
827
|
-
return element;
|
|
828
|
-
};
|
|
829
|
-
/**
|
|
830
|
-
* Create and return a new ReactElement of the given type.
|
|
831
|
-
* See https://reactjs.org/docs/react-api.html#createelement
|
|
832
|
-
*/
|
|
833
|
-
|
|
834
|
-
function createElement(type, config, children) {
|
|
835
|
-
var propName; // Reserved names are extracted
|
|
836
|
-
|
|
837
|
-
var props = {};
|
|
838
|
-
var key = null;
|
|
839
|
-
var ref = null;
|
|
840
|
-
var self = null;
|
|
841
|
-
var source = null;
|
|
842
|
-
|
|
843
|
-
if (config != null) {
|
|
844
|
-
if (hasValidRef(config)) {
|
|
845
|
-
ref = config.ref;
|
|
846
|
-
|
|
847
|
-
{
|
|
848
|
-
warnIfStringRefCannotBeAutoConverted(config);
|
|
849
|
-
}
|
|
850
|
-
}
|
|
851
|
-
|
|
852
|
-
if (hasValidKey(config)) {
|
|
853
|
-
{
|
|
854
|
-
checkKeyStringCoercion(config.key);
|
|
855
|
-
}
|
|
856
|
-
|
|
857
|
-
key = '' + config.key;
|
|
858
|
-
}
|
|
859
|
-
|
|
860
|
-
self = config.__self === undefined ? null : config.__self;
|
|
861
|
-
source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object
|
|
862
|
-
|
|
863
|
-
for (propName in config) {
|
|
864
|
-
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
865
|
-
props[propName] = config[propName];
|
|
866
|
-
}
|
|
867
|
-
}
|
|
868
|
-
} // Children can be more than one argument, and those are transferred onto
|
|
869
|
-
// the newly allocated props object.
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
var childrenLength = arguments.length - 2;
|
|
873
|
-
|
|
874
|
-
if (childrenLength === 1) {
|
|
875
|
-
props.children = children;
|
|
876
|
-
} else if (childrenLength > 1) {
|
|
877
|
-
var childArray = Array(childrenLength);
|
|
878
|
-
|
|
879
|
-
for (var i = 0; i < childrenLength; i++) {
|
|
880
|
-
childArray[i] = arguments[i + 2];
|
|
881
|
-
}
|
|
882
|
-
|
|
883
|
-
{
|
|
884
|
-
if (Object.freeze) {
|
|
885
|
-
Object.freeze(childArray);
|
|
886
|
-
}
|
|
887
|
-
}
|
|
888
|
-
|
|
889
|
-
props.children = childArray;
|
|
890
|
-
} // Resolve default props
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
if (type && type.defaultProps) {
|
|
894
|
-
var defaultProps = type.defaultProps;
|
|
895
|
-
|
|
896
|
-
for (propName in defaultProps) {
|
|
897
|
-
if (props[propName] === undefined) {
|
|
898
|
-
props[propName] = defaultProps[propName];
|
|
899
|
-
}
|
|
900
|
-
}
|
|
901
|
-
}
|
|
902
|
-
|
|
903
|
-
{
|
|
904
|
-
if (key || ref) {
|
|
905
|
-
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
|
906
|
-
|
|
907
|
-
if (key) {
|
|
908
|
-
defineKeyPropWarningGetter(props, displayName);
|
|
909
|
-
}
|
|
910
|
-
|
|
911
|
-
if (ref) {
|
|
912
|
-
defineRefPropWarningGetter(props, displayName);
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
|
-
}
|
|
916
|
-
|
|
917
|
-
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
|
918
|
-
}
|
|
919
|
-
function cloneAndReplaceKey(oldElement, newKey) {
|
|
920
|
-
var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
|
|
921
|
-
return newElement;
|
|
922
|
-
}
|
|
923
|
-
/**
|
|
924
|
-
* Clone and return a new ReactElement using element as the starting point.
|
|
925
|
-
* See https://reactjs.org/docs/react-api.html#cloneelement
|
|
926
|
-
*/
|
|
927
|
-
|
|
928
|
-
function cloneElement(element, config, children) {
|
|
929
|
-
if (element === null || element === undefined) {
|
|
930
|
-
throw new Error("React.cloneElement(...): The argument must be a React element, but you passed " + element + ".");
|
|
931
|
-
}
|
|
932
|
-
|
|
933
|
-
var propName; // Original props are copied
|
|
934
|
-
|
|
935
|
-
var props = assign({}, element.props); // Reserved names are extracted
|
|
936
|
-
|
|
937
|
-
var key = element.key;
|
|
938
|
-
var ref = element.ref; // Self is preserved since the owner is preserved.
|
|
939
|
-
|
|
940
|
-
var self = element._self; // Source is preserved since cloneElement is unlikely to be targeted by a
|
|
941
|
-
// transpiler, and the original source is probably a better indicator of the
|
|
942
|
-
// true owner.
|
|
943
|
-
|
|
944
|
-
var source = element._source; // Owner will be preserved, unless ref is overridden
|
|
945
|
-
|
|
946
|
-
var owner = element._owner;
|
|
947
|
-
|
|
948
|
-
if (config != null) {
|
|
949
|
-
if (hasValidRef(config)) {
|
|
950
|
-
// Silently steal the ref from the parent.
|
|
951
|
-
ref = config.ref;
|
|
952
|
-
owner = ReactCurrentOwner.current;
|
|
953
|
-
}
|
|
954
|
-
|
|
955
|
-
if (hasValidKey(config)) {
|
|
956
|
-
{
|
|
957
|
-
checkKeyStringCoercion(config.key);
|
|
958
|
-
}
|
|
959
|
-
|
|
960
|
-
key = '' + config.key;
|
|
961
|
-
} // Remaining properties override existing props
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
var defaultProps;
|
|
965
|
-
|
|
966
|
-
if (element.type && element.type.defaultProps) {
|
|
967
|
-
defaultProps = element.type.defaultProps;
|
|
968
|
-
}
|
|
969
|
-
|
|
970
|
-
for (propName in config) {
|
|
971
|
-
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
972
|
-
if (config[propName] === undefined && defaultProps !== undefined) {
|
|
973
|
-
// Resolve default props
|
|
974
|
-
props[propName] = defaultProps[propName];
|
|
975
|
-
} else {
|
|
976
|
-
props[propName] = config[propName];
|
|
977
|
-
}
|
|
978
|
-
}
|
|
979
|
-
}
|
|
980
|
-
} // Children can be more than one argument, and those are transferred onto
|
|
981
|
-
// the newly allocated props object.
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
var childrenLength = arguments.length - 2;
|
|
985
|
-
|
|
986
|
-
if (childrenLength === 1) {
|
|
987
|
-
props.children = children;
|
|
988
|
-
} else if (childrenLength > 1) {
|
|
989
|
-
var childArray = Array(childrenLength);
|
|
990
|
-
|
|
991
|
-
for (var i = 0; i < childrenLength; i++) {
|
|
992
|
-
childArray[i] = arguments[i + 2];
|
|
993
|
-
}
|
|
994
|
-
|
|
995
|
-
props.children = childArray;
|
|
996
|
-
}
|
|
997
|
-
|
|
998
|
-
return ReactElement(element.type, key, ref, self, source, owner, props);
|
|
999
|
-
}
|
|
1000
|
-
/**
|
|
1001
|
-
* Verifies the object is a ReactElement.
|
|
1002
|
-
* See https://reactjs.org/docs/react-api.html#isvalidelement
|
|
1003
|
-
* @param {?object} object
|
|
1004
|
-
* @return {boolean} True if `object` is a ReactElement.
|
|
1005
|
-
* @final
|
|
1006
|
-
*/
|
|
1007
|
-
|
|
1008
|
-
function isValidElement(object) {
|
|
1009
|
-
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
1010
|
-
}
|
|
1011
|
-
|
|
1012
|
-
var SEPARATOR = '.';
|
|
1013
|
-
var SUBSEPARATOR = ':';
|
|
1014
|
-
/**
|
|
1015
|
-
* Escape and wrap key so it is safe to use as a reactid
|
|
1016
|
-
*
|
|
1017
|
-
* @param {string} key to be escaped.
|
|
1018
|
-
* @return {string} the escaped key.
|
|
1019
|
-
*/
|
|
1020
|
-
|
|
1021
|
-
function escape(key) {
|
|
1022
|
-
var escapeRegex = /[=:]/g;
|
|
1023
|
-
var escaperLookup = {
|
|
1024
|
-
'=': '=0',
|
|
1025
|
-
':': '=2'
|
|
1026
|
-
};
|
|
1027
|
-
var escapedString = key.replace(escapeRegex, function (match) {
|
|
1028
|
-
return escaperLookup[match];
|
|
1029
|
-
});
|
|
1030
|
-
return '$' + escapedString;
|
|
1031
|
-
}
|
|
1032
|
-
/**
|
|
1033
|
-
* TODO: Test that a single child and an array with one item have the same key
|
|
1034
|
-
* pattern.
|
|
1035
|
-
*/
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
var didWarnAboutMaps = false;
|
|
1039
|
-
var userProvidedKeyEscapeRegex = /\/+/g;
|
|
1040
|
-
|
|
1041
|
-
function escapeUserProvidedKey(text) {
|
|
1042
|
-
return text.replace(userProvidedKeyEscapeRegex, '$&/');
|
|
1043
|
-
}
|
|
1044
|
-
/**
|
|
1045
|
-
* Generate a key string that identifies a element within a set.
|
|
1046
|
-
*
|
|
1047
|
-
* @param {*} element A element that could contain a manual key.
|
|
1048
|
-
* @param {number} index Index that is used if a manual key is not provided.
|
|
1049
|
-
* @return {string}
|
|
1050
|
-
*/
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
function getElementKey(element, index) {
|
|
1054
|
-
// Do some typechecking here since we call this blindly. We want to ensure
|
|
1055
|
-
// that we don't block potential future ES APIs.
|
|
1056
|
-
if (typeof element === 'object' && element !== null && element.key != null) {
|
|
1057
|
-
// Explicit key
|
|
1058
|
-
{
|
|
1059
|
-
checkKeyStringCoercion(element.key);
|
|
1060
|
-
}
|
|
1061
|
-
|
|
1062
|
-
return escape('' + element.key);
|
|
1063
|
-
} // Implicit key determined by the index in the set
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
return index.toString(36);
|
|
1067
|
-
}
|
|
1068
|
-
|
|
1069
|
-
function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
|
|
1070
|
-
var type = typeof children;
|
|
1071
|
-
|
|
1072
|
-
if (type === 'undefined' || type === 'boolean') {
|
|
1073
|
-
// All of the above are perceived as null.
|
|
1074
|
-
children = null;
|
|
1075
|
-
}
|
|
1076
|
-
|
|
1077
|
-
var invokeCallback = false;
|
|
1078
|
-
|
|
1079
|
-
if (children === null) {
|
|
1080
|
-
invokeCallback = true;
|
|
1081
|
-
} else {
|
|
1082
|
-
switch (type) {
|
|
1083
|
-
case 'string':
|
|
1084
|
-
case 'number':
|
|
1085
|
-
invokeCallback = true;
|
|
1086
|
-
break;
|
|
1087
|
-
|
|
1088
|
-
case 'object':
|
|
1089
|
-
switch (children.$$typeof) {
|
|
1090
|
-
case REACT_ELEMENT_TYPE:
|
|
1091
|
-
case REACT_PORTAL_TYPE:
|
|
1092
|
-
invokeCallback = true;
|
|
1093
|
-
}
|
|
1094
|
-
|
|
1095
|
-
}
|
|
1096
|
-
}
|
|
1097
|
-
|
|
1098
|
-
if (invokeCallback) {
|
|
1099
|
-
var _child = children;
|
|
1100
|
-
var mappedChild = callback(_child); // If it's the only child, treat the name as if it was wrapped in an array
|
|
1101
|
-
// so that it's consistent if the number of children grows:
|
|
1102
|
-
|
|
1103
|
-
var childKey = nameSoFar === '' ? SEPARATOR + getElementKey(_child, 0) : nameSoFar;
|
|
1104
|
-
|
|
1105
|
-
if (isArray(mappedChild)) {
|
|
1106
|
-
var escapedChildKey = '';
|
|
1107
|
-
|
|
1108
|
-
if (childKey != null) {
|
|
1109
|
-
escapedChildKey = escapeUserProvidedKey(childKey) + '/';
|
|
1110
|
-
}
|
|
1111
|
-
|
|
1112
|
-
mapIntoArray(mappedChild, array, escapedChildKey, '', function (c) {
|
|
1113
|
-
return c;
|
|
1114
|
-
});
|
|
1115
|
-
} else if (mappedChild != null) {
|
|
1116
|
-
if (isValidElement(mappedChild)) {
|
|
1117
|
-
{
|
|
1118
|
-
// The `if` statement here prevents auto-disabling of the safe
|
|
1119
|
-
// coercion ESLint rule, so we must manually disable it below.
|
|
1120
|
-
// $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
|
|
1121
|
-
if (mappedChild.key && (!_child || _child.key !== mappedChild.key)) {
|
|
1122
|
-
checkKeyStringCoercion(mappedChild.key);
|
|
1123
|
-
}
|
|
1124
|
-
}
|
|
1125
|
-
|
|
1126
|
-
mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as
|
|
1127
|
-
// traverseAllChildren used to do for objects as children
|
|
1128
|
-
escapedPrefix + ( // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
|
|
1129
|
-
mappedChild.key && (!_child || _child.key !== mappedChild.key) ? // $FlowFixMe Flow incorrectly thinks existing element's key can be a number
|
|
1130
|
-
// eslint-disable-next-line react-internal/safe-string-coercion
|
|
1131
|
-
escapeUserProvidedKey('' + mappedChild.key) + '/' : '') + childKey);
|
|
1132
|
-
}
|
|
1133
|
-
|
|
1134
|
-
array.push(mappedChild);
|
|
1135
|
-
}
|
|
1136
|
-
|
|
1137
|
-
return 1;
|
|
1138
|
-
}
|
|
1139
|
-
|
|
1140
|
-
var child;
|
|
1141
|
-
var nextName;
|
|
1142
|
-
var subtreeCount = 0; // Count of children found in the current subtree.
|
|
1143
|
-
|
|
1144
|
-
var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
|
|
1145
|
-
|
|
1146
|
-
if (isArray(children)) {
|
|
1147
|
-
for (var i = 0; i < children.length; i++) {
|
|
1148
|
-
child = children[i];
|
|
1149
|
-
nextName = nextNamePrefix + getElementKey(child, i);
|
|
1150
|
-
subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
|
|
1151
|
-
}
|
|
1152
|
-
} else {
|
|
1153
|
-
var iteratorFn = getIteratorFn(children);
|
|
1154
|
-
|
|
1155
|
-
if (typeof iteratorFn === 'function') {
|
|
1156
|
-
var iterableChildren = children;
|
|
1157
|
-
|
|
1158
|
-
{
|
|
1159
|
-
// Warn about using Maps as children
|
|
1160
|
-
if (iteratorFn === iterableChildren.entries) {
|
|
1161
|
-
if (!didWarnAboutMaps) {
|
|
1162
|
-
warn('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.');
|
|
1163
|
-
}
|
|
1164
|
-
|
|
1165
|
-
didWarnAboutMaps = true;
|
|
1166
|
-
}
|
|
1167
|
-
}
|
|
1168
|
-
|
|
1169
|
-
var iterator = iteratorFn.call(iterableChildren);
|
|
1170
|
-
var step;
|
|
1171
|
-
var ii = 0;
|
|
1172
|
-
|
|
1173
|
-
while (!(step = iterator.next()).done) {
|
|
1174
|
-
child = step.value;
|
|
1175
|
-
nextName = nextNamePrefix + getElementKey(child, ii++);
|
|
1176
|
-
subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
|
|
1177
|
-
}
|
|
1178
|
-
} else if (type === 'object') {
|
|
1179
|
-
// eslint-disable-next-line react-internal/safe-string-coercion
|
|
1180
|
-
var childrenString = String(children);
|
|
1181
|
-
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.');
|
|
1182
|
-
}
|
|
1183
|
-
}
|
|
1184
|
-
|
|
1185
|
-
return subtreeCount;
|
|
1186
|
-
}
|
|
1187
|
-
|
|
1188
|
-
/**
|
|
1189
|
-
* Maps children that are typically specified as `props.children`.
|
|
1190
|
-
*
|
|
1191
|
-
* See https://reactjs.org/docs/react-api.html#reactchildrenmap
|
|
1192
|
-
*
|
|
1193
|
-
* The provided mapFunction(child, index) will be called for each
|
|
1194
|
-
* leaf child.
|
|
1195
|
-
*
|
|
1196
|
-
* @param {?*} children Children tree container.
|
|
1197
|
-
* @param {function(*, int)} func The map function.
|
|
1198
|
-
* @param {*} context Context for mapFunction.
|
|
1199
|
-
* @return {object} Object containing the ordered map of results.
|
|
1200
|
-
*/
|
|
1201
|
-
function mapChildren(children, func, context) {
|
|
1202
|
-
if (children == null) {
|
|
1203
|
-
return children;
|
|
1204
|
-
}
|
|
1205
|
-
|
|
1206
|
-
var result = [];
|
|
1207
|
-
var count = 0;
|
|
1208
|
-
mapIntoArray(children, result, '', '', function (child) {
|
|
1209
|
-
return func.call(context, child, count++);
|
|
1210
|
-
});
|
|
1211
|
-
return result;
|
|
1212
|
-
}
|
|
1213
|
-
/**
|
|
1214
|
-
* Count the number of children that are typically specified as
|
|
1215
|
-
* `props.children`.
|
|
1216
|
-
*
|
|
1217
|
-
* See https://reactjs.org/docs/react-api.html#reactchildrencount
|
|
1218
|
-
*
|
|
1219
|
-
* @param {?*} children Children tree container.
|
|
1220
|
-
* @return {number} The number of children.
|
|
1221
|
-
*/
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
function countChildren(children) {
|
|
1225
|
-
var n = 0;
|
|
1226
|
-
mapChildren(children, function () {
|
|
1227
|
-
n++; // Don't return anything
|
|
1228
|
-
});
|
|
1229
|
-
return n;
|
|
1230
|
-
}
|
|
1231
|
-
|
|
1232
|
-
/**
|
|
1233
|
-
* Iterates through children that are typically specified as `props.children`.
|
|
1234
|
-
*
|
|
1235
|
-
* See https://reactjs.org/docs/react-api.html#reactchildrenforeach
|
|
1236
|
-
*
|
|
1237
|
-
* The provided forEachFunc(child, index) will be called for each
|
|
1238
|
-
* leaf child.
|
|
1239
|
-
*
|
|
1240
|
-
* @param {?*} children Children tree container.
|
|
1241
|
-
* @param {function(*, int)} forEachFunc
|
|
1242
|
-
* @param {*} forEachContext Context for forEachContext.
|
|
1243
|
-
*/
|
|
1244
|
-
function forEachChildren(children, forEachFunc, forEachContext) {
|
|
1245
|
-
mapChildren(children, function () {
|
|
1246
|
-
forEachFunc.apply(this, arguments); // Don't return anything.
|
|
1247
|
-
}, forEachContext);
|
|
1248
|
-
}
|
|
1249
|
-
/**
|
|
1250
|
-
* Flatten a children object (typically specified as `props.children`) and
|
|
1251
|
-
* return an array with appropriately re-keyed children.
|
|
1252
|
-
*
|
|
1253
|
-
* See https://reactjs.org/docs/react-api.html#reactchildrentoarray
|
|
1254
|
-
*/
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
function toArray(children) {
|
|
1258
|
-
return mapChildren(children, function (child) {
|
|
1259
|
-
return child;
|
|
1260
|
-
}) || [];
|
|
1261
|
-
}
|
|
1262
|
-
/**
|
|
1263
|
-
* Returns the first child in a collection of children and verifies that there
|
|
1264
|
-
* is only one child in the collection.
|
|
1265
|
-
*
|
|
1266
|
-
* See https://reactjs.org/docs/react-api.html#reactchildrenonly
|
|
1267
|
-
*
|
|
1268
|
-
* The current implementation of this function assumes that a single child gets
|
|
1269
|
-
* passed without a wrapper, but the purpose of this helper function is to
|
|
1270
|
-
* abstract away the particular structure of children.
|
|
1271
|
-
*
|
|
1272
|
-
* @param {?object} children Child collection structure.
|
|
1273
|
-
* @return {ReactElement} The first and only `ReactElement` contained in the
|
|
1274
|
-
* structure.
|
|
1275
|
-
*/
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
function onlyChild(children) {
|
|
1279
|
-
if (!isValidElement(children)) {
|
|
1280
|
-
throw new Error('React.Children.only expected to receive a single React element child.');
|
|
1281
|
-
}
|
|
1282
|
-
|
|
1283
|
-
return children;
|
|
1284
|
-
}
|
|
1285
|
-
|
|
1286
|
-
function createContext(defaultValue) {
|
|
1287
|
-
// TODO: Second argument used to be an optional `calculateChangedBits`
|
|
1288
|
-
// function. Warn to reserve for future use?
|
|
1289
|
-
var context = {
|
|
1290
|
-
$$typeof: REACT_CONTEXT_TYPE,
|
|
1291
|
-
// As a workaround to support multiple concurrent renderers, we categorize
|
|
1292
|
-
// some renderers as primary and others as secondary. We only expect
|
|
1293
|
-
// there to be two concurrent renderers at most: React Native (primary) and
|
|
1294
|
-
// Fabric (secondary); React DOM (primary) and React ART (secondary).
|
|
1295
|
-
// Secondary renderers store their context values on separate fields.
|
|
1296
|
-
_currentValue: defaultValue,
|
|
1297
|
-
_currentValue2: defaultValue,
|
|
1298
|
-
// Used to track how many concurrent renderers this context currently
|
|
1299
|
-
// supports within in a single renderer. Such as parallel server rendering.
|
|
1300
|
-
_threadCount: 0,
|
|
1301
|
-
// These are circular
|
|
1302
|
-
Provider: null,
|
|
1303
|
-
Consumer: null,
|
|
1304
|
-
// Add these to use same hidden class in VM as ServerContext
|
|
1305
|
-
_defaultValue: null,
|
|
1306
|
-
_globalName: null
|
|
1307
|
-
};
|
|
1308
|
-
context.Provider = {
|
|
1309
|
-
$$typeof: REACT_PROVIDER_TYPE,
|
|
1310
|
-
_context: context
|
|
1311
|
-
};
|
|
1312
|
-
var hasWarnedAboutUsingNestedContextConsumers = false;
|
|
1313
|
-
var hasWarnedAboutUsingConsumerProvider = false;
|
|
1314
|
-
var hasWarnedAboutDisplayNameOnConsumer = false;
|
|
1315
|
-
|
|
1316
|
-
{
|
|
1317
|
-
// A separate object, but proxies back to the original context object for
|
|
1318
|
-
// backwards compatibility. It has a different $$typeof, so we can properly
|
|
1319
|
-
// warn for the incorrect usage of Context as a Consumer.
|
|
1320
|
-
var Consumer = {
|
|
1321
|
-
$$typeof: REACT_CONTEXT_TYPE,
|
|
1322
|
-
_context: context
|
|
1323
|
-
}; // $FlowFixMe: Flow complains about not setting a value, which is intentional here
|
|
1324
|
-
|
|
1325
|
-
Object.defineProperties(Consumer, {
|
|
1326
|
-
Provider: {
|
|
1327
|
-
get: function () {
|
|
1328
|
-
if (!hasWarnedAboutUsingConsumerProvider) {
|
|
1329
|
-
hasWarnedAboutUsingConsumerProvider = true;
|
|
1330
|
-
|
|
1331
|
-
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?');
|
|
1332
|
-
}
|
|
1333
|
-
|
|
1334
|
-
return context.Provider;
|
|
1335
|
-
},
|
|
1336
|
-
set: function (_Provider) {
|
|
1337
|
-
context.Provider = _Provider;
|
|
1338
|
-
}
|
|
1339
|
-
},
|
|
1340
|
-
_currentValue: {
|
|
1341
|
-
get: function () {
|
|
1342
|
-
return context._currentValue;
|
|
1343
|
-
},
|
|
1344
|
-
set: function (_currentValue) {
|
|
1345
|
-
context._currentValue = _currentValue;
|
|
1346
|
-
}
|
|
1347
|
-
},
|
|
1348
|
-
_currentValue2: {
|
|
1349
|
-
get: function () {
|
|
1350
|
-
return context._currentValue2;
|
|
1351
|
-
},
|
|
1352
|
-
set: function (_currentValue2) {
|
|
1353
|
-
context._currentValue2 = _currentValue2;
|
|
1354
|
-
}
|
|
1355
|
-
},
|
|
1356
|
-
_threadCount: {
|
|
1357
|
-
get: function () {
|
|
1358
|
-
return context._threadCount;
|
|
1359
|
-
},
|
|
1360
|
-
set: function (_threadCount) {
|
|
1361
|
-
context._threadCount = _threadCount;
|
|
1362
|
-
}
|
|
1363
|
-
},
|
|
1364
|
-
Consumer: {
|
|
1365
|
-
get: function () {
|
|
1366
|
-
if (!hasWarnedAboutUsingNestedContextConsumers) {
|
|
1367
|
-
hasWarnedAboutUsingNestedContextConsumers = true;
|
|
1368
|
-
|
|
1369
|
-
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?');
|
|
1370
|
-
}
|
|
1371
|
-
|
|
1372
|
-
return context.Consumer;
|
|
1373
|
-
}
|
|
1374
|
-
},
|
|
1375
|
-
displayName: {
|
|
1376
|
-
get: function () {
|
|
1377
|
-
return context.displayName;
|
|
1378
|
-
},
|
|
1379
|
-
set: function (displayName) {
|
|
1380
|
-
if (!hasWarnedAboutDisplayNameOnConsumer) {
|
|
1381
|
-
warn('Setting `displayName` on Context.Consumer has no effect. ' + "You should set it directly on the context with Context.displayName = '%s'.", displayName);
|
|
1382
|
-
|
|
1383
|
-
hasWarnedAboutDisplayNameOnConsumer = true;
|
|
1384
|
-
}
|
|
1385
|
-
}
|
|
1386
|
-
}
|
|
1387
|
-
}); // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty
|
|
1388
|
-
|
|
1389
|
-
context.Consumer = Consumer;
|
|
1390
|
-
}
|
|
1391
|
-
|
|
1392
|
-
{
|
|
1393
|
-
context._currentRenderer = null;
|
|
1394
|
-
context._currentRenderer2 = null;
|
|
1395
|
-
}
|
|
1396
|
-
|
|
1397
|
-
return context;
|
|
1398
|
-
}
|
|
1399
|
-
|
|
1400
|
-
var Uninitialized = -1;
|
|
1401
|
-
var Pending = 0;
|
|
1402
|
-
var Resolved = 1;
|
|
1403
|
-
var Rejected = 2;
|
|
1404
|
-
|
|
1405
|
-
function lazyInitializer(payload) {
|
|
1406
|
-
if (payload._status === Uninitialized) {
|
|
1407
|
-
var ctor = payload._result;
|
|
1408
|
-
var thenable = ctor(); // Transition to the next state.
|
|
1409
|
-
// This might throw either because it's missing or throws. If so, we treat it
|
|
1410
|
-
// as still uninitialized and try again next time. Which is the same as what
|
|
1411
|
-
// happens if the ctor or any wrappers processing the ctor throws. This might
|
|
1412
|
-
// end up fixing it if the resolution was a concurrency bug.
|
|
1413
|
-
|
|
1414
|
-
thenable.then(function (moduleObject) {
|
|
1415
|
-
if (payload._status === Pending || payload._status === Uninitialized) {
|
|
1416
|
-
// Transition to the next state.
|
|
1417
|
-
var resolved = payload;
|
|
1418
|
-
resolved._status = Resolved;
|
|
1419
|
-
resolved._result = moduleObject;
|
|
1420
|
-
}
|
|
1421
|
-
}, function (error) {
|
|
1422
|
-
if (payload._status === Pending || payload._status === Uninitialized) {
|
|
1423
|
-
// Transition to the next state.
|
|
1424
|
-
var rejected = payload;
|
|
1425
|
-
rejected._status = Rejected;
|
|
1426
|
-
rejected._result = error;
|
|
1427
|
-
}
|
|
1428
|
-
});
|
|
1429
|
-
|
|
1430
|
-
if (payload._status === Uninitialized) {
|
|
1431
|
-
// In case, we're still uninitialized, then we're waiting for the thenable
|
|
1432
|
-
// to resolve. Set it as pending in the meantime.
|
|
1433
|
-
var pending = payload;
|
|
1434
|
-
pending._status = Pending;
|
|
1435
|
-
pending._result = thenable;
|
|
1436
|
-
}
|
|
1437
|
-
}
|
|
1438
|
-
|
|
1439
|
-
if (payload._status === Resolved) {
|
|
1440
|
-
var moduleObject = payload._result;
|
|
1441
|
-
|
|
1442
|
-
{
|
|
1443
|
-
if (moduleObject === undefined) {
|
|
1444
|
-
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.
|
|
1445
|
-
'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))\n\n" + 'Did you accidentally put curly braces around the import?', moduleObject);
|
|
1446
|
-
}
|
|
1447
|
-
}
|
|
1448
|
-
|
|
1449
|
-
{
|
|
1450
|
-
if (!('default' in moduleObject)) {
|
|
1451
|
-
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.
|
|
1452
|
-
'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))", moduleObject);
|
|
1453
|
-
}
|
|
1454
|
-
}
|
|
1455
|
-
|
|
1456
|
-
return moduleObject.default;
|
|
1457
|
-
} else {
|
|
1458
|
-
throw payload._result;
|
|
1459
|
-
}
|
|
1460
|
-
}
|
|
1461
|
-
|
|
1462
|
-
function lazy(ctor) {
|
|
1463
|
-
var payload = {
|
|
1464
|
-
// We use these fields to store the result.
|
|
1465
|
-
_status: Uninitialized,
|
|
1466
|
-
_result: ctor
|
|
1467
|
-
};
|
|
1468
|
-
var lazyType = {
|
|
1469
|
-
$$typeof: REACT_LAZY_TYPE,
|
|
1470
|
-
_payload: payload,
|
|
1471
|
-
_init: lazyInitializer
|
|
1472
|
-
};
|
|
1473
|
-
|
|
1474
|
-
{
|
|
1475
|
-
// In production, this would just set it on the object.
|
|
1476
|
-
var defaultProps;
|
|
1477
|
-
var propTypes; // $FlowFixMe
|
|
1478
|
-
|
|
1479
|
-
Object.defineProperties(lazyType, {
|
|
1480
|
-
defaultProps: {
|
|
1481
|
-
configurable: true,
|
|
1482
|
-
get: function () {
|
|
1483
|
-
return defaultProps;
|
|
1484
|
-
},
|
|
1485
|
-
set: function (newDefaultProps) {
|
|
1486
|
-
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.');
|
|
1487
|
-
|
|
1488
|
-
defaultProps = newDefaultProps; // Match production behavior more closely:
|
|
1489
|
-
// $FlowFixMe
|
|
1490
|
-
|
|
1491
|
-
Object.defineProperty(lazyType, 'defaultProps', {
|
|
1492
|
-
enumerable: true
|
|
1493
|
-
});
|
|
1494
|
-
}
|
|
1495
|
-
},
|
|
1496
|
-
propTypes: {
|
|
1497
|
-
configurable: true,
|
|
1498
|
-
get: function () {
|
|
1499
|
-
return propTypes;
|
|
1500
|
-
},
|
|
1501
|
-
set: function (newPropTypes) {
|
|
1502
|
-
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.');
|
|
1503
|
-
|
|
1504
|
-
propTypes = newPropTypes; // Match production behavior more closely:
|
|
1505
|
-
// $FlowFixMe
|
|
1506
|
-
|
|
1507
|
-
Object.defineProperty(lazyType, 'propTypes', {
|
|
1508
|
-
enumerable: true
|
|
1509
|
-
});
|
|
1510
|
-
}
|
|
1511
|
-
}
|
|
1512
|
-
});
|
|
1513
|
-
}
|
|
1514
|
-
|
|
1515
|
-
return lazyType;
|
|
1516
|
-
}
|
|
1517
|
-
|
|
1518
|
-
function forwardRef(render) {
|
|
1519
|
-
{
|
|
1520
|
-
if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
|
|
1521
|
-
error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
|
|
1522
|
-
} else if (typeof render !== 'function') {
|
|
1523
|
-
error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
|
|
1524
|
-
} else {
|
|
1525
|
-
if (render.length !== 0 && render.length !== 2) {
|
|
1526
|
-
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.');
|
|
1527
|
-
}
|
|
1528
|
-
}
|
|
1529
|
-
|
|
1530
|
-
if (render != null) {
|
|
1531
|
-
if (render.defaultProps != null || render.propTypes != null) {
|
|
1532
|
-
error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?');
|
|
1533
|
-
}
|
|
1534
|
-
}
|
|
1535
|
-
}
|
|
1536
|
-
|
|
1537
|
-
var elementType = {
|
|
1538
|
-
$$typeof: REACT_FORWARD_REF_TYPE,
|
|
1539
|
-
render: render
|
|
1540
|
-
};
|
|
1541
|
-
|
|
1542
|
-
{
|
|
1543
|
-
var ownName;
|
|
1544
|
-
Object.defineProperty(elementType, 'displayName', {
|
|
1545
|
-
enumerable: false,
|
|
1546
|
-
configurable: true,
|
|
1547
|
-
get: function () {
|
|
1548
|
-
return ownName;
|
|
1549
|
-
},
|
|
1550
|
-
set: function (name) {
|
|
1551
|
-
ownName = name; // The inner component shouldn't inherit this display name in most cases,
|
|
1552
|
-
// because the component may be used elsewhere.
|
|
1553
|
-
// But it's nice for anonymous functions to inherit the name,
|
|
1554
|
-
// so that our component-stack generation logic will display their frames.
|
|
1555
|
-
// An anonymous function generally suggests a pattern like:
|
|
1556
|
-
// React.forwardRef((props, ref) => {...});
|
|
1557
|
-
// This kind of inner function is not used elsewhere so the side effect is okay.
|
|
1558
|
-
|
|
1559
|
-
if (!render.name && !render.displayName) {
|
|
1560
|
-
render.displayName = name;
|
|
1561
|
-
}
|
|
1562
|
-
}
|
|
1563
|
-
});
|
|
1564
|
-
}
|
|
1565
|
-
|
|
1566
|
-
return elementType;
|
|
1567
|
-
}
|
|
1568
|
-
|
|
1569
|
-
var REACT_MODULE_REFERENCE;
|
|
1570
|
-
|
|
1571
|
-
{
|
|
1572
|
-
REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
|
|
1573
|
-
}
|
|
1574
|
-
|
|
1575
|
-
function isValidElementType(type) {
|
|
1576
|
-
if (typeof type === 'string' || typeof type === 'function') {
|
|
1577
|
-
return true;
|
|
1578
|
-
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
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 ) {
|
|
1582
|
-
return true;
|
|
1583
|
-
}
|
|
1584
|
-
|
|
1585
|
-
if (typeof type === 'object' && type !== null) {
|
|
1586
|
-
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
|
|
1587
|
-
// types supported by any Flight configuration anywhere since
|
|
1588
|
-
// we don't know which Flight build this will end up being used
|
|
1589
|
-
// with.
|
|
1590
|
-
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
|
|
1591
|
-
return true;
|
|
1592
|
-
}
|
|
1593
|
-
}
|
|
1594
|
-
|
|
1595
|
-
return false;
|
|
1596
|
-
}
|
|
1597
|
-
|
|
1598
|
-
function memo(type, compare) {
|
|
1599
|
-
{
|
|
1600
|
-
if (!isValidElementType(type)) {
|
|
1601
|
-
error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
|
|
1602
|
-
}
|
|
1603
|
-
}
|
|
1604
|
-
|
|
1605
|
-
var elementType = {
|
|
1606
|
-
$$typeof: REACT_MEMO_TYPE,
|
|
1607
|
-
type: type,
|
|
1608
|
-
compare: compare === undefined ? null : compare
|
|
1609
|
-
};
|
|
1610
|
-
|
|
1611
|
-
{
|
|
1612
|
-
var ownName;
|
|
1613
|
-
Object.defineProperty(elementType, 'displayName', {
|
|
1614
|
-
enumerable: false,
|
|
1615
|
-
configurable: true,
|
|
1616
|
-
get: function () {
|
|
1617
|
-
return ownName;
|
|
1618
|
-
},
|
|
1619
|
-
set: function (name) {
|
|
1620
|
-
ownName = name; // The inner component shouldn't inherit this display name in most cases,
|
|
1621
|
-
// because the component may be used elsewhere.
|
|
1622
|
-
// But it's nice for anonymous functions to inherit the name,
|
|
1623
|
-
// so that our component-stack generation logic will display their frames.
|
|
1624
|
-
// An anonymous function generally suggests a pattern like:
|
|
1625
|
-
// React.memo((props) => {...});
|
|
1626
|
-
// This kind of inner function is not used elsewhere so the side effect is okay.
|
|
1627
|
-
|
|
1628
|
-
if (!type.name && !type.displayName) {
|
|
1629
|
-
type.displayName = name;
|
|
1630
|
-
}
|
|
1631
|
-
}
|
|
1632
|
-
});
|
|
1633
|
-
}
|
|
1634
|
-
|
|
1635
|
-
return elementType;
|
|
1636
|
-
}
|
|
1637
|
-
|
|
1638
|
-
function resolveDispatcher() {
|
|
1639
|
-
var dispatcher = ReactCurrentDispatcher.current;
|
|
1640
|
-
|
|
1641
|
-
{
|
|
1642
|
-
if (dispatcher === null) {
|
|
1643
|
-
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.');
|
|
1644
|
-
}
|
|
1645
|
-
} // Will result in a null access error if accessed outside render phase. We
|
|
1646
|
-
// intentionally don't throw our own error because this is in a hot path.
|
|
1647
|
-
// Also helps ensure this is inlined.
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
return dispatcher;
|
|
1651
|
-
}
|
|
1652
|
-
function useContext(Context) {
|
|
1653
|
-
var dispatcher = resolveDispatcher();
|
|
1654
|
-
|
|
1655
|
-
{
|
|
1656
|
-
// TODO: add a more generic warning for invalid values.
|
|
1657
|
-
if (Context._context !== undefined) {
|
|
1658
|
-
var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs
|
|
1659
|
-
// and nobody should be using this in existing code.
|
|
1660
|
-
|
|
1661
|
-
if (realContext.Consumer === Context) {
|
|
1662
|
-
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?');
|
|
1663
|
-
} else if (realContext.Provider === Context) {
|
|
1664
|
-
error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
|
|
1665
|
-
}
|
|
1666
|
-
}
|
|
1667
|
-
}
|
|
1668
|
-
|
|
1669
|
-
return dispatcher.useContext(Context);
|
|
1670
|
-
}
|
|
1671
|
-
function useState(initialState) {
|
|
1672
|
-
var dispatcher = resolveDispatcher();
|
|
1673
|
-
return dispatcher.useState(initialState);
|
|
1674
|
-
}
|
|
1675
|
-
function useReducer(reducer, initialArg, init) {
|
|
1676
|
-
var dispatcher = resolveDispatcher();
|
|
1677
|
-
return dispatcher.useReducer(reducer, initialArg, init);
|
|
1678
|
-
}
|
|
1679
|
-
function useRef(initialValue) {
|
|
1680
|
-
var dispatcher = resolveDispatcher();
|
|
1681
|
-
return dispatcher.useRef(initialValue);
|
|
1682
|
-
}
|
|
1683
|
-
function useEffect(create, deps) {
|
|
1684
|
-
var dispatcher = resolveDispatcher();
|
|
1685
|
-
return dispatcher.useEffect(create, deps);
|
|
1686
|
-
}
|
|
1687
|
-
function useInsertionEffect(create, deps) {
|
|
1688
|
-
var dispatcher = resolveDispatcher();
|
|
1689
|
-
return dispatcher.useInsertionEffect(create, deps);
|
|
1690
|
-
}
|
|
1691
|
-
function useLayoutEffect(create, deps) {
|
|
1692
|
-
var dispatcher = resolveDispatcher();
|
|
1693
|
-
return dispatcher.useLayoutEffect(create, deps);
|
|
1694
|
-
}
|
|
1695
|
-
function useCallback(callback, deps) {
|
|
1696
|
-
var dispatcher = resolveDispatcher();
|
|
1697
|
-
return dispatcher.useCallback(callback, deps);
|
|
1698
|
-
}
|
|
1699
|
-
function useMemo(create, deps) {
|
|
1700
|
-
var dispatcher = resolveDispatcher();
|
|
1701
|
-
return dispatcher.useMemo(create, deps);
|
|
1702
|
-
}
|
|
1703
|
-
function useImperativeHandle(ref, create, deps) {
|
|
1704
|
-
var dispatcher = resolveDispatcher();
|
|
1705
|
-
return dispatcher.useImperativeHandle(ref, create, deps);
|
|
1706
|
-
}
|
|
1707
|
-
function useDebugValue(value, formatterFn) {
|
|
1708
|
-
{
|
|
1709
|
-
var dispatcher = resolveDispatcher();
|
|
1710
|
-
return dispatcher.useDebugValue(value, formatterFn);
|
|
1711
|
-
}
|
|
1712
|
-
}
|
|
1713
|
-
function useTransition() {
|
|
1714
|
-
var dispatcher = resolveDispatcher();
|
|
1715
|
-
return dispatcher.useTransition();
|
|
1716
|
-
}
|
|
1717
|
-
function useDeferredValue(value) {
|
|
1718
|
-
var dispatcher = resolveDispatcher();
|
|
1719
|
-
return dispatcher.useDeferredValue(value);
|
|
1720
|
-
}
|
|
1721
|
-
function useId() {
|
|
1722
|
-
var dispatcher = resolveDispatcher();
|
|
1723
|
-
return dispatcher.useId();
|
|
1724
|
-
}
|
|
1725
|
-
function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
|
1726
|
-
var dispatcher = resolveDispatcher();
|
|
1727
|
-
return dispatcher.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
1728
|
-
}
|
|
1729
|
-
|
|
1730
|
-
// Helpers to patch console.logs to avoid logging during side-effect free
|
|
1731
|
-
// replaying on render function. This currently only patches the object
|
|
1732
|
-
// lazily which won't cover if the log function was extracted eagerly.
|
|
1733
|
-
// We could also eagerly patch the method.
|
|
1734
|
-
var disabledDepth = 0;
|
|
1735
|
-
var prevLog;
|
|
1736
|
-
var prevInfo;
|
|
1737
|
-
var prevWarn;
|
|
1738
|
-
var prevError;
|
|
1739
|
-
var prevGroup;
|
|
1740
|
-
var prevGroupCollapsed;
|
|
1741
|
-
var prevGroupEnd;
|
|
1742
|
-
|
|
1743
|
-
function disabledLog() {}
|
|
1744
|
-
|
|
1745
|
-
disabledLog.__reactDisabledLog = true;
|
|
1746
|
-
function disableLogs() {
|
|
1747
|
-
{
|
|
1748
|
-
if (disabledDepth === 0) {
|
|
1749
|
-
/* eslint-disable react-internal/no-production-logging */
|
|
1750
|
-
prevLog = console.log;
|
|
1751
|
-
prevInfo = console.info;
|
|
1752
|
-
prevWarn = console.warn;
|
|
1753
|
-
prevError = console.error;
|
|
1754
|
-
prevGroup = console.group;
|
|
1755
|
-
prevGroupCollapsed = console.groupCollapsed;
|
|
1756
|
-
prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
|
|
1757
|
-
|
|
1758
|
-
var props = {
|
|
1759
|
-
configurable: true,
|
|
1760
|
-
enumerable: true,
|
|
1761
|
-
value: disabledLog,
|
|
1762
|
-
writable: true
|
|
1763
|
-
}; // $FlowFixMe Flow thinks console is immutable.
|
|
1764
|
-
|
|
1765
|
-
Object.defineProperties(console, {
|
|
1766
|
-
info: props,
|
|
1767
|
-
log: props,
|
|
1768
|
-
warn: props,
|
|
1769
|
-
error: props,
|
|
1770
|
-
group: props,
|
|
1771
|
-
groupCollapsed: props,
|
|
1772
|
-
groupEnd: props
|
|
1773
|
-
});
|
|
1774
|
-
/* eslint-enable react-internal/no-production-logging */
|
|
1775
|
-
}
|
|
1776
|
-
|
|
1777
|
-
disabledDepth++;
|
|
1778
|
-
}
|
|
1779
|
-
}
|
|
1780
|
-
function reenableLogs() {
|
|
1781
|
-
{
|
|
1782
|
-
disabledDepth--;
|
|
1783
|
-
|
|
1784
|
-
if (disabledDepth === 0) {
|
|
1785
|
-
/* eslint-disable react-internal/no-production-logging */
|
|
1786
|
-
var props = {
|
|
1787
|
-
configurable: true,
|
|
1788
|
-
enumerable: true,
|
|
1789
|
-
writable: true
|
|
1790
|
-
}; // $FlowFixMe Flow thinks console is immutable.
|
|
1791
|
-
|
|
1792
|
-
Object.defineProperties(console, {
|
|
1793
|
-
log: assign({}, props, {
|
|
1794
|
-
value: prevLog
|
|
1795
|
-
}),
|
|
1796
|
-
info: assign({}, props, {
|
|
1797
|
-
value: prevInfo
|
|
1798
|
-
}),
|
|
1799
|
-
warn: assign({}, props, {
|
|
1800
|
-
value: prevWarn
|
|
1801
|
-
}),
|
|
1802
|
-
error: assign({}, props, {
|
|
1803
|
-
value: prevError
|
|
1804
|
-
}),
|
|
1805
|
-
group: assign({}, props, {
|
|
1806
|
-
value: prevGroup
|
|
1807
|
-
}),
|
|
1808
|
-
groupCollapsed: assign({}, props, {
|
|
1809
|
-
value: prevGroupCollapsed
|
|
1810
|
-
}),
|
|
1811
|
-
groupEnd: assign({}, props, {
|
|
1812
|
-
value: prevGroupEnd
|
|
1813
|
-
})
|
|
1814
|
-
});
|
|
1815
|
-
/* eslint-enable react-internal/no-production-logging */
|
|
1816
|
-
}
|
|
1817
|
-
|
|
1818
|
-
if (disabledDepth < 0) {
|
|
1819
|
-
error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
|
|
1820
|
-
}
|
|
1821
|
-
}
|
|
1822
|
-
}
|
|
1823
|
-
|
|
1824
|
-
var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
|
|
1825
|
-
var prefix;
|
|
1826
|
-
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
|
1827
|
-
{
|
|
1828
|
-
if (prefix === undefined) {
|
|
1829
|
-
// Extract the VM specific prefix used by each line.
|
|
1830
|
-
try {
|
|
1831
|
-
throw Error();
|
|
1832
|
-
} catch (x) {
|
|
1833
|
-
var match = x.stack.trim().match(/\n( *(at )?)/);
|
|
1834
|
-
prefix = match && match[1] || '';
|
|
1835
|
-
}
|
|
1836
|
-
} // We use the prefix to ensure our stacks line up with native stack frames.
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
return '\n' + prefix + name;
|
|
1840
|
-
}
|
|
1841
|
-
}
|
|
1842
|
-
var reentry = false;
|
|
1843
|
-
var componentFrameCache;
|
|
1844
|
-
|
|
1845
|
-
{
|
|
1846
|
-
var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
|
|
1847
|
-
componentFrameCache = new PossiblyWeakMap();
|
|
1848
|
-
}
|
|
1849
|
-
|
|
1850
|
-
function describeNativeComponentFrame(fn, construct) {
|
|
1851
|
-
// If something asked for a stack inside a fake render, it should get ignored.
|
|
1852
|
-
if ( !fn || reentry) {
|
|
1853
|
-
return '';
|
|
1854
|
-
}
|
|
1855
|
-
|
|
1856
|
-
{
|
|
1857
|
-
var frame = componentFrameCache.get(fn);
|
|
1858
|
-
|
|
1859
|
-
if (frame !== undefined) {
|
|
1860
|
-
return frame;
|
|
1861
|
-
}
|
|
1862
|
-
}
|
|
1863
|
-
|
|
1864
|
-
var control;
|
|
1865
|
-
reentry = true;
|
|
1866
|
-
var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
|
|
1867
|
-
|
|
1868
|
-
Error.prepareStackTrace = undefined;
|
|
1869
|
-
var previousDispatcher;
|
|
1870
|
-
|
|
1871
|
-
{
|
|
1872
|
-
previousDispatcher = ReactCurrentDispatcher$1.current; // Set the dispatcher in DEV because this might be call in the render function
|
|
1873
|
-
// for warnings.
|
|
1874
|
-
|
|
1875
|
-
ReactCurrentDispatcher$1.current = null;
|
|
1876
|
-
disableLogs();
|
|
1877
|
-
}
|
|
1878
|
-
|
|
1879
|
-
try {
|
|
1880
|
-
// This should throw.
|
|
1881
|
-
if (construct) {
|
|
1882
|
-
// Something should be setting the props in the constructor.
|
|
1883
|
-
var Fake = function () {
|
|
1884
|
-
throw Error();
|
|
1885
|
-
}; // $FlowFixMe
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
Object.defineProperty(Fake.prototype, 'props', {
|
|
1889
|
-
set: function () {
|
|
1890
|
-
// We use a throwing setter instead of frozen or non-writable props
|
|
1891
|
-
// because that won't throw in a non-strict mode function.
|
|
1892
|
-
throw Error();
|
|
1893
|
-
}
|
|
1894
|
-
});
|
|
1895
|
-
|
|
1896
|
-
if (typeof Reflect === 'object' && Reflect.construct) {
|
|
1897
|
-
// We construct a different control for this case to include any extra
|
|
1898
|
-
// frames added by the construct call.
|
|
1899
|
-
try {
|
|
1900
|
-
Reflect.construct(Fake, []);
|
|
1901
|
-
} catch (x) {
|
|
1902
|
-
control = x;
|
|
1903
|
-
}
|
|
1904
|
-
|
|
1905
|
-
Reflect.construct(fn, [], Fake);
|
|
1906
|
-
} else {
|
|
1907
|
-
try {
|
|
1908
|
-
Fake.call();
|
|
1909
|
-
} catch (x) {
|
|
1910
|
-
control = x;
|
|
1911
|
-
}
|
|
1912
|
-
|
|
1913
|
-
fn.call(Fake.prototype);
|
|
1914
|
-
}
|
|
1915
|
-
} else {
|
|
1916
|
-
try {
|
|
1917
|
-
throw Error();
|
|
1918
|
-
} catch (x) {
|
|
1919
|
-
control = x;
|
|
1920
|
-
}
|
|
1921
|
-
|
|
1922
|
-
fn();
|
|
1923
|
-
}
|
|
1924
|
-
} catch (sample) {
|
|
1925
|
-
// This is inlined manually because closure doesn't do it for us.
|
|
1926
|
-
if (sample && control && typeof sample.stack === 'string') {
|
|
1927
|
-
// This extracts the first frame from the sample that isn't also in the control.
|
|
1928
|
-
// Skipping one frame that we assume is the frame that calls the two.
|
|
1929
|
-
var sampleLines = sample.stack.split('\n');
|
|
1930
|
-
var controlLines = control.stack.split('\n');
|
|
1931
|
-
var s = sampleLines.length - 1;
|
|
1932
|
-
var c = controlLines.length - 1;
|
|
1933
|
-
|
|
1934
|
-
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
|
1935
|
-
// We expect at least one stack frame to be shared.
|
|
1936
|
-
// Typically this will be the root most one. However, stack frames may be
|
|
1937
|
-
// cut off due to maximum stack limits. In this case, one maybe cut off
|
|
1938
|
-
// earlier than the other. We assume that the sample is longer or the same
|
|
1939
|
-
// and there for cut off earlier. So we should find the root most frame in
|
|
1940
|
-
// the sample somewhere in the control.
|
|
1941
|
-
c--;
|
|
1942
|
-
}
|
|
1943
|
-
|
|
1944
|
-
for (; s >= 1 && c >= 0; s--, c--) {
|
|
1945
|
-
// Next we find the first one that isn't the same which should be the
|
|
1946
|
-
// frame that called our sample function and the control.
|
|
1947
|
-
if (sampleLines[s] !== controlLines[c]) {
|
|
1948
|
-
// In V8, the first line is describing the message but other VMs don't.
|
|
1949
|
-
// If we're about to return the first line, and the control is also on the same
|
|
1950
|
-
// line, that's a pretty good indicator that our sample threw at same line as
|
|
1951
|
-
// the control. I.e. before we entered the sample frame. So we ignore this result.
|
|
1952
|
-
// This can happen if you passed a class to function component, or non-function.
|
|
1953
|
-
if (s !== 1 || c !== 1) {
|
|
1954
|
-
do {
|
|
1955
|
-
s--;
|
|
1956
|
-
c--; // We may still have similar intermediate frames from the construct call.
|
|
1957
|
-
// The next one that isn't the same should be our match though.
|
|
1958
|
-
|
|
1959
|
-
if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
|
1960
|
-
// V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
|
|
1961
|
-
var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>"
|
|
1962
|
-
// but we have a user-provided "displayName"
|
|
1963
|
-
// splice it in to make the stack more readable.
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
if (fn.displayName && _frame.includes('<anonymous>')) {
|
|
1967
|
-
_frame = _frame.replace('<anonymous>', fn.displayName);
|
|
1968
|
-
}
|
|
1969
|
-
|
|
1970
|
-
{
|
|
1971
|
-
if (typeof fn === 'function') {
|
|
1972
|
-
componentFrameCache.set(fn, _frame);
|
|
1973
|
-
}
|
|
1974
|
-
} // Return the line we found.
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
return _frame;
|
|
1978
|
-
}
|
|
1979
|
-
} while (s >= 1 && c >= 0);
|
|
1980
|
-
}
|
|
1981
|
-
|
|
1982
|
-
break;
|
|
1983
|
-
}
|
|
1984
|
-
}
|
|
1985
|
-
}
|
|
1986
|
-
} finally {
|
|
1987
|
-
reentry = false;
|
|
1988
|
-
|
|
1989
|
-
{
|
|
1990
|
-
ReactCurrentDispatcher$1.current = previousDispatcher;
|
|
1991
|
-
reenableLogs();
|
|
1992
|
-
}
|
|
1993
|
-
|
|
1994
|
-
Error.prepareStackTrace = previousPrepareStackTrace;
|
|
1995
|
-
} // Fallback to just using the name if we couldn't make it throw.
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
var name = fn ? fn.displayName || fn.name : '';
|
|
1999
|
-
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
|
|
2000
|
-
|
|
2001
|
-
{
|
|
2002
|
-
if (typeof fn === 'function') {
|
|
2003
|
-
componentFrameCache.set(fn, syntheticFrame);
|
|
2004
|
-
}
|
|
2005
|
-
}
|
|
2006
|
-
|
|
2007
|
-
return syntheticFrame;
|
|
2008
|
-
}
|
|
2009
|
-
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
|
2010
|
-
{
|
|
2011
|
-
return describeNativeComponentFrame(fn, false);
|
|
2012
|
-
}
|
|
2013
|
-
}
|
|
2014
|
-
|
|
2015
|
-
function shouldConstruct(Component) {
|
|
2016
|
-
var prototype = Component.prototype;
|
|
2017
|
-
return !!(prototype && prototype.isReactComponent);
|
|
2018
|
-
}
|
|
2019
|
-
|
|
2020
|
-
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
|
2021
|
-
|
|
2022
|
-
if (type == null) {
|
|
2023
|
-
return '';
|
|
2024
|
-
}
|
|
2025
|
-
|
|
2026
|
-
if (typeof type === 'function') {
|
|
2027
|
-
{
|
|
2028
|
-
return describeNativeComponentFrame(type, shouldConstruct(type));
|
|
2029
|
-
}
|
|
2030
|
-
}
|
|
2031
|
-
|
|
2032
|
-
if (typeof type === 'string') {
|
|
2033
|
-
return describeBuiltInComponentFrame(type);
|
|
2034
|
-
}
|
|
2035
|
-
|
|
2036
|
-
switch (type) {
|
|
2037
|
-
case REACT_SUSPENSE_TYPE:
|
|
2038
|
-
return describeBuiltInComponentFrame('Suspense');
|
|
2039
|
-
|
|
2040
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
2041
|
-
return describeBuiltInComponentFrame('SuspenseList');
|
|
2042
|
-
}
|
|
2043
|
-
|
|
2044
|
-
if (typeof type === 'object') {
|
|
2045
|
-
switch (type.$$typeof) {
|
|
2046
|
-
case REACT_FORWARD_REF_TYPE:
|
|
2047
|
-
return describeFunctionComponentFrame(type.render);
|
|
2048
|
-
|
|
2049
|
-
case REACT_MEMO_TYPE:
|
|
2050
|
-
// Memo may contain any component type so we recursively resolve it.
|
|
2051
|
-
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
|
2052
|
-
|
|
2053
|
-
case REACT_LAZY_TYPE:
|
|
2054
|
-
{
|
|
2055
|
-
var lazyComponent = type;
|
|
2056
|
-
var payload = lazyComponent._payload;
|
|
2057
|
-
var init = lazyComponent._init;
|
|
2058
|
-
|
|
2059
|
-
try {
|
|
2060
|
-
// Lazy may contain any component type so we recursively resolve it.
|
|
2061
|
-
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
|
2062
|
-
} catch (x) {}
|
|
2063
|
-
}
|
|
2064
|
-
}
|
|
2065
|
-
}
|
|
2066
|
-
|
|
2067
|
-
return '';
|
|
2068
|
-
}
|
|
2069
|
-
|
|
2070
|
-
var loggedTypeFailures = {};
|
|
2071
|
-
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
2072
|
-
|
|
2073
|
-
function setCurrentlyValidatingElement(element) {
|
|
2074
|
-
{
|
|
2075
|
-
if (element) {
|
|
2076
|
-
var owner = element._owner;
|
|
2077
|
-
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
2078
|
-
ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
|
|
2079
|
-
} else {
|
|
2080
|
-
ReactDebugCurrentFrame$1.setExtraStackFrame(null);
|
|
2081
|
-
}
|
|
2082
|
-
}
|
|
2083
|
-
}
|
|
2084
|
-
|
|
2085
|
-
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
|
2086
|
-
{
|
|
2087
|
-
// $FlowFixMe This is okay but Flow doesn't know it.
|
|
2088
|
-
var has = Function.call.bind(hasOwnProperty);
|
|
2089
|
-
|
|
2090
|
-
for (var typeSpecName in typeSpecs) {
|
|
2091
|
-
if (has(typeSpecs, typeSpecName)) {
|
|
2092
|
-
var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
|
|
2093
|
-
// fail the render phase where it didn't fail before. So we log it.
|
|
2094
|
-
// After these have been cleaned up, we'll let them throw.
|
|
2095
|
-
|
|
2096
|
-
try {
|
|
2097
|
-
// This is intentionally an invariant that gets caught. It's the same
|
|
2098
|
-
// behavior as without this statement except with a better message.
|
|
2099
|
-
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
2100
|
-
// eslint-disable-next-line react-internal/prod-error-codes
|
|
2101
|
-
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`.');
|
|
2102
|
-
err.name = 'Invariant Violation';
|
|
2103
|
-
throw err;
|
|
2104
|
-
}
|
|
2105
|
-
|
|
2106
|
-
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
|
|
2107
|
-
} catch (ex) {
|
|
2108
|
-
error$1 = ex;
|
|
2109
|
-
}
|
|
2110
|
-
|
|
2111
|
-
if (error$1 && !(error$1 instanceof Error)) {
|
|
2112
|
-
setCurrentlyValidatingElement(element);
|
|
2113
|
-
|
|
2114
|
-
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);
|
|
2115
|
-
|
|
2116
|
-
setCurrentlyValidatingElement(null);
|
|
2117
|
-
}
|
|
2118
|
-
|
|
2119
|
-
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
|
2120
|
-
// Only monitor this failure once because there tends to be a lot of the
|
|
2121
|
-
// same error.
|
|
2122
|
-
loggedTypeFailures[error$1.message] = true;
|
|
2123
|
-
setCurrentlyValidatingElement(element);
|
|
2124
|
-
|
|
2125
|
-
error('Failed %s type: %s', location, error$1.message);
|
|
2126
|
-
|
|
2127
|
-
setCurrentlyValidatingElement(null);
|
|
2128
|
-
}
|
|
2129
|
-
}
|
|
2130
|
-
}
|
|
2131
|
-
}
|
|
2132
|
-
}
|
|
2133
|
-
|
|
2134
|
-
function setCurrentlyValidatingElement$1(element) {
|
|
2135
|
-
{
|
|
2136
|
-
if (element) {
|
|
2137
|
-
var owner = element._owner;
|
|
2138
|
-
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
2139
|
-
setExtraStackFrame(stack);
|
|
2140
|
-
} else {
|
|
2141
|
-
setExtraStackFrame(null);
|
|
2142
|
-
}
|
|
2143
|
-
}
|
|
2144
|
-
}
|
|
2145
|
-
|
|
2146
|
-
var propTypesMisspellWarningShown;
|
|
2147
|
-
|
|
2148
|
-
{
|
|
2149
|
-
propTypesMisspellWarningShown = false;
|
|
2150
|
-
}
|
|
2151
|
-
|
|
2152
|
-
function getDeclarationErrorAddendum() {
|
|
2153
|
-
if (ReactCurrentOwner.current) {
|
|
2154
|
-
var name = getComponentNameFromType(ReactCurrentOwner.current.type);
|
|
2155
|
-
|
|
2156
|
-
if (name) {
|
|
2157
|
-
return '\n\nCheck the render method of `' + name + '`.';
|
|
2158
|
-
}
|
|
2159
|
-
}
|
|
2160
|
-
|
|
2161
|
-
return '';
|
|
2162
|
-
}
|
|
2163
|
-
|
|
2164
|
-
function getSourceInfoErrorAddendum(source) {
|
|
2165
|
-
if (source !== undefined) {
|
|
2166
|
-
var fileName = source.fileName.replace(/^.*[\\\/]/, '');
|
|
2167
|
-
var lineNumber = source.lineNumber;
|
|
2168
|
-
return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
|
|
2169
|
-
}
|
|
2170
|
-
|
|
2171
|
-
return '';
|
|
2172
|
-
}
|
|
2173
|
-
|
|
2174
|
-
function getSourceInfoErrorAddendumForProps(elementProps) {
|
|
2175
|
-
if (elementProps !== null && elementProps !== undefined) {
|
|
2176
|
-
return getSourceInfoErrorAddendum(elementProps.__source);
|
|
2177
|
-
}
|
|
2178
|
-
|
|
2179
|
-
return '';
|
|
2180
|
-
}
|
|
2181
|
-
/**
|
|
2182
|
-
* Warn if there's no key explicitly set on dynamic arrays of children or
|
|
2183
|
-
* object keys are not valid. This allows us to keep track of children between
|
|
2184
|
-
* updates.
|
|
2185
|
-
*/
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
var ownerHasKeyUseWarning = {};
|
|
2189
|
-
|
|
2190
|
-
function getCurrentComponentErrorInfo(parentType) {
|
|
2191
|
-
var info = getDeclarationErrorAddendum();
|
|
2192
|
-
|
|
2193
|
-
if (!info) {
|
|
2194
|
-
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
|
2195
|
-
|
|
2196
|
-
if (parentName) {
|
|
2197
|
-
info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
|
2198
|
-
}
|
|
2199
|
-
}
|
|
2200
|
-
|
|
2201
|
-
return info;
|
|
2202
|
-
}
|
|
2203
|
-
/**
|
|
2204
|
-
* Warn if the element doesn't have an explicit key assigned to it.
|
|
2205
|
-
* This element is in an array. The array could grow and shrink or be
|
|
2206
|
-
* reordered. All children that haven't already been validated are required to
|
|
2207
|
-
* have a "key" property assigned to it. Error statuses are cached so a warning
|
|
2208
|
-
* will only be shown once.
|
|
2209
|
-
*
|
|
2210
|
-
* @internal
|
|
2211
|
-
* @param {ReactElement} element Element that requires a key.
|
|
2212
|
-
* @param {*} parentType element's parent's type.
|
|
2213
|
-
*/
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
function validateExplicitKey(element, parentType) {
|
|
2217
|
-
if (!element._store || element._store.validated || element.key != null) {
|
|
2218
|
-
return;
|
|
2219
|
-
}
|
|
2220
|
-
|
|
2221
|
-
element._store.validated = true;
|
|
2222
|
-
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
2223
|
-
|
|
2224
|
-
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
|
2225
|
-
return;
|
|
2226
|
-
}
|
|
2227
|
-
|
|
2228
|
-
ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
|
|
2229
|
-
// property, it may be the creator of the child that's responsible for
|
|
2230
|
-
// assigning it a key.
|
|
2231
|
-
|
|
2232
|
-
var childOwner = '';
|
|
2233
|
-
|
|
2234
|
-
if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
|
|
2235
|
-
// Give the component that originally created this child.
|
|
2236
|
-
childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
|
|
2237
|
-
}
|
|
2238
|
-
|
|
2239
|
-
{
|
|
2240
|
-
setCurrentlyValidatingElement$1(element);
|
|
2241
|
-
|
|
2242
|
-
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);
|
|
2243
|
-
|
|
2244
|
-
setCurrentlyValidatingElement$1(null);
|
|
2245
|
-
}
|
|
2246
|
-
}
|
|
2247
|
-
/**
|
|
2248
|
-
* Ensure that every element either is passed in a static location, in an
|
|
2249
|
-
* array with an explicit keys property defined, or in an object literal
|
|
2250
|
-
* with valid key property.
|
|
2251
|
-
*
|
|
2252
|
-
* @internal
|
|
2253
|
-
* @param {ReactNode} node Statically passed child of any type.
|
|
2254
|
-
* @param {*} parentType node's parent's type.
|
|
2255
|
-
*/
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
function validateChildKeys(node, parentType) {
|
|
2259
|
-
if (typeof node !== 'object') {
|
|
2260
|
-
return;
|
|
2261
|
-
}
|
|
2262
|
-
|
|
2263
|
-
if (isArray(node)) {
|
|
2264
|
-
for (var i = 0; i < node.length; i++) {
|
|
2265
|
-
var child = node[i];
|
|
2266
|
-
|
|
2267
|
-
if (isValidElement(child)) {
|
|
2268
|
-
validateExplicitKey(child, parentType);
|
|
2269
|
-
}
|
|
2270
|
-
}
|
|
2271
|
-
} else if (isValidElement(node)) {
|
|
2272
|
-
// This element was passed in a valid location.
|
|
2273
|
-
if (node._store) {
|
|
2274
|
-
node._store.validated = true;
|
|
2275
|
-
}
|
|
2276
|
-
} else if (node) {
|
|
2277
|
-
var iteratorFn = getIteratorFn(node);
|
|
2278
|
-
|
|
2279
|
-
if (typeof iteratorFn === 'function') {
|
|
2280
|
-
// Entry iterators used to provide implicit keys,
|
|
2281
|
-
// but now we print a separate warning for them later.
|
|
2282
|
-
if (iteratorFn !== node.entries) {
|
|
2283
|
-
var iterator = iteratorFn.call(node);
|
|
2284
|
-
var step;
|
|
2285
|
-
|
|
2286
|
-
while (!(step = iterator.next()).done) {
|
|
2287
|
-
if (isValidElement(step.value)) {
|
|
2288
|
-
validateExplicitKey(step.value, parentType);
|
|
2289
|
-
}
|
|
2290
|
-
}
|
|
2291
|
-
}
|
|
2292
|
-
}
|
|
2293
|
-
}
|
|
2294
|
-
}
|
|
2295
|
-
/**
|
|
2296
|
-
* Given an element, validate that its props follow the propTypes definition,
|
|
2297
|
-
* provided by the type.
|
|
2298
|
-
*
|
|
2299
|
-
* @param {ReactElement} element
|
|
2300
|
-
*/
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
function validatePropTypes(element) {
|
|
2304
|
-
{
|
|
2305
|
-
var type = element.type;
|
|
2306
|
-
|
|
2307
|
-
if (type === null || type === undefined || typeof type === 'string') {
|
|
2308
|
-
return;
|
|
2309
|
-
}
|
|
2310
|
-
|
|
2311
|
-
var propTypes;
|
|
2312
|
-
|
|
2313
|
-
if (typeof type === 'function') {
|
|
2314
|
-
propTypes = type.propTypes;
|
|
2315
|
-
} else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
|
|
2316
|
-
// Inner props are checked in the reconciler.
|
|
2317
|
-
type.$$typeof === REACT_MEMO_TYPE)) {
|
|
2318
|
-
propTypes = type.propTypes;
|
|
2319
|
-
} else {
|
|
2320
|
-
return;
|
|
2321
|
-
}
|
|
2322
|
-
|
|
2323
|
-
if (propTypes) {
|
|
2324
|
-
// Intentionally inside to avoid triggering lazy initializers:
|
|
2325
|
-
var name = getComponentNameFromType(type);
|
|
2326
|
-
checkPropTypes(propTypes, element.props, 'prop', name, element);
|
|
2327
|
-
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
|
2328
|
-
propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
|
|
2329
|
-
|
|
2330
|
-
var _name = getComponentNameFromType(type);
|
|
2331
|
-
|
|
2332
|
-
error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
|
|
2333
|
-
}
|
|
2334
|
-
|
|
2335
|
-
if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
|
|
2336
|
-
error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
|
2337
|
-
}
|
|
2338
|
-
}
|
|
2339
|
-
}
|
|
2340
|
-
/**
|
|
2341
|
-
* Given a fragment, validate that it can only be provided with fragment props
|
|
2342
|
-
* @param {ReactElement} fragment
|
|
2343
|
-
*/
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
function validateFragmentProps(fragment) {
|
|
2347
|
-
{
|
|
2348
|
-
var keys = Object.keys(fragment.props);
|
|
2349
|
-
|
|
2350
|
-
for (var i = 0; i < keys.length; i++) {
|
|
2351
|
-
var key = keys[i];
|
|
2352
|
-
|
|
2353
|
-
if (key !== 'children' && key !== 'key') {
|
|
2354
|
-
setCurrentlyValidatingElement$1(fragment);
|
|
2355
|
-
|
|
2356
|
-
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
|
2357
|
-
|
|
2358
|
-
setCurrentlyValidatingElement$1(null);
|
|
2359
|
-
break;
|
|
2360
|
-
}
|
|
2361
|
-
}
|
|
2362
|
-
|
|
2363
|
-
if (fragment.ref !== null) {
|
|
2364
|
-
setCurrentlyValidatingElement$1(fragment);
|
|
2365
|
-
|
|
2366
|
-
error('Invalid attribute `ref` supplied to `React.Fragment`.');
|
|
2367
|
-
|
|
2368
|
-
setCurrentlyValidatingElement$1(null);
|
|
2369
|
-
}
|
|
2370
|
-
}
|
|
2371
|
-
}
|
|
2372
|
-
function createElementWithValidation(type, props, children) {
|
|
2373
|
-
var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
|
|
2374
|
-
// succeed and there will likely be errors in render.
|
|
2375
|
-
|
|
2376
|
-
if (!validType) {
|
|
2377
|
-
var info = '';
|
|
2378
|
-
|
|
2379
|
-
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
|
2380
|
-
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.";
|
|
2381
|
-
}
|
|
2382
|
-
|
|
2383
|
-
var sourceInfo = getSourceInfoErrorAddendumForProps(props);
|
|
2384
|
-
|
|
2385
|
-
if (sourceInfo) {
|
|
2386
|
-
info += sourceInfo;
|
|
2387
|
-
} else {
|
|
2388
|
-
info += getDeclarationErrorAddendum();
|
|
2389
|
-
}
|
|
2390
|
-
|
|
2391
|
-
var typeString;
|
|
2392
|
-
|
|
2393
|
-
if (type === null) {
|
|
2394
|
-
typeString = 'null';
|
|
2395
|
-
} else if (isArray(type)) {
|
|
2396
|
-
typeString = 'array';
|
|
2397
|
-
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
2398
|
-
typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
|
|
2399
|
-
info = ' Did you accidentally export a JSX literal instead of a component?';
|
|
2400
|
-
} else {
|
|
2401
|
-
typeString = typeof type;
|
|
2402
|
-
}
|
|
2403
|
-
|
|
2404
|
-
{
|
|
2405
|
-
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);
|
|
2406
|
-
}
|
|
2407
|
-
}
|
|
2408
|
-
|
|
2409
|
-
var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used.
|
|
2410
|
-
// TODO: Drop this when these are no longer allowed as the type argument.
|
|
2411
|
-
|
|
2412
|
-
if (element == null) {
|
|
2413
|
-
return element;
|
|
2414
|
-
} // Skip key warning if the type isn't valid since our key validation logic
|
|
2415
|
-
// doesn't expect a non-string/function type and can throw confusing errors.
|
|
2416
|
-
// We don't want exception behavior to differ between dev and prod.
|
|
2417
|
-
// (Rendering will throw with a helpful message and as soon as the type is
|
|
2418
|
-
// fixed, the key warnings will appear.)
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
if (validType) {
|
|
2422
|
-
for (var i = 2; i < arguments.length; i++) {
|
|
2423
|
-
validateChildKeys(arguments[i], type);
|
|
2424
|
-
}
|
|
2425
|
-
}
|
|
2426
|
-
|
|
2427
|
-
if (type === REACT_FRAGMENT_TYPE) {
|
|
2428
|
-
validateFragmentProps(element);
|
|
2429
|
-
} else {
|
|
2430
|
-
validatePropTypes(element);
|
|
2431
|
-
}
|
|
2432
|
-
|
|
2433
|
-
return element;
|
|
2434
|
-
}
|
|
2435
|
-
var didWarnAboutDeprecatedCreateFactory = false;
|
|
2436
|
-
function createFactoryWithValidation(type) {
|
|
2437
|
-
var validatedFactory = createElementWithValidation.bind(null, type);
|
|
2438
|
-
validatedFactory.type = type;
|
|
2439
|
-
|
|
2440
|
-
{
|
|
2441
|
-
if (!didWarnAboutDeprecatedCreateFactory) {
|
|
2442
|
-
didWarnAboutDeprecatedCreateFactory = true;
|
|
2443
|
-
|
|
2444
|
-
warn('React.createFactory() is deprecated and will be removed in ' + 'a future major release. Consider using JSX ' + 'or use React.createElement() directly instead.');
|
|
2445
|
-
} // Legacy hook: remove it
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
Object.defineProperty(validatedFactory, 'type', {
|
|
2449
|
-
enumerable: false,
|
|
2450
|
-
get: function () {
|
|
2451
|
-
warn('Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
|
|
2452
|
-
|
|
2453
|
-
Object.defineProperty(this, 'type', {
|
|
2454
|
-
value: type
|
|
2455
|
-
});
|
|
2456
|
-
return type;
|
|
2457
|
-
}
|
|
2458
|
-
});
|
|
2459
|
-
}
|
|
2460
|
-
|
|
2461
|
-
return validatedFactory;
|
|
2462
|
-
}
|
|
2463
|
-
function cloneElementWithValidation(element, props, children) {
|
|
2464
|
-
var newElement = cloneElement.apply(this, arguments);
|
|
2465
|
-
|
|
2466
|
-
for (var i = 2; i < arguments.length; i++) {
|
|
2467
|
-
validateChildKeys(arguments[i], newElement.type);
|
|
2468
|
-
}
|
|
2469
|
-
|
|
2470
|
-
validatePropTypes(newElement);
|
|
2471
|
-
return newElement;
|
|
2472
|
-
}
|
|
2473
|
-
|
|
2474
|
-
function startTransition(scope, options) {
|
|
2475
|
-
var prevTransition = ReactCurrentBatchConfig.transition;
|
|
2476
|
-
ReactCurrentBatchConfig.transition = {};
|
|
2477
|
-
var currentTransition = ReactCurrentBatchConfig.transition;
|
|
2478
|
-
|
|
2479
|
-
{
|
|
2480
|
-
ReactCurrentBatchConfig.transition._updatedFibers = new Set();
|
|
2481
|
-
}
|
|
2482
|
-
|
|
2483
|
-
try {
|
|
2484
|
-
scope();
|
|
2485
|
-
} finally {
|
|
2486
|
-
ReactCurrentBatchConfig.transition = prevTransition;
|
|
2487
|
-
|
|
2488
|
-
{
|
|
2489
|
-
if (prevTransition === null && currentTransition._updatedFibers) {
|
|
2490
|
-
var updatedFibersCount = currentTransition._updatedFibers.size;
|
|
2491
|
-
|
|
2492
|
-
if (updatedFibersCount > 10) {
|
|
2493
|
-
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.');
|
|
2494
|
-
}
|
|
2495
|
-
|
|
2496
|
-
currentTransition._updatedFibers.clear();
|
|
2497
|
-
}
|
|
2498
|
-
}
|
|
2499
|
-
}
|
|
2500
|
-
}
|
|
2501
|
-
|
|
2502
|
-
var didWarnAboutMessageChannel = false;
|
|
2503
|
-
var enqueueTaskImpl = null;
|
|
2504
|
-
function enqueueTask(task) {
|
|
2505
|
-
if (enqueueTaskImpl === null) {
|
|
2506
|
-
try {
|
|
2507
|
-
// read require off the module object to get around the bundlers.
|
|
2508
|
-
// we don't want them to detect a require and bundle a Node polyfill.
|
|
2509
|
-
var requireString = ('require' + Math.random()).slice(0, 7);
|
|
2510
|
-
var nodeRequire = module && module[requireString]; // assuming we're in node, let's try to get node's
|
|
2511
|
-
// version of setImmediate, bypassing fake timers if any.
|
|
2512
|
-
|
|
2513
|
-
enqueueTaskImpl = nodeRequire.call(module, 'timers').setImmediate;
|
|
2514
|
-
} catch (_err) {
|
|
2515
|
-
// we're in a browser
|
|
2516
|
-
// we can't use regular timers because they may still be faked
|
|
2517
|
-
// so we try MessageChannel+postMessage instead
|
|
2518
|
-
enqueueTaskImpl = function (callback) {
|
|
2519
|
-
{
|
|
2520
|
-
if (didWarnAboutMessageChannel === false) {
|
|
2521
|
-
didWarnAboutMessageChannel = true;
|
|
2522
|
-
|
|
2523
|
-
if (typeof MessageChannel === 'undefined') {
|
|
2524
|
-
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.');
|
|
2525
|
-
}
|
|
2526
|
-
}
|
|
2527
|
-
}
|
|
2528
|
-
|
|
2529
|
-
var channel = new MessageChannel();
|
|
2530
|
-
channel.port1.onmessage = callback;
|
|
2531
|
-
channel.port2.postMessage(undefined);
|
|
2532
|
-
};
|
|
2533
|
-
}
|
|
2534
|
-
}
|
|
2535
|
-
|
|
2536
|
-
return enqueueTaskImpl(task);
|
|
2537
|
-
}
|
|
2538
|
-
|
|
2539
|
-
var actScopeDepth = 0;
|
|
2540
|
-
var didWarnNoAwaitAct = false;
|
|
2541
|
-
function act(callback) {
|
|
2542
|
-
{
|
|
2543
|
-
// `act` calls can be nested, so we track the depth. This represents the
|
|
2544
|
-
// number of `act` scopes on the stack.
|
|
2545
|
-
var prevActScopeDepth = actScopeDepth;
|
|
2546
|
-
actScopeDepth++;
|
|
2547
|
-
|
|
2548
|
-
if (ReactCurrentActQueue.current === null) {
|
|
2549
|
-
// This is the outermost `act` scope. Initialize the queue. The reconciler
|
|
2550
|
-
// will detect the queue and use it instead of Scheduler.
|
|
2551
|
-
ReactCurrentActQueue.current = [];
|
|
2552
|
-
}
|
|
2553
|
-
|
|
2554
|
-
var prevIsBatchingLegacy = ReactCurrentActQueue.isBatchingLegacy;
|
|
2555
|
-
var result;
|
|
2556
|
-
|
|
2557
|
-
try {
|
|
2558
|
-
// Used to reproduce behavior of `batchedUpdates` in legacy mode. Only
|
|
2559
|
-
// set to `true` while the given callback is executed, not for updates
|
|
2560
|
-
// triggered during an async event, because this is how the legacy
|
|
2561
|
-
// implementation of `act` behaved.
|
|
2562
|
-
ReactCurrentActQueue.isBatchingLegacy = true;
|
|
2563
|
-
result = callback(); // Replicate behavior of original `act` implementation in legacy mode,
|
|
2564
|
-
// which flushed updates immediately after the scope function exits, even
|
|
2565
|
-
// if it's an async function.
|
|
2566
|
-
|
|
2567
|
-
if (!prevIsBatchingLegacy && ReactCurrentActQueue.didScheduleLegacyUpdate) {
|
|
2568
|
-
var queue = ReactCurrentActQueue.current;
|
|
2569
|
-
|
|
2570
|
-
if (queue !== null) {
|
|
2571
|
-
ReactCurrentActQueue.didScheduleLegacyUpdate = false;
|
|
2572
|
-
flushActQueue(queue);
|
|
2573
|
-
}
|
|
2574
|
-
}
|
|
2575
|
-
} catch (error) {
|
|
2576
|
-
popActScope(prevActScopeDepth);
|
|
2577
|
-
throw error;
|
|
2578
|
-
} finally {
|
|
2579
|
-
ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy;
|
|
2580
|
-
}
|
|
2581
|
-
|
|
2582
|
-
if (result !== null && typeof result === 'object' && typeof result.then === 'function') {
|
|
2583
|
-
var thenableResult = result; // The callback is an async function (i.e. returned a promise). Wait
|
|
2584
|
-
// for it to resolve before exiting the current scope.
|
|
2585
|
-
|
|
2586
|
-
var wasAwaited = false;
|
|
2587
|
-
var thenable = {
|
|
2588
|
-
then: function (resolve, reject) {
|
|
2589
|
-
wasAwaited = true;
|
|
2590
|
-
thenableResult.then(function (returnValue) {
|
|
2591
|
-
popActScope(prevActScopeDepth);
|
|
2592
|
-
|
|
2593
|
-
if (actScopeDepth === 0) {
|
|
2594
|
-
// We've exited the outermost act scope. Recursively flush the
|
|
2595
|
-
// queue until there's no remaining work.
|
|
2596
|
-
recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
|
2597
|
-
} else {
|
|
2598
|
-
resolve(returnValue);
|
|
2599
|
-
}
|
|
2600
|
-
}, function (error) {
|
|
2601
|
-
// The callback threw an error.
|
|
2602
|
-
popActScope(prevActScopeDepth);
|
|
2603
|
-
reject(error);
|
|
2604
|
-
});
|
|
2605
|
-
}
|
|
2606
|
-
};
|
|
2607
|
-
|
|
2608
|
-
{
|
|
2609
|
-
if (!didWarnNoAwaitAct && typeof Promise !== 'undefined') {
|
|
2610
|
-
// eslint-disable-next-line no-undef
|
|
2611
|
-
Promise.resolve().then(function () {}).then(function () {
|
|
2612
|
-
if (!wasAwaited) {
|
|
2613
|
-
didWarnNoAwaitAct = true;
|
|
2614
|
-
|
|
2615
|
-
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 () => ...);');
|
|
2616
|
-
}
|
|
2617
|
-
});
|
|
2618
|
-
}
|
|
2619
|
-
}
|
|
2620
|
-
|
|
2621
|
-
return thenable;
|
|
2622
|
-
} else {
|
|
2623
|
-
var returnValue = result; // The callback is not an async function. Exit the current scope
|
|
2624
|
-
// immediately, without awaiting.
|
|
2625
|
-
|
|
2626
|
-
popActScope(prevActScopeDepth);
|
|
2627
|
-
|
|
2628
|
-
if (actScopeDepth === 0) {
|
|
2629
|
-
// Exiting the outermost act scope. Flush the queue.
|
|
2630
|
-
var _queue = ReactCurrentActQueue.current;
|
|
2631
|
-
|
|
2632
|
-
if (_queue !== null) {
|
|
2633
|
-
flushActQueue(_queue);
|
|
2634
|
-
ReactCurrentActQueue.current = null;
|
|
2635
|
-
} // Return a thenable. If the user awaits it, we'll flush again in
|
|
2636
|
-
// case additional work was scheduled by a microtask.
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
var _thenable = {
|
|
2640
|
-
then: function (resolve, reject) {
|
|
2641
|
-
// Confirm we haven't re-entered another `act` scope, in case
|
|
2642
|
-
// the user does something weird like await the thenable
|
|
2643
|
-
// multiple times.
|
|
2644
|
-
if (ReactCurrentActQueue.current === null) {
|
|
2645
|
-
// Recursively flush the queue until there's no remaining work.
|
|
2646
|
-
ReactCurrentActQueue.current = [];
|
|
2647
|
-
recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
|
2648
|
-
} else {
|
|
2649
|
-
resolve(returnValue);
|
|
2650
|
-
}
|
|
2651
|
-
}
|
|
2652
|
-
};
|
|
2653
|
-
return _thenable;
|
|
2654
|
-
} else {
|
|
2655
|
-
// Since we're inside a nested `act` scope, the returned thenable
|
|
2656
|
-
// immediately resolves. The outer scope will flush the queue.
|
|
2657
|
-
var _thenable2 = {
|
|
2658
|
-
then: function (resolve, reject) {
|
|
2659
|
-
resolve(returnValue);
|
|
2660
|
-
}
|
|
2661
|
-
};
|
|
2662
|
-
return _thenable2;
|
|
2663
|
-
}
|
|
2664
|
-
}
|
|
2665
|
-
}
|
|
2666
|
-
}
|
|
2667
|
-
|
|
2668
|
-
function popActScope(prevActScopeDepth) {
|
|
2669
|
-
{
|
|
2670
|
-
if (prevActScopeDepth !== actScopeDepth - 1) {
|
|
2671
|
-
error('You seem to have overlapping act() calls, this is not supported. ' + 'Be sure to await previous act() calls before making a new one. ');
|
|
2672
|
-
}
|
|
2673
|
-
|
|
2674
|
-
actScopeDepth = prevActScopeDepth;
|
|
2675
|
-
}
|
|
2676
|
-
}
|
|
2677
|
-
|
|
2678
|
-
function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
|
|
2679
|
-
{
|
|
2680
|
-
var queue = ReactCurrentActQueue.current;
|
|
2681
|
-
|
|
2682
|
-
if (queue !== null) {
|
|
2683
|
-
try {
|
|
2684
|
-
flushActQueue(queue);
|
|
2685
|
-
enqueueTask(function () {
|
|
2686
|
-
if (queue.length === 0) {
|
|
2687
|
-
// No additional work was scheduled. Finish.
|
|
2688
|
-
ReactCurrentActQueue.current = null;
|
|
2689
|
-
resolve(returnValue);
|
|
2690
|
-
} else {
|
|
2691
|
-
// Keep flushing work until there's none left.
|
|
2692
|
-
recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
|
2693
|
-
}
|
|
2694
|
-
});
|
|
2695
|
-
} catch (error) {
|
|
2696
|
-
reject(error);
|
|
2697
|
-
}
|
|
2698
|
-
} else {
|
|
2699
|
-
resolve(returnValue);
|
|
2700
|
-
}
|
|
2701
|
-
}
|
|
2702
|
-
}
|
|
2703
|
-
|
|
2704
|
-
var isFlushing = false;
|
|
2705
|
-
|
|
2706
|
-
function flushActQueue(queue) {
|
|
2707
|
-
{
|
|
2708
|
-
if (!isFlushing) {
|
|
2709
|
-
// Prevent re-entrance.
|
|
2710
|
-
isFlushing = true;
|
|
2711
|
-
var i = 0;
|
|
2712
|
-
|
|
2713
|
-
try {
|
|
2714
|
-
for (; i < queue.length; i++) {
|
|
2715
|
-
var callback = queue[i];
|
|
2716
|
-
|
|
2717
|
-
do {
|
|
2718
|
-
callback = callback(true);
|
|
2719
|
-
} while (callback !== null);
|
|
2720
|
-
}
|
|
2721
|
-
|
|
2722
|
-
queue.length = 0;
|
|
2723
|
-
} catch (error) {
|
|
2724
|
-
// If something throws, leave the remaining callbacks on the queue.
|
|
2725
|
-
queue = queue.slice(i + 1);
|
|
2726
|
-
throw error;
|
|
2727
|
-
} finally {
|
|
2728
|
-
isFlushing = false;
|
|
2729
|
-
}
|
|
2730
|
-
}
|
|
2731
|
-
}
|
|
2732
|
-
}
|
|
2733
|
-
|
|
2734
|
-
var createElement$1 = createElementWithValidation ;
|
|
2735
|
-
var cloneElement$1 = cloneElementWithValidation ;
|
|
2736
|
-
var createFactory = createFactoryWithValidation ;
|
|
2737
|
-
var Children = {
|
|
2738
|
-
map: mapChildren,
|
|
2739
|
-
forEach: forEachChildren,
|
|
2740
|
-
count: countChildren,
|
|
2741
|
-
toArray: toArray,
|
|
2742
|
-
only: onlyChild
|
|
2743
|
-
};
|
|
2744
|
-
|
|
2745
|
-
exports.Children = Children;
|
|
2746
|
-
exports.Component = Component;
|
|
2747
|
-
exports.Fragment = REACT_FRAGMENT_TYPE;
|
|
2748
|
-
exports.Profiler = REACT_PROFILER_TYPE;
|
|
2749
|
-
exports.PureComponent = PureComponent;
|
|
2750
|
-
exports.StrictMode = REACT_STRICT_MODE_TYPE;
|
|
2751
|
-
exports.Suspense = REACT_SUSPENSE_TYPE;
|
|
2752
|
-
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
|
|
2753
|
-
exports.cloneElement = cloneElement$1;
|
|
2754
|
-
exports.createContext = createContext;
|
|
2755
|
-
exports.createElement = createElement$1;
|
|
2756
|
-
exports.createFactory = createFactory;
|
|
2757
|
-
exports.createRef = createRef;
|
|
2758
|
-
exports.forwardRef = forwardRef;
|
|
2759
|
-
exports.isValidElement = isValidElement;
|
|
2760
|
-
exports.lazy = lazy;
|
|
2761
|
-
exports.memo = memo;
|
|
2762
|
-
exports.startTransition = startTransition;
|
|
2763
|
-
exports.unstable_act = act;
|
|
2764
|
-
exports.useCallback = useCallback;
|
|
2765
|
-
exports.useContext = useContext;
|
|
2766
|
-
exports.useDebugValue = useDebugValue;
|
|
2767
|
-
exports.useDeferredValue = useDeferredValue;
|
|
2768
|
-
exports.useEffect = useEffect;
|
|
2769
|
-
exports.useId = useId;
|
|
2770
|
-
exports.useImperativeHandle = useImperativeHandle;
|
|
2771
|
-
exports.useInsertionEffect = useInsertionEffect;
|
|
2772
|
-
exports.useLayoutEffect = useLayoutEffect;
|
|
2773
|
-
exports.useMemo = useMemo;
|
|
2774
|
-
exports.useReducer = useReducer;
|
|
2775
|
-
exports.useRef = useRef;
|
|
2776
|
-
exports.useState = useState;
|
|
2777
|
-
exports.useSyncExternalStore = useSyncExternalStore;
|
|
2778
|
-
exports.useTransition = useTransition;
|
|
2779
|
-
exports.version = ReactVersion;
|
|
2780
|
-
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
|
2781
|
-
if (
|
|
2782
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
|
2783
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===
|
|
2784
|
-
'function'
|
|
2785
|
-
) {
|
|
2786
|
-
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
2787
|
-
}
|
|
2788
|
-
|
|
2789
|
-
})();
|
|
2790
|
-
}
|
|
2791
|
-
} (react_development, react_development.exports));
|
|
2792
|
-
return react_development.exports;
|
|
2793
|
-
}
|
|
2794
|
-
|
|
2795
|
-
var hasRequiredReact;
|
|
2796
|
-
|
|
2797
|
-
function requireReact () {
|
|
2798
|
-
if (hasRequiredReact) return react.exports;
|
|
2799
|
-
hasRequiredReact = 1;
|
|
2800
|
-
|
|
2801
|
-
if (process.env.NODE_ENV === 'production') {
|
|
2802
|
-
react.exports = requireReact_production_min();
|
|
2803
|
-
} else {
|
|
2804
|
-
react.exports = requireReact_development();
|
|
2805
|
-
}
|
|
2806
|
-
return react.exports;
|
|
2807
|
-
}
|
|
2808
|
-
|
|
2809
|
-
var reactExports = requireReact();
|
|
2810
|
-
var React = /*@__PURE__*/getDefaultExportFromCjs(reactExports);
|
|
2811
|
-
|
|
2812
5
|
function bind(fn, thisArg) {
|
|
2813
6
|
return function wrap() {
|
|
2814
7
|
return fn.apply(thisArg, arguments);
|
|
@@ -4089,10 +1282,10 @@ const hasStandardBrowserWebWorkerEnv = (() => {
|
|
|
4089
1282
|
})();
|
|
4090
1283
|
|
|
4091
1284
|
var utils = /*#__PURE__*/Object.freeze({
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
1285
|
+
__proto__: null,
|
|
1286
|
+
hasBrowserEnv: hasBrowserEnv,
|
|
1287
|
+
hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
|
|
1288
|
+
hasStandardBrowserEnv: hasStandardBrowserEnv
|
|
4096
1289
|
});
|
|
4097
1290
|
|
|
4098
1291
|
var platform = {
|
|
@@ -6066,7 +3259,7 @@ const whatType = ({
|
|
|
6066
3259
|
// const style=flexType(typeStyle,me,{},{})
|
|
6067
3260
|
// return 'type'
|
|
6068
3261
|
const typeStyle = typeof _typeStyle === 'function' ? _typeStyle?.bind(me)() : _typeStyle;
|
|
6069
|
-
return /*#__PURE__*/
|
|
3262
|
+
return /*#__PURE__*/React__default.createElement(type, {
|
|
6070
3263
|
style: typeStyle
|
|
6071
3264
|
});
|
|
6072
3265
|
} else if (render) {
|
|
@@ -6217,9 +3410,9 @@ const StyledCover = styled.div`
|
|
|
6217
3410
|
const Cover = ({
|
|
6218
3411
|
children
|
|
6219
3412
|
}) => {
|
|
6220
|
-
return /*#__PURE__*/
|
|
3413
|
+
return /*#__PURE__*/React__default.createElement(StyledCover, null, children);
|
|
6221
3414
|
};
|
|
6222
|
-
class JRSubmit extends
|
|
3415
|
+
class JRSubmit extends React__default.Component {
|
|
6223
3416
|
#methods = ['get', 'post', 'put', 'patch', 'delete', 'download'];
|
|
6224
3417
|
constructor(props) {
|
|
6225
3418
|
super(props);
|
|
@@ -6476,7 +3669,7 @@ class JRSubmit extends React.Component {
|
|
|
6476
3669
|
return;
|
|
6477
3670
|
}
|
|
6478
3671
|
render() {
|
|
6479
|
-
return this.props.cover != null && this.state?.lodaing ? /*#__PURE__*/
|
|
3672
|
+
return this.props.cover != null && this.state?.lodaing ? /*#__PURE__*/React__default.createElement(Cover, null, flexType(this.props.cover, this, null, null)) : this.renderer();
|
|
6480
3673
|
}
|
|
6481
3674
|
}
|
|
6482
3675
|
|
|
@@ -6494,12 +3687,12 @@ const FreeType$1 = ({
|
|
|
6494
3687
|
const content = config.bind(me)({
|
|
6495
3688
|
setStyle
|
|
6496
3689
|
});
|
|
6497
|
-
return /*#__PURE__*/
|
|
3690
|
+
return /*#__PURE__*/React__default.createElement(Tag, {
|
|
6498
3691
|
className: className,
|
|
6499
3692
|
style: style
|
|
6500
3693
|
}, content);
|
|
6501
3694
|
} else if (typeof config === 'string') {
|
|
6502
|
-
return /*#__PURE__*/
|
|
3695
|
+
return /*#__PURE__*/React__default.createElement(Tag, {
|
|
6503
3696
|
className: className
|
|
6504
3697
|
}, config);
|
|
6505
3698
|
}
|
|
@@ -6541,33 +3734,33 @@ const StyledJRFrame$1 = styled.div`
|
|
|
6541
3734
|
`;
|
|
6542
3735
|
class JRFrame extends JRSubmit {
|
|
6543
3736
|
renderer() {
|
|
6544
|
-
return /*#__PURE__*/
|
|
3737
|
+
return /*#__PURE__*/React__default.createElement(StyledJRFrame$1, {
|
|
6545
3738
|
style: this.props.style,
|
|
6546
3739
|
className: `${this.props.className} jr-frame`
|
|
6547
|
-
}, /*#__PURE__*/
|
|
3740
|
+
}, /*#__PURE__*/React__default.createElement(FreeType$1, {
|
|
6548
3741
|
tag: "div",
|
|
6549
3742
|
config: this.props.start,
|
|
6550
3743
|
me: this,
|
|
6551
3744
|
className: 'start'
|
|
6552
|
-
}), /*#__PURE__*/
|
|
3745
|
+
}), /*#__PURE__*/React__default.createElement("main", null, /*#__PURE__*/React__default.createElement(FreeType$1, {
|
|
6553
3746
|
tag: "header",
|
|
6554
3747
|
config: this.props.top,
|
|
6555
3748
|
me: this
|
|
6556
|
-
}), /*#__PURE__*/
|
|
3749
|
+
}), /*#__PURE__*/React__default.createElement("main", null, /*#__PURE__*/React__default.createElement(FreeType$1, {
|
|
6557
3750
|
tag: "div",
|
|
6558
3751
|
config: this.props.left,
|
|
6559
3752
|
me: this,
|
|
6560
3753
|
className: 'left'
|
|
6561
|
-
}), this.renderMe?.() ?? this.props.children, /*#__PURE__*/
|
|
3754
|
+
}), this.renderMe?.() ?? this.props.children, /*#__PURE__*/React__default.createElement(FreeType$1, {
|
|
6562
3755
|
tag: "div",
|
|
6563
3756
|
config: this.props.right,
|
|
6564
3757
|
me: this,
|
|
6565
3758
|
className: 'right'
|
|
6566
|
-
})), /*#__PURE__*/
|
|
3759
|
+
})), /*#__PURE__*/React__default.createElement(FreeType$1, {
|
|
6567
3760
|
tag: "footer",
|
|
6568
3761
|
config: this.props.bottom,
|
|
6569
3762
|
me: this
|
|
6570
|
-
})), /*#__PURE__*/
|
|
3763
|
+
})), /*#__PURE__*/React__default.createElement(FreeType$1, {
|
|
6571
3764
|
tag: "div",
|
|
6572
3765
|
config: this.props.end,
|
|
6573
3766
|
me: this,
|
|
@@ -6594,10 +3787,10 @@ const StyledSlider$1 = styled.div`
|
|
|
6594
3787
|
border-right:1px dashed gray;
|
|
6595
3788
|
}
|
|
6596
3789
|
`;
|
|
6597
|
-
class Slider$1 extends
|
|
3790
|
+
class Slider$1 extends React__default.Component {
|
|
6598
3791
|
constructor() {
|
|
6599
3792
|
super();
|
|
6600
|
-
this.sliderRef = /*#__PURE__*/
|
|
3793
|
+
this.sliderRef = /*#__PURE__*/React__default.createRef();
|
|
6601
3794
|
}
|
|
6602
3795
|
stop = e => {
|
|
6603
3796
|
this.sliderRef.current.classList.remove('resizing');
|
|
@@ -6646,7 +3839,7 @@ class Slider$1 extends React.Component {
|
|
|
6646
3839
|
}
|
|
6647
3840
|
render() {
|
|
6648
3841
|
const column = this.props.column;
|
|
6649
|
-
return /*#__PURE__*/
|
|
3842
|
+
return /*#__PURE__*/React__default.createElement(StyledSlider$1, {
|
|
6650
3843
|
ref: this.sliderRef,
|
|
6651
3844
|
onMouseDown: e => {
|
|
6652
3845
|
this.start(this.props.thRef, column);
|
|
@@ -6659,7 +3852,7 @@ const Colgroup = ({
|
|
|
6659
3852
|
leafColumns,
|
|
6660
3853
|
colGroupRef
|
|
6661
3854
|
}) => {
|
|
6662
|
-
return /*#__PURE__*/
|
|
3855
|
+
return /*#__PURE__*/React__default.createElement("colgroup", {
|
|
6663
3856
|
ref: colGroupRef
|
|
6664
3857
|
}, leafColumns?.map((_column, index) => {
|
|
6665
3858
|
const {
|
|
@@ -6669,7 +3862,7 @@ const Colgroup = ({
|
|
|
6669
3862
|
const style = {
|
|
6670
3863
|
width
|
|
6671
3864
|
};
|
|
6672
|
-
return /*#__PURE__*/
|
|
3865
|
+
return /*#__PURE__*/React__default.createElement("col", {
|
|
6673
3866
|
style: style,
|
|
6674
3867
|
key: index
|
|
6675
3868
|
});
|
|
@@ -6682,13 +3875,13 @@ const Ths$1 = ({
|
|
|
6682
3875
|
table
|
|
6683
3876
|
}) => {
|
|
6684
3877
|
return rowColumn?.map((column, colIndex) => {
|
|
6685
|
-
const thRef = /*#__PURE__*/
|
|
6686
|
-
return /*#__PURE__*/
|
|
3878
|
+
const thRef = /*#__PURE__*/React__default.createRef();
|
|
3879
|
+
return /*#__PURE__*/React__default.createElement("th", {
|
|
6687
3880
|
key: colIndex,
|
|
6688
3881
|
ref: thRef,
|
|
6689
3882
|
colSpan: column.colSpan,
|
|
6690
3883
|
rowSpan: column.rowSpan ?? (column.isLeaf && deep > rowIndex ? deep - rowIndex + 1 : null)
|
|
6691
|
-
}, flexType(column.label, table), table.props.resizableColumns === true && /*#__PURE__*/
|
|
3884
|
+
}, flexType(column.label, table), table.props.resizableColumns === true && /*#__PURE__*/React__default.createElement(Slider$1, {
|
|
6692
3885
|
table: table,
|
|
6693
3886
|
thRef: thRef,
|
|
6694
3887
|
column: column
|
|
@@ -6702,10 +3895,10 @@ const HeadTrs = ({
|
|
|
6702
3895
|
}) => {
|
|
6703
3896
|
const columns = Array.isArray(_columns?.[0]) ? _columns : [_columns];
|
|
6704
3897
|
return columns?.map((rowColumn, rowIndex) => {
|
|
6705
|
-
return /*#__PURE__*/
|
|
3898
|
+
return /*#__PURE__*/React__default.createElement("tr", {
|
|
6706
3899
|
className: trClassName,
|
|
6707
3900
|
key: rowIndex
|
|
6708
|
-
}, /*#__PURE__*/
|
|
3901
|
+
}, /*#__PURE__*/React__default.createElement(Ths$1, {
|
|
6709
3902
|
deep: columns.length - 1,
|
|
6710
3903
|
rowColumn: rowColumn,
|
|
6711
3904
|
rowIndex: rowIndex,
|
|
@@ -6718,10 +3911,10 @@ const THead = ({
|
|
|
6718
3911
|
leafColumns,
|
|
6719
3912
|
table
|
|
6720
3913
|
}) => {
|
|
6721
|
-
return /*#__PURE__*/
|
|
3914
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("thead", null, /*#__PURE__*/React__default.createElement(HeadTrs, {
|
|
6722
3915
|
columns: columns,
|
|
6723
3916
|
table: table
|
|
6724
|
-
})), /*#__PURE__*/
|
|
3917
|
+
})), /*#__PURE__*/React__default.createElement(Colgroup, {
|
|
6725
3918
|
leafColumns: leafColumns,
|
|
6726
3919
|
colGroupRef: table.colGroupRef
|
|
6727
3920
|
}));
|
|
@@ -6746,7 +3939,7 @@ const FootThs = ({
|
|
|
6746
3939
|
// }
|
|
6747
3940
|
let style = flexType(column.style, table, {}, {});
|
|
6748
3941
|
const content = whatType(column, table, column.label);
|
|
6749
|
-
return /*#__PURE__*/
|
|
3942
|
+
return /*#__PURE__*/React__default.createElement("th", {
|
|
6750
3943
|
style: style,
|
|
6751
3944
|
colSpan: column.colSpan,
|
|
6752
3945
|
rowSpan: column.rowSpan
|
|
@@ -6758,24 +3951,24 @@ const TFoot = ({
|
|
|
6758
3951
|
columns
|
|
6759
3952
|
}) => {
|
|
6760
3953
|
const trs = columns?.map((rowColumn, rowIndex) => {
|
|
6761
|
-
return /*#__PURE__*/
|
|
3954
|
+
return /*#__PURE__*/React__default.createElement("tr", {
|
|
6762
3955
|
key: rowIndex
|
|
6763
|
-
}, /*#__PURE__*/
|
|
3956
|
+
}, /*#__PURE__*/React__default.createElement(FootThs, {
|
|
6764
3957
|
columns: rowColumn,
|
|
6765
3958
|
table: table
|
|
6766
3959
|
}));
|
|
6767
3960
|
});
|
|
6768
|
-
return /*#__PURE__*/
|
|
3961
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("tfoot", null, trs));
|
|
6769
3962
|
};
|
|
6770
3963
|
|
|
6771
|
-
function _extends$
|
|
6772
|
-
return _extends$
|
|
3964
|
+
function _extends$1() {
|
|
3965
|
+
return _extends$1 = Object.assign ? Object.assign.bind() : function (n) {
|
|
6773
3966
|
for (var e = 1; e < arguments.length; e++) {
|
|
6774
3967
|
var t = arguments[e];
|
|
6775
3968
|
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
6776
3969
|
}
|
|
6777
3970
|
return n;
|
|
6778
|
-
}, _extends$
|
|
3971
|
+
}, _extends$1.apply(null, arguments);
|
|
6779
3972
|
}
|
|
6780
3973
|
|
|
6781
3974
|
styled.tbody`
|
|
@@ -6816,7 +4009,7 @@ const Ths = ({
|
|
|
6816
4009
|
content = column.label;
|
|
6817
4010
|
}
|
|
6818
4011
|
// style.textAlign=align
|
|
6819
|
-
return /*#__PURE__*/
|
|
4012
|
+
return /*#__PURE__*/React__default.createElement("th", {
|
|
6820
4013
|
key: colIndex,
|
|
6821
4014
|
style: {
|
|
6822
4015
|
textAlign: align,
|
|
@@ -6836,10 +4029,10 @@ const GroupColumns = ({
|
|
|
6836
4029
|
}) => {
|
|
6837
4030
|
const columns = Array.isArray(_columns?.[0]) ? _columns : [_columns];
|
|
6838
4031
|
return columns?.map((rowColumn, rowIndex) => {
|
|
6839
|
-
return /*#__PURE__*/
|
|
4032
|
+
return /*#__PURE__*/React__default.createElement("tr", {
|
|
6840
4033
|
className: trClassName,
|
|
6841
4034
|
key: rowIndex
|
|
6842
|
-
}, /*#__PURE__*/
|
|
4035
|
+
}, /*#__PURE__*/React__default.createElement(Ths, {
|
|
6843
4036
|
table: table,
|
|
6844
4037
|
groupData: groupData,
|
|
6845
4038
|
groupIndex: tbodyIndex,
|
|
@@ -6859,7 +4052,7 @@ styled.tr`
|
|
|
6859
4052
|
}
|
|
6860
4053
|
`;
|
|
6861
4054
|
const GroupHeader = props => {
|
|
6862
|
-
return /*#__PURE__*/
|
|
4055
|
+
return /*#__PURE__*/React__default.createElement(GroupColumns, _extends$1({
|
|
6863
4056
|
trClassName: 'jr-group-header'
|
|
6864
4057
|
}, props));
|
|
6865
4058
|
};
|
|
@@ -6870,7 +4063,7 @@ styled.tr`
|
|
|
6870
4063
|
}
|
|
6871
4064
|
`;
|
|
6872
4065
|
const GroupFooter = props => {
|
|
6873
|
-
return /*#__PURE__*/
|
|
4066
|
+
return /*#__PURE__*/React__default.createElement(GroupColumns, _extends$1({
|
|
6874
4067
|
trClassName: 'jr-group-footer'
|
|
6875
4068
|
}, props));
|
|
6876
4069
|
};
|
|
@@ -6917,7 +4110,7 @@ const Td = ({
|
|
|
6917
4110
|
const typeStyle = flexType(_typeStyle, table, {
|
|
6918
4111
|
record
|
|
6919
4112
|
}, {});
|
|
6920
|
-
content = /*#__PURE__*/
|
|
4113
|
+
content = /*#__PURE__*/React__default.createElement(type, {
|
|
6921
4114
|
onChange: _onChange ? e => {
|
|
6922
4115
|
_onChange?.bind(table)(e, {
|
|
6923
4116
|
value,
|
|
@@ -6945,7 +4138,7 @@ const Td = ({
|
|
|
6945
4138
|
} else {
|
|
6946
4139
|
content = value;
|
|
6947
4140
|
}
|
|
6948
|
-
return /*#__PURE__*/
|
|
4141
|
+
return /*#__PURE__*/React__default.createElement("td", {
|
|
6949
4142
|
colSpan: style.colSpan,
|
|
6950
4143
|
rowSpan: style.rowSpan,
|
|
6951
4144
|
style: {
|
|
@@ -6964,7 +4157,7 @@ const Tds = ({
|
|
|
6964
4157
|
trIndex
|
|
6965
4158
|
}) => {
|
|
6966
4159
|
return leafColumns?.map((column, tdIndex) => {
|
|
6967
|
-
return /*#__PURE__*/
|
|
4160
|
+
return /*#__PURE__*/React__default.createElement(Td, {
|
|
6968
4161
|
column: column,
|
|
6969
4162
|
key: tdIndex,
|
|
6970
4163
|
record: record,
|
|
@@ -6989,14 +4182,14 @@ const TBody = ({
|
|
|
6989
4182
|
table,
|
|
6990
4183
|
tbodyIndex
|
|
6991
4184
|
};
|
|
6992
|
-
return /*#__PURE__*/
|
|
4185
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("tbody", {
|
|
6993
4186
|
key: `tbody${tbodyIndex}`
|
|
6994
|
-
}, groupData?.length > 0 && /*#__PURE__*/
|
|
4187
|
+
}, groupData?.length > 0 && /*#__PURE__*/React__default.createElement(GroupHeader, _extends$1({
|
|
6995
4188
|
groupData: groupData,
|
|
6996
4189
|
columns: groupHeader
|
|
6997
4190
|
}, neededProps)), groupData?.map?.((record, trIndex) => {
|
|
6998
4191
|
const onRowClick = table.props.onRowClick?.bind(table);
|
|
6999
|
-
return /*#__PURE__*/
|
|
4192
|
+
return /*#__PURE__*/React__default.createElement("tr", {
|
|
7000
4193
|
key: trIndex,
|
|
7001
4194
|
onClick: () => {
|
|
7002
4195
|
onRowClick?.({
|
|
@@ -7005,13 +4198,13 @@ const TBody = ({
|
|
|
7005
4198
|
groupIndex: tbodyIndex
|
|
7006
4199
|
});
|
|
7007
4200
|
}
|
|
7008
|
-
}, /*#__PURE__*/
|
|
4201
|
+
}, /*#__PURE__*/React__default.createElement(Tds, _extends$1({
|
|
7009
4202
|
record: record,
|
|
7010
4203
|
trIndex: trIndex
|
|
7011
4204
|
}, neededProps, {
|
|
7012
4205
|
leafColumns: leafColumns
|
|
7013
4206
|
})));
|
|
7014
|
-
}), groupData?.length > 0 && /*#__PURE__*/
|
|
4207
|
+
}), groupData?.length > 0 && /*#__PURE__*/React__default.createElement(GroupFooter, _extends$1({
|
|
7015
4208
|
groupData: groupData,
|
|
7016
4209
|
columns: groupFooter
|
|
7017
4210
|
}, neededProps))));
|
|
@@ -7029,7 +4222,7 @@ const TBodies = ({
|
|
|
7029
4222
|
|
|
7030
4223
|
// po('dataSource',dataSource)
|
|
7031
4224
|
return dataSource?.map((groupData, tbodyIndex, c) => {
|
|
7032
|
-
return /*#__PURE__*/
|
|
4225
|
+
return /*#__PURE__*/React__default.createElement(TBody, {
|
|
7033
4226
|
key: `tbody${tbodyIndex}`,
|
|
7034
4227
|
table: table
|
|
7035
4228
|
// dataSource={dataSource}
|
|
@@ -7177,49 +4370,10 @@ const StyledJRTable = styled.div`
|
|
|
7177
4370
|
}
|
|
7178
4371
|
`;
|
|
7179
4372
|
|
|
7180
|
-
var _path$1;
|
|
7181
|
-
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); }
|
|
7182
|
-
var SvgX = function SvgX(props) {
|
|
7183
|
-
return /*#__PURE__*/reactExports.createElement("svg", _extends$2({
|
|
7184
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
7185
|
-
width: 24,
|
|
7186
|
-
height: 24,
|
|
7187
|
-
fill: "none",
|
|
7188
|
-
stroke: "currentColor",
|
|
7189
|
-
strokeLinecap: "round",
|
|
7190
|
-
strokeLinejoin: "round",
|
|
7191
|
-
strokeWidth: 2
|
|
7192
|
-
}, props), _path$1 || (_path$1 = /*#__PURE__*/reactExports.createElement("path", {
|
|
7193
|
-
d: "M18 6 6 18M6 6l12 12"
|
|
7194
|
-
})));
|
|
7195
|
-
};
|
|
7196
|
-
|
|
7197
|
-
var _rect;
|
|
7198
|
-
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); }
|
|
7199
|
-
var SvgSquare = function SvgSquare(props) {
|
|
7200
|
-
return /*#__PURE__*/reactExports.createElement("svg", _extends$1({
|
|
7201
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
7202
|
-
width: 24,
|
|
7203
|
-
height: 24,
|
|
7204
|
-
fill: "none",
|
|
7205
|
-
stroke: "currentColor",
|
|
7206
|
-
strokeLinecap: "round",
|
|
7207
|
-
strokeLinejoin: "round",
|
|
7208
|
-
strokeWidth: 2
|
|
7209
|
-
}, props), _rect || (_rect = /*#__PURE__*/reactExports.createElement("rect", {
|
|
7210
|
-
width: 18,
|
|
7211
|
-
height: 18,
|
|
7212
|
-
x: 3,
|
|
7213
|
-
y: 3,
|
|
7214
|
-
rx: 2,
|
|
7215
|
-
ry: 2
|
|
7216
|
-
})));
|
|
7217
|
-
};
|
|
7218
|
-
|
|
7219
4373
|
var _path;
|
|
7220
4374
|
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); }
|
|
7221
|
-
var
|
|
7222
|
-
return /*#__PURE__*/
|
|
4375
|
+
var SvgX = function SvgX(props) {
|
|
4376
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
7223
4377
|
xmlns: "http://www.w3.org/2000/svg",
|
|
7224
4378
|
width: 24,
|
|
7225
4379
|
height: 24,
|
|
@@ -7227,9 +4381,10 @@ var SvgMinus = function SvgMinus(props) {
|
|
|
7227
4381
|
stroke: "currentColor",
|
|
7228
4382
|
strokeLinecap: "round",
|
|
7229
4383
|
strokeLinejoin: "round",
|
|
7230
|
-
strokeWidth: 2
|
|
7231
|
-
|
|
7232
|
-
|
|
4384
|
+
strokeWidth: 2,
|
|
4385
|
+
viewBox: "0 0 24 24"
|
|
4386
|
+
}, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
|
|
4387
|
+
d: "M18 6 6 18M6 6l12 12"
|
|
7233
4388
|
})));
|
|
7234
4389
|
};
|
|
7235
4390
|
|
|
@@ -7238,7 +4393,7 @@ function JRButton({
|
|
|
7238
4393
|
children,
|
|
7239
4394
|
...props
|
|
7240
4395
|
}) {
|
|
7241
|
-
return /*#__PURE__*/
|
|
4396
|
+
return /*#__PURE__*/React__default.createElement("button", props, icon, children);
|
|
7242
4397
|
}
|
|
7243
4398
|
|
|
7244
4399
|
const StyledTitle = styled.div`
|
|
@@ -7287,6 +4442,7 @@ const StyledTitle = styled.div`
|
|
|
7287
4442
|
color:white;
|
|
7288
4443
|
}
|
|
7289
4444
|
>svg{
|
|
4445
|
+
color:black;
|
|
7290
4446
|
width:14px;
|
|
7291
4447
|
height:14px;
|
|
7292
4448
|
cursor: pointer;
|
|
@@ -7294,11 +4450,13 @@ const StyledTitle = styled.div`
|
|
|
7294
4450
|
}
|
|
7295
4451
|
>button.danger:hover{
|
|
7296
4452
|
background: red;
|
|
7297
|
-
|
|
4453
|
+
>svg{
|
|
4454
|
+
color:white;
|
|
4455
|
+
}
|
|
7298
4456
|
}
|
|
7299
4457
|
}
|
|
7300
4458
|
`;
|
|
7301
|
-
class TitleBar extends
|
|
4459
|
+
class TitleBar extends React__default.Component {
|
|
7302
4460
|
pos1 = 0;
|
|
7303
4461
|
pos2 = 0;
|
|
7304
4462
|
pos3 = 0;
|
|
@@ -7308,6 +4466,10 @@ class TitleBar extends React.Component {
|
|
|
7308
4466
|
stop = e => {
|
|
7309
4467
|
e.preventDefault();
|
|
7310
4468
|
if (this.moved) {
|
|
4469
|
+
const {
|
|
4470
|
+
clientX,
|
|
4471
|
+
clientY
|
|
4472
|
+
} = e;
|
|
7311
4473
|
const {
|
|
7312
4474
|
height: titleBarHeight
|
|
7313
4475
|
} = this.props.titleBarRef.current.getBoundingClientRect();
|
|
@@ -7317,7 +4479,6 @@ class TitleBar extends React.Component {
|
|
|
7317
4479
|
width,
|
|
7318
4480
|
height
|
|
7319
4481
|
} = this.props.windowRef.current.getBoundingClientRect();
|
|
7320
|
-
po('y', y);
|
|
7321
4482
|
if (y < 1) {
|
|
7322
4483
|
this.props.windowRef.current.style.transition = 'var(--transition-x-y), left .1s ease-in';
|
|
7323
4484
|
this.props.windowRef.current.style.left = `${-this.props.thick}px`;
|
|
@@ -7326,6 +4487,7 @@ class TitleBar extends React.Component {
|
|
|
7326
4487
|
|
|
7327
4488
|
this.props.window.orgHeight = height;
|
|
7328
4489
|
this.props.window.orgWidth = width;
|
|
4490
|
+
this.props.window.orgXd = clientX - x;
|
|
7329
4491
|
}
|
|
7330
4492
|
if (y > window.innerHeight) this.props.windowRef.current.style.top = `${window.innerHeight - titleBarHeight}px`;
|
|
7331
4493
|
if (x + width - this.props.thick < 0) this.props.windowRef.current.style.left = 0;
|
|
@@ -7334,6 +4496,7 @@ class TitleBar extends React.Component {
|
|
|
7334
4496
|
}
|
|
7335
4497
|
window.removeEventListener('mousemove', this.move);
|
|
7336
4498
|
window.removeEventListener('mouseup', this.stop);
|
|
4499
|
+
window.removeEventListener('mousemove', this.preMove);
|
|
7337
4500
|
};
|
|
7338
4501
|
move = e => {
|
|
7339
4502
|
e.preventDefault();
|
|
@@ -7348,12 +4511,8 @@ class TitleBar extends React.Component {
|
|
|
7348
4511
|
this.pos3 = clientX;
|
|
7349
4512
|
this.pos4 = y;
|
|
7350
4513
|
const w = this.props.windowRef.current;
|
|
7351
|
-
this.x = w.offsetLeft - this.pos1;
|
|
7352
4514
|
this.y = w.offsetTop - this.pos2;
|
|
7353
|
-
|
|
7354
|
-
w.style.height = `${this.props.window.orgHeight}px`;
|
|
7355
|
-
this.props.window.orgHeight = null;
|
|
7356
|
-
}
|
|
4515
|
+
this.x = w.offsetLeft - this.pos1;
|
|
7357
4516
|
if (this.props.window.orgWidth) {
|
|
7358
4517
|
if (clientX > this.props.window.orgWidth) {
|
|
7359
4518
|
this.x = clientX - this.props.window.orgWidth / 2;
|
|
@@ -7362,8 +4521,29 @@ class TitleBar extends React.Component {
|
|
|
7362
4521
|
this.props.window.orgWidth = null;
|
|
7363
4522
|
}
|
|
7364
4523
|
this.y = this.y < -this.props.thick ? -this.props.thick : this.y;
|
|
7365
|
-
w.style.
|
|
7366
|
-
w.style.
|
|
4524
|
+
w.style.transition = 'unset';
|
|
4525
|
+
w.style.top = `${this.y}px`;
|
|
4526
|
+
w.style.left = `${this.x}px`;
|
|
4527
|
+
};
|
|
4528
|
+
preMove = e => {
|
|
4529
|
+
const w = this.props.windowRef.current;
|
|
4530
|
+
const {
|
|
4531
|
+
clientX,
|
|
4532
|
+
clientY
|
|
4533
|
+
} = e;
|
|
4534
|
+
if (this.props.window.orgXd) {
|
|
4535
|
+
w.style.left = `${clientX - this.props.window.orgXd}px`;
|
|
4536
|
+
this.props.window.orgXd = null;
|
|
4537
|
+
}
|
|
4538
|
+
if (this.props.window.orgHeight) {
|
|
4539
|
+
w.style.height = `${this.props.window.orgHeight}px`;
|
|
4540
|
+
this.props.window.orgHeight = null;
|
|
4541
|
+
}
|
|
4542
|
+
w.style.transition = 'left .1s ease-in, height .1s ease-in';
|
|
4543
|
+
setTimeout(() => {
|
|
4544
|
+
window.addEventListener('mousemove', this.move);
|
|
4545
|
+
}, 100);
|
|
4546
|
+
window.removeEventListener('mousemove', this.preMove);
|
|
7367
4547
|
};
|
|
7368
4548
|
start(e) {
|
|
7369
4549
|
e.preventDefault();
|
|
@@ -7372,27 +4552,23 @@ class TitleBar extends React.Component {
|
|
|
7372
4552
|
this.pos4 = e.clientY;
|
|
7373
4553
|
this.props.windowRef.current.style.transition = 'var(--transition-x-y)';
|
|
7374
4554
|
document.body.style.cursor = 'grabbing';
|
|
7375
|
-
window.addEventListener('mousemove', this.
|
|
4555
|
+
window.addEventListener('mousemove', this.preMove);
|
|
7376
4556
|
window.addEventListener('mouseup', this.stop);
|
|
7377
4557
|
}
|
|
7378
4558
|
render() {
|
|
7379
|
-
return /*#__PURE__*/
|
|
4559
|
+
return /*#__PURE__*/React__default.createElement(StyledTitle, {
|
|
7380
4560
|
ref: this.props.titleBarRef,
|
|
7381
4561
|
draggable: "false",
|
|
7382
4562
|
onMouseDown: e => {
|
|
7383
4563
|
this.start(e);
|
|
7384
4564
|
}
|
|
7385
|
-
}, /*#__PURE__*/
|
|
4565
|
+
}, /*#__PURE__*/React__default.createElement(FreeType$1, {
|
|
7386
4566
|
tag: "div",
|
|
7387
4567
|
config: this.props.title ?? '',
|
|
7388
4568
|
me: this.props.window,
|
|
7389
4569
|
className: 'title'
|
|
7390
|
-
}), /*#__PURE__*/
|
|
7391
|
-
icon: /*#__PURE__*/
|
|
7392
|
-
}), /*#__PURE__*/React.createElement(JRButton, {
|
|
7393
|
-
icon: /*#__PURE__*/React.createElement(SvgSquare, null)
|
|
7394
|
-
}), this.props.window.props.setOpen ? /*#__PURE__*/React.createElement(JRButton, {
|
|
7395
|
-
icon: /*#__PURE__*/React.createElement(SvgX, null),
|
|
4570
|
+
}), /*#__PURE__*/React__default.createElement("nav", null, this.props.window.props.setOpen ? /*#__PURE__*/React__default.createElement(JRButton, {
|
|
4571
|
+
icon: /*#__PURE__*/React__default.createElement(SvgX, null),
|
|
7396
4572
|
className: 'danger',
|
|
7397
4573
|
onClick: () => {
|
|
7398
4574
|
this.props.window.props.setOpen(false);
|
|
@@ -7402,9 +4578,9 @@ class TitleBar extends React.Component {
|
|
|
7402
4578
|
}
|
|
7403
4579
|
|
|
7404
4580
|
const directions = ['n', 'e', 's', 'w', 'nww', 'nnw', 'nne', 'nee', 'sse', 'see', 'sww', 'ssw'];
|
|
7405
|
-
class Sliders extends
|
|
4581
|
+
class Sliders extends React__default.Component {
|
|
7406
4582
|
render() {
|
|
7407
|
-
return directions.map((direction, index) => /*#__PURE__*/
|
|
4583
|
+
return directions.map((direction, index) => /*#__PURE__*/React__default.createElement(Slider, {
|
|
7408
4584
|
direction: direction,
|
|
7409
4585
|
thick: this.props.thick,
|
|
7410
4586
|
windowRef: this.props.windowRef,
|
|
@@ -7469,13 +4645,13 @@ const StyledSlider = styled.div`
|
|
|
7469
4645
|
user-select: none;
|
|
7470
4646
|
|
|
7471
4647
|
`;
|
|
7472
|
-
class Slider extends
|
|
4648
|
+
class Slider extends React__default.Component {
|
|
7473
4649
|
width = '3px';
|
|
7474
4650
|
borderWidth = 'px';
|
|
7475
|
-
borderLong =
|
|
4651
|
+
borderLong = 5;
|
|
7476
4652
|
constructor(props) {
|
|
7477
4653
|
super(props);
|
|
7478
|
-
this.sliderRef = /*#__PURE__*/
|
|
4654
|
+
this.sliderRef = /*#__PURE__*/React__default.createRef();
|
|
7479
4655
|
}
|
|
7480
4656
|
directions = {
|
|
7481
4657
|
n: {
|
|
@@ -7702,10 +4878,12 @@ class Slider extends React.Component {
|
|
|
7702
4878
|
if (x > window.innerWidth) this.props.windowRef.current.style.left = `${window.innerWidth - width}px`;
|
|
7703
4879
|
document.body.style.cursor = 'default';
|
|
7704
4880
|
window.removeEventListener('mousemove', this.move);
|
|
4881
|
+
window.removeEventListener('mousemove', this.preMove);
|
|
7705
4882
|
window.removeEventListener('mouseup', this.stop);
|
|
7706
4883
|
};
|
|
7707
4884
|
move = e => {
|
|
7708
4885
|
e.preventDefault();
|
|
4886
|
+
this.props.windowRef.current.style.transition = 'unset';
|
|
7709
4887
|
const {
|
|
7710
4888
|
clientX,
|
|
7711
4889
|
clientY,
|
|
@@ -7717,7 +4895,7 @@ class Slider extends React.Component {
|
|
|
7717
4895
|
left,
|
|
7718
4896
|
top
|
|
7719
4897
|
} = window.getBoundingClientRect();
|
|
7720
|
-
|
|
4898
|
+
let {
|
|
7721
4899
|
x: startX,
|
|
7722
4900
|
width: startWidth,
|
|
7723
4901
|
y: startY,
|
|
@@ -7739,6 +4917,15 @@ class Slider extends React.Component {
|
|
|
7739
4917
|
top
|
|
7740
4918
|
});
|
|
7741
4919
|
};
|
|
4920
|
+
preMove = () => {
|
|
4921
|
+
this.props.windowRef.current.style.height = `${this.props.window.orgHeight}px`;
|
|
4922
|
+
this.data.height = this.props.window.orgHeight;
|
|
4923
|
+
this.props.window.orgHeight = null;
|
|
4924
|
+
window.removeEventListener('mousemove', this.preMove);
|
|
4925
|
+
setTimeout(() => {
|
|
4926
|
+
window.addEventListener('mousemove', this.move);
|
|
4927
|
+
}, 100);
|
|
4928
|
+
};
|
|
7742
4929
|
start = (e, direction) => {
|
|
7743
4930
|
e.preventDefault();
|
|
7744
4931
|
const {
|
|
@@ -7750,14 +4937,6 @@ class Slider extends React.Component {
|
|
|
7750
4937
|
width,
|
|
7751
4938
|
height
|
|
7752
4939
|
} = this.props.windowRef.current.getBoundingClientRect();
|
|
7753
|
-
if (direction.indexOf('n') > -1) {
|
|
7754
|
-
if (this.props.window.orgHeight) {
|
|
7755
|
-
height = this.props.window.orgHeight;
|
|
7756
|
-
this.props.window.orgHeight = null;
|
|
7757
|
-
}
|
|
7758
|
-
} else if (direction.indexOf('s') > -1) {
|
|
7759
|
-
this.props.window.orgHeight = null;
|
|
7760
|
-
}
|
|
7761
4940
|
this.data = {
|
|
7762
4941
|
x,
|
|
7763
4942
|
y,
|
|
@@ -7766,13 +4945,16 @@ class Slider extends React.Component {
|
|
|
7766
4945
|
titleBarHeight,
|
|
7767
4946
|
direction
|
|
7768
4947
|
};
|
|
7769
|
-
this.props.windowRef.current.style.transition = 'unset';
|
|
7770
4948
|
document.body.style.cursor = this.directions[this.props.direction].cursor;
|
|
7771
|
-
|
|
4949
|
+
if (this.props.window.orgHeight) {
|
|
4950
|
+
window.addEventListener('mousemove', this.preMove);
|
|
4951
|
+
} else {
|
|
4952
|
+
window.addEventListener('mousemove', this.move);
|
|
4953
|
+
}
|
|
7772
4954
|
window.addEventListener('mouseup', this.stop);
|
|
7773
4955
|
};
|
|
7774
4956
|
render() {
|
|
7775
|
-
return /*#__PURE__*/
|
|
4957
|
+
return /*#__PURE__*/React__default.createElement(StyledSlider, {
|
|
7776
4958
|
$direction: this.directions[this.props.direction],
|
|
7777
4959
|
$padding: this.props.padding,
|
|
7778
4960
|
onMouseDown: e => {
|
|
@@ -7827,6 +5009,12 @@ const StyledJRWindow = styled.div`
|
|
|
7827
5009
|
display: flex;
|
|
7828
5010
|
}
|
|
7829
5011
|
}
|
|
5012
|
+
|
|
5013
|
+
@container (min-width: 700px) {
|
|
5014
|
+
&{
|
|
5015
|
+
border: 1px solid red;
|
|
5016
|
+
}
|
|
5017
|
+
}
|
|
7830
5018
|
`;
|
|
7831
5019
|
class JRWindow extends JRFrame {
|
|
7832
5020
|
x = 0;
|
|
@@ -7837,8 +5025,8 @@ class JRWindow extends JRFrame {
|
|
|
7837
5025
|
thick = 5;
|
|
7838
5026
|
constructor(props) {
|
|
7839
5027
|
super(props);
|
|
7840
|
-
this.ref = /*#__PURE__*/
|
|
7841
|
-
this.titleBarRef = /*#__PURE__*/
|
|
5028
|
+
this.ref = /*#__PURE__*/React__default.createRef();
|
|
5029
|
+
this.titleBarRef = /*#__PURE__*/React__default.createRef();
|
|
7842
5030
|
this.init();
|
|
7843
5031
|
}
|
|
7844
5032
|
componentWillUpdate(prevProps, prevState, snapshot) {
|
|
@@ -7853,7 +5041,7 @@ class JRWindow extends JRFrame {
|
|
|
7853
5041
|
this.y = this.props.y ?? (window.innerHeight - (this.height ?? 300)) / 2;
|
|
7854
5042
|
}
|
|
7855
5043
|
renderer() {
|
|
7856
|
-
return this.props.popup === true ? this.props.open === true ? /*#__PURE__*/
|
|
5044
|
+
return this.props.popup === true ? this.props.open === true ? /*#__PURE__*/React__default.createElement(StyledJRWindow, {
|
|
7857
5045
|
ref: this.ref,
|
|
7858
5046
|
className: `jr-window ${this.props.className ?? ''}`,
|
|
7859
5047
|
$x: this.x,
|
|
@@ -7861,13 +5049,13 @@ class JRWindow extends JRFrame {
|
|
|
7861
5049
|
$width: this.width,
|
|
7862
5050
|
$height: this.height,
|
|
7863
5051
|
$thick: this.thick
|
|
7864
|
-
}, /*#__PURE__*/
|
|
5052
|
+
}, /*#__PURE__*/React__default.createElement("main", null, /*#__PURE__*/React__default.createElement(TitleBar, {
|
|
7865
5053
|
titleBarRef: this.titleBarRef,
|
|
7866
5054
|
windowRef: this.ref,
|
|
7867
5055
|
window: this,
|
|
7868
5056
|
title: this.props.title,
|
|
7869
5057
|
thick: this.thick
|
|
7870
|
-
}), /*#__PURE__*/
|
|
5058
|
+
}), /*#__PURE__*/React__default.createElement("main", null, super.renderer())), /*#__PURE__*/React__default.createElement(Sliders, {
|
|
7871
5059
|
thick: this.thick,
|
|
7872
5060
|
windowRef: this.ref,
|
|
7873
5061
|
window: this,
|
|
@@ -7898,7 +5086,7 @@ const setMapObject = (map, names, value) => {
|
|
|
7898
5086
|
class JRTable extends JRWindow {
|
|
7899
5087
|
constructor(props) {
|
|
7900
5088
|
super(props);
|
|
7901
|
-
this.colGroupRef = /*#__PURE__*/
|
|
5089
|
+
this.colGroupRef = /*#__PURE__*/React__default.createRef();
|
|
7902
5090
|
}
|
|
7903
5091
|
UNSAFE_componentWillMount() {
|
|
7904
5092
|
this.setColumns(this.props.columns ?? []);
|
|
@@ -7915,7 +5103,7 @@ class JRTable extends JRWindow {
|
|
|
7915
5103
|
value,
|
|
7916
5104
|
onChange
|
|
7917
5105
|
}) {
|
|
7918
|
-
return /*#__PURE__*/
|
|
5106
|
+
return /*#__PURE__*/React__default.createElement("checkbox", {
|
|
7919
5107
|
checked: value,
|
|
7920
5108
|
onChange: e => {
|
|
7921
5109
|
onChange(e.target.checked);
|
|
@@ -7954,7 +5142,7 @@ class JRTable extends JRWindow {
|
|
|
7954
5142
|
value,
|
|
7955
5143
|
onChange
|
|
7956
5144
|
}) {
|
|
7957
|
-
return /*#__PURE__*/
|
|
5145
|
+
return /*#__PURE__*/React__default.createElement("checkbox", {
|
|
7958
5146
|
checked: value,
|
|
7959
5147
|
onChange: e => {
|
|
7960
5148
|
onChange(e.target.checked);
|
|
@@ -7964,7 +5152,7 @@ class JRTable extends JRWindow {
|
|
|
7964
5152
|
align: 'center',
|
|
7965
5153
|
name,
|
|
7966
5154
|
label() {
|
|
7967
|
-
return /*#__PURE__*/
|
|
5155
|
+
return /*#__PURE__*/React__default.createElement("button", {
|
|
7968
5156
|
onClick: () => {
|
|
7969
5157
|
const value = this.props.delete.value ?? this.getDataSource()?.filter(record => record[name]).map(record => sendValue ? record[sendValue] : record);
|
|
7970
5158
|
const callback = this.props.delete.callback ?? function (a, b, c) {
|
|
@@ -8087,25 +5275,25 @@ class JRTable extends JRWindow {
|
|
|
8087
5275
|
}
|
|
8088
5276
|
//------------------------------------------------------------------------------------
|
|
8089
5277
|
renderMe() {
|
|
8090
|
-
return /*#__PURE__*/
|
|
5278
|
+
return /*#__PURE__*/React__default.createElement(StyledJRTable, {
|
|
8091
5279
|
className: `${this.props.className ?? ''} jr-table ${this.props.onRowClick ? 'row-highlightable' : ''}`
|
|
8092
|
-
}, /*#__PURE__*/
|
|
5280
|
+
}, /*#__PURE__*/React__default.createElement("table", {
|
|
8093
5281
|
className: 'jr-table-table'
|
|
8094
|
-
}, /*#__PURE__*/
|
|
5282
|
+
}, /*#__PURE__*/React__default.createElement(TBodies, {
|
|
8095
5283
|
table: this,
|
|
8096
5284
|
leafColumns: this.state.leafColumns,
|
|
8097
5285
|
groupHeader: this.props.groupHeader,
|
|
8098
5286
|
groupFooter: this.props.groupFooter,
|
|
8099
5287
|
dataSource: this.getDataSource(),
|
|
8100
5288
|
onRowClick: this.props.onRowClick
|
|
8101
|
-
}), /*#__PURE__*/
|
|
5289
|
+
}), /*#__PURE__*/React__default.createElement(TFoot, {
|
|
8102
5290
|
columns: this.props.footColumns,
|
|
8103
5291
|
table: this
|
|
8104
|
-
}), /*#__PURE__*/
|
|
5292
|
+
}), /*#__PURE__*/React__default.createElement(THead, {
|
|
8105
5293
|
columns: this.state.columns,
|
|
8106
5294
|
leafColumns: this.state.leafColumns,
|
|
8107
5295
|
table: this
|
|
8108
|
-
})), /*#__PURE__*/
|
|
5296
|
+
})), /*#__PURE__*/React__default.createElement("div", {
|
|
8109
5297
|
className: 'empty'
|
|
8110
5298
|
}, this.noData() && '無資料'));
|
|
8111
5299
|
}
|
|
@@ -8454,12 +5642,12 @@ class JRFields extends JRWindow {
|
|
|
8454
5642
|
}
|
|
8455
5643
|
if (type) {
|
|
8456
5644
|
const typeStyle = flexType(_typeStyle, this, null);
|
|
8457
|
-
content = /*#__PURE__*/
|
|
5645
|
+
content = /*#__PURE__*/React__default.createElement(StyledColumnValue, {
|
|
8458
5646
|
className: 'jr-column-value',
|
|
8459
5647
|
style: {
|
|
8460
5648
|
gridColumn: label == null ? 'span 2' : null
|
|
8461
5649
|
}
|
|
8462
|
-
}, /*#__PURE__*/
|
|
5650
|
+
}, /*#__PURE__*/React__default.createElement(type, {
|
|
8463
5651
|
value: value,
|
|
8464
5652
|
onChange,
|
|
8465
5653
|
record: parentValue,
|
|
@@ -8470,13 +5658,13 @@ class JRFields extends JRWindow {
|
|
|
8470
5658
|
...column
|
|
8471
5659
|
}));
|
|
8472
5660
|
} else if (column.columns) {
|
|
8473
|
-
content = /*#__PURE__*/
|
|
5661
|
+
content = /*#__PURE__*/React__default.createElement(StyledGrid, {
|
|
8474
5662
|
cols: column.cols,
|
|
8475
5663
|
className: 'jr-grid',
|
|
8476
5664
|
$gap: gap
|
|
8477
5665
|
}, this.createColumns(value, column.columns, _parentName, fullname));
|
|
8478
5666
|
} else if (name || column.render) {
|
|
8479
|
-
content = /*#__PURE__*/
|
|
5667
|
+
content = /*#__PURE__*/React__default.createElement(StyledColumnValue, {
|
|
8480
5668
|
className: 'jr-column-value',
|
|
8481
5669
|
style: {
|
|
8482
5670
|
gridColumn: label == null ? 'span 2' : null,
|
|
@@ -8490,7 +5678,7 @@ class JRFields extends JRWindow {
|
|
|
8490
5678
|
}
|
|
8491
5679
|
const layout = column.labelProps?.layout === undefined ? this.props.labelProps?.layout : column.labelProps?.layout;
|
|
8492
5680
|
const labelStyle = column.labelProps?.style ?? this.props.labelProps?.style ?? {};
|
|
8493
|
-
return /*#__PURE__*/
|
|
5681
|
+
return /*#__PURE__*/React__default.createElement(StyledColumn, {
|
|
8494
5682
|
$layout: layout,
|
|
8495
5683
|
$hasLabel: label != null,
|
|
8496
5684
|
key: `f${index}`,
|
|
@@ -8498,18 +5686,18 @@ class JRFields extends JRWindow {
|
|
|
8498
5686
|
className: 'jr-column',
|
|
8499
5687
|
$labelWidth: column.labelProps?.width ?? this.props.labelProps?.width ?? '120px',
|
|
8500
5688
|
$valueWidth: column.valueProps?.width ?? this.props.valueProps?.width ?? '1fr'
|
|
8501
|
-
}, label != null && /*#__PURE__*/
|
|
5689
|
+
}, label != null && /*#__PURE__*/React__default.createElement(StyledColumnLabel, {
|
|
8502
5690
|
style: labelStyle,
|
|
8503
5691
|
$required: required,
|
|
8504
5692
|
className: 'label',
|
|
8505
5693
|
$layout: layout,
|
|
8506
5694
|
$colon: column.labelProps?.colon === undefined ? this.colon : column.labelProps?.colon
|
|
8507
|
-
}, label), content, this.props.debugMode && /*#__PURE__*/
|
|
5695
|
+
}, label), content, this.props.debugMode && /*#__PURE__*/React__default.createElement(StyledColumnFooter, null, /*#__PURE__*/React__default.createElement("div", {
|
|
8508
5696
|
className: "left"
|
|
8509
|
-
}, /*#__PURE__*/
|
|
5697
|
+
}, /*#__PURE__*/React__default.createElement(ColumnMessage, {
|
|
8510
5698
|
value: this.getValidateValue(_parentName.join('.')),
|
|
8511
5699
|
record: this.getValue()
|
|
8512
|
-
})), /*#__PURE__*/
|
|
5700
|
+
})), /*#__PURE__*/React__default.createElement("div", {
|
|
8513
5701
|
className: "right"
|
|
8514
5702
|
}))
|
|
8515
5703
|
// validateValue?.[name]!==undefined && <StyledColumnFooter $layout={layout}>
|
|
@@ -8524,10 +5712,10 @@ class JRFields extends JRWindow {
|
|
|
8524
5712
|
});
|
|
8525
5713
|
}
|
|
8526
5714
|
renderMe() {
|
|
8527
|
-
return /*#__PURE__*/
|
|
5715
|
+
return /*#__PURE__*/React__default.createElement(StyleJRFields, {
|
|
8528
5716
|
className: 'jr-fields',
|
|
8529
5717
|
style: this.props.typeStyle
|
|
8530
|
-
}, /*#__PURE__*/
|
|
5718
|
+
}, /*#__PURE__*/React__default.createElement(StyledGrid, {
|
|
8531
5719
|
cols: this.props.cols,
|
|
8532
5720
|
style: this.props.gridStyle,
|
|
8533
5721
|
className: 'jr-grid',
|
|
@@ -8589,7 +5777,7 @@ const FreeType = ({
|
|
|
8589
5777
|
const content = config.bind(me)({
|
|
8590
5778
|
setStyle
|
|
8591
5779
|
});
|
|
8592
|
-
return /*#__PURE__*/
|
|
5780
|
+
return /*#__PURE__*/React__default.createElement(Tag, {
|
|
8593
5781
|
className: className,
|
|
8594
5782
|
style: style
|
|
8595
5783
|
}, content);
|
|
@@ -8597,33 +5785,33 @@ const FreeType = ({
|
|
|
8597
5785
|
};
|
|
8598
5786
|
class JRTestReact extends JRSubmit {
|
|
8599
5787
|
renderer() {
|
|
8600
|
-
return /*#__PURE__*/
|
|
5788
|
+
return /*#__PURE__*/React__default.createElement(StyledJRFrame, {
|
|
8601
5789
|
style: this.props.style,
|
|
8602
5790
|
className: `${this.props.className} jr-frame`
|
|
8603
|
-
}, /*#__PURE__*/
|
|
5791
|
+
}, /*#__PURE__*/React__default.createElement(FreeType, {
|
|
8604
5792
|
tag: "div",
|
|
8605
5793
|
config: this.props.start,
|
|
8606
5794
|
me: this,
|
|
8607
5795
|
className: 'start'
|
|
8608
|
-
}), /*#__PURE__*/
|
|
5796
|
+
}), /*#__PURE__*/React__default.createElement("main", null, /*#__PURE__*/React__default.createElement(FreeType, {
|
|
8609
5797
|
tag: "header",
|
|
8610
5798
|
config: this.props.top,
|
|
8611
5799
|
me: this
|
|
8612
|
-
}), /*#__PURE__*/
|
|
5800
|
+
}), /*#__PURE__*/React__default.createElement("main", null, /*#__PURE__*/React__default.createElement(FreeType, {
|
|
8613
5801
|
tag: "div",
|
|
8614
5802
|
config: this.props.left,
|
|
8615
5803
|
me: this,
|
|
8616
5804
|
className: 'left'
|
|
8617
|
-
}), this.renderMe(), /*#__PURE__*/
|
|
5805
|
+
}), this.renderMe(), /*#__PURE__*/React__default.createElement(FreeType, {
|
|
8618
5806
|
tag: "div",
|
|
8619
5807
|
config: this.props.right,
|
|
8620
5808
|
me: this,
|
|
8621
5809
|
className: 'right'
|
|
8622
|
-
})), /*#__PURE__*/
|
|
5810
|
+
})), /*#__PURE__*/React__default.createElement(FreeType, {
|
|
8623
5811
|
tag: "footer",
|
|
8624
5812
|
config: this.props.bottom,
|
|
8625
5813
|
me: this
|
|
8626
|
-
})), /*#__PURE__*/
|
|
5814
|
+
})), /*#__PURE__*/React__default.createElement(FreeType, {
|
|
8627
5815
|
tag: "div",
|
|
8628
5816
|
config: this.props.end,
|
|
8629
5817
|
me: this,
|
|
@@ -8631,7 +5819,7 @@ class JRTestReact extends JRSubmit {
|
|
|
8631
5819
|
}));
|
|
8632
5820
|
}
|
|
8633
5821
|
renderMe() {
|
|
8634
|
-
return /*#__PURE__*/
|
|
5822
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
8635
5823
|
style: {
|
|
8636
5824
|
flex: 1
|
|
8637
5825
|
}
|
|
@@ -8639,4 +5827,4 @@ class JRTestReact extends JRSubmit {
|
|
|
8639
5827
|
}
|
|
8640
5828
|
}
|
|
8641
5829
|
|
|
8642
|
-
export { JRButton, JRFields, JRFrame, JRSubmit, JRTable, JRTestReact };
|
|
5830
|
+
export { JRButton, JRFields, JRFrame, JRSubmit, JRTable, JRTestReact, JRWindow };
|