@bolttech/form-engine 3.0.0-beta.9 → 3.0.1-beta.2
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/README.md +266 -217
- package/index.esm.js +1506 -380
- package/package.json +6 -9
- package/src/components/AsFormField/AsFormField.d.ts +12 -3
- package/src/components/AsFormField/AsFormField.type.d.ts +9 -0
- package/src/components/AsFormFieldBuilder/AsFormFieldBuilder.d.ts +11 -0
- package/src/components/AsFormFieldBuilder/AsFormFieldBuilder.type.d.ts +20 -0
- package/src/components/FieldWrapper/FieldWrapper.d.ts +10 -3
- package/src/components/FieldWrapper/FieldWrapper.type.d.ts +28 -0
- package/src/components/Form/Form.d.ts +8 -3
- package/src/components/Form/Form.type.d.ts +11 -0
- package/src/components/index.d.ts +1 -0
- package/src/context/FormGroupContext.d.ts +16 -24
- package/src/context/FormGroupContext.type.d.ts +46 -0
- package/src/generators/formBuilder.d.ts +20 -5
- package/src/helpers/helpers.d.ts +7 -0
- package/src/helpers/mapper.d.ts +7 -0
- package/src/hooks/index.d.ts +2 -0
- package/src/hooks/useForm/useForm.d.ts +6 -0
- package/src/hooks/useForm/useForm.type.d.ts +12 -0
- package/src/hooks/useFormGroup/useFormGroup.d.ts +10 -0
- package/src/index.d.ts +2 -0
- package/src/types/index.d.ts +26 -42
- package/src/core/README.md +0 -1616
- package/src/core/index.d.js +0 -2126
package/index.esm.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { FormGroup, FormCore } from 'form-engine-core';
|
|
3
|
-
import { createContext, useRef,
|
|
2
|
+
import { FormGroup, FormCore } from '@bolttech/form-engine-core';
|
|
3
|
+
import { createContext, useContext, useRef, useMemo, useState, useEffect, useCallback, Suspense, Children } from 'react';
|
|
4
4
|
|
|
5
5
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
6
6
|
|
|
7
|
-
var fails$
|
|
7
|
+
var fails$h = function (exec) {
|
|
8
8
|
try {
|
|
9
9
|
return !!exec();
|
|
10
10
|
} catch (error) {
|
|
@@ -12,9 +12,9 @@ var fails$b = function (exec) {
|
|
|
12
12
|
}
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
var fails$
|
|
15
|
+
var fails$g = fails$h;
|
|
16
16
|
|
|
17
|
-
var functionBindNative = !fails$
|
|
17
|
+
var functionBindNative = !fails$g(function () {
|
|
18
18
|
// eslint-disable-next-line es/no-function-prototype-bind -- safe
|
|
19
19
|
var test = (function () { /* empty */ }).bind();
|
|
20
20
|
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
@@ -24,39 +24,39 @@ var functionBindNative = !fails$a(function () {
|
|
|
24
24
|
var NATIVE_BIND$1 = functionBindNative;
|
|
25
25
|
|
|
26
26
|
var FunctionPrototype$1 = Function.prototype;
|
|
27
|
-
var call$
|
|
28
|
-
var uncurryThisWithBind = NATIVE_BIND$1 && FunctionPrototype$1.bind.bind(call$
|
|
27
|
+
var call$8 = FunctionPrototype$1.call;
|
|
28
|
+
var uncurryThisWithBind = NATIVE_BIND$1 && FunctionPrototype$1.bind.bind(call$8, call$8);
|
|
29
29
|
|
|
30
30
|
var functionUncurryThis = NATIVE_BIND$1 ? uncurryThisWithBind : function (fn) {
|
|
31
31
|
return function () {
|
|
32
|
-
return call$
|
|
32
|
+
return call$8.apply(fn, arguments);
|
|
33
33
|
};
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
var uncurryThis$
|
|
36
|
+
var uncurryThis$f = functionUncurryThis;
|
|
37
37
|
|
|
38
|
-
var toString$
|
|
39
|
-
var stringSlice$
|
|
38
|
+
var toString$5 = uncurryThis$f({}.toString);
|
|
39
|
+
var stringSlice$3 = uncurryThis$f(''.slice);
|
|
40
40
|
|
|
41
|
-
var classofRaw = function (it) {
|
|
42
|
-
return stringSlice$
|
|
41
|
+
var classofRaw$2 = function (it) {
|
|
42
|
+
return stringSlice$3(toString$5(it), 8, -1);
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
var uncurryThis$
|
|
46
|
-
var fails$
|
|
47
|
-
var classof = classofRaw;
|
|
45
|
+
var uncurryThis$e = functionUncurryThis;
|
|
46
|
+
var fails$f = fails$h;
|
|
47
|
+
var classof$3 = classofRaw$2;
|
|
48
48
|
|
|
49
|
-
var $Object$
|
|
50
|
-
var split = uncurryThis$
|
|
49
|
+
var $Object$4 = Object;
|
|
50
|
+
var split = uncurryThis$e(''.split);
|
|
51
51
|
|
|
52
52
|
// fallback for non-array-like ES3 and non-enumerable old V8 strings
|
|
53
|
-
var indexedObject = fails$
|
|
53
|
+
var indexedObject = fails$f(function () {
|
|
54
54
|
// throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
|
|
55
55
|
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
56
|
-
return !$Object$
|
|
56
|
+
return !$Object$4('z').propertyIsEnumerable(0);
|
|
57
57
|
}) ? function (it) {
|
|
58
|
-
return classof(it) === 'String' ? split(it, '') : $Object$
|
|
59
|
-
} : $Object$
|
|
58
|
+
return classof$3(it) === 'String' ? split(it, '') : $Object$4(it);
|
|
59
|
+
} : $Object$4;
|
|
60
60
|
|
|
61
61
|
// we can't use just `it == null` since of `document.all` special case
|
|
62
62
|
// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec
|
|
@@ -66,21 +66,21 @@ var isNullOrUndefined$2 = function (it) {
|
|
|
66
66
|
|
|
67
67
|
var isNullOrUndefined$1 = isNullOrUndefined$2;
|
|
68
68
|
|
|
69
|
-
var $TypeError$
|
|
69
|
+
var $TypeError$8 = TypeError;
|
|
70
70
|
|
|
71
71
|
// `RequireObjectCoercible` abstract operation
|
|
72
72
|
// https://tc39.es/ecma262/#sec-requireobjectcoercible
|
|
73
|
-
var requireObjectCoercible$
|
|
74
|
-
if (isNullOrUndefined$1(it)) throw new $TypeError$
|
|
73
|
+
var requireObjectCoercible$4 = function (it) {
|
|
74
|
+
if (isNullOrUndefined$1(it)) throw new $TypeError$8("Can't call method on " + it);
|
|
75
75
|
return it;
|
|
76
76
|
};
|
|
77
77
|
|
|
78
78
|
// toObject with fallback for non-array-like ES3 strings
|
|
79
79
|
var IndexedObject$1 = indexedObject;
|
|
80
|
-
var requireObjectCoercible$
|
|
80
|
+
var requireObjectCoercible$3 = requireObjectCoercible$4;
|
|
81
81
|
|
|
82
82
|
var toIndexedObject$5 = function (it) {
|
|
83
|
-
return IndexedObject$1(requireObjectCoercible$
|
|
83
|
+
return IndexedObject$1(requireObjectCoercible$3(it));
|
|
84
84
|
};
|
|
85
85
|
|
|
86
86
|
var check = function (it) {
|
|
@@ -88,7 +88,7 @@ var check = function (it) {
|
|
|
88
88
|
};
|
|
89
89
|
|
|
90
90
|
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
|
|
91
|
-
var global$
|
|
91
|
+
var global$e =
|
|
92
92
|
// eslint-disable-next-line es/no-global-this -- safe
|
|
93
93
|
check(typeof globalThis == 'object' && globalThis) ||
|
|
94
94
|
check(typeof window == 'object' && window) ||
|
|
@@ -101,20 +101,20 @@ var global$b =
|
|
|
101
101
|
|
|
102
102
|
var sharedStore = {exports: {}};
|
|
103
103
|
|
|
104
|
-
var global$
|
|
104
|
+
var global$d = global$e;
|
|
105
105
|
|
|
106
106
|
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
107
107
|
var defineProperty$5 = Object.defineProperty;
|
|
108
108
|
|
|
109
109
|
var defineGlobalProperty$3 = function (key, value) {
|
|
110
110
|
try {
|
|
111
|
-
defineProperty$5(global$
|
|
111
|
+
defineProperty$5(global$d, key, { value: value, configurable: true, writable: true });
|
|
112
112
|
} catch (error) {
|
|
113
|
-
global$
|
|
113
|
+
global$d[key] = value;
|
|
114
114
|
} return value;
|
|
115
115
|
};
|
|
116
116
|
|
|
117
|
-
var globalThis$1 = global$
|
|
117
|
+
var globalThis$1 = global$e;
|
|
118
118
|
var defineGlobalProperty$2 = defineGlobalProperty$3;
|
|
119
119
|
|
|
120
120
|
var SHARED = '__core-js_shared__';
|
|
@@ -130,49 +130,49 @@ var store$3 = sharedStore.exports = globalThis$1[SHARED] || defineGlobalProperty
|
|
|
130
130
|
|
|
131
131
|
var store$2 = sharedStore.exports;
|
|
132
132
|
|
|
133
|
-
var shared$
|
|
133
|
+
var shared$4 = function (key, value) {
|
|
134
134
|
return store$2[key] || (store$2[key] = value || {});
|
|
135
135
|
};
|
|
136
136
|
|
|
137
|
-
var requireObjectCoercible$
|
|
137
|
+
var requireObjectCoercible$2 = requireObjectCoercible$4;
|
|
138
138
|
|
|
139
|
-
var $Object$
|
|
139
|
+
var $Object$3 = Object;
|
|
140
140
|
|
|
141
141
|
// `ToObject` abstract operation
|
|
142
142
|
// https://tc39.es/ecma262/#sec-toobject
|
|
143
|
-
var toObject$
|
|
144
|
-
return $Object$
|
|
143
|
+
var toObject$4 = function (argument) {
|
|
144
|
+
return $Object$3(requireObjectCoercible$2(argument));
|
|
145
145
|
};
|
|
146
146
|
|
|
147
|
-
var uncurryThis$
|
|
148
|
-
var toObject$
|
|
147
|
+
var uncurryThis$d = functionUncurryThis;
|
|
148
|
+
var toObject$3 = toObject$4;
|
|
149
149
|
|
|
150
|
-
var hasOwnProperty = uncurryThis$
|
|
150
|
+
var hasOwnProperty = uncurryThis$d({}.hasOwnProperty);
|
|
151
151
|
|
|
152
152
|
// `HasOwnProperty` abstract operation
|
|
153
153
|
// https://tc39.es/ecma262/#sec-hasownproperty
|
|
154
154
|
// eslint-disable-next-line es/no-object-hasown -- safe
|
|
155
155
|
var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
|
|
156
|
-
return hasOwnProperty(toObject$
|
|
156
|
+
return hasOwnProperty(toObject$3(it), key);
|
|
157
157
|
};
|
|
158
158
|
|
|
159
|
-
var uncurryThis$
|
|
159
|
+
var uncurryThis$c = functionUncurryThis;
|
|
160
160
|
|
|
161
161
|
var id = 0;
|
|
162
162
|
var postfix = Math.random();
|
|
163
|
-
var toString = uncurryThis$
|
|
163
|
+
var toString$4 = uncurryThis$c(1.0.toString);
|
|
164
164
|
|
|
165
165
|
var uid$2 = function (key) {
|
|
166
|
-
return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);
|
|
166
|
+
return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$4(++id + postfix, 36);
|
|
167
167
|
};
|
|
168
168
|
|
|
169
169
|
var engineUserAgent = typeof navigator != 'undefined' && String(navigator.userAgent) || '';
|
|
170
170
|
|
|
171
|
-
var global$
|
|
172
|
-
var userAgent = engineUserAgent;
|
|
171
|
+
var global$c = global$e;
|
|
172
|
+
var userAgent$2 = engineUserAgent;
|
|
173
173
|
|
|
174
|
-
var process = global$
|
|
175
|
-
var Deno = global$
|
|
174
|
+
var process = global$c.process;
|
|
175
|
+
var Deno = global$c.Deno;
|
|
176
176
|
var versions = process && process.versions || Deno && Deno.version;
|
|
177
177
|
var v8 = versions && versions.v8;
|
|
178
178
|
var match, version;
|
|
@@ -186,10 +186,10 @@ if (v8) {
|
|
|
186
186
|
|
|
187
187
|
// BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
|
|
188
188
|
// so check `userAgent` even if `.v8` exists, but 0
|
|
189
|
-
if (!version && userAgent) {
|
|
190
|
-
match = userAgent.match(/Edge\/(\d+)/);
|
|
189
|
+
if (!version && userAgent$2) {
|
|
190
|
+
match = userAgent$2.match(/Edge\/(\d+)/);
|
|
191
191
|
if (!match || match[1] >= 74) {
|
|
192
|
-
match = userAgent.match(/Chrome\/(\d+)/);
|
|
192
|
+
match = userAgent$2.match(/Chrome\/(\d+)/);
|
|
193
193
|
if (match) version = +match[1];
|
|
194
194
|
}
|
|
195
195
|
}
|
|
@@ -198,19 +198,19 @@ var engineV8Version = version;
|
|
|
198
198
|
|
|
199
199
|
/* eslint-disable es/no-symbol -- required for testing */
|
|
200
200
|
var V8_VERSION = engineV8Version;
|
|
201
|
-
var fails$
|
|
202
|
-
var global$
|
|
201
|
+
var fails$e = fails$h;
|
|
202
|
+
var global$b = global$e;
|
|
203
203
|
|
|
204
|
-
var $String$
|
|
204
|
+
var $String$5 = global$b.String;
|
|
205
205
|
|
|
206
206
|
// eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
|
|
207
|
-
var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$
|
|
207
|
+
var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$e(function () {
|
|
208
208
|
var symbol = Symbol('symbol detection');
|
|
209
209
|
// Chrome 38 Symbol has incorrect toString conversion
|
|
210
210
|
// `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
|
|
211
211
|
// nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will,
|
|
212
212
|
// of course, fail.
|
|
213
|
-
return !$String$
|
|
213
|
+
return !$String$5(symbol) || !(Object(symbol) instanceof Symbol) ||
|
|
214
214
|
// Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
|
|
215
215
|
!Symbol.sham && V8_VERSION && V8_VERSION < 41;
|
|
216
216
|
});
|
|
@@ -222,20 +222,20 @@ var useSymbolAsUid = NATIVE_SYMBOL$1
|
|
|
222
222
|
&& !Symbol.sham
|
|
223
223
|
&& typeof Symbol.iterator == 'symbol';
|
|
224
224
|
|
|
225
|
-
var global$
|
|
226
|
-
var shared$
|
|
227
|
-
var hasOwn$
|
|
225
|
+
var global$a = global$e;
|
|
226
|
+
var shared$3 = shared$4;
|
|
227
|
+
var hasOwn$9 = hasOwnProperty_1;
|
|
228
228
|
var uid$1 = uid$2;
|
|
229
229
|
var NATIVE_SYMBOL = symbolConstructorDetection;
|
|
230
230
|
var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;
|
|
231
231
|
|
|
232
|
-
var Symbol$1 = global$
|
|
233
|
-
var WellKnownSymbolsStore = shared$
|
|
232
|
+
var Symbol$1 = global$a.Symbol;
|
|
233
|
+
var WellKnownSymbolsStore = shared$3('wks');
|
|
234
234
|
var createWellKnownSymbol = USE_SYMBOL_AS_UID$1 ? Symbol$1['for'] || Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid$1;
|
|
235
235
|
|
|
236
|
-
var wellKnownSymbol$
|
|
237
|
-
if (!hasOwn$
|
|
238
|
-
WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn$
|
|
236
|
+
var wellKnownSymbol$a = function (name) {
|
|
237
|
+
if (!hasOwn$9(WellKnownSymbolsStore, name)) {
|
|
238
|
+
WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn$9(Symbol$1, name)
|
|
239
239
|
? Symbol$1[name]
|
|
240
240
|
: createWellKnownSymbol('Symbol.' + name);
|
|
241
241
|
} return WellKnownSymbolsStore[name];
|
|
@@ -247,45 +247,45 @@ var documentAll = typeof document == 'object' && document.all;
|
|
|
247
247
|
// `IsCallable` abstract operation
|
|
248
248
|
// https://tc39.es/ecma262/#sec-iscallable
|
|
249
249
|
// eslint-disable-next-line unicorn/no-typeof-undefined -- required for testing
|
|
250
|
-
var isCallable$
|
|
250
|
+
var isCallable$e = typeof documentAll == 'undefined' && documentAll !== undefined ? function (argument) {
|
|
251
251
|
return typeof argument == 'function' || argument === documentAll;
|
|
252
252
|
} : function (argument) {
|
|
253
253
|
return typeof argument == 'function';
|
|
254
254
|
};
|
|
255
255
|
|
|
256
|
-
var isCallable$
|
|
256
|
+
var isCallable$d = isCallable$e;
|
|
257
257
|
|
|
258
|
-
var isObject$
|
|
259
|
-
return typeof it == 'object' ? it !== null : isCallable$
|
|
258
|
+
var isObject$9 = function (it) {
|
|
259
|
+
return typeof it == 'object' ? it !== null : isCallable$d(it);
|
|
260
260
|
};
|
|
261
261
|
|
|
262
|
-
var isObject$
|
|
262
|
+
var isObject$8 = isObject$9;
|
|
263
263
|
|
|
264
|
-
var $String$
|
|
265
|
-
var $TypeError$
|
|
264
|
+
var $String$4 = String;
|
|
265
|
+
var $TypeError$7 = TypeError;
|
|
266
266
|
|
|
267
267
|
// `Assert: Type(argument) is Object`
|
|
268
|
-
var anObject$
|
|
269
|
-
if (isObject$
|
|
270
|
-
throw new $TypeError$
|
|
268
|
+
var anObject$6 = function (argument) {
|
|
269
|
+
if (isObject$8(argument)) return argument;
|
|
270
|
+
throw new $TypeError$7($String$4(argument) + ' is not an object');
|
|
271
271
|
};
|
|
272
272
|
|
|
273
273
|
var objectDefineProperties = {};
|
|
274
274
|
|
|
275
|
-
var fails$
|
|
275
|
+
var fails$d = fails$h;
|
|
276
276
|
|
|
277
277
|
// Detect IE8's incomplete defineProperty implementation
|
|
278
|
-
var descriptors = !fails$
|
|
278
|
+
var descriptors = !fails$d(function () {
|
|
279
279
|
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
280
280
|
return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] !== 7;
|
|
281
281
|
});
|
|
282
282
|
|
|
283
283
|
var DESCRIPTORS$9 = descriptors;
|
|
284
|
-
var fails$
|
|
284
|
+
var fails$c = fails$h;
|
|
285
285
|
|
|
286
286
|
// V8 ~ Chrome 36-
|
|
287
287
|
// https://bugs.chromium.org/p/v8/issues/detail?id=3334
|
|
288
|
-
var v8PrototypeDefineBug = DESCRIPTORS$9 && fails$
|
|
288
|
+
var v8PrototypeDefineBug = DESCRIPTORS$9 && fails$c(function () {
|
|
289
289
|
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
290
290
|
return Object.defineProperty(function () { /* empty */ }, 'prototype', {
|
|
291
291
|
value: 42,
|
|
@@ -295,23 +295,23 @@ var v8PrototypeDefineBug = DESCRIPTORS$9 && fails$6(function () {
|
|
|
295
295
|
|
|
296
296
|
var objectDefineProperty = {};
|
|
297
297
|
|
|
298
|
-
var global$
|
|
299
|
-
var isObject$
|
|
298
|
+
var global$9 = global$e;
|
|
299
|
+
var isObject$7 = isObject$9;
|
|
300
300
|
|
|
301
|
-
var document$1 = global$
|
|
301
|
+
var document$1 = global$9.document;
|
|
302
302
|
// typeof document.createElement is 'object' in old IE
|
|
303
|
-
var EXISTS$1 = isObject$
|
|
303
|
+
var EXISTS$1 = isObject$7(document$1) && isObject$7(document$1.createElement);
|
|
304
304
|
|
|
305
305
|
var documentCreateElement$2 = function (it) {
|
|
306
306
|
return EXISTS$1 ? document$1.createElement(it) : {};
|
|
307
307
|
};
|
|
308
308
|
|
|
309
309
|
var DESCRIPTORS$8 = descriptors;
|
|
310
|
-
var fails$
|
|
310
|
+
var fails$b = fails$h;
|
|
311
311
|
var createElement = documentCreateElement$2;
|
|
312
312
|
|
|
313
313
|
// Thanks to IE8 for its funny defineProperty
|
|
314
|
-
var ie8DomDefine = !DESCRIPTORS$8 && !fails$
|
|
314
|
+
var ie8DomDefine = !DESCRIPTORS$8 && !fails$b(function () {
|
|
315
315
|
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
316
316
|
return Object.defineProperty(createElement('div'), 'a', {
|
|
317
317
|
get: function () { return 7; }
|
|
@@ -320,109 +320,109 @@ var ie8DomDefine = !DESCRIPTORS$8 && !fails$5(function () {
|
|
|
320
320
|
|
|
321
321
|
var NATIVE_BIND = functionBindNative;
|
|
322
322
|
|
|
323
|
-
var call$
|
|
323
|
+
var call$7 = Function.prototype.call;
|
|
324
324
|
|
|
325
|
-
var functionCall = NATIVE_BIND ? call$
|
|
326
|
-
return call$
|
|
325
|
+
var functionCall = NATIVE_BIND ? call$7.bind(call$7) : function () {
|
|
326
|
+
return call$7.apply(call$7, arguments);
|
|
327
327
|
};
|
|
328
328
|
|
|
329
|
-
var global$
|
|
330
|
-
var isCallable$
|
|
329
|
+
var global$8 = global$e;
|
|
330
|
+
var isCallable$c = isCallable$e;
|
|
331
331
|
|
|
332
332
|
var aFunction = function (argument) {
|
|
333
|
-
return isCallable$
|
|
333
|
+
return isCallable$c(argument) ? argument : undefined;
|
|
334
334
|
};
|
|
335
335
|
|
|
336
336
|
var getBuiltIn$3 = function (namespace, method) {
|
|
337
|
-
return arguments.length < 2 ? aFunction(global$
|
|
337
|
+
return arguments.length < 2 ? aFunction(global$8[namespace]) : global$8[namespace] && global$8[namespace][method];
|
|
338
338
|
};
|
|
339
339
|
|
|
340
|
-
var uncurryThis$
|
|
340
|
+
var uncurryThis$b = functionUncurryThis;
|
|
341
341
|
|
|
342
|
-
var objectIsPrototypeOf = uncurryThis$
|
|
342
|
+
var objectIsPrototypeOf = uncurryThis$b({}.isPrototypeOf);
|
|
343
343
|
|
|
344
344
|
var getBuiltIn$2 = getBuiltIn$3;
|
|
345
|
-
var isCallable$
|
|
346
|
-
var isPrototypeOf = objectIsPrototypeOf;
|
|
345
|
+
var isCallable$b = isCallable$e;
|
|
346
|
+
var isPrototypeOf$1 = objectIsPrototypeOf;
|
|
347
347
|
var USE_SYMBOL_AS_UID = useSymbolAsUid;
|
|
348
348
|
|
|
349
|
-
var $Object$
|
|
349
|
+
var $Object$2 = Object;
|
|
350
350
|
|
|
351
351
|
var isSymbol$2 = USE_SYMBOL_AS_UID ? function (it) {
|
|
352
352
|
return typeof it == 'symbol';
|
|
353
353
|
} : function (it) {
|
|
354
354
|
var $Symbol = getBuiltIn$2('Symbol');
|
|
355
|
-
return isCallable$
|
|
355
|
+
return isCallable$b($Symbol) && isPrototypeOf$1($Symbol.prototype, $Object$2(it));
|
|
356
356
|
};
|
|
357
357
|
|
|
358
|
-
var $String$
|
|
358
|
+
var $String$3 = String;
|
|
359
359
|
|
|
360
|
-
var tryToString$
|
|
360
|
+
var tryToString$2 = function (argument) {
|
|
361
361
|
try {
|
|
362
|
-
return $String$
|
|
362
|
+
return $String$3(argument);
|
|
363
363
|
} catch (error) {
|
|
364
364
|
return 'Object';
|
|
365
365
|
}
|
|
366
366
|
};
|
|
367
367
|
|
|
368
|
-
var isCallable$
|
|
369
|
-
var tryToString = tryToString$
|
|
368
|
+
var isCallable$a = isCallable$e;
|
|
369
|
+
var tryToString$1 = tryToString$2;
|
|
370
370
|
|
|
371
|
-
var $TypeError$
|
|
371
|
+
var $TypeError$6 = TypeError;
|
|
372
372
|
|
|
373
373
|
// `Assert: IsCallable(argument) is true`
|
|
374
|
-
var aCallable$
|
|
375
|
-
if (isCallable$
|
|
376
|
-
throw new $TypeError$
|
|
374
|
+
var aCallable$3 = function (argument) {
|
|
375
|
+
if (isCallable$a(argument)) return argument;
|
|
376
|
+
throw new $TypeError$6(tryToString$1(argument) + ' is not a function');
|
|
377
377
|
};
|
|
378
378
|
|
|
379
|
-
var aCallable$
|
|
379
|
+
var aCallable$2 = aCallable$3;
|
|
380
380
|
var isNullOrUndefined = isNullOrUndefined$2;
|
|
381
381
|
|
|
382
382
|
// `GetMethod` abstract operation
|
|
383
383
|
// https://tc39.es/ecma262/#sec-getmethod
|
|
384
384
|
var getMethod$1 = function (V, P) {
|
|
385
385
|
var func = V[P];
|
|
386
|
-
return isNullOrUndefined(func) ? undefined : aCallable$
|
|
386
|
+
return isNullOrUndefined(func) ? undefined : aCallable$2(func);
|
|
387
387
|
};
|
|
388
388
|
|
|
389
|
-
var call$
|
|
390
|
-
var isCallable$
|
|
391
|
-
var isObject$
|
|
389
|
+
var call$6 = functionCall;
|
|
390
|
+
var isCallable$9 = isCallable$e;
|
|
391
|
+
var isObject$6 = isObject$9;
|
|
392
392
|
|
|
393
|
-
var $TypeError$
|
|
393
|
+
var $TypeError$5 = TypeError;
|
|
394
394
|
|
|
395
395
|
// `OrdinaryToPrimitive` abstract operation
|
|
396
396
|
// https://tc39.es/ecma262/#sec-ordinarytoprimitive
|
|
397
397
|
var ordinaryToPrimitive$1 = function (input, pref) {
|
|
398
398
|
var fn, val;
|
|
399
|
-
if (pref === 'string' && isCallable$
|
|
400
|
-
if (isCallable$
|
|
401
|
-
if (pref !== 'string' && isCallable$
|
|
402
|
-
throw new $TypeError$
|
|
399
|
+
if (pref === 'string' && isCallable$9(fn = input.toString) && !isObject$6(val = call$6(fn, input))) return val;
|
|
400
|
+
if (isCallable$9(fn = input.valueOf) && !isObject$6(val = call$6(fn, input))) return val;
|
|
401
|
+
if (pref !== 'string' && isCallable$9(fn = input.toString) && !isObject$6(val = call$6(fn, input))) return val;
|
|
402
|
+
throw new $TypeError$5("Can't convert object to primitive value");
|
|
403
403
|
};
|
|
404
404
|
|
|
405
|
-
var call$
|
|
406
|
-
var isObject$
|
|
405
|
+
var call$5 = functionCall;
|
|
406
|
+
var isObject$5 = isObject$9;
|
|
407
407
|
var isSymbol$1 = isSymbol$2;
|
|
408
408
|
var getMethod = getMethod$1;
|
|
409
409
|
var ordinaryToPrimitive = ordinaryToPrimitive$1;
|
|
410
|
-
var wellKnownSymbol$
|
|
410
|
+
var wellKnownSymbol$9 = wellKnownSymbol$a;
|
|
411
411
|
|
|
412
|
-
var $TypeError$
|
|
413
|
-
var TO_PRIMITIVE = wellKnownSymbol$
|
|
412
|
+
var $TypeError$4 = TypeError;
|
|
413
|
+
var TO_PRIMITIVE = wellKnownSymbol$9('toPrimitive');
|
|
414
414
|
|
|
415
415
|
// `ToPrimitive` abstract operation
|
|
416
416
|
// https://tc39.es/ecma262/#sec-toprimitive
|
|
417
417
|
var toPrimitive$1 = function (input, pref) {
|
|
418
|
-
if (!isObject$
|
|
418
|
+
if (!isObject$5(input) || isSymbol$1(input)) return input;
|
|
419
419
|
var exoticToPrim = getMethod(input, TO_PRIMITIVE);
|
|
420
420
|
var result;
|
|
421
421
|
if (exoticToPrim) {
|
|
422
422
|
if (pref === undefined) pref = 'default';
|
|
423
|
-
result = call$
|
|
424
|
-
if (!isObject$
|
|
425
|
-
throw new $TypeError$
|
|
423
|
+
result = call$5(exoticToPrim, input, pref);
|
|
424
|
+
if (!isObject$5(result) || isSymbol$1(result)) return result;
|
|
425
|
+
throw new $TypeError$4("Can't convert object to primitive value");
|
|
426
426
|
}
|
|
427
427
|
if (pref === undefined) pref = 'number';
|
|
428
428
|
return ordinaryToPrimitive(input, pref);
|
|
@@ -441,10 +441,10 @@ var toPropertyKey$2 = function (argument) {
|
|
|
441
441
|
var DESCRIPTORS$7 = descriptors;
|
|
442
442
|
var IE8_DOM_DEFINE$1 = ie8DomDefine;
|
|
443
443
|
var V8_PROTOTYPE_DEFINE_BUG$1 = v8PrototypeDefineBug;
|
|
444
|
-
var anObject$
|
|
444
|
+
var anObject$5 = anObject$6;
|
|
445
445
|
var toPropertyKey$1 = toPropertyKey$2;
|
|
446
446
|
|
|
447
|
-
var $TypeError$
|
|
447
|
+
var $TypeError$3 = TypeError;
|
|
448
448
|
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
449
449
|
var $defineProperty = Object.defineProperty;
|
|
450
450
|
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
@@ -456,9 +456,9 @@ var WRITABLE = 'writable';
|
|
|
456
456
|
// `Object.defineProperty` method
|
|
457
457
|
// https://tc39.es/ecma262/#sec-object.defineproperty
|
|
458
458
|
objectDefineProperty.f = DESCRIPTORS$7 ? V8_PROTOTYPE_DEFINE_BUG$1 ? function defineProperty(O, P, Attributes) {
|
|
459
|
-
anObject$
|
|
459
|
+
anObject$5(O);
|
|
460
460
|
P = toPropertyKey$1(P);
|
|
461
|
-
anObject$
|
|
461
|
+
anObject$5(Attributes);
|
|
462
462
|
if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
|
|
463
463
|
var current = $getOwnPropertyDescriptor$1(O, P);
|
|
464
464
|
if (current && current[WRITABLE]) {
|
|
@@ -471,26 +471,26 @@ objectDefineProperty.f = DESCRIPTORS$7 ? V8_PROTOTYPE_DEFINE_BUG$1 ? function de
|
|
|
471
471
|
}
|
|
472
472
|
} return $defineProperty(O, P, Attributes);
|
|
473
473
|
} : $defineProperty : function defineProperty(O, P, Attributes) {
|
|
474
|
-
anObject$
|
|
474
|
+
anObject$5(O);
|
|
475
475
|
P = toPropertyKey$1(P);
|
|
476
|
-
anObject$
|
|
476
|
+
anObject$5(Attributes);
|
|
477
477
|
if (IE8_DOM_DEFINE$1) try {
|
|
478
478
|
return $defineProperty(O, P, Attributes);
|
|
479
479
|
} catch (error) { /* empty */ }
|
|
480
|
-
if ('get' in Attributes || 'set' in Attributes) throw new $TypeError$
|
|
480
|
+
if ('get' in Attributes || 'set' in Attributes) throw new $TypeError$3('Accessors not supported');
|
|
481
481
|
if ('value' in Attributes) O[P] = Attributes.value;
|
|
482
482
|
return O;
|
|
483
483
|
};
|
|
484
484
|
|
|
485
485
|
var ceil = Math.ceil;
|
|
486
|
-
var floor = Math.floor;
|
|
486
|
+
var floor$1 = Math.floor;
|
|
487
487
|
|
|
488
488
|
// `Math.trunc` method
|
|
489
489
|
// https://tc39.es/ecma262/#sec-math.trunc
|
|
490
490
|
// eslint-disable-next-line es/no-math-trunc -- safe
|
|
491
491
|
var mathTrunc = Math.trunc || function trunc(x) {
|
|
492
492
|
var n = +x;
|
|
493
|
-
return (n > 0 ? floor : ceil)(n);
|
|
493
|
+
return (n > 0 ? floor$1 : ceil)(n);
|
|
494
494
|
};
|
|
495
495
|
|
|
496
496
|
var trunc = mathTrunc;
|
|
@@ -506,44 +506,44 @@ var toIntegerOrInfinity$2 = function (argument) {
|
|
|
506
506
|
var toIntegerOrInfinity$1 = toIntegerOrInfinity$2;
|
|
507
507
|
|
|
508
508
|
var max = Math.max;
|
|
509
|
-
var min$
|
|
509
|
+
var min$2 = Math.min;
|
|
510
510
|
|
|
511
511
|
// Helper for a popular repeating case of the spec:
|
|
512
512
|
// Let integer be ? ToInteger(index).
|
|
513
513
|
// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
|
|
514
514
|
var toAbsoluteIndex$1 = function (index, length) {
|
|
515
515
|
var integer = toIntegerOrInfinity$1(index);
|
|
516
|
-
return integer < 0 ? max(integer + length, 0) : min$
|
|
516
|
+
return integer < 0 ? max(integer + length, 0) : min$2(integer, length);
|
|
517
517
|
};
|
|
518
518
|
|
|
519
519
|
var toIntegerOrInfinity = toIntegerOrInfinity$2;
|
|
520
520
|
|
|
521
|
-
var min = Math.min;
|
|
521
|
+
var min$1 = Math.min;
|
|
522
522
|
|
|
523
523
|
// `ToLength` abstract operation
|
|
524
524
|
// https://tc39.es/ecma262/#sec-tolength
|
|
525
|
-
var toLength$
|
|
525
|
+
var toLength$2 = function (argument) {
|
|
526
526
|
var len = toIntegerOrInfinity(argument);
|
|
527
|
-
return len > 0 ? min(len, 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
|
|
527
|
+
return len > 0 ? min$1(len, 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
|
|
528
528
|
};
|
|
529
529
|
|
|
530
|
-
var toLength = toLength$
|
|
530
|
+
var toLength$1 = toLength$2;
|
|
531
531
|
|
|
532
532
|
// `LengthOfArrayLike` abstract operation
|
|
533
533
|
// https://tc39.es/ecma262/#sec-lengthofarraylike
|
|
534
|
-
var lengthOfArrayLike$
|
|
535
|
-
return toLength(obj.length);
|
|
534
|
+
var lengthOfArrayLike$2 = function (obj) {
|
|
535
|
+
return toLength$1(obj.length);
|
|
536
536
|
};
|
|
537
537
|
|
|
538
538
|
var toIndexedObject$4 = toIndexedObject$5;
|
|
539
539
|
var toAbsoluteIndex = toAbsoluteIndex$1;
|
|
540
|
-
var lengthOfArrayLike = lengthOfArrayLike$
|
|
540
|
+
var lengthOfArrayLike$1 = lengthOfArrayLike$2;
|
|
541
541
|
|
|
542
542
|
// `Array.prototype.{ indexOf, includes }` methods implementation
|
|
543
543
|
var createMethod = function (IS_INCLUDES) {
|
|
544
544
|
return function ($this, el, fromIndex) {
|
|
545
545
|
var O = toIndexedObject$4($this);
|
|
546
|
-
var length = lengthOfArrayLike(O);
|
|
546
|
+
var length = lengthOfArrayLike$1(O);
|
|
547
547
|
if (length === 0) return !IS_INCLUDES && -1;
|
|
548
548
|
var index = toAbsoluteIndex(fromIndex, length);
|
|
549
549
|
var value;
|
|
@@ -571,23 +571,23 @@ var arrayIncludes = {
|
|
|
571
571
|
|
|
572
572
|
var hiddenKeys$4 = {};
|
|
573
573
|
|
|
574
|
-
var uncurryThis$
|
|
575
|
-
var hasOwn$
|
|
574
|
+
var uncurryThis$a = functionUncurryThis;
|
|
575
|
+
var hasOwn$8 = hasOwnProperty_1;
|
|
576
576
|
var toIndexedObject$3 = toIndexedObject$5;
|
|
577
|
-
var indexOf = arrayIncludes.indexOf;
|
|
577
|
+
var indexOf$1 = arrayIncludes.indexOf;
|
|
578
578
|
var hiddenKeys$3 = hiddenKeys$4;
|
|
579
579
|
|
|
580
|
-
var push = uncurryThis$
|
|
580
|
+
var push$1 = uncurryThis$a([].push);
|
|
581
581
|
|
|
582
582
|
var objectKeysInternal = function (object, names) {
|
|
583
583
|
var O = toIndexedObject$3(object);
|
|
584
584
|
var i = 0;
|
|
585
585
|
var result = [];
|
|
586
586
|
var key;
|
|
587
|
-
for (key in O) !hasOwn$
|
|
587
|
+
for (key in O) !hasOwn$8(hiddenKeys$3, key) && hasOwn$8(O, key) && push$1(result, key);
|
|
588
588
|
// Don't enum bug & hidden keys
|
|
589
|
-
while (names.length > i) if (hasOwn$
|
|
590
|
-
~indexOf(result, key) || push(result, key);
|
|
589
|
+
while (names.length > i) if (hasOwn$8(O, key = names[i++])) {
|
|
590
|
+
~indexOf$1(result, key) || push$1(result, key);
|
|
591
591
|
}
|
|
592
592
|
return result;
|
|
593
593
|
};
|
|
@@ -616,7 +616,7 @@ var objectKeys$2 = Object.keys || function keys(O) {
|
|
|
616
616
|
var DESCRIPTORS$6 = descriptors;
|
|
617
617
|
var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug;
|
|
618
618
|
var definePropertyModule$3 = objectDefineProperty;
|
|
619
|
-
var anObject$
|
|
619
|
+
var anObject$4 = anObject$6;
|
|
620
620
|
var toIndexedObject$2 = toIndexedObject$5;
|
|
621
621
|
var objectKeys$1 = objectKeys$2;
|
|
622
622
|
|
|
@@ -624,7 +624,7 @@ var objectKeys$1 = objectKeys$2;
|
|
|
624
624
|
// https://tc39.es/ecma262/#sec-object.defineproperties
|
|
625
625
|
// eslint-disable-next-line es/no-object-defineproperties -- safe
|
|
626
626
|
objectDefineProperties.f = DESCRIPTORS$6 && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
|
|
627
|
-
anObject$
|
|
627
|
+
anObject$4(O);
|
|
628
628
|
var props = toIndexedObject$2(Properties);
|
|
629
629
|
var keys = objectKeys$1(Properties);
|
|
630
630
|
var length = keys.length;
|
|
@@ -638,17 +638,17 @@ var getBuiltIn$1 = getBuiltIn$3;
|
|
|
638
638
|
|
|
639
639
|
var html$1 = getBuiltIn$1('document', 'documentElement');
|
|
640
640
|
|
|
641
|
-
var shared$
|
|
641
|
+
var shared$2 = shared$4;
|
|
642
642
|
var uid = uid$2;
|
|
643
643
|
|
|
644
|
-
var keys = shared$
|
|
644
|
+
var keys = shared$2('keys');
|
|
645
645
|
|
|
646
646
|
var sharedKey$3 = function (key) {
|
|
647
647
|
return keys[key] || (keys[key] = uid(key));
|
|
648
648
|
};
|
|
649
649
|
|
|
650
650
|
/* global ActiveXObject -- old IE, WSH */
|
|
651
|
-
var anObject$
|
|
651
|
+
var anObject$3 = anObject$6;
|
|
652
652
|
var definePropertiesModule = objectDefineProperties;
|
|
653
653
|
var enumBugKeys$1 = enumBugKeys$3;
|
|
654
654
|
var hiddenKeys$2 = hiddenKeys$4;
|
|
@@ -722,7 +722,7 @@ hiddenKeys$2[IE_PROTO$1] = true;
|
|
|
722
722
|
var objectCreate = Object.create || function create(O, Properties) {
|
|
723
723
|
var result;
|
|
724
724
|
if (O !== null) {
|
|
725
|
-
EmptyConstructor[PROTOTYPE] = anObject$
|
|
725
|
+
EmptyConstructor[PROTOTYPE] = anObject$3(O);
|
|
726
726
|
result = new EmptyConstructor();
|
|
727
727
|
EmptyConstructor[PROTOTYPE] = null;
|
|
728
728
|
// add "__proto__" for Object.getPrototypeOf polyfill
|
|
@@ -731,11 +731,11 @@ var objectCreate = Object.create || function create(O, Properties) {
|
|
|
731
731
|
return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
|
|
732
732
|
};
|
|
733
733
|
|
|
734
|
-
var wellKnownSymbol$
|
|
735
|
-
var create$
|
|
734
|
+
var wellKnownSymbol$8 = wellKnownSymbol$a;
|
|
735
|
+
var create$2 = objectCreate;
|
|
736
736
|
var defineProperty$4 = objectDefineProperty.f;
|
|
737
737
|
|
|
738
|
-
var UNSCOPABLES = wellKnownSymbol$
|
|
738
|
+
var UNSCOPABLES = wellKnownSymbol$8('unscopables');
|
|
739
739
|
var ArrayPrototype = Array.prototype;
|
|
740
740
|
|
|
741
741
|
// Array.prototype[@@unscopables]
|
|
@@ -743,7 +743,7 @@ var ArrayPrototype = Array.prototype;
|
|
|
743
743
|
if (ArrayPrototype[UNSCOPABLES] === undefined) {
|
|
744
744
|
defineProperty$4(ArrayPrototype, UNSCOPABLES, {
|
|
745
745
|
configurable: true,
|
|
746
|
-
value: create$
|
|
746
|
+
value: create$2(null)
|
|
747
747
|
});
|
|
748
748
|
}
|
|
749
749
|
|
|
@@ -754,12 +754,12 @@ var addToUnscopables$1 = function (key) {
|
|
|
754
754
|
|
|
755
755
|
var iterators = {};
|
|
756
756
|
|
|
757
|
-
var global$
|
|
758
|
-
var isCallable$
|
|
757
|
+
var global$7 = global$e;
|
|
758
|
+
var isCallable$8 = isCallable$e;
|
|
759
759
|
|
|
760
|
-
var WeakMap$1 = global$
|
|
760
|
+
var WeakMap$1 = global$7.WeakMap;
|
|
761
761
|
|
|
762
|
-
var weakMapBasicDetection = isCallable$
|
|
762
|
+
var weakMapBasicDetection = isCallable$8(WeakMap$1) && /native code/.test(String(WeakMap$1));
|
|
763
763
|
|
|
764
764
|
var createPropertyDescriptor$3 = function (bitmap, value) {
|
|
765
765
|
return {
|
|
@@ -782,17 +782,17 @@ var createNonEnumerableProperty$4 = DESCRIPTORS$5 ? function (object, key, value
|
|
|
782
782
|
};
|
|
783
783
|
|
|
784
784
|
var NATIVE_WEAK_MAP = weakMapBasicDetection;
|
|
785
|
-
var global$
|
|
786
|
-
var isObject$
|
|
785
|
+
var global$6 = global$e;
|
|
786
|
+
var isObject$4 = isObject$9;
|
|
787
787
|
var createNonEnumerableProperty$3 = createNonEnumerableProperty$4;
|
|
788
|
-
var hasOwn$
|
|
789
|
-
var shared = sharedStore.exports;
|
|
788
|
+
var hasOwn$7 = hasOwnProperty_1;
|
|
789
|
+
var shared$1 = sharedStore.exports;
|
|
790
790
|
var sharedKey$1 = sharedKey$3;
|
|
791
791
|
var hiddenKeys$1 = hiddenKeys$4;
|
|
792
792
|
|
|
793
793
|
var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
|
|
794
|
-
var TypeError$1 = global$
|
|
795
|
-
var WeakMap = global$
|
|
794
|
+
var TypeError$1 = global$6.TypeError;
|
|
795
|
+
var WeakMap = global$6.WeakMap;
|
|
796
796
|
var set, get, has;
|
|
797
797
|
|
|
798
798
|
var enforce = function (it) {
|
|
@@ -802,14 +802,14 @@ var enforce = function (it) {
|
|
|
802
802
|
var getterFor = function (TYPE) {
|
|
803
803
|
return function (it) {
|
|
804
804
|
var state;
|
|
805
|
-
if (!isObject$
|
|
805
|
+
if (!isObject$4(it) || (state = get(it)).type !== TYPE) {
|
|
806
806
|
throw new TypeError$1('Incompatible receiver, ' + TYPE + ' required');
|
|
807
807
|
} return state;
|
|
808
808
|
};
|
|
809
809
|
};
|
|
810
810
|
|
|
811
|
-
if (NATIVE_WEAK_MAP || shared.state) {
|
|
812
|
-
var store$1 = shared.state || (shared.state = new WeakMap());
|
|
811
|
+
if (NATIVE_WEAK_MAP || shared$1.state) {
|
|
812
|
+
var store$1 = shared$1.state || (shared$1.state = new WeakMap());
|
|
813
813
|
/* eslint-disable no-self-assign -- prototype methods protection */
|
|
814
814
|
store$1.get = store$1.get;
|
|
815
815
|
store$1.has = store$1.has;
|
|
@@ -831,16 +831,16 @@ if (NATIVE_WEAK_MAP || shared.state) {
|
|
|
831
831
|
var STATE = sharedKey$1('state');
|
|
832
832
|
hiddenKeys$1[STATE] = true;
|
|
833
833
|
set = function (it, metadata) {
|
|
834
|
-
if (hasOwn$
|
|
834
|
+
if (hasOwn$7(it, STATE)) throw new TypeError$1(OBJECT_ALREADY_INITIALIZED);
|
|
835
835
|
metadata.facade = it;
|
|
836
836
|
createNonEnumerableProperty$3(it, STATE, metadata);
|
|
837
837
|
return metadata;
|
|
838
838
|
};
|
|
839
839
|
get = function (it) {
|
|
840
|
-
return hasOwn$
|
|
840
|
+
return hasOwn$7(it, STATE) ? it[STATE] : {};
|
|
841
841
|
};
|
|
842
842
|
has = function (it) {
|
|
843
|
-
return hasOwn$
|
|
843
|
+
return hasOwn$7(it, STATE);
|
|
844
844
|
};
|
|
845
845
|
}
|
|
846
846
|
|
|
@@ -858,25 +858,25 @@ var objectPropertyIsEnumerable = {};
|
|
|
858
858
|
|
|
859
859
|
var $propertyIsEnumerable = {}.propertyIsEnumerable;
|
|
860
860
|
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
861
|
-
var getOwnPropertyDescriptor$
|
|
861
|
+
var getOwnPropertyDescriptor$2 = Object.getOwnPropertyDescriptor;
|
|
862
862
|
|
|
863
863
|
// Nashorn ~ JDK8 bug
|
|
864
|
-
var NASHORN_BUG = getOwnPropertyDescriptor$
|
|
864
|
+
var NASHORN_BUG = getOwnPropertyDescriptor$2 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
|
|
865
865
|
|
|
866
866
|
// `Object.prototype.propertyIsEnumerable` method implementation
|
|
867
867
|
// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
|
|
868
868
|
objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
|
|
869
|
-
var descriptor = getOwnPropertyDescriptor$
|
|
869
|
+
var descriptor = getOwnPropertyDescriptor$2(this, V);
|
|
870
870
|
return !!descriptor && descriptor.enumerable;
|
|
871
871
|
} : $propertyIsEnumerable;
|
|
872
872
|
|
|
873
873
|
var DESCRIPTORS$4 = descriptors;
|
|
874
|
-
var call$
|
|
874
|
+
var call$4 = functionCall;
|
|
875
875
|
var propertyIsEnumerableModule$1 = objectPropertyIsEnumerable;
|
|
876
876
|
var createPropertyDescriptor$1 = createPropertyDescriptor$3;
|
|
877
877
|
var toIndexedObject$1 = toIndexedObject$5;
|
|
878
878
|
var toPropertyKey = toPropertyKey$2;
|
|
879
|
-
var hasOwn$
|
|
879
|
+
var hasOwn$6 = hasOwnProperty_1;
|
|
880
880
|
var IE8_DOM_DEFINE = ie8DomDefine;
|
|
881
881
|
|
|
882
882
|
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
@@ -890,19 +890,19 @@ objectGetOwnPropertyDescriptor.f = DESCRIPTORS$4 ? $getOwnPropertyDescriptor : f
|
|
|
890
890
|
if (IE8_DOM_DEFINE) try {
|
|
891
891
|
return $getOwnPropertyDescriptor(O, P);
|
|
892
892
|
} catch (error) { /* empty */ }
|
|
893
|
-
if (hasOwn$
|
|
893
|
+
if (hasOwn$6(O, P)) return createPropertyDescriptor$1(!call$4(propertyIsEnumerableModule$1.f, O, P), O[P]);
|
|
894
894
|
};
|
|
895
895
|
|
|
896
896
|
var makeBuiltIn$2 = {exports: {}};
|
|
897
897
|
|
|
898
898
|
var DESCRIPTORS$3 = descriptors;
|
|
899
|
-
var hasOwn$
|
|
899
|
+
var hasOwn$5 = hasOwnProperty_1;
|
|
900
900
|
|
|
901
901
|
var FunctionPrototype = Function.prototype;
|
|
902
902
|
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
903
903
|
var getDescriptor = DESCRIPTORS$3 && Object.getOwnPropertyDescriptor;
|
|
904
904
|
|
|
905
|
-
var EXISTS = hasOwn$
|
|
905
|
+
var EXISTS = hasOwn$5(FunctionPrototype, 'name');
|
|
906
906
|
// additional protection from minified / mangled / dropped function names
|
|
907
907
|
var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
|
|
908
908
|
var CONFIGURABLE = EXISTS && (!DESCRIPTORS$3 || (DESCRIPTORS$3 && getDescriptor(FunctionPrototype, 'name').configurable));
|
|
@@ -913,14 +913,14 @@ var functionName = {
|
|
|
913
913
|
CONFIGURABLE: CONFIGURABLE
|
|
914
914
|
};
|
|
915
915
|
|
|
916
|
-
var uncurryThis$
|
|
917
|
-
var isCallable$
|
|
916
|
+
var uncurryThis$9 = functionUncurryThis;
|
|
917
|
+
var isCallable$7 = isCallable$e;
|
|
918
918
|
var store = sharedStore.exports;
|
|
919
919
|
|
|
920
|
-
var functionToString = uncurryThis$
|
|
920
|
+
var functionToString = uncurryThis$9(Function.toString);
|
|
921
921
|
|
|
922
922
|
// this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
|
|
923
|
-
if (!isCallable$
|
|
923
|
+
if (!isCallable$7(store.inspectSource)) {
|
|
924
924
|
store.inspectSource = function (it) {
|
|
925
925
|
return functionToString(it);
|
|
926
926
|
};
|
|
@@ -928,51 +928,51 @@ if (!isCallable$6(store.inspectSource)) {
|
|
|
928
928
|
|
|
929
929
|
var inspectSource$1 = store.inspectSource;
|
|
930
930
|
|
|
931
|
-
var uncurryThis$
|
|
932
|
-
var fails$
|
|
933
|
-
var isCallable$
|
|
934
|
-
var hasOwn$
|
|
931
|
+
var uncurryThis$8 = functionUncurryThis;
|
|
932
|
+
var fails$a = fails$h;
|
|
933
|
+
var isCallable$6 = isCallable$e;
|
|
934
|
+
var hasOwn$4 = hasOwnProperty_1;
|
|
935
935
|
var DESCRIPTORS$2 = descriptors;
|
|
936
936
|
var CONFIGURABLE_FUNCTION_NAME$1 = functionName.CONFIGURABLE;
|
|
937
937
|
var inspectSource = inspectSource$1;
|
|
938
938
|
var InternalStateModule$1 = internalState;
|
|
939
939
|
|
|
940
940
|
var enforceInternalState = InternalStateModule$1.enforce;
|
|
941
|
-
var getInternalState$
|
|
942
|
-
var $String$
|
|
941
|
+
var getInternalState$2 = InternalStateModule$1.get;
|
|
942
|
+
var $String$2 = String;
|
|
943
943
|
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
944
944
|
var defineProperty$3 = Object.defineProperty;
|
|
945
|
-
var stringSlice = uncurryThis$
|
|
946
|
-
var replace = uncurryThis$
|
|
947
|
-
var join = uncurryThis$
|
|
945
|
+
var stringSlice$2 = uncurryThis$8(''.slice);
|
|
946
|
+
var replace$1 = uncurryThis$8(''.replace);
|
|
947
|
+
var join = uncurryThis$8([].join);
|
|
948
948
|
|
|
949
|
-
var CONFIGURABLE_LENGTH = DESCRIPTORS$2 && !fails$
|
|
949
|
+
var CONFIGURABLE_LENGTH = DESCRIPTORS$2 && !fails$a(function () {
|
|
950
950
|
return defineProperty$3(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;
|
|
951
951
|
});
|
|
952
952
|
|
|
953
953
|
var TEMPLATE = String(String).split('String');
|
|
954
954
|
|
|
955
955
|
var makeBuiltIn$1 = makeBuiltIn$2.exports = function (value, name, options) {
|
|
956
|
-
if (stringSlice($String$
|
|
957
|
-
name = '[' + replace($String$
|
|
956
|
+
if (stringSlice$2($String$2(name), 0, 7) === 'Symbol(') {
|
|
957
|
+
name = '[' + replace$1($String$2(name), /^Symbol\(([^)]*)\).*$/, '$1') + ']';
|
|
958
958
|
}
|
|
959
959
|
if (options && options.getter) name = 'get ' + name;
|
|
960
960
|
if (options && options.setter) name = 'set ' + name;
|
|
961
|
-
if (!hasOwn$
|
|
961
|
+
if (!hasOwn$4(value, 'name') || (CONFIGURABLE_FUNCTION_NAME$1 && value.name !== name)) {
|
|
962
962
|
if (DESCRIPTORS$2) defineProperty$3(value, 'name', { value: name, configurable: true });
|
|
963
963
|
else value.name = name;
|
|
964
964
|
}
|
|
965
|
-
if (CONFIGURABLE_LENGTH && options && hasOwn$
|
|
965
|
+
if (CONFIGURABLE_LENGTH && options && hasOwn$4(options, 'arity') && value.length !== options.arity) {
|
|
966
966
|
defineProperty$3(value, 'length', { value: options.arity });
|
|
967
967
|
}
|
|
968
968
|
try {
|
|
969
|
-
if (options && hasOwn$
|
|
969
|
+
if (options && hasOwn$4(options, 'constructor') && options.constructor) {
|
|
970
970
|
if (DESCRIPTORS$2) defineProperty$3(value, 'prototype', { writable: false });
|
|
971
971
|
// in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable
|
|
972
972
|
} else if (value.prototype) value.prototype = undefined;
|
|
973
973
|
} catch (error) { /* empty */ }
|
|
974
974
|
var state = enforceInternalState(value);
|
|
975
|
-
if (!hasOwn$
|
|
975
|
+
if (!hasOwn$4(state, 'source')) {
|
|
976
976
|
state.source = join(TEMPLATE, typeof name == 'string' ? name : '');
|
|
977
977
|
} return value;
|
|
978
978
|
};
|
|
@@ -980,19 +980,19 @@ var makeBuiltIn$1 = makeBuiltIn$2.exports = function (value, name, options) {
|
|
|
980
980
|
// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
|
|
981
981
|
// eslint-disable-next-line no-extend-native -- required
|
|
982
982
|
Function.prototype.toString = makeBuiltIn$1(function toString() {
|
|
983
|
-
return isCallable$
|
|
983
|
+
return isCallable$6(this) && getInternalState$2(this).source || inspectSource(this);
|
|
984
984
|
}, 'toString');
|
|
985
985
|
|
|
986
|
-
var isCallable$
|
|
986
|
+
var isCallable$5 = isCallable$e;
|
|
987
987
|
var definePropertyModule$1 = objectDefineProperty;
|
|
988
988
|
var makeBuiltIn = makeBuiltIn$2.exports;
|
|
989
989
|
var defineGlobalProperty$1 = defineGlobalProperty$3;
|
|
990
990
|
|
|
991
|
-
var defineBuiltIn$
|
|
991
|
+
var defineBuiltIn$4 = function (O, key, value, options) {
|
|
992
992
|
if (!options) options = {};
|
|
993
993
|
var simple = options.enumerable;
|
|
994
994
|
var name = options.name !== undefined ? options.name : key;
|
|
995
|
-
if (isCallable$
|
|
995
|
+
if (isCallable$5(value)) makeBuiltIn(value, name, options);
|
|
996
996
|
if (options.global) {
|
|
997
997
|
if (simple) O[key] = value;
|
|
998
998
|
else defineGlobalProperty$1(key, value);
|
|
@@ -1031,21 +1031,21 @@ var objectGetOwnPropertySymbols = {};
|
|
|
1031
1031
|
objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
|
|
1032
1032
|
|
|
1033
1033
|
var getBuiltIn = getBuiltIn$3;
|
|
1034
|
-
var uncurryThis$
|
|
1034
|
+
var uncurryThis$7 = functionUncurryThis;
|
|
1035
1035
|
var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
|
|
1036
1036
|
var getOwnPropertySymbolsModule$1 = objectGetOwnPropertySymbols;
|
|
1037
|
-
var anObject = anObject$
|
|
1037
|
+
var anObject$2 = anObject$6;
|
|
1038
1038
|
|
|
1039
|
-
var concat$1 = uncurryThis$
|
|
1039
|
+
var concat$1 = uncurryThis$7([].concat);
|
|
1040
1040
|
|
|
1041
1041
|
// all object keys, includes non-enumerable and symbols
|
|
1042
1042
|
var ownKeys$1 = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
|
|
1043
|
-
var keys = getOwnPropertyNamesModule.f(anObject(it));
|
|
1043
|
+
var keys = getOwnPropertyNamesModule.f(anObject$2(it));
|
|
1044
1044
|
var getOwnPropertySymbols = getOwnPropertySymbolsModule$1.f;
|
|
1045
1045
|
return getOwnPropertySymbols ? concat$1(keys, getOwnPropertySymbols(it)) : keys;
|
|
1046
1046
|
};
|
|
1047
1047
|
|
|
1048
|
-
var hasOwn$
|
|
1048
|
+
var hasOwn$3 = hasOwnProperty_1;
|
|
1049
1049
|
var ownKeys = ownKeys$1;
|
|
1050
1050
|
var getOwnPropertyDescriptorModule = objectGetOwnPropertyDescriptor;
|
|
1051
1051
|
var definePropertyModule = objectDefineProperty;
|
|
@@ -1056,14 +1056,14 @@ var copyConstructorProperties$1 = function (target, source, exceptions) {
|
|
|
1056
1056
|
var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
|
|
1057
1057
|
for (var i = 0; i < keys.length; i++) {
|
|
1058
1058
|
var key = keys[i];
|
|
1059
|
-
if (!hasOwn$
|
|
1059
|
+
if (!hasOwn$3(target, key) && !(exceptions && hasOwn$3(exceptions, key))) {
|
|
1060
1060
|
defineProperty(target, key, getOwnPropertyDescriptor(source, key));
|
|
1061
1061
|
}
|
|
1062
1062
|
}
|
|
1063
1063
|
};
|
|
1064
1064
|
|
|
1065
|
-
var fails$
|
|
1066
|
-
var isCallable$
|
|
1065
|
+
var fails$9 = fails$h;
|
|
1066
|
+
var isCallable$4 = isCallable$e;
|
|
1067
1067
|
|
|
1068
1068
|
var replacement = /#|\.prototype\./;
|
|
1069
1069
|
|
|
@@ -1071,7 +1071,7 @@ var isForced$1 = function (feature, detection) {
|
|
|
1071
1071
|
var value = data[normalize(feature)];
|
|
1072
1072
|
return value === POLYFILL ? true
|
|
1073
1073
|
: value === NATIVE ? false
|
|
1074
|
-
: isCallable$
|
|
1074
|
+
: isCallable$4(detection) ? fails$9(detection)
|
|
1075
1075
|
: !!detection;
|
|
1076
1076
|
};
|
|
1077
1077
|
|
|
@@ -1085,10 +1085,10 @@ var POLYFILL = isForced$1.POLYFILL = 'P';
|
|
|
1085
1085
|
|
|
1086
1086
|
var isForced_1 = isForced$1;
|
|
1087
1087
|
|
|
1088
|
-
var global$
|
|
1089
|
-
var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
|
|
1088
|
+
var global$5 = global$e;
|
|
1089
|
+
var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
|
|
1090
1090
|
var createNonEnumerableProperty$2 = createNonEnumerableProperty$4;
|
|
1091
|
-
var defineBuiltIn$
|
|
1091
|
+
var defineBuiltIn$3 = defineBuiltIn$4;
|
|
1092
1092
|
var defineGlobalProperty = defineGlobalProperty$3;
|
|
1093
1093
|
var copyConstructorProperties = copyConstructorProperties$1;
|
|
1094
1094
|
var isForced = isForced_1;
|
|
@@ -1114,16 +1114,16 @@ var _export = function (options, source) {
|
|
|
1114
1114
|
var STATIC = options.stat;
|
|
1115
1115
|
var FORCED, target, key, targetProperty, sourceProperty, descriptor;
|
|
1116
1116
|
if (GLOBAL) {
|
|
1117
|
-
target = global$
|
|
1117
|
+
target = global$5;
|
|
1118
1118
|
} else if (STATIC) {
|
|
1119
|
-
target = global$
|
|
1119
|
+
target = global$5[TARGET] || defineGlobalProperty(TARGET, {});
|
|
1120
1120
|
} else {
|
|
1121
|
-
target = global$
|
|
1121
|
+
target = global$5[TARGET] && global$5[TARGET].prototype;
|
|
1122
1122
|
}
|
|
1123
1123
|
if (target) for (key in source) {
|
|
1124
1124
|
sourceProperty = source[key];
|
|
1125
1125
|
if (options.dontCallGetSet) {
|
|
1126
|
-
descriptor = getOwnPropertyDescriptor(target, key);
|
|
1126
|
+
descriptor = getOwnPropertyDescriptor$1(target, key);
|
|
1127
1127
|
targetProperty = descriptor && descriptor.value;
|
|
1128
1128
|
} else targetProperty = target[key];
|
|
1129
1129
|
FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
|
|
@@ -1136,49 +1136,49 @@ var _export = function (options, source) {
|
|
|
1136
1136
|
if (options.sham || (targetProperty && targetProperty.sham)) {
|
|
1137
1137
|
createNonEnumerableProperty$2(sourceProperty, 'sham', true);
|
|
1138
1138
|
}
|
|
1139
|
-
defineBuiltIn$
|
|
1139
|
+
defineBuiltIn$3(target, key, sourceProperty, options);
|
|
1140
1140
|
}
|
|
1141
1141
|
};
|
|
1142
1142
|
|
|
1143
|
-
var fails$
|
|
1143
|
+
var fails$8 = fails$h;
|
|
1144
1144
|
|
|
1145
|
-
var correctPrototypeGetter = !fails$
|
|
1145
|
+
var correctPrototypeGetter = !fails$8(function () {
|
|
1146
1146
|
function F() { /* empty */ }
|
|
1147
1147
|
F.prototype.constructor = null;
|
|
1148
1148
|
// eslint-disable-next-line es/no-object-getprototypeof -- required for testing
|
|
1149
1149
|
return Object.getPrototypeOf(new F()) !== F.prototype;
|
|
1150
1150
|
});
|
|
1151
1151
|
|
|
1152
|
-
var hasOwn$
|
|
1153
|
-
var isCallable$
|
|
1154
|
-
var toObject$
|
|
1152
|
+
var hasOwn$2 = hasOwnProperty_1;
|
|
1153
|
+
var isCallable$3 = isCallable$e;
|
|
1154
|
+
var toObject$2 = toObject$4;
|
|
1155
1155
|
var sharedKey = sharedKey$3;
|
|
1156
1156
|
var CORRECT_PROTOTYPE_GETTER = correctPrototypeGetter;
|
|
1157
1157
|
|
|
1158
1158
|
var IE_PROTO = sharedKey('IE_PROTO');
|
|
1159
|
-
var $Object = Object;
|
|
1160
|
-
var ObjectPrototype = $Object.prototype;
|
|
1159
|
+
var $Object$1 = Object;
|
|
1160
|
+
var ObjectPrototype = $Object$1.prototype;
|
|
1161
1161
|
|
|
1162
1162
|
// `Object.getPrototypeOf` method
|
|
1163
1163
|
// https://tc39.es/ecma262/#sec-object.getprototypeof
|
|
1164
1164
|
// eslint-disable-next-line es/no-object-getprototypeof -- safe
|
|
1165
|
-
var objectGetPrototypeOf = CORRECT_PROTOTYPE_GETTER ? $Object.getPrototypeOf : function (O) {
|
|
1166
|
-
var object = toObject$
|
|
1167
|
-
if (hasOwn$
|
|
1165
|
+
var objectGetPrototypeOf = CORRECT_PROTOTYPE_GETTER ? $Object$1.getPrototypeOf : function (O) {
|
|
1166
|
+
var object = toObject$2(O);
|
|
1167
|
+
if (hasOwn$2(object, IE_PROTO)) return object[IE_PROTO];
|
|
1168
1168
|
var constructor = object.constructor;
|
|
1169
|
-
if (isCallable$
|
|
1169
|
+
if (isCallable$3(constructor) && object instanceof constructor) {
|
|
1170
1170
|
return constructor.prototype;
|
|
1171
|
-
} return object instanceof $Object ? ObjectPrototype : null;
|
|
1171
|
+
} return object instanceof $Object$1 ? ObjectPrototype : null;
|
|
1172
1172
|
};
|
|
1173
1173
|
|
|
1174
|
-
var fails$
|
|
1175
|
-
var isCallable$
|
|
1176
|
-
var isObject$
|
|
1174
|
+
var fails$7 = fails$h;
|
|
1175
|
+
var isCallable$2 = isCallable$e;
|
|
1176
|
+
var isObject$3 = isObject$9;
|
|
1177
1177
|
var getPrototypeOf$1 = objectGetPrototypeOf;
|
|
1178
|
-
var defineBuiltIn$
|
|
1179
|
-
var wellKnownSymbol$
|
|
1178
|
+
var defineBuiltIn$2 = defineBuiltIn$4;
|
|
1179
|
+
var wellKnownSymbol$7 = wellKnownSymbol$a;
|
|
1180
1180
|
|
|
1181
|
-
var ITERATOR$2 = wellKnownSymbol$
|
|
1181
|
+
var ITERATOR$2 = wellKnownSymbol$7('iterator');
|
|
1182
1182
|
var BUGGY_SAFARI_ITERATORS$1 = false;
|
|
1183
1183
|
|
|
1184
1184
|
// `%IteratorPrototype%` object
|
|
@@ -1196,7 +1196,7 @@ if ([].keys) {
|
|
|
1196
1196
|
}
|
|
1197
1197
|
}
|
|
1198
1198
|
|
|
1199
|
-
var NEW_ITERATOR_PROTOTYPE = !isObject$
|
|
1199
|
+
var NEW_ITERATOR_PROTOTYPE = !isObject$3(IteratorPrototype$2) || fails$7(function () {
|
|
1200
1200
|
var test = {};
|
|
1201
1201
|
// FF44- legacy iterators case
|
|
1202
1202
|
return IteratorPrototype$2[ITERATOR$2].call(test) !== test;
|
|
@@ -1206,8 +1206,8 @@ if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype$2 = {};
|
|
|
1206
1206
|
|
|
1207
1207
|
// `%IteratorPrototype%[@@iterator]()` method
|
|
1208
1208
|
// https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
|
|
1209
|
-
if (!isCallable$
|
|
1210
|
-
defineBuiltIn$
|
|
1209
|
+
if (!isCallable$2(IteratorPrototype$2[ITERATOR$2])) {
|
|
1210
|
+
defineBuiltIn$2(IteratorPrototype$2, ITERATOR$2, function () {
|
|
1211
1211
|
return this;
|
|
1212
1212
|
});
|
|
1213
1213
|
}
|
|
@@ -1218,20 +1218,20 @@ var iteratorsCore = {
|
|
|
1218
1218
|
};
|
|
1219
1219
|
|
|
1220
1220
|
var defineProperty$2 = objectDefineProperty.f;
|
|
1221
|
-
var hasOwn = hasOwnProperty_1;
|
|
1222
|
-
var wellKnownSymbol$
|
|
1221
|
+
var hasOwn$1 = hasOwnProperty_1;
|
|
1222
|
+
var wellKnownSymbol$6 = wellKnownSymbol$a;
|
|
1223
1223
|
|
|
1224
|
-
var TO_STRING_TAG = wellKnownSymbol$
|
|
1224
|
+
var TO_STRING_TAG$2 = wellKnownSymbol$6('toStringTag');
|
|
1225
1225
|
|
|
1226
1226
|
var setToStringTag$3 = function (target, TAG, STATIC) {
|
|
1227
1227
|
if (target && !STATIC) target = target.prototype;
|
|
1228
|
-
if (target && !hasOwn(target, TO_STRING_TAG)) {
|
|
1229
|
-
defineProperty$2(target, TO_STRING_TAG, { configurable: true, value: TAG });
|
|
1228
|
+
if (target && !hasOwn$1(target, TO_STRING_TAG$2)) {
|
|
1229
|
+
defineProperty$2(target, TO_STRING_TAG$2, { configurable: true, value: TAG });
|
|
1230
1230
|
}
|
|
1231
1231
|
};
|
|
1232
1232
|
|
|
1233
1233
|
var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
|
|
1234
|
-
var create = objectCreate;
|
|
1234
|
+
var create$1 = objectCreate;
|
|
1235
1235
|
var createPropertyDescriptor = createPropertyDescriptor$3;
|
|
1236
1236
|
var setToStringTag$2 = setToStringTag$3;
|
|
1237
1237
|
var Iterators$2 = iterators;
|
|
@@ -1240,42 +1240,42 @@ var returnThis$1 = function () { return this; };
|
|
|
1240
1240
|
|
|
1241
1241
|
var iteratorCreateConstructor = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
|
|
1242
1242
|
var TO_STRING_TAG = NAME + ' Iterator';
|
|
1243
|
-
IteratorConstructor.prototype = create(IteratorPrototype$1, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) });
|
|
1243
|
+
IteratorConstructor.prototype = create$1(IteratorPrototype$1, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) });
|
|
1244
1244
|
setToStringTag$2(IteratorConstructor, TO_STRING_TAG, false);
|
|
1245
1245
|
Iterators$2[TO_STRING_TAG] = returnThis$1;
|
|
1246
1246
|
return IteratorConstructor;
|
|
1247
1247
|
};
|
|
1248
1248
|
|
|
1249
|
-
var uncurryThis$
|
|
1250
|
-
var aCallable = aCallable$
|
|
1249
|
+
var uncurryThis$6 = functionUncurryThis;
|
|
1250
|
+
var aCallable$1 = aCallable$3;
|
|
1251
1251
|
|
|
1252
1252
|
var functionUncurryThisAccessor = function (object, key, method) {
|
|
1253
1253
|
try {
|
|
1254
1254
|
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
1255
|
-
return uncurryThis$
|
|
1255
|
+
return uncurryThis$6(aCallable$1(Object.getOwnPropertyDescriptor(object, key)[method]));
|
|
1256
1256
|
} catch (error) { /* empty */ }
|
|
1257
1257
|
};
|
|
1258
1258
|
|
|
1259
|
-
var isObject$
|
|
1259
|
+
var isObject$2 = isObject$9;
|
|
1260
1260
|
|
|
1261
1261
|
var isPossiblePrototype$1 = function (argument) {
|
|
1262
|
-
return isObject$
|
|
1262
|
+
return isObject$2(argument) || argument === null;
|
|
1263
1263
|
};
|
|
1264
1264
|
|
|
1265
1265
|
var isPossiblePrototype = isPossiblePrototype$1;
|
|
1266
1266
|
|
|
1267
|
-
var $String = String;
|
|
1268
|
-
var $TypeError = TypeError;
|
|
1267
|
+
var $String$1 = String;
|
|
1268
|
+
var $TypeError$2 = TypeError;
|
|
1269
1269
|
|
|
1270
1270
|
var aPossiblePrototype$1 = function (argument) {
|
|
1271
1271
|
if (isPossiblePrototype(argument)) return argument;
|
|
1272
|
-
throw new $TypeError("Can't set " + $String(argument) + ' as a prototype');
|
|
1272
|
+
throw new $TypeError$2("Can't set " + $String$1(argument) + ' as a prototype');
|
|
1273
1273
|
};
|
|
1274
1274
|
|
|
1275
1275
|
/* eslint-disable no-proto -- safe */
|
|
1276
1276
|
var uncurryThisAccessor = functionUncurryThisAccessor;
|
|
1277
|
-
var isObject = isObject$
|
|
1278
|
-
var requireObjectCoercible = requireObjectCoercible$
|
|
1277
|
+
var isObject$1 = isObject$9;
|
|
1278
|
+
var requireObjectCoercible$1 = requireObjectCoercible$4;
|
|
1279
1279
|
var aPossiblePrototype = aPossiblePrototype$1;
|
|
1280
1280
|
|
|
1281
1281
|
// `Object.setPrototypeOf` method
|
|
@@ -1292,34 +1292,34 @@ var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? functio
|
|
|
1292
1292
|
CORRECT_SETTER = test instanceof Array;
|
|
1293
1293
|
} catch (error) { /* empty */ }
|
|
1294
1294
|
return function setPrototypeOf(O, proto) {
|
|
1295
|
-
requireObjectCoercible(O);
|
|
1295
|
+
requireObjectCoercible$1(O);
|
|
1296
1296
|
aPossiblePrototype(proto);
|
|
1297
|
-
if (!isObject(O)) return O;
|
|
1297
|
+
if (!isObject$1(O)) return O;
|
|
1298
1298
|
if (CORRECT_SETTER) setter(O, proto);
|
|
1299
1299
|
else O.__proto__ = proto;
|
|
1300
1300
|
return O;
|
|
1301
1301
|
};
|
|
1302
1302
|
}() : undefined);
|
|
1303
1303
|
|
|
1304
|
-
var $$
|
|
1305
|
-
var call$
|
|
1304
|
+
var $$4 = _export;
|
|
1305
|
+
var call$3 = functionCall;
|
|
1306
1306
|
var FunctionName = functionName;
|
|
1307
|
-
var isCallable = isCallable$
|
|
1307
|
+
var isCallable$1 = isCallable$e;
|
|
1308
1308
|
var createIteratorConstructor = iteratorCreateConstructor;
|
|
1309
1309
|
var getPrototypeOf = objectGetPrototypeOf;
|
|
1310
1310
|
var setPrototypeOf = objectSetPrototypeOf;
|
|
1311
1311
|
var setToStringTag$1 = setToStringTag$3;
|
|
1312
1312
|
var createNonEnumerableProperty$1 = createNonEnumerableProperty$4;
|
|
1313
|
-
var defineBuiltIn = defineBuiltIn$
|
|
1314
|
-
var wellKnownSymbol$
|
|
1313
|
+
var defineBuiltIn$1 = defineBuiltIn$4;
|
|
1314
|
+
var wellKnownSymbol$5 = wellKnownSymbol$a;
|
|
1315
1315
|
var Iterators$1 = iterators;
|
|
1316
1316
|
var IteratorsCore = iteratorsCore;
|
|
1317
1317
|
|
|
1318
|
-
var PROPER_FUNCTION_NAME = FunctionName.PROPER;
|
|
1318
|
+
var PROPER_FUNCTION_NAME$1 = FunctionName.PROPER;
|
|
1319
1319
|
var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
|
|
1320
1320
|
var IteratorPrototype = IteratorsCore.IteratorPrototype;
|
|
1321
1321
|
var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
|
|
1322
|
-
var ITERATOR$1 = wellKnownSymbol$
|
|
1322
|
+
var ITERATOR$1 = wellKnownSymbol$5('iterator');
|
|
1323
1323
|
var KEYS = 'keys';
|
|
1324
1324
|
var VALUES = 'values';
|
|
1325
1325
|
var ENTRIES = 'entries';
|
|
@@ -1359,8 +1359,8 @@ var iteratorDefine = function (Iterable, NAME, IteratorConstructor, next, DEFAUL
|
|
|
1359
1359
|
if (getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
|
|
1360
1360
|
if (setPrototypeOf) {
|
|
1361
1361
|
setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
|
|
1362
|
-
} else if (!isCallable(CurrentIteratorPrototype[ITERATOR$1])) {
|
|
1363
|
-
defineBuiltIn(CurrentIteratorPrototype, ITERATOR$1, returnThis);
|
|
1362
|
+
} else if (!isCallable$1(CurrentIteratorPrototype[ITERATOR$1])) {
|
|
1363
|
+
defineBuiltIn$1(CurrentIteratorPrototype, ITERATOR$1, returnThis);
|
|
1364
1364
|
}
|
|
1365
1365
|
}
|
|
1366
1366
|
// Set @@toStringTag to native iterators
|
|
@@ -1369,12 +1369,12 @@ var iteratorDefine = function (Iterable, NAME, IteratorConstructor, next, DEFAUL
|
|
|
1369
1369
|
}
|
|
1370
1370
|
|
|
1371
1371
|
// fix Array.prototype.{ values, @@iterator }.name in V8 / FF
|
|
1372
|
-
if (PROPER_FUNCTION_NAME && DEFAULT === VALUES && nativeIterator && nativeIterator.name !== VALUES) {
|
|
1372
|
+
if (PROPER_FUNCTION_NAME$1 && DEFAULT === VALUES && nativeIterator && nativeIterator.name !== VALUES) {
|
|
1373
1373
|
if (CONFIGURABLE_FUNCTION_NAME) {
|
|
1374
1374
|
createNonEnumerableProperty$1(IterablePrototype, 'name', VALUES);
|
|
1375
1375
|
} else {
|
|
1376
1376
|
INCORRECT_VALUES_NAME = true;
|
|
1377
|
-
defaultIterator = function values() { return call$
|
|
1377
|
+
defaultIterator = function values() { return call$3(nativeIterator, this); };
|
|
1378
1378
|
}
|
|
1379
1379
|
}
|
|
1380
1380
|
|
|
@@ -1387,14 +1387,14 @@ var iteratorDefine = function (Iterable, NAME, IteratorConstructor, next, DEFAUL
|
|
|
1387
1387
|
};
|
|
1388
1388
|
if (FORCED) for (KEY in methods) {
|
|
1389
1389
|
if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
|
|
1390
|
-
defineBuiltIn(IterablePrototype, KEY, methods[KEY]);
|
|
1390
|
+
defineBuiltIn$1(IterablePrototype, KEY, methods[KEY]);
|
|
1391
1391
|
}
|
|
1392
|
-
} else $$
|
|
1392
|
+
} else $$4({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
|
|
1393
1393
|
}
|
|
1394
1394
|
|
|
1395
1395
|
// define iterator
|
|
1396
1396
|
if (IterablePrototype[ITERATOR$1] !== defaultIterator) {
|
|
1397
|
-
defineBuiltIn(IterablePrototype, ITERATOR$1, defaultIterator, { name: DEFAULT });
|
|
1397
|
+
defineBuiltIn$1(IterablePrototype, ITERATOR$1, defaultIterator, { name: DEFAULT });
|
|
1398
1398
|
}
|
|
1399
1399
|
Iterators$1[NAME] = defaultIterator;
|
|
1400
1400
|
|
|
@@ -1418,7 +1418,7 @@ var DESCRIPTORS$1 = descriptors;
|
|
|
1418
1418
|
|
|
1419
1419
|
var ARRAY_ITERATOR = 'Array Iterator';
|
|
1420
1420
|
var setInternalState = InternalStateModule.set;
|
|
1421
|
-
var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR);
|
|
1421
|
+
var getInternalState$1 = InternalStateModule.getterFor(ARRAY_ITERATOR);
|
|
1422
1422
|
|
|
1423
1423
|
// `Array.prototype.entries` method
|
|
1424
1424
|
// https://tc39.es/ecma262/#sec-array.prototype.entries
|
|
@@ -1440,7 +1440,7 @@ var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind)
|
|
|
1440
1440
|
// `%ArrayIteratorPrototype%.next` method
|
|
1441
1441
|
// https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
|
|
1442
1442
|
}, function () {
|
|
1443
|
-
var state = getInternalState(this);
|
|
1443
|
+
var state = getInternalState$1(this);
|
|
1444
1444
|
var target = state.target;
|
|
1445
1445
|
var index = state.index++;
|
|
1446
1446
|
if (!target || index >= target.length) {
|
|
@@ -1512,15 +1512,15 @@ var DOMTokenListPrototype$1 = classList && classList.constructor && classList.co
|
|
|
1512
1512
|
|
|
1513
1513
|
var domTokenListPrototype = DOMTokenListPrototype$1 === Object.prototype ? undefined : DOMTokenListPrototype$1;
|
|
1514
1514
|
|
|
1515
|
-
var global$
|
|
1515
|
+
var global$4 = global$e;
|
|
1516
1516
|
var DOMIterables = domIterables;
|
|
1517
1517
|
var DOMTokenListPrototype = domTokenListPrototype;
|
|
1518
1518
|
var ArrayIteratorMethods = es_array_iterator;
|
|
1519
1519
|
var createNonEnumerableProperty = createNonEnumerableProperty$4;
|
|
1520
1520
|
var setToStringTag = setToStringTag$3;
|
|
1521
|
-
var wellKnownSymbol = wellKnownSymbol$
|
|
1521
|
+
var wellKnownSymbol$4 = wellKnownSymbol$a;
|
|
1522
1522
|
|
|
1523
|
-
var ITERATOR = wellKnownSymbol('iterator');
|
|
1523
|
+
var ITERATOR = wellKnownSymbol$4('iterator');
|
|
1524
1524
|
var ArrayValues = ArrayIteratorMethods.values;
|
|
1525
1525
|
|
|
1526
1526
|
var handlePrototype = function (CollectionPrototype, COLLECTION_NAME) {
|
|
@@ -1544,30 +1544,264 @@ var handlePrototype = function (CollectionPrototype, COLLECTION_NAME) {
|
|
|
1544
1544
|
};
|
|
1545
1545
|
|
|
1546
1546
|
for (var COLLECTION_NAME in DOMIterables) {
|
|
1547
|
-
handlePrototype(global$
|
|
1547
|
+
handlePrototype(global$4[COLLECTION_NAME] && global$4[COLLECTION_NAME].prototype, COLLECTION_NAME);
|
|
1548
1548
|
}
|
|
1549
1549
|
|
|
1550
1550
|
handlePrototype(DOMTokenListPrototype, 'DOMTokenList');
|
|
1551
1551
|
|
|
1552
|
+
var tryToString = tryToString$2;
|
|
1553
|
+
|
|
1554
|
+
var $TypeError$1 = TypeError;
|
|
1555
|
+
|
|
1556
|
+
var deletePropertyOrThrow$1 = function (O, P) {
|
|
1557
|
+
if (!delete O[P]) throw new $TypeError$1('Cannot delete property ' + tryToString(P) + ' of ' + tryToString(O));
|
|
1558
|
+
};
|
|
1559
|
+
|
|
1560
|
+
var wellKnownSymbol$3 = wellKnownSymbol$a;
|
|
1561
|
+
|
|
1562
|
+
var TO_STRING_TAG$1 = wellKnownSymbol$3('toStringTag');
|
|
1563
|
+
var test$1 = {};
|
|
1564
|
+
|
|
1565
|
+
test$1[TO_STRING_TAG$1] = 'z';
|
|
1566
|
+
|
|
1567
|
+
var toStringTagSupport = String(test$1) === '[object z]';
|
|
1568
|
+
|
|
1569
|
+
var TO_STRING_TAG_SUPPORT = toStringTagSupport;
|
|
1570
|
+
var isCallable = isCallable$e;
|
|
1571
|
+
var classofRaw$1 = classofRaw$2;
|
|
1572
|
+
var wellKnownSymbol$2 = wellKnownSymbol$a;
|
|
1573
|
+
|
|
1574
|
+
var TO_STRING_TAG = wellKnownSymbol$2('toStringTag');
|
|
1575
|
+
var $Object = Object;
|
|
1576
|
+
|
|
1577
|
+
// ES3 wrong here
|
|
1578
|
+
var CORRECT_ARGUMENTS = classofRaw$1(function () { return arguments; }()) === 'Arguments';
|
|
1579
|
+
|
|
1580
|
+
// fallback for IE11 Script Access Denied error
|
|
1581
|
+
var tryGet = function (it, key) {
|
|
1582
|
+
try {
|
|
1583
|
+
return it[key];
|
|
1584
|
+
} catch (error) { /* empty */ }
|
|
1585
|
+
};
|
|
1586
|
+
|
|
1587
|
+
// getting tag from ES6+ `Object.prototype.toString`
|
|
1588
|
+
var classof$2 = TO_STRING_TAG_SUPPORT ? classofRaw$1 : function (it) {
|
|
1589
|
+
var O, tag, result;
|
|
1590
|
+
return it === undefined ? 'Undefined' : it === null ? 'Null'
|
|
1591
|
+
// @@toStringTag case
|
|
1592
|
+
: typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag
|
|
1593
|
+
// builtinTag case
|
|
1594
|
+
: CORRECT_ARGUMENTS ? classofRaw$1(O)
|
|
1595
|
+
// ES3 arguments fallback
|
|
1596
|
+
: (result = classofRaw$1(O)) === 'Object' && isCallable(O.callee) ? 'Arguments' : result;
|
|
1597
|
+
};
|
|
1598
|
+
|
|
1599
|
+
var classof$1 = classof$2;
|
|
1600
|
+
|
|
1601
|
+
var $String = String;
|
|
1602
|
+
|
|
1603
|
+
var toString$3 = function (argument) {
|
|
1604
|
+
if (classof$1(argument) === 'Symbol') throw new TypeError('Cannot convert a Symbol value to a string');
|
|
1605
|
+
return $String(argument);
|
|
1606
|
+
};
|
|
1607
|
+
|
|
1608
|
+
var uncurryThis$5 = functionUncurryThis;
|
|
1609
|
+
|
|
1610
|
+
var arraySlice$1 = uncurryThis$5([].slice);
|
|
1611
|
+
|
|
1612
|
+
var arraySlice = arraySlice$1;
|
|
1613
|
+
|
|
1614
|
+
var floor = Math.floor;
|
|
1615
|
+
|
|
1616
|
+
var sort = function (array, comparefn) {
|
|
1617
|
+
var length = array.length;
|
|
1618
|
+
|
|
1619
|
+
if (length < 8) {
|
|
1620
|
+
// insertion sort
|
|
1621
|
+
var i = 1;
|
|
1622
|
+
var element, j;
|
|
1623
|
+
|
|
1624
|
+
while (i < length) {
|
|
1625
|
+
j = i;
|
|
1626
|
+
element = array[i];
|
|
1627
|
+
while (j && comparefn(array[j - 1], element) > 0) {
|
|
1628
|
+
array[j] = array[--j];
|
|
1629
|
+
}
|
|
1630
|
+
if (j !== i++) array[j] = element;
|
|
1631
|
+
}
|
|
1632
|
+
} else {
|
|
1633
|
+
// merge sort
|
|
1634
|
+
var middle = floor(length / 2);
|
|
1635
|
+
var left = sort(arraySlice(array, 0, middle), comparefn);
|
|
1636
|
+
var right = sort(arraySlice(array, middle), comparefn);
|
|
1637
|
+
var llength = left.length;
|
|
1638
|
+
var rlength = right.length;
|
|
1639
|
+
var lindex = 0;
|
|
1640
|
+
var rindex = 0;
|
|
1641
|
+
|
|
1642
|
+
while (lindex < llength || rindex < rlength) {
|
|
1643
|
+
array[lindex + rindex] = (lindex < llength && rindex < rlength)
|
|
1644
|
+
? comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++]
|
|
1645
|
+
: lindex < llength ? left[lindex++] : right[rindex++];
|
|
1646
|
+
}
|
|
1647
|
+
}
|
|
1648
|
+
|
|
1649
|
+
return array;
|
|
1650
|
+
};
|
|
1651
|
+
|
|
1652
|
+
var arraySort = sort;
|
|
1653
|
+
|
|
1654
|
+
var fails$6 = fails$h;
|
|
1655
|
+
|
|
1656
|
+
var arrayMethodIsStrict$1 = function (METHOD_NAME, argument) {
|
|
1657
|
+
var method = [][METHOD_NAME];
|
|
1658
|
+
return !!method && fails$6(function () {
|
|
1659
|
+
// eslint-disable-next-line no-useless-call -- required for testing
|
|
1660
|
+
method.call(null, argument || function () { return 1; }, 1);
|
|
1661
|
+
});
|
|
1662
|
+
};
|
|
1663
|
+
|
|
1664
|
+
var userAgent$1 = engineUserAgent;
|
|
1665
|
+
|
|
1666
|
+
var firefox = userAgent$1.match(/firefox\/(\d+)/i);
|
|
1667
|
+
|
|
1668
|
+
var engineFfVersion = !!firefox && +firefox[1];
|
|
1669
|
+
|
|
1670
|
+
var UA = engineUserAgent;
|
|
1671
|
+
|
|
1672
|
+
var engineIsIeOrEdge = /MSIE|Trident/.test(UA);
|
|
1673
|
+
|
|
1674
|
+
var userAgent = engineUserAgent;
|
|
1675
|
+
|
|
1676
|
+
var webkit = userAgent.match(/AppleWebKit\/(\d+)\./);
|
|
1677
|
+
|
|
1678
|
+
var engineWebkitVersion = !!webkit && +webkit[1];
|
|
1679
|
+
|
|
1680
|
+
var $$3 = _export;
|
|
1681
|
+
var uncurryThis$4 = functionUncurryThis;
|
|
1682
|
+
var aCallable = aCallable$3;
|
|
1683
|
+
var toObject$1 = toObject$4;
|
|
1684
|
+
var lengthOfArrayLike = lengthOfArrayLike$2;
|
|
1685
|
+
var deletePropertyOrThrow = deletePropertyOrThrow$1;
|
|
1686
|
+
var toString$2 = toString$3;
|
|
1687
|
+
var fails$5 = fails$h;
|
|
1688
|
+
var internalSort = arraySort;
|
|
1689
|
+
var arrayMethodIsStrict = arrayMethodIsStrict$1;
|
|
1690
|
+
var FF = engineFfVersion;
|
|
1691
|
+
var IE_OR_EDGE = engineIsIeOrEdge;
|
|
1692
|
+
var V8 = engineV8Version;
|
|
1693
|
+
var WEBKIT = engineWebkitVersion;
|
|
1694
|
+
|
|
1695
|
+
var test = [];
|
|
1696
|
+
var nativeSort = uncurryThis$4(test.sort);
|
|
1697
|
+
var push = uncurryThis$4(test.push);
|
|
1698
|
+
|
|
1699
|
+
// IE8-
|
|
1700
|
+
var FAILS_ON_UNDEFINED = fails$5(function () {
|
|
1701
|
+
test.sort(undefined);
|
|
1702
|
+
});
|
|
1703
|
+
// V8 bug
|
|
1704
|
+
var FAILS_ON_NULL = fails$5(function () {
|
|
1705
|
+
test.sort(null);
|
|
1706
|
+
});
|
|
1707
|
+
// Old WebKit
|
|
1708
|
+
var STRICT_METHOD = arrayMethodIsStrict('sort');
|
|
1709
|
+
|
|
1710
|
+
var STABLE_SORT = !fails$5(function () {
|
|
1711
|
+
// feature detection can be too slow, so check engines versions
|
|
1712
|
+
if (V8) return V8 < 70;
|
|
1713
|
+
if (FF && FF > 3) return;
|
|
1714
|
+
if (IE_OR_EDGE) return true;
|
|
1715
|
+
if (WEBKIT) return WEBKIT < 603;
|
|
1716
|
+
|
|
1717
|
+
var result = '';
|
|
1718
|
+
var code, chr, value, index;
|
|
1719
|
+
|
|
1720
|
+
// generate an array with more 512 elements (Chakra and old V8 fails only in this case)
|
|
1721
|
+
for (code = 65; code < 76; code++) {
|
|
1722
|
+
chr = String.fromCharCode(code);
|
|
1723
|
+
|
|
1724
|
+
switch (code) {
|
|
1725
|
+
case 66: case 69: case 70: case 72: value = 3; break;
|
|
1726
|
+
case 68: case 71: value = 4; break;
|
|
1727
|
+
default: value = 2;
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1730
|
+
for (index = 0; index < 47; index++) {
|
|
1731
|
+
test.push({ k: chr + index, v: value });
|
|
1732
|
+
}
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1735
|
+
test.sort(function (a, b) { return b.v - a.v; });
|
|
1736
|
+
|
|
1737
|
+
for (index = 0; index < test.length; index++) {
|
|
1738
|
+
chr = test[index].k.charAt(0);
|
|
1739
|
+
if (result.charAt(result.length - 1) !== chr) result += chr;
|
|
1740
|
+
}
|
|
1741
|
+
|
|
1742
|
+
return result !== 'DGBEFHACIJK';
|
|
1743
|
+
});
|
|
1744
|
+
|
|
1745
|
+
var FORCED = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD || !STABLE_SORT;
|
|
1746
|
+
|
|
1747
|
+
var getSortCompare = function (comparefn) {
|
|
1748
|
+
return function (x, y) {
|
|
1749
|
+
if (y === undefined) return -1;
|
|
1750
|
+
if (x === undefined) return 1;
|
|
1751
|
+
if (comparefn !== undefined) return +comparefn(x, y) || 0;
|
|
1752
|
+
return toString$2(x) > toString$2(y) ? 1 : -1;
|
|
1753
|
+
};
|
|
1754
|
+
};
|
|
1755
|
+
|
|
1756
|
+
// `Array.prototype.sort` method
|
|
1757
|
+
// https://tc39.es/ecma262/#sec-array.prototype.sort
|
|
1758
|
+
$$3({ target: 'Array', proto: true, forced: FORCED }, {
|
|
1759
|
+
sort: function sort(comparefn) {
|
|
1760
|
+
if (comparefn !== undefined) aCallable(comparefn);
|
|
1761
|
+
|
|
1762
|
+
var array = toObject$1(this);
|
|
1763
|
+
|
|
1764
|
+
if (STABLE_SORT) return comparefn === undefined ? nativeSort(array) : nativeSort(array, comparefn);
|
|
1765
|
+
|
|
1766
|
+
var items = [];
|
|
1767
|
+
var arrayLength = lengthOfArrayLike(array);
|
|
1768
|
+
var itemsLength, index;
|
|
1769
|
+
|
|
1770
|
+
for (index = 0; index < arrayLength; index++) {
|
|
1771
|
+
if (index in array) push(items, array[index]);
|
|
1772
|
+
}
|
|
1773
|
+
|
|
1774
|
+
internalSort(items, getSortCompare(comparefn));
|
|
1775
|
+
|
|
1776
|
+
itemsLength = lengthOfArrayLike(items);
|
|
1777
|
+
index = 0;
|
|
1778
|
+
|
|
1779
|
+
while (index < itemsLength) array[index] = items[index++];
|
|
1780
|
+
while (index < arrayLength) deletePropertyOrThrow(array, index++);
|
|
1781
|
+
|
|
1782
|
+
return array;
|
|
1783
|
+
}
|
|
1784
|
+
});
|
|
1785
|
+
|
|
1552
1786
|
var DESCRIPTORS = descriptors;
|
|
1553
|
-
var uncurryThis = functionUncurryThis;
|
|
1554
|
-
var call = functionCall;
|
|
1555
|
-
var fails = fails$
|
|
1787
|
+
var uncurryThis$3 = functionUncurryThis;
|
|
1788
|
+
var call$2 = functionCall;
|
|
1789
|
+
var fails$4 = fails$h;
|
|
1556
1790
|
var objectKeys = objectKeys$2;
|
|
1557
1791
|
var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols;
|
|
1558
1792
|
var propertyIsEnumerableModule = objectPropertyIsEnumerable;
|
|
1559
|
-
var toObject = toObject$
|
|
1793
|
+
var toObject = toObject$4;
|
|
1560
1794
|
var IndexedObject = indexedObject;
|
|
1561
1795
|
|
|
1562
1796
|
// eslint-disable-next-line es/no-object-assign -- safe
|
|
1563
1797
|
var $assign = Object.assign;
|
|
1564
1798
|
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
1565
1799
|
var defineProperty = Object.defineProperty;
|
|
1566
|
-
var concat = uncurryThis([].concat);
|
|
1800
|
+
var concat = uncurryThis$3([].concat);
|
|
1567
1801
|
|
|
1568
1802
|
// `Object.assign` method
|
|
1569
1803
|
// https://tc39.es/ecma262/#sec-object.assign
|
|
1570
|
-
var objectAssign = !$assign || fails(function () {
|
|
1804
|
+
var objectAssign = !$assign || fails$4(function () {
|
|
1571
1805
|
// should have correct order of operations (Edge bug)
|
|
1572
1806
|
if (DESCRIPTORS && $assign({ b: 1 }, $assign(defineProperty({}, 'a', {
|
|
1573
1807
|
enumerable: true,
|
|
@@ -1601,29 +1835,176 @@ var objectAssign = !$assign || fails(function () {
|
|
|
1601
1835
|
var key;
|
|
1602
1836
|
while (length > j) {
|
|
1603
1837
|
key = keys[j++];
|
|
1604
|
-
if (!DESCRIPTORS || call(propertyIsEnumerable, S, key)) T[key] = S[key];
|
|
1838
|
+
if (!DESCRIPTORS || call$2(propertyIsEnumerable, S, key)) T[key] = S[key];
|
|
1605
1839
|
}
|
|
1606
1840
|
} return T;
|
|
1607
1841
|
} : $assign;
|
|
1608
1842
|
|
|
1609
|
-
var
|
|
1843
|
+
var $$2 = _export;
|
|
1610
1844
|
var assign = objectAssign;
|
|
1611
1845
|
|
|
1612
1846
|
// `Object.assign` method
|
|
1613
1847
|
// https://tc39.es/ecma262/#sec-object.assign
|
|
1614
1848
|
// eslint-disable-next-line es/no-object-assign -- required for testing
|
|
1615
|
-
|
|
1849
|
+
$$2({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }, {
|
|
1616
1850
|
assign: assign
|
|
1617
1851
|
});
|
|
1618
1852
|
|
|
1619
|
-
|
|
1853
|
+
var anObject$1 = anObject$6;
|
|
1854
|
+
|
|
1855
|
+
// `RegExp.prototype.flags` getter implementation
|
|
1856
|
+
// https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
|
|
1857
|
+
var regexpFlags$1 = function () {
|
|
1858
|
+
var that = anObject$1(this);
|
|
1859
|
+
var result = '';
|
|
1860
|
+
if (that.hasIndices) result += 'd';
|
|
1861
|
+
if (that.global) result += 'g';
|
|
1862
|
+
if (that.ignoreCase) result += 'i';
|
|
1863
|
+
if (that.multiline) result += 'm';
|
|
1864
|
+
if (that.dotAll) result += 's';
|
|
1865
|
+
if (that.unicode) result += 'u';
|
|
1866
|
+
if (that.unicodeSets) result += 'v';
|
|
1867
|
+
if (that.sticky) result += 'y';
|
|
1868
|
+
return result;
|
|
1869
|
+
};
|
|
1870
|
+
|
|
1871
|
+
var call$1 = functionCall;
|
|
1872
|
+
var hasOwn = hasOwnProperty_1;
|
|
1873
|
+
var isPrototypeOf = objectIsPrototypeOf;
|
|
1874
|
+
var regExpFlags = regexpFlags$1;
|
|
1875
|
+
|
|
1876
|
+
var RegExpPrototype$1 = RegExp.prototype;
|
|
1877
|
+
|
|
1878
|
+
var regexpGetFlags = function (R) {
|
|
1879
|
+
var flags = R.flags;
|
|
1880
|
+
return flags === undefined && !('flags' in RegExpPrototype$1) && !hasOwn(R, 'flags') && isPrototypeOf(RegExpPrototype$1, R)
|
|
1881
|
+
? call$1(regExpFlags, R) : flags;
|
|
1882
|
+
};
|
|
1883
|
+
|
|
1884
|
+
var PROPER_FUNCTION_NAME = functionName.PROPER;
|
|
1885
|
+
var defineBuiltIn = defineBuiltIn$4;
|
|
1886
|
+
var anObject = anObject$6;
|
|
1887
|
+
var $toString = toString$3;
|
|
1888
|
+
var fails$3 = fails$h;
|
|
1889
|
+
var getRegExpFlags = regexpGetFlags;
|
|
1890
|
+
|
|
1891
|
+
var TO_STRING = 'toString';
|
|
1892
|
+
var RegExpPrototype = RegExp.prototype;
|
|
1893
|
+
var nativeToString = RegExpPrototype[TO_STRING];
|
|
1894
|
+
|
|
1895
|
+
var NOT_GENERIC = fails$3(function () { return nativeToString.call({ source: 'a', flags: 'b' }) !== '/a/b'; });
|
|
1896
|
+
// FF44- RegExp#toString has a wrong name
|
|
1897
|
+
var INCORRECT_NAME = PROPER_FUNCTION_NAME && nativeToString.name !== TO_STRING;
|
|
1898
|
+
|
|
1899
|
+
// `RegExp.prototype.toString` method
|
|
1900
|
+
// https://tc39.es/ecma262/#sec-regexp.prototype.tostring
|
|
1901
|
+
if (NOT_GENERIC || INCORRECT_NAME) {
|
|
1902
|
+
defineBuiltIn(RegExpPrototype, TO_STRING, function toString() {
|
|
1903
|
+
var R = anObject(this);
|
|
1904
|
+
var pattern = $toString(R.source);
|
|
1905
|
+
var flags = $toString(getRegExpFlags(R));
|
|
1906
|
+
return '/' + pattern + '/' + flags;
|
|
1907
|
+
}, { unsafe: true });
|
|
1908
|
+
}
|
|
1909
|
+
|
|
1910
|
+
var classofRaw = classofRaw$2;
|
|
1911
|
+
var uncurryThis$2 = functionUncurryThis;
|
|
1912
|
+
|
|
1913
|
+
var functionUncurryThisClause = function (fn) {
|
|
1914
|
+
// Nashorn bug:
|
|
1915
|
+
// https://github.com/zloirock/core-js/issues/1128
|
|
1916
|
+
// https://github.com/zloirock/core-js/issues/1130
|
|
1917
|
+
if (classofRaw(fn) === 'Function') return uncurryThis$2(fn);
|
|
1918
|
+
};
|
|
1919
|
+
|
|
1920
|
+
var isObject = isObject$9;
|
|
1921
|
+
var classof = classofRaw$2;
|
|
1922
|
+
var wellKnownSymbol$1 = wellKnownSymbol$a;
|
|
1923
|
+
|
|
1924
|
+
var MATCH$1 = wellKnownSymbol$1('match');
|
|
1925
|
+
|
|
1926
|
+
// `IsRegExp` abstract operation
|
|
1927
|
+
// https://tc39.es/ecma262/#sec-isregexp
|
|
1928
|
+
var isRegexp = function (it) {
|
|
1929
|
+
var isRegExp;
|
|
1930
|
+
return isObject(it) && ((isRegExp = it[MATCH$1]) !== undefined ? !!isRegExp : classof(it) === 'RegExp');
|
|
1931
|
+
};
|
|
1932
|
+
|
|
1933
|
+
var isRegExp = isRegexp;
|
|
1934
|
+
|
|
1935
|
+
var $TypeError = TypeError;
|
|
1936
|
+
|
|
1937
|
+
var notARegexp = function (it) {
|
|
1938
|
+
if (isRegExp(it)) {
|
|
1939
|
+
throw new $TypeError("The method doesn't accept regular expressions");
|
|
1940
|
+
} return it;
|
|
1941
|
+
};
|
|
1942
|
+
|
|
1943
|
+
var wellKnownSymbol = wellKnownSymbol$a;
|
|
1944
|
+
|
|
1945
|
+
var MATCH = wellKnownSymbol('match');
|
|
1946
|
+
|
|
1947
|
+
var correctIsRegexpLogic = function (METHOD_NAME) {
|
|
1948
|
+
var regexp = /./;
|
|
1949
|
+
try {
|
|
1950
|
+
'/./'[METHOD_NAME](regexp);
|
|
1951
|
+
} catch (error1) {
|
|
1952
|
+
try {
|
|
1953
|
+
regexp[MATCH] = false;
|
|
1954
|
+
return '/./'[METHOD_NAME](regexp);
|
|
1955
|
+
} catch (error2) { /* empty */ }
|
|
1956
|
+
} return false;
|
|
1957
|
+
};
|
|
1958
|
+
|
|
1959
|
+
var $$1 = _export;
|
|
1960
|
+
var uncurryThis$1 = functionUncurryThisClause;
|
|
1961
|
+
var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
|
|
1962
|
+
var toLength = toLength$2;
|
|
1963
|
+
var toString$1 = toString$3;
|
|
1964
|
+
var notARegExp = notARegexp;
|
|
1965
|
+
var requireObjectCoercible = requireObjectCoercible$4;
|
|
1966
|
+
var correctIsRegExpLogic = correctIsRegexpLogic;
|
|
1967
|
+
|
|
1968
|
+
var stringSlice$1 = uncurryThis$1(''.slice);
|
|
1969
|
+
var min = Math.min;
|
|
1970
|
+
|
|
1971
|
+
var CORRECT_IS_REGEXP_LOGIC = correctIsRegExpLogic('startsWith');
|
|
1972
|
+
// https://github.com/zloirock/core-js/pull/702
|
|
1973
|
+
var MDN_POLYFILL_BUG = !CORRECT_IS_REGEXP_LOGIC && !!function () {
|
|
1974
|
+
var descriptor = getOwnPropertyDescriptor(String.prototype, 'startsWith');
|
|
1975
|
+
return descriptor && !descriptor.writable;
|
|
1976
|
+
}();
|
|
1977
|
+
|
|
1978
|
+
// `String.prototype.startsWith` method
|
|
1979
|
+
// https://tc39.es/ecma262/#sec-string.prototype.startswith
|
|
1980
|
+
$$1({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, {
|
|
1981
|
+
startsWith: function startsWith(searchString /* , position = 0 */) {
|
|
1982
|
+
var that = toString$1(requireObjectCoercible(this));
|
|
1983
|
+
notARegExp(searchString);
|
|
1984
|
+
var index = toLength(min(arguments.length > 1 ? arguments[1] : undefined, that.length));
|
|
1985
|
+
var search = toString$1(searchString);
|
|
1986
|
+
return stringSlice$1(that, index, index + search.length) === search;
|
|
1987
|
+
}
|
|
1988
|
+
});
|
|
1989
|
+
|
|
1620
1990
|
const FormGroupContext = /*#__PURE__*/createContext({});
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1991
|
+
/**
|
|
1992
|
+
* context interface to be used isolated or with the context provider
|
|
1993
|
+
*
|
|
1994
|
+
* @param {TFormContextProvider} param context parameters
|
|
1995
|
+
* @returns {TFormContext}
|
|
1996
|
+
*/
|
|
1997
|
+
const IsolatedContext = ({
|
|
1998
|
+
debugMode: _debugMode = false,
|
|
1999
|
+
mappers
|
|
1625
2000
|
}) => {
|
|
1626
2001
|
const formGroupInstance = useRef(new FormGroup());
|
|
2002
|
+
const addFormWithIndex = index => {
|
|
2003
|
+
formGroupInstance.current.createFormWithIndex({
|
|
2004
|
+
index,
|
|
2005
|
+
mappers
|
|
2006
|
+
});
|
|
2007
|
+
};
|
|
1627
2008
|
const addForm = ({
|
|
1628
2009
|
key,
|
|
1629
2010
|
formInstance
|
|
@@ -1648,10 +2029,11 @@ const FormGroupContextProvider = ({
|
|
|
1648
2029
|
const printFormGroupInstance = () => {
|
|
1649
2030
|
console.log(formGroupInstance.current.printFormGroupInstance());
|
|
1650
2031
|
};
|
|
1651
|
-
|
|
2032
|
+
function submitMultipleFormsByIndex(indexes) {
|
|
1652
2033
|
return formGroupInstance.current.submitMultipleFormsByIndex(indexes);
|
|
1653
|
-
}
|
|
1654
|
-
|
|
2034
|
+
}
|
|
2035
|
+
return {
|
|
2036
|
+
addFormWithIndex,
|
|
1655
2037
|
addForm,
|
|
1656
2038
|
getForm,
|
|
1657
2039
|
removeForm,
|
|
@@ -1659,84 +2041,161 @@ const FormGroupContextProvider = ({
|
|
|
1659
2041
|
formGroupInstance: formGroupInstance.current,
|
|
1660
2042
|
printFormGroupInstance,
|
|
1661
2043
|
submitMultipleFormsByIndex,
|
|
1662
|
-
debugMode: _debugMode
|
|
2044
|
+
debugMode: _debugMode,
|
|
2045
|
+
active: false
|
|
1663
2046
|
};
|
|
2047
|
+
};
|
|
2048
|
+
/**
|
|
2049
|
+
* context provider to wrap form-engine adapter elements
|
|
2050
|
+
*
|
|
2051
|
+
* @param {PropsWithChildren<TFormContextProvider>} param context parameters
|
|
2052
|
+
* @returns {ReactElement}
|
|
2053
|
+
*/
|
|
2054
|
+
const FormGroupContextProvider = ({
|
|
2055
|
+
children,
|
|
2056
|
+
mappers,
|
|
2057
|
+
debugMode: _debugMode2 = false
|
|
2058
|
+
}) => {
|
|
2059
|
+
const contextValue = IsolatedContext({
|
|
2060
|
+
mappers,
|
|
2061
|
+
debugMode: _debugMode2
|
|
2062
|
+
});
|
|
2063
|
+
contextValue.debugMode = _debugMode2;
|
|
2064
|
+
contextValue.active = true;
|
|
1664
2065
|
return jsxs(FormGroupContext.Provider, {
|
|
1665
2066
|
value: contextValue,
|
|
1666
|
-
children: [
|
|
2067
|
+
children: [_debugMode2 && jsxs(Fragment, {
|
|
1667
2068
|
children: [jsx("button", {
|
|
1668
|
-
onClick: () => console.log(formGroupInstance),
|
|
2069
|
+
onClick: () => console.log(contextValue.formGroupInstance),
|
|
1669
2070
|
children: "printGroupInstance"
|
|
1670
2071
|
}), jsx("br", {}), jsx("hr", {})]
|
|
1671
2072
|
}), children]
|
|
1672
2073
|
});
|
|
1673
2074
|
};
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
2075
|
+
/**
|
|
2076
|
+
* FormGroup context hook to handle context or isolated context implementations
|
|
2077
|
+
*
|
|
2078
|
+
* @param {TFormContextProvider} props form group context parameters
|
|
2079
|
+
* @returns {TFormContext}
|
|
2080
|
+
*/
|
|
2081
|
+
const useFormGroupContext = props => {
|
|
2082
|
+
const context = useContext(FormGroupContext);
|
|
2083
|
+
if (Object.keys(context).length === 0 && props) {
|
|
2084
|
+
return IsolatedContext({
|
|
2085
|
+
debugMode: props.debugMode,
|
|
2086
|
+
mappers: props.mappers
|
|
2087
|
+
});
|
|
1678
2088
|
}
|
|
1679
2089
|
return context;
|
|
1680
2090
|
};
|
|
1681
2091
|
|
|
2092
|
+
/**
|
|
2093
|
+
* Renders the React element defined on the mappers configuration
|
|
2094
|
+
*
|
|
2095
|
+
* @param param component props, field instance and children to render
|
|
2096
|
+
* @returns
|
|
2097
|
+
*/
|
|
2098
|
+
const FieldWrapperComponentRender = ({
|
|
2099
|
+
props,
|
|
2100
|
+
fieldInstance,
|
|
2101
|
+
children
|
|
2102
|
+
}) => {
|
|
2103
|
+
var _a, _b, _c;
|
|
2104
|
+
const Component = (_a = fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.mapper) === null || _a === void 0 ? void 0 : _a.component;
|
|
2105
|
+
const Asynccomponent = (_b = fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.mapper) === null || _b === void 0 ? void 0 : _b.asynccomponent;
|
|
2106
|
+
if (Component) return jsx(Component, Object.assign({}, props, {
|
|
2107
|
+
children: children && children
|
|
2108
|
+
}));
|
|
2109
|
+
if (Asynccomponent) return jsx(Suspense, {
|
|
2110
|
+
children: jsx(Asynccomponent, Object.assign({}, props, {
|
|
2111
|
+
children: children && children
|
|
2112
|
+
}))
|
|
2113
|
+
});
|
|
2114
|
+
return jsx("div", {
|
|
2115
|
+
children: `failed to render field ${fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.name} with componentName:${(_c = fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.mapper) === null || _c === void 0 ? void 0 : _c.componentName}, please check mappers`
|
|
2116
|
+
});
|
|
2117
|
+
};
|
|
2118
|
+
/**
|
|
2119
|
+
* Base field Wrapper to render the component with the necessary configurations from the schema
|
|
2120
|
+
* and mapper configuration
|
|
2121
|
+
*
|
|
2122
|
+
* @param {TFieldWrapperProps} param FieldWrapper params
|
|
2123
|
+
* @returns {ReactElement}
|
|
2124
|
+
*/
|
|
1682
2125
|
const FieldWrapper = ({
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
formKey,
|
|
2126
|
+
name,
|
|
2127
|
+
formIndex,
|
|
1686
2128
|
children,
|
|
1687
|
-
|
|
2129
|
+
props,
|
|
2130
|
+
context
|
|
1688
2131
|
}) => {
|
|
1689
|
-
var _a;
|
|
2132
|
+
var _a, _b, _c;
|
|
2133
|
+
const localContext = useFormGroupContext({});
|
|
2134
|
+
/**
|
|
2135
|
+
* picks the right context prioritizing the context passed as prop
|
|
2136
|
+
*/
|
|
1690
2137
|
const {
|
|
1691
2138
|
formGroupInstance,
|
|
1692
2139
|
debugMode
|
|
1693
|
-
} =
|
|
1694
|
-
const fieldInstance = ((_a = formGroupInstance.getForm({
|
|
1695
|
-
key:
|
|
2140
|
+
} = useMemo(() => context ? context : localContext, [context, localContext]);
|
|
2141
|
+
const fieldInstance = useRef((_a = formGroupInstance.getForm({
|
|
2142
|
+
key: formIndex
|
|
1696
2143
|
})) === null || _a === void 0 ? void 0 : _a.getField({
|
|
1697
|
-
key:
|
|
1698
|
-
}))
|
|
1699
|
-
const [valueState, setValueState] = useState(fieldInstance.stateValue);
|
|
2144
|
+
key: name
|
|
2145
|
+
})).current;
|
|
2146
|
+
const [valueState, setValueState] = useState((fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.stateValue) || {});
|
|
1700
2147
|
const [state, setState] = useState({
|
|
1701
|
-
visibility: fieldInstance.visibility,
|
|
1702
|
-
props: fieldInstance.props
|
|
1703
|
-
apiResponse: fieldInstance.api
|
|
2148
|
+
visibility: fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.visibility,
|
|
2149
|
+
props: (fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.props) || props
|
|
1704
2150
|
});
|
|
2151
|
+
/**
|
|
2152
|
+
* handles the mounting and unmounting logic onto the field instance
|
|
2153
|
+
*/
|
|
1705
2154
|
useEffect(() => {
|
|
1706
|
-
fieldInstance.mountField({
|
|
2155
|
+
fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.mountField({
|
|
1707
2156
|
valueSubscription: value => {
|
|
1708
2157
|
setValueState(value);
|
|
1709
2158
|
},
|
|
1710
2159
|
propsSubscription: ({
|
|
1711
|
-
errors,
|
|
1712
2160
|
visibility,
|
|
1713
|
-
|
|
1714
|
-
|
|
2161
|
+
props,
|
|
2162
|
+
errors
|
|
1715
2163
|
}) => {
|
|
1716
2164
|
setState(prev => Object.assign(Object.assign({}, prev), {
|
|
1717
|
-
errors,
|
|
1718
2165
|
visibility,
|
|
1719
|
-
|
|
1720
|
-
|
|
2166
|
+
props,
|
|
2167
|
+
errors
|
|
1721
2168
|
}));
|
|
1722
2169
|
}
|
|
1723
2170
|
});
|
|
1724
2171
|
return () => {
|
|
1725
|
-
fieldInstance.destroyField();
|
|
2172
|
+
fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.destroyField();
|
|
1726
2173
|
};
|
|
1727
2174
|
}, []);
|
|
2175
|
+
/**
|
|
2176
|
+
* handles the value change onto the field instance
|
|
2177
|
+
*/
|
|
1728
2178
|
const handleChange = useCallback(event => {
|
|
1729
|
-
fieldInstance.emitValue({
|
|
2179
|
+
fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.emitValue({
|
|
1730
2180
|
value: event,
|
|
1731
2181
|
event: 'ON_FIELD_CHANGE'
|
|
1732
2182
|
});
|
|
1733
2183
|
}, []);
|
|
2184
|
+
/**
|
|
2185
|
+
* handles the event emission onto the field instance
|
|
2186
|
+
*/
|
|
1734
2187
|
const handleEvent = useCallback(event => {
|
|
1735
|
-
fieldInstance.emitEvents({
|
|
2188
|
+
fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.emitEvents({
|
|
1736
2189
|
event
|
|
1737
2190
|
});
|
|
1738
2191
|
}, []);
|
|
2192
|
+
/**
|
|
2193
|
+
* handles the mappers configuration to bind the event submission callback
|
|
2194
|
+
* to the corresponding prop defined on the mappers
|
|
2195
|
+
*/
|
|
1739
2196
|
const mapProps = useMemo(() => {
|
|
2197
|
+
var _a;
|
|
2198
|
+
const events = (_a = fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.mapper) === null || _a === void 0 ? void 0 : _a.events;
|
|
1740
2199
|
const props = {};
|
|
1741
2200
|
if (events === null || events === void 0 ? void 0 : events.onBlur) props[events.onBlur] = () => handleEvent('ON_FIELD_BLUR');
|
|
1742
2201
|
if (events === null || events === void 0 ? void 0 : events.getValue) props[events.getValue] = handleChange;
|
|
@@ -1746,65 +2205,128 @@ const FieldWrapper = ({
|
|
|
1746
2205
|
if (events === null || events === void 0 ? void 0 : events.onKeyDown) props[events.onKeyDown] = () => handleEvent('ON_FIELD_KEYDOWN');
|
|
1747
2206
|
return props;
|
|
1748
2207
|
}, []);
|
|
1749
|
-
const mapValue = useMemo(() => (events === null || events === void 0 ? void 0 : events.setValue) ? {
|
|
1750
|
-
[events.setValue]: valueState
|
|
1751
|
-
} : {}, [valueState]);
|
|
1752
2208
|
return (state === null || state === void 0 ? void 0 : state.visibility) ? jsxs(Fragment, {
|
|
1753
|
-
children: [debugMode && jsxs(
|
|
1754
|
-
|
|
2209
|
+
children: [debugMode && jsxs("div", {
|
|
2210
|
+
style: {
|
|
2211
|
+
width: '100%',
|
|
2212
|
+
display: 'flex',
|
|
2213
|
+
flexDirection: 'column'
|
|
2214
|
+
},
|
|
2215
|
+
children: [jsxs("b", {
|
|
1755
2216
|
style: {
|
|
1756
2217
|
padding: '0px',
|
|
1757
2218
|
margin: '0px'
|
|
1758
2219
|
},
|
|
1759
|
-
children:
|
|
2220
|
+
children: ["name:", name]
|
|
2221
|
+
}), jsxs("b", {
|
|
2222
|
+
style: {
|
|
2223
|
+
padding: '0px',
|
|
2224
|
+
margin: '0px'
|
|
2225
|
+
},
|
|
2226
|
+
children: ["order:", (_b = fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.originalSchema) === null || _b === void 0 ? void 0 : _b.order]
|
|
2227
|
+
}), jsxs("b", {
|
|
2228
|
+
style: {
|
|
2229
|
+
padding: '0px',
|
|
2230
|
+
margin: '0px'
|
|
2231
|
+
},
|
|
2232
|
+
children: ["path:", fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.path]
|
|
1760
2233
|
}), jsx("br", {}), jsx("hr", {})]
|
|
1761
|
-
}), jsx(
|
|
1762
|
-
|
|
1763
|
-
|
|
2234
|
+
}), jsx(FieldWrapperComponentRender, {
|
|
2235
|
+
props: Object.assign(Object.assign(Object.assign(Object.assign({}, mapProps), state.props), state.errors), valueState),
|
|
2236
|
+
fieldInstance: fieldInstance,
|
|
2237
|
+
children: children ? children : ((_c = state === null || state === void 0 ? void 0 : state.props) === null || _c === void 0 ? void 0 : _c.children) ? state === null || state === void 0 ? void 0 : state.props.children : null
|
|
2238
|
+
})]
|
|
1764
2239
|
}) : jsx(Fragment, {});
|
|
1765
2240
|
};
|
|
1766
2241
|
|
|
2242
|
+
/**
|
|
2243
|
+
* recursive function to transform form fields from a form instance into
|
|
2244
|
+
* a react component tree
|
|
2245
|
+
*
|
|
2246
|
+
* @param {Map<string,IFormField>} param.fields form instance field Map
|
|
2247
|
+
* @param {string} param.prevPath previous field path to track the tree branch creation
|
|
2248
|
+
* @param {string} param.formIndex form index to aid field identification onto the FieldWrapper
|
|
2249
|
+
* @returns {ReactNode}
|
|
2250
|
+
*/
|
|
1767
2251
|
const BuildTree = ({
|
|
1768
2252
|
fields,
|
|
1769
2253
|
prevPath,
|
|
1770
|
-
|
|
2254
|
+
formIndex
|
|
1771
2255
|
}) => {
|
|
1772
|
-
return Array.from(fields).
|
|
2256
|
+
return Array.from(fields).sort(([, field], [, field2]) => {
|
|
2257
|
+
var _a, _b;
|
|
2258
|
+
return (((_a = field.originalSchema) === null || _a === void 0 ? void 0 : _a.order) || 0) - (((_b = field2.originalSchema) === null || _b === void 0 ? void 0 : _b.order) || 0);
|
|
2259
|
+
}).filter(([, value]) => {
|
|
1773
2260
|
return value.path === prevPath;
|
|
1774
2261
|
}).map(([, value]) => {
|
|
1775
|
-
var _a;
|
|
1776
2262
|
const fieldName = value.name;
|
|
1777
|
-
const mapper = (_a = fields.get(fieldName)) === null || _a === void 0 ? void 0 : _a.mapper;
|
|
1778
2263
|
const children = BuildTree({
|
|
1779
2264
|
fields,
|
|
1780
2265
|
prevPath: `${prevPath ? `${prevPath}.` : ``}${value.name}`,
|
|
1781
|
-
|
|
2266
|
+
formIndex
|
|
1782
2267
|
});
|
|
1783
2268
|
const lenght = Children.count(children);
|
|
1784
|
-
return
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
events: mapper.events,
|
|
1788
|
-
formKey: formKey,
|
|
2269
|
+
return jsx(FieldWrapper, {
|
|
2270
|
+
name: fieldName,
|
|
2271
|
+
formIndex: formIndex,
|
|
1789
2272
|
children: lenght > 0 ? children : null
|
|
1790
|
-
}, fieldName)
|
|
1791
|
-
children: `failed to render field: ${fieldName} on tree, check mappers.. :(`
|
|
1792
|
-
});
|
|
2273
|
+
}, fieldName);
|
|
1793
2274
|
});
|
|
1794
2275
|
};
|
|
2276
|
+
/**
|
|
2277
|
+
* function to transform AsFormField elements onto a JSON schema
|
|
2278
|
+
*
|
|
2279
|
+
* @param param.children ReactNode children elements
|
|
2280
|
+
* @returns {IComponentSchema[] | null | undefined}
|
|
2281
|
+
*/
|
|
1795
2282
|
const BuildAsFormFieldTree = ({
|
|
1796
2283
|
children
|
|
1797
2284
|
}) => {
|
|
1798
2285
|
return Children.map(children, (child, index) => {
|
|
1799
|
-
var _a, _b;
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
2286
|
+
var _a, _b, _c, _d, _e;
|
|
2287
|
+
let struct;
|
|
2288
|
+
if (!String((_a = child === null || child === void 0 ? void 0 : child.type) === null || _a === void 0 ? void 0 : _a.name).startsWith('AsFormField')) {
|
|
2289
|
+
if (typeof child.type === 'function' || typeof child.type === 'object') {
|
|
2290
|
+
const props = Object.assign({}, child.props);
|
|
2291
|
+
delete props.children;
|
|
2292
|
+
struct = {
|
|
2293
|
+
component: ((_b = child === null || child === void 0 ? void 0 : child.type) === null || _b === void 0 ? void 0 : _b.name) || 'customForwardRef',
|
|
2294
|
+
name: `adapter-${Math.floor(Math.random() * Date.now()).toString(16)}`,
|
|
2295
|
+
mapper: {
|
|
2296
|
+
component: child.type,
|
|
2297
|
+
componentName: typeof child.type !== 'string' ? (_c = child === null || child === void 0 ? void 0 : child.type) === null || _c === void 0 ? void 0 : _c.name : child.type
|
|
2298
|
+
},
|
|
2299
|
+
props
|
|
2300
|
+
};
|
|
2301
|
+
} else if (typeof child.type === 'string' || typeof child === 'string') {
|
|
2302
|
+
throw new Error(`Only function components works inside a Form as React Nodes,\n
|
|
2303
|
+
if you want something like this to work: <div>hi</div>\n
|
|
2304
|
+
wrap it onto a function component\n
|
|
2305
|
+
const CustomTextNode = (props:{text:string}) => <div>props</div>\n
|
|
2306
|
+
and use it like <CustomTextNode text="hi"/>`);
|
|
2307
|
+
} else {
|
|
2308
|
+
throw {
|
|
2309
|
+
message: `Unknown error occured, please check the child that was tried to render below`,
|
|
2310
|
+
component: child
|
|
2311
|
+
};
|
|
2312
|
+
}
|
|
2313
|
+
} else {
|
|
2314
|
+
if (((_d = child === null || child === void 0 ? void 0 : child.type) === null || _d === void 0 ? void 0 : _d.name) === 'AsFormField') {
|
|
2315
|
+
struct = Object.assign({}, child.props);
|
|
2316
|
+
} else {
|
|
2317
|
+
if (!child.type.defaultProps.component) throw new Error(`set defaultProps component name\n
|
|
2318
|
+
ex: AsFormFieldInput.defaultProps = {
|
|
2319
|
+
component = 'input'
|
|
2320
|
+
}`);
|
|
2321
|
+
struct = Object.assign(Object.assign({}, child.props), child.type.defaultProps);
|
|
2322
|
+
}
|
|
1803
2323
|
}
|
|
1804
|
-
|
|
1805
|
-
|
|
2324
|
+
if (struct && (struct === null || struct === void 0 ? void 0 : struct.children)) {
|
|
2325
|
+
delete struct.children;
|
|
2326
|
+
}
|
|
2327
|
+
struct.order = index;
|
|
1806
2328
|
const childElements = BuildAsFormFieldTree({
|
|
1807
|
-
children: (
|
|
2329
|
+
children: (_e = child.props) === null || _e === void 0 ? void 0 : _e.children
|
|
1808
2330
|
});
|
|
1809
2331
|
return Object.assign(Object.assign({}, struct), childElements && {
|
|
1810
2332
|
children: childElements
|
|
@@ -1812,7 +2334,150 @@ const BuildAsFormFieldTree = ({
|
|
|
1812
2334
|
});
|
|
1813
2335
|
};
|
|
1814
2336
|
|
|
1815
|
-
|
|
2337
|
+
/******************************************************************************
|
|
2338
|
+
Copyright (c) Microsoft Corporation.
|
|
2339
|
+
|
|
2340
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
2341
|
+
purpose with or without fee is hereby granted.
|
|
2342
|
+
|
|
2343
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
2344
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
2345
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
2346
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
2347
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
2348
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
2349
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
2350
|
+
***************************************************************************** */
|
|
2351
|
+
|
|
2352
|
+
function __rest(s, e) {
|
|
2353
|
+
var t = {};
|
|
2354
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
2355
|
+
t[p] = s[p];
|
|
2356
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
2357
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2358
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
2359
|
+
t[p[i]] = s[p[i]];
|
|
2360
|
+
}
|
|
2361
|
+
return t;
|
|
2362
|
+
}
|
|
2363
|
+
|
|
2364
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
2365
|
+
var e = new Error(message);
|
|
2366
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
2367
|
+
};
|
|
2368
|
+
|
|
2369
|
+
/**
|
|
2370
|
+
* events mapping to aid function callback binding
|
|
2371
|
+
*/
|
|
2372
|
+
const eventsMapping = {
|
|
2373
|
+
ON_FIELD_CHANGE: 'onChange',
|
|
2374
|
+
ON_FIELD_BLUR: 'onBlur',
|
|
2375
|
+
ON_FIELD_FOCUS: 'onFocus',
|
|
2376
|
+
ON_FIELD_KEYDOWN: 'onKeyDown',
|
|
2377
|
+
ON_FIELD_KEYUP: 'onKeyUp',
|
|
2378
|
+
ON_FIELD_MOUNT: 'onMount',
|
|
2379
|
+
ON_API_FIELD_RESPONSE: 'onApiResponse',
|
|
2380
|
+
ON_FIELD_CLICK: 'onClick'
|
|
2381
|
+
};
|
|
2382
|
+
|
|
2383
|
+
/**
|
|
2384
|
+
* Hook to register events callback functions
|
|
2385
|
+
*/
|
|
2386
|
+
function useForm(_a) {
|
|
2387
|
+
var {
|
|
2388
|
+
id,
|
|
2389
|
+
onData,
|
|
2390
|
+
onSubmit,
|
|
2391
|
+
onFormMount
|
|
2392
|
+
} = _a,
|
|
2393
|
+
rest = __rest(_a, ["id", "onData", "onSubmit", "onFormMount"]);
|
|
2394
|
+
const {
|
|
2395
|
+
formGroupInstance
|
|
2396
|
+
} = useFormGroupContext({});
|
|
2397
|
+
/**
|
|
2398
|
+
* reference to store all updated callback functions rerendered by props change
|
|
2399
|
+
*/
|
|
2400
|
+
const callbackRefs = useRef(rest);
|
|
2401
|
+
useEffect(() => {
|
|
2402
|
+
callbackRefs.current = rest;
|
|
2403
|
+
}, [rest]);
|
|
2404
|
+
const formValuesCallbackRefs = useRef({
|
|
2405
|
+
onData,
|
|
2406
|
+
onSubmit,
|
|
2407
|
+
onFormMount
|
|
2408
|
+
});
|
|
2409
|
+
useEffect(() => {
|
|
2410
|
+
formValuesCallbackRefs.current = {
|
|
2411
|
+
onData,
|
|
2412
|
+
onSubmit,
|
|
2413
|
+
onFormMount
|
|
2414
|
+
};
|
|
2415
|
+
}, [onData, onSubmit, onFormMount]);
|
|
2416
|
+
/**
|
|
2417
|
+
* handle function call after the debounce occurs on the form instance field event
|
|
2418
|
+
* subject in order to call the most updated function with the updated function
|
|
2419
|
+
* reference to avoid events get outdated values
|
|
2420
|
+
*/
|
|
2421
|
+
useEffect(() => {
|
|
2422
|
+
var _a;
|
|
2423
|
+
const callback = payload => {
|
|
2424
|
+
var _a, _b;
|
|
2425
|
+
const eventMapping = eventsMapping[payload.event];
|
|
2426
|
+
if (eventMapping && callbackRefs.current[eventMapping]) {
|
|
2427
|
+
(_b = (_a = callbackRefs.current)[eventMapping]) === null || _b === void 0 ? void 0 : _b.call(_a, payload);
|
|
2428
|
+
}
|
|
2429
|
+
};
|
|
2430
|
+
const sub = (_a = formGroupInstance.getForm({
|
|
2431
|
+
key: id
|
|
2432
|
+
})) === null || _a === void 0 ? void 0 : _a.subscribeFieldEvent({
|
|
2433
|
+
callback
|
|
2434
|
+
});
|
|
2435
|
+
return () => sub === null || sub === void 0 ? void 0 : sub.unsubscribe();
|
|
2436
|
+
}, []);
|
|
2437
|
+
useEffect(() => {
|
|
2438
|
+
var _a, _b, _c;
|
|
2439
|
+
const mountCallback = payload => {
|
|
2440
|
+
var _a, _b;
|
|
2441
|
+
if (formValuesCallbackRefs.current.onMount) {
|
|
2442
|
+
(_b = (_a = formValuesCallbackRefs.current).onFormMount) === null || _b === void 0 ? void 0 : _b.call(_a, payload);
|
|
2443
|
+
}
|
|
2444
|
+
};
|
|
2445
|
+
const mountSub = (_a = formGroupInstance.getForm({
|
|
2446
|
+
key: id
|
|
2447
|
+
})) === null || _a === void 0 ? void 0 : _a.subscribeOnMount(mountCallback);
|
|
2448
|
+
const dataCallback = payload => {
|
|
2449
|
+
var _a, _b;
|
|
2450
|
+
if (formValuesCallbackRefs.current.onData) {
|
|
2451
|
+
(_b = (_a = formValuesCallbackRefs.current).onData) === null || _b === void 0 ? void 0 : _b.call(_a, payload);
|
|
2452
|
+
}
|
|
2453
|
+
};
|
|
2454
|
+
const dataSub = (_b = formGroupInstance.getForm({
|
|
2455
|
+
key: id
|
|
2456
|
+
})) === null || _b === void 0 ? void 0 : _b.subscribeData(dataCallback);
|
|
2457
|
+
const submitCallback = payload => {
|
|
2458
|
+
var _a, _b;
|
|
2459
|
+
if (formValuesCallbackRefs.current.onSubmit) {
|
|
2460
|
+
(_b = (_a = formValuesCallbackRefs.current).onSubmit) === null || _b === void 0 ? void 0 : _b.call(_a, payload);
|
|
2461
|
+
}
|
|
2462
|
+
};
|
|
2463
|
+
const submitSub = (_c = formGroupInstance.getForm({
|
|
2464
|
+
key: id
|
|
2465
|
+
})) === null || _c === void 0 ? void 0 : _c.subscribeOnSubmit(submitCallback);
|
|
2466
|
+
return () => {
|
|
2467
|
+
mountSub === null || mountSub === void 0 ? void 0 : mountSub.unsubscribe();
|
|
2468
|
+
dataSub === null || dataSub === void 0 ? void 0 : dataSub.unsubscribe();
|
|
2469
|
+
submitSub === null || submitSub === void 0 ? void 0 : submitSub.unsubscribe();
|
|
2470
|
+
};
|
|
2471
|
+
}, []);
|
|
2472
|
+
return;
|
|
2473
|
+
}
|
|
2474
|
+
|
|
2475
|
+
/**
|
|
2476
|
+
*
|
|
2477
|
+
* @param {TFormProps} param form properties initializor
|
|
2478
|
+
* @returns {ReactElement}
|
|
2479
|
+
*/
|
|
2480
|
+
function Form({
|
|
1816
2481
|
schema,
|
|
1817
2482
|
index,
|
|
1818
2483
|
initialValues,
|
|
@@ -1820,18 +2485,30 @@ const Form = ({
|
|
|
1820
2485
|
action,
|
|
1821
2486
|
method,
|
|
1822
2487
|
onSubmit,
|
|
2488
|
+
onFormMount,
|
|
1823
2489
|
onData,
|
|
2490
|
+
onBlur,
|
|
2491
|
+
onChange,
|
|
2492
|
+
onApiResponse,
|
|
2493
|
+
onClick,
|
|
2494
|
+
onFocus,
|
|
2495
|
+
onKeyDown,
|
|
2496
|
+
onKeyUp,
|
|
2497
|
+
onMount,
|
|
1824
2498
|
children
|
|
1825
|
-
})
|
|
2499
|
+
}) {
|
|
1826
2500
|
const {
|
|
1827
2501
|
addForm,
|
|
1828
2502
|
removeForm,
|
|
1829
2503
|
getForm,
|
|
1830
2504
|
mappers,
|
|
1831
2505
|
debugMode
|
|
1832
|
-
} = useFormGroupContext();
|
|
2506
|
+
} = useFormGroupContext({});
|
|
1833
2507
|
const [tree, setTree] = useState();
|
|
1834
2508
|
const schemaIndex = useMemo(() => index || (schema === null || schema === void 0 ? void 0 : schema.index) || 'defaultChange', [index, schema]);
|
|
2509
|
+
/**
|
|
2510
|
+
* logic to initialize the form instance and it's removal
|
|
2511
|
+
*/
|
|
1835
2512
|
useEffect(() => {
|
|
1836
2513
|
if (schemaIndex === 'defaultChange') {
|
|
1837
2514
|
console.warn('please, add an unique id to the form, otherwise multiple forms will break');
|
|
@@ -1839,25 +2516,37 @@ const Form = ({
|
|
|
1839
2516
|
const formInstance = new FormCore({
|
|
1840
2517
|
schema,
|
|
1841
2518
|
initialValues: initialValues || (schema === null || schema === void 0 ? void 0 : schema.initialValues),
|
|
2519
|
+
iVars: iVars || (schema === null || schema === void 0 ? void 0 : schema.iVars),
|
|
1842
2520
|
action: action || (schema === null || schema === void 0 ? void 0 : schema.action),
|
|
1843
2521
|
method: method || (schema === null || schema === void 0 ? void 0 : schema.method),
|
|
1844
2522
|
index: schemaIndex,
|
|
1845
|
-
onSubmit,
|
|
1846
|
-
onData,
|
|
1847
2523
|
mappers
|
|
1848
2524
|
});
|
|
1849
2525
|
addForm({
|
|
1850
2526
|
key: schemaIndex,
|
|
1851
2527
|
formInstance
|
|
1852
2528
|
});
|
|
2529
|
+
let subMounted;
|
|
2530
|
+
if (onFormMount) {
|
|
2531
|
+
subMounted = formInstance.subscribeOnMount(onFormMount);
|
|
2532
|
+
}
|
|
2533
|
+
formInstance === null || formInstance === void 0 ? void 0 : formInstance.mounted();
|
|
1853
2534
|
/*
|
|
1854
2535
|
@TODO check if form instance is killed each time it is unmounted
|
|
1855
2536
|
the management of multiple forms needs to be planned
|
|
1856
2537
|
*/
|
|
1857
|
-
return () =>
|
|
1858
|
-
|
|
1859
|
-
|
|
2538
|
+
return () => {
|
|
2539
|
+
subMounted === null || subMounted === void 0 ? void 0 : subMounted.unsubscribe();
|
|
2540
|
+
removeForm({
|
|
2541
|
+
key: schemaIndex
|
|
2542
|
+
});
|
|
2543
|
+
};
|
|
1860
2544
|
}, []);
|
|
2545
|
+
/**
|
|
2546
|
+
* logic to transform AsFormFields onto JSON schema
|
|
2547
|
+
* and JSON schema onto FieldWrappers, refreshes when
|
|
2548
|
+
* the react tree changes it's children
|
|
2549
|
+
*/
|
|
1861
2550
|
useEffect(() => {
|
|
1862
2551
|
var _a;
|
|
1863
2552
|
const schema = BuildAsFormFieldTree({
|
|
@@ -1872,16 +2561,53 @@ const Form = ({
|
|
|
1872
2561
|
if (fields) {
|
|
1873
2562
|
const buildTree = BuildTree({
|
|
1874
2563
|
fields,
|
|
1875
|
-
|
|
2564
|
+
formIndex: index
|
|
1876
2565
|
});
|
|
1877
2566
|
setTree(buildTree);
|
|
1878
2567
|
}
|
|
1879
2568
|
}, [children]);
|
|
2569
|
+
/**
|
|
2570
|
+
* iVars change tracker to update iVars onto form instance
|
|
2571
|
+
*/
|
|
1880
2572
|
useEffect(() => {
|
|
1881
2573
|
if (iVars) getForm({
|
|
1882
|
-
key:
|
|
2574
|
+
key: schemaIndex
|
|
1883
2575
|
}).iVars = iVars;
|
|
1884
2576
|
}, [iVars]);
|
|
2577
|
+
/**
|
|
2578
|
+
* initialValues setter for async initialValues
|
|
2579
|
+
*/
|
|
2580
|
+
useEffect(() => {
|
|
2581
|
+
const form = getForm({
|
|
2582
|
+
key: schemaIndex
|
|
2583
|
+
});
|
|
2584
|
+
if (initialValues && form) {
|
|
2585
|
+
Object.keys(initialValues).forEach(fieldName => {
|
|
2586
|
+
var _a;
|
|
2587
|
+
(_a = form.fields.get(fieldName)) === null || _a === void 0 ? void 0 : _a.emitValue({
|
|
2588
|
+
event: 'ON_FIELD_MOUNT',
|
|
2589
|
+
value: initialValues[fieldName]
|
|
2590
|
+
});
|
|
2591
|
+
});
|
|
2592
|
+
}
|
|
2593
|
+
}, [initialValues]);
|
|
2594
|
+
/**
|
|
2595
|
+
* hook usage to keep event bindings updated on callback functions passed as props
|
|
2596
|
+
*/
|
|
2597
|
+
useForm({
|
|
2598
|
+
id: schemaIndex,
|
|
2599
|
+
onApiResponse,
|
|
2600
|
+
onBlur,
|
|
2601
|
+
onChange,
|
|
2602
|
+
onClick,
|
|
2603
|
+
onFocus,
|
|
2604
|
+
onKeyDown,
|
|
2605
|
+
onKeyUp,
|
|
2606
|
+
onMount,
|
|
2607
|
+
onSubmit,
|
|
2608
|
+
onFormMount,
|
|
2609
|
+
onData
|
|
2610
|
+
});
|
|
1885
2611
|
/*
|
|
1886
2612
|
@TODO move this logic inside form-core, add action and method onto form element,
|
|
1887
2613
|
might need a ref of the form to collect all the form parameters when there is a
|
|
@@ -1909,26 +2635,426 @@ const Form = ({
|
|
|
1909
2635
|
key: schemaIndex
|
|
1910
2636
|
})),
|
|
1911
2637
|
children: "print form instance"
|
|
2638
|
+
}), jsx("button", {
|
|
2639
|
+
onClick: () => {
|
|
2640
|
+
var _a;
|
|
2641
|
+
return console.log((_a = getForm({
|
|
2642
|
+
key: schemaIndex
|
|
2643
|
+
})) === null || _a === void 0 ? void 0 : _a.getFormValues());
|
|
2644
|
+
},
|
|
2645
|
+
children: "print form values"
|
|
1912
2646
|
}), jsx("button", {
|
|
1913
2647
|
onClick: () => {
|
|
1914
2648
|
var _a;
|
|
1915
2649
|
return (_a = getForm({
|
|
1916
2650
|
key: schemaIndex
|
|
1917
|
-
})) === null || _a === void 0 ? void 0 : _a.
|
|
2651
|
+
})) === null || _a === void 0 ? void 0 : _a.submit();
|
|
1918
2652
|
},
|
|
1919
|
-
children: "
|
|
2653
|
+
children: "try submit"
|
|
1920
2654
|
}), jsx("br", {}), jsx("hr", {})]
|
|
1921
2655
|
}), jsx("form", {
|
|
1922
2656
|
onSubmit: handleSubmit,
|
|
1923
2657
|
children: tree && tree
|
|
1924
2658
|
})]
|
|
1925
2659
|
});
|
|
1926
|
-
}
|
|
2660
|
+
}
|
|
1927
2661
|
|
|
2662
|
+
/**
|
|
2663
|
+
* Component wrapper to aid building schemas with react without writting a JSON schema
|
|
2664
|
+
* along with BuildAsFormFieldTree inside a Form component, FieldWrapper gets this props
|
|
2665
|
+
* to build the component as it does with a JSON schema, this component only works inside
|
|
2666
|
+
* the Form component
|
|
2667
|
+
*
|
|
2668
|
+
* @param {TAsFormFieldProps} props JSON schema props
|
|
2669
|
+
* @returns {ReactNode}
|
|
2670
|
+
*/
|
|
1928
2671
|
const AsFormField = props => {
|
|
1929
|
-
return
|
|
1930
|
-
|
|
1931
|
-
|
|
2672
|
+
return props.children;
|
|
2673
|
+
};
|
|
2674
|
+
|
|
2675
|
+
var fails$2 = fails$h;
|
|
2676
|
+
var global$3 = global$e;
|
|
2677
|
+
|
|
2678
|
+
// babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
|
|
2679
|
+
var $RegExp$2 = global$3.RegExp;
|
|
2680
|
+
|
|
2681
|
+
var UNSUPPORTED_Y$1 = fails$2(function () {
|
|
2682
|
+
var re = $RegExp$2('a', 'y');
|
|
2683
|
+
re.lastIndex = 2;
|
|
2684
|
+
return re.exec('abcd') !== null;
|
|
2685
|
+
});
|
|
2686
|
+
|
|
2687
|
+
// UC Browser bug
|
|
2688
|
+
// https://github.com/zloirock/core-js/issues/1008
|
|
2689
|
+
var MISSED_STICKY = UNSUPPORTED_Y$1 || fails$2(function () {
|
|
2690
|
+
return !$RegExp$2('a', 'y').sticky;
|
|
2691
|
+
});
|
|
2692
|
+
|
|
2693
|
+
var BROKEN_CARET = UNSUPPORTED_Y$1 || fails$2(function () {
|
|
2694
|
+
// https://bugzilla.mozilla.org/show_bug.cgi?id=773687
|
|
2695
|
+
var re = $RegExp$2('^r', 'gy');
|
|
2696
|
+
re.lastIndex = 2;
|
|
2697
|
+
return re.exec('str') !== null;
|
|
2698
|
+
});
|
|
2699
|
+
|
|
2700
|
+
var regexpStickyHelpers = {
|
|
2701
|
+
BROKEN_CARET: BROKEN_CARET,
|
|
2702
|
+
MISSED_STICKY: MISSED_STICKY,
|
|
2703
|
+
UNSUPPORTED_Y: UNSUPPORTED_Y$1
|
|
2704
|
+
};
|
|
2705
|
+
|
|
2706
|
+
var fails$1 = fails$h;
|
|
2707
|
+
var global$2 = global$e;
|
|
2708
|
+
|
|
2709
|
+
// babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError
|
|
2710
|
+
var $RegExp$1 = global$2.RegExp;
|
|
2711
|
+
|
|
2712
|
+
var regexpUnsupportedDotAll = fails$1(function () {
|
|
2713
|
+
var re = $RegExp$1('.', 's');
|
|
2714
|
+
return !(re.dotAll && re.test('\n') && re.flags === 's');
|
|
2715
|
+
});
|
|
2716
|
+
|
|
2717
|
+
var fails = fails$h;
|
|
2718
|
+
var global$1 = global$e;
|
|
2719
|
+
|
|
2720
|
+
// babel-minify and Closure Compiler transpiles RegExp('(?<a>b)', 'g') -> /(?<a>b)/g and it causes SyntaxError
|
|
2721
|
+
var $RegExp = global$1.RegExp;
|
|
2722
|
+
|
|
2723
|
+
var regexpUnsupportedNcg = fails(function () {
|
|
2724
|
+
var re = $RegExp('(?<a>b)', 'g');
|
|
2725
|
+
return re.exec('b').groups.a !== 'b' ||
|
|
2726
|
+
'b'.replace(re, '$<a>c') !== 'bc';
|
|
2727
|
+
});
|
|
2728
|
+
|
|
2729
|
+
/* eslint-disable regexp/no-empty-capturing-group, regexp/no-empty-group, regexp/no-lazy-ends -- testing */
|
|
2730
|
+
/* eslint-disable regexp/no-useless-quantifier -- testing */
|
|
2731
|
+
var call = functionCall;
|
|
2732
|
+
var uncurryThis = functionUncurryThis;
|
|
2733
|
+
var toString = toString$3;
|
|
2734
|
+
var regexpFlags = regexpFlags$1;
|
|
2735
|
+
var stickyHelpers = regexpStickyHelpers;
|
|
2736
|
+
var shared = shared$4;
|
|
2737
|
+
var create = objectCreate;
|
|
2738
|
+
var getInternalState = internalState.get;
|
|
2739
|
+
var UNSUPPORTED_DOT_ALL = regexpUnsupportedDotAll;
|
|
2740
|
+
var UNSUPPORTED_NCG = regexpUnsupportedNcg;
|
|
2741
|
+
|
|
2742
|
+
var nativeReplace = shared('native-string-replace', String.prototype.replace);
|
|
2743
|
+
var nativeExec = RegExp.prototype.exec;
|
|
2744
|
+
var patchedExec = nativeExec;
|
|
2745
|
+
var charAt = uncurryThis(''.charAt);
|
|
2746
|
+
var indexOf = uncurryThis(''.indexOf);
|
|
2747
|
+
var replace = uncurryThis(''.replace);
|
|
2748
|
+
var stringSlice = uncurryThis(''.slice);
|
|
2749
|
+
|
|
2750
|
+
var UPDATES_LAST_INDEX_WRONG = (function () {
|
|
2751
|
+
var re1 = /a/;
|
|
2752
|
+
var re2 = /b*/g;
|
|
2753
|
+
call(nativeExec, re1, 'a');
|
|
2754
|
+
call(nativeExec, re2, 'a');
|
|
2755
|
+
return re1.lastIndex !== 0 || re2.lastIndex !== 0;
|
|
2756
|
+
})();
|
|
2757
|
+
|
|
2758
|
+
var UNSUPPORTED_Y = stickyHelpers.BROKEN_CARET;
|
|
2759
|
+
|
|
2760
|
+
// nonparticipating capturing group, copied from es5-shim's String#split patch.
|
|
2761
|
+
var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
|
|
2762
|
+
|
|
2763
|
+
var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y || UNSUPPORTED_DOT_ALL || UNSUPPORTED_NCG;
|
|
2764
|
+
|
|
2765
|
+
if (PATCH) {
|
|
2766
|
+
patchedExec = function exec(string) {
|
|
2767
|
+
var re = this;
|
|
2768
|
+
var state = getInternalState(re);
|
|
2769
|
+
var str = toString(string);
|
|
2770
|
+
var raw = state.raw;
|
|
2771
|
+
var result, reCopy, lastIndex, match, i, object, group;
|
|
2772
|
+
|
|
2773
|
+
if (raw) {
|
|
2774
|
+
raw.lastIndex = re.lastIndex;
|
|
2775
|
+
result = call(patchedExec, raw, str);
|
|
2776
|
+
re.lastIndex = raw.lastIndex;
|
|
2777
|
+
return result;
|
|
2778
|
+
}
|
|
2779
|
+
|
|
2780
|
+
var groups = state.groups;
|
|
2781
|
+
var sticky = UNSUPPORTED_Y && re.sticky;
|
|
2782
|
+
var flags = call(regexpFlags, re);
|
|
2783
|
+
var source = re.source;
|
|
2784
|
+
var charsAdded = 0;
|
|
2785
|
+
var strCopy = str;
|
|
2786
|
+
|
|
2787
|
+
if (sticky) {
|
|
2788
|
+
flags = replace(flags, 'y', '');
|
|
2789
|
+
if (indexOf(flags, 'g') === -1) {
|
|
2790
|
+
flags += 'g';
|
|
2791
|
+
}
|
|
2792
|
+
|
|
2793
|
+
strCopy = stringSlice(str, re.lastIndex);
|
|
2794
|
+
// Support anchored sticky behavior.
|
|
2795
|
+
if (re.lastIndex > 0 && (!re.multiline || re.multiline && charAt(str, re.lastIndex - 1) !== '\n')) {
|
|
2796
|
+
source = '(?: ' + source + ')';
|
|
2797
|
+
strCopy = ' ' + strCopy;
|
|
2798
|
+
charsAdded++;
|
|
2799
|
+
}
|
|
2800
|
+
// ^(? + rx + ) is needed, in combination with some str slicing, to
|
|
2801
|
+
// simulate the 'y' flag.
|
|
2802
|
+
reCopy = new RegExp('^(?:' + source + ')', flags);
|
|
2803
|
+
}
|
|
2804
|
+
|
|
2805
|
+
if (NPCG_INCLUDED) {
|
|
2806
|
+
reCopy = new RegExp('^' + source + '$(?!\\s)', flags);
|
|
2807
|
+
}
|
|
2808
|
+
if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
|
|
2809
|
+
|
|
2810
|
+
match = call(nativeExec, sticky ? reCopy : re, strCopy);
|
|
2811
|
+
|
|
2812
|
+
if (sticky) {
|
|
2813
|
+
if (match) {
|
|
2814
|
+
match.input = stringSlice(match.input, charsAdded);
|
|
2815
|
+
match[0] = stringSlice(match[0], charsAdded);
|
|
2816
|
+
match.index = re.lastIndex;
|
|
2817
|
+
re.lastIndex += match[0].length;
|
|
2818
|
+
} else re.lastIndex = 0;
|
|
2819
|
+
} else if (UPDATES_LAST_INDEX_WRONG && match) {
|
|
2820
|
+
re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
|
|
2821
|
+
}
|
|
2822
|
+
if (NPCG_INCLUDED && match && match.length > 1) {
|
|
2823
|
+
// Fix browsers whose `exec` methods don't consistently return `undefined`
|
|
2824
|
+
// for NPCG, like IE8. NOTE: This doesn't work for /(.?)?/
|
|
2825
|
+
call(nativeReplace, match[0], reCopy, function () {
|
|
2826
|
+
for (i = 1; i < arguments.length - 2; i++) {
|
|
2827
|
+
if (arguments[i] === undefined) match[i] = undefined;
|
|
2828
|
+
}
|
|
2829
|
+
});
|
|
2830
|
+
}
|
|
2831
|
+
|
|
2832
|
+
if (match && groups) {
|
|
2833
|
+
match.groups = object = create(null);
|
|
2834
|
+
for (i = 0; i < groups.length; i++) {
|
|
2835
|
+
group = groups[i];
|
|
2836
|
+
object[group[0]] = match[group[1]];
|
|
2837
|
+
}
|
|
2838
|
+
}
|
|
2839
|
+
|
|
2840
|
+
return match;
|
|
2841
|
+
};
|
|
2842
|
+
}
|
|
2843
|
+
|
|
2844
|
+
var regexpExec = patchedExec;
|
|
2845
|
+
|
|
2846
|
+
var $ = _export;
|
|
2847
|
+
var exec = regexpExec;
|
|
2848
|
+
|
|
2849
|
+
// `RegExp.prototype.exec` method
|
|
2850
|
+
// https://tc39.es/ecma262/#sec-regexp.prototype.exec
|
|
2851
|
+
$({ target: 'RegExp', proto: true, forced: /./.exec !== exec }, {
|
|
2852
|
+
exec: exec
|
|
2853
|
+
});
|
|
2854
|
+
|
|
2855
|
+
/**
|
|
2856
|
+
* Component Wrapper to render form fields without the Form component, gets additional formId and mapper since
|
|
2857
|
+
* it won't rely on them and needs to be manually declared
|
|
2858
|
+
*
|
|
2859
|
+
* @param {TAsFormFieldBuilderProps} props JSON schema props along with FieldWrapper props and mapper props
|
|
2860
|
+
* @returns {ReactElement}
|
|
2861
|
+
*/
|
|
2862
|
+
const AsFormFieldBuilder = props => {
|
|
2863
|
+
var _a, _b;
|
|
2864
|
+
const context = useFormGroupContext({});
|
|
2865
|
+
/**
|
|
2866
|
+
* state to track the field instance creation process
|
|
2867
|
+
*/
|
|
2868
|
+
const [mounted, setMounted] = useState(false);
|
|
2869
|
+
/**
|
|
2870
|
+
* initializer to create or add a form instance to the formGroup by it's formId
|
|
2871
|
+
* and add the field to the form instance
|
|
2872
|
+
* Also has the logic to remove it once this element is removed
|
|
2873
|
+
*/
|
|
2874
|
+
useEffect(() => {
|
|
2875
|
+
var _a, _b, _c, _d;
|
|
2876
|
+
if (!((_a = context.formGroupInstance) === null || _a === void 0 ? void 0 : _a.forms.has(props.formIndex))) {
|
|
2877
|
+
context.addFormWithIndex(props.formIndex);
|
|
2878
|
+
}
|
|
2879
|
+
const fieldSchema = Object.assign(Object.assign({}, props), {
|
|
2880
|
+
component: props.mapper.componentName,
|
|
2881
|
+
children: undefined
|
|
2882
|
+
});
|
|
2883
|
+
const formInstance = context.formGroupInstance.forms.get(props.formIndex);
|
|
2884
|
+
formInstance === null || formInstance === void 0 ? void 0 : formInstance.addField({
|
|
2885
|
+
fieldSchema,
|
|
2886
|
+
mapperElement: props.mapper
|
|
2887
|
+
});
|
|
2888
|
+
const field = formInstance === null || formInstance === void 0 ? void 0 : formInstance.getField({
|
|
2889
|
+
key: props.name
|
|
2890
|
+
});
|
|
2891
|
+
/* This line is only for scenario that we have value by the component props */
|
|
2892
|
+
if (((_b = props.mapper.events) === null || _b === void 0 ? void 0 : _b.setValue) && props.props) {
|
|
2893
|
+
field === null || field === void 0 ? void 0 : field.emitValue({
|
|
2894
|
+
value: props.props[props.mapper.events.setValue],
|
|
2895
|
+
event: 'ON_FIELD_MOUNT'
|
|
2896
|
+
});
|
|
2897
|
+
}
|
|
2898
|
+
/* This line is only for scenario that we have value by the instanced form (initialValues) */
|
|
2899
|
+
if ((_c = formInstance === null || formInstance === void 0 ? void 0 : formInstance.initialValues) === null || _c === void 0 ? void 0 : _c[props.nameToSubmit || props.name]) {
|
|
2900
|
+
field === null || field === void 0 ? void 0 : field.emitValue({
|
|
2901
|
+
value: (_d = formInstance.initialValues) === null || _d === void 0 ? void 0 : _d[props.nameToSubmit || props.name],
|
|
2902
|
+
event: 'ON_FIELD_MOUNT'
|
|
2903
|
+
});
|
|
2904
|
+
}
|
|
2905
|
+
if (typeof (props === null || props === void 0 ? void 0 : props.visibility) !== 'undefined' && field) {
|
|
2906
|
+
field.visibility = props.visibility;
|
|
2907
|
+
}
|
|
2908
|
+
setMounted(true);
|
|
2909
|
+
return () => formInstance === null || formInstance === void 0 ? void 0 : formInstance.removeField({
|
|
2910
|
+
key: props.name
|
|
2911
|
+
});
|
|
2912
|
+
}, []);
|
|
2913
|
+
/**
|
|
2914
|
+
* expensive function to allow both external props and templating work
|
|
2915
|
+
* evaluate if templating will be done onto form-engine or not
|
|
2916
|
+
*/
|
|
2917
|
+
useEffect(() => {
|
|
2918
|
+
var _a;
|
|
2919
|
+
if (!mounted) return;
|
|
2920
|
+
const field = (_a = context.formGroupInstance.forms.get(props.formIndex)) === null || _a === void 0 ? void 0 : _a.fields.get(props.name);
|
|
2921
|
+
const fieldProps = field === null || field === void 0 ? void 0 : field.props;
|
|
2922
|
+
if (props.props) {
|
|
2923
|
+
Object.keys(props.props).forEach(propKey => {
|
|
2924
|
+
var _a, _b;
|
|
2925
|
+
if (typeof ((_a = props.props) === null || _a === void 0 ? void 0 : _a[propKey]) === 'string' &&
|
|
2926
|
+
/**
|
|
2927
|
+
* need to check linting on build, this needs to be casted in order to build..
|
|
2928
|
+
*/
|
|
2929
|
+
/\$/.test((_b = props.props) === null || _b === void 0 ? void 0 : _b[propKey])) {
|
|
2930
|
+
delete props.props[propKey];
|
|
2931
|
+
}
|
|
2932
|
+
});
|
|
2933
|
+
}
|
|
2934
|
+
field === null || field === void 0 ? void 0 : field.propsSubject$.next(Object.assign(Object.assign({}, fieldProps), props.props));
|
|
2935
|
+
}, [props.props]);
|
|
2936
|
+
/**
|
|
2937
|
+
* allows to control field selected value on each event
|
|
2938
|
+
*/
|
|
2939
|
+
useEffect(() => {
|
|
2940
|
+
var _a;
|
|
2941
|
+
if (!props.onSelected) return;
|
|
2942
|
+
const callback = payload => {
|
|
2943
|
+
if (props.onSelected) {
|
|
2944
|
+
props.onSelected(payload);
|
|
2945
|
+
}
|
|
2946
|
+
};
|
|
2947
|
+
const sub = (_a = context.formGroupInstance.forms.get(props.formIndex)) === null || _a === void 0 ? void 0 : _a.subscribeFieldEvent({
|
|
2948
|
+
callback
|
|
2949
|
+
});
|
|
2950
|
+
return () => sub === null || sub === void 0 ? void 0 : sub.unsubscribe();
|
|
2951
|
+
}, [props.onSelected]);
|
|
2952
|
+
/**
|
|
2953
|
+
* allows to control field visibility as a controlled component
|
|
2954
|
+
*/
|
|
2955
|
+
useEffect(() => {
|
|
2956
|
+
var _a;
|
|
2957
|
+
if (!mounted) return;
|
|
2958
|
+
const field = (_a = context.formGroupInstance.forms.get(props.formIndex)) === null || _a === void 0 ? void 0 : _a.fields.get(props.name);
|
|
2959
|
+
if (typeof (props === null || props === void 0 ? void 0 : props.visibility) !== 'undefined' && field) {
|
|
2960
|
+
field.visibility = props.visibility;
|
|
2961
|
+
}
|
|
2962
|
+
}, [mounted, props.visibility]);
|
|
2963
|
+
/**
|
|
2964
|
+
* allows to control field value as a controlled component
|
|
2965
|
+
*/
|
|
2966
|
+
useEffect(() => {
|
|
2967
|
+
var _a, _b, _c, _d;
|
|
2968
|
+
if (!mounted) return;
|
|
2969
|
+
const field = (_a = context.formGroupInstance.forms.get(props.formIndex)) === null || _a === void 0 ? void 0 : _a.fields.get(props.name);
|
|
2970
|
+
if (((_b = props.mapper.events) === null || _b === void 0 ? void 0 : _b.setValue) && ((_c = props.props) === null || _c === void 0 ? void 0 : _c[props.mapper.events.setValue]) && field) {
|
|
2971
|
+
field === null || field === void 0 ? void 0 : field.emitValue({
|
|
2972
|
+
value: (_d = props.props) === null || _d === void 0 ? void 0 : _d[props.mapper.events.setValue],
|
|
2973
|
+
event: 'ON_FIELD_CHANGE'
|
|
2974
|
+
});
|
|
2975
|
+
}
|
|
2976
|
+
}, [mounted, (_a = props.props) === null || _a === void 0 ? void 0 : _a[((_b = props.mapper.events) === null || _b === void 0 ? void 0 : _b.setValue) || 'value']]);
|
|
2977
|
+
return mounted ? jsx(FieldWrapper, {
|
|
2978
|
+
formIndex: props.formIndex,
|
|
2979
|
+
name: props.name,
|
|
2980
|
+
props: props.props,
|
|
2981
|
+
context: !context.active ? context : null,
|
|
2982
|
+
children: props.children && props.children
|
|
2983
|
+
}) : jsx(Fragment, {});
|
|
2984
|
+
};
|
|
2985
|
+
|
|
2986
|
+
// @TODO implement onSubmitGroup
|
|
2987
|
+
const useFormGroup = ({
|
|
2988
|
+
ids,
|
|
2989
|
+
onData
|
|
2990
|
+
// onSubmit,
|
|
2991
|
+
}) => {
|
|
2992
|
+
const {
|
|
2993
|
+
formGroupInstance
|
|
2994
|
+
} = useFormGroupContext({});
|
|
2995
|
+
const onDataCallbackRef = useRef(onData);
|
|
2996
|
+
// const onSubmitCallbackRef = useRef(onSubmit);
|
|
2997
|
+
useEffect(() => {
|
|
2998
|
+
onDataCallbackRef.current = onData;
|
|
2999
|
+
}, [onData]);
|
|
3000
|
+
// useEffect(() => {
|
|
3001
|
+
// onSubmitCallbackRef.current = onSubmit;
|
|
3002
|
+
// }, [onSubmit]);
|
|
3003
|
+
useEffect(() => {
|
|
3004
|
+
const onDataCallback = payload => {
|
|
3005
|
+
var _a;
|
|
3006
|
+
if (onDataCallbackRef.current) {
|
|
3007
|
+
(_a = onDataCallbackRef.current) === null || _a === void 0 ? void 0 : _a.call(onDataCallbackRef, payload);
|
|
3008
|
+
}
|
|
3009
|
+
};
|
|
3010
|
+
const onDataSub = formGroupInstance.onDataSubscription({
|
|
3011
|
+
ids,
|
|
3012
|
+
callback: onDataCallback
|
|
3013
|
+
});
|
|
3014
|
+
// const onSubmitCallback = (
|
|
3015
|
+
// payload: TFormValues<Record<string, unknown>>
|
|
3016
|
+
// ) => {
|
|
3017
|
+
// if (onSubmitCallbackRef.current) {
|
|
3018
|
+
// onSubmitCallbackRef.current?.(payload);
|
|
3019
|
+
// }
|
|
3020
|
+
// };
|
|
3021
|
+
return () => {
|
|
3022
|
+
onDataSub.unsubscribe();
|
|
3023
|
+
};
|
|
3024
|
+
}, []);
|
|
3025
|
+
return;
|
|
3026
|
+
};
|
|
3027
|
+
|
|
3028
|
+
const defaultChangeEvent = event => {
|
|
3029
|
+
return event.currentTarget.value;
|
|
3030
|
+
};
|
|
3031
|
+
const checkedChangeEvent = event => {
|
|
3032
|
+
return event.currentTarget.checked;
|
|
3033
|
+
};
|
|
3034
|
+
const valueChangeEvent = event => {
|
|
3035
|
+
return event.target.value;
|
|
3036
|
+
};
|
|
3037
|
+
const datepickerChangeEvent = event => event;
|
|
3038
|
+
const dropdownChangeEvent = (event, opts) => {
|
|
3039
|
+
if (typeof event === 'object' && event !== null && 'value' in event && 'id' in event) {
|
|
3040
|
+
return {
|
|
3041
|
+
_value: event === null || event === void 0 ? void 0 : event.id,
|
|
3042
|
+
_metadata: event
|
|
3043
|
+
};
|
|
3044
|
+
} else if (typeof event === 'string' && typeof opts === 'object' && 'props' in opts && typeof opts.props === 'object' && 'optionList' in opts.props && Array.isArray(opts.props.optionList)) {
|
|
3045
|
+
const option = opts.props.optionList.find(el => el.value === event);
|
|
3046
|
+
if (option) {
|
|
3047
|
+
return {
|
|
3048
|
+
_value: option.id,
|
|
3049
|
+
_metadata: option
|
|
3050
|
+
};
|
|
3051
|
+
} else {
|
|
3052
|
+
return {
|
|
3053
|
+
_value: event,
|
|
3054
|
+
_metadata: event
|
|
3055
|
+
};
|
|
3056
|
+
}
|
|
3057
|
+
}
|
|
1932
3058
|
};
|
|
1933
3059
|
|
|
1934
|
-
export { AsFormField, Form, FormGroupContext, FormGroupContextProvider, useFormGroupContext };
|
|
3060
|
+
export { AsFormField, AsFormFieldBuilder, Form, FormGroupContext, FormGroupContextProvider, checkedChangeEvent, datepickerChangeEvent, defaultChangeEvent, dropdownChangeEvent, useForm, useFormGroup, useFormGroupContext, valueChangeEvent };
|