@abgov/jsonforms-components 0.0.1 → 1.2.0
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/index.esm.d.ts +1 -0
- package/index.esm.js +4831 -0
- package/package.json +8 -2
- package/src/index.d.ts +5 -0
- package/src/lib/Additional/HelpContent.d.ts +21 -0
- package/src/lib/Additional/styled-components.d.ts +1 -0
- package/src/lib/Cells/DateCell.d.ts +6 -0
- package/src/lib/Cells/IntegerCell.d.ts +6 -0
- package/src/lib/Cells/NumberCell.d.ts +6 -0
- package/src/lib/Cells/TextCell.d.ts +6 -0
- package/src/lib/Cells/TimeCell.d.ts +6 -0
- package/src/lib/Cells/index.d.ts +2 -0
- package/src/lib/Context/index.d.ts +39 -0
- package/src/lib/Controls/FileUploader/ContextMenu.d.ts +18 -0
- package/src/lib/Controls/FileUploader/FileUploaderControl.d.ts +4 -0
- package/src/lib/Controls/FileUploader/FileUploaderTester.d.ts +2 -0
- package/src/lib/Controls/FileUploader/styled-components.d.ts +1 -0
- package/src/lib/Controls/FormStepper/FormStepperControl.d.ts +14 -0
- package/src/lib/Controls/FormStepper/FormStepperTester.d.ts +2 -0
- package/src/lib/Controls/FormStepper/styled-components.d.ts +7 -0
- package/src/lib/Controls/Inputs/InputBaseControl.d.ts +7 -0
- package/src/lib/Controls/Inputs/InputBooleanControl.d.ts +6 -0
- package/src/lib/Controls/Inputs/InputBooleanRadioControl.d.ts +6 -0
- package/src/lib/Controls/Inputs/InputDateControl.d.ts +9 -0
- package/src/lib/Controls/Inputs/InputDateTimeControl.d.ts +9 -0
- package/src/lib/Controls/Inputs/InputEnum.d.ts +12 -0
- package/src/lib/Controls/Inputs/InputEnumAutoComplete.d.ts +10 -0
- package/src/lib/Controls/Inputs/InputEnumRadios.d.ts +12 -0
- package/src/lib/Controls/Inputs/InputIntegerControl.d.ts +9 -0
- package/src/lib/Controls/Inputs/InputMultiLineTextControl.d.ts +9 -0
- package/src/lib/Controls/Inputs/InputNumberControl.d.ts +9 -0
- package/src/lib/Controls/Inputs/InputTextControl.d.ts +9 -0
- package/src/lib/Controls/Inputs/InputTimeControl.d.ts +9 -0
- package/src/lib/Controls/Inputs/{type.ts → type.d.ts} +1 -1
- package/src/lib/Controls/ObjectArray/DeleteDialog.d.ts +12 -0
- package/src/lib/Controls/ObjectArray/ObjectArray.d.ts +6 -0
- package/src/lib/Controls/ObjectArray/ObjectArrayToolBar.d.ts +16 -0
- package/src/lib/Controls/ObjectArray/ObjectListControl.d.ts +24 -0
- package/src/lib/Controls/ObjectArray/styled-components.d.ts +3 -0
- package/src/lib/ErrorHandling/GoAErrorControl.d.ts +15 -0
- package/src/lib/ErrorHandling/{MessageControl.tsx → MessageControl.d.ts} +1 -8
- package/src/lib/ErrorHandling/errorCheck.d.ts +14 -0
- package/src/lib/ErrorHandling/schemaValidation.d.ts +11 -0
- package/src/lib/common/Grid.d.ts +11 -0
- package/src/lib/jsonforms-components.d.ts +4 -0
- package/src/lib/layouts/GroupControl.d.ts +5 -0
- package/src/lib/layouts/HorizontalLayoutControl.d.ts +5 -0
- package/src/lib/layouts/VerticalLayoutControl.d.ts +4 -0
- package/src/lib/util/layout.d.ts +8 -0
- package/src/lib/util/schemaUtils.d.ts +1 -0
- package/src/lib/util/stringUtils.d.ts +33 -0
- package/src/lib/util/style-component.d.ts +1 -0
- package/.babelrc +0 -12
- package/.eslintrc.json +0 -36
- package/.releaserc.json +0 -25
- package/jest.config.ts +0 -11
- package/project.json +0 -55
- package/rollup.config.js +0 -14
- package/src/index.ts +0 -166
- package/src/lib/Additional/HelpContent.tsx +0 -95
- package/src/lib/Additional/styled-components.ts +0 -27
- package/src/lib/Cells/DateCell.tsx +0 -10
- package/src/lib/Cells/IntegerCell.tsx +0 -10
- package/src/lib/Cells/NumberCell.tsx +0 -10
- package/src/lib/Cells/TextCell.tsx +0 -10
- package/src/lib/Cells/TimeCell.tsx +0 -10
- package/src/lib/Cells/index.tsx +0 -14
- package/src/lib/Context/index.tsx +0 -172
- package/src/lib/Controls/FileUploader/ContextMenu.tsx +0 -50
- package/src/lib/Controls/FileUploader/FileUploaderControl.tsx +0 -131
- package/src/lib/Controls/FileUploader/FileUploaderTester.tsx +0 -3
- package/src/lib/Controls/FileUploader/styled-components.tsx +0 -10
- package/src/lib/Controls/FormStepper/FormStepperControl.tsx +0 -269
- package/src/lib/Controls/FormStepper/FormStepperTester.tsx +0 -22
- package/src/lib/Controls/FormStepper/styled-components.tsx +0 -17
- package/src/lib/Controls/Inputs/InputBaseControl.tsx +0 -52
- package/src/lib/Controls/Inputs/InputBooleanControl.tsx +0 -67
- package/src/lib/Controls/Inputs/InputBooleanRadioControl.tsx +0 -74
- package/src/lib/Controls/Inputs/InputDateControl.tsx +0 -90
- package/src/lib/Controls/Inputs/InputDateTimeControl.tsx +0 -46
- package/src/lib/Controls/Inputs/InputEnum.tsx +0 -74
- package/src/lib/Controls/Inputs/InputEnumAutoComplete.tsx +0 -73
- package/src/lib/Controls/Inputs/InputEnumRadios.tsx +0 -43
- package/src/lib/Controls/Inputs/InputIntegerControl.tsx +0 -63
- package/src/lib/Controls/Inputs/InputMultiLineTextControl.tsx +0 -63
- package/src/lib/Controls/Inputs/InputNumberControl.tsx +0 -63
- package/src/lib/Controls/Inputs/InputTextControl.tsx +0 -62
- package/src/lib/Controls/Inputs/InputTimeControl.tsx +0 -46
- package/src/lib/Controls/Inputs/inputControl.spec.ts +0 -84
- package/src/lib/Controls/ObjectArray/DeleteDialog.tsx +0 -49
- package/src/lib/Controls/ObjectArray/ObjectArray.tsx +0 -59
- package/src/lib/Controls/ObjectArray/ObjectArrayToolBar.tsx +0 -51
- package/src/lib/Controls/ObjectArray/ObjectListControl.tsx +0 -368
- package/src/lib/Controls/ObjectArray/styled-components.tsx +0 -13
- package/src/lib/ErrorHandling/GoAErrorControl.tsx +0 -53
- package/src/lib/ErrorHandling/categorizationValidation.spec.ts +0 -98
- package/src/lib/ErrorHandling/controlValildation.spec.ts +0 -57
- package/src/lib/ErrorHandling/errorCheck.spec.ts +0 -185
- package/src/lib/ErrorHandling/errorCheck.tsx +0 -86
- package/src/lib/ErrorHandling/layoutValildation.spec.ts +0 -47
- package/src/lib/ErrorHandling/otherValildation.spec.ts +0 -74
- package/src/lib/ErrorHandling/schemaValidation.ts +0 -115
- package/src/lib/common/Grid.tsx +0 -55
- package/src/lib/jsonforms-components.module.scss +0 -7
- package/src/lib/jsonforms-components.spec.tsx +0 -10
- package/src/lib/jsonforms-components.tsx +0 -14
- package/src/lib/layouts/GroupControl.tsx +0 -25
- package/src/lib/layouts/HorizontalLayoutControl.tsx +0 -30
- package/src/lib/layouts/VerticalLayoutControl.tsx +0 -28
- package/src/lib/util/layout.tsx +0 -68
- package/src/lib/util/schemaUtils.ts +0 -9
- package/src/lib/util/stringUtils.ts +0 -98
- package/src/lib/util/style-component.ts +0 -8
- package/tsconfig.json +0 -20
- package/tsconfig.lib.json +0 -19
- package/tsconfig.spec.json +0 -20
- /package/src/lib/Additional/{index.ts → index.d.ts} +0 -0
- /package/src/lib/Controls/FileUploader/{index.tsx → index.d.ts} +0 -0
- /package/src/lib/Controls/FormStepper/{index.tsx → index.d.ts} +0 -0
- /package/src/lib/Controls/Inputs/{index.tsx → index.d.ts} +0 -0
- /package/src/lib/Controls/ObjectArray/{index.tsx → index.d.ts} +0 -0
- /package/src/lib/Controls/{index.tsx → index.d.ts} +0 -0
- /package/src/lib/layouts/{index.ts → index.d.ts} +0 -0
package/index.esm.js
ADDED
|
@@ -0,0 +1,4831 @@
|
|
|
1
|
+
import { withAjvProps, materialSliderControlTester, MaterialSliderControl, materialObjectControlTester, MaterialObjectRenderer, materialAllOfControlTester, MaterialAllOfRenderer, materialAnyOfControlTester, MaterialAnyOfRenderer, materialOneOfControlTester, MaterialOneOfRenderer, materialOneOfRadioGroupControlTester, MaterialOneOfRadioGroupControl, materialOneOfEnumControlTester, MaterialOneOfEnumControl, materialHorizontalLayoutTester, materialVerticalLayoutTester, materialArrayLayoutTester, MaterialArrayLayout, materialAnyOfStringOrEnumControlTester, MaterialAnyOfStringOrEnumControl, materialEnumArrayRendererTester, MaterialEnumArrayRenderer, materialBooleanCellTester, MaterialBooleanCell, materialBooleanToggleCellTester, MaterialBooleanToggleCell, materialEnumCellTester, MaterialEnumCell, materialOneOfEnumCellTester, MaterialOneOfEnumCell } from '@jsonforms/material-renderers';
|
|
2
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
import { GoAFormItem, GoAInput, GoATextArea, GoACallout, GoAInputDate, GoAInputDateTime, GoAInputTime, GoADropdown, GoADropdownItem, GoARadioGroup, GoARadioItem, GoACheckbox, GoAFormStepper, GoAFormStep, GoAPages, GoAButton, GoAIconButton, GoAFileUploadInput, GoAModal, GoACircularProgress, GoAGrid, GoAContainer, GoAButtonGroup, GoADetails } from '@abgov/react-components';
|
|
4
|
+
import { Hidden, Typography, FormHelperText } from '@mui/material';
|
|
5
|
+
import { rankWith, isStringControl, and, optionIs, isDateControl, isNumberControl, isIntegerControl, isDateTimeControl, isTimeControl, isEnumControl, isBooleanControl, isDescriptionHidden, isVisible, isEnabled, deriveLabelForUISchemaElement, uiTypeIs, schemaTypeIs, formatIs, createDefaultValue, Paths, or, isObjectArrayControl, isPrimitiveArrayControl, withIncreasedRank, hasType, isControl, isCategorization, isLayout } from '@jsonforms/core';
|
|
6
|
+
import { withJsonFormsControlProps, withJsonFormsEnumProps, withTranslateProps, withJsonFormsLayoutProps, JsonFormsDispatch, useJsonForms, withJsonFormsArrayLayoutProps, withJsonFormsCellProps } from '@jsonforms/react';
|
|
7
|
+
import React, { createContext, useEffect, useState, useMemo, useContext, useCallback } from 'react';
|
|
8
|
+
import merge from 'lodash/merge';
|
|
9
|
+
import axios from 'axios';
|
|
10
|
+
import TextField from '@mui/material/TextField';
|
|
11
|
+
import Autocomplete from '@mui/material/Autocomplete';
|
|
12
|
+
import styled from 'styled-components';
|
|
13
|
+
import isEmpty from 'lodash/isEmpty';
|
|
14
|
+
import range from 'lodash/range';
|
|
15
|
+
|
|
16
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
17
|
+
|
|
18
|
+
var fails$i = function (exec) {
|
|
19
|
+
try {
|
|
20
|
+
return !!exec();
|
|
21
|
+
} catch (error) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
var fails$h = fails$i;
|
|
27
|
+
|
|
28
|
+
var functionBindNative = !fails$h(function () {
|
|
29
|
+
// eslint-disable-next-line es/no-function-prototype-bind -- safe
|
|
30
|
+
var test = (function () { /* empty */ }).bind();
|
|
31
|
+
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
32
|
+
return typeof test != 'function' || test.hasOwnProperty('prototype');
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
var NATIVE_BIND$2 = functionBindNative;
|
|
36
|
+
|
|
37
|
+
var FunctionPrototype$2 = Function.prototype;
|
|
38
|
+
var call$c = FunctionPrototype$2.call;
|
|
39
|
+
var uncurryThisWithBind = NATIVE_BIND$2 && FunctionPrototype$2.bind.bind(call$c, call$c);
|
|
40
|
+
|
|
41
|
+
var functionUncurryThis = NATIVE_BIND$2 ? uncurryThisWithBind : function (fn) {
|
|
42
|
+
return function () {
|
|
43
|
+
return call$c.apply(fn, arguments);
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
var uncurryThis$g = functionUncurryThis;
|
|
48
|
+
|
|
49
|
+
var toString$7 = uncurryThis$g({}.toString);
|
|
50
|
+
var stringSlice$6 = uncurryThis$g(''.slice);
|
|
51
|
+
|
|
52
|
+
var classofRaw$1 = function (it) {
|
|
53
|
+
return stringSlice$6(toString$7(it), 8, -1);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
var uncurryThis$f = functionUncurryThis;
|
|
57
|
+
var fails$g = fails$i;
|
|
58
|
+
var classof$4 = classofRaw$1;
|
|
59
|
+
|
|
60
|
+
var $Object$4 = Object;
|
|
61
|
+
var split = uncurryThis$f(''.split);
|
|
62
|
+
|
|
63
|
+
// fallback for non-array-like ES3 and non-enumerable old V8 strings
|
|
64
|
+
var indexedObject = fails$g(function () {
|
|
65
|
+
// throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
|
|
66
|
+
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
67
|
+
return !$Object$4('z').propertyIsEnumerable(0);
|
|
68
|
+
}) ? function (it) {
|
|
69
|
+
return classof$4(it) === 'String' ? split(it, '') : $Object$4(it);
|
|
70
|
+
} : $Object$4;
|
|
71
|
+
|
|
72
|
+
// we can't use just `it == null` since of `document.all` special case
|
|
73
|
+
// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec
|
|
74
|
+
var isNullOrUndefined$3 = function (it) {
|
|
75
|
+
return it === null || it === undefined;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
var isNullOrUndefined$2 = isNullOrUndefined$3;
|
|
79
|
+
|
|
80
|
+
var $TypeError$8 = TypeError;
|
|
81
|
+
|
|
82
|
+
// `RequireObjectCoercible` abstract operation
|
|
83
|
+
// https://tc39.es/ecma262/#sec-requireobjectcoercible
|
|
84
|
+
var requireObjectCoercible$5 = function (it) {
|
|
85
|
+
if (isNullOrUndefined$2(it)) throw new $TypeError$8("Can't call method on " + it);
|
|
86
|
+
return it;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
// toObject with fallback for non-array-like ES3 strings
|
|
90
|
+
var IndexedObject$1 = indexedObject;
|
|
91
|
+
var requireObjectCoercible$4 = requireObjectCoercible$5;
|
|
92
|
+
|
|
93
|
+
var toIndexedObject$5 = function (it) {
|
|
94
|
+
return IndexedObject$1(requireObjectCoercible$4(it));
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
var check = function (it) {
|
|
98
|
+
return it && it.Math === Math && it;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
|
|
102
|
+
var global$f =
|
|
103
|
+
// eslint-disable-next-line es/no-global-this -- safe
|
|
104
|
+
check(typeof globalThis == 'object' && globalThis) ||
|
|
105
|
+
check(typeof window == 'object' && window) ||
|
|
106
|
+
// eslint-disable-next-line no-restricted-globals -- safe
|
|
107
|
+
check(typeof self == 'object' && self) ||
|
|
108
|
+
check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
|
|
109
|
+
check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
|
|
110
|
+
// eslint-disable-next-line no-new-func -- fallback
|
|
111
|
+
(function () { return this; })() || Function('return this')();
|
|
112
|
+
|
|
113
|
+
var sharedStore = {exports: {}};
|
|
114
|
+
|
|
115
|
+
var global$e = global$f;
|
|
116
|
+
|
|
117
|
+
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
118
|
+
var defineProperty$6 = Object.defineProperty;
|
|
119
|
+
|
|
120
|
+
var defineGlobalProperty$3 = function (key, value) {
|
|
121
|
+
try {
|
|
122
|
+
defineProperty$6(global$e, key, { value: value, configurable: true, writable: true });
|
|
123
|
+
} catch (error) {
|
|
124
|
+
global$e[key] = value;
|
|
125
|
+
} return value;
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
var globalThis$1 = global$f;
|
|
129
|
+
var defineGlobalProperty$2 = defineGlobalProperty$3;
|
|
130
|
+
|
|
131
|
+
var SHARED = '__core-js_shared__';
|
|
132
|
+
var store$3 = sharedStore.exports = globalThis$1[SHARED] || defineGlobalProperty$2(SHARED, {});
|
|
133
|
+
|
|
134
|
+
(store$3.versions || (store$3.versions = [])).push({
|
|
135
|
+
version: '3.36.0',
|
|
136
|
+
mode: 'global',
|
|
137
|
+
copyright: '© 2014-2024 Denis Pushkarev (zloirock.ru)',
|
|
138
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.36.0/LICENSE',
|
|
139
|
+
source: 'https://github.com/zloirock/core-js'
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
var store$2 = sharedStore.exports;
|
|
143
|
+
|
|
144
|
+
var shared$4 = function (key, value) {
|
|
145
|
+
return store$2[key] || (store$2[key] = value || {});
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
var requireObjectCoercible$3 = requireObjectCoercible$5;
|
|
149
|
+
|
|
150
|
+
var $Object$3 = Object;
|
|
151
|
+
|
|
152
|
+
// `ToObject` abstract operation
|
|
153
|
+
// https://tc39.es/ecma262/#sec-toobject
|
|
154
|
+
var toObject$4 = function (argument) {
|
|
155
|
+
return $Object$3(requireObjectCoercible$3(argument));
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
var uncurryThis$e = functionUncurryThis;
|
|
159
|
+
var toObject$3 = toObject$4;
|
|
160
|
+
|
|
161
|
+
var hasOwnProperty = uncurryThis$e({}.hasOwnProperty);
|
|
162
|
+
|
|
163
|
+
// `HasOwnProperty` abstract operation
|
|
164
|
+
// https://tc39.es/ecma262/#sec-hasownproperty
|
|
165
|
+
// eslint-disable-next-line es/no-object-hasown -- safe
|
|
166
|
+
var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
|
|
167
|
+
return hasOwnProperty(toObject$3(it), key);
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
var uncurryThis$d = functionUncurryThis;
|
|
171
|
+
|
|
172
|
+
var id = 0;
|
|
173
|
+
var postfix = Math.random();
|
|
174
|
+
var toString$6 = uncurryThis$d(1.0.toString);
|
|
175
|
+
|
|
176
|
+
var uid$2 = function (key) {
|
|
177
|
+
return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$6(++id + postfix, 36);
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
var engineUserAgent = typeof navigator != 'undefined' && String(navigator.userAgent) || '';
|
|
181
|
+
|
|
182
|
+
var global$d = global$f;
|
|
183
|
+
var userAgent = engineUserAgent;
|
|
184
|
+
|
|
185
|
+
var process = global$d.process;
|
|
186
|
+
var Deno = global$d.Deno;
|
|
187
|
+
var versions = process && process.versions || Deno && Deno.version;
|
|
188
|
+
var v8 = versions && versions.v8;
|
|
189
|
+
var match, version;
|
|
190
|
+
|
|
191
|
+
if (v8) {
|
|
192
|
+
match = v8.split('.');
|
|
193
|
+
// in old Chrome, versions of V8 isn't V8 = Chrome / 10
|
|
194
|
+
// but their correct versions are not interesting for us
|
|
195
|
+
version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
|
|
199
|
+
// so check `userAgent` even if `.v8` exists, but 0
|
|
200
|
+
if (!version && userAgent) {
|
|
201
|
+
match = userAgent.match(/Edge\/(\d+)/);
|
|
202
|
+
if (!match || match[1] >= 74) {
|
|
203
|
+
match = userAgent.match(/Chrome\/(\d+)/);
|
|
204
|
+
if (match) version = +match[1];
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
var engineV8Version = version;
|
|
209
|
+
|
|
210
|
+
/* eslint-disable es/no-symbol -- required for testing */
|
|
211
|
+
var V8_VERSION = engineV8Version;
|
|
212
|
+
var fails$f = fails$i;
|
|
213
|
+
var global$c = global$f;
|
|
214
|
+
|
|
215
|
+
var $String$5 = global$c.String;
|
|
216
|
+
|
|
217
|
+
// eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
|
|
218
|
+
var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$f(function () {
|
|
219
|
+
var symbol = Symbol('symbol detection');
|
|
220
|
+
// Chrome 38 Symbol has incorrect toString conversion
|
|
221
|
+
// `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
|
|
222
|
+
// nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will,
|
|
223
|
+
// of course, fail.
|
|
224
|
+
return !$String$5(symbol) || !(Object(symbol) instanceof Symbol) ||
|
|
225
|
+
// Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
|
|
226
|
+
!Symbol.sham && V8_VERSION && V8_VERSION < 41;
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
/* eslint-disable es/no-symbol -- required for testing */
|
|
230
|
+
var NATIVE_SYMBOL$2 = symbolConstructorDetection;
|
|
231
|
+
|
|
232
|
+
var useSymbolAsUid = NATIVE_SYMBOL$2
|
|
233
|
+
&& !Symbol.sham
|
|
234
|
+
&& typeof Symbol.iterator == 'symbol';
|
|
235
|
+
|
|
236
|
+
var global$b = global$f;
|
|
237
|
+
var shared$3 = shared$4;
|
|
238
|
+
var hasOwn$a = hasOwnProperty_1;
|
|
239
|
+
var uid$1 = uid$2;
|
|
240
|
+
var NATIVE_SYMBOL$1 = symbolConstructorDetection;
|
|
241
|
+
var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;
|
|
242
|
+
|
|
243
|
+
var Symbol$1 = global$b.Symbol;
|
|
244
|
+
var WellKnownSymbolsStore = shared$3('wks');
|
|
245
|
+
var createWellKnownSymbol = USE_SYMBOL_AS_UID$1 ? Symbol$1['for'] || Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid$1;
|
|
246
|
+
|
|
247
|
+
var wellKnownSymbol$c = function (name) {
|
|
248
|
+
if (!hasOwn$a(WellKnownSymbolsStore, name)) {
|
|
249
|
+
WellKnownSymbolsStore[name] = NATIVE_SYMBOL$1 && hasOwn$a(Symbol$1, name)
|
|
250
|
+
? Symbol$1[name]
|
|
251
|
+
: createWellKnownSymbol('Symbol.' + name);
|
|
252
|
+
} return WellKnownSymbolsStore[name];
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
|
|
256
|
+
var documentAll = typeof document == 'object' && document.all;
|
|
257
|
+
|
|
258
|
+
// `IsCallable` abstract operation
|
|
259
|
+
// https://tc39.es/ecma262/#sec-iscallable
|
|
260
|
+
// eslint-disable-next-line unicorn/no-typeof-undefined -- required for testing
|
|
261
|
+
var isCallable$h = typeof documentAll == 'undefined' && documentAll !== undefined ? function (argument) {
|
|
262
|
+
return typeof argument == 'function' || argument === documentAll;
|
|
263
|
+
} : function (argument) {
|
|
264
|
+
return typeof argument == 'function';
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
var isCallable$g = isCallable$h;
|
|
268
|
+
|
|
269
|
+
var isObject$8 = function (it) {
|
|
270
|
+
return typeof it == 'object' ? it !== null : isCallable$g(it);
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
var isObject$7 = isObject$8;
|
|
274
|
+
|
|
275
|
+
var $String$4 = String;
|
|
276
|
+
var $TypeError$7 = TypeError;
|
|
277
|
+
|
|
278
|
+
// `Assert: Type(argument) is Object`
|
|
279
|
+
var anObject$9 = function (argument) {
|
|
280
|
+
if (isObject$7(argument)) return argument;
|
|
281
|
+
throw new $TypeError$7($String$4(argument) + ' is not an object');
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
var objectDefineProperties = {};
|
|
285
|
+
|
|
286
|
+
var fails$e = fails$i;
|
|
287
|
+
|
|
288
|
+
// Detect IE8's incomplete defineProperty implementation
|
|
289
|
+
var descriptors = !fails$e(function () {
|
|
290
|
+
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
291
|
+
return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] !== 7;
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
var DESCRIPTORS$a = descriptors;
|
|
295
|
+
var fails$d = fails$i;
|
|
296
|
+
|
|
297
|
+
// V8 ~ Chrome 36-
|
|
298
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3334
|
|
299
|
+
var v8PrototypeDefineBug = DESCRIPTORS$a && fails$d(function () {
|
|
300
|
+
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
301
|
+
return Object.defineProperty(function () { /* empty */ }, 'prototype', {
|
|
302
|
+
value: 42,
|
|
303
|
+
writable: false
|
|
304
|
+
}).prototype !== 42;
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
var objectDefineProperty = {};
|
|
308
|
+
|
|
309
|
+
var global$a = global$f;
|
|
310
|
+
var isObject$6 = isObject$8;
|
|
311
|
+
|
|
312
|
+
var document$1 = global$a.document;
|
|
313
|
+
// typeof document.createElement is 'object' in old IE
|
|
314
|
+
var EXISTS$1 = isObject$6(document$1) && isObject$6(document$1.createElement);
|
|
315
|
+
|
|
316
|
+
var documentCreateElement$2 = function (it) {
|
|
317
|
+
return EXISTS$1 ? document$1.createElement(it) : {};
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
var DESCRIPTORS$9 = descriptors;
|
|
321
|
+
var fails$c = fails$i;
|
|
322
|
+
var createElement = documentCreateElement$2;
|
|
323
|
+
|
|
324
|
+
// Thanks to IE8 for its funny defineProperty
|
|
325
|
+
var ie8DomDefine = !DESCRIPTORS$9 && !fails$c(function () {
|
|
326
|
+
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
327
|
+
return Object.defineProperty(createElement('div'), 'a', {
|
|
328
|
+
get: function () { return 7; }
|
|
329
|
+
}).a !== 7;
|
|
330
|
+
});
|
|
331
|
+
|
|
332
|
+
var NATIVE_BIND$1 = functionBindNative;
|
|
333
|
+
|
|
334
|
+
var call$b = Function.prototype.call;
|
|
335
|
+
|
|
336
|
+
var functionCall = NATIVE_BIND$1 ? call$b.bind(call$b) : function () {
|
|
337
|
+
return call$b.apply(call$b, arguments);
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
var global$9 = global$f;
|
|
341
|
+
var isCallable$f = isCallable$h;
|
|
342
|
+
|
|
343
|
+
var aFunction = function (argument) {
|
|
344
|
+
return isCallable$f(argument) ? argument : undefined;
|
|
345
|
+
};
|
|
346
|
+
|
|
347
|
+
var getBuiltIn$3 = function (namespace, method) {
|
|
348
|
+
return arguments.length < 2 ? aFunction(global$9[namespace]) : global$9[namespace] && global$9[namespace][method];
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
var uncurryThis$c = functionUncurryThis;
|
|
352
|
+
|
|
353
|
+
var objectIsPrototypeOf = uncurryThis$c({}.isPrototypeOf);
|
|
354
|
+
|
|
355
|
+
var getBuiltIn$2 = getBuiltIn$3;
|
|
356
|
+
var isCallable$e = isCallable$h;
|
|
357
|
+
var isPrototypeOf$2 = objectIsPrototypeOf;
|
|
358
|
+
var USE_SYMBOL_AS_UID = useSymbolAsUid;
|
|
359
|
+
|
|
360
|
+
var $Object$2 = Object;
|
|
361
|
+
|
|
362
|
+
var isSymbol$2 = USE_SYMBOL_AS_UID ? function (it) {
|
|
363
|
+
return typeof it == 'symbol';
|
|
364
|
+
} : function (it) {
|
|
365
|
+
var $Symbol = getBuiltIn$2('Symbol');
|
|
366
|
+
return isCallable$e($Symbol) && isPrototypeOf$2($Symbol.prototype, $Object$2(it));
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
var $String$3 = String;
|
|
370
|
+
|
|
371
|
+
var tryToString$1 = function (argument) {
|
|
372
|
+
try {
|
|
373
|
+
return $String$3(argument);
|
|
374
|
+
} catch (error) {
|
|
375
|
+
return 'Object';
|
|
376
|
+
}
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
var isCallable$d = isCallable$h;
|
|
380
|
+
var tryToString = tryToString$1;
|
|
381
|
+
|
|
382
|
+
var $TypeError$6 = TypeError;
|
|
383
|
+
|
|
384
|
+
// `Assert: IsCallable(argument) is true`
|
|
385
|
+
var aCallable$2 = function (argument) {
|
|
386
|
+
if (isCallable$d(argument)) return argument;
|
|
387
|
+
throw new $TypeError$6(tryToString(argument) + ' is not a function');
|
|
388
|
+
};
|
|
389
|
+
|
|
390
|
+
var aCallable$1 = aCallable$2;
|
|
391
|
+
var isNullOrUndefined$1 = isNullOrUndefined$3;
|
|
392
|
+
|
|
393
|
+
// `GetMethod` abstract operation
|
|
394
|
+
// https://tc39.es/ecma262/#sec-getmethod
|
|
395
|
+
var getMethod$2 = function (V, P) {
|
|
396
|
+
var func = V[P];
|
|
397
|
+
return isNullOrUndefined$1(func) ? undefined : aCallable$1(func);
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
var call$a = functionCall;
|
|
401
|
+
var isCallable$c = isCallable$h;
|
|
402
|
+
var isObject$5 = isObject$8;
|
|
403
|
+
|
|
404
|
+
var $TypeError$5 = TypeError;
|
|
405
|
+
|
|
406
|
+
// `OrdinaryToPrimitive` abstract operation
|
|
407
|
+
// https://tc39.es/ecma262/#sec-ordinarytoprimitive
|
|
408
|
+
var ordinaryToPrimitive$1 = function (input, pref) {
|
|
409
|
+
var fn, val;
|
|
410
|
+
if (pref === 'string' && isCallable$c(fn = input.toString) && !isObject$5(val = call$a(fn, input))) return val;
|
|
411
|
+
if (isCallable$c(fn = input.valueOf) && !isObject$5(val = call$a(fn, input))) return val;
|
|
412
|
+
if (pref !== 'string' && isCallable$c(fn = input.toString) && !isObject$5(val = call$a(fn, input))) return val;
|
|
413
|
+
throw new $TypeError$5("Can't convert object to primitive value");
|
|
414
|
+
};
|
|
415
|
+
|
|
416
|
+
var call$9 = functionCall;
|
|
417
|
+
var isObject$4 = isObject$8;
|
|
418
|
+
var isSymbol$1 = isSymbol$2;
|
|
419
|
+
var getMethod$1 = getMethod$2;
|
|
420
|
+
var ordinaryToPrimitive = ordinaryToPrimitive$1;
|
|
421
|
+
var wellKnownSymbol$b = wellKnownSymbol$c;
|
|
422
|
+
|
|
423
|
+
var $TypeError$4 = TypeError;
|
|
424
|
+
var TO_PRIMITIVE = wellKnownSymbol$b('toPrimitive');
|
|
425
|
+
|
|
426
|
+
// `ToPrimitive` abstract operation
|
|
427
|
+
// https://tc39.es/ecma262/#sec-toprimitive
|
|
428
|
+
var toPrimitive$1 = function (input, pref) {
|
|
429
|
+
if (!isObject$4(input) || isSymbol$1(input)) return input;
|
|
430
|
+
var exoticToPrim = getMethod$1(input, TO_PRIMITIVE);
|
|
431
|
+
var result;
|
|
432
|
+
if (exoticToPrim) {
|
|
433
|
+
if (pref === undefined) pref = 'default';
|
|
434
|
+
result = call$9(exoticToPrim, input, pref);
|
|
435
|
+
if (!isObject$4(result) || isSymbol$1(result)) return result;
|
|
436
|
+
throw new $TypeError$4("Can't convert object to primitive value");
|
|
437
|
+
}
|
|
438
|
+
if (pref === undefined) pref = 'number';
|
|
439
|
+
return ordinaryToPrimitive(input, pref);
|
|
440
|
+
};
|
|
441
|
+
|
|
442
|
+
var toPrimitive = toPrimitive$1;
|
|
443
|
+
var isSymbol = isSymbol$2;
|
|
444
|
+
|
|
445
|
+
// `ToPropertyKey` abstract operation
|
|
446
|
+
// https://tc39.es/ecma262/#sec-topropertykey
|
|
447
|
+
var toPropertyKey$2 = function (argument) {
|
|
448
|
+
var key = toPrimitive(argument, 'string');
|
|
449
|
+
return isSymbol(key) ? key : key + '';
|
|
450
|
+
};
|
|
451
|
+
|
|
452
|
+
var DESCRIPTORS$8 = descriptors;
|
|
453
|
+
var IE8_DOM_DEFINE$1 = ie8DomDefine;
|
|
454
|
+
var V8_PROTOTYPE_DEFINE_BUG$1 = v8PrototypeDefineBug;
|
|
455
|
+
var anObject$8 = anObject$9;
|
|
456
|
+
var toPropertyKey$1 = toPropertyKey$2;
|
|
457
|
+
|
|
458
|
+
var $TypeError$3 = TypeError;
|
|
459
|
+
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
460
|
+
var $defineProperty = Object.defineProperty;
|
|
461
|
+
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
462
|
+
var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
|
|
463
|
+
var ENUMERABLE = 'enumerable';
|
|
464
|
+
var CONFIGURABLE$1 = 'configurable';
|
|
465
|
+
var WRITABLE = 'writable';
|
|
466
|
+
|
|
467
|
+
// `Object.defineProperty` method
|
|
468
|
+
// https://tc39.es/ecma262/#sec-object.defineproperty
|
|
469
|
+
objectDefineProperty.f = DESCRIPTORS$8 ? V8_PROTOTYPE_DEFINE_BUG$1 ? function defineProperty(O, P, Attributes) {
|
|
470
|
+
anObject$8(O);
|
|
471
|
+
P = toPropertyKey$1(P);
|
|
472
|
+
anObject$8(Attributes);
|
|
473
|
+
if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
|
|
474
|
+
var current = $getOwnPropertyDescriptor$1(O, P);
|
|
475
|
+
if (current && current[WRITABLE]) {
|
|
476
|
+
O[P] = Attributes.value;
|
|
477
|
+
Attributes = {
|
|
478
|
+
configurable: CONFIGURABLE$1 in Attributes ? Attributes[CONFIGURABLE$1] : current[CONFIGURABLE$1],
|
|
479
|
+
enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
|
|
480
|
+
writable: false
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
} return $defineProperty(O, P, Attributes);
|
|
484
|
+
} : $defineProperty : function defineProperty(O, P, Attributes) {
|
|
485
|
+
anObject$8(O);
|
|
486
|
+
P = toPropertyKey$1(P);
|
|
487
|
+
anObject$8(Attributes);
|
|
488
|
+
if (IE8_DOM_DEFINE$1) try {
|
|
489
|
+
return $defineProperty(O, P, Attributes);
|
|
490
|
+
} catch (error) { /* empty */ }
|
|
491
|
+
if ('get' in Attributes || 'set' in Attributes) throw new $TypeError$3('Accessors not supported');
|
|
492
|
+
if ('value' in Attributes) O[P] = Attributes.value;
|
|
493
|
+
return O;
|
|
494
|
+
};
|
|
495
|
+
|
|
496
|
+
var ceil = Math.ceil;
|
|
497
|
+
var floor$1 = Math.floor;
|
|
498
|
+
|
|
499
|
+
// `Math.trunc` method
|
|
500
|
+
// https://tc39.es/ecma262/#sec-math.trunc
|
|
501
|
+
// eslint-disable-next-line es/no-math-trunc -- safe
|
|
502
|
+
var mathTrunc = Math.trunc || function trunc(x) {
|
|
503
|
+
var n = +x;
|
|
504
|
+
return (n > 0 ? floor$1 : ceil)(n);
|
|
505
|
+
};
|
|
506
|
+
|
|
507
|
+
var trunc = mathTrunc;
|
|
508
|
+
|
|
509
|
+
// `ToIntegerOrInfinity` abstract operation
|
|
510
|
+
// https://tc39.es/ecma262/#sec-tointegerorinfinity
|
|
511
|
+
var toIntegerOrInfinity$4 = function (argument) {
|
|
512
|
+
var number = +argument;
|
|
513
|
+
// eslint-disable-next-line no-self-compare -- NaN check
|
|
514
|
+
return number !== number || number === 0 ? 0 : trunc(number);
|
|
515
|
+
};
|
|
516
|
+
|
|
517
|
+
var toIntegerOrInfinity$3 = toIntegerOrInfinity$4;
|
|
518
|
+
|
|
519
|
+
var max$1 = Math.max;
|
|
520
|
+
var min$2 = Math.min;
|
|
521
|
+
|
|
522
|
+
// Helper for a popular repeating case of the spec:
|
|
523
|
+
// Let integer be ? ToInteger(index).
|
|
524
|
+
// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
|
|
525
|
+
var toAbsoluteIndex$1 = function (index, length) {
|
|
526
|
+
var integer = toIntegerOrInfinity$3(index);
|
|
527
|
+
return integer < 0 ? max$1(integer + length, 0) : min$2(integer, length);
|
|
528
|
+
};
|
|
529
|
+
|
|
530
|
+
var toIntegerOrInfinity$2 = toIntegerOrInfinity$4;
|
|
531
|
+
|
|
532
|
+
var min$1 = Math.min;
|
|
533
|
+
|
|
534
|
+
// `ToLength` abstract operation
|
|
535
|
+
// https://tc39.es/ecma262/#sec-tolength
|
|
536
|
+
var toLength$2 = function (argument) {
|
|
537
|
+
var len = toIntegerOrInfinity$2(argument);
|
|
538
|
+
return len > 0 ? min$1(len, 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
|
|
539
|
+
};
|
|
540
|
+
|
|
541
|
+
var toLength$1 = toLength$2;
|
|
542
|
+
|
|
543
|
+
// `LengthOfArrayLike` abstract operation
|
|
544
|
+
// https://tc39.es/ecma262/#sec-lengthofarraylike
|
|
545
|
+
var lengthOfArrayLike$1 = function (obj) {
|
|
546
|
+
return toLength$1(obj.length);
|
|
547
|
+
};
|
|
548
|
+
|
|
549
|
+
var toIndexedObject$4 = toIndexedObject$5;
|
|
550
|
+
var toAbsoluteIndex = toAbsoluteIndex$1;
|
|
551
|
+
var lengthOfArrayLike = lengthOfArrayLike$1;
|
|
552
|
+
|
|
553
|
+
// `Array.prototype.{ indexOf, includes }` methods implementation
|
|
554
|
+
var createMethod$1 = function (IS_INCLUDES) {
|
|
555
|
+
return function ($this, el, fromIndex) {
|
|
556
|
+
var O = toIndexedObject$4($this);
|
|
557
|
+
var length = lengthOfArrayLike(O);
|
|
558
|
+
if (length === 0) return !IS_INCLUDES && -1;
|
|
559
|
+
var index = toAbsoluteIndex(fromIndex, length);
|
|
560
|
+
var value;
|
|
561
|
+
// Array#includes uses SameValueZero equality algorithm
|
|
562
|
+
// eslint-disable-next-line no-self-compare -- NaN check
|
|
563
|
+
if (IS_INCLUDES && el !== el) while (length > index) {
|
|
564
|
+
value = O[index++];
|
|
565
|
+
// eslint-disable-next-line no-self-compare -- NaN check
|
|
566
|
+
if (value !== value) return true;
|
|
567
|
+
// Array#indexOf ignores holes, Array#includes - not
|
|
568
|
+
} else for (;length > index; index++) {
|
|
569
|
+
if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
|
|
570
|
+
} return !IS_INCLUDES && -1;
|
|
571
|
+
};
|
|
572
|
+
};
|
|
573
|
+
|
|
574
|
+
var arrayIncludes = {
|
|
575
|
+
// `Array.prototype.includes` method
|
|
576
|
+
// https://tc39.es/ecma262/#sec-array.prototype.includes
|
|
577
|
+
includes: createMethod$1(true),
|
|
578
|
+
// `Array.prototype.indexOf` method
|
|
579
|
+
// https://tc39.es/ecma262/#sec-array.prototype.indexof
|
|
580
|
+
indexOf: createMethod$1(false)
|
|
581
|
+
};
|
|
582
|
+
|
|
583
|
+
var hiddenKeys$4 = {};
|
|
584
|
+
|
|
585
|
+
var uncurryThis$b = functionUncurryThis;
|
|
586
|
+
var hasOwn$9 = hasOwnProperty_1;
|
|
587
|
+
var toIndexedObject$3 = toIndexedObject$5;
|
|
588
|
+
var indexOf$1 = arrayIncludes.indexOf;
|
|
589
|
+
var hiddenKeys$3 = hiddenKeys$4;
|
|
590
|
+
|
|
591
|
+
var push$1 = uncurryThis$b([].push);
|
|
592
|
+
|
|
593
|
+
var objectKeysInternal = function (object, names) {
|
|
594
|
+
var O = toIndexedObject$3(object);
|
|
595
|
+
var i = 0;
|
|
596
|
+
var result = [];
|
|
597
|
+
var key;
|
|
598
|
+
for (key in O) !hasOwn$9(hiddenKeys$3, key) && hasOwn$9(O, key) && push$1(result, key);
|
|
599
|
+
// Don't enum bug & hidden keys
|
|
600
|
+
while (names.length > i) if (hasOwn$9(O, key = names[i++])) {
|
|
601
|
+
~indexOf$1(result, key) || push$1(result, key);
|
|
602
|
+
}
|
|
603
|
+
return result;
|
|
604
|
+
};
|
|
605
|
+
|
|
606
|
+
// IE8- don't enum bug keys
|
|
607
|
+
var enumBugKeys$3 = [
|
|
608
|
+
'constructor',
|
|
609
|
+
'hasOwnProperty',
|
|
610
|
+
'isPrototypeOf',
|
|
611
|
+
'propertyIsEnumerable',
|
|
612
|
+
'toLocaleString',
|
|
613
|
+
'toString',
|
|
614
|
+
'valueOf'
|
|
615
|
+
];
|
|
616
|
+
|
|
617
|
+
var internalObjectKeys$1 = objectKeysInternal;
|
|
618
|
+
var enumBugKeys$2 = enumBugKeys$3;
|
|
619
|
+
|
|
620
|
+
// `Object.keys` method
|
|
621
|
+
// https://tc39.es/ecma262/#sec-object.keys
|
|
622
|
+
// eslint-disable-next-line es/no-object-keys -- safe
|
|
623
|
+
var objectKeys$2 = Object.keys || function keys(O) {
|
|
624
|
+
return internalObjectKeys$1(O, enumBugKeys$2);
|
|
625
|
+
};
|
|
626
|
+
|
|
627
|
+
var DESCRIPTORS$7 = descriptors;
|
|
628
|
+
var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug;
|
|
629
|
+
var definePropertyModule$3 = objectDefineProperty;
|
|
630
|
+
var anObject$7 = anObject$9;
|
|
631
|
+
var toIndexedObject$2 = toIndexedObject$5;
|
|
632
|
+
var objectKeys$1 = objectKeys$2;
|
|
633
|
+
|
|
634
|
+
// `Object.defineProperties` method
|
|
635
|
+
// https://tc39.es/ecma262/#sec-object.defineproperties
|
|
636
|
+
// eslint-disable-next-line es/no-object-defineproperties -- safe
|
|
637
|
+
objectDefineProperties.f = DESCRIPTORS$7 && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
|
|
638
|
+
anObject$7(O);
|
|
639
|
+
var props = toIndexedObject$2(Properties);
|
|
640
|
+
var keys = objectKeys$1(Properties);
|
|
641
|
+
var length = keys.length;
|
|
642
|
+
var index = 0;
|
|
643
|
+
var key;
|
|
644
|
+
while (length > index) definePropertyModule$3.f(O, key = keys[index++], props[key]);
|
|
645
|
+
return O;
|
|
646
|
+
};
|
|
647
|
+
|
|
648
|
+
var getBuiltIn$1 = getBuiltIn$3;
|
|
649
|
+
|
|
650
|
+
var html$1 = getBuiltIn$1('document', 'documentElement');
|
|
651
|
+
|
|
652
|
+
var shared$2 = shared$4;
|
|
653
|
+
var uid = uid$2;
|
|
654
|
+
|
|
655
|
+
var keys = shared$2('keys');
|
|
656
|
+
|
|
657
|
+
var sharedKey$3 = function (key) {
|
|
658
|
+
return keys[key] || (keys[key] = uid(key));
|
|
659
|
+
};
|
|
660
|
+
|
|
661
|
+
/* global ActiveXObject -- old IE, WSH */
|
|
662
|
+
var anObject$6 = anObject$9;
|
|
663
|
+
var definePropertiesModule = objectDefineProperties;
|
|
664
|
+
var enumBugKeys$1 = enumBugKeys$3;
|
|
665
|
+
var hiddenKeys$2 = hiddenKeys$4;
|
|
666
|
+
var html = html$1;
|
|
667
|
+
var documentCreateElement$1 = documentCreateElement$2;
|
|
668
|
+
var sharedKey$2 = sharedKey$3;
|
|
669
|
+
|
|
670
|
+
var GT = '>';
|
|
671
|
+
var LT = '<';
|
|
672
|
+
var PROTOTYPE = 'prototype';
|
|
673
|
+
var SCRIPT = 'script';
|
|
674
|
+
var IE_PROTO$1 = sharedKey$2('IE_PROTO');
|
|
675
|
+
|
|
676
|
+
var EmptyConstructor = function () { /* empty */ };
|
|
677
|
+
|
|
678
|
+
var scriptTag = function (content) {
|
|
679
|
+
return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
|
|
680
|
+
};
|
|
681
|
+
|
|
682
|
+
// Create object with fake `null` prototype: use ActiveX Object with cleared prototype
|
|
683
|
+
var NullProtoObjectViaActiveX = function (activeXDocument) {
|
|
684
|
+
activeXDocument.write(scriptTag(''));
|
|
685
|
+
activeXDocument.close();
|
|
686
|
+
var temp = activeXDocument.parentWindow.Object;
|
|
687
|
+
activeXDocument = null; // avoid memory leak
|
|
688
|
+
return temp;
|
|
689
|
+
};
|
|
690
|
+
|
|
691
|
+
// Create object with fake `null` prototype: use iframe Object with cleared prototype
|
|
692
|
+
var NullProtoObjectViaIFrame = function () {
|
|
693
|
+
// Thrash, waste and sodomy: IE GC bug
|
|
694
|
+
var iframe = documentCreateElement$1('iframe');
|
|
695
|
+
var JS = 'java' + SCRIPT + ':';
|
|
696
|
+
var iframeDocument;
|
|
697
|
+
iframe.style.display = 'none';
|
|
698
|
+
html.appendChild(iframe);
|
|
699
|
+
// https://github.com/zloirock/core-js/issues/475
|
|
700
|
+
iframe.src = String(JS);
|
|
701
|
+
iframeDocument = iframe.contentWindow.document;
|
|
702
|
+
iframeDocument.open();
|
|
703
|
+
iframeDocument.write(scriptTag('document.F=Object'));
|
|
704
|
+
iframeDocument.close();
|
|
705
|
+
return iframeDocument.F;
|
|
706
|
+
};
|
|
707
|
+
|
|
708
|
+
// Check for document.domain and active x support
|
|
709
|
+
// No need to use active x approach when document.domain is not set
|
|
710
|
+
// see https://github.com/es-shims/es5-shim/issues/150
|
|
711
|
+
// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
|
|
712
|
+
// avoid IE GC bug
|
|
713
|
+
var activeXDocument;
|
|
714
|
+
var NullProtoObject = function () {
|
|
715
|
+
try {
|
|
716
|
+
activeXDocument = new ActiveXObject('htmlfile');
|
|
717
|
+
} catch (error) { /* ignore */ }
|
|
718
|
+
NullProtoObject = typeof document != 'undefined'
|
|
719
|
+
? document.domain && activeXDocument
|
|
720
|
+
? NullProtoObjectViaActiveX(activeXDocument) // old IE
|
|
721
|
+
: NullProtoObjectViaIFrame()
|
|
722
|
+
: NullProtoObjectViaActiveX(activeXDocument); // WSH
|
|
723
|
+
var length = enumBugKeys$1.length;
|
|
724
|
+
while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys$1[length]];
|
|
725
|
+
return NullProtoObject();
|
|
726
|
+
};
|
|
727
|
+
|
|
728
|
+
hiddenKeys$2[IE_PROTO$1] = true;
|
|
729
|
+
|
|
730
|
+
// `Object.create` method
|
|
731
|
+
// https://tc39.es/ecma262/#sec-object.create
|
|
732
|
+
// eslint-disable-next-line es/no-object-create -- safe
|
|
733
|
+
var objectCreate = Object.create || function create(O, Properties) {
|
|
734
|
+
var result;
|
|
735
|
+
if (O !== null) {
|
|
736
|
+
EmptyConstructor[PROTOTYPE] = anObject$6(O);
|
|
737
|
+
result = new EmptyConstructor();
|
|
738
|
+
EmptyConstructor[PROTOTYPE] = null;
|
|
739
|
+
// add "__proto__" for Object.getPrototypeOf polyfill
|
|
740
|
+
result[IE_PROTO$1] = O;
|
|
741
|
+
} else result = NullProtoObject();
|
|
742
|
+
return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
|
|
743
|
+
};
|
|
744
|
+
|
|
745
|
+
var wellKnownSymbol$a = wellKnownSymbol$c;
|
|
746
|
+
var create$2 = objectCreate;
|
|
747
|
+
var defineProperty$5 = objectDefineProperty.f;
|
|
748
|
+
|
|
749
|
+
var UNSCOPABLES = wellKnownSymbol$a('unscopables');
|
|
750
|
+
var ArrayPrototype = Array.prototype;
|
|
751
|
+
|
|
752
|
+
// Array.prototype[@@unscopables]
|
|
753
|
+
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
754
|
+
if (ArrayPrototype[UNSCOPABLES] === undefined) {
|
|
755
|
+
defineProperty$5(ArrayPrototype, UNSCOPABLES, {
|
|
756
|
+
configurable: true,
|
|
757
|
+
value: create$2(null)
|
|
758
|
+
});
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
// add a key to Array.prototype[@@unscopables]
|
|
762
|
+
var addToUnscopables$2 = function (key) {
|
|
763
|
+
ArrayPrototype[UNSCOPABLES][key] = true;
|
|
764
|
+
};
|
|
765
|
+
|
|
766
|
+
var iterators = {};
|
|
767
|
+
|
|
768
|
+
var global$8 = global$f;
|
|
769
|
+
var isCallable$b = isCallable$h;
|
|
770
|
+
|
|
771
|
+
var WeakMap$1 = global$8.WeakMap;
|
|
772
|
+
|
|
773
|
+
var weakMapBasicDetection = isCallable$b(WeakMap$1) && /native code/.test(String(WeakMap$1));
|
|
774
|
+
|
|
775
|
+
var createPropertyDescriptor$3 = function (bitmap, value) {
|
|
776
|
+
return {
|
|
777
|
+
enumerable: !(bitmap & 1),
|
|
778
|
+
configurable: !(bitmap & 2),
|
|
779
|
+
writable: !(bitmap & 4),
|
|
780
|
+
value: value
|
|
781
|
+
};
|
|
782
|
+
};
|
|
783
|
+
|
|
784
|
+
var DESCRIPTORS$6 = descriptors;
|
|
785
|
+
var definePropertyModule$2 = objectDefineProperty;
|
|
786
|
+
var createPropertyDescriptor$2 = createPropertyDescriptor$3;
|
|
787
|
+
|
|
788
|
+
var createNonEnumerableProperty$5 = DESCRIPTORS$6 ? function (object, key, value) {
|
|
789
|
+
return definePropertyModule$2.f(object, key, createPropertyDescriptor$2(1, value));
|
|
790
|
+
} : function (object, key, value) {
|
|
791
|
+
object[key] = value;
|
|
792
|
+
return object;
|
|
793
|
+
};
|
|
794
|
+
|
|
795
|
+
var NATIVE_WEAK_MAP = weakMapBasicDetection;
|
|
796
|
+
var global$7 = global$f;
|
|
797
|
+
var isObject$3 = isObject$8;
|
|
798
|
+
var createNonEnumerableProperty$4 = createNonEnumerableProperty$5;
|
|
799
|
+
var hasOwn$8 = hasOwnProperty_1;
|
|
800
|
+
var shared$1 = sharedStore.exports;
|
|
801
|
+
var sharedKey$1 = sharedKey$3;
|
|
802
|
+
var hiddenKeys$1 = hiddenKeys$4;
|
|
803
|
+
|
|
804
|
+
var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
|
|
805
|
+
var TypeError$1 = global$7.TypeError;
|
|
806
|
+
var WeakMap = global$7.WeakMap;
|
|
807
|
+
var set, get, has;
|
|
808
|
+
|
|
809
|
+
var enforce = function (it) {
|
|
810
|
+
return has(it) ? get(it) : set(it, {});
|
|
811
|
+
};
|
|
812
|
+
|
|
813
|
+
var getterFor = function (TYPE) {
|
|
814
|
+
return function (it) {
|
|
815
|
+
var state;
|
|
816
|
+
if (!isObject$3(it) || (state = get(it)).type !== TYPE) {
|
|
817
|
+
throw new TypeError$1('Incompatible receiver, ' + TYPE + ' required');
|
|
818
|
+
} return state;
|
|
819
|
+
};
|
|
820
|
+
};
|
|
821
|
+
|
|
822
|
+
if (NATIVE_WEAK_MAP || shared$1.state) {
|
|
823
|
+
var store$1 = shared$1.state || (shared$1.state = new WeakMap());
|
|
824
|
+
/* eslint-disable no-self-assign -- prototype methods protection */
|
|
825
|
+
store$1.get = store$1.get;
|
|
826
|
+
store$1.has = store$1.has;
|
|
827
|
+
store$1.set = store$1.set;
|
|
828
|
+
/* eslint-enable no-self-assign -- prototype methods protection */
|
|
829
|
+
set = function (it, metadata) {
|
|
830
|
+
if (store$1.has(it)) throw new TypeError$1(OBJECT_ALREADY_INITIALIZED);
|
|
831
|
+
metadata.facade = it;
|
|
832
|
+
store$1.set(it, metadata);
|
|
833
|
+
return metadata;
|
|
834
|
+
};
|
|
835
|
+
get = function (it) {
|
|
836
|
+
return store$1.get(it) || {};
|
|
837
|
+
};
|
|
838
|
+
has = function (it) {
|
|
839
|
+
return store$1.has(it);
|
|
840
|
+
};
|
|
841
|
+
} else {
|
|
842
|
+
var STATE = sharedKey$1('state');
|
|
843
|
+
hiddenKeys$1[STATE] = true;
|
|
844
|
+
set = function (it, metadata) {
|
|
845
|
+
if (hasOwn$8(it, STATE)) throw new TypeError$1(OBJECT_ALREADY_INITIALIZED);
|
|
846
|
+
metadata.facade = it;
|
|
847
|
+
createNonEnumerableProperty$4(it, STATE, metadata);
|
|
848
|
+
return metadata;
|
|
849
|
+
};
|
|
850
|
+
get = function (it) {
|
|
851
|
+
return hasOwn$8(it, STATE) ? it[STATE] : {};
|
|
852
|
+
};
|
|
853
|
+
has = function (it) {
|
|
854
|
+
return hasOwn$8(it, STATE);
|
|
855
|
+
};
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
var internalState = {
|
|
859
|
+
set: set,
|
|
860
|
+
get: get,
|
|
861
|
+
has: has,
|
|
862
|
+
enforce: enforce,
|
|
863
|
+
getterFor: getterFor
|
|
864
|
+
};
|
|
865
|
+
|
|
866
|
+
var objectGetOwnPropertyDescriptor = {};
|
|
867
|
+
|
|
868
|
+
var objectPropertyIsEnumerable = {};
|
|
869
|
+
|
|
870
|
+
var $propertyIsEnumerable = {}.propertyIsEnumerable;
|
|
871
|
+
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
872
|
+
var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
|
|
873
|
+
|
|
874
|
+
// Nashorn ~ JDK8 bug
|
|
875
|
+
var NASHORN_BUG = getOwnPropertyDescriptor$1 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
|
|
876
|
+
|
|
877
|
+
// `Object.prototype.propertyIsEnumerable` method implementation
|
|
878
|
+
// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
|
|
879
|
+
objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
|
|
880
|
+
var descriptor = getOwnPropertyDescriptor$1(this, V);
|
|
881
|
+
return !!descriptor && descriptor.enumerable;
|
|
882
|
+
} : $propertyIsEnumerable;
|
|
883
|
+
|
|
884
|
+
var DESCRIPTORS$5 = descriptors;
|
|
885
|
+
var call$8 = functionCall;
|
|
886
|
+
var propertyIsEnumerableModule$1 = objectPropertyIsEnumerable;
|
|
887
|
+
var createPropertyDescriptor$1 = createPropertyDescriptor$3;
|
|
888
|
+
var toIndexedObject$1 = toIndexedObject$5;
|
|
889
|
+
var toPropertyKey = toPropertyKey$2;
|
|
890
|
+
var hasOwn$7 = hasOwnProperty_1;
|
|
891
|
+
var IE8_DOM_DEFINE = ie8DomDefine;
|
|
892
|
+
|
|
893
|
+
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
894
|
+
var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
895
|
+
|
|
896
|
+
// `Object.getOwnPropertyDescriptor` method
|
|
897
|
+
// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
|
|
898
|
+
objectGetOwnPropertyDescriptor.f = DESCRIPTORS$5 ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
|
|
899
|
+
O = toIndexedObject$1(O);
|
|
900
|
+
P = toPropertyKey(P);
|
|
901
|
+
if (IE8_DOM_DEFINE) try {
|
|
902
|
+
return $getOwnPropertyDescriptor(O, P);
|
|
903
|
+
} catch (error) { /* empty */ }
|
|
904
|
+
if (hasOwn$7(O, P)) return createPropertyDescriptor$1(!call$8(propertyIsEnumerableModule$1.f, O, P), O[P]);
|
|
905
|
+
};
|
|
906
|
+
|
|
907
|
+
var makeBuiltIn$3 = {exports: {}};
|
|
908
|
+
|
|
909
|
+
var DESCRIPTORS$4 = descriptors;
|
|
910
|
+
var hasOwn$6 = hasOwnProperty_1;
|
|
911
|
+
|
|
912
|
+
var FunctionPrototype$1 = Function.prototype;
|
|
913
|
+
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
914
|
+
var getDescriptor = DESCRIPTORS$4 && Object.getOwnPropertyDescriptor;
|
|
915
|
+
|
|
916
|
+
var EXISTS = hasOwn$6(FunctionPrototype$1, 'name');
|
|
917
|
+
// additional protection from minified / mangled / dropped function names
|
|
918
|
+
var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
|
|
919
|
+
var CONFIGURABLE = EXISTS && (!DESCRIPTORS$4 || (DESCRIPTORS$4 && getDescriptor(FunctionPrototype$1, 'name').configurable));
|
|
920
|
+
|
|
921
|
+
var functionName = {
|
|
922
|
+
EXISTS: EXISTS,
|
|
923
|
+
PROPER: PROPER,
|
|
924
|
+
CONFIGURABLE: CONFIGURABLE
|
|
925
|
+
};
|
|
926
|
+
|
|
927
|
+
var uncurryThis$a = functionUncurryThis;
|
|
928
|
+
var isCallable$a = isCallable$h;
|
|
929
|
+
var store = sharedStore.exports;
|
|
930
|
+
|
|
931
|
+
var functionToString = uncurryThis$a(Function.toString);
|
|
932
|
+
|
|
933
|
+
// this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
|
|
934
|
+
if (!isCallable$a(store.inspectSource)) {
|
|
935
|
+
store.inspectSource = function (it) {
|
|
936
|
+
return functionToString(it);
|
|
937
|
+
};
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
var inspectSource$1 = store.inspectSource;
|
|
941
|
+
|
|
942
|
+
var uncurryThis$9 = functionUncurryThis;
|
|
943
|
+
var fails$b = fails$i;
|
|
944
|
+
var isCallable$9 = isCallable$h;
|
|
945
|
+
var hasOwn$5 = hasOwnProperty_1;
|
|
946
|
+
var DESCRIPTORS$3 = descriptors;
|
|
947
|
+
var CONFIGURABLE_FUNCTION_NAME$1 = functionName.CONFIGURABLE;
|
|
948
|
+
var inspectSource = inspectSource$1;
|
|
949
|
+
var InternalStateModule$1 = internalState;
|
|
950
|
+
|
|
951
|
+
var enforceInternalState = InternalStateModule$1.enforce;
|
|
952
|
+
var getInternalState$2 = InternalStateModule$1.get;
|
|
953
|
+
var $String$2 = String;
|
|
954
|
+
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
955
|
+
var defineProperty$4 = Object.defineProperty;
|
|
956
|
+
var stringSlice$5 = uncurryThis$9(''.slice);
|
|
957
|
+
var replace$3 = uncurryThis$9(''.replace);
|
|
958
|
+
var join = uncurryThis$9([].join);
|
|
959
|
+
|
|
960
|
+
var CONFIGURABLE_LENGTH = DESCRIPTORS$3 && !fails$b(function () {
|
|
961
|
+
return defineProperty$4(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;
|
|
962
|
+
});
|
|
963
|
+
|
|
964
|
+
var TEMPLATE = String(String).split('String');
|
|
965
|
+
|
|
966
|
+
var makeBuiltIn$2 = makeBuiltIn$3.exports = function (value, name, options) {
|
|
967
|
+
if (stringSlice$5($String$2(name), 0, 7) === 'Symbol(') {
|
|
968
|
+
name = '[' + replace$3($String$2(name), /^Symbol\(([^)]*)\).*$/, '$1') + ']';
|
|
969
|
+
}
|
|
970
|
+
if (options && options.getter) name = 'get ' + name;
|
|
971
|
+
if (options && options.setter) name = 'set ' + name;
|
|
972
|
+
if (!hasOwn$5(value, 'name') || (CONFIGURABLE_FUNCTION_NAME$1 && value.name !== name)) {
|
|
973
|
+
if (DESCRIPTORS$3) defineProperty$4(value, 'name', { value: name, configurable: true });
|
|
974
|
+
else value.name = name;
|
|
975
|
+
}
|
|
976
|
+
if (CONFIGURABLE_LENGTH && options && hasOwn$5(options, 'arity') && value.length !== options.arity) {
|
|
977
|
+
defineProperty$4(value, 'length', { value: options.arity });
|
|
978
|
+
}
|
|
979
|
+
try {
|
|
980
|
+
if (options && hasOwn$5(options, 'constructor') && options.constructor) {
|
|
981
|
+
if (DESCRIPTORS$3) defineProperty$4(value, 'prototype', { writable: false });
|
|
982
|
+
// in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable
|
|
983
|
+
} else if (value.prototype) value.prototype = undefined;
|
|
984
|
+
} catch (error) { /* empty */ }
|
|
985
|
+
var state = enforceInternalState(value);
|
|
986
|
+
if (!hasOwn$5(state, 'source')) {
|
|
987
|
+
state.source = join(TEMPLATE, typeof name == 'string' ? name : '');
|
|
988
|
+
} return value;
|
|
989
|
+
};
|
|
990
|
+
|
|
991
|
+
// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
|
|
992
|
+
// eslint-disable-next-line no-extend-native -- required
|
|
993
|
+
Function.prototype.toString = makeBuiltIn$2(function toString() {
|
|
994
|
+
return isCallable$9(this) && getInternalState$2(this).source || inspectSource(this);
|
|
995
|
+
}, 'toString');
|
|
996
|
+
|
|
997
|
+
var isCallable$8 = isCallable$h;
|
|
998
|
+
var definePropertyModule$1 = objectDefineProperty;
|
|
999
|
+
var makeBuiltIn$1 = makeBuiltIn$3.exports;
|
|
1000
|
+
var defineGlobalProperty$1 = defineGlobalProperty$3;
|
|
1001
|
+
|
|
1002
|
+
var defineBuiltIn$5 = function (O, key, value, options) {
|
|
1003
|
+
if (!options) options = {};
|
|
1004
|
+
var simple = options.enumerable;
|
|
1005
|
+
var name = options.name !== undefined ? options.name : key;
|
|
1006
|
+
if (isCallable$8(value)) makeBuiltIn$1(value, name, options);
|
|
1007
|
+
if (options.global) {
|
|
1008
|
+
if (simple) O[key] = value;
|
|
1009
|
+
else defineGlobalProperty$1(key, value);
|
|
1010
|
+
} else {
|
|
1011
|
+
try {
|
|
1012
|
+
if (!options.unsafe) delete O[key];
|
|
1013
|
+
else if (O[key]) simple = true;
|
|
1014
|
+
} catch (error) { /* empty */ }
|
|
1015
|
+
if (simple) O[key] = value;
|
|
1016
|
+
else definePropertyModule$1.f(O, key, {
|
|
1017
|
+
value: value,
|
|
1018
|
+
enumerable: false,
|
|
1019
|
+
configurable: !options.nonConfigurable,
|
|
1020
|
+
writable: !options.nonWritable
|
|
1021
|
+
});
|
|
1022
|
+
} return O;
|
|
1023
|
+
};
|
|
1024
|
+
|
|
1025
|
+
var objectGetOwnPropertyNames = {};
|
|
1026
|
+
|
|
1027
|
+
var internalObjectKeys = objectKeysInternal;
|
|
1028
|
+
var enumBugKeys = enumBugKeys$3;
|
|
1029
|
+
|
|
1030
|
+
var hiddenKeys = enumBugKeys.concat('length', 'prototype');
|
|
1031
|
+
|
|
1032
|
+
// `Object.getOwnPropertyNames` method
|
|
1033
|
+
// https://tc39.es/ecma262/#sec-object.getownpropertynames
|
|
1034
|
+
// eslint-disable-next-line es/no-object-getownpropertynames -- safe
|
|
1035
|
+
objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
|
|
1036
|
+
return internalObjectKeys(O, hiddenKeys);
|
|
1037
|
+
};
|
|
1038
|
+
|
|
1039
|
+
var objectGetOwnPropertySymbols = {};
|
|
1040
|
+
|
|
1041
|
+
// eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
|
|
1042
|
+
objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
|
|
1043
|
+
|
|
1044
|
+
var getBuiltIn = getBuiltIn$3;
|
|
1045
|
+
var uncurryThis$8 = functionUncurryThis;
|
|
1046
|
+
var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
|
|
1047
|
+
var getOwnPropertySymbolsModule$1 = objectGetOwnPropertySymbols;
|
|
1048
|
+
var anObject$5 = anObject$9;
|
|
1049
|
+
|
|
1050
|
+
var concat$2 = uncurryThis$8([].concat);
|
|
1051
|
+
|
|
1052
|
+
// all object keys, includes non-enumerable and symbols
|
|
1053
|
+
var ownKeys$1 = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
|
|
1054
|
+
var keys = getOwnPropertyNamesModule.f(anObject$5(it));
|
|
1055
|
+
var getOwnPropertySymbols = getOwnPropertySymbolsModule$1.f;
|
|
1056
|
+
return getOwnPropertySymbols ? concat$2(keys, getOwnPropertySymbols(it)) : keys;
|
|
1057
|
+
};
|
|
1058
|
+
|
|
1059
|
+
var hasOwn$4 = hasOwnProperty_1;
|
|
1060
|
+
var ownKeys = ownKeys$1;
|
|
1061
|
+
var getOwnPropertyDescriptorModule = objectGetOwnPropertyDescriptor;
|
|
1062
|
+
var definePropertyModule = objectDefineProperty;
|
|
1063
|
+
|
|
1064
|
+
var copyConstructorProperties$2 = function (target, source, exceptions) {
|
|
1065
|
+
var keys = ownKeys(source);
|
|
1066
|
+
var defineProperty = definePropertyModule.f;
|
|
1067
|
+
var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
|
|
1068
|
+
for (var i = 0; i < keys.length; i++) {
|
|
1069
|
+
var key = keys[i];
|
|
1070
|
+
if (!hasOwn$4(target, key) && !(exceptions && hasOwn$4(exceptions, key))) {
|
|
1071
|
+
defineProperty(target, key, getOwnPropertyDescriptor(source, key));
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
};
|
|
1075
|
+
|
|
1076
|
+
var fails$a = fails$i;
|
|
1077
|
+
var isCallable$7 = isCallable$h;
|
|
1078
|
+
|
|
1079
|
+
var replacement = /#|\.prototype\./;
|
|
1080
|
+
|
|
1081
|
+
var isForced$1 = function (feature, detection) {
|
|
1082
|
+
var value = data[normalize(feature)];
|
|
1083
|
+
return value === POLYFILL ? true
|
|
1084
|
+
: value === NATIVE ? false
|
|
1085
|
+
: isCallable$7(detection) ? fails$a(detection)
|
|
1086
|
+
: !!detection;
|
|
1087
|
+
};
|
|
1088
|
+
|
|
1089
|
+
var normalize = isForced$1.normalize = function (string) {
|
|
1090
|
+
return String(string).replace(replacement, '.').toLowerCase();
|
|
1091
|
+
};
|
|
1092
|
+
|
|
1093
|
+
var data = isForced$1.data = {};
|
|
1094
|
+
var NATIVE = isForced$1.NATIVE = 'N';
|
|
1095
|
+
var POLYFILL = isForced$1.POLYFILL = 'P';
|
|
1096
|
+
|
|
1097
|
+
var isForced_1 = isForced$1;
|
|
1098
|
+
|
|
1099
|
+
var global$6 = global$f;
|
|
1100
|
+
var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
|
|
1101
|
+
var createNonEnumerableProperty$3 = createNonEnumerableProperty$5;
|
|
1102
|
+
var defineBuiltIn$4 = defineBuiltIn$5;
|
|
1103
|
+
var defineGlobalProperty = defineGlobalProperty$3;
|
|
1104
|
+
var copyConstructorProperties$1 = copyConstructorProperties$2;
|
|
1105
|
+
var isForced = isForced_1;
|
|
1106
|
+
|
|
1107
|
+
/*
|
|
1108
|
+
options.target - name of the target object
|
|
1109
|
+
options.global - target is the global object
|
|
1110
|
+
options.stat - export as static methods of target
|
|
1111
|
+
options.proto - export as prototype methods of target
|
|
1112
|
+
options.real - real prototype method for the `pure` version
|
|
1113
|
+
options.forced - export even if the native feature is available
|
|
1114
|
+
options.bind - bind methods to the target, required for the `pure` version
|
|
1115
|
+
options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
|
|
1116
|
+
options.unsafe - use the simple assignment of property instead of delete + defineProperty
|
|
1117
|
+
options.sham - add a flag to not completely full polyfills
|
|
1118
|
+
options.enumerable - export as enumerable property
|
|
1119
|
+
options.dontCallGetSet - prevent calling a getter on target
|
|
1120
|
+
options.name - the .name of the function if it does not match the key
|
|
1121
|
+
*/
|
|
1122
|
+
var _export = function (options, source) {
|
|
1123
|
+
var TARGET = options.target;
|
|
1124
|
+
var GLOBAL = options.global;
|
|
1125
|
+
var STATIC = options.stat;
|
|
1126
|
+
var FORCED, target, key, targetProperty, sourceProperty, descriptor;
|
|
1127
|
+
if (GLOBAL) {
|
|
1128
|
+
target = global$6;
|
|
1129
|
+
} else if (STATIC) {
|
|
1130
|
+
target = global$6[TARGET] || defineGlobalProperty(TARGET, {});
|
|
1131
|
+
} else {
|
|
1132
|
+
target = global$6[TARGET] && global$6[TARGET].prototype;
|
|
1133
|
+
}
|
|
1134
|
+
if (target) for (key in source) {
|
|
1135
|
+
sourceProperty = source[key];
|
|
1136
|
+
if (options.dontCallGetSet) {
|
|
1137
|
+
descriptor = getOwnPropertyDescriptor(target, key);
|
|
1138
|
+
targetProperty = descriptor && descriptor.value;
|
|
1139
|
+
} else targetProperty = target[key];
|
|
1140
|
+
FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
|
|
1141
|
+
// contained in target
|
|
1142
|
+
if (!FORCED && targetProperty !== undefined) {
|
|
1143
|
+
if (typeof sourceProperty == typeof targetProperty) continue;
|
|
1144
|
+
copyConstructorProperties$1(sourceProperty, targetProperty);
|
|
1145
|
+
}
|
|
1146
|
+
// add a flag to not completely full polyfills
|
|
1147
|
+
if (options.sham || (targetProperty && targetProperty.sham)) {
|
|
1148
|
+
createNonEnumerableProperty$3(sourceProperty, 'sham', true);
|
|
1149
|
+
}
|
|
1150
|
+
defineBuiltIn$4(target, key, sourceProperty, options);
|
|
1151
|
+
}
|
|
1152
|
+
};
|
|
1153
|
+
|
|
1154
|
+
var fails$9 = fails$i;
|
|
1155
|
+
|
|
1156
|
+
var correctPrototypeGetter = !fails$9(function () {
|
|
1157
|
+
function F() { /* empty */ }
|
|
1158
|
+
F.prototype.constructor = null;
|
|
1159
|
+
// eslint-disable-next-line es/no-object-getprototypeof -- required for testing
|
|
1160
|
+
return Object.getPrototypeOf(new F()) !== F.prototype;
|
|
1161
|
+
});
|
|
1162
|
+
|
|
1163
|
+
var hasOwn$3 = hasOwnProperty_1;
|
|
1164
|
+
var isCallable$6 = isCallable$h;
|
|
1165
|
+
var toObject$2 = toObject$4;
|
|
1166
|
+
var sharedKey = sharedKey$3;
|
|
1167
|
+
var CORRECT_PROTOTYPE_GETTER = correctPrototypeGetter;
|
|
1168
|
+
|
|
1169
|
+
var IE_PROTO = sharedKey('IE_PROTO');
|
|
1170
|
+
var $Object$1 = Object;
|
|
1171
|
+
var ObjectPrototype = $Object$1.prototype;
|
|
1172
|
+
|
|
1173
|
+
// `Object.getPrototypeOf` method
|
|
1174
|
+
// https://tc39.es/ecma262/#sec-object.getprototypeof
|
|
1175
|
+
// eslint-disable-next-line es/no-object-getprototypeof -- safe
|
|
1176
|
+
var objectGetPrototypeOf = CORRECT_PROTOTYPE_GETTER ? $Object$1.getPrototypeOf : function (O) {
|
|
1177
|
+
var object = toObject$2(O);
|
|
1178
|
+
if (hasOwn$3(object, IE_PROTO)) return object[IE_PROTO];
|
|
1179
|
+
var constructor = object.constructor;
|
|
1180
|
+
if (isCallable$6(constructor) && object instanceof constructor) {
|
|
1181
|
+
return constructor.prototype;
|
|
1182
|
+
} return object instanceof $Object$1 ? ObjectPrototype : null;
|
|
1183
|
+
};
|
|
1184
|
+
|
|
1185
|
+
var fails$8 = fails$i;
|
|
1186
|
+
var isCallable$5 = isCallable$h;
|
|
1187
|
+
var isObject$2 = isObject$8;
|
|
1188
|
+
var getPrototypeOf$1 = objectGetPrototypeOf;
|
|
1189
|
+
var defineBuiltIn$3 = defineBuiltIn$5;
|
|
1190
|
+
var wellKnownSymbol$9 = wellKnownSymbol$c;
|
|
1191
|
+
|
|
1192
|
+
var ITERATOR$2 = wellKnownSymbol$9('iterator');
|
|
1193
|
+
var BUGGY_SAFARI_ITERATORS$1 = false;
|
|
1194
|
+
|
|
1195
|
+
// `%IteratorPrototype%` object
|
|
1196
|
+
// https://tc39.es/ecma262/#sec-%iteratorprototype%-object
|
|
1197
|
+
var IteratorPrototype$2, PrototypeOfArrayIteratorPrototype, arrayIterator;
|
|
1198
|
+
|
|
1199
|
+
/* eslint-disable es/no-array-prototype-keys -- safe */
|
|
1200
|
+
if ([].keys) {
|
|
1201
|
+
arrayIterator = [].keys();
|
|
1202
|
+
// Safari 8 has buggy iterators w/o `next`
|
|
1203
|
+
if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS$1 = true;
|
|
1204
|
+
else {
|
|
1205
|
+
PrototypeOfArrayIteratorPrototype = getPrototypeOf$1(getPrototypeOf$1(arrayIterator));
|
|
1206
|
+
if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype$2 = PrototypeOfArrayIteratorPrototype;
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
var NEW_ITERATOR_PROTOTYPE = !isObject$2(IteratorPrototype$2) || fails$8(function () {
|
|
1211
|
+
var test = {};
|
|
1212
|
+
// FF44- legacy iterators case
|
|
1213
|
+
return IteratorPrototype$2[ITERATOR$2].call(test) !== test;
|
|
1214
|
+
});
|
|
1215
|
+
|
|
1216
|
+
if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype$2 = {};
|
|
1217
|
+
|
|
1218
|
+
// `%IteratorPrototype%[@@iterator]()` method
|
|
1219
|
+
// https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
|
|
1220
|
+
if (!isCallable$5(IteratorPrototype$2[ITERATOR$2])) {
|
|
1221
|
+
defineBuiltIn$3(IteratorPrototype$2, ITERATOR$2, function () {
|
|
1222
|
+
return this;
|
|
1223
|
+
});
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
var iteratorsCore = {
|
|
1227
|
+
IteratorPrototype: IteratorPrototype$2,
|
|
1228
|
+
BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS$1
|
|
1229
|
+
};
|
|
1230
|
+
|
|
1231
|
+
var defineProperty$3 = objectDefineProperty.f;
|
|
1232
|
+
var hasOwn$2 = hasOwnProperty_1;
|
|
1233
|
+
var wellKnownSymbol$8 = wellKnownSymbol$c;
|
|
1234
|
+
|
|
1235
|
+
var TO_STRING_TAG$2 = wellKnownSymbol$8('toStringTag');
|
|
1236
|
+
|
|
1237
|
+
var setToStringTag$3 = function (target, TAG, STATIC) {
|
|
1238
|
+
if (target && !STATIC) target = target.prototype;
|
|
1239
|
+
if (target && !hasOwn$2(target, TO_STRING_TAG$2)) {
|
|
1240
|
+
defineProperty$3(target, TO_STRING_TAG$2, { configurable: true, value: TAG });
|
|
1241
|
+
}
|
|
1242
|
+
};
|
|
1243
|
+
|
|
1244
|
+
var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
|
|
1245
|
+
var create$1 = objectCreate;
|
|
1246
|
+
var createPropertyDescriptor = createPropertyDescriptor$3;
|
|
1247
|
+
var setToStringTag$2 = setToStringTag$3;
|
|
1248
|
+
var Iterators$2 = iterators;
|
|
1249
|
+
|
|
1250
|
+
var returnThis$1 = function () { return this; };
|
|
1251
|
+
|
|
1252
|
+
var iteratorCreateConstructor = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
|
|
1253
|
+
var TO_STRING_TAG = NAME + ' Iterator';
|
|
1254
|
+
IteratorConstructor.prototype = create$1(IteratorPrototype$1, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) });
|
|
1255
|
+
setToStringTag$2(IteratorConstructor, TO_STRING_TAG, false);
|
|
1256
|
+
Iterators$2[TO_STRING_TAG] = returnThis$1;
|
|
1257
|
+
return IteratorConstructor;
|
|
1258
|
+
};
|
|
1259
|
+
|
|
1260
|
+
var uncurryThis$7 = functionUncurryThis;
|
|
1261
|
+
var aCallable = aCallable$2;
|
|
1262
|
+
|
|
1263
|
+
var functionUncurryThisAccessor = function (object, key, method) {
|
|
1264
|
+
try {
|
|
1265
|
+
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
1266
|
+
return uncurryThis$7(aCallable(Object.getOwnPropertyDescriptor(object, key)[method]));
|
|
1267
|
+
} catch (error) { /* empty */ }
|
|
1268
|
+
};
|
|
1269
|
+
|
|
1270
|
+
var isObject$1 = isObject$8;
|
|
1271
|
+
|
|
1272
|
+
var isPossiblePrototype$1 = function (argument) {
|
|
1273
|
+
return isObject$1(argument) || argument === null;
|
|
1274
|
+
};
|
|
1275
|
+
|
|
1276
|
+
var isPossiblePrototype = isPossiblePrototype$1;
|
|
1277
|
+
|
|
1278
|
+
var $String$1 = String;
|
|
1279
|
+
var $TypeError$2 = TypeError;
|
|
1280
|
+
|
|
1281
|
+
var aPossiblePrototype$1 = function (argument) {
|
|
1282
|
+
if (isPossiblePrototype(argument)) return argument;
|
|
1283
|
+
throw new $TypeError$2("Can't set " + $String$1(argument) + ' as a prototype');
|
|
1284
|
+
};
|
|
1285
|
+
|
|
1286
|
+
/* eslint-disable no-proto -- safe */
|
|
1287
|
+
var uncurryThisAccessor = functionUncurryThisAccessor;
|
|
1288
|
+
var anObject$4 = anObject$9;
|
|
1289
|
+
var aPossiblePrototype = aPossiblePrototype$1;
|
|
1290
|
+
|
|
1291
|
+
// `Object.setPrototypeOf` method
|
|
1292
|
+
// https://tc39.es/ecma262/#sec-object.setprototypeof
|
|
1293
|
+
// Works with __proto__ only. Old v8 can't work with null proto objects.
|
|
1294
|
+
// eslint-disable-next-line es/no-object-setprototypeof -- safe
|
|
1295
|
+
var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
|
|
1296
|
+
var CORRECT_SETTER = false;
|
|
1297
|
+
var test = {};
|
|
1298
|
+
var setter;
|
|
1299
|
+
try {
|
|
1300
|
+
setter = uncurryThisAccessor(Object.prototype, '__proto__', 'set');
|
|
1301
|
+
setter(test, []);
|
|
1302
|
+
CORRECT_SETTER = test instanceof Array;
|
|
1303
|
+
} catch (error) { /* empty */ }
|
|
1304
|
+
return function setPrototypeOf(O, proto) {
|
|
1305
|
+
anObject$4(O);
|
|
1306
|
+
aPossiblePrototype(proto);
|
|
1307
|
+
if (CORRECT_SETTER) setter(O, proto);
|
|
1308
|
+
else O.__proto__ = proto;
|
|
1309
|
+
return O;
|
|
1310
|
+
};
|
|
1311
|
+
}() : undefined);
|
|
1312
|
+
|
|
1313
|
+
var $$5 = _export;
|
|
1314
|
+
var call$7 = functionCall;
|
|
1315
|
+
var FunctionName = functionName;
|
|
1316
|
+
var isCallable$4 = isCallable$h;
|
|
1317
|
+
var createIteratorConstructor = iteratorCreateConstructor;
|
|
1318
|
+
var getPrototypeOf = objectGetPrototypeOf;
|
|
1319
|
+
var setPrototypeOf = objectSetPrototypeOf;
|
|
1320
|
+
var setToStringTag$1 = setToStringTag$3;
|
|
1321
|
+
var createNonEnumerableProperty$2 = createNonEnumerableProperty$5;
|
|
1322
|
+
var defineBuiltIn$2 = defineBuiltIn$5;
|
|
1323
|
+
var wellKnownSymbol$7 = wellKnownSymbol$c;
|
|
1324
|
+
var Iterators$1 = iterators;
|
|
1325
|
+
var IteratorsCore = iteratorsCore;
|
|
1326
|
+
|
|
1327
|
+
var PROPER_FUNCTION_NAME$1 = FunctionName.PROPER;
|
|
1328
|
+
var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
|
|
1329
|
+
var IteratorPrototype = IteratorsCore.IteratorPrototype;
|
|
1330
|
+
var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
|
|
1331
|
+
var ITERATOR$1 = wellKnownSymbol$7('iterator');
|
|
1332
|
+
var KEYS = 'keys';
|
|
1333
|
+
var VALUES = 'values';
|
|
1334
|
+
var ENTRIES = 'entries';
|
|
1335
|
+
|
|
1336
|
+
var returnThis = function () { return this; };
|
|
1337
|
+
|
|
1338
|
+
var iteratorDefine = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
|
|
1339
|
+
createIteratorConstructor(IteratorConstructor, NAME, next);
|
|
1340
|
+
|
|
1341
|
+
var getIterationMethod = function (KIND) {
|
|
1342
|
+
if (KIND === DEFAULT && defaultIterator) return defaultIterator;
|
|
1343
|
+
if (!BUGGY_SAFARI_ITERATORS && KIND && KIND in IterablePrototype) return IterablePrototype[KIND];
|
|
1344
|
+
|
|
1345
|
+
switch (KIND) {
|
|
1346
|
+
case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
|
|
1347
|
+
case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
|
|
1348
|
+
case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
return function () { return new IteratorConstructor(this); };
|
|
1352
|
+
};
|
|
1353
|
+
|
|
1354
|
+
var TO_STRING_TAG = NAME + ' Iterator';
|
|
1355
|
+
var INCORRECT_VALUES_NAME = false;
|
|
1356
|
+
var IterablePrototype = Iterable.prototype;
|
|
1357
|
+
var nativeIterator = IterablePrototype[ITERATOR$1]
|
|
1358
|
+
|| IterablePrototype['@@iterator']
|
|
1359
|
+
|| DEFAULT && IterablePrototype[DEFAULT];
|
|
1360
|
+
var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
|
|
1361
|
+
var anyNativeIterator = NAME === 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
|
|
1362
|
+
var CurrentIteratorPrototype, methods, KEY;
|
|
1363
|
+
|
|
1364
|
+
// fix native
|
|
1365
|
+
if (anyNativeIterator) {
|
|
1366
|
+
CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
|
|
1367
|
+
if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
|
|
1368
|
+
if (getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
|
|
1369
|
+
if (setPrototypeOf) {
|
|
1370
|
+
setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
|
|
1371
|
+
} else if (!isCallable$4(CurrentIteratorPrototype[ITERATOR$1])) {
|
|
1372
|
+
defineBuiltIn$2(CurrentIteratorPrototype, ITERATOR$1, returnThis);
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
// Set @@toStringTag to native iterators
|
|
1376
|
+
setToStringTag$1(CurrentIteratorPrototype, TO_STRING_TAG, true);
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1380
|
+
// fix Array.prototype.{ values, @@iterator }.name in V8 / FF
|
|
1381
|
+
if (PROPER_FUNCTION_NAME$1 && DEFAULT === VALUES && nativeIterator && nativeIterator.name !== VALUES) {
|
|
1382
|
+
if (CONFIGURABLE_FUNCTION_NAME) {
|
|
1383
|
+
createNonEnumerableProperty$2(IterablePrototype, 'name', VALUES);
|
|
1384
|
+
} else {
|
|
1385
|
+
INCORRECT_VALUES_NAME = true;
|
|
1386
|
+
defaultIterator = function values() { return call$7(nativeIterator, this); };
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
// export additional methods
|
|
1391
|
+
if (DEFAULT) {
|
|
1392
|
+
methods = {
|
|
1393
|
+
values: getIterationMethod(VALUES),
|
|
1394
|
+
keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
|
|
1395
|
+
entries: getIterationMethod(ENTRIES)
|
|
1396
|
+
};
|
|
1397
|
+
if (FORCED) for (KEY in methods) {
|
|
1398
|
+
if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
|
|
1399
|
+
defineBuiltIn$2(IterablePrototype, KEY, methods[KEY]);
|
|
1400
|
+
}
|
|
1401
|
+
} else $$5({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
|
|
1402
|
+
}
|
|
1403
|
+
|
|
1404
|
+
// define iterator
|
|
1405
|
+
if (IterablePrototype[ITERATOR$1] !== defaultIterator) {
|
|
1406
|
+
defineBuiltIn$2(IterablePrototype, ITERATOR$1, defaultIterator, { name: DEFAULT });
|
|
1407
|
+
}
|
|
1408
|
+
Iterators$1[NAME] = defaultIterator;
|
|
1409
|
+
|
|
1410
|
+
return methods;
|
|
1411
|
+
};
|
|
1412
|
+
|
|
1413
|
+
// `CreateIterResultObject` abstract operation
|
|
1414
|
+
// https://tc39.es/ecma262/#sec-createiterresultobject
|
|
1415
|
+
var createIterResultObject$1 = function (value, done) {
|
|
1416
|
+
return { value: value, done: done };
|
|
1417
|
+
};
|
|
1418
|
+
|
|
1419
|
+
var toIndexedObject = toIndexedObject$5;
|
|
1420
|
+
var addToUnscopables$1 = addToUnscopables$2;
|
|
1421
|
+
var Iterators = iterators;
|
|
1422
|
+
var InternalStateModule = internalState;
|
|
1423
|
+
var defineProperty$2 = objectDefineProperty.f;
|
|
1424
|
+
var defineIterator = iteratorDefine;
|
|
1425
|
+
var createIterResultObject = createIterResultObject$1;
|
|
1426
|
+
var DESCRIPTORS$2 = descriptors;
|
|
1427
|
+
|
|
1428
|
+
var ARRAY_ITERATOR = 'Array Iterator';
|
|
1429
|
+
var setInternalState = InternalStateModule.set;
|
|
1430
|
+
var getInternalState$1 = InternalStateModule.getterFor(ARRAY_ITERATOR);
|
|
1431
|
+
|
|
1432
|
+
// `Array.prototype.entries` method
|
|
1433
|
+
// https://tc39.es/ecma262/#sec-array.prototype.entries
|
|
1434
|
+
// `Array.prototype.keys` method
|
|
1435
|
+
// https://tc39.es/ecma262/#sec-array.prototype.keys
|
|
1436
|
+
// `Array.prototype.values` method
|
|
1437
|
+
// https://tc39.es/ecma262/#sec-array.prototype.values
|
|
1438
|
+
// `Array.prototype[@@iterator]` method
|
|
1439
|
+
// https://tc39.es/ecma262/#sec-array.prototype-@@iterator
|
|
1440
|
+
// `CreateArrayIterator` internal method
|
|
1441
|
+
// https://tc39.es/ecma262/#sec-createarrayiterator
|
|
1442
|
+
var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) {
|
|
1443
|
+
setInternalState(this, {
|
|
1444
|
+
type: ARRAY_ITERATOR,
|
|
1445
|
+
target: toIndexedObject(iterated), // target
|
|
1446
|
+
index: 0, // next index
|
|
1447
|
+
kind: kind // kind
|
|
1448
|
+
});
|
|
1449
|
+
// `%ArrayIteratorPrototype%.next` method
|
|
1450
|
+
// https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
|
|
1451
|
+
}, function () {
|
|
1452
|
+
var state = getInternalState$1(this);
|
|
1453
|
+
var target = state.target;
|
|
1454
|
+
var index = state.index++;
|
|
1455
|
+
if (!target || index >= target.length) {
|
|
1456
|
+
state.target = undefined;
|
|
1457
|
+
return createIterResultObject(undefined, true);
|
|
1458
|
+
}
|
|
1459
|
+
switch (state.kind) {
|
|
1460
|
+
case 'keys': return createIterResultObject(index, false);
|
|
1461
|
+
case 'values': return createIterResultObject(target[index], false);
|
|
1462
|
+
} return createIterResultObject([index, target[index]], false);
|
|
1463
|
+
}, 'values');
|
|
1464
|
+
|
|
1465
|
+
// argumentsList[@@iterator] is %ArrayProto_values%
|
|
1466
|
+
// https://tc39.es/ecma262/#sec-createunmappedargumentsobject
|
|
1467
|
+
// https://tc39.es/ecma262/#sec-createmappedargumentsobject
|
|
1468
|
+
var values = Iterators.Arguments = Iterators.Array;
|
|
1469
|
+
|
|
1470
|
+
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
1471
|
+
addToUnscopables$1('keys');
|
|
1472
|
+
addToUnscopables$1('values');
|
|
1473
|
+
addToUnscopables$1('entries');
|
|
1474
|
+
|
|
1475
|
+
// V8 ~ Chrome 45- bug
|
|
1476
|
+
if (DESCRIPTORS$2 && values.name !== 'values') try {
|
|
1477
|
+
defineProperty$2(values, 'name', { value: 'values' });
|
|
1478
|
+
} catch (error) { /* empty */ }
|
|
1479
|
+
|
|
1480
|
+
// iterable DOM collections
|
|
1481
|
+
// flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
|
|
1482
|
+
var domIterables = {
|
|
1483
|
+
CSSRuleList: 0,
|
|
1484
|
+
CSSStyleDeclaration: 0,
|
|
1485
|
+
CSSValueList: 0,
|
|
1486
|
+
ClientRectList: 0,
|
|
1487
|
+
DOMRectList: 0,
|
|
1488
|
+
DOMStringList: 0,
|
|
1489
|
+
DOMTokenList: 1,
|
|
1490
|
+
DataTransferItemList: 0,
|
|
1491
|
+
FileList: 0,
|
|
1492
|
+
HTMLAllCollection: 0,
|
|
1493
|
+
HTMLCollection: 0,
|
|
1494
|
+
HTMLFormElement: 0,
|
|
1495
|
+
HTMLSelectElement: 0,
|
|
1496
|
+
MediaList: 0,
|
|
1497
|
+
MimeTypeArray: 0,
|
|
1498
|
+
NamedNodeMap: 0,
|
|
1499
|
+
NodeList: 1,
|
|
1500
|
+
PaintRequestList: 0,
|
|
1501
|
+
Plugin: 0,
|
|
1502
|
+
PluginArray: 0,
|
|
1503
|
+
SVGLengthList: 0,
|
|
1504
|
+
SVGNumberList: 0,
|
|
1505
|
+
SVGPathSegList: 0,
|
|
1506
|
+
SVGPointList: 0,
|
|
1507
|
+
SVGStringList: 0,
|
|
1508
|
+
SVGTransformList: 0,
|
|
1509
|
+
SourceBufferList: 0,
|
|
1510
|
+
StyleSheetList: 0,
|
|
1511
|
+
TextTrackCueList: 0,
|
|
1512
|
+
TextTrackList: 0,
|
|
1513
|
+
TouchList: 0
|
|
1514
|
+
};
|
|
1515
|
+
|
|
1516
|
+
// in old WebKit versions, `element.classList` is not an instance of global `DOMTokenList`
|
|
1517
|
+
var documentCreateElement = documentCreateElement$2;
|
|
1518
|
+
|
|
1519
|
+
var classList = documentCreateElement('span').classList;
|
|
1520
|
+
var DOMTokenListPrototype$1 = classList && classList.constructor && classList.constructor.prototype;
|
|
1521
|
+
|
|
1522
|
+
var domTokenListPrototype = DOMTokenListPrototype$1 === Object.prototype ? undefined : DOMTokenListPrototype$1;
|
|
1523
|
+
|
|
1524
|
+
var global$5 = global$f;
|
|
1525
|
+
var DOMIterables = domIterables;
|
|
1526
|
+
var DOMTokenListPrototype = domTokenListPrototype;
|
|
1527
|
+
var ArrayIteratorMethods = es_array_iterator;
|
|
1528
|
+
var createNonEnumerableProperty$1 = createNonEnumerableProperty$5;
|
|
1529
|
+
var setToStringTag = setToStringTag$3;
|
|
1530
|
+
var wellKnownSymbol$6 = wellKnownSymbol$c;
|
|
1531
|
+
|
|
1532
|
+
var ITERATOR = wellKnownSymbol$6('iterator');
|
|
1533
|
+
var ArrayValues = ArrayIteratorMethods.values;
|
|
1534
|
+
|
|
1535
|
+
var handlePrototype = function (CollectionPrototype, COLLECTION_NAME) {
|
|
1536
|
+
if (CollectionPrototype) {
|
|
1537
|
+
// some Chrome versions have non-configurable methods on DOMTokenList
|
|
1538
|
+
if (CollectionPrototype[ITERATOR] !== ArrayValues) try {
|
|
1539
|
+
createNonEnumerableProperty$1(CollectionPrototype, ITERATOR, ArrayValues);
|
|
1540
|
+
} catch (error) {
|
|
1541
|
+
CollectionPrototype[ITERATOR] = ArrayValues;
|
|
1542
|
+
}
|
|
1543
|
+
setToStringTag(CollectionPrototype, COLLECTION_NAME, true);
|
|
1544
|
+
if (DOMIterables[COLLECTION_NAME]) for (var METHOD_NAME in ArrayIteratorMethods) {
|
|
1545
|
+
// some Chrome versions have non-configurable methods on DOMTokenList
|
|
1546
|
+
if (CollectionPrototype[METHOD_NAME] !== ArrayIteratorMethods[METHOD_NAME]) try {
|
|
1547
|
+
createNonEnumerableProperty$1(CollectionPrototype, METHOD_NAME, ArrayIteratorMethods[METHOD_NAME]);
|
|
1548
|
+
} catch (error) {
|
|
1549
|
+
CollectionPrototype[METHOD_NAME] = ArrayIteratorMethods[METHOD_NAME];
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
};
|
|
1554
|
+
|
|
1555
|
+
for (var COLLECTION_NAME in DOMIterables) {
|
|
1556
|
+
handlePrototype(global$5[COLLECTION_NAME] && global$5[COLLECTION_NAME].prototype, COLLECTION_NAME);
|
|
1557
|
+
}
|
|
1558
|
+
|
|
1559
|
+
handlePrototype(DOMTokenListPrototype, 'DOMTokenList');
|
|
1560
|
+
|
|
1561
|
+
var wellKnownSymbol$5 = wellKnownSymbol$c;
|
|
1562
|
+
|
|
1563
|
+
var TO_STRING_TAG$1 = wellKnownSymbol$5('toStringTag');
|
|
1564
|
+
var test = {};
|
|
1565
|
+
|
|
1566
|
+
test[TO_STRING_TAG$1] = 'z';
|
|
1567
|
+
|
|
1568
|
+
var toStringTagSupport = String(test) === '[object z]';
|
|
1569
|
+
|
|
1570
|
+
var TO_STRING_TAG_SUPPORT = toStringTagSupport;
|
|
1571
|
+
var isCallable$3 = isCallable$h;
|
|
1572
|
+
var classofRaw = classofRaw$1;
|
|
1573
|
+
var wellKnownSymbol$4 = wellKnownSymbol$c;
|
|
1574
|
+
|
|
1575
|
+
var TO_STRING_TAG = wellKnownSymbol$4('toStringTag');
|
|
1576
|
+
var $Object = Object;
|
|
1577
|
+
|
|
1578
|
+
// ES3 wrong here
|
|
1579
|
+
var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) === 'Arguments';
|
|
1580
|
+
|
|
1581
|
+
// fallback for IE11 Script Access Denied error
|
|
1582
|
+
var tryGet = function (it, key) {
|
|
1583
|
+
try {
|
|
1584
|
+
return it[key];
|
|
1585
|
+
} catch (error) { /* empty */ }
|
|
1586
|
+
};
|
|
1587
|
+
|
|
1588
|
+
// getting tag from ES6+ `Object.prototype.toString`
|
|
1589
|
+
var classof$3 = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
|
|
1590
|
+
var O, tag, result;
|
|
1591
|
+
return it === undefined ? 'Undefined' : it === null ? 'Null'
|
|
1592
|
+
// @@toStringTag case
|
|
1593
|
+
: typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag
|
|
1594
|
+
// builtinTag case
|
|
1595
|
+
: CORRECT_ARGUMENTS ? classofRaw(O)
|
|
1596
|
+
// ES3 arguments fallback
|
|
1597
|
+
: (result = classofRaw(O)) === 'Object' && isCallable$3(O.callee) ? 'Arguments' : result;
|
|
1598
|
+
};
|
|
1599
|
+
|
|
1600
|
+
var classof$2 = classof$3;
|
|
1601
|
+
|
|
1602
|
+
var $String = String;
|
|
1603
|
+
|
|
1604
|
+
var toString$5 = function (argument) {
|
|
1605
|
+
if (classof$2(argument) === 'Symbol') throw new TypeError('Cannot convert a Symbol value to a string');
|
|
1606
|
+
return $String(argument);
|
|
1607
|
+
};
|
|
1608
|
+
|
|
1609
|
+
var makeBuiltIn = makeBuiltIn$3.exports;
|
|
1610
|
+
var defineProperty$1 = objectDefineProperty;
|
|
1611
|
+
|
|
1612
|
+
var defineBuiltInAccessor$1 = function (target, name, descriptor) {
|
|
1613
|
+
if (descriptor.get) makeBuiltIn(descriptor.get, name, { getter: true });
|
|
1614
|
+
if (descriptor.set) makeBuiltIn(descriptor.set, name, { setter: true });
|
|
1615
|
+
return defineProperty$1.f(target, name, descriptor);
|
|
1616
|
+
};
|
|
1617
|
+
|
|
1618
|
+
var $$4 = _export;
|
|
1619
|
+
var DESCRIPTORS$1 = descriptors;
|
|
1620
|
+
var global$4 = global$f;
|
|
1621
|
+
var uncurryThis$6 = functionUncurryThis;
|
|
1622
|
+
var hasOwn$1 = hasOwnProperty_1;
|
|
1623
|
+
var isCallable$2 = isCallable$h;
|
|
1624
|
+
var isPrototypeOf$1 = objectIsPrototypeOf;
|
|
1625
|
+
var toString$4 = toString$5;
|
|
1626
|
+
var defineBuiltInAccessor = defineBuiltInAccessor$1;
|
|
1627
|
+
var copyConstructorProperties = copyConstructorProperties$2;
|
|
1628
|
+
|
|
1629
|
+
var NativeSymbol = global$4.Symbol;
|
|
1630
|
+
var SymbolPrototype = NativeSymbol && NativeSymbol.prototype;
|
|
1631
|
+
|
|
1632
|
+
if (DESCRIPTORS$1 && isCallable$2(NativeSymbol) && (!('description' in SymbolPrototype) ||
|
|
1633
|
+
// Safari 12 bug
|
|
1634
|
+
NativeSymbol().description !== undefined
|
|
1635
|
+
)) {
|
|
1636
|
+
var EmptyStringDescriptionStore = {};
|
|
1637
|
+
// wrap Symbol constructor for correct work with undefined description
|
|
1638
|
+
var SymbolWrapper = function Symbol() {
|
|
1639
|
+
var description = arguments.length < 1 || arguments[0] === undefined ? undefined : toString$4(arguments[0]);
|
|
1640
|
+
var result = isPrototypeOf$1(SymbolPrototype, this)
|
|
1641
|
+
? new NativeSymbol(description)
|
|
1642
|
+
// in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)'
|
|
1643
|
+
: description === undefined ? NativeSymbol() : NativeSymbol(description);
|
|
1644
|
+
if (description === '') EmptyStringDescriptionStore[result] = true;
|
|
1645
|
+
return result;
|
|
1646
|
+
};
|
|
1647
|
+
|
|
1648
|
+
copyConstructorProperties(SymbolWrapper, NativeSymbol);
|
|
1649
|
+
SymbolWrapper.prototype = SymbolPrototype;
|
|
1650
|
+
SymbolPrototype.constructor = SymbolWrapper;
|
|
1651
|
+
|
|
1652
|
+
var NATIVE_SYMBOL = String(NativeSymbol('description detection')) === 'Symbol(description detection)';
|
|
1653
|
+
var thisSymbolValue = uncurryThis$6(SymbolPrototype.valueOf);
|
|
1654
|
+
var symbolDescriptiveString = uncurryThis$6(SymbolPrototype.toString);
|
|
1655
|
+
var regexp = /^Symbol\((.*)\)[^)]+$/;
|
|
1656
|
+
var replace$2 = uncurryThis$6(''.replace);
|
|
1657
|
+
var stringSlice$4 = uncurryThis$6(''.slice);
|
|
1658
|
+
|
|
1659
|
+
defineBuiltInAccessor(SymbolPrototype, 'description', {
|
|
1660
|
+
configurable: true,
|
|
1661
|
+
get: function description() {
|
|
1662
|
+
var symbol = thisSymbolValue(this);
|
|
1663
|
+
if (hasOwn$1(EmptyStringDescriptionStore, symbol)) return '';
|
|
1664
|
+
var string = symbolDescriptiveString(symbol);
|
|
1665
|
+
var desc = NATIVE_SYMBOL ? stringSlice$4(string, 7, -1) : replace$2(string, regexp, '$1');
|
|
1666
|
+
return desc === '' ? undefined : desc;
|
|
1667
|
+
}
|
|
1668
|
+
});
|
|
1669
|
+
|
|
1670
|
+
$$4({ global: true, constructor: true, forced: true }, {
|
|
1671
|
+
Symbol: SymbolWrapper
|
|
1672
|
+
});
|
|
1673
|
+
}
|
|
1674
|
+
|
|
1675
|
+
var DESCRIPTORS = descriptors;
|
|
1676
|
+
var uncurryThis$5 = functionUncurryThis;
|
|
1677
|
+
var call$6 = functionCall;
|
|
1678
|
+
var fails$7 = fails$i;
|
|
1679
|
+
var objectKeys = objectKeys$2;
|
|
1680
|
+
var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols;
|
|
1681
|
+
var propertyIsEnumerableModule = objectPropertyIsEnumerable;
|
|
1682
|
+
var toObject$1 = toObject$4;
|
|
1683
|
+
var IndexedObject = indexedObject;
|
|
1684
|
+
|
|
1685
|
+
// eslint-disable-next-line es/no-object-assign -- safe
|
|
1686
|
+
var $assign = Object.assign;
|
|
1687
|
+
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
1688
|
+
var defineProperty = Object.defineProperty;
|
|
1689
|
+
var concat$1 = uncurryThis$5([].concat);
|
|
1690
|
+
|
|
1691
|
+
// `Object.assign` method
|
|
1692
|
+
// https://tc39.es/ecma262/#sec-object.assign
|
|
1693
|
+
var objectAssign = !$assign || fails$7(function () {
|
|
1694
|
+
// should have correct order of operations (Edge bug)
|
|
1695
|
+
if (DESCRIPTORS && $assign({ b: 1 }, $assign(defineProperty({}, 'a', {
|
|
1696
|
+
enumerable: true,
|
|
1697
|
+
get: function () {
|
|
1698
|
+
defineProperty(this, 'b', {
|
|
1699
|
+
value: 3,
|
|
1700
|
+
enumerable: false
|
|
1701
|
+
});
|
|
1702
|
+
}
|
|
1703
|
+
}), { b: 2 })).b !== 1) return true;
|
|
1704
|
+
// should work with symbols and should have deterministic property order (V8 bug)
|
|
1705
|
+
var A = {};
|
|
1706
|
+
var B = {};
|
|
1707
|
+
// eslint-disable-next-line es/no-symbol -- safe
|
|
1708
|
+
var symbol = Symbol('assign detection');
|
|
1709
|
+
var alphabet = 'abcdefghijklmnopqrst';
|
|
1710
|
+
A[symbol] = 7;
|
|
1711
|
+
alphabet.split('').forEach(function (chr) { B[chr] = chr; });
|
|
1712
|
+
return $assign({}, A)[symbol] !== 7 || objectKeys($assign({}, B)).join('') !== alphabet;
|
|
1713
|
+
}) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
|
|
1714
|
+
var T = toObject$1(target);
|
|
1715
|
+
var argumentsLength = arguments.length;
|
|
1716
|
+
var index = 1;
|
|
1717
|
+
var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
|
|
1718
|
+
var propertyIsEnumerable = propertyIsEnumerableModule.f;
|
|
1719
|
+
while (argumentsLength > index) {
|
|
1720
|
+
var S = IndexedObject(arguments[index++]);
|
|
1721
|
+
var keys = getOwnPropertySymbols ? concat$1(objectKeys(S), getOwnPropertySymbols(S)) : objectKeys(S);
|
|
1722
|
+
var length = keys.length;
|
|
1723
|
+
var j = 0;
|
|
1724
|
+
var key;
|
|
1725
|
+
while (length > j) {
|
|
1726
|
+
key = keys[j++];
|
|
1727
|
+
if (!DESCRIPTORS || call$6(propertyIsEnumerable, S, key)) T[key] = S[key];
|
|
1728
|
+
}
|
|
1729
|
+
} return T;
|
|
1730
|
+
} : $assign;
|
|
1731
|
+
|
|
1732
|
+
var $$3 = _export;
|
|
1733
|
+
var assign = objectAssign;
|
|
1734
|
+
|
|
1735
|
+
// `Object.assign` method
|
|
1736
|
+
// https://tc39.es/ecma262/#sec-object.assign
|
|
1737
|
+
// eslint-disable-next-line es/no-object-assign -- required for testing
|
|
1738
|
+
$$3({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }, {
|
|
1739
|
+
assign: assign
|
|
1740
|
+
});
|
|
1741
|
+
|
|
1742
|
+
var anObject$3 = anObject$9;
|
|
1743
|
+
|
|
1744
|
+
// `RegExp.prototype.flags` getter implementation
|
|
1745
|
+
// https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
|
|
1746
|
+
var regexpFlags$1 = function () {
|
|
1747
|
+
var that = anObject$3(this);
|
|
1748
|
+
var result = '';
|
|
1749
|
+
if (that.hasIndices) result += 'd';
|
|
1750
|
+
if (that.global) result += 'g';
|
|
1751
|
+
if (that.ignoreCase) result += 'i';
|
|
1752
|
+
if (that.multiline) result += 'm';
|
|
1753
|
+
if (that.dotAll) result += 's';
|
|
1754
|
+
if (that.unicode) result += 'u';
|
|
1755
|
+
if (that.unicodeSets) result += 'v';
|
|
1756
|
+
if (that.sticky) result += 'y';
|
|
1757
|
+
return result;
|
|
1758
|
+
};
|
|
1759
|
+
|
|
1760
|
+
var fails$6 = fails$i;
|
|
1761
|
+
var global$3 = global$f;
|
|
1762
|
+
|
|
1763
|
+
// babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
|
|
1764
|
+
var $RegExp$2 = global$3.RegExp;
|
|
1765
|
+
|
|
1766
|
+
var UNSUPPORTED_Y$1 = fails$6(function () {
|
|
1767
|
+
var re = $RegExp$2('a', 'y');
|
|
1768
|
+
re.lastIndex = 2;
|
|
1769
|
+
return re.exec('abcd') !== null;
|
|
1770
|
+
});
|
|
1771
|
+
|
|
1772
|
+
// UC Browser bug
|
|
1773
|
+
// https://github.com/zloirock/core-js/issues/1008
|
|
1774
|
+
var MISSED_STICKY = UNSUPPORTED_Y$1 || fails$6(function () {
|
|
1775
|
+
return !$RegExp$2('a', 'y').sticky;
|
|
1776
|
+
});
|
|
1777
|
+
|
|
1778
|
+
var BROKEN_CARET = UNSUPPORTED_Y$1 || fails$6(function () {
|
|
1779
|
+
// https://bugzilla.mozilla.org/show_bug.cgi?id=773687
|
|
1780
|
+
var re = $RegExp$2('^r', 'gy');
|
|
1781
|
+
re.lastIndex = 2;
|
|
1782
|
+
return re.exec('str') !== null;
|
|
1783
|
+
});
|
|
1784
|
+
|
|
1785
|
+
var regexpStickyHelpers = {
|
|
1786
|
+
BROKEN_CARET: BROKEN_CARET,
|
|
1787
|
+
MISSED_STICKY: MISSED_STICKY,
|
|
1788
|
+
UNSUPPORTED_Y: UNSUPPORTED_Y$1
|
|
1789
|
+
};
|
|
1790
|
+
|
|
1791
|
+
var fails$5 = fails$i;
|
|
1792
|
+
var global$2 = global$f;
|
|
1793
|
+
|
|
1794
|
+
// babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError
|
|
1795
|
+
var $RegExp$1 = global$2.RegExp;
|
|
1796
|
+
|
|
1797
|
+
var regexpUnsupportedDotAll = fails$5(function () {
|
|
1798
|
+
var re = $RegExp$1('.', 's');
|
|
1799
|
+
return !(re.dotAll && re.test('\n') && re.flags === 's');
|
|
1800
|
+
});
|
|
1801
|
+
|
|
1802
|
+
var fails$4 = fails$i;
|
|
1803
|
+
var global$1 = global$f;
|
|
1804
|
+
|
|
1805
|
+
// babel-minify and Closure Compiler transpiles RegExp('(?<a>b)', 'g') -> /(?<a>b)/g and it causes SyntaxError
|
|
1806
|
+
var $RegExp = global$1.RegExp;
|
|
1807
|
+
|
|
1808
|
+
var regexpUnsupportedNcg = fails$4(function () {
|
|
1809
|
+
var re = $RegExp('(?<a>b)', 'g');
|
|
1810
|
+
return re.exec('b').groups.a !== 'b' ||
|
|
1811
|
+
'b'.replace(re, '$<a>c') !== 'bc';
|
|
1812
|
+
});
|
|
1813
|
+
|
|
1814
|
+
/* eslint-disable regexp/no-empty-capturing-group, regexp/no-empty-group, regexp/no-lazy-ends -- testing */
|
|
1815
|
+
/* eslint-disable regexp/no-useless-quantifier -- testing */
|
|
1816
|
+
var call$5 = functionCall;
|
|
1817
|
+
var uncurryThis$4 = functionUncurryThis;
|
|
1818
|
+
var toString$3 = toString$5;
|
|
1819
|
+
var regexpFlags = regexpFlags$1;
|
|
1820
|
+
var stickyHelpers = regexpStickyHelpers;
|
|
1821
|
+
var shared = shared$4;
|
|
1822
|
+
var create = objectCreate;
|
|
1823
|
+
var getInternalState = internalState.get;
|
|
1824
|
+
var UNSUPPORTED_DOT_ALL = regexpUnsupportedDotAll;
|
|
1825
|
+
var UNSUPPORTED_NCG = regexpUnsupportedNcg;
|
|
1826
|
+
|
|
1827
|
+
var nativeReplace = shared('native-string-replace', String.prototype.replace);
|
|
1828
|
+
var nativeExec = RegExp.prototype.exec;
|
|
1829
|
+
var patchedExec = nativeExec;
|
|
1830
|
+
var charAt$3 = uncurryThis$4(''.charAt);
|
|
1831
|
+
var indexOf = uncurryThis$4(''.indexOf);
|
|
1832
|
+
var replace$1 = uncurryThis$4(''.replace);
|
|
1833
|
+
var stringSlice$3 = uncurryThis$4(''.slice);
|
|
1834
|
+
|
|
1835
|
+
var UPDATES_LAST_INDEX_WRONG = (function () {
|
|
1836
|
+
var re1 = /a/;
|
|
1837
|
+
var re2 = /b*/g;
|
|
1838
|
+
call$5(nativeExec, re1, 'a');
|
|
1839
|
+
call$5(nativeExec, re2, 'a');
|
|
1840
|
+
return re1.lastIndex !== 0 || re2.lastIndex !== 0;
|
|
1841
|
+
})();
|
|
1842
|
+
|
|
1843
|
+
var UNSUPPORTED_Y = stickyHelpers.BROKEN_CARET;
|
|
1844
|
+
|
|
1845
|
+
// nonparticipating capturing group, copied from es5-shim's String#split patch.
|
|
1846
|
+
var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
|
|
1847
|
+
|
|
1848
|
+
var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y || UNSUPPORTED_DOT_ALL || UNSUPPORTED_NCG;
|
|
1849
|
+
|
|
1850
|
+
if (PATCH) {
|
|
1851
|
+
patchedExec = function exec(string) {
|
|
1852
|
+
var re = this;
|
|
1853
|
+
var state = getInternalState(re);
|
|
1854
|
+
var str = toString$3(string);
|
|
1855
|
+
var raw = state.raw;
|
|
1856
|
+
var result, reCopy, lastIndex, match, i, object, group;
|
|
1857
|
+
|
|
1858
|
+
if (raw) {
|
|
1859
|
+
raw.lastIndex = re.lastIndex;
|
|
1860
|
+
result = call$5(patchedExec, raw, str);
|
|
1861
|
+
re.lastIndex = raw.lastIndex;
|
|
1862
|
+
return result;
|
|
1863
|
+
}
|
|
1864
|
+
|
|
1865
|
+
var groups = state.groups;
|
|
1866
|
+
var sticky = UNSUPPORTED_Y && re.sticky;
|
|
1867
|
+
var flags = call$5(regexpFlags, re);
|
|
1868
|
+
var source = re.source;
|
|
1869
|
+
var charsAdded = 0;
|
|
1870
|
+
var strCopy = str;
|
|
1871
|
+
|
|
1872
|
+
if (sticky) {
|
|
1873
|
+
flags = replace$1(flags, 'y', '');
|
|
1874
|
+
if (indexOf(flags, 'g') === -1) {
|
|
1875
|
+
flags += 'g';
|
|
1876
|
+
}
|
|
1877
|
+
|
|
1878
|
+
strCopy = stringSlice$3(str, re.lastIndex);
|
|
1879
|
+
// Support anchored sticky behavior.
|
|
1880
|
+
if (re.lastIndex > 0 && (!re.multiline || re.multiline && charAt$3(str, re.lastIndex - 1) !== '\n')) {
|
|
1881
|
+
source = '(?: ' + source + ')';
|
|
1882
|
+
strCopy = ' ' + strCopy;
|
|
1883
|
+
charsAdded++;
|
|
1884
|
+
}
|
|
1885
|
+
// ^(? + rx + ) is needed, in combination with some str slicing, to
|
|
1886
|
+
// simulate the 'y' flag.
|
|
1887
|
+
reCopy = new RegExp('^(?:' + source + ')', flags);
|
|
1888
|
+
}
|
|
1889
|
+
|
|
1890
|
+
if (NPCG_INCLUDED) {
|
|
1891
|
+
reCopy = new RegExp('^' + source + '$(?!\\s)', flags);
|
|
1892
|
+
}
|
|
1893
|
+
if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
|
|
1894
|
+
|
|
1895
|
+
match = call$5(nativeExec, sticky ? reCopy : re, strCopy);
|
|
1896
|
+
|
|
1897
|
+
if (sticky) {
|
|
1898
|
+
if (match) {
|
|
1899
|
+
match.input = stringSlice$3(match.input, charsAdded);
|
|
1900
|
+
match[0] = stringSlice$3(match[0], charsAdded);
|
|
1901
|
+
match.index = re.lastIndex;
|
|
1902
|
+
re.lastIndex += match[0].length;
|
|
1903
|
+
} else re.lastIndex = 0;
|
|
1904
|
+
} else if (UPDATES_LAST_INDEX_WRONG && match) {
|
|
1905
|
+
re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
|
|
1906
|
+
}
|
|
1907
|
+
if (NPCG_INCLUDED && match && match.length > 1) {
|
|
1908
|
+
// Fix browsers whose `exec` methods don't consistently return `undefined`
|
|
1909
|
+
// for NPCG, like IE8. NOTE: This doesn't work for /(.?)?/
|
|
1910
|
+
call$5(nativeReplace, match[0], reCopy, function () {
|
|
1911
|
+
for (i = 1; i < arguments.length - 2; i++) {
|
|
1912
|
+
if (arguments[i] === undefined) match[i] = undefined;
|
|
1913
|
+
}
|
|
1914
|
+
});
|
|
1915
|
+
}
|
|
1916
|
+
|
|
1917
|
+
if (match && groups) {
|
|
1918
|
+
match.groups = object = create(null);
|
|
1919
|
+
for (i = 0; i < groups.length; i++) {
|
|
1920
|
+
group = groups[i];
|
|
1921
|
+
object[group[0]] = match[group[1]];
|
|
1922
|
+
}
|
|
1923
|
+
}
|
|
1924
|
+
|
|
1925
|
+
return match;
|
|
1926
|
+
};
|
|
1927
|
+
}
|
|
1928
|
+
|
|
1929
|
+
var regexpExec$2 = patchedExec;
|
|
1930
|
+
|
|
1931
|
+
var $$2 = _export;
|
|
1932
|
+
var exec = regexpExec$2;
|
|
1933
|
+
|
|
1934
|
+
// `RegExp.prototype.exec` method
|
|
1935
|
+
// https://tc39.es/ecma262/#sec-regexp.prototype.exec
|
|
1936
|
+
$$2({ target: 'RegExp', proto: true, forced: /./.exec !== exec }, {
|
|
1937
|
+
exec: exec
|
|
1938
|
+
});
|
|
1939
|
+
|
|
1940
|
+
var NATIVE_BIND = functionBindNative;
|
|
1941
|
+
|
|
1942
|
+
var FunctionPrototype = Function.prototype;
|
|
1943
|
+
var apply$1 = FunctionPrototype.apply;
|
|
1944
|
+
var call$4 = FunctionPrototype.call;
|
|
1945
|
+
|
|
1946
|
+
// eslint-disable-next-line es/no-reflect -- safe
|
|
1947
|
+
var functionApply = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND ? call$4.bind(apply$1) : function () {
|
|
1948
|
+
return call$4.apply(apply$1, arguments);
|
|
1949
|
+
});
|
|
1950
|
+
|
|
1951
|
+
// TODO: Remove from `core-js@4` since it's moved to entry points
|
|
1952
|
+
|
|
1953
|
+
var call$3 = functionCall;
|
|
1954
|
+
var defineBuiltIn$1 = defineBuiltIn$5;
|
|
1955
|
+
var regexpExec$1 = regexpExec$2;
|
|
1956
|
+
var fails$3 = fails$i;
|
|
1957
|
+
var wellKnownSymbol$3 = wellKnownSymbol$c;
|
|
1958
|
+
var createNonEnumerableProperty = createNonEnumerableProperty$5;
|
|
1959
|
+
|
|
1960
|
+
var SPECIES = wellKnownSymbol$3('species');
|
|
1961
|
+
var RegExpPrototype$2 = RegExp.prototype;
|
|
1962
|
+
|
|
1963
|
+
var fixRegexpWellKnownSymbolLogic = function (KEY, exec, FORCED, SHAM) {
|
|
1964
|
+
var SYMBOL = wellKnownSymbol$3(KEY);
|
|
1965
|
+
|
|
1966
|
+
var DELEGATES_TO_SYMBOL = !fails$3(function () {
|
|
1967
|
+
// String methods call symbol-named RegExp methods
|
|
1968
|
+
var O = {};
|
|
1969
|
+
O[SYMBOL] = function () { return 7; };
|
|
1970
|
+
return ''[KEY](O) !== 7;
|
|
1971
|
+
});
|
|
1972
|
+
|
|
1973
|
+
var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails$3(function () {
|
|
1974
|
+
// Symbol-named RegExp methods call .exec
|
|
1975
|
+
var execCalled = false;
|
|
1976
|
+
var re = /a/;
|
|
1977
|
+
|
|
1978
|
+
if (KEY === 'split') {
|
|
1979
|
+
// We can't use real regex here since it causes deoptimization
|
|
1980
|
+
// and serious performance degradation in V8
|
|
1981
|
+
// https://github.com/zloirock/core-js/issues/306
|
|
1982
|
+
re = {};
|
|
1983
|
+
// RegExp[@@split] doesn't call the regex's exec method, but first creates
|
|
1984
|
+
// a new one. We need to return the patched regex when creating the new one.
|
|
1985
|
+
re.constructor = {};
|
|
1986
|
+
re.constructor[SPECIES] = function () { return re; };
|
|
1987
|
+
re.flags = '';
|
|
1988
|
+
re[SYMBOL] = /./[SYMBOL];
|
|
1989
|
+
}
|
|
1990
|
+
|
|
1991
|
+
re.exec = function () {
|
|
1992
|
+
execCalled = true;
|
|
1993
|
+
return null;
|
|
1994
|
+
};
|
|
1995
|
+
|
|
1996
|
+
re[SYMBOL]('');
|
|
1997
|
+
return !execCalled;
|
|
1998
|
+
});
|
|
1999
|
+
|
|
2000
|
+
if (
|
|
2001
|
+
!DELEGATES_TO_SYMBOL ||
|
|
2002
|
+
!DELEGATES_TO_EXEC ||
|
|
2003
|
+
FORCED
|
|
2004
|
+
) {
|
|
2005
|
+
var nativeRegExpMethod = /./[SYMBOL];
|
|
2006
|
+
var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
|
|
2007
|
+
var $exec = regexp.exec;
|
|
2008
|
+
if ($exec === regexpExec$1 || $exec === RegExpPrototype$2.exec) {
|
|
2009
|
+
if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
|
|
2010
|
+
// The native String method already delegates to @@method (this
|
|
2011
|
+
// polyfilled function), leasing to infinite recursion.
|
|
2012
|
+
// We avoid it by directly calling the native @@method method.
|
|
2013
|
+
return { done: true, value: call$3(nativeRegExpMethod, regexp, str, arg2) };
|
|
2014
|
+
}
|
|
2015
|
+
return { done: true, value: call$3(nativeMethod, str, regexp, arg2) };
|
|
2016
|
+
}
|
|
2017
|
+
return { done: false };
|
|
2018
|
+
});
|
|
2019
|
+
|
|
2020
|
+
defineBuiltIn$1(String.prototype, KEY, methods[0]);
|
|
2021
|
+
defineBuiltIn$1(RegExpPrototype$2, SYMBOL, methods[1]);
|
|
2022
|
+
}
|
|
2023
|
+
|
|
2024
|
+
if (SHAM) createNonEnumerableProperty(RegExpPrototype$2[SYMBOL], 'sham', true);
|
|
2025
|
+
};
|
|
2026
|
+
|
|
2027
|
+
var uncurryThis$3 = functionUncurryThis;
|
|
2028
|
+
var toIntegerOrInfinity$1 = toIntegerOrInfinity$4;
|
|
2029
|
+
var toString$2 = toString$5;
|
|
2030
|
+
var requireObjectCoercible$2 = requireObjectCoercible$5;
|
|
2031
|
+
|
|
2032
|
+
var charAt$2 = uncurryThis$3(''.charAt);
|
|
2033
|
+
var charCodeAt = uncurryThis$3(''.charCodeAt);
|
|
2034
|
+
var stringSlice$2 = uncurryThis$3(''.slice);
|
|
2035
|
+
|
|
2036
|
+
var createMethod = function (CONVERT_TO_STRING) {
|
|
2037
|
+
return function ($this, pos) {
|
|
2038
|
+
var S = toString$2(requireObjectCoercible$2($this));
|
|
2039
|
+
var position = toIntegerOrInfinity$1(pos);
|
|
2040
|
+
var size = S.length;
|
|
2041
|
+
var first, second;
|
|
2042
|
+
if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
|
|
2043
|
+
first = charCodeAt(S, position);
|
|
2044
|
+
return first < 0xD800 || first > 0xDBFF || position + 1 === size
|
|
2045
|
+
|| (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF
|
|
2046
|
+
? CONVERT_TO_STRING
|
|
2047
|
+
? charAt$2(S, position)
|
|
2048
|
+
: first
|
|
2049
|
+
: CONVERT_TO_STRING
|
|
2050
|
+
? stringSlice$2(S, position, position + 2)
|
|
2051
|
+
: (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
|
|
2052
|
+
};
|
|
2053
|
+
};
|
|
2054
|
+
|
|
2055
|
+
var stringMultibyte = {
|
|
2056
|
+
// `String.prototype.codePointAt` method
|
|
2057
|
+
// https://tc39.es/ecma262/#sec-string.prototype.codepointat
|
|
2058
|
+
codeAt: createMethod(false),
|
|
2059
|
+
// `String.prototype.at` method
|
|
2060
|
+
// https://github.com/mathiasbynens/String.prototype.at
|
|
2061
|
+
charAt: createMethod(true)
|
|
2062
|
+
};
|
|
2063
|
+
|
|
2064
|
+
var charAt$1 = stringMultibyte.charAt;
|
|
2065
|
+
|
|
2066
|
+
// `AdvanceStringIndex` abstract operation
|
|
2067
|
+
// https://tc39.es/ecma262/#sec-advancestringindex
|
|
2068
|
+
var advanceStringIndex$1 = function (S, index, unicode) {
|
|
2069
|
+
return index + (unicode ? charAt$1(S, index).length : 1);
|
|
2070
|
+
};
|
|
2071
|
+
|
|
2072
|
+
var uncurryThis$2 = functionUncurryThis;
|
|
2073
|
+
var toObject = toObject$4;
|
|
2074
|
+
|
|
2075
|
+
var floor = Math.floor;
|
|
2076
|
+
var charAt = uncurryThis$2(''.charAt);
|
|
2077
|
+
var replace = uncurryThis$2(''.replace);
|
|
2078
|
+
var stringSlice$1 = uncurryThis$2(''.slice);
|
|
2079
|
+
// eslint-disable-next-line redos/no-vulnerable -- safe
|
|
2080
|
+
var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g;
|
|
2081
|
+
var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g;
|
|
2082
|
+
|
|
2083
|
+
// `GetSubstitution` abstract operation
|
|
2084
|
+
// https://tc39.es/ecma262/#sec-getsubstitution
|
|
2085
|
+
var getSubstitution$1 = function (matched, str, position, captures, namedCaptures, replacement) {
|
|
2086
|
+
var tailPos = position + matched.length;
|
|
2087
|
+
var m = captures.length;
|
|
2088
|
+
var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
|
|
2089
|
+
if (namedCaptures !== undefined) {
|
|
2090
|
+
namedCaptures = toObject(namedCaptures);
|
|
2091
|
+
symbols = SUBSTITUTION_SYMBOLS;
|
|
2092
|
+
}
|
|
2093
|
+
return replace(replacement, symbols, function (match, ch) {
|
|
2094
|
+
var capture;
|
|
2095
|
+
switch (charAt(ch, 0)) {
|
|
2096
|
+
case '$': return '$';
|
|
2097
|
+
case '&': return matched;
|
|
2098
|
+
case '`': return stringSlice$1(str, 0, position);
|
|
2099
|
+
case "'": return stringSlice$1(str, tailPos);
|
|
2100
|
+
case '<':
|
|
2101
|
+
capture = namedCaptures[stringSlice$1(ch, 1, -1)];
|
|
2102
|
+
break;
|
|
2103
|
+
default: // \d\d?
|
|
2104
|
+
var n = +ch;
|
|
2105
|
+
if (n === 0) return match;
|
|
2106
|
+
if (n > m) {
|
|
2107
|
+
var f = floor(n / 10);
|
|
2108
|
+
if (f === 0) return match;
|
|
2109
|
+
if (f <= m) return captures[f - 1] === undefined ? charAt(ch, 1) : captures[f - 1] + charAt(ch, 1);
|
|
2110
|
+
return match;
|
|
2111
|
+
}
|
|
2112
|
+
capture = captures[n - 1];
|
|
2113
|
+
}
|
|
2114
|
+
return capture === undefined ? '' : capture;
|
|
2115
|
+
});
|
|
2116
|
+
};
|
|
2117
|
+
|
|
2118
|
+
var call$2 = functionCall;
|
|
2119
|
+
var anObject$2 = anObject$9;
|
|
2120
|
+
var isCallable$1 = isCallable$h;
|
|
2121
|
+
var classof$1 = classofRaw$1;
|
|
2122
|
+
var regexpExec = regexpExec$2;
|
|
2123
|
+
|
|
2124
|
+
var $TypeError$1 = TypeError;
|
|
2125
|
+
|
|
2126
|
+
// `RegExpExec` abstract operation
|
|
2127
|
+
// https://tc39.es/ecma262/#sec-regexpexec
|
|
2128
|
+
var regexpExecAbstract = function (R, S) {
|
|
2129
|
+
var exec = R.exec;
|
|
2130
|
+
if (isCallable$1(exec)) {
|
|
2131
|
+
var result = call$2(exec, R, S);
|
|
2132
|
+
if (result !== null) anObject$2(result);
|
|
2133
|
+
return result;
|
|
2134
|
+
}
|
|
2135
|
+
if (classof$1(R) === 'RegExp') return call$2(regexpExec, R, S);
|
|
2136
|
+
throw new $TypeError$1('RegExp#exec called on incompatible receiver');
|
|
2137
|
+
};
|
|
2138
|
+
|
|
2139
|
+
var apply = functionApply;
|
|
2140
|
+
var call$1 = functionCall;
|
|
2141
|
+
var uncurryThis$1 = functionUncurryThis;
|
|
2142
|
+
var fixRegExpWellKnownSymbolLogic = fixRegexpWellKnownSymbolLogic;
|
|
2143
|
+
var fails$2 = fails$i;
|
|
2144
|
+
var anObject$1 = anObject$9;
|
|
2145
|
+
var isCallable = isCallable$h;
|
|
2146
|
+
var isNullOrUndefined = isNullOrUndefined$3;
|
|
2147
|
+
var toIntegerOrInfinity = toIntegerOrInfinity$4;
|
|
2148
|
+
var toLength = toLength$2;
|
|
2149
|
+
var toString$1 = toString$5;
|
|
2150
|
+
var requireObjectCoercible$1 = requireObjectCoercible$5;
|
|
2151
|
+
var advanceStringIndex = advanceStringIndex$1;
|
|
2152
|
+
var getMethod = getMethod$2;
|
|
2153
|
+
var getSubstitution = getSubstitution$1;
|
|
2154
|
+
var regExpExec = regexpExecAbstract;
|
|
2155
|
+
var wellKnownSymbol$2 = wellKnownSymbol$c;
|
|
2156
|
+
|
|
2157
|
+
var REPLACE = wellKnownSymbol$2('replace');
|
|
2158
|
+
var max = Math.max;
|
|
2159
|
+
var min = Math.min;
|
|
2160
|
+
var concat = uncurryThis$1([].concat);
|
|
2161
|
+
var push = uncurryThis$1([].push);
|
|
2162
|
+
var stringIndexOf$1 = uncurryThis$1(''.indexOf);
|
|
2163
|
+
var stringSlice = uncurryThis$1(''.slice);
|
|
2164
|
+
|
|
2165
|
+
var maybeToString = function (it) {
|
|
2166
|
+
return it === undefined ? it : String(it);
|
|
2167
|
+
};
|
|
2168
|
+
|
|
2169
|
+
// IE <= 11 replaces $0 with the whole match, as if it was $&
|
|
2170
|
+
// https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
|
|
2171
|
+
var REPLACE_KEEPS_$0 = (function () {
|
|
2172
|
+
// eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing
|
|
2173
|
+
return 'a'.replace(/./, '$0') === '$0';
|
|
2174
|
+
})();
|
|
2175
|
+
|
|
2176
|
+
// Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string
|
|
2177
|
+
var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
|
|
2178
|
+
if (/./[REPLACE]) {
|
|
2179
|
+
return /./[REPLACE]('a', '$0') === '';
|
|
2180
|
+
}
|
|
2181
|
+
return false;
|
|
2182
|
+
})();
|
|
2183
|
+
|
|
2184
|
+
var REPLACE_SUPPORTS_NAMED_GROUPS = !fails$2(function () {
|
|
2185
|
+
var re = /./;
|
|
2186
|
+
re.exec = function () {
|
|
2187
|
+
var result = [];
|
|
2188
|
+
result.groups = { a: '7' };
|
|
2189
|
+
return result;
|
|
2190
|
+
};
|
|
2191
|
+
// eslint-disable-next-line regexp/no-useless-dollar-replacements -- false positive
|
|
2192
|
+
return ''.replace(re, '$<a>') !== '7';
|
|
2193
|
+
});
|
|
2194
|
+
|
|
2195
|
+
// @@replace logic
|
|
2196
|
+
fixRegExpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNative) {
|
|
2197
|
+
var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';
|
|
2198
|
+
|
|
2199
|
+
return [
|
|
2200
|
+
// `String.prototype.replace` method
|
|
2201
|
+
// https://tc39.es/ecma262/#sec-string.prototype.replace
|
|
2202
|
+
function replace(searchValue, replaceValue) {
|
|
2203
|
+
var O = requireObjectCoercible$1(this);
|
|
2204
|
+
var replacer = isNullOrUndefined(searchValue) ? undefined : getMethod(searchValue, REPLACE);
|
|
2205
|
+
return replacer
|
|
2206
|
+
? call$1(replacer, searchValue, O, replaceValue)
|
|
2207
|
+
: call$1(nativeReplace, toString$1(O), searchValue, replaceValue);
|
|
2208
|
+
},
|
|
2209
|
+
// `RegExp.prototype[@@replace]` method
|
|
2210
|
+
// https://tc39.es/ecma262/#sec-regexp.prototype-@@replace
|
|
2211
|
+
function (string, replaceValue) {
|
|
2212
|
+
var rx = anObject$1(this);
|
|
2213
|
+
var S = toString$1(string);
|
|
2214
|
+
|
|
2215
|
+
if (
|
|
2216
|
+
typeof replaceValue == 'string' &&
|
|
2217
|
+
stringIndexOf$1(replaceValue, UNSAFE_SUBSTITUTE) === -1 &&
|
|
2218
|
+
stringIndexOf$1(replaceValue, '$<') === -1
|
|
2219
|
+
) {
|
|
2220
|
+
var res = maybeCallNative(nativeReplace, rx, S, replaceValue);
|
|
2221
|
+
if (res.done) return res.value;
|
|
2222
|
+
}
|
|
2223
|
+
|
|
2224
|
+
var functionalReplace = isCallable(replaceValue);
|
|
2225
|
+
if (!functionalReplace) replaceValue = toString$1(replaceValue);
|
|
2226
|
+
|
|
2227
|
+
var global = rx.global;
|
|
2228
|
+
var fullUnicode;
|
|
2229
|
+
if (global) {
|
|
2230
|
+
fullUnicode = rx.unicode;
|
|
2231
|
+
rx.lastIndex = 0;
|
|
2232
|
+
}
|
|
2233
|
+
|
|
2234
|
+
var results = [];
|
|
2235
|
+
var result;
|
|
2236
|
+
while (true) {
|
|
2237
|
+
result = regExpExec(rx, S);
|
|
2238
|
+
if (result === null) break;
|
|
2239
|
+
|
|
2240
|
+
push(results, result);
|
|
2241
|
+
if (!global) break;
|
|
2242
|
+
|
|
2243
|
+
var matchStr = toString$1(result[0]);
|
|
2244
|
+
if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
|
|
2245
|
+
}
|
|
2246
|
+
|
|
2247
|
+
var accumulatedResult = '';
|
|
2248
|
+
var nextSourcePosition = 0;
|
|
2249
|
+
for (var i = 0; i < results.length; i++) {
|
|
2250
|
+
result = results[i];
|
|
2251
|
+
|
|
2252
|
+
var matched = toString$1(result[0]);
|
|
2253
|
+
var position = max(min(toIntegerOrInfinity(result.index), S.length), 0);
|
|
2254
|
+
var captures = [];
|
|
2255
|
+
var replacement;
|
|
2256
|
+
// NOTE: This is equivalent to
|
|
2257
|
+
// captures = result.slice(1).map(maybeToString)
|
|
2258
|
+
// but for some reason `nativeSlice.call(result, 1, result.length)` (called in
|
|
2259
|
+
// the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
|
|
2260
|
+
// causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
|
|
2261
|
+
for (var j = 1; j < result.length; j++) push(captures, maybeToString(result[j]));
|
|
2262
|
+
var namedCaptures = result.groups;
|
|
2263
|
+
if (functionalReplace) {
|
|
2264
|
+
var replacerArgs = concat([matched], captures, position, S);
|
|
2265
|
+
if (namedCaptures !== undefined) push(replacerArgs, namedCaptures);
|
|
2266
|
+
replacement = toString$1(apply(replaceValue, undefined, replacerArgs));
|
|
2267
|
+
} else {
|
|
2268
|
+
replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
|
|
2269
|
+
}
|
|
2270
|
+
if (position >= nextSourcePosition) {
|
|
2271
|
+
accumulatedResult += stringSlice(S, nextSourcePosition, position) + replacement;
|
|
2272
|
+
nextSourcePosition = position + matched.length;
|
|
2273
|
+
}
|
|
2274
|
+
}
|
|
2275
|
+
|
|
2276
|
+
return accumulatedResult + stringSlice(S, nextSourcePosition);
|
|
2277
|
+
}
|
|
2278
|
+
];
|
|
2279
|
+
}, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);
|
|
2280
|
+
|
|
2281
|
+
/**
|
|
2282
|
+
* Sets the first word to be capitalized so that it is sentence cased.
|
|
2283
|
+
* @param words
|
|
2284
|
+
* @returns sentence word string.
|
|
2285
|
+
*/
|
|
2286
|
+
const capitalizeFirstLetter = words => {
|
|
2287
|
+
const value = words.charAt(0).toUpperCase() + words.slice(1).toLowerCase();
|
|
2288
|
+
return value;
|
|
2289
|
+
};
|
|
2290
|
+
/**
|
|
2291
|
+
* Compares the scope name and the label to determine if it matches so that it can be sentence case.
|
|
2292
|
+
* @param scope - format eg: '#/properties/firstName'
|
|
2293
|
+
* @param label - The label text
|
|
2294
|
+
* @returns true if the scope and label matches, otherwise false
|
|
2295
|
+
*/
|
|
2296
|
+
const controlScopeMatchesLabel = (scope, label) => {
|
|
2297
|
+
var _a, _b, _c;
|
|
2298
|
+
// Get the property name in the string from the scope
|
|
2299
|
+
const splitIdName = (_c = (_b = (_a = scope.replace(' ', '').split('/')) === null || _a === void 0 ? void 0 : _a.at(-1)) === null || _b === void 0 ? void 0 : _b.toLowerCase()) !== null && _c !== void 0 ? _c : '';
|
|
2300
|
+
const labelWithNoSpaces = label.replace(' ', '').toLowerCase();
|
|
2301
|
+
if (splitIdName === labelWithNoSpaces) {
|
|
2302
|
+
return true;
|
|
2303
|
+
}
|
|
2304
|
+
return false;
|
|
2305
|
+
};
|
|
2306
|
+
/**
|
|
2307
|
+
* Gets the label text in sentence case
|
|
2308
|
+
* @param scope
|
|
2309
|
+
* @param label
|
|
2310
|
+
* @returns
|
|
2311
|
+
*/
|
|
2312
|
+
const getLabelText = (scope, label) => {
|
|
2313
|
+
let labelToUpdate = '';
|
|
2314
|
+
if (controlScopeMatchesLabel(scope, label || '')) {
|
|
2315
|
+
labelToUpdate = capitalizeFirstLetter(label || '');
|
|
2316
|
+
} else {
|
|
2317
|
+
labelToUpdate = label || '';
|
|
2318
|
+
}
|
|
2319
|
+
return labelToUpdate;
|
|
2320
|
+
};
|
|
2321
|
+
const isEmptyBoolean = (schema, data) => {
|
|
2322
|
+
return schema.type !== undefined && schema.type === 'boolean' && (data === null || data === undefined);
|
|
2323
|
+
};
|
|
2324
|
+
const isEmptyNumber = (schema, data) => {
|
|
2325
|
+
return data === '' || data === undefined || data === null || (schema.type === 'number' || schema.type === 'integer') && isNaN(+data);
|
|
2326
|
+
};
|
|
2327
|
+
/**
|
|
2328
|
+
* Check if a required, defined input value is valid. Returns an appropriate
|
|
2329
|
+
* error message if not.
|
|
2330
|
+
* @param props
|
|
2331
|
+
* @returns error message
|
|
2332
|
+
*/
|
|
2333
|
+
const checkFieldValidity = props => {
|
|
2334
|
+
const {
|
|
2335
|
+
data,
|
|
2336
|
+
errors: ajvErrors,
|
|
2337
|
+
required,
|
|
2338
|
+
label,
|
|
2339
|
+
uischema,
|
|
2340
|
+
schema
|
|
2341
|
+
} = props;
|
|
2342
|
+
const labelToUpdate = getLabelText(uischema.scope, label);
|
|
2343
|
+
if (required) {
|
|
2344
|
+
if (data === undefined) return '';
|
|
2345
|
+
if (schema) {
|
|
2346
|
+
if (isEmptyBoolean(schema, data)) {
|
|
2347
|
+
return `${labelToUpdate} is required`;
|
|
2348
|
+
}
|
|
2349
|
+
if (isEmptyNumber(schema, data)) {
|
|
2350
|
+
return `${labelToUpdate} is required`;
|
|
2351
|
+
}
|
|
2352
|
+
}
|
|
2353
|
+
}
|
|
2354
|
+
return ajvErrors;
|
|
2355
|
+
};
|
|
2356
|
+
/**
|
|
2357
|
+
* Check if the date is a valid date/time
|
|
2358
|
+
*/
|
|
2359
|
+
const isValidDate = function isValidDate(date) {
|
|
2360
|
+
if (date instanceof Date && isFinite(date.getTime())) {
|
|
2361
|
+
return true;
|
|
2362
|
+
} else if (typeof date === 'string' && date.length > 0) {
|
|
2363
|
+
return true;
|
|
2364
|
+
} else {
|
|
2365
|
+
return false;
|
|
2366
|
+
}
|
|
2367
|
+
};
|
|
2368
|
+
|
|
2369
|
+
const GoAInputBaseControl = props => {
|
|
2370
|
+
var _a, _b, _c;
|
|
2371
|
+
// eslint-disable-next-line
|
|
2372
|
+
const {
|
|
2373
|
+
id,
|
|
2374
|
+
description,
|
|
2375
|
+
errors,
|
|
2376
|
+
uischema,
|
|
2377
|
+
visible,
|
|
2378
|
+
config,
|
|
2379
|
+
label,
|
|
2380
|
+
input,
|
|
2381
|
+
required
|
|
2382
|
+
} = props;
|
|
2383
|
+
errors.length === 0;
|
|
2384
|
+
const InnerComponent = input;
|
|
2385
|
+
const labelToUpdate = getLabelText(uischema.scope, label || '');
|
|
2386
|
+
let modifiedErrors = checkFieldValidity(props);
|
|
2387
|
+
if (modifiedErrors === 'should be equal to one of the allowed values' && ((_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.enumContext)) {
|
|
2388
|
+
modifiedErrors = '';
|
|
2389
|
+
}
|
|
2390
|
+
return jsx(Hidden, {
|
|
2391
|
+
xsUp: !visible,
|
|
2392
|
+
children: jsx(GoAFormItem, {
|
|
2393
|
+
requirement: required ? 'required' : undefined,
|
|
2394
|
+
error: modifiedErrors,
|
|
2395
|
+
label: (props === null || props === void 0 ? void 0 : props.noLabel) === true ? '' : labelToUpdate,
|
|
2396
|
+
helpText: typeof ((_b = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _b === void 0 ? void 0 : _b.help) === 'string' ? (_c = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _c === void 0 ? void 0 : _c.help : '',
|
|
2397
|
+
children: jsx(InnerComponent, Object.assign({}, props))
|
|
2398
|
+
})
|
|
2399
|
+
});
|
|
2400
|
+
};
|
|
2401
|
+
|
|
2402
|
+
const GoAInputText = props => {
|
|
2403
|
+
var _a, _b, _c, _d;
|
|
2404
|
+
// eslint-disable-next-line
|
|
2405
|
+
const {
|
|
2406
|
+
data,
|
|
2407
|
+
config,
|
|
2408
|
+
id,
|
|
2409
|
+
enabled,
|
|
2410
|
+
uischema,
|
|
2411
|
+
isValid,
|
|
2412
|
+
errors,
|
|
2413
|
+
path,
|
|
2414
|
+
handleChange,
|
|
2415
|
+
schema,
|
|
2416
|
+
label
|
|
2417
|
+
} = props;
|
|
2418
|
+
const appliedUiSchemaOptions = Object.assign(Object.assign({}, config), uischema === null || uischema === void 0 ? void 0 : uischema.options);
|
|
2419
|
+
const placeholder = (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.placeholder) || (schema === null || schema === void 0 ? void 0 : schema.description) || '';
|
|
2420
|
+
const errorsFormInput = checkFieldValidity(props);
|
|
2421
|
+
const autoCapitalize = ((_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps) === null || _b === void 0 ? void 0 : _b.autoCapitalize) === true || ((_c = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _c === void 0 ? void 0 : _c.autoCapitalize) === true;
|
|
2422
|
+
return jsx(GoAInput, Object.assign({
|
|
2423
|
+
error: errorsFormInput.length > 0,
|
|
2424
|
+
type: appliedUiSchemaOptions.format === 'password' ? 'password' : 'text',
|
|
2425
|
+
disabled: !enabled,
|
|
2426
|
+
value: data,
|
|
2427
|
+
width: '100%',
|
|
2428
|
+
placeholder: placeholder,
|
|
2429
|
+
// maxLength={appliedUiSchemaOptions?.maxLength}
|
|
2430
|
+
name: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.name) || `${id || label}-input`,
|
|
2431
|
+
testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
|
|
2432
|
+
// Dont use handleChange in the onChange event, use the keyPress or onBlur.
|
|
2433
|
+
// If you use it onChange along with keyPress event it will cause a
|
|
2434
|
+
// side effect that causes the validation to render when it shouldnt.
|
|
2435
|
+
onChange: (name, value) => {},
|
|
2436
|
+
onKeyPress: (name, value, key) => {
|
|
2437
|
+
if (!(key === 'Tab' || key === 'Shift')) {
|
|
2438
|
+
if (autoCapitalize === true) {
|
|
2439
|
+
handleChange(path, value.toUpperCase());
|
|
2440
|
+
} else {
|
|
2441
|
+
handleChange(path, value);
|
|
2442
|
+
}
|
|
2443
|
+
}
|
|
2444
|
+
},
|
|
2445
|
+
onBlur: (name, value) => {
|
|
2446
|
+
if (autoCapitalize === true) {
|
|
2447
|
+
handleChange(path, value.toUpperCase());
|
|
2448
|
+
} else {
|
|
2449
|
+
handleChange(path, value);
|
|
2450
|
+
}
|
|
2451
|
+
}
|
|
2452
|
+
}, (_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.componentProps));
|
|
2453
|
+
};
|
|
2454
|
+
const GoATextControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
|
|
2455
|
+
input: GoAInputText
|
|
2456
|
+
}));
|
|
2457
|
+
const GoATextControlTester = rankWith(1, isStringControl);
|
|
2458
|
+
const GoAInputTextControl = withJsonFormsControlProps(GoATextControl);
|
|
2459
|
+
|
|
2460
|
+
const MultiLineText = props => {
|
|
2461
|
+
var _a, _b, _c, _d;
|
|
2462
|
+
// eslint-disable-next-line
|
|
2463
|
+
const {
|
|
2464
|
+
data,
|
|
2465
|
+
config,
|
|
2466
|
+
id,
|
|
2467
|
+
enabled,
|
|
2468
|
+
uischema,
|
|
2469
|
+
path,
|
|
2470
|
+
handleChange,
|
|
2471
|
+
schema,
|
|
2472
|
+
label
|
|
2473
|
+
} = props;
|
|
2474
|
+
const appliedUiSchemaOptions = Object.assign(Object.assign({}, config), uischema === null || uischema === void 0 ? void 0 : uischema.options);
|
|
2475
|
+
const placeholder = (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.placeholder) || (schema === null || schema === void 0 ? void 0 : schema.description) || '';
|
|
2476
|
+
const errorsFormInput = checkFieldValidity(props);
|
|
2477
|
+
const autoCapitalize = ((_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps) === null || _b === void 0 ? void 0 : _b.autoCapitalize) === true || ((_c = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _c === void 0 ? void 0 : _c.autoCapitalize) === true;
|
|
2478
|
+
return jsx(GoATextArea, Object.assign({
|
|
2479
|
+
error: errorsFormInput.length > 0,
|
|
2480
|
+
value: data,
|
|
2481
|
+
disabled: !enabled,
|
|
2482
|
+
placeholder: placeholder,
|
|
2483
|
+
testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
|
|
2484
|
+
name: `${label || path}-text-area`,
|
|
2485
|
+
width: '100%',
|
|
2486
|
+
// Note: Paul Jan-09-2023. The latest ui-component come with the maxCount. We need to uncomment the following line when the component is updated
|
|
2487
|
+
// maxCount={schema.maxLength || 256}
|
|
2488
|
+
onKeyPress: (name, value, key) => {
|
|
2489
|
+
if (!(key === 'Tab' || key === 'Shift')) {
|
|
2490
|
+
if (autoCapitalize === true) {
|
|
2491
|
+
handleChange(path, value.toUpperCase());
|
|
2492
|
+
} else {
|
|
2493
|
+
handleChange(path, value);
|
|
2494
|
+
}
|
|
2495
|
+
}
|
|
2496
|
+
},
|
|
2497
|
+
// Dont use handleChange in the onChange event, use the keyPress or onBlur.
|
|
2498
|
+
// If you use it onChange along with keyPress event it will cause a
|
|
2499
|
+
// side effect that causes the validation to render when it shouldnt.
|
|
2500
|
+
onChange: () => {}
|
|
2501
|
+
}, (_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.componentProps));
|
|
2502
|
+
};
|
|
2503
|
+
const MultiLineTextControlInput = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
|
|
2504
|
+
input: MultiLineText
|
|
2505
|
+
}));
|
|
2506
|
+
const MultiLineTextControlTester = rankWith(3, and(isStringControl, optionIs('multi', true)));
|
|
2507
|
+
const MultiLineTextControl = withJsonFormsControlProps(MultiLineTextControlInput);
|
|
2508
|
+
|
|
2509
|
+
/**
|
|
2510
|
+
* Used internally by registered Controls, the MessageControl
|
|
2511
|
+
* is used to display an error message if a component cannot be rendered
|
|
2512
|
+
* due to input errors - typically from options.componentProps.
|
|
2513
|
+
*
|
|
2514
|
+
* NOTE: The component itself is not, and should not, be registered.
|
|
2515
|
+
*
|
|
2516
|
+
* @param message the message to be displayed
|
|
2517
|
+
*
|
|
2518
|
+
* @returns component for displaying the message in the correct style
|
|
2519
|
+
*/
|
|
2520
|
+
// TODO: Add styling
|
|
2521
|
+
const MessageControl = message => {
|
|
2522
|
+
return jsx(GoACallout, {
|
|
2523
|
+
type: "emergency",
|
|
2524
|
+
children: message
|
|
2525
|
+
});
|
|
2526
|
+
};
|
|
2527
|
+
|
|
2528
|
+
const errMalformedDate = (scope, type) => {
|
|
2529
|
+
return `${type}-date for variable '${scope}' has an incorrect format.`;
|
|
2530
|
+
};
|
|
2531
|
+
const standardizeDate = date => {
|
|
2532
|
+
try {
|
|
2533
|
+
const stdDate = new Date(date).toISOString().substring(0, 10);
|
|
2534
|
+
return stdDate;
|
|
2535
|
+
} catch (e) {
|
|
2536
|
+
return undefined;
|
|
2537
|
+
}
|
|
2538
|
+
};
|
|
2539
|
+
const isValidDateFormat = date => {
|
|
2540
|
+
const standardized = standardizeDate(date);
|
|
2541
|
+
return standardized !== undefined;
|
|
2542
|
+
};
|
|
2543
|
+
const invalidDateFormat = (scope, type) => {
|
|
2544
|
+
return MessageControl(errMalformedDate(scope, type));
|
|
2545
|
+
};
|
|
2546
|
+
const reformatDateProps = props => {
|
|
2547
|
+
if (props) {
|
|
2548
|
+
if ('min' in props && typeof props.min === 'string') {
|
|
2549
|
+
props['min'] = standardizeDate(props.min);
|
|
2550
|
+
}
|
|
2551
|
+
if ('max' in props && typeof props.max === 'string') {
|
|
2552
|
+
props['max'] = standardizeDate(props.max);
|
|
2553
|
+
}
|
|
2554
|
+
}
|
|
2555
|
+
return props;
|
|
2556
|
+
};
|
|
2557
|
+
const GoADateInput = props => {
|
|
2558
|
+
var _a, _b, _c, _d, _e;
|
|
2559
|
+
const {
|
|
2560
|
+
data,
|
|
2561
|
+
config,
|
|
2562
|
+
id,
|
|
2563
|
+
enabled,
|
|
2564
|
+
uischema,
|
|
2565
|
+
path,
|
|
2566
|
+
handleChange,
|
|
2567
|
+
label
|
|
2568
|
+
} = props;
|
|
2569
|
+
const appliedUiSchemaOptions = Object.assign(Object.assign({}, config), uischema === null || uischema === void 0 ? void 0 : uischema.options);
|
|
2570
|
+
const minDate = (_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps) === null || _b === void 0 ? void 0 : _b.min;
|
|
2571
|
+
if (minDate && !isValidDateFormat(minDate)) {
|
|
2572
|
+
return invalidDateFormat(uischema.scope, 'Min');
|
|
2573
|
+
}
|
|
2574
|
+
const maxDate = (_d = (_c = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _c === void 0 ? void 0 : _c.componentProps) === null || _d === void 0 ? void 0 : _d.max;
|
|
2575
|
+
if (maxDate && !isValidDateFormat(maxDate)) {
|
|
2576
|
+
return invalidDateFormat(uischema.scope, 'Max');
|
|
2577
|
+
}
|
|
2578
|
+
return jsx(GoAInputDate, Object.assign({
|
|
2579
|
+
error: checkFieldValidity(props).length > 0,
|
|
2580
|
+
width: "100%",
|
|
2581
|
+
name: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.name) || `${id || label}-input`,
|
|
2582
|
+
value: standardizeDate(data) || '',
|
|
2583
|
+
testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
|
|
2584
|
+
disabled: !enabled,
|
|
2585
|
+
// Don't use handleChange in the onChange event, use the keyPress or onBlur.
|
|
2586
|
+
// If you use it onChange along with keyPress event it will cause a
|
|
2587
|
+
// side effect that causes the validation to render when it shouldn't.
|
|
2588
|
+
onChange: (name, value) => {},
|
|
2589
|
+
onKeyPress: (name, value, key) => {
|
|
2590
|
+
if (!(key === 'Tab' || key === 'Shift')) {
|
|
2591
|
+
value = standardizeDate(value) || '';
|
|
2592
|
+
handleChange(path, value);
|
|
2593
|
+
}
|
|
2594
|
+
},
|
|
2595
|
+
onBlur: (name, value) => {
|
|
2596
|
+
value = standardizeDate(value) || '';
|
|
2597
|
+
handleChange(path, value);
|
|
2598
|
+
}
|
|
2599
|
+
}, reformatDateProps((_e = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _e === void 0 ? void 0 : _e.componentProps)));
|
|
2600
|
+
};
|
|
2601
|
+
const GoADateControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
|
|
2602
|
+
input: GoADateInput
|
|
2603
|
+
}));
|
|
2604
|
+
const GoADateControlTester = rankWith(4, isDateControl);
|
|
2605
|
+
const GoAInputDateControl = withJsonFormsControlProps(GoADateControl);
|
|
2606
|
+
|
|
2607
|
+
const GoANumberInput = props => {
|
|
2608
|
+
var _a;
|
|
2609
|
+
// eslint-disable-next-line
|
|
2610
|
+
const {
|
|
2611
|
+
data,
|
|
2612
|
+
config,
|
|
2613
|
+
id,
|
|
2614
|
+
enabled,
|
|
2615
|
+
uischema,
|
|
2616
|
+
isValid,
|
|
2617
|
+
path,
|
|
2618
|
+
handleChange,
|
|
2619
|
+
schema,
|
|
2620
|
+
label
|
|
2621
|
+
} = props;
|
|
2622
|
+
const appliedUiSchemaOptions = Object.assign(Object.assign({}, config), uischema === null || uischema === void 0 ? void 0 : uischema.options);
|
|
2623
|
+
const placeholder = (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.placeholder) || (schema === null || schema === void 0 ? void 0 : schema.description) || '';
|
|
2624
|
+
const InputValue = data && data !== undefined ? data : '';
|
|
2625
|
+
const clonedSchema = JSON.parse(JSON.stringify(schema));
|
|
2626
|
+
const StepValue = clonedSchema.multipleOf ? clonedSchema.multipleOf : 0.01;
|
|
2627
|
+
const MinValue = clonedSchema.minimum ? clonedSchema.minimum : '';
|
|
2628
|
+
const MaxValue = clonedSchema.exclusiveMaximum ? clonedSchema.exclusiveMaximum : '';
|
|
2629
|
+
const errorsFormInput = checkFieldValidity(props);
|
|
2630
|
+
return jsx(GoAInput, Object.assign({
|
|
2631
|
+
type: "number",
|
|
2632
|
+
error: errorsFormInput.length > 0,
|
|
2633
|
+
disabled: !enabled,
|
|
2634
|
+
value: InputValue,
|
|
2635
|
+
placeholder: placeholder,
|
|
2636
|
+
step: StepValue,
|
|
2637
|
+
min: MinValue,
|
|
2638
|
+
max: MaxValue,
|
|
2639
|
+
width: "100%",
|
|
2640
|
+
name: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.name) || `${id || label}-input`,
|
|
2641
|
+
testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
|
|
2642
|
+
onKeyPress: (name, value, key) => {
|
|
2643
|
+
if (!(key === 'Tab' || key === 'Shift')) {
|
|
2644
|
+
let newValue = '';
|
|
2645
|
+
if (value !== '') {
|
|
2646
|
+
newValue = +value;
|
|
2647
|
+
}
|
|
2648
|
+
handleChange(path, newValue);
|
|
2649
|
+
}
|
|
2650
|
+
},
|
|
2651
|
+
onBlur: (name, value) => {
|
|
2652
|
+
let newValue = '';
|
|
2653
|
+
if (value !== '') {
|
|
2654
|
+
newValue = +value;
|
|
2655
|
+
}
|
|
2656
|
+
handleChange(path, newValue);
|
|
2657
|
+
},
|
|
2658
|
+
//Dont trigger the handleChange event on the onChange event as it will cause
|
|
2659
|
+
//issue with the error message from displaying, use keyPress or the onBlur event instead
|
|
2660
|
+
onChange: (name, value) => {}
|
|
2661
|
+
}, (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps));
|
|
2662
|
+
};
|
|
2663
|
+
const GoANumberControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
|
|
2664
|
+
input: GoANumberInput
|
|
2665
|
+
}));
|
|
2666
|
+
const GoANumberControlTester = rankWith(2, isNumberControl);
|
|
2667
|
+
const GoAInputNumberControl = withJsonFormsControlProps(GoANumberControl);
|
|
2668
|
+
|
|
2669
|
+
const GoAInputInteger = props => {
|
|
2670
|
+
var _a;
|
|
2671
|
+
// eslint-disable-next-line
|
|
2672
|
+
const {
|
|
2673
|
+
data,
|
|
2674
|
+
config,
|
|
2675
|
+
id,
|
|
2676
|
+
enabled,
|
|
2677
|
+
uischema,
|
|
2678
|
+
isValid,
|
|
2679
|
+
path,
|
|
2680
|
+
handleChange,
|
|
2681
|
+
schema,
|
|
2682
|
+
label
|
|
2683
|
+
} = props;
|
|
2684
|
+
const appliedUiSchemaOptions = Object.assign(Object.assign({}, config), uischema === null || uischema === void 0 ? void 0 : uischema.options);
|
|
2685
|
+
const placeholder = (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.placeholder) || (schema === null || schema === void 0 ? void 0 : schema.description) || '';
|
|
2686
|
+
const InputValue = data && data !== undefined ? data : '';
|
|
2687
|
+
const clonedSchema = JSON.parse(JSON.stringify(schema));
|
|
2688
|
+
const StepValue = clonedSchema.multipleOf ? clonedSchema.multipleOf : 0;
|
|
2689
|
+
const MinValue = clonedSchema.minimum ? clonedSchema.minimum : '';
|
|
2690
|
+
const MaxValue = clonedSchema.exclusiveMaximum ? clonedSchema.exclusiveMaximum : '';
|
|
2691
|
+
const errorsFormInput = checkFieldValidity(props);
|
|
2692
|
+
return jsx(GoAInput, Object.assign({
|
|
2693
|
+
type: "number",
|
|
2694
|
+
error: errorsFormInput.length > 0,
|
|
2695
|
+
width: "100%",
|
|
2696
|
+
disabled: !enabled,
|
|
2697
|
+
value: InputValue,
|
|
2698
|
+
step: StepValue,
|
|
2699
|
+
min: MinValue,
|
|
2700
|
+
max: MaxValue,
|
|
2701
|
+
placeholder: placeholder,
|
|
2702
|
+
name: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.name) || `${id || label}-input`,
|
|
2703
|
+
testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
|
|
2704
|
+
onKeyPress: (name, value, key) => {
|
|
2705
|
+
if (!(key === 'Tab' || key === 'Shift')) {
|
|
2706
|
+
let newValue = '';
|
|
2707
|
+
if (value !== '') {
|
|
2708
|
+
newValue = +value;
|
|
2709
|
+
}
|
|
2710
|
+
handleChange(path, newValue);
|
|
2711
|
+
}
|
|
2712
|
+
},
|
|
2713
|
+
onBlur: (name, value) => {
|
|
2714
|
+
let newValue = '';
|
|
2715
|
+
if (value !== '') {
|
|
2716
|
+
newValue = +value;
|
|
2717
|
+
}
|
|
2718
|
+
handleChange(path, newValue);
|
|
2719
|
+
},
|
|
2720
|
+
//Dont trigger the handleChange event on the onChange event as it will cause
|
|
2721
|
+
//issue with the error message from displaying, use keyPress or the onBlur event instead
|
|
2722
|
+
onChange: (name, value) => {}
|
|
2723
|
+
}, (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps));
|
|
2724
|
+
};
|
|
2725
|
+
const GoAIntegerControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
|
|
2726
|
+
input: GoAInputInteger
|
|
2727
|
+
}));
|
|
2728
|
+
const GoAIntegerControlTester = rankWith(2, isIntegerControl);
|
|
2729
|
+
const GoAInputIntegerControl = withJsonFormsControlProps(GoAIntegerControl);
|
|
2730
|
+
|
|
2731
|
+
const GoADateTimeInput = props => {
|
|
2732
|
+
var _a;
|
|
2733
|
+
// eslint-disable-next-line
|
|
2734
|
+
const {
|
|
2735
|
+
data,
|
|
2736
|
+
config,
|
|
2737
|
+
id,
|
|
2738
|
+
enabled,
|
|
2739
|
+
uischema,
|
|
2740
|
+
isValid,
|
|
2741
|
+
path,
|
|
2742
|
+
errors,
|
|
2743
|
+
handleChange,
|
|
2744
|
+
schema,
|
|
2745
|
+
label
|
|
2746
|
+
} = props;
|
|
2747
|
+
const appliedUiSchemaOptions = Object.assign(Object.assign({}, config), uischema === null || uischema === void 0 ? void 0 : uischema.options);
|
|
2748
|
+
return jsx(GoAInputDateTime, Object.assign({
|
|
2749
|
+
error: checkFieldValidity(props).length > 0,
|
|
2750
|
+
width: "100%",
|
|
2751
|
+
name: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.name) || `${id || label}-input`,
|
|
2752
|
+
value: data ? new Date(data).toISOString() : '',
|
|
2753
|
+
testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
|
|
2754
|
+
disabled: !enabled,
|
|
2755
|
+
// Dont use handleChange in the onChange event, use the keyPress or onBlur.
|
|
2756
|
+
// If you use it onChange along with keyPress event it will cause a
|
|
2757
|
+
// side effect that causes the validation to render when it shouldnt.
|
|
2758
|
+
onChange: (name, value) => {},
|
|
2759
|
+
onKeyPress: (name, value, key) => {
|
|
2760
|
+
var _a;
|
|
2761
|
+
if (!(key === 'Tab' || key === 'Shift')) {
|
|
2762
|
+
value = isValidDate(value) ? (_a = new Date(value)) === null || _a === void 0 ? void 0 : _a.toISOString() : '';
|
|
2763
|
+
handleChange(path, value);
|
|
2764
|
+
}
|
|
2765
|
+
},
|
|
2766
|
+
onBlur: (name, value) => {
|
|
2767
|
+
value = isValidDate(value) ? new Date(value).toISOString() : '';
|
|
2768
|
+
handleChange(path, value);
|
|
2769
|
+
}
|
|
2770
|
+
}, (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps));
|
|
2771
|
+
};
|
|
2772
|
+
const GoADateTimeControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
|
|
2773
|
+
input: GoADateTimeInput
|
|
2774
|
+
}));
|
|
2775
|
+
const GoADateTimeControlTester = rankWith(2, isDateTimeControl);
|
|
2776
|
+
const GoAInputDateTimeControl = withJsonFormsControlProps(GoADateTimeControl);
|
|
2777
|
+
|
|
2778
|
+
const GoATimeInput = props => {
|
|
2779
|
+
var _a;
|
|
2780
|
+
// eslint-disable-next-line
|
|
2781
|
+
const {
|
|
2782
|
+
data,
|
|
2783
|
+
config,
|
|
2784
|
+
id,
|
|
2785
|
+
enabled,
|
|
2786
|
+
uischema,
|
|
2787
|
+
isValid,
|
|
2788
|
+
path,
|
|
2789
|
+
handleChange,
|
|
2790
|
+
schema,
|
|
2791
|
+
label
|
|
2792
|
+
} = props;
|
|
2793
|
+
const appliedUiSchemaOptions = Object.assign(Object.assign({}, config), uischema === null || uischema === void 0 ? void 0 : uischema.options);
|
|
2794
|
+
(appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.placeholder) || (schema === null || schema === void 0 ? void 0 : schema.description) || '';
|
|
2795
|
+
const errorsFormInput = checkFieldValidity(props);
|
|
2796
|
+
return jsx(GoAInputTime, Object.assign({
|
|
2797
|
+
error: errorsFormInput.length > 0,
|
|
2798
|
+
name: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.name) || `${id || label}-input`,
|
|
2799
|
+
value: data,
|
|
2800
|
+
step: 1,
|
|
2801
|
+
width: "100%",
|
|
2802
|
+
disabled: !enabled,
|
|
2803
|
+
testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
|
|
2804
|
+
onBlur: (name, value) => {
|
|
2805
|
+
handleChange(path, value);
|
|
2806
|
+
},
|
|
2807
|
+
// Dont use handleChange in the onChange event, use the keyPress or onBlur.
|
|
2808
|
+
// If you use it onChange along with keyPress event it will cause a
|
|
2809
|
+
// side effect that causes the validation to render when it shouldnt.
|
|
2810
|
+
onChange: (name, value) => {},
|
|
2811
|
+
onKeyPress: (name, value, key) => {
|
|
2812
|
+
if (!(key === 'Tab' || key === 'Shift')) {
|
|
2813
|
+
handleChange(path, value);
|
|
2814
|
+
}
|
|
2815
|
+
}
|
|
2816
|
+
}, (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps));
|
|
2817
|
+
};
|
|
2818
|
+
const GoATimeControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
|
|
2819
|
+
input: GoATimeInput
|
|
2820
|
+
}));
|
|
2821
|
+
const GoATimeControlTester = rankWith(4, isTimeControl);
|
|
2822
|
+
const GoAInputTimeControl = withJsonFormsControlProps(GoATimeControl);
|
|
2823
|
+
|
|
2824
|
+
var $$1 = _export;
|
|
2825
|
+
var $includes = arrayIncludes.includes;
|
|
2826
|
+
var fails$1 = fails$i;
|
|
2827
|
+
var addToUnscopables = addToUnscopables$2;
|
|
2828
|
+
|
|
2829
|
+
// FF99+ bug
|
|
2830
|
+
var BROKEN_ON_SPARSE = fails$1(function () {
|
|
2831
|
+
// eslint-disable-next-line es/no-array-prototype-includes -- detection
|
|
2832
|
+
return !Array(1).includes();
|
|
2833
|
+
});
|
|
2834
|
+
|
|
2835
|
+
// `Array.prototype.includes` method
|
|
2836
|
+
// https://tc39.es/ecma262/#sec-array.prototype.includes
|
|
2837
|
+
$$1({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
|
|
2838
|
+
includes: function includes(el /* , fromIndex = 0 */) {
|
|
2839
|
+
return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
|
|
2840
|
+
}
|
|
2841
|
+
});
|
|
2842
|
+
|
|
2843
|
+
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
2844
|
+
addToUnscopables('includes');
|
|
2845
|
+
|
|
2846
|
+
var isObject = isObject$8;
|
|
2847
|
+
var classof = classofRaw$1;
|
|
2848
|
+
var wellKnownSymbol$1 = wellKnownSymbol$c;
|
|
2849
|
+
|
|
2850
|
+
var MATCH$1 = wellKnownSymbol$1('match');
|
|
2851
|
+
|
|
2852
|
+
// `IsRegExp` abstract operation
|
|
2853
|
+
// https://tc39.es/ecma262/#sec-isregexp
|
|
2854
|
+
var isRegexp = function (it) {
|
|
2855
|
+
var isRegExp;
|
|
2856
|
+
return isObject(it) && ((isRegExp = it[MATCH$1]) !== undefined ? !!isRegExp : classof(it) === 'RegExp');
|
|
2857
|
+
};
|
|
2858
|
+
|
|
2859
|
+
var isRegExp = isRegexp;
|
|
2860
|
+
|
|
2861
|
+
var $TypeError = TypeError;
|
|
2862
|
+
|
|
2863
|
+
var notARegexp = function (it) {
|
|
2864
|
+
if (isRegExp(it)) {
|
|
2865
|
+
throw new $TypeError("The method doesn't accept regular expressions");
|
|
2866
|
+
} return it;
|
|
2867
|
+
};
|
|
2868
|
+
|
|
2869
|
+
var wellKnownSymbol = wellKnownSymbol$c;
|
|
2870
|
+
|
|
2871
|
+
var MATCH = wellKnownSymbol('match');
|
|
2872
|
+
|
|
2873
|
+
var correctIsRegexpLogic = function (METHOD_NAME) {
|
|
2874
|
+
var regexp = /./;
|
|
2875
|
+
try {
|
|
2876
|
+
'/./'[METHOD_NAME](regexp);
|
|
2877
|
+
} catch (error1) {
|
|
2878
|
+
try {
|
|
2879
|
+
regexp[MATCH] = false;
|
|
2880
|
+
return '/./'[METHOD_NAME](regexp);
|
|
2881
|
+
} catch (error2) { /* empty */ }
|
|
2882
|
+
} return false;
|
|
2883
|
+
};
|
|
2884
|
+
|
|
2885
|
+
var $ = _export;
|
|
2886
|
+
var uncurryThis = functionUncurryThis;
|
|
2887
|
+
var notARegExp = notARegexp;
|
|
2888
|
+
var requireObjectCoercible = requireObjectCoercible$5;
|
|
2889
|
+
var toString = toString$5;
|
|
2890
|
+
var correctIsRegExpLogic = correctIsRegexpLogic;
|
|
2891
|
+
|
|
2892
|
+
var stringIndexOf = uncurryThis(''.indexOf);
|
|
2893
|
+
|
|
2894
|
+
// `String.prototype.includes` method
|
|
2895
|
+
// https://tc39.es/ecma262/#sec-string.prototype.includes
|
|
2896
|
+
$({ target: 'String', proto: true, forced: !correctIsRegExpLogic('includes') }, {
|
|
2897
|
+
includes: function includes(searchString /* , position = 0 */) {
|
|
2898
|
+
return !!~stringIndexOf(
|
|
2899
|
+
toString(requireObjectCoercible(this)),
|
|
2900
|
+
toString(notARegExp(searchString)),
|
|
2901
|
+
arguments.length > 1 ? arguments[1] : undefined
|
|
2902
|
+
);
|
|
2903
|
+
}
|
|
2904
|
+
});
|
|
2905
|
+
|
|
2906
|
+
const getAxiosInterceptorConfig = axios => {
|
|
2907
|
+
const requestId = axios.interceptors.request.use(req => {
|
|
2908
|
+
if (req.data === undefined) {
|
|
2909
|
+
throw new Error(`The URL: ${req.url} encountered a CORS error.`);
|
|
2910
|
+
}
|
|
2911
|
+
return req;
|
|
2912
|
+
});
|
|
2913
|
+
return [requestId, axios];
|
|
2914
|
+
};
|
|
2915
|
+
function addDataByUrl(key, url, processDataFunction, token) {
|
|
2916
|
+
let header = {};
|
|
2917
|
+
const [requestId, axiosWithConfig] = getAxiosInterceptorConfig(axios);
|
|
2918
|
+
if (token) {
|
|
2919
|
+
header = Object.assign(Object.assign({}, header), {
|
|
2920
|
+
Authorization: `Bearer ${token}`
|
|
2921
|
+
});
|
|
2922
|
+
}
|
|
2923
|
+
axiosWithConfig.get(url, header).then(response => {
|
|
2924
|
+
const processedData = processDataFunction(response.data);
|
|
2925
|
+
enumValues.set(key, () => processedData);
|
|
2926
|
+
}).catch(err => {
|
|
2927
|
+
if (err.message.includes('CORS')) {
|
|
2928
|
+
console.warn(err.message);
|
|
2929
|
+
} else {
|
|
2930
|
+
console.warn(`addDataByUrl: ${err.message}`);
|
|
2931
|
+
}
|
|
2932
|
+
});
|
|
2933
|
+
axiosWithConfig.interceptors.request.eject(requestId);
|
|
2934
|
+
}
|
|
2935
|
+
function addDataByOptions(key, url, location, type, values) {
|
|
2936
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2937
|
+
const dataFunction = data => {
|
|
2938
|
+
let dataLink = data;
|
|
2939
|
+
let returnData = [''];
|
|
2940
|
+
const locationArray = location && !Array.isArray(location) ? [location] : location;
|
|
2941
|
+
locationArray === null || locationArray === void 0 ? void 0 : locationArray.forEach(attribute => {
|
|
2942
|
+
dataLink = dataLink[attribute];
|
|
2943
|
+
});
|
|
2944
|
+
const valuesArray = Array.isArray(values) ? values : [values];
|
|
2945
|
+
if (type === 'keys') {
|
|
2946
|
+
returnData = Object.keys(dataLink);
|
|
2947
|
+
} else {
|
|
2948
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2949
|
+
returnData = dataLink.map(entry => {
|
|
2950
|
+
let parse = '';
|
|
2951
|
+
valuesArray.forEach((v, index) => {
|
|
2952
|
+
parse += `${entry[v]}`;
|
|
2953
|
+
if (index < valuesArray.length - 1) {
|
|
2954
|
+
parse += ' ';
|
|
2955
|
+
}
|
|
2956
|
+
});
|
|
2957
|
+
return parse;
|
|
2958
|
+
});
|
|
2959
|
+
}
|
|
2960
|
+
return returnData;
|
|
2961
|
+
};
|
|
2962
|
+
addDataByUrl(key, url, dataFunction);
|
|
2963
|
+
}
|
|
2964
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2965
|
+
const enumValues = new Map();
|
|
2966
|
+
const enumFunctions = new Map();
|
|
2967
|
+
const baseEnumerator = {
|
|
2968
|
+
data: enumValues,
|
|
2969
|
+
functions: enumFunctions
|
|
2970
|
+
};
|
|
2971
|
+
const JsonFormContext = /*#__PURE__*/createContext(baseEnumerator);
|
|
2972
|
+
function ContextProvider(props) {
|
|
2973
|
+
var _a;
|
|
2974
|
+
React.useContext(JsonFormContext);
|
|
2975
|
+
if (props.fileManagement) {
|
|
2976
|
+
const {
|
|
2977
|
+
fileList,
|
|
2978
|
+
uploadFile,
|
|
2979
|
+
downloadFile,
|
|
2980
|
+
deleteFile
|
|
2981
|
+
} = props.fileManagement;
|
|
2982
|
+
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
2983
|
+
const uploadFileFunction = uploadFile ? uploadFile : () => {};
|
|
2984
|
+
const downloadFileFunction = downloadFile ? downloadFile : () => {};
|
|
2985
|
+
const deleteFileFunction = deleteFile ? deleteFile : () => {};
|
|
2986
|
+
enumValues.set('file-list', () => fileList);
|
|
2987
|
+
enumFunctions.set('upload-file', () => uploadFileFunction);
|
|
2988
|
+
enumFunctions.set('download-file', () => downloadFileFunction);
|
|
2989
|
+
enumFunctions.set('delete-file', () => deleteFileFunction);
|
|
2990
|
+
}
|
|
2991
|
+
if (props.data) {
|
|
2992
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2993
|
+
(_a = props.data) === null || _a === void 0 ? void 0 : _a.forEach(item => {
|
|
2994
|
+
enumValues.set(Object.keys(item)[0], () => item);
|
|
2995
|
+
});
|
|
2996
|
+
}
|
|
2997
|
+
if (!props.children) {
|
|
2998
|
+
return null;
|
|
2999
|
+
}
|
|
3000
|
+
return jsx(JsonFormContext.Provider, {
|
|
3001
|
+
value: baseEnumerator,
|
|
3002
|
+
children: props.children
|
|
3003
|
+
});
|
|
3004
|
+
}
|
|
3005
|
+
/**
|
|
3006
|
+
* Grabs data stored under a given key
|
|
3007
|
+
*
|
|
3008
|
+
*/
|
|
3009
|
+
function getData(key) {
|
|
3010
|
+
const dataFunction = baseEnumerator.data.get(key);
|
|
3011
|
+
return dataFunction && dataFunction();
|
|
3012
|
+
}
|
|
3013
|
+
/**
|
|
3014
|
+
* Grabs all data
|
|
3015
|
+
*
|
|
3016
|
+
*/
|
|
3017
|
+
function getAllData() {
|
|
3018
|
+
const allData = [];
|
|
3019
|
+
baseEnumerator.data.forEach((d, key) => {
|
|
3020
|
+
allData.push({
|
|
3021
|
+
[key]: d()
|
|
3022
|
+
});
|
|
3023
|
+
});
|
|
3024
|
+
return allData;
|
|
3025
|
+
}
|
|
3026
|
+
/**
|
|
3027
|
+
* Allows additional data to be added under a given key
|
|
3028
|
+
*
|
|
3029
|
+
* This data will then be available inside the context
|
|
3030
|
+
*/
|
|
3031
|
+
function addData(key, data) {
|
|
3032
|
+
enumValues.set(key, () => data);
|
|
3033
|
+
}
|
|
3034
|
+
|
|
3035
|
+
const EnumSelect = props => {
|
|
3036
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
3037
|
+
const {
|
|
3038
|
+
data,
|
|
3039
|
+
id,
|
|
3040
|
+
enabled,
|
|
3041
|
+
errors,
|
|
3042
|
+
schema,
|
|
3043
|
+
path,
|
|
3044
|
+
handleChange,
|
|
3045
|
+
options,
|
|
3046
|
+
config,
|
|
3047
|
+
label,
|
|
3048
|
+
uischema
|
|
3049
|
+
} = props;
|
|
3050
|
+
let enumData = (schema === null || schema === void 0 ? void 0 : schema.enum) || [];
|
|
3051
|
+
const appliedUiSchemaOptions = merge({}, config, props.uischema.options, options);
|
|
3052
|
+
const dataKey = (_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.enumContext) === null || _b === void 0 ? void 0 : _b.key;
|
|
3053
|
+
const url = (_d = (_c = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _c === void 0 ? void 0 : _c.enumContext) === null || _d === void 0 ? void 0 : _d.url;
|
|
3054
|
+
const location = (_f = (_e = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _e === void 0 ? void 0 : _e.enumContext) === null || _f === void 0 ? void 0 : _f.location;
|
|
3055
|
+
const type = (_h = (_g = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _g === void 0 ? void 0 : _g.enumContext) === null || _h === void 0 ? void 0 : _h.type;
|
|
3056
|
+
const values = (_k = (_j = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _j === void 0 ? void 0 : _j.enumContext) === null || _k === void 0 ? void 0 : _k.values;
|
|
3057
|
+
const errorsFormInput = checkFieldValidity(props);
|
|
3058
|
+
useEffect(() => {
|
|
3059
|
+
if (dataKey && url) {
|
|
3060
|
+
addDataByOptions(dataKey, url, location, type, values);
|
|
3061
|
+
}
|
|
3062
|
+
}, [url, location, type, values, dataKey]);
|
|
3063
|
+
if (dataKey && getData(dataKey)) {
|
|
3064
|
+
const newData = getData(dataKey);
|
|
3065
|
+
enumData = newData;
|
|
3066
|
+
}
|
|
3067
|
+
return jsx(GoADropdown, Object.assign({
|
|
3068
|
+
error: errorsFormInput.length > 0,
|
|
3069
|
+
name: `${label}`,
|
|
3070
|
+
value: data,
|
|
3071
|
+
disabled: !enabled,
|
|
3072
|
+
relative: true,
|
|
3073
|
+
testId: `${id || label}-jsonform`
|
|
3074
|
+
}, appliedUiSchemaOptions, {
|
|
3075
|
+
onChange: (name, value) => {
|
|
3076
|
+
handleChange(path, value);
|
|
3077
|
+
}
|
|
3078
|
+
}, (_l = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _l === void 0 ? void 0 : _l.componentProps, {
|
|
3079
|
+
children: enumData === null || enumData === void 0 ? void 0 : enumData.map(item => {
|
|
3080
|
+
return jsx(GoADropdownItem, {
|
|
3081
|
+
value: `${item}`,
|
|
3082
|
+
label: `${item}`
|
|
3083
|
+
}, `json-form-dropdown-${item}`);
|
|
3084
|
+
})
|
|
3085
|
+
}), `${id}-jsonform-key`);
|
|
3086
|
+
};
|
|
3087
|
+
const numControl = props => {
|
|
3088
|
+
return jsx(GoAInputBaseControl, Object.assign({}, props, {
|
|
3089
|
+
input: EnumSelect
|
|
3090
|
+
}));
|
|
3091
|
+
};
|
|
3092
|
+
const GoAEnumControlTester = rankWith(2, isEnumControl);
|
|
3093
|
+
// HOC order can be reversed with https://github.com/eclipsesource/jsonforms/issues/1987
|
|
3094
|
+
const GoAEnumControl = withJsonFormsEnumProps(withTranslateProps(numControl), true);
|
|
3095
|
+
|
|
3096
|
+
const EnumSelectAutoComplete = props => {
|
|
3097
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
3098
|
+
const {
|
|
3099
|
+
data,
|
|
3100
|
+
schema,
|
|
3101
|
+
path,
|
|
3102
|
+
handleChange,
|
|
3103
|
+
uischema
|
|
3104
|
+
} = props;
|
|
3105
|
+
let enumData = (schema === null || schema === void 0 ? void 0 : schema.enum) || [];
|
|
3106
|
+
const dataKey = (_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.enumContext) === null || _b === void 0 ? void 0 : _b.key;
|
|
3107
|
+
const url = (_d = (_c = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _c === void 0 ? void 0 : _c.enumContext) === null || _d === void 0 ? void 0 : _d.url;
|
|
3108
|
+
const location = (_f = (_e = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _e === void 0 ? void 0 : _e.enumContext) === null || _f === void 0 ? void 0 : _f.location;
|
|
3109
|
+
const type = (_h = (_g = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _g === void 0 ? void 0 : _g.enumContext) === null || _h === void 0 ? void 0 : _h.type;
|
|
3110
|
+
const values = (_k = (_j = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _j === void 0 ? void 0 : _j.enumContext) === null || _k === void 0 ? void 0 : _k.values;
|
|
3111
|
+
const defaultProps = {
|
|
3112
|
+
options: enumData,
|
|
3113
|
+
getOptionLabel: option => option
|
|
3114
|
+
};
|
|
3115
|
+
const [inputValue, setInputValue] = React.useState('');
|
|
3116
|
+
useEffect(() => {
|
|
3117
|
+
if (dataKey && url) {
|
|
3118
|
+
addDataByOptions(dataKey, url, location, type, values);
|
|
3119
|
+
}
|
|
3120
|
+
}, [url, location, type, values, dataKey]);
|
|
3121
|
+
if (dataKey && getData(dataKey)) {
|
|
3122
|
+
const newData = getData(dataKey);
|
|
3123
|
+
// eslint-disable-next-line
|
|
3124
|
+
enumData = newData;
|
|
3125
|
+
defaultProps.options = enumData;
|
|
3126
|
+
}
|
|
3127
|
+
return jsx(Autocomplete, Object.assign({}, defaultProps, {
|
|
3128
|
+
id: "autocomplete",
|
|
3129
|
+
getOptionLabel: option => option,
|
|
3130
|
+
isOptionEqualToValue: (option, value) => option.id === value.id,
|
|
3131
|
+
value: data || null,
|
|
3132
|
+
onChange: (name, value) => {
|
|
3133
|
+
handleChange(path, value);
|
|
3134
|
+
setInputValue(value);
|
|
3135
|
+
},
|
|
3136
|
+
renderInput: params => {
|
|
3137
|
+
return jsx(TextField, Object.assign({}, params, {
|
|
3138
|
+
variant: "outlined",
|
|
3139
|
+
size: "small",
|
|
3140
|
+
placeholder: schema === null || schema === void 0 ? void 0 : schema.description
|
|
3141
|
+
}));
|
|
3142
|
+
}
|
|
3143
|
+
}));
|
|
3144
|
+
};
|
|
3145
|
+
const numControlAutoComplete = props => {
|
|
3146
|
+
return jsx(GoAInputBaseControl, Object.assign({}, props, {
|
|
3147
|
+
input: EnumSelectAutoComplete
|
|
3148
|
+
}));
|
|
3149
|
+
};
|
|
3150
|
+
const GoAEnumControlAutoCompleteTester = rankWith(3, and(isEnumControl, optionIs('autocomplete', true)));
|
|
3151
|
+
const GoAEnumAutoCompleteControl = withJsonFormsEnumProps(withTranslateProps(numControlAutoComplete), true);
|
|
3152
|
+
|
|
3153
|
+
const RadioGroup = props => {
|
|
3154
|
+
var _a;
|
|
3155
|
+
const {
|
|
3156
|
+
data,
|
|
3157
|
+
className,
|
|
3158
|
+
id,
|
|
3159
|
+
enabled,
|
|
3160
|
+
schema,
|
|
3161
|
+
uischema,
|
|
3162
|
+
path,
|
|
3163
|
+
handleChange,
|
|
3164
|
+
options,
|
|
3165
|
+
config,
|
|
3166
|
+
label,
|
|
3167
|
+
t
|
|
3168
|
+
} = props;
|
|
3169
|
+
const enumData = (schema === null || schema === void 0 ? void 0 : schema.enum) || [];
|
|
3170
|
+
const appliedUiSchemaOptions = merge({}, config, props.uischema.options, uischema, options);
|
|
3171
|
+
const errorsFormInput = checkFieldValidity(props);
|
|
3172
|
+
return jsx(GoARadioGroup, Object.assign({
|
|
3173
|
+
error: errorsFormInput.length > 0,
|
|
3174
|
+
name: `${options || appliedUiSchemaOptions.label}`,
|
|
3175
|
+
testId: `${id || label}-jsonform-dropdown`,
|
|
3176
|
+
value: data,
|
|
3177
|
+
disabled: !enabled
|
|
3178
|
+
}, appliedUiSchemaOptions, {
|
|
3179
|
+
onChange: (name, value) => handleChange(path, value)
|
|
3180
|
+
}, (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps, {
|
|
3181
|
+
children: enumData.map(value => {
|
|
3182
|
+
return jsx(GoARadioItem, Object.assign({
|
|
3183
|
+
name: value,
|
|
3184
|
+
value: `${value}`,
|
|
3185
|
+
label: value
|
|
3186
|
+
}, appliedUiSchemaOptions));
|
|
3187
|
+
})
|
|
3188
|
+
}));
|
|
3189
|
+
};
|
|
3190
|
+
const EnumRadioControl = props => {
|
|
3191
|
+
return jsx(GoAInputBaseControl, Object.assign({}, props, {
|
|
3192
|
+
input: RadioGroup
|
|
3193
|
+
}));
|
|
3194
|
+
};
|
|
3195
|
+
const GoAEnumRadioGroupControl = withJsonFormsEnumProps(withTranslateProps(EnumRadioControl), true);
|
|
3196
|
+
const GoARadioGroupControlTester = rankWith(20, and(isEnumControl, optionIs('format', 'radio')));
|
|
3197
|
+
|
|
3198
|
+
const BooleanComponent = ({
|
|
3199
|
+
data,
|
|
3200
|
+
visible,
|
|
3201
|
+
enabled,
|
|
3202
|
+
uischema,
|
|
3203
|
+
handleChange,
|
|
3204
|
+
path,
|
|
3205
|
+
config,
|
|
3206
|
+
label,
|
|
3207
|
+
required,
|
|
3208
|
+
errors,
|
|
3209
|
+
description
|
|
3210
|
+
}) => {
|
|
3211
|
+
var _a;
|
|
3212
|
+
const appliedUiSchemaOptions = Object.assign(Object.assign({}, config), uischema.options);
|
|
3213
|
+
!isDescriptionHidden(visible, description, false, appliedUiSchemaOptions.showUnfocusedDescription);
|
|
3214
|
+
const errorsFormInput = checkFieldValidity({
|
|
3215
|
+
data,
|
|
3216
|
+
uischema,
|
|
3217
|
+
label,
|
|
3218
|
+
required,
|
|
3219
|
+
errors
|
|
3220
|
+
});
|
|
3221
|
+
let text = label + (required ? ' (required)' : '');
|
|
3222
|
+
if (label && description) {
|
|
3223
|
+
text = description;
|
|
3224
|
+
if (required) {
|
|
3225
|
+
text = `${description} ` + (required ? ' (required)' : '');
|
|
3226
|
+
}
|
|
3227
|
+
}
|
|
3228
|
+
return jsx(GoACheckbox, Object.assign({
|
|
3229
|
+
error: errorsFormInput.length > 0,
|
|
3230
|
+
testId: `${path}-checkbox-test-id`,
|
|
3231
|
+
disabled: !enabled,
|
|
3232
|
+
text: text,
|
|
3233
|
+
name: `${path}`,
|
|
3234
|
+
checked: data,
|
|
3235
|
+
onChange: (name, checked, value) => {
|
|
3236
|
+
handleChange(path, checked);
|
|
3237
|
+
}
|
|
3238
|
+
}, (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps));
|
|
3239
|
+
};
|
|
3240
|
+
const BooleanControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
|
|
3241
|
+
noLabel: true,
|
|
3242
|
+
input: BooleanComponent
|
|
3243
|
+
}));
|
|
3244
|
+
const GoABooleanControlTester = rankWith(2, isBooleanControl);
|
|
3245
|
+
const GoABooleanControl = withJsonFormsControlProps(BooleanControl);
|
|
3246
|
+
|
|
3247
|
+
const BooleanRadioComponent = ({
|
|
3248
|
+
data,
|
|
3249
|
+
visible,
|
|
3250
|
+
enabled,
|
|
3251
|
+
uischema,
|
|
3252
|
+
handleChange,
|
|
3253
|
+
path,
|
|
3254
|
+
config,
|
|
3255
|
+
label,
|
|
3256
|
+
required,
|
|
3257
|
+
errors,
|
|
3258
|
+
description
|
|
3259
|
+
}) => {
|
|
3260
|
+
var _a;
|
|
3261
|
+
const appliedUiSchemaOptions = Object.assign(Object.assign({}, config), uischema === null || uischema === void 0 ? void 0 : uischema.options);
|
|
3262
|
+
const TrueValue = (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.textForTrue) || 'Yes';
|
|
3263
|
+
const FalseValue = (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.textForFalse) || 'No';
|
|
3264
|
+
const EnableDescription = (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.enableDescription) === true;
|
|
3265
|
+
const TrueDescription = description || (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.descriptionForTrue);
|
|
3266
|
+
const FalseDescription = description || (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.descriptionForFalse);
|
|
3267
|
+
const BaseTestId = (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${path}-boolean-radio-jsonform`;
|
|
3268
|
+
const errorsFormInput = checkFieldValidity({
|
|
3269
|
+
data,
|
|
3270
|
+
uischema,
|
|
3271
|
+
label,
|
|
3272
|
+
required,
|
|
3273
|
+
errors
|
|
3274
|
+
});
|
|
3275
|
+
return jsx(Hidden, {
|
|
3276
|
+
xsUp: !visible,
|
|
3277
|
+
children: jsxs(GoARadioGroup, Object.assign({
|
|
3278
|
+
error: errorsFormInput.length > 0,
|
|
3279
|
+
name: `${label}`,
|
|
3280
|
+
value: data === true ? TrueValue : data === false ? FalseValue : null,
|
|
3281
|
+
disabled: !enabled,
|
|
3282
|
+
testId: BaseTestId,
|
|
3283
|
+
onChange: (_name, value) => {
|
|
3284
|
+
if (value === TrueValue) {
|
|
3285
|
+
handleChange(path, true);
|
|
3286
|
+
}
|
|
3287
|
+
if (value === FalseValue) {
|
|
3288
|
+
handleChange(path, false);
|
|
3289
|
+
}
|
|
3290
|
+
}
|
|
3291
|
+
}, (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps, {
|
|
3292
|
+
children: [jsx(GoARadioItem, {
|
|
3293
|
+
value: TrueValue,
|
|
3294
|
+
testId: `${BaseTestId}-yes-option`,
|
|
3295
|
+
description: EnableDescription ? TrueDescription : null
|
|
3296
|
+
}), jsx(GoARadioItem, {
|
|
3297
|
+
value: FalseValue,
|
|
3298
|
+
testId: `${BaseTestId}-no-option`,
|
|
3299
|
+
description: EnableDescription ? FalseDescription : null
|
|
3300
|
+
})]
|
|
3301
|
+
}))
|
|
3302
|
+
});
|
|
3303
|
+
};
|
|
3304
|
+
const BooleanRadioControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
|
|
3305
|
+
input: BooleanRadioComponent
|
|
3306
|
+
}));
|
|
3307
|
+
const GoABooleanRadioControlTester = rankWith(3, and(isBooleanControl, optionIs('radio', true)));
|
|
3308
|
+
const GoABooleanRadioControl = withJsonFormsControlProps(BooleanRadioControl);
|
|
3309
|
+
|
|
3310
|
+
var call = functionCall;
|
|
3311
|
+
var hasOwn = hasOwnProperty_1;
|
|
3312
|
+
var isPrototypeOf = objectIsPrototypeOf;
|
|
3313
|
+
var regExpFlags = regexpFlags$1;
|
|
3314
|
+
|
|
3315
|
+
var RegExpPrototype$1 = RegExp.prototype;
|
|
3316
|
+
|
|
3317
|
+
var regexpGetFlags = function (R) {
|
|
3318
|
+
var flags = R.flags;
|
|
3319
|
+
return flags === undefined && !('flags' in RegExpPrototype$1) && !hasOwn(R, 'flags') && isPrototypeOf(RegExpPrototype$1, R)
|
|
3320
|
+
? call(regExpFlags, R) : flags;
|
|
3321
|
+
};
|
|
3322
|
+
|
|
3323
|
+
var PROPER_FUNCTION_NAME = functionName.PROPER;
|
|
3324
|
+
var defineBuiltIn = defineBuiltIn$5;
|
|
3325
|
+
var anObject = anObject$9;
|
|
3326
|
+
var $toString = toString$5;
|
|
3327
|
+
var fails = fails$i;
|
|
3328
|
+
var getRegExpFlags = regexpGetFlags;
|
|
3329
|
+
|
|
3330
|
+
var TO_STRING = 'toString';
|
|
3331
|
+
var RegExpPrototype = RegExp.prototype;
|
|
3332
|
+
var nativeToString = RegExpPrototype[TO_STRING];
|
|
3333
|
+
|
|
3334
|
+
var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) !== '/a/b'; });
|
|
3335
|
+
// FF44- RegExp#toString has a wrong name
|
|
3336
|
+
var INCORRECT_NAME = PROPER_FUNCTION_NAME && nativeToString.name !== TO_STRING;
|
|
3337
|
+
|
|
3338
|
+
// `RegExp.prototype.toString` method
|
|
3339
|
+
// https://tc39.es/ecma262/#sec-regexp.prototype.tostring
|
|
3340
|
+
if (NOT_GENERIC || INCORRECT_NAME) {
|
|
3341
|
+
defineBuiltIn(RegExpPrototype, TO_STRING, function toString() {
|
|
3342
|
+
var R = anObject(this);
|
|
3343
|
+
var pattern = $toString(R.source);
|
|
3344
|
+
var flags = $toString(getRegExpFlags(R));
|
|
3345
|
+
return '/' + pattern + '/' + flags;
|
|
3346
|
+
}, { unsafe: true });
|
|
3347
|
+
}
|
|
3348
|
+
|
|
3349
|
+
let _$5 = t => t,
|
|
3350
|
+
_t$5,
|
|
3351
|
+
_t2$3;
|
|
3352
|
+
const Grid = styled.div(_t$5 || (_t$5 = _$5`
|
|
3353
|
+
display: flex;
|
|
3354
|
+
flex-direction: row;
|
|
3355
|
+
flex-wrap: wrap;
|
|
3356
|
+
justify-content: space-between;
|
|
3357
|
+
align-items: stretch;
|
|
3358
|
+
`));
|
|
3359
|
+
const GridItem = styled.div(_t2$3 || (_t2$3 = _$5`
|
|
3360
|
+
margin-bottom: ${0};
|
|
3361
|
+
|
|
3362
|
+
> .goa-card {
|
|
3363
|
+
height: 100% !important;
|
|
3364
|
+
width: 100% !important;
|
|
3365
|
+
}
|
|
3366
|
+
|
|
3367
|
+
> img {
|
|
3368
|
+
width: 100%;
|
|
3369
|
+
}
|
|
3370
|
+
|
|
3371
|
+
flex: 0 1
|
|
3372
|
+
${0};
|
|
3373
|
+
|
|
3374
|
+
@media (min-width: 768px) {
|
|
3375
|
+
flex-basis: ${0};
|
|
3376
|
+
}
|
|
3377
|
+
@media (min-width: 1024px) {
|
|
3378
|
+
flex-basis: ${0};
|
|
3379
|
+
}
|
|
3380
|
+
@media (min-width: 1280px) {
|
|
3381
|
+
flex-basis: ${0};
|
|
3382
|
+
}
|
|
3383
|
+
`), props => {
|
|
3384
|
+
var _a;
|
|
3385
|
+
return `${(_a = props.vSpacing) !== null && _a !== void 0 ? _a : 0}rem`;
|
|
3386
|
+
}, props => {
|
|
3387
|
+
var _a, _b;
|
|
3388
|
+
return props.sm === 12 || props.sm === undefined ? '100%' : `calc(${100 * ((_a = props === null || props === void 0 ? void 0 : props.sm) !== null && _a !== void 0 ? _a : 12) / 12}% - ${(_b = props.hSpacing) !== null && _b !== void 0 ? _b : 0}rem)`;
|
|
3389
|
+
}, props => {
|
|
3390
|
+
var _a, _b, _c;
|
|
3391
|
+
return props.md === 12 ? '100%' : `calc(${100 * ((_b = (_a = props === null || props === void 0 ? void 0 : props.md) !== null && _a !== void 0 ? _a : props.sm) !== null && _b !== void 0 ? _b : 12) / 12}% - ${(_c = props.hSpacing) !== null && _c !== void 0 ? _c : 0}rem)`;
|
|
3392
|
+
}, props => {
|
|
3393
|
+
var _a, _b, _c, _d;
|
|
3394
|
+
return props.lg === 12 ? '100%' : `calc(${100 * ((_c = (_b = (_a = props === null || props === void 0 ? void 0 : props.lg) !== null && _a !== void 0 ? _a : props === null || props === void 0 ? void 0 : props.md) !== null && _b !== void 0 ? _b : props.sm) !== null && _c !== void 0 ? _c : 12) / 12}% - ${(_d = props.hSpacing) !== null && _d !== void 0 ? _d : 0}rem)`;
|
|
3395
|
+
}, props => {
|
|
3396
|
+
var _a, _b, _c, _d;
|
|
3397
|
+
return props.xl === 12 ? '100%' : `calc(${100 * ((_c = (_b = (_a = props === null || props === void 0 ? void 0 : props.xl) !== null && _a !== void 0 ? _a : props === null || props === void 0 ? void 0 : props.md) !== null && _b !== void 0 ? _b : props.sm) !== null && _c !== void 0 ? _c : 12) / 12}% - ${(_d = props.hSpacing) !== null && _d !== void 0 ? _d : 0}rem)`;
|
|
3398
|
+
});
|
|
3399
|
+
|
|
3400
|
+
let _$4 = t => t,
|
|
3401
|
+
_t$4,
|
|
3402
|
+
_t2$2,
|
|
3403
|
+
_t3$1,
|
|
3404
|
+
_t4,
|
|
3405
|
+
_t5,
|
|
3406
|
+
_t6,
|
|
3407
|
+
_t7;
|
|
3408
|
+
const ReviewItem = styled.div(_t$4 || (_t$4 = _$4`
|
|
3409
|
+
display: flex;
|
|
3410
|
+
flex-direction: column;
|
|
3411
|
+
border: var(--goa-border-width-s) solid grey;
|
|
3412
|
+
border-radius: var(--goa-border-radius-m);
|
|
3413
|
+
margin: var(--goa-space-2xs);
|
|
3414
|
+
padding: var(--goa-space-xs);
|
|
3415
|
+
`));
|
|
3416
|
+
const ReviewItemSection = styled.div(_t2$2 || (_t2$2 = _$4`
|
|
3417
|
+
background-color: #f1f1f1;
|
|
3418
|
+
margin-bottom: 1rem;
|
|
3419
|
+
padding: 1rem;
|
|
3420
|
+
border: 1px solid #dcdcdc;
|
|
3421
|
+
border-radius: 5px;
|
|
3422
|
+
`));
|
|
3423
|
+
const ReviewItemHeader = styled.div(_t3$1 || (_t3$1 = _$4`
|
|
3424
|
+
display: flex;
|
|
3425
|
+
align-items: center;
|
|
3426
|
+
justify-content: space-between;
|
|
3427
|
+
margin-bottom: 2rem;
|
|
3428
|
+
`));
|
|
3429
|
+
const ReviewItemTitle = styled.div(_t4 || (_t4 = _$4`
|
|
3430
|
+
font-size: var(--fs-xl);
|
|
3431
|
+
line-height: var(--lh-lg);
|
|
3432
|
+
font-weight: var(--fw-light);
|
|
3433
|
+
`));
|
|
3434
|
+
const Anchor = styled.div(_t5 || (_t5 = _$4`
|
|
3435
|
+
color: #0070c4;
|
|
3436
|
+
text-decoration: underline;
|
|
3437
|
+
outline: none;
|
|
3438
|
+
cursor: pointer;
|
|
3439
|
+
`));
|
|
3440
|
+
styled.div(_t6 || (_t6 = _$4`
|
|
3441
|
+
margin-left: var(--goa-space-m);
|
|
3442
|
+
`));
|
|
3443
|
+
styled.div(_t7 || (_t7 = _$4`
|
|
3444
|
+
margin-bottom: var(--goa-space-m);
|
|
3445
|
+
`));
|
|
3446
|
+
|
|
3447
|
+
const resolveLabelFromScope = scope => {
|
|
3448
|
+
// eslint-disable-next-line no-useless-escape
|
|
3449
|
+
const validPatternRegex = /^#(\/properties\/[^\/]+)+$/;
|
|
3450
|
+
const isValid = validPatternRegex.test(scope);
|
|
3451
|
+
if (!isValid) return null;
|
|
3452
|
+
const lastSegment = scope.split('/').pop();
|
|
3453
|
+
if (lastSegment) {
|
|
3454
|
+
const lowercased = lastSegment.replace(/([A-Z])/g, ' $1').toLowerCase();
|
|
3455
|
+
return lowercased.charAt(0).toUpperCase() + lowercased.slice(1);
|
|
3456
|
+
}
|
|
3457
|
+
return '';
|
|
3458
|
+
};
|
|
3459
|
+
const getFormFieldValue = (scope, data) => {
|
|
3460
|
+
if (data !== undefined) {
|
|
3461
|
+
const pathArray = scope.replace('#/properties/', '').replace('properties/', '').split('/');
|
|
3462
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3463
|
+
let currentValue = data;
|
|
3464
|
+
for (const key of pathArray) {
|
|
3465
|
+
if (currentValue[key] === undefined) {
|
|
3466
|
+
return '';
|
|
3467
|
+
}
|
|
3468
|
+
currentValue = currentValue[key];
|
|
3469
|
+
}
|
|
3470
|
+
return typeof currentValue === 'object' ? '' : currentValue;
|
|
3471
|
+
} else {
|
|
3472
|
+
return '';
|
|
3473
|
+
}
|
|
3474
|
+
};
|
|
3475
|
+
const renderFormFields = (elements, data) => elements.map((element, index) => {
|
|
3476
|
+
// const clonedElement = element;
|
|
3477
|
+
const clonedElement = JSON.parse(JSON.stringify(element));
|
|
3478
|
+
if (clonedElement.type === 'Control' && clonedElement.scope) {
|
|
3479
|
+
const label = resolveLabelFromScope(clonedElement.scope);
|
|
3480
|
+
if (!label) return null;
|
|
3481
|
+
const value = getFormFieldValue(clonedElement.scope, data ? data : {}).toString();
|
|
3482
|
+
return jsxs(GridItem, {
|
|
3483
|
+
md: 6,
|
|
3484
|
+
vSpacing: 1,
|
|
3485
|
+
hSpacing: 0.5,
|
|
3486
|
+
children: [jsxs("strong", {
|
|
3487
|
+
children: [label, ":"]
|
|
3488
|
+
}), " ", value]
|
|
3489
|
+
}, index);
|
|
3490
|
+
} else if (clonedElement === null || clonedElement === void 0 ? void 0 : clonedElement.elements) {
|
|
3491
|
+
return jsx(React.Fragment, {
|
|
3492
|
+
children: renderFormFields(clonedElement.elements, data)
|
|
3493
|
+
}, index);
|
|
3494
|
+
}
|
|
3495
|
+
return null;
|
|
3496
|
+
});
|
|
3497
|
+
const FormStepper = ({
|
|
3498
|
+
uischema,
|
|
3499
|
+
data,
|
|
3500
|
+
schema,
|
|
3501
|
+
// eslint-disable-next-line
|
|
3502
|
+
ajv,
|
|
3503
|
+
path,
|
|
3504
|
+
cells,
|
|
3505
|
+
renderers,
|
|
3506
|
+
config,
|
|
3507
|
+
visible,
|
|
3508
|
+
enabled,
|
|
3509
|
+
t
|
|
3510
|
+
}) => {
|
|
3511
|
+
const categorization = uischema;
|
|
3512
|
+
const [step, setStep] = useState(0);
|
|
3513
|
+
const [isFormValid, setIsFormValid] = useState(false);
|
|
3514
|
+
const [showNextBtn, setShowNextBtn] = useState(true);
|
|
3515
|
+
const categories = useMemo(() => categorization.elements.filter(category => isVisible(category, data, '', ajv)), [categorization, data, ajv]);
|
|
3516
|
+
const disabledCategoryMap = categories.map(c => !isEnabled(c, data, '', ajv));
|
|
3517
|
+
const handleSubmit = () => {
|
|
3518
|
+
console.log('submitted', data);
|
|
3519
|
+
};
|
|
3520
|
+
const CategoryLabels = useMemo(() => {
|
|
3521
|
+
return categories.map(e => deriveLabelForUISchemaElement(e, t));
|
|
3522
|
+
}, [categories, t]);
|
|
3523
|
+
useEffect(() => {}, [categories.length]);
|
|
3524
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3525
|
+
const vslidateFormData = formData => {
|
|
3526
|
+
const validate = ajv.compile(schema);
|
|
3527
|
+
return validate(formData);
|
|
3528
|
+
};
|
|
3529
|
+
useEffect(() => {
|
|
3530
|
+
const valid = vslidateFormData(data);
|
|
3531
|
+
setIsFormValid(valid);
|
|
3532
|
+
}, [data, vslidateFormData]);
|
|
3533
|
+
if ((categories === null || categories === void 0 ? void 0 : categories.length) < 1) {
|
|
3534
|
+
// eslint-disable-next-line
|
|
3535
|
+
return jsx(Fragment, {});
|
|
3536
|
+
}
|
|
3537
|
+
function nextPage(page, disabled) {
|
|
3538
|
+
page++;
|
|
3539
|
+
while (page <= disabled.length && disabled[page - 1]) {
|
|
3540
|
+
page++;
|
|
3541
|
+
}
|
|
3542
|
+
setPage(page);
|
|
3543
|
+
}
|
|
3544
|
+
function prevPage(page, disabled) {
|
|
3545
|
+
page--;
|
|
3546
|
+
while (page >= 0 && disabled[page - 1]) {
|
|
3547
|
+
page--;
|
|
3548
|
+
}
|
|
3549
|
+
setPage(page);
|
|
3550
|
+
}
|
|
3551
|
+
function setPage(page) {
|
|
3552
|
+
setStep(page);
|
|
3553
|
+
if (page < 1 || page > categories.length + 1) return;
|
|
3554
|
+
if (categories.length + 1 === page) {
|
|
3555
|
+
setShowNextBtn(false);
|
|
3556
|
+
} else {
|
|
3557
|
+
setShowNextBtn(true);
|
|
3558
|
+
}
|
|
3559
|
+
}
|
|
3560
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
3561
|
+
useEffect(() => {
|
|
3562
|
+
setStep(0);
|
|
3563
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3564
|
+
}, []);
|
|
3565
|
+
const renderStepElements = (category, indexOfCategory) => {
|
|
3566
|
+
return (
|
|
3567
|
+
/*
|
|
3568
|
+
[Mar-04-2024][Paul Li] the GoAPages internal state cannot handle the hidden/display well. We need extra hide/display control to it appropriately.
|
|
3569
|
+
*/
|
|
3570
|
+
jsx(Hidden, {
|
|
3571
|
+
xsUp: indexOfCategory !== step - 1,
|
|
3572
|
+
children: category.elements.map((elementUiSchema, index) => {
|
|
3573
|
+
return jsx(JsonFormsDispatch, {
|
|
3574
|
+
schema: schema,
|
|
3575
|
+
uischema: elementUiSchema,
|
|
3576
|
+
renderers: renderers,
|
|
3577
|
+
cells: cells,
|
|
3578
|
+
path: path,
|
|
3579
|
+
visible: visible,
|
|
3580
|
+
enabled: enabled && !disabledCategoryMap[indexOfCategory]
|
|
3581
|
+
}, index);
|
|
3582
|
+
})
|
|
3583
|
+
})
|
|
3584
|
+
);
|
|
3585
|
+
};
|
|
3586
|
+
const handleEdit = index => {
|
|
3587
|
+
setPage(index + 1);
|
|
3588
|
+
};
|
|
3589
|
+
return jsx(Hidden, {
|
|
3590
|
+
xsUp: !visible,
|
|
3591
|
+
children: jsxs("div", {
|
|
3592
|
+
id: `${path || `goa`}-form-stepper`,
|
|
3593
|
+
className: "formStepper",
|
|
3594
|
+
children: [jsxs(GoAFormStepper, {
|
|
3595
|
+
testId: "form-stepper-test",
|
|
3596
|
+
step: step,
|
|
3597
|
+
onChange: step => {
|
|
3598
|
+
setPage(step);
|
|
3599
|
+
},
|
|
3600
|
+
children: [categories === null || categories === void 0 ? void 0 : categories.map((category, index) => {
|
|
3601
|
+
return jsx(GoAFormStep, {
|
|
3602
|
+
text: `${CategoryLabels[index]}${disabledCategoryMap[index] ? ' (disabled)' : ''}`,
|
|
3603
|
+
status: 'incomplete'
|
|
3604
|
+
}, `${CategoryLabels[index]}-tab`);
|
|
3605
|
+
}), jsx(GoAFormStep, {
|
|
3606
|
+
text: "Review",
|
|
3607
|
+
status: "incomplete"
|
|
3608
|
+
})]
|
|
3609
|
+
}), jsxs(GoAPages, {
|
|
3610
|
+
current: step,
|
|
3611
|
+
mb: "xl",
|
|
3612
|
+
children: [categories === null || categories === void 0 ? void 0 : categories.map((category, index) => {
|
|
3613
|
+
return jsx("div", {
|
|
3614
|
+
"data-testid": `step_${index}-content`,
|
|
3615
|
+
children: renderStepElements(category, index)
|
|
3616
|
+
}, `${CategoryLabels[index]}`);
|
|
3617
|
+
}), jsxs("div", {
|
|
3618
|
+
children: [jsx("h3", {
|
|
3619
|
+
style: {
|
|
3620
|
+
flex: 1
|
|
3621
|
+
},
|
|
3622
|
+
children: "Summary"
|
|
3623
|
+
}), jsx(ReviewItem, {
|
|
3624
|
+
children: categories.map((category, index) => {
|
|
3625
|
+
const categoryLabel = category.label || category.i18n || 'Unknown Category';
|
|
3626
|
+
return jsxs(ReviewItemSection, {
|
|
3627
|
+
children: [jsxs(ReviewItemHeader, {
|
|
3628
|
+
children: [jsx(ReviewItemTitle, {
|
|
3629
|
+
children: categoryLabel
|
|
3630
|
+
}), jsx(Anchor, {
|
|
3631
|
+
onClick: () => handleEdit(index),
|
|
3632
|
+
children: "Edit"
|
|
3633
|
+
})]
|
|
3634
|
+
}), jsx(Grid, {
|
|
3635
|
+
children: renderFormFields(category.elements, data)
|
|
3636
|
+
})]
|
|
3637
|
+
}, index);
|
|
3638
|
+
})
|
|
3639
|
+
})]
|
|
3640
|
+
})]
|
|
3641
|
+
}), step && step !== 0 && jsxs("div", {
|
|
3642
|
+
style: {
|
|
3643
|
+
display: 'flex',
|
|
3644
|
+
justifyContent: 'space-between'
|
|
3645
|
+
},
|
|
3646
|
+
children: [step !== 1 ? jsx(GoAButton, {
|
|
3647
|
+
type: "secondary",
|
|
3648
|
+
disabled: disabledCategoryMap[step - 1] || !enabled,
|
|
3649
|
+
onClick: () => prevPage(step, disabledCategoryMap),
|
|
3650
|
+
children: "Previous"
|
|
3651
|
+
}) : jsx("div", {}), step !== null && showNextBtn && jsx(GoAButton, {
|
|
3652
|
+
type: "primary",
|
|
3653
|
+
disabled: disabledCategoryMap[step - 1] || !enabled,
|
|
3654
|
+
onClick: () => nextPage(step, disabledCategoryMap),
|
|
3655
|
+
children: "Next"
|
|
3656
|
+
}), !showNextBtn && jsx("div", {
|
|
3657
|
+
children: jsx(GoAButton, {
|
|
3658
|
+
type: "primary",
|
|
3659
|
+
onClick: handleSubmit,
|
|
3660
|
+
disabled: !isFormValid || !enabled,
|
|
3661
|
+
children: "Submit"
|
|
3662
|
+
})
|
|
3663
|
+
})]
|
|
3664
|
+
})]
|
|
3665
|
+
})
|
|
3666
|
+
});
|
|
3667
|
+
};
|
|
3668
|
+
const FormStepperControl = withAjvProps(withTranslateProps(withJsonFormsLayoutProps(FormStepper)));
|
|
3669
|
+
|
|
3670
|
+
// Ensure that all children (Category) have valid elements or things tend
|
|
3671
|
+
// to blow up. If not, the the error control will report the problem.
|
|
3672
|
+
const categoriesAreValid = uischema => {
|
|
3673
|
+
let isValid = true;
|
|
3674
|
+
if ('type' in uischema && uischema.type === 'Categorization' && 'elements' in uischema) {
|
|
3675
|
+
uischema.elements.forEach(e => {
|
|
3676
|
+
if (e.type !== 'Category' || !('elements' in e)) {
|
|
3677
|
+
isValid = false;
|
|
3678
|
+
}
|
|
3679
|
+
});
|
|
3680
|
+
} else {
|
|
3681
|
+
return false;
|
|
3682
|
+
}
|
|
3683
|
+
return isValid;
|
|
3684
|
+
};
|
|
3685
|
+
const CategorizationRendererTester = rankWith(2, and(uiTypeIs('Categorization'), categoriesAreValid, optionIs('variant', 'stepper')));
|
|
3686
|
+
|
|
3687
|
+
/******************************************************************************
|
|
3688
|
+
Copyright (c) Microsoft Corporation.
|
|
3689
|
+
|
|
3690
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
3691
|
+
purpose with or without fee is hereby granted.
|
|
3692
|
+
|
|
3693
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
3694
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
3695
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
3696
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
3697
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
3698
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
3699
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
3700
|
+
***************************************************************************** */
|
|
3701
|
+
|
|
3702
|
+
function __rest(s, e) {
|
|
3703
|
+
var t = {};
|
|
3704
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
3705
|
+
t[p] = s[p];
|
|
3706
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
3707
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
3708
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
3709
|
+
t[p[i]] = s[p[i]];
|
|
3710
|
+
}
|
|
3711
|
+
return t;
|
|
3712
|
+
}
|
|
3713
|
+
|
|
3714
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
3715
|
+
var e = new Error(message);
|
|
3716
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
3717
|
+
};
|
|
3718
|
+
|
|
3719
|
+
let _$3 = t => t,
|
|
3720
|
+
_t$3;
|
|
3721
|
+
const GoAContextMenuIcon = props => {
|
|
3722
|
+
return jsx(GoAIconButton, {
|
|
3723
|
+
icon: props.type,
|
|
3724
|
+
onClick: props.onClick,
|
|
3725
|
+
title: props.title,
|
|
3726
|
+
testId: props.testId,
|
|
3727
|
+
size: "small",
|
|
3728
|
+
disabled: props.disabled
|
|
3729
|
+
});
|
|
3730
|
+
};
|
|
3731
|
+
const GoAContextMenu = styled.div(_t$3 || (_t$3 = _$3`
|
|
3732
|
+
display: flex;
|
|
3733
|
+
align-items: center;
|
|
3734
|
+
background-color: #fff;
|
|
3735
|
+
gap: var(--goa-space-2xs);
|
|
3736
|
+
|
|
3737
|
+
> .goa-icon-button {
|
|
3738
|
+
cursor: pointer;
|
|
3739
|
+
border-radius: var(--goa-border-radius-m);
|
|
3740
|
+
padding: var(--goa-space-2xs);
|
|
3741
|
+
}
|
|
3742
|
+
> .goa-icon-button + .goa-icon-button {
|
|
3743
|
+
margin-left: var(--goa-space-none);
|
|
3744
|
+
}
|
|
3745
|
+
`));
|
|
3746
|
+
|
|
3747
|
+
let _$2 = t => t,
|
|
3748
|
+
_t$2,
|
|
3749
|
+
_t2$1;
|
|
3750
|
+
const FileUploader = _a => {
|
|
3751
|
+
var _b;
|
|
3752
|
+
var {
|
|
3753
|
+
data,
|
|
3754
|
+
path,
|
|
3755
|
+
handleChange,
|
|
3756
|
+
uischema
|
|
3757
|
+
} = _a,
|
|
3758
|
+
props = __rest(_a, ["data", "path", "handleChange", "uischema"]);
|
|
3759
|
+
const enumerators = useContext(JsonFormContext);
|
|
3760
|
+
const uploadTriggerFunction = enumerators.functions.get('upload-file');
|
|
3761
|
+
const uploadTrigger = uploadTriggerFunction && uploadTriggerFunction();
|
|
3762
|
+
const downloadTriggerFunction = enumerators.functions.get('download-file');
|
|
3763
|
+
const downloadTrigger = downloadTriggerFunction && downloadTriggerFunction();
|
|
3764
|
+
const deleteTriggerFunction = enumerators.functions.get('delete-file');
|
|
3765
|
+
const deleteTrigger = deleteTriggerFunction && deleteTriggerFunction();
|
|
3766
|
+
const fileListValue = enumerators.data.get('file-list');
|
|
3767
|
+
// eslint-disable-next-line
|
|
3768
|
+
const fileList = fileListValue && fileListValue();
|
|
3769
|
+
const {
|
|
3770
|
+
required,
|
|
3771
|
+
label,
|
|
3772
|
+
i18nKeyPrefix
|
|
3773
|
+
} = props;
|
|
3774
|
+
const propertyId = i18nKeyPrefix;
|
|
3775
|
+
const variant = ((_b = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _b === void 0 ? void 0 : _b.variant) || 'button';
|
|
3776
|
+
function uploadFile(file) {
|
|
3777
|
+
if (uploadTrigger) {
|
|
3778
|
+
handleChange(propertyId, ['Loading', Array.isArray(data) ? data[1] : data, file === null || file === void 0 ? void 0 : file.name]);
|
|
3779
|
+
uploadTrigger(file, propertyId);
|
|
3780
|
+
}
|
|
3781
|
+
}
|
|
3782
|
+
function downloadFile(file) {
|
|
3783
|
+
if (downloadTrigger) {
|
|
3784
|
+
downloadTrigger(file, propertyId);
|
|
3785
|
+
}
|
|
3786
|
+
}
|
|
3787
|
+
function deleteFile(file) {
|
|
3788
|
+
if (deleteTrigger) {
|
|
3789
|
+
deleteTrigger(file, propertyId);
|
|
3790
|
+
}
|
|
3791
|
+
}
|
|
3792
|
+
useEffect(() => {
|
|
3793
|
+
// UseEffect is required because not having it causes a react update error, but
|
|
3794
|
+
// it doesn't function correctly within jsonforms unless there is a minor delay here
|
|
3795
|
+
const delayedFunction = () => {
|
|
3796
|
+
var _a, _b;
|
|
3797
|
+
if (fileList && Array.isArray(data) && data[1] !== ((_a = fileList[propertyId]) === null || _a === void 0 ? void 0 : _a.urn)) {
|
|
3798
|
+
handleChange(propertyId, fileList && ((_b = fileList[propertyId]) === null || _b === void 0 ? void 0 : _b.urn));
|
|
3799
|
+
}
|
|
3800
|
+
};
|
|
3801
|
+
const timeoutId = setTimeout(delayedFunction, 1);
|
|
3802
|
+
return () => clearTimeout(timeoutId);
|
|
3803
|
+
}, [data, handleChange, fileList, propertyId]);
|
|
3804
|
+
return jsxs(FileUploaderStyle, {
|
|
3805
|
+
id: "file-upload",
|
|
3806
|
+
className: "FileUploader",
|
|
3807
|
+
children: [required ? jsx(GoAFormItem, {
|
|
3808
|
+
label: label,
|
|
3809
|
+
requirement: "required"
|
|
3810
|
+
}) : jsx("div", {
|
|
3811
|
+
className: "label",
|
|
3812
|
+
children: props.label
|
|
3813
|
+
}), jsx("div", {
|
|
3814
|
+
className: "file-upload",
|
|
3815
|
+
children: jsx(GoAFileUploadInput, {
|
|
3816
|
+
variant: variant,
|
|
3817
|
+
onSelectFile: uploadFile
|
|
3818
|
+
})
|
|
3819
|
+
}), jsx("div", {
|
|
3820
|
+
children: Array.isArray(data) && data[0] === 'Loading' ? jsx(GoAModal, {
|
|
3821
|
+
open: Array.isArray(data) && data[0] === 'Loading',
|
|
3822
|
+
children: jsx("div", {
|
|
3823
|
+
className: "align-center",
|
|
3824
|
+
children: jsx(GoACircularProgress, {
|
|
3825
|
+
visible: true,
|
|
3826
|
+
message: `Uploading ${data[2]}`,
|
|
3827
|
+
size: "large"
|
|
3828
|
+
})
|
|
3829
|
+
})
|
|
3830
|
+
}) : jsx("div", {
|
|
3831
|
+
children: fileList && fileList[props.i18nKeyPrefix] && jsxs(AttachmentBorder, {
|
|
3832
|
+
children: [jsx("div", {
|
|
3833
|
+
children: fileList && fileList[props.i18nKeyPrefix].filename
|
|
3834
|
+
}), jsxs(GoAContextMenu, {
|
|
3835
|
+
children: [jsx(GoAContextMenuIcon, {
|
|
3836
|
+
testId: "download-icon",
|
|
3837
|
+
title: "Download",
|
|
3838
|
+
type: "download",
|
|
3839
|
+
onClick: () => downloadFile(fileList && fileList[props.i18nKeyPrefix])
|
|
3840
|
+
}), jsx(GoAContextMenuIcon, {
|
|
3841
|
+
"data-testid": "delete-icon",
|
|
3842
|
+
title: "Delete",
|
|
3843
|
+
type: "trash",
|
|
3844
|
+
onClick: () => deleteFile(fileList && fileList[props.i18nKeyPrefix])
|
|
3845
|
+
})]
|
|
3846
|
+
})]
|
|
3847
|
+
})
|
|
3848
|
+
})
|
|
3849
|
+
})]
|
|
3850
|
+
});
|
|
3851
|
+
};
|
|
3852
|
+
const AttachmentBorder = styled.div(_t$2 || (_t$2 = _$2`
|
|
3853
|
+
display: flex;
|
|
3854
|
+
flex-direction: row;
|
|
3855
|
+
border: var(--goa-border-width-s) solid #dcdcdc;
|
|
3856
|
+
border-radius: var(--goa-border-radius-m);
|
|
3857
|
+
padding: var(--goa-space-xs);
|
|
3858
|
+
width: fit-content;
|
|
3859
|
+
margin-top: var(--goa-space-2xs);
|
|
3860
|
+
`));
|
|
3861
|
+
const FileUploaderStyle = styled.div(_t2$1 || (_t2$1 = _$2`
|
|
3862
|
+
.label {
|
|
3863
|
+
display: block;
|
|
3864
|
+
font-weight: var(--goa-font-weight-bold);
|
|
3865
|
+
color: var(--goa-color-text-default);
|
|
3866
|
+
font-size: var(--goa-font-size-4);
|
|
3867
|
+
padding: 0 0 var(--goa-space-xs) 0;
|
|
3868
|
+
}
|
|
3869
|
+
|
|
3870
|
+
.align-center {
|
|
3871
|
+
text-align-last: center;
|
|
3872
|
+
}
|
|
3873
|
+
|
|
3874
|
+
.file-upload {
|
|
3875
|
+
margin-bottom: var(--goa-space-xs);
|
|
3876
|
+
}
|
|
3877
|
+
`));
|
|
3878
|
+
|
|
3879
|
+
const FileUploaderTester = rankWith(3, and(schemaTypeIs('string'), formatIs('file-urn')));
|
|
3880
|
+
|
|
3881
|
+
const ObjectArrayToolBar = /*#__PURE__*/React.memo(function TableToolbar({
|
|
3882
|
+
numColumns,
|
|
3883
|
+
errors,
|
|
3884
|
+
label,
|
|
3885
|
+
path,
|
|
3886
|
+
addItem,
|
|
3887
|
+
schema,
|
|
3888
|
+
enabled,
|
|
3889
|
+
translations,
|
|
3890
|
+
rootSchema,
|
|
3891
|
+
uischema
|
|
3892
|
+
}) {
|
|
3893
|
+
var _a, _b;
|
|
3894
|
+
const buttonPosition = ((_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.addButtonPosition) || 'left';
|
|
3895
|
+
return jsx(Fragment, {
|
|
3896
|
+
children: jsx("div", {
|
|
3897
|
+
style: {
|
|
3898
|
+
textAlign: buttonPosition
|
|
3899
|
+
},
|
|
3900
|
+
children: jsx(GoAButton, {
|
|
3901
|
+
disabled: !enabled,
|
|
3902
|
+
testId: `object-array-toolbar-${label}`,
|
|
3903
|
+
"aria-label": translations.addAriaLabel,
|
|
3904
|
+
onClick: addItem(path, createDefaultValue(schema, rootSchema)),
|
|
3905
|
+
children: ((_b = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _b === void 0 ? void 0 : _b.addButtonText) || 'Add'
|
|
3906
|
+
})
|
|
3907
|
+
})
|
|
3908
|
+
});
|
|
3909
|
+
});
|
|
3910
|
+
|
|
3911
|
+
let _$1 = t => t,
|
|
3912
|
+
_t$1,
|
|
3913
|
+
_t2,
|
|
3914
|
+
_t3;
|
|
3915
|
+
const DeleteDialogContent = styled.div(_t$1 || (_t$1 = _$1`
|
|
3916
|
+
margin-bottom: var(--goa-space-m);
|
|
3917
|
+
`));
|
|
3918
|
+
const ToolBarHeader = styled.div(_t2 || (_t2 = _$1`
|
|
3919
|
+
margin-bottom: var(--goa-space-l);
|
|
3920
|
+
`));
|
|
3921
|
+
const ObjectArrayTitle = styled.h2(_t3 || (_t3 = _$1`
|
|
3922
|
+
margin-bottom: var(--goa-space-l);
|
|
3923
|
+
`));
|
|
3924
|
+
|
|
3925
|
+
// eslint-disable-next-line
|
|
3926
|
+
const extractScopesFromUISchema = uischema => {
|
|
3927
|
+
var _a;
|
|
3928
|
+
const scopes = [];
|
|
3929
|
+
if (uischema === null || uischema === void 0 ? void 0 : uischema.elements) {
|
|
3930
|
+
// eslint-disable-next-line
|
|
3931
|
+
(_a = uischema === null || uischema === void 0 ? void 0 : uischema.elements) === null || _a === void 0 ? void 0 : _a.forEach(element => {
|
|
3932
|
+
var _a;
|
|
3933
|
+
if (element === null || element === void 0 ? void 0 : element.elements) {
|
|
3934
|
+
// eslint-disable-next-line
|
|
3935
|
+
(_a = element === null || element === void 0 ? void 0 : element.elements) === null || _a === void 0 ? void 0 : _a.forEach(internalElement => {
|
|
3936
|
+
if (internalElement === null || internalElement === void 0 ? void 0 : internalElement.scope) {
|
|
3937
|
+
scopes.push(internalElement === null || internalElement === void 0 ? void 0 : internalElement.scope);
|
|
3938
|
+
}
|
|
3939
|
+
});
|
|
3940
|
+
}
|
|
3941
|
+
});
|
|
3942
|
+
}
|
|
3943
|
+
return scopes;
|
|
3944
|
+
};
|
|
3945
|
+
const GenerateRows = (Cell, schema, rowPath, enabled, cells, uischema) => {
|
|
3946
|
+
if (schema.type === 'object') {
|
|
3947
|
+
const props = {
|
|
3948
|
+
schema,
|
|
3949
|
+
rowPath,
|
|
3950
|
+
enabled,
|
|
3951
|
+
cells,
|
|
3952
|
+
uischema
|
|
3953
|
+
};
|
|
3954
|
+
return jsx(Cell, Object.assign({}, props));
|
|
3955
|
+
} else {
|
|
3956
|
+
// primitives
|
|
3957
|
+
const props = {
|
|
3958
|
+
schema,
|
|
3959
|
+
rowPath,
|
|
3960
|
+
cellPath: rowPath,
|
|
3961
|
+
enabled
|
|
3962
|
+
};
|
|
3963
|
+
return jsx(Cell, Object.assign({}, props), rowPath);
|
|
3964
|
+
}
|
|
3965
|
+
};
|
|
3966
|
+
const getValidColumnProps = scopedSchema => {
|
|
3967
|
+
if (scopedSchema.type === 'object' && typeof scopedSchema.properties === 'object') {
|
|
3968
|
+
return Object.keys(scopedSchema.properties).filter(prop => {
|
|
3969
|
+
var _a;
|
|
3970
|
+
return ((_a = scopedSchema.properties) === null || _a === void 0 ? void 0 : _a[prop].type) !== 'array';
|
|
3971
|
+
});
|
|
3972
|
+
}
|
|
3973
|
+
// primitives
|
|
3974
|
+
return [''];
|
|
3975
|
+
};
|
|
3976
|
+
const EmptyList = ({
|
|
3977
|
+
numColumns,
|
|
3978
|
+
translations
|
|
3979
|
+
}) => jsx(GoAGrid, {
|
|
3980
|
+
minChildWidth: "30ch",
|
|
3981
|
+
children: jsx(Typography, {
|
|
3982
|
+
align: "center",
|
|
3983
|
+
children: jsx("b", {
|
|
3984
|
+
children: translations.noDataMessage
|
|
3985
|
+
})
|
|
3986
|
+
})
|
|
3987
|
+
});
|
|
3988
|
+
const ctxToNonEmptyCellProps = (ctx, ownProps) => {
|
|
3989
|
+
var _a;
|
|
3990
|
+
ownProps.rowPath + (ownProps.schema.type === 'object' ? '.' + ownProps.propName : '');
|
|
3991
|
+
const errors = '';
|
|
3992
|
+
return {
|
|
3993
|
+
uischema: ownProps.uischema,
|
|
3994
|
+
rowPath: ownProps.rowPath,
|
|
3995
|
+
schema: ownProps.schema,
|
|
3996
|
+
rootSchema: (_a = ctx.core) === null || _a === void 0 ? void 0 : _a.schema,
|
|
3997
|
+
errors,
|
|
3998
|
+
enabled: ownProps.enabled,
|
|
3999
|
+
cells: ownProps.cells || ctx.cells,
|
|
4000
|
+
renderers: ownProps.renderers || ctx.renderers
|
|
4001
|
+
};
|
|
4002
|
+
};
|
|
4003
|
+
const NonEmptyCellComponent = /*#__PURE__*/React.memo(function NonEmptyCellComponent({
|
|
4004
|
+
schema,
|
|
4005
|
+
errors,
|
|
4006
|
+
enabled,
|
|
4007
|
+
renderers,
|
|
4008
|
+
cells,
|
|
4009
|
+
rowPath,
|
|
4010
|
+
isValid,
|
|
4011
|
+
uischema
|
|
4012
|
+
}) {
|
|
4013
|
+
var _a, _b;
|
|
4014
|
+
const propNames = getValidColumnProps(schema);
|
|
4015
|
+
const propScopes = (uischema === null || uischema === void 0 ? void 0 : uischema.scope) ? propNames.map(name => {
|
|
4016
|
+
return `#/properties/${name}`;
|
|
4017
|
+
}) : [];
|
|
4018
|
+
const scopesInElements = extractScopesFromUISchema(uischema);
|
|
4019
|
+
const scopesNotInElements = propScopes.filter(scope => {
|
|
4020
|
+
return !scopesInElements.includes(scope);
|
|
4021
|
+
});
|
|
4022
|
+
/* Create default elements for scope not defined in the uischema
|
|
4023
|
+
* future work: merge the options
|
|
4024
|
+
*/
|
|
4025
|
+
const uiSchemaElementsForNotDefined = {
|
|
4026
|
+
type: ((_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.defaultType) || 'VerticalLayout',
|
|
4027
|
+
elements: scopesNotInElements.map(scope => {
|
|
4028
|
+
return {
|
|
4029
|
+
type: 'Control',
|
|
4030
|
+
scope
|
|
4031
|
+
};
|
|
4032
|
+
})
|
|
4033
|
+
};
|
|
4034
|
+
return jsxs(Fragment, {
|
|
4035
|
+
children: [
|
|
4036
|
+
// eslint-disable-next-line
|
|
4037
|
+
(_b = uischema === null || uischema === void 0 ? void 0 : uischema.elements) === null || _b === void 0 ? void 0 : _b.map(element => {
|
|
4038
|
+
return jsx(JsonFormsDispatch, {
|
|
4039
|
+
schema: schema,
|
|
4040
|
+
uischema: element,
|
|
4041
|
+
path: rowPath,
|
|
4042
|
+
enabled: enabled,
|
|
4043
|
+
renderers: renderers,
|
|
4044
|
+
cells: cells
|
|
4045
|
+
}, rowPath);
|
|
4046
|
+
}), jsx(JsonFormsDispatch, {
|
|
4047
|
+
schema: schema,
|
|
4048
|
+
uischema: uiSchemaElementsForNotDefined,
|
|
4049
|
+
path: rowPath,
|
|
4050
|
+
enabled: enabled,
|
|
4051
|
+
renderers: renderers,
|
|
4052
|
+
cells: cells
|
|
4053
|
+
}), jsx(FormHelperText, {
|
|
4054
|
+
error: !isValid,
|
|
4055
|
+
children: !isValid && errors
|
|
4056
|
+
})]
|
|
4057
|
+
});
|
|
4058
|
+
});
|
|
4059
|
+
const NonEmptyCell = ownProps => {
|
|
4060
|
+
const ctx = useJsonForms();
|
|
4061
|
+
const emptyCellProps = ctxToNonEmptyCellProps(ctx, ownProps);
|
|
4062
|
+
const isValid = isEmpty(emptyCellProps.errors);
|
|
4063
|
+
return jsx(NonEmptyCellComponent, Object.assign({}, emptyCellProps, {
|
|
4064
|
+
isValid: isValid
|
|
4065
|
+
}));
|
|
4066
|
+
};
|
|
4067
|
+
const NonEmptyRowComponent = ({
|
|
4068
|
+
childPath,
|
|
4069
|
+
schema,
|
|
4070
|
+
rowIndex,
|
|
4071
|
+
openDeleteDialog,
|
|
4072
|
+
enabled,
|
|
4073
|
+
cells,
|
|
4074
|
+
path,
|
|
4075
|
+
translations,
|
|
4076
|
+
uischema
|
|
4077
|
+
}) => {
|
|
4078
|
+
return jsx("div", {
|
|
4079
|
+
children: enabled ? jsxs(GoAContainer, {
|
|
4080
|
+
children: [jsx(GoAGrid, {
|
|
4081
|
+
minChildWidth: "30ch",
|
|
4082
|
+
children: jsx(GoAIconButton, {
|
|
4083
|
+
icon: "trash",
|
|
4084
|
+
"aria-label": translations.removeAriaLabel,
|
|
4085
|
+
onClick: () => openDeleteDialog(childPath, rowIndex)
|
|
4086
|
+
})
|
|
4087
|
+
}), GenerateRows(NonEmptyCell, schema, childPath, enabled, cells, uischema)]
|
|
4088
|
+
}) : null
|
|
4089
|
+
}, childPath);
|
|
4090
|
+
};
|
|
4091
|
+
const NonEmptyList = /*#__PURE__*/React.memo(NonEmptyRowComponent);
|
|
4092
|
+
const ObjectArrayList = ({
|
|
4093
|
+
data,
|
|
4094
|
+
path,
|
|
4095
|
+
schema,
|
|
4096
|
+
openDeleteDialog,
|
|
4097
|
+
uischema,
|
|
4098
|
+
config,
|
|
4099
|
+
enabled,
|
|
4100
|
+
cells,
|
|
4101
|
+
translations
|
|
4102
|
+
}) => {
|
|
4103
|
+
const isEmptyList = data === 0;
|
|
4104
|
+
if (isEmptyList) {
|
|
4105
|
+
return jsx(EmptyList, {
|
|
4106
|
+
numColumns: getValidColumnProps(schema).length + 1,
|
|
4107
|
+
translations: translations
|
|
4108
|
+
});
|
|
4109
|
+
}
|
|
4110
|
+
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
4111
|
+
return jsx(Fragment, {
|
|
4112
|
+
children: range(data).map(index => {
|
|
4113
|
+
const childPath = Paths.compose(path, `${index}`);
|
|
4114
|
+
return jsx(NonEmptyList, {
|
|
4115
|
+
childPath: childPath,
|
|
4116
|
+
rowIndex: index,
|
|
4117
|
+
schema: schema,
|
|
4118
|
+
openDeleteDialog: openDeleteDialog,
|
|
4119
|
+
showSortButtons: appliedUiSchemaOptions.showSortButtons || appliedUiSchemaOptions.showArrayTableSortButtons,
|
|
4120
|
+
enabled: enabled,
|
|
4121
|
+
cells: cells,
|
|
4122
|
+
path: path,
|
|
4123
|
+
uischema: uischema,
|
|
4124
|
+
translations: translations
|
|
4125
|
+
}, childPath);
|
|
4126
|
+
})
|
|
4127
|
+
});
|
|
4128
|
+
};
|
|
4129
|
+
// eslint-disable-next-line
|
|
4130
|
+
class ObjectArrayControl extends React.Component {
|
|
4131
|
+
constructor() {
|
|
4132
|
+
super(...arguments);
|
|
4133
|
+
// eslint-disable-next-line
|
|
4134
|
+
this.addItem = (path, value) => this.props.addItem(path, value);
|
|
4135
|
+
}
|
|
4136
|
+
render() {
|
|
4137
|
+
var _a;
|
|
4138
|
+
const _b = this.props,
|
|
4139
|
+
{
|
|
4140
|
+
label,
|
|
4141
|
+
path,
|
|
4142
|
+
schema,
|
|
4143
|
+
rootSchema,
|
|
4144
|
+
uischema,
|
|
4145
|
+
errors,
|
|
4146
|
+
openDeleteDialog,
|
|
4147
|
+
visible,
|
|
4148
|
+
enabled,
|
|
4149
|
+
cells,
|
|
4150
|
+
translations,
|
|
4151
|
+
data,
|
|
4152
|
+
config
|
|
4153
|
+
} = _b,
|
|
4154
|
+
additionalProps = __rest(_b, ["label", "path", "schema", "rootSchema", "uischema", "errors", "openDeleteDialog", "visible", "enabled", "cells", "translations", "data", "config"]);
|
|
4155
|
+
const controlElement = uischema;
|
|
4156
|
+
// eslint-disable-next-line
|
|
4157
|
+
const listTitle = label || ((_a = uischema.options) === null || _a === void 0 ? void 0 : _a.title);
|
|
4158
|
+
return jsx(Hidden, {
|
|
4159
|
+
xsUp: !visible,
|
|
4160
|
+
children: jsxs("div", {
|
|
4161
|
+
children: [jsxs(ToolBarHeader, {
|
|
4162
|
+
children: [listTitle && jsx(ObjectArrayTitle, {
|
|
4163
|
+
children: listTitle
|
|
4164
|
+
}), jsx(ObjectArrayToolBar, {
|
|
4165
|
+
errors: errors,
|
|
4166
|
+
label: label,
|
|
4167
|
+
addItem: this.addItem,
|
|
4168
|
+
numColumns: 0,
|
|
4169
|
+
path: path,
|
|
4170
|
+
uischema: controlElement,
|
|
4171
|
+
schema: schema,
|
|
4172
|
+
rootSchema: rootSchema,
|
|
4173
|
+
enabled: enabled,
|
|
4174
|
+
translations: translations
|
|
4175
|
+
})]
|
|
4176
|
+
}), jsx("div", {
|
|
4177
|
+
children: jsx(ObjectArrayList, Object.assign({
|
|
4178
|
+
path: path,
|
|
4179
|
+
schema: schema,
|
|
4180
|
+
uischema: uischema,
|
|
4181
|
+
enabled: enabled,
|
|
4182
|
+
openDeleteDialog: openDeleteDialog,
|
|
4183
|
+
translations: translations,
|
|
4184
|
+
data: data,
|
|
4185
|
+
cells: cells,
|
|
4186
|
+
config: config
|
|
4187
|
+
}, additionalProps))
|
|
4188
|
+
})]
|
|
4189
|
+
})
|
|
4190
|
+
});
|
|
4191
|
+
}
|
|
4192
|
+
}
|
|
4193
|
+
|
|
4194
|
+
const DeleteDialog = /*#__PURE__*/React.memo(function DeleteDialog({
|
|
4195
|
+
open,
|
|
4196
|
+
onConfirm,
|
|
4197
|
+
onCancel,
|
|
4198
|
+
title,
|
|
4199
|
+
message
|
|
4200
|
+
}) {
|
|
4201
|
+
return jsxs(GoAModal, {
|
|
4202
|
+
open: open,
|
|
4203
|
+
testId: "object-array-modal",
|
|
4204
|
+
heading: title,
|
|
4205
|
+
children: [jsx(DeleteDialogContent, {
|
|
4206
|
+
"data-testid": "object-array-modal-content",
|
|
4207
|
+
children: message
|
|
4208
|
+
}), jsxs(GoAButtonGroup, {
|
|
4209
|
+
alignment: "end",
|
|
4210
|
+
children: [jsx(GoAButton, {
|
|
4211
|
+
type: "secondary",
|
|
4212
|
+
testId: "object-array-modal-button",
|
|
4213
|
+
onClick: () => {
|
|
4214
|
+
onCancel();
|
|
4215
|
+
},
|
|
4216
|
+
children: "Cancel"
|
|
4217
|
+
}), jsx(GoAButton, {
|
|
4218
|
+
type: "primary",
|
|
4219
|
+
testId: "object-array-confirm-button",
|
|
4220
|
+
onClick: () => {
|
|
4221
|
+
onConfirm();
|
|
4222
|
+
},
|
|
4223
|
+
children: "Delete"
|
|
4224
|
+
})]
|
|
4225
|
+
})]
|
|
4226
|
+
}, 1);
|
|
4227
|
+
});
|
|
4228
|
+
|
|
4229
|
+
const ArrayControl = props => {
|
|
4230
|
+
const [open, setOpen] = useState(false);
|
|
4231
|
+
const [path, setPath] = useState();
|
|
4232
|
+
const [rowData, setRowData] = useState(0);
|
|
4233
|
+
const {
|
|
4234
|
+
removeItems,
|
|
4235
|
+
visible
|
|
4236
|
+
} = props;
|
|
4237
|
+
const openDeleteDialog = useCallback((p, rowIndex) => {
|
|
4238
|
+
setOpen(true);
|
|
4239
|
+
setPath(p);
|
|
4240
|
+
setRowData(rowIndex);
|
|
4241
|
+
}, [setOpen, setPath, setRowData]);
|
|
4242
|
+
const deleteCancel = useCallback(() => setOpen(false), [setOpen]);
|
|
4243
|
+
// eslint-disable-next-line
|
|
4244
|
+
const deleteConfirm = useCallback(() => {
|
|
4245
|
+
const p = path === null || path === void 0 ? void 0 : path.substring(0, path.lastIndexOf('.'));
|
|
4246
|
+
if (removeItems && p) {
|
|
4247
|
+
removeItems(p, [rowData])();
|
|
4248
|
+
}
|
|
4249
|
+
setOpen(false);
|
|
4250
|
+
// eslint-disable-next-line
|
|
4251
|
+
}, [setOpen, path, rowData]);
|
|
4252
|
+
return jsxs(Hidden, {
|
|
4253
|
+
xsUp: !visible,
|
|
4254
|
+
children: [jsx(ObjectArrayControl, Object.assign({}, props, {
|
|
4255
|
+
openDeleteDialog: openDeleteDialog
|
|
4256
|
+
})), jsx(DeleteDialog, {
|
|
4257
|
+
open: open,
|
|
4258
|
+
onCancel: deleteCancel,
|
|
4259
|
+
onConfirm: deleteConfirm,
|
|
4260
|
+
title: props.translations.deleteDialogTitle || '',
|
|
4261
|
+
message: props.translations.deleteDialogMessage || ''
|
|
4262
|
+
})]
|
|
4263
|
+
});
|
|
4264
|
+
};
|
|
4265
|
+
const GoAArrayControlTester = rankWith(3, or(isObjectArrayControl, isPrimitiveArrayControl));
|
|
4266
|
+
const GoAArrayControlRenderer = withJsonFormsArrayLayoutProps(ArrayControl);
|
|
4267
|
+
const GoAListWithDetailsTester = rankWith(3, and(uiTypeIs('ListWithDetail')));
|
|
4268
|
+
|
|
4269
|
+
const GoATextCell = props => jsx(GoAInputText, Object.assign({}, props));
|
|
4270
|
+
const GoATextCellTester = rankWith(1, isStringControl);
|
|
4271
|
+
withJsonFormsCellProps(GoATextCell);
|
|
4272
|
+
|
|
4273
|
+
const GoADateCell = props => jsx(GoADateInput, Object.assign({}, props));
|
|
4274
|
+
const GoADateCellTester = rankWith(1, isDateControl);
|
|
4275
|
+
withJsonFormsCellProps(GoADateCell);
|
|
4276
|
+
|
|
4277
|
+
const GoATimeCell = props => jsx(GoADateInput, Object.assign({}, props));
|
|
4278
|
+
const GoATimeCellTester = rankWith(2, isTimeControl);
|
|
4279
|
+
withJsonFormsCellProps(GoATimeCell);
|
|
4280
|
+
|
|
4281
|
+
const GoANumberCell = props => jsx(GoANumberInput, Object.assign({}, props));
|
|
4282
|
+
const GoANumberCellTester = rankWith(1, isNumberControl);
|
|
4283
|
+
withJsonFormsCellProps(GoANumberCell);
|
|
4284
|
+
|
|
4285
|
+
const GoAIntegerCell = props => jsx(GoAInputInteger, Object.assign({}, props));
|
|
4286
|
+
const GoAIntegerCellTester = rankWith(1, isIntegerControl);
|
|
4287
|
+
withJsonFormsCellProps(GoAIntegerCell);
|
|
4288
|
+
|
|
4289
|
+
const InputCells = [{
|
|
4290
|
+
tester: GoATextCellTester,
|
|
4291
|
+
cell: withJsonFormsCellProps(GoATextCell)
|
|
4292
|
+
}, {
|
|
4293
|
+
tester: GoADateCellTester,
|
|
4294
|
+
cell: withJsonFormsCellProps(GoADateCell)
|
|
4295
|
+
}, {
|
|
4296
|
+
tester: GoATimeCellTester,
|
|
4297
|
+
cell: withJsonFormsCellProps(GoATimeCell)
|
|
4298
|
+
}, {
|
|
4299
|
+
tester: GoANumberCellTester,
|
|
4300
|
+
cell: withJsonFormsCellProps(GoANumberCell)
|
|
4301
|
+
}, {
|
|
4302
|
+
tester: GoAIntegerCellTester,
|
|
4303
|
+
cell: withJsonFormsCellProps(GoAIntegerCell)
|
|
4304
|
+
}];
|
|
4305
|
+
|
|
4306
|
+
const renderLayoutElements = (elements, schema, path, enabled, renderers, cells) => {
|
|
4307
|
+
return elements.map((child, index) => jsx("div", {
|
|
4308
|
+
children: jsx(JsonFormsDispatch, {
|
|
4309
|
+
uischema: child,
|
|
4310
|
+
schema: schema,
|
|
4311
|
+
path: path,
|
|
4312
|
+
enabled: enabled,
|
|
4313
|
+
renderers: renderers,
|
|
4314
|
+
cells: cells
|
|
4315
|
+
}, path)
|
|
4316
|
+
}, index));
|
|
4317
|
+
};
|
|
4318
|
+
const LayoutRenderer = ({
|
|
4319
|
+
elements,
|
|
4320
|
+
schema,
|
|
4321
|
+
path,
|
|
4322
|
+
enabled,
|
|
4323
|
+
direction,
|
|
4324
|
+
renderers,
|
|
4325
|
+
cells,
|
|
4326
|
+
visible
|
|
4327
|
+
}) => {
|
|
4328
|
+
if (isEmpty(elements)) {
|
|
4329
|
+
return null;
|
|
4330
|
+
} else {
|
|
4331
|
+
if (direction === 'row') {
|
|
4332
|
+
return jsx(Hidden, {
|
|
4333
|
+
xsUp: !visible,
|
|
4334
|
+
children: jsx(GoAGrid, {
|
|
4335
|
+
minChildWidth: "10ch",
|
|
4336
|
+
children: renderLayoutElements(elements, schema, path, enabled, renderers, cells)
|
|
4337
|
+
})
|
|
4338
|
+
});
|
|
4339
|
+
} else {
|
|
4340
|
+
return jsx(Hidden, {
|
|
4341
|
+
xsUp: !visible,
|
|
4342
|
+
children: renderLayoutElements(elements, schema, path, enabled, renderers, cells)
|
|
4343
|
+
});
|
|
4344
|
+
}
|
|
4345
|
+
}
|
|
4346
|
+
};
|
|
4347
|
+
|
|
4348
|
+
rankWith(2, uiTypeIs('HorizontalLayout'));
|
|
4349
|
+
const GoAHorizontalLayoutComponent = ({
|
|
4350
|
+
uischema,
|
|
4351
|
+
renderers,
|
|
4352
|
+
cells,
|
|
4353
|
+
schema,
|
|
4354
|
+
path,
|
|
4355
|
+
enabled,
|
|
4356
|
+
visible
|
|
4357
|
+
}) => {
|
|
4358
|
+
const layout = uischema;
|
|
4359
|
+
const childProps = {
|
|
4360
|
+
elements: layout.elements,
|
|
4361
|
+
schema,
|
|
4362
|
+
path,
|
|
4363
|
+
enabled,
|
|
4364
|
+
direction: 'row',
|
|
4365
|
+
visible
|
|
4366
|
+
};
|
|
4367
|
+
return jsx(LayoutRenderer, Object.assign({}, childProps, {
|
|
4368
|
+
renderers: renderers,
|
|
4369
|
+
cells: cells
|
|
4370
|
+
}));
|
|
4371
|
+
};
|
|
4372
|
+
const GoAHorizontalLayout = withJsonFormsLayoutProps(GoAHorizontalLayoutComponent, true);
|
|
4373
|
+
|
|
4374
|
+
const GoAVerticalLayoutComponent = ({
|
|
4375
|
+
uischema,
|
|
4376
|
+
schema,
|
|
4377
|
+
path,
|
|
4378
|
+
enabled,
|
|
4379
|
+
renderers,
|
|
4380
|
+
cells,
|
|
4381
|
+
visible
|
|
4382
|
+
}) => {
|
|
4383
|
+
const verticalLayout = uischema;
|
|
4384
|
+
const childProps = {
|
|
4385
|
+
elements: verticalLayout.elements,
|
|
4386
|
+
schema,
|
|
4387
|
+
path,
|
|
4388
|
+
enabled,
|
|
4389
|
+
direction: 'column',
|
|
4390
|
+
visible
|
|
4391
|
+
};
|
|
4392
|
+
return jsx(LayoutRenderer, Object.assign({}, childProps, {
|
|
4393
|
+
renderers: renderers,
|
|
4394
|
+
cells: cells
|
|
4395
|
+
}));
|
|
4396
|
+
};
|
|
4397
|
+
const GoAVerticalLayout = withJsonFormsLayoutProps(GoAVerticalLayoutComponent, true);
|
|
4398
|
+
|
|
4399
|
+
const groupTester = rankWith(1, uiTypeIs('Group'));
|
|
4400
|
+
const GoAGroupControlComponent = props => {
|
|
4401
|
+
var _a;
|
|
4402
|
+
const {
|
|
4403
|
+
uischema,
|
|
4404
|
+
schema,
|
|
4405
|
+
path,
|
|
4406
|
+
enabled,
|
|
4407
|
+
renderers,
|
|
4408
|
+
cells,
|
|
4409
|
+
visible
|
|
4410
|
+
} = props;
|
|
4411
|
+
const group = uischema;
|
|
4412
|
+
return jsx(Hidden, {
|
|
4413
|
+
xsUp: !visible,
|
|
4414
|
+
children: jsx(GoAContainer, Object.assign({}, group.options, (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps, {
|
|
4415
|
+
children: renderLayoutElements(group.elements, schema, path, enabled, renderers, cells)
|
|
4416
|
+
}))
|
|
4417
|
+
});
|
|
4418
|
+
};
|
|
4419
|
+
const GoAGroupLayoutTester = withIncreasedRank(1, groupTester);
|
|
4420
|
+
const GoAGroupControl = withJsonFormsLayoutProps(GoAGroupControlComponent);
|
|
4421
|
+
|
|
4422
|
+
let _ = t => t,
|
|
4423
|
+
_t;
|
|
4424
|
+
const HelpContentDiv = styled.div(_t || (_t = _`
|
|
4425
|
+
.parent-label {
|
|
4426
|
+
font-size: 24px;
|
|
4427
|
+
margin-bottom: var(--goa-space-m);
|
|
4428
|
+
font-weight: bold;
|
|
4429
|
+
}
|
|
4430
|
+
|
|
4431
|
+
.child-label {
|
|
4432
|
+
font-size: 18px;
|
|
4433
|
+
margin-bottom: var(--goa-space-xs);
|
|
4434
|
+
font-weight: bold;
|
|
4435
|
+
}
|
|
4436
|
+
.parent-margin {
|
|
4437
|
+
margin-bottom: var(--goa-space-l);
|
|
4438
|
+
}
|
|
4439
|
+
.child-margin {
|
|
4440
|
+
margin-bottom: var(--goa-space-2xs);
|
|
4441
|
+
}
|
|
4442
|
+
ul {
|
|
4443
|
+
margin: 0 0 0 var(--goa-space-xs);
|
|
4444
|
+
}
|
|
4445
|
+
.single-line {
|
|
4446
|
+
margin: var(--goa-space-2xs) 0 var(--goa-space-2xs) 0;
|
|
4447
|
+
}
|
|
4448
|
+
`));
|
|
4449
|
+
|
|
4450
|
+
const HelpContentComponent = _a => {
|
|
4451
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
4452
|
+
var {
|
|
4453
|
+
isParent = true
|
|
4454
|
+
} = _a,
|
|
4455
|
+
props = __rest(_a, ["isParent"]);
|
|
4456
|
+
const labelClass = isParent ? 'parent-label' : 'child-label';
|
|
4457
|
+
const marginClass = isParent ? 'parent-margin' : 'child-margin';
|
|
4458
|
+
// eslint-disable-next-line
|
|
4459
|
+
const {
|
|
4460
|
+
uischema,
|
|
4461
|
+
visible,
|
|
4462
|
+
label
|
|
4463
|
+
} = props;
|
|
4464
|
+
const renderHelp = () => {
|
|
4465
|
+
var _a, _b, _c;
|
|
4466
|
+
return Array.isArray((_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.help) ? jsx("ul", {
|
|
4467
|
+
children: (_b = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _b === void 0 ? void 0 : _b.help.map((line, index) => jsx("li", {
|
|
4468
|
+
children: `${line}`
|
|
4469
|
+
}, index))
|
|
4470
|
+
}) : jsx("p", {
|
|
4471
|
+
className: "single-line",
|
|
4472
|
+
children: (_c = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _c === void 0 ? void 0 : _c.help
|
|
4473
|
+
});
|
|
4474
|
+
};
|
|
4475
|
+
return jsx(Hidden, {
|
|
4476
|
+
xsUp: !visible,
|
|
4477
|
+
children: jsx(HelpContentDiv, {
|
|
4478
|
+
"aria-label": (_b = uischema.options) === null || _b === void 0 ? void 0 : _b.ariaLabel,
|
|
4479
|
+
children: jsxs("div", {
|
|
4480
|
+
className: marginClass,
|
|
4481
|
+
children: [label && !((_c = uischema.options) === null || _c === void 0 ? void 0 : _c.variant) && ((_d = uischema.options) === null || _d === void 0 ? void 0 : _d.variant) !== 'details' && jsxs("div", {
|
|
4482
|
+
className: labelClass,
|
|
4483
|
+
children: [label, jsx("br", {})]
|
|
4484
|
+
}), (!((_e = uischema.options) === null || _e === void 0 ? void 0 : _e.variant) || ((_f = uischema.options) === null || _f === void 0 ? void 0 : _f.variant) !== 'details') && renderHelp(), ((_g = uischema.options) === null || _g === void 0 ? void 0 : _g.variant) && ((_h = uischema.options) === null || _h === void 0 ? void 0 : _h.variant) === 'details' && jsxs(GoADetails, {
|
|
4485
|
+
heading: label ? label : '',
|
|
4486
|
+
mt: "3xs",
|
|
4487
|
+
mb: "none",
|
|
4488
|
+
children: [renderHelp(), (uischema === null || uischema === void 0 ? void 0 : uischema.elements) && ((_j = uischema === null || uischema === void 0 ? void 0 : uischema.elements) === null || _j === void 0 ? void 0 : _j.length) > 0 && jsx(HelpContents, {
|
|
4489
|
+
elements: uischema === null || uischema === void 0 ? void 0 : uischema.elements
|
|
4490
|
+
})]
|
|
4491
|
+
}), (uischema === null || uischema === void 0 ? void 0 : uischema.elements) && (uischema === null || uischema === void 0 ? void 0 : uischema.elements.length) > 0 && ((_k = uischema.options) === null || _k === void 0 ? void 0 : _k.variant) !== 'details' && jsx(HelpContents, {
|
|
4492
|
+
elements: uischema.elements,
|
|
4493
|
+
isParent: false
|
|
4494
|
+
})]
|
|
4495
|
+
})
|
|
4496
|
+
})
|
|
4497
|
+
});
|
|
4498
|
+
};
|
|
4499
|
+
const HelpContents = ({
|
|
4500
|
+
elements,
|
|
4501
|
+
isParent: _isParent = false
|
|
4502
|
+
}) => jsx("div", {
|
|
4503
|
+
children: elements === null || elements === void 0 ? void 0 : elements.map(element => {
|
|
4504
|
+
return jsx(HelpContentComponent, {
|
|
4505
|
+
uischema: element,
|
|
4506
|
+
label: element.label,
|
|
4507
|
+
errors: '',
|
|
4508
|
+
data: undefined,
|
|
4509
|
+
enabled: false,
|
|
4510
|
+
visible: true,
|
|
4511
|
+
path: '',
|
|
4512
|
+
handleChange: function (path, value) {
|
|
4513
|
+
throw new Error('Function not implemented.');
|
|
4514
|
+
},
|
|
4515
|
+
rootSchema: {},
|
|
4516
|
+
id: '',
|
|
4517
|
+
schema: {},
|
|
4518
|
+
isParent: _isParent
|
|
4519
|
+
});
|
|
4520
|
+
})
|
|
4521
|
+
});
|
|
4522
|
+
const HelpContentTester = rankWith(1, uiTypeIs('HelpContent'));
|
|
4523
|
+
const HelpContent = withJsonFormsControlProps(HelpContentComponent);
|
|
4524
|
+
|
|
4525
|
+
const isNullSchema = schema => {
|
|
4526
|
+
return schema === undefined || schema === null;
|
|
4527
|
+
};
|
|
4528
|
+
const isValidScope = (uiSchema, schema) => {
|
|
4529
|
+
if (!('scope' in uiSchema)) {
|
|
4530
|
+
return false;
|
|
4531
|
+
}
|
|
4532
|
+
const scopeComponents = uiSchema.scope.split('/');
|
|
4533
|
+
// get rid of the '#' at the beginning of scope
|
|
4534
|
+
scopeComponents.shift();
|
|
4535
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4536
|
+
let obj = schema;
|
|
4537
|
+
// iterate through the schema to ensure each property exists
|
|
4538
|
+
for (const key of scopeComponents) {
|
|
4539
|
+
if (obj && typeof obj === 'object' && key in obj) {
|
|
4540
|
+
obj = obj[key];
|
|
4541
|
+
} else {
|
|
4542
|
+
return false;
|
|
4543
|
+
}
|
|
4544
|
+
}
|
|
4545
|
+
return true;
|
|
4546
|
+
};
|
|
4547
|
+
const isLayoutType = schema => {
|
|
4548
|
+
return hasType(schema, 'VerticalLayout') || hasType(schema, 'HorizontalLayout') || hasType(schema, 'Categorization') || hasType(schema, 'Group');
|
|
4549
|
+
};
|
|
4550
|
+
const isKnownType = schema => {
|
|
4551
|
+
return hasType(schema, 'Control') || isLayoutType(schema) || hasType(schema, 'HelpContent') || isListWithDetail(schema);
|
|
4552
|
+
};
|
|
4553
|
+
const isListWithDetail = schema => {
|
|
4554
|
+
return hasType(schema, 'ListWithDetail');
|
|
4555
|
+
};
|
|
4556
|
+
const isScopedPrefixed = scope => {
|
|
4557
|
+
const scopeComponents = scope.split('/');
|
|
4558
|
+
return scopeComponents.length > 1 && scopeComponents[0] === '#';
|
|
4559
|
+
};
|
|
4560
|
+
const isEmptyObject = schema => {
|
|
4561
|
+
return Object.keys(schema).length === 0;
|
|
4562
|
+
};
|
|
4563
|
+
const isControlWithNoScope = uiSchema => {
|
|
4564
|
+
return 'type' in uiSchema && uiSchema.type === 'Control' && !('scope' in uiSchema);
|
|
4565
|
+
};
|
|
4566
|
+
const hasElements = schema => {
|
|
4567
|
+
return 'elements' in schema && Array.isArray(schema.elements);
|
|
4568
|
+
};
|
|
4569
|
+
const isEmptyElements = schema => {
|
|
4570
|
+
return 'elements' in schema && schema.elements !== undefined && schema.elements !== null && Object.keys(schema.elements).length === 0;
|
|
4571
|
+
};
|
|
4572
|
+
const hasVariant = schema => {
|
|
4573
|
+
return 'options' in schema && schema.options !== undefined && schema.options !== null && 'variant' in schema.options;
|
|
4574
|
+
};
|
|
4575
|
+
const isValidJsonObject = schema => {
|
|
4576
|
+
return typeof schema === 'object' && Object.keys(schema).length === 0 || 'properties' in schema && ('type' in schema && schema.type === 'object' || !('type' in schema));
|
|
4577
|
+
};
|
|
4578
|
+
|
|
4579
|
+
const errCategorizationHasNonCategories = "Each element of 'Categorizations' must be of type 'Category'";
|
|
4580
|
+
const errCategorizationHasNoElements = 'A Categorization must contain Categories.';
|
|
4581
|
+
const errNoElements = type => `A ${type} must contain elements.`;
|
|
4582
|
+
const errCategorizationHasNoVariant = 'A Categorization must contain Options with a variant.';
|
|
4583
|
+
const errMissingScope = 'A Control must have a scope';
|
|
4584
|
+
const errMalformedScope = scope => `Scope ${scope} must be prefixed with '#/'.`;
|
|
4585
|
+
const errUnknownScope = scope => `Failed to render: unknown scope ${scope}`;
|
|
4586
|
+
const errMissingType = 'UI schema element must have a type';
|
|
4587
|
+
const errUnknownType = type => `Unknown schema type: ${type}. (Names are case sensitive)`;
|
|
4588
|
+
const getUISchemaErrors = (uiSchema, schema) => {
|
|
4589
|
+
// Sometimes the UISchema is null. Ignore those cases, as all checks are done on the UIschema.
|
|
4590
|
+
if (isNullSchema(uiSchema)) {
|
|
4591
|
+
return null;
|
|
4592
|
+
}
|
|
4593
|
+
// silently ignore empty objects
|
|
4594
|
+
if (isEmptyObject(uiSchema)) {
|
|
4595
|
+
return '';
|
|
4596
|
+
}
|
|
4597
|
+
// Check control elements
|
|
4598
|
+
if (isControl(uiSchema) && hasType(uiSchema, 'Control')) {
|
|
4599
|
+
if (!isScopedPrefixed(uiSchema.scope)) {
|
|
4600
|
+
return errMalformedScope(uiSchema.scope);
|
|
4601
|
+
}
|
|
4602
|
+
if (!isValidScope(uiSchema, schema)) {
|
|
4603
|
+
return errUnknownScope(uiSchema.scope);
|
|
4604
|
+
}
|
|
4605
|
+
}
|
|
4606
|
+
// isControl will fail if scope is not present, so make the test explicit...
|
|
4607
|
+
if (isControlWithNoScope(uiSchema)) {
|
|
4608
|
+
return errMissingScope;
|
|
4609
|
+
}
|
|
4610
|
+
if (isListWithDetail(uiSchema)) {
|
|
4611
|
+
if ('scope' in uiSchema) {
|
|
4612
|
+
const scope = uiSchema.scope;
|
|
4613
|
+
if (!isValidScope(uiSchema, schema)) {
|
|
4614
|
+
return errUnknownScope(scope);
|
|
4615
|
+
}
|
|
4616
|
+
} else {
|
|
4617
|
+
return errMissingScope;
|
|
4618
|
+
}
|
|
4619
|
+
}
|
|
4620
|
+
// Make an explicit check for Categorization, as this requires Category elements.
|
|
4621
|
+
// Is layout will fail if some of these conditions are not met, so we do that
|
|
4622
|
+
// check later.
|
|
4623
|
+
if (isCategorization(uiSchema)) {
|
|
4624
|
+
if (!hasElements(uiSchema)) {
|
|
4625
|
+
return errCategorizationHasNoElements;
|
|
4626
|
+
}
|
|
4627
|
+
if (!hasVariant(uiSchema)) {
|
|
4628
|
+
return errCategorizationHasNoVariant;
|
|
4629
|
+
}
|
|
4630
|
+
// ensure each element has type Category, and that each category
|
|
4631
|
+
// has elements
|
|
4632
|
+
if (isLayout(uiSchema)) {
|
|
4633
|
+
const invalidCategorizations = [];
|
|
4634
|
+
const invalidCategories = [];
|
|
4635
|
+
uiSchema.elements.forEach(e => {
|
|
4636
|
+
if (e.type !== 'Category') {
|
|
4637
|
+
invalidCategorizations.push(e.type);
|
|
4638
|
+
}
|
|
4639
|
+
if (!hasElements(e) || isEmptyElements(e)) {
|
|
4640
|
+
invalidCategories.push(e);
|
|
4641
|
+
}
|
|
4642
|
+
});
|
|
4643
|
+
if (invalidCategorizations.length > 0) {
|
|
4644
|
+
return errCategorizationHasNonCategories;
|
|
4645
|
+
}
|
|
4646
|
+
if (invalidCategories.length > 0) {
|
|
4647
|
+
return errNoElements('Category');
|
|
4648
|
+
}
|
|
4649
|
+
}
|
|
4650
|
+
}
|
|
4651
|
+
// Check layout
|
|
4652
|
+
if (isLayoutType(uiSchema)) {
|
|
4653
|
+
if (!hasElements(uiSchema)) {
|
|
4654
|
+
return errNoElements(uiSchema.type);
|
|
4655
|
+
}
|
|
4656
|
+
if (isEmptyElements(uiSchema)) {
|
|
4657
|
+
return errNoElements(uiSchema.type);
|
|
4658
|
+
}
|
|
4659
|
+
}
|
|
4660
|
+
if (!isKnownType(uiSchema)) {
|
|
4661
|
+
if (uiSchema.type === undefined || uiSchema.type.length < 1) {
|
|
4662
|
+
return errMissingType;
|
|
4663
|
+
}
|
|
4664
|
+
return errUnknownType(uiSchema.type);
|
|
4665
|
+
}
|
|
4666
|
+
return null;
|
|
4667
|
+
};
|
|
4668
|
+
|
|
4669
|
+
const isValidJsonSchema = schema => {
|
|
4670
|
+
if (isNullSchema(schema)) {
|
|
4671
|
+
return '';
|
|
4672
|
+
}
|
|
4673
|
+
if (!isValidJsonObject(schema)) {
|
|
4674
|
+
return 'Unable to render: json schema is not valid.';
|
|
4675
|
+
}
|
|
4676
|
+
return null;
|
|
4677
|
+
};
|
|
4678
|
+
// Some 'errors' need not be reported, but we want to handle them
|
|
4679
|
+
// here. e.g. A layout with empty elements should be quietly ignored.
|
|
4680
|
+
// this is handled by the errors !== '' check.
|
|
4681
|
+
const ErrorControl = props => {
|
|
4682
|
+
const {
|
|
4683
|
+
schema,
|
|
4684
|
+
uischema
|
|
4685
|
+
} = props;
|
|
4686
|
+
// Report data schema errors over ui schema ones, as errors in the former
|
|
4687
|
+
// can cause cascading errors in the latter.
|
|
4688
|
+
const dataSchemaErrors = isValidJsonSchema(schema);
|
|
4689
|
+
if (dataSchemaErrors && dataSchemaErrors !== '') {
|
|
4690
|
+
return jsx("p", {
|
|
4691
|
+
children: dataSchemaErrors
|
|
4692
|
+
});
|
|
4693
|
+
}
|
|
4694
|
+
const uiSchemaErrors = getUISchemaErrors(uischema, schema);
|
|
4695
|
+
if (uiSchemaErrors && uiSchemaErrors !== '') {
|
|
4696
|
+
return MessageControl(uiSchemaErrors);
|
|
4697
|
+
}
|
|
4698
|
+
return jsx("span", {});
|
|
4699
|
+
};
|
|
4700
|
+
/**
|
|
4701
|
+
* Note: by returning a rank of 1000, we are saying that this renderer is very important,
|
|
4702
|
+
* one that must get used if there are any errors whatsoever.
|
|
4703
|
+
*/
|
|
4704
|
+
const GoAErrorControlTester = rankWith(1000, (uischema, schema, context) => {
|
|
4705
|
+
const validJsonSchema = isValidJsonSchema(schema);
|
|
4706
|
+
const validUiSchema = getUISchemaErrors(uischema, schema);
|
|
4707
|
+
return validUiSchema != null || validJsonSchema != null;
|
|
4708
|
+
});
|
|
4709
|
+
var GoAErrorControl = withJsonFormsControlProps(ErrorControl);
|
|
4710
|
+
|
|
4711
|
+
const countries = ['Argentina', 'Brazil', 'Canada', 'Denmark', 'Egypt', 'France', 'Greece', 'India', 'Japan', 'Kenya'];
|
|
4712
|
+
addData('countries', countries);
|
|
4713
|
+
const GoABaseRenderers = [
|
|
4714
|
+
// controls
|
|
4715
|
+
{
|
|
4716
|
+
tester: GoAEnumControlTester,
|
|
4717
|
+
renderer: GoAEnumControl
|
|
4718
|
+
}, {
|
|
4719
|
+
tester: GoAEnumControlAutoCompleteTester,
|
|
4720
|
+
renderer: GoAEnumAutoCompleteControl
|
|
4721
|
+
}, {
|
|
4722
|
+
tester: GoAIntegerControlTester,
|
|
4723
|
+
renderer: GoAInputIntegerControl
|
|
4724
|
+
}, {
|
|
4725
|
+
tester: GoANumberControlTester,
|
|
4726
|
+
renderer: GoAInputNumberControl
|
|
4727
|
+
}, {
|
|
4728
|
+
tester: GoATextControlTester,
|
|
4729
|
+
renderer: GoAInputTextControl
|
|
4730
|
+
}, {
|
|
4731
|
+
tester: GoADateControlTester,
|
|
4732
|
+
renderer: GoAInputDateControl
|
|
4733
|
+
}, {
|
|
4734
|
+
tester: GoADateTimeControlTester,
|
|
4735
|
+
renderer: GoAInputDateTimeControl
|
|
4736
|
+
}, {
|
|
4737
|
+
tester: GoATimeControlTester,
|
|
4738
|
+
renderer: GoAInputTimeControl
|
|
4739
|
+
}, {
|
|
4740
|
+
tester: materialSliderControlTester,
|
|
4741
|
+
renderer: MaterialSliderControl
|
|
4742
|
+
}, {
|
|
4743
|
+
tester: materialObjectControlTester,
|
|
4744
|
+
renderer: MaterialObjectRenderer
|
|
4745
|
+
}, {
|
|
4746
|
+
tester: materialAllOfControlTester,
|
|
4747
|
+
renderer: MaterialAllOfRenderer
|
|
4748
|
+
}, {
|
|
4749
|
+
tester: materialAnyOfControlTester,
|
|
4750
|
+
renderer: MaterialAnyOfRenderer
|
|
4751
|
+
}, {
|
|
4752
|
+
tester: materialOneOfControlTester,
|
|
4753
|
+
renderer: MaterialOneOfRenderer
|
|
4754
|
+
}, {
|
|
4755
|
+
tester: GoARadioGroupControlTester,
|
|
4756
|
+
renderer: GoAEnumRadioGroupControl
|
|
4757
|
+
}, {
|
|
4758
|
+
tester: GoABooleanControlTester,
|
|
4759
|
+
renderer: GoABooleanControl
|
|
4760
|
+
}, {
|
|
4761
|
+
tester: GoABooleanRadioControlTester,
|
|
4762
|
+
renderer: GoABooleanRadioControl
|
|
4763
|
+
}, {
|
|
4764
|
+
tester: GoAArrayControlTester,
|
|
4765
|
+
renderer: GoAArrayControlRenderer
|
|
4766
|
+
}, {
|
|
4767
|
+
tester: GoAListWithDetailsTester,
|
|
4768
|
+
renderer: GoAArrayControlRenderer
|
|
4769
|
+
}, {
|
|
4770
|
+
tester: materialOneOfRadioGroupControlTester,
|
|
4771
|
+
renderer: MaterialOneOfRadioGroupControl
|
|
4772
|
+
}, {
|
|
4773
|
+
tester: materialOneOfEnumControlTester,
|
|
4774
|
+
renderer: MaterialOneOfEnumControl
|
|
4775
|
+
},
|
|
4776
|
+
// layouts
|
|
4777
|
+
{
|
|
4778
|
+
tester: GoAGroupLayoutTester,
|
|
4779
|
+
renderer: GoAGroupControl
|
|
4780
|
+
}, {
|
|
4781
|
+
tester: materialHorizontalLayoutTester,
|
|
4782
|
+
renderer: GoAHorizontalLayout
|
|
4783
|
+
}, {
|
|
4784
|
+
tester: materialVerticalLayoutTester,
|
|
4785
|
+
renderer: GoAVerticalLayout
|
|
4786
|
+
}, {
|
|
4787
|
+
tester: materialArrayLayoutTester,
|
|
4788
|
+
renderer: MaterialArrayLayout
|
|
4789
|
+
},
|
|
4790
|
+
// additional
|
|
4791
|
+
{
|
|
4792
|
+
tester: GoAErrorControlTester,
|
|
4793
|
+
renderer: GoAErrorControl
|
|
4794
|
+
}, {
|
|
4795
|
+
tester: materialAnyOfStringOrEnumControlTester,
|
|
4796
|
+
renderer: MaterialAnyOfStringOrEnumControl
|
|
4797
|
+
}, {
|
|
4798
|
+
tester: materialEnumArrayRendererTester,
|
|
4799
|
+
renderer: MaterialEnumArrayRenderer
|
|
4800
|
+
}, {
|
|
4801
|
+
tester: materialEnumArrayRendererTester,
|
|
4802
|
+
renderer: MaterialEnumArrayRenderer
|
|
4803
|
+
}, {
|
|
4804
|
+
tester: MultiLineTextControlTester,
|
|
4805
|
+
renderer: MultiLineTextControl
|
|
4806
|
+
}, {
|
|
4807
|
+
tester: HelpContentTester,
|
|
4808
|
+
renderer: HelpContent
|
|
4809
|
+
}];
|
|
4810
|
+
const GoARenderers = [...GoABaseRenderers, {
|
|
4811
|
+
tester: CategorizationRendererTester,
|
|
4812
|
+
renderer: FormStepperControl
|
|
4813
|
+
}, {
|
|
4814
|
+
tester: FileUploaderTester,
|
|
4815
|
+
renderer: withJsonFormsControlProps(FileUploader)
|
|
4816
|
+
}];
|
|
4817
|
+
const GoACells = [{
|
|
4818
|
+
tester: materialBooleanCellTester,
|
|
4819
|
+
cell: MaterialBooleanCell
|
|
4820
|
+
}, {
|
|
4821
|
+
tester: materialBooleanToggleCellTester,
|
|
4822
|
+
cell: MaterialBooleanToggleCell
|
|
4823
|
+
}, {
|
|
4824
|
+
tester: materialEnumCellTester,
|
|
4825
|
+
cell: MaterialEnumCell
|
|
4826
|
+
}, {
|
|
4827
|
+
tester: materialOneOfEnumCellTester,
|
|
4828
|
+
cell: MaterialOneOfEnumCell
|
|
4829
|
+
}, ...InputCells];
|
|
4830
|
+
|
|
4831
|
+
export { ContextProvider, GoABaseRenderers, GoACells, GoARenderers, JsonFormContext, addData, addDataByOptions, addDataByUrl, getAllData, getData };
|