@abgov/jsonforms-components 2.70.4 → 2.71.1
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.js
CHANGED
|
@@ -6,7 +6,8 @@ import axios from 'axios';
|
|
|
6
6
|
import get$1 from 'lodash/get';
|
|
7
7
|
import { toDataPath, INIT, UPDATE_CORE, isVisible, isEnabled, deriveLabelForUISchemaElement, rankWith, isStringControl, and, optionIs, isDateControl, isNumberControl, isIntegerControl, isDateTimeControl, isTimeControl, uiTypeIs, isControl as isControl$1, isEnumControl, or, isOneOfEnumControl, isBooleanControl, createDefaultValue, Paths, Resolve, schemaTypeIs, formatIs, getAjv, schemaMatches, isObjectArrayControl, isPrimitiveArrayControl, composePaths, hasType, isCategorization, isLayout } from '@jsonforms/core';
|
|
8
8
|
import * as _$c from 'lodash';
|
|
9
|
-
import ___default, { isEqual, isEmpty, isObject as isObject$i } from 'lodash';
|
|
9
|
+
import ___default, { isEqual as isEqual$1, isEmpty, isObject as isObject$i } from 'lodash';
|
|
10
|
+
import isEqual from 'lodash/isEqual';
|
|
10
11
|
import { useJsonForms, withJsonFormsControlProps, withJsonFormsEnumProps, withTranslateProps, JsonFormsDispatch, withJsonFormsAllOfProps, withJsonFormsArrayLayoutProps, withJsonFormsLayoutProps, withJsonFormsCellProps } from '@jsonforms/react';
|
|
11
12
|
import dompurify from 'dompurify';
|
|
12
13
|
import * as xss from 'xss';
|
|
@@ -6811,20 +6812,192 @@ $$f({ target: 'Array', proto: true, forced: FORCED$3 }, {
|
|
|
6811
6812
|
}
|
|
6812
6813
|
});
|
|
6813
6814
|
|
|
6815
|
+
var tryToString = tryToString$5;
|
|
6816
|
+
|
|
6817
|
+
var $TypeError$1 = TypeError;
|
|
6818
|
+
|
|
6819
|
+
var deletePropertyOrThrow$2 = function (O, P) {
|
|
6820
|
+
if (!delete O[P]) throw new $TypeError$1('Cannot delete property ' + tryToString(P) + ' of ' + tryToString(O));
|
|
6821
|
+
};
|
|
6822
|
+
|
|
6823
|
+
var arraySlice$1 = arraySlice$4;
|
|
6824
|
+
|
|
6825
|
+
var floor$2 = Math.floor;
|
|
6826
|
+
|
|
6827
|
+
var sort = function (array, comparefn) {
|
|
6828
|
+
var length = array.length;
|
|
6829
|
+
|
|
6830
|
+
if (length < 8) {
|
|
6831
|
+
// insertion sort
|
|
6832
|
+
var i = 1;
|
|
6833
|
+
var element, j;
|
|
6834
|
+
|
|
6835
|
+
while (i < length) {
|
|
6836
|
+
j = i;
|
|
6837
|
+
element = array[i];
|
|
6838
|
+
while (j && comparefn(array[j - 1], element) > 0) {
|
|
6839
|
+
array[j] = array[--j];
|
|
6840
|
+
}
|
|
6841
|
+
if (j !== i++) array[j] = element;
|
|
6842
|
+
}
|
|
6843
|
+
} else {
|
|
6844
|
+
// merge sort
|
|
6845
|
+
var middle = floor$2(length / 2);
|
|
6846
|
+
var left = sort(arraySlice$1(array, 0, middle), comparefn);
|
|
6847
|
+
var right = sort(arraySlice$1(array, middle), comparefn);
|
|
6848
|
+
var llength = left.length;
|
|
6849
|
+
var rlength = right.length;
|
|
6850
|
+
var lindex = 0;
|
|
6851
|
+
var rindex = 0;
|
|
6852
|
+
|
|
6853
|
+
while (lindex < llength || rindex < rlength) {
|
|
6854
|
+
array[lindex + rindex] = (lindex < llength && rindex < rlength)
|
|
6855
|
+
? comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++]
|
|
6856
|
+
: lindex < llength ? left[lindex++] : right[rindex++];
|
|
6857
|
+
}
|
|
6858
|
+
}
|
|
6859
|
+
|
|
6860
|
+
return array;
|
|
6861
|
+
};
|
|
6862
|
+
|
|
6863
|
+
var arraySort$1 = sort;
|
|
6864
|
+
|
|
6865
|
+
var userAgent$2 = engineUserAgent;
|
|
6866
|
+
|
|
6867
|
+
var firefox = userAgent$2.match(/firefox\/(\d+)/i);
|
|
6868
|
+
|
|
6869
|
+
var engineFfVersion = !!firefox && +firefox[1];
|
|
6870
|
+
|
|
6871
|
+
var UA = engineUserAgent;
|
|
6872
|
+
|
|
6873
|
+
var engineIsIeOrEdge = /MSIE|Trident/.test(UA);
|
|
6874
|
+
|
|
6875
|
+
var userAgent$1 = engineUserAgent;
|
|
6876
|
+
|
|
6877
|
+
var webkit = userAgent$1.match(/AppleWebKit\/(\d+)\./);
|
|
6878
|
+
|
|
6879
|
+
var engineWebkitVersion = !!webkit && +webkit[1];
|
|
6880
|
+
|
|
6814
6881
|
var $$e = _export;
|
|
6815
|
-
var
|
|
6882
|
+
var uncurryThis$d = functionUncurryThis;
|
|
6816
6883
|
var aCallable$3 = aCallable$k;
|
|
6884
|
+
var toObject$4 = toObject$c;
|
|
6885
|
+
var lengthOfArrayLike$6 = lengthOfArrayLike$c;
|
|
6886
|
+
var deletePropertyOrThrow$1 = deletePropertyOrThrow$2;
|
|
6887
|
+
var toString$b = toString$n;
|
|
6888
|
+
var fails$4 = fails$y;
|
|
6889
|
+
var internalSort = arraySort$1;
|
|
6890
|
+
var arrayMethodIsStrict = arrayMethodIsStrict$2;
|
|
6891
|
+
var FF = engineFfVersion;
|
|
6892
|
+
var IE_OR_EDGE = engineIsIeOrEdge;
|
|
6893
|
+
var V8 = engineV8Version;
|
|
6894
|
+
var WEBKIT = engineWebkitVersion;
|
|
6895
|
+
|
|
6896
|
+
var test = [];
|
|
6897
|
+
var nativeSort = uncurryThis$d(test.sort);
|
|
6898
|
+
var push$6 = uncurryThis$d(test.push);
|
|
6899
|
+
|
|
6900
|
+
// IE8-
|
|
6901
|
+
var FAILS_ON_UNDEFINED = fails$4(function () {
|
|
6902
|
+
test.sort(undefined);
|
|
6903
|
+
});
|
|
6904
|
+
// V8 bug
|
|
6905
|
+
var FAILS_ON_NULL = fails$4(function () {
|
|
6906
|
+
test.sort(null);
|
|
6907
|
+
});
|
|
6908
|
+
// Old WebKit
|
|
6909
|
+
var STRICT_METHOD = arrayMethodIsStrict('sort');
|
|
6910
|
+
|
|
6911
|
+
var STABLE_SORT = !fails$4(function () {
|
|
6912
|
+
// feature detection can be too slow, so check engines versions
|
|
6913
|
+
if (V8) return V8 < 70;
|
|
6914
|
+
if (FF && FF > 3) return;
|
|
6915
|
+
if (IE_OR_EDGE) return true;
|
|
6916
|
+
if (WEBKIT) return WEBKIT < 603;
|
|
6917
|
+
|
|
6918
|
+
var result = '';
|
|
6919
|
+
var code, chr, value, index;
|
|
6920
|
+
|
|
6921
|
+
// generate an array with more 512 elements (Chakra and old V8 fails only in this case)
|
|
6922
|
+
for (code = 65; code < 76; code++) {
|
|
6923
|
+
chr = String.fromCharCode(code);
|
|
6924
|
+
|
|
6925
|
+
switch (code) {
|
|
6926
|
+
case 66: case 69: case 70: case 72: value = 3; break;
|
|
6927
|
+
case 68: case 71: value = 4; break;
|
|
6928
|
+
default: value = 2;
|
|
6929
|
+
}
|
|
6930
|
+
|
|
6931
|
+
for (index = 0; index < 47; index++) {
|
|
6932
|
+
test.push({ k: chr + index, v: value });
|
|
6933
|
+
}
|
|
6934
|
+
}
|
|
6935
|
+
|
|
6936
|
+
test.sort(function (a, b) { return b.v - a.v; });
|
|
6937
|
+
|
|
6938
|
+
for (index = 0; index < test.length; index++) {
|
|
6939
|
+
chr = test[index].k.charAt(0);
|
|
6940
|
+
if (result.charAt(result.length - 1) !== chr) result += chr;
|
|
6941
|
+
}
|
|
6942
|
+
|
|
6943
|
+
return result !== 'DGBEFHACIJK';
|
|
6944
|
+
});
|
|
6945
|
+
|
|
6946
|
+
var FORCED$2 = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD || !STABLE_SORT;
|
|
6947
|
+
|
|
6948
|
+
var getSortCompare = function (comparefn) {
|
|
6949
|
+
return function (x, y) {
|
|
6950
|
+
if (y === undefined) return -1;
|
|
6951
|
+
if (x === undefined) return 1;
|
|
6952
|
+
if (comparefn !== undefined) return +comparefn(x, y) || 0;
|
|
6953
|
+
return toString$b(x) > toString$b(y) ? 1 : -1;
|
|
6954
|
+
};
|
|
6955
|
+
};
|
|
6956
|
+
|
|
6957
|
+
// `Array.prototype.sort` method
|
|
6958
|
+
// https://tc39.es/ecma262/#sec-array.prototype.sort
|
|
6959
|
+
$$e({ target: 'Array', proto: true, forced: FORCED$2 }, {
|
|
6960
|
+
sort: function sort(comparefn) {
|
|
6961
|
+
if (comparefn !== undefined) aCallable$3(comparefn);
|
|
6962
|
+
|
|
6963
|
+
var array = toObject$4(this);
|
|
6964
|
+
|
|
6965
|
+
if (STABLE_SORT) return comparefn === undefined ? nativeSort(array) : nativeSort(array, comparefn);
|
|
6966
|
+
|
|
6967
|
+
var items = [];
|
|
6968
|
+
var arrayLength = lengthOfArrayLike$6(array);
|
|
6969
|
+
var itemsLength, index;
|
|
6970
|
+
|
|
6971
|
+
for (index = 0; index < arrayLength; index++) {
|
|
6972
|
+
if (index in array) push$6(items, array[index]);
|
|
6973
|
+
}
|
|
6974
|
+
|
|
6975
|
+
internalSort(items, getSortCompare(comparefn));
|
|
6976
|
+
|
|
6977
|
+
itemsLength = lengthOfArrayLike$6(items);
|
|
6978
|
+
index = 0;
|
|
6979
|
+
|
|
6980
|
+
while (index < itemsLength) array[index] = items[index++];
|
|
6981
|
+
while (index < arrayLength) deletePropertyOrThrow$1(array, index++);
|
|
6982
|
+
|
|
6983
|
+
return array;
|
|
6984
|
+
}
|
|
6985
|
+
});
|
|
6986
|
+
|
|
6987
|
+
var $$d = _export;
|
|
6988
|
+
var iterate$1 = iterate$a;
|
|
6989
|
+
var aCallable$2 = aCallable$k;
|
|
6817
6990
|
var anObject$5 = anObject$t;
|
|
6818
6991
|
var getIteratorDirect$2 = getIteratorDirect$a;
|
|
6819
6992
|
|
|
6820
|
-
var $TypeError
|
|
6993
|
+
var $TypeError = TypeError;
|
|
6821
6994
|
|
|
6822
6995
|
// `Iterator.prototype.reduce` method
|
|
6823
6996
|
// https://github.com/tc39/proposal-iterator-helpers
|
|
6824
|
-
$$
|
|
6997
|
+
$$d({ target: 'Iterator', proto: true, real: true }, {
|
|
6825
6998
|
reduce: function reduce(reducer /* , initialValue */) {
|
|
6826
6999
|
anObject$5(this);
|
|
6827
|
-
aCallable$
|
|
7000
|
+
aCallable$2(reducer);
|
|
6828
7001
|
var record = getIteratorDirect$2(this);
|
|
6829
7002
|
var noInitial = arguments.length < 2;
|
|
6830
7003
|
var accumulator = noInitial ? undefined : arguments[1];
|
|
@@ -6838,7 +7011,7 @@ $$e({ target: 'Iterator', proto: true, real: true }, {
|
|
|
6838
7011
|
}
|
|
6839
7012
|
counter++;
|
|
6840
7013
|
}, { IS_RECORD: true });
|
|
6841
|
-
if (noInitial) throw new $TypeError
|
|
7014
|
+
if (noInitial) throw new $TypeError('Reduce of empty iterator with no initial value');
|
|
6842
7015
|
return accumulator;
|
|
6843
7016
|
}
|
|
6844
7017
|
});
|
|
@@ -6869,15 +7042,15 @@ const pickPropertyValues = (obj, property, endWithType) => {
|
|
|
6869
7042
|
return values;
|
|
6870
7043
|
};
|
|
6871
7044
|
|
|
6872
|
-
var uncurryThis$
|
|
7045
|
+
var uncurryThis$c = functionUncurryThis;
|
|
6873
7046
|
var hasOwn$4 = hasOwnProperty_1;
|
|
6874
7047
|
|
|
6875
7048
|
var $SyntaxError = SyntaxError;
|
|
6876
7049
|
var $parseInt$2 = parseInt;
|
|
6877
7050
|
var fromCharCode$1 = String.fromCharCode;
|
|
6878
|
-
var at$1 = uncurryThis$
|
|
6879
|
-
var slice$2 = uncurryThis$
|
|
6880
|
-
var exec$4 = uncurryThis$
|
|
7051
|
+
var at$1 = uncurryThis$c(''.charAt);
|
|
7052
|
+
var slice$2 = uncurryThis$c(''.slice);
|
|
7053
|
+
var exec$4 = uncurryThis$c(/./.exec);
|
|
6881
7054
|
|
|
6882
7055
|
var codePoints = {
|
|
6883
7056
|
'\\"': '"',
|
|
@@ -6925,20 +7098,20 @@ var parseJsonString = function (source, i) {
|
|
|
6925
7098
|
return { value: value, end: i };
|
|
6926
7099
|
};
|
|
6927
7100
|
|
|
6928
|
-
var $$
|
|
7101
|
+
var $$c = _export;
|
|
6929
7102
|
var DESCRIPTORS$5 = descriptors;
|
|
6930
7103
|
var global$5 = global$t;
|
|
6931
7104
|
var getBuiltIn = getBuiltIn$b;
|
|
6932
|
-
var uncurryThis$
|
|
7105
|
+
var uncurryThis$b = functionUncurryThis;
|
|
6933
7106
|
var call$7 = functionCall;
|
|
6934
7107
|
var isCallable$2 = isCallable$t;
|
|
6935
7108
|
var isObject$2 = isObject$h;
|
|
6936
7109
|
var isArray$2 = isArray$5;
|
|
6937
7110
|
var hasOwn$3 = hasOwnProperty_1;
|
|
6938
|
-
var toString$
|
|
6939
|
-
var lengthOfArrayLike$
|
|
7111
|
+
var toString$a = toString$n;
|
|
7112
|
+
var lengthOfArrayLike$5 = lengthOfArrayLike$c;
|
|
6940
7113
|
var createProperty$2 = createProperty$4;
|
|
6941
|
-
var fails$
|
|
7114
|
+
var fails$3 = fails$y;
|
|
6942
7115
|
var parseJSONString = parseJsonString;
|
|
6943
7116
|
var NATIVE_SYMBOL$1 = symbolConstructorDetection;
|
|
6944
7117
|
|
|
@@ -6949,10 +7122,10 @@ var nativeParse = JSON$1 && JSON$1.parse;
|
|
|
6949
7122
|
var enumerableOwnProperties = getBuiltIn('Object', 'keys');
|
|
6950
7123
|
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
6951
7124
|
var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
|
|
6952
|
-
var at = uncurryThis$
|
|
6953
|
-
var slice$1 = uncurryThis$
|
|
6954
|
-
var exec$3 = uncurryThis$
|
|
6955
|
-
var push$
|
|
7125
|
+
var at = uncurryThis$b(''.charAt);
|
|
7126
|
+
var slice$1 = uncurryThis$b(''.slice);
|
|
7127
|
+
var exec$3 = uncurryThis$b(/./.exec);
|
|
7128
|
+
var push$5 = uncurryThis$b([].push);
|
|
6956
7129
|
|
|
6957
7130
|
var IS_DIGIT = /^\d$/;
|
|
6958
7131
|
var IS_NON_ZERO_DIGIT = /^[1-9]$/;
|
|
@@ -6963,7 +7136,7 @@ var PRIMITIVE = 0;
|
|
|
6963
7136
|
var OBJECT = 1;
|
|
6964
7137
|
|
|
6965
7138
|
var $parse = function (source, reviver) {
|
|
6966
|
-
source = toString$
|
|
7139
|
+
source = toString$a(source);
|
|
6967
7140
|
var context = new Context(source, 0);
|
|
6968
7141
|
var root = context.parse();
|
|
6969
7142
|
var value = root.value;
|
|
@@ -6984,13 +7157,13 @@ var internalize = function (holder, name, reviver, node) {
|
|
|
6984
7157
|
var nodes = unmodified ? node.nodes : nodeIsArray ? [] : {};
|
|
6985
7158
|
if (nodeIsArray) {
|
|
6986
7159
|
elementRecordsLen = nodes.length;
|
|
6987
|
-
len = lengthOfArrayLike$
|
|
7160
|
+
len = lengthOfArrayLike$5(val);
|
|
6988
7161
|
for (i = 0; i < len; i++) {
|
|
6989
7162
|
internalizeProperty(val, i, internalize(val, '' + i, reviver, i < elementRecordsLen ? nodes[i] : undefined));
|
|
6990
7163
|
}
|
|
6991
7164
|
} else {
|
|
6992
7165
|
keys = enumerableOwnProperties(val);
|
|
6993
|
-
len = lengthOfArrayLike$
|
|
7166
|
+
len = lengthOfArrayLike$5(keys);
|
|
6994
7167
|
for (i = 0; i < len; i++) {
|
|
6995
7168
|
P = keys[i];
|
|
6996
7169
|
internalizeProperty(val, P, internalize(val, P, reviver, hasOwn$3(nodes, P) ? nodes[P] : undefined));
|
|
@@ -7097,8 +7270,8 @@ Context.prototype = {
|
|
|
7097
7270
|
break;
|
|
7098
7271
|
}
|
|
7099
7272
|
var result = this.fork(i).parse();
|
|
7100
|
-
push$
|
|
7101
|
-
push$
|
|
7273
|
+
push$5(nodes, result);
|
|
7274
|
+
push$5(array, result.value);
|
|
7102
7275
|
i = this.until([',', ']'], result.end);
|
|
7103
7276
|
if (at(source, i) === ',') {
|
|
7104
7277
|
expectElement = true;
|
|
@@ -7153,7 +7326,7 @@ Context.prototype = {
|
|
|
7153
7326
|
}
|
|
7154
7327
|
};
|
|
7155
7328
|
|
|
7156
|
-
var NO_SOURCE_SUPPORT = fails$
|
|
7329
|
+
var NO_SOURCE_SUPPORT = fails$3(function () {
|
|
7157
7330
|
var unsafeInt = '9007199254740993';
|
|
7158
7331
|
var source;
|
|
7159
7332
|
nativeParse(unsafeInt, function (key, value, context) {
|
|
@@ -7162,7 +7335,7 @@ var NO_SOURCE_SUPPORT = fails$4(function () {
|
|
|
7162
7335
|
return source !== unsafeInt;
|
|
7163
7336
|
});
|
|
7164
7337
|
|
|
7165
|
-
var PROPER_BASE_PARSE = NATIVE_SYMBOL$1 && !fails$
|
|
7338
|
+
var PROPER_BASE_PARSE = NATIVE_SYMBOL$1 && !fails$3(function () {
|
|
7166
7339
|
// Safari 9 bug
|
|
7167
7340
|
return 1 / nativeParse('-0 \t') !== -Infinity;
|
|
7168
7341
|
});
|
|
@@ -7170,7 +7343,7 @@ var PROPER_BASE_PARSE = NATIVE_SYMBOL$1 && !fails$4(function () {
|
|
|
7170
7343
|
// `JSON.parse` method
|
|
7171
7344
|
// https://tc39.es/ecma262/#sec-json.parse
|
|
7172
7345
|
// https://github.com/tc39/proposal-json-parse-with-source
|
|
7173
|
-
$$
|
|
7346
|
+
$$c({ target: 'JSON', stat: true, forced: NO_SOURCE_SUPPORT }, {
|
|
7174
7347
|
parse: function parse(text, reviver) {
|
|
7175
7348
|
return PROPER_BASE_PARSE && !isCallable$2(reviver) ? nativeParse(text) : $parse(text, reviver);
|
|
7176
7349
|
}
|
|
@@ -7343,6 +7516,9 @@ function anyRequiredFieldEmpty(scopes, data, required, schema) {
|
|
|
7343
7516
|
}
|
|
7344
7517
|
return false;
|
|
7345
7518
|
}
|
|
7519
|
+
// Auto-populate targets reach us either as schema scopes (#/properties/firstName) or as the data
|
|
7520
|
+
// paths toDataPath produces (firstName). Normalize both to the dot form used for value lookups.
|
|
7521
|
+
const toNormalizedPath = pathOrScope => pathOrScope != null && pathOrScope.startsWith('#/') ? normalizeSchemaPath(pathOrScope) : pathOrScope || '';
|
|
7346
7522
|
function getStepStatus(opts) {
|
|
7347
7523
|
const {
|
|
7348
7524
|
scopes,
|
|
@@ -7350,7 +7526,8 @@ function getStepStatus(opts) {
|
|
|
7350
7526
|
schema,
|
|
7351
7527
|
data,
|
|
7352
7528
|
visited,
|
|
7353
|
-
autoPopulatedScopes = []
|
|
7529
|
+
autoPopulatedScopes = [],
|
|
7530
|
+
autoPopulatedValues = []
|
|
7354
7531
|
} = opts;
|
|
7355
7532
|
const normalizedScopes = scopes.map(normalizeSchemaPath).filter(Boolean);
|
|
7356
7533
|
const requiredForScopes = getRequiredForScopes(scopes, schema);
|
|
@@ -7359,9 +7536,32 @@ function getStepStatus(opts) {
|
|
|
7359
7536
|
// Auto-populated values (system-filled from the user profile) are excluded, so:
|
|
7360
7537
|
// - a page the user has never opened is NotStarted even when auto-populated, and
|
|
7361
7538
|
// - a saved form the user actually filled still shows its status when resumed.
|
|
7362
|
-
const autoPopulatedSet = new Set(autoPopulatedScopes.map(
|
|
7539
|
+
const autoPopulatedSet = new Set(autoPopulatedScopes.map(toNormalizedPath).filter(Boolean));
|
|
7540
|
+
const autoPopulatedValueByPath = new Map();
|
|
7541
|
+
autoPopulatedValues.forEach(({
|
|
7542
|
+
path,
|
|
7543
|
+
value
|
|
7544
|
+
}) => {
|
|
7545
|
+
const normalized = toNormalizedPath(path);
|
|
7546
|
+
if (normalized) {
|
|
7547
|
+
autoPopulatedSet.add(normalized);
|
|
7548
|
+
autoPopulatedValueByPath.set(normalized, value);
|
|
7549
|
+
}
|
|
7550
|
+
});
|
|
7551
|
+
// Still system-filled only while the value matches what auto-populate would write. Without a
|
|
7552
|
+
// known value we can't tell an edit from the original, so assume it is untouched.
|
|
7553
|
+
const isStillAutoPopulated = path => {
|
|
7554
|
+
if (!autoPopulatedValueByPath.has(path)) {
|
|
7555
|
+
return true;
|
|
7556
|
+
}
|
|
7557
|
+
return isEqual(get$1(data || {}, path), autoPopulatedValueByPath.get(path));
|
|
7558
|
+
};
|
|
7559
|
+
// Editing or clearing an auto-populated field is user activity in its own right, even when what
|
|
7560
|
+
// is left behind is empty — otherwise clearing a pre-filled field would send the step back to
|
|
7561
|
+
// NotStarted.
|
|
7562
|
+
const userEditedAutoPopulated = normalizedScopes.some(path => autoPopulatedSet.has(path) && !isStillAutoPopulated(path));
|
|
7363
7563
|
const userDataScopes = normalizedScopes.filter(path => !autoPopulatedSet.has(path));
|
|
7364
|
-
const stepHasUserData = userDataScopes.
|
|
7564
|
+
const stepHasUserData = userDataScopes.some(path => hasMeaningfulValue(get$1(data || {}, path))) || userEditedAutoPopulated;
|
|
7365
7565
|
const started = (visited != null ? visited : false) || stepHasUserData;
|
|
7366
7566
|
if (!started) {
|
|
7367
7567
|
return {
|
|
@@ -7499,6 +7699,37 @@ function getIncompletePaths(errors, scopePaths) {
|
|
|
7499
7699
|
const getLocalStorageKeyPrefix = () => {
|
|
7500
7700
|
return window.location.href + '_' + new Date().toISOString().slice(0, 10);
|
|
7501
7701
|
};
|
|
7702
|
+
// Steps the user has opened, persisted per form so the status survives a resume.
|
|
7703
|
+
//
|
|
7704
|
+
// Whether a step was opened cannot be recovered from the form data: a user who edits an
|
|
7705
|
+
// auto-populated field and then puts the original value back leaves data identical to the
|
|
7706
|
+
// untouched case. The visit has to be recorded when it happens, or it is lost.
|
|
7707
|
+
//
|
|
7708
|
+
// Deliberately keyed on the form id rather than the URL+date used by the cacheStatus cache above,
|
|
7709
|
+
// so resuming a draft tomorrow — or from a different route to the same form — still restores it.
|
|
7710
|
+
const getVisitedStepsKey = formId => `adsp.form.${formId}.visitedSteps`;
|
|
7711
|
+
const saveVisitedSteps = (formId, ids) => {
|
|
7712
|
+
if (!formId) return;
|
|
7713
|
+
try {
|
|
7714
|
+
localStorage.setItem(getVisitedStepsKey(formId), JSON.stringify(ids));
|
|
7715
|
+
} catch (err) {
|
|
7716
|
+
// Private browsing and full quotas both throw here. Losing the cache only costs the user the
|
|
7717
|
+
// restored status on resume, so it must never take the form down with it.
|
|
7718
|
+
console.warn(`Could not persist visited steps: ${err}`);
|
|
7719
|
+
}
|
|
7720
|
+
};
|
|
7721
|
+
const getVisitedSteps = formId => {
|
|
7722
|
+
if (!formId) return undefined;
|
|
7723
|
+
try {
|
|
7724
|
+
const value = localStorage.getItem(getVisitedStepsKey(formId));
|
|
7725
|
+
if (!value || !isJson(value)) return undefined;
|
|
7726
|
+
const parsed = JSON.parse(value);
|
|
7727
|
+
return Array.isArray(parsed) ? parsed.filter(id => typeof id === 'number') : undefined;
|
|
7728
|
+
} catch (err) {
|
|
7729
|
+
console.warn(`Could not read visited steps: ${err}`);
|
|
7730
|
+
return undefined;
|
|
7731
|
+
}
|
|
7732
|
+
};
|
|
7502
7733
|
function isJson(str) {
|
|
7503
7734
|
try {
|
|
7504
7735
|
JSON.parse(str);
|
|
@@ -7536,10 +7767,14 @@ const stepperReducer = (state, action) => {
|
|
|
7536
7767
|
// (page/next, page/prev, or setVisited previously marked it visited).
|
|
7537
7768
|
// Preserve any previously-tracked isVisited=true so navigation history
|
|
7538
7769
|
// isn't lost whenever unrelated form data changes trigger this recompute.
|
|
7770
|
+
// isNavigatedAway is tracked here and never recomputed, so the merge is the only thing
|
|
7771
|
+
// carrying it across a recompute. Seeding it from the recomputed state instead would let
|
|
7772
|
+
// data presence mark a step navigated, which is the whole thing it exists to avoid.
|
|
7539
7773
|
const mergedCategories = newState.categories.map(newCategory => {
|
|
7540
7774
|
const previousCategory = categories.find(c => c.id === newCategory.id);
|
|
7541
7775
|
return Object.assign({}, newCategory, {
|
|
7542
|
-
isVisited: (previousCategory == null ? void 0 : previousCategory.isVisited) || newCategory.isVisited
|
|
7776
|
+
isVisited: (previousCategory == null ? void 0 : previousCategory.isVisited) || newCategory.isVisited,
|
|
7777
|
+
isNavigatedAway: (previousCategory == null ? void 0 : previousCategory.isNavigatedAway) === true
|
|
7543
7778
|
});
|
|
7544
7779
|
});
|
|
7545
7780
|
return Object.assign({}, newState, {
|
|
@@ -7550,7 +7785,8 @@ const stepperReducer = (state, action) => {
|
|
|
7550
7785
|
{
|
|
7551
7786
|
const newActive = activeId + 1;
|
|
7552
7787
|
const newCategories = categories.map((c, idx) => idx === activeId ? Object.assign({}, c, {
|
|
7553
|
-
isVisited: true
|
|
7788
|
+
isVisited: true,
|
|
7789
|
+
isNavigatedAway: true
|
|
7554
7790
|
}) : c);
|
|
7555
7791
|
const isOnReview = newActive === lastId + 1;
|
|
7556
7792
|
return Object.assign({}, state, {
|
|
@@ -7566,7 +7802,8 @@ const stepperReducer = (state, action) => {
|
|
|
7566
7802
|
{
|
|
7567
7803
|
const newActive = Math.max(0, activeId - 1);
|
|
7568
7804
|
const newCategories = categories.map((c, idx) => idx === activeId ? Object.assign({}, c, {
|
|
7569
|
-
isVisited: true
|
|
7805
|
+
isVisited: true,
|
|
7806
|
+
isNavigatedAway: true
|
|
7570
7807
|
}) : c);
|
|
7571
7808
|
return Object.assign({}, state, {
|
|
7572
7809
|
activeId: newActive,
|
|
@@ -7637,7 +7874,8 @@ const stepperReducer = (state, action) => {
|
|
|
7637
7874
|
id
|
|
7638
7875
|
} = action.payload;
|
|
7639
7876
|
const newCategories = state.categories.map(cat => cat.id === id ? Object.assign({}, cat, {
|
|
7640
|
-
isVisited: true
|
|
7877
|
+
isVisited: true,
|
|
7878
|
+
isNavigatedAway: true
|
|
7641
7879
|
}) : cat);
|
|
7642
7880
|
return Object.assign({}, state, {
|
|
7643
7881
|
categories: newCategories
|
|
@@ -7670,7 +7908,7 @@ const stepperReducer = (state, action) => {
|
|
|
7670
7908
|
};
|
|
7671
7909
|
|
|
7672
7910
|
var isArray$1 = isArray$5;
|
|
7673
|
-
var lengthOfArrayLike$
|
|
7911
|
+
var lengthOfArrayLike$4 = lengthOfArrayLike$c;
|
|
7674
7912
|
var doesNotExceedSafeInteger$1 = doesNotExceedSafeInteger$3;
|
|
7675
7913
|
var bind$3 = functionBindContext;
|
|
7676
7914
|
|
|
@@ -7687,7 +7925,7 @@ var flattenIntoArray$2 = function (target, original, source, sourceLen, start, d
|
|
|
7687
7925
|
element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex];
|
|
7688
7926
|
|
|
7689
7927
|
if (depth > 0 && isArray$1(element)) {
|
|
7690
|
-
elementLen = lengthOfArrayLike$
|
|
7928
|
+
elementLen = lengthOfArrayLike$4(element);
|
|
7691
7929
|
targetIndex = flattenIntoArray$2(target, original, element, elementLen, targetIndex, depth - 1) - 1;
|
|
7692
7930
|
} else {
|
|
7693
7931
|
doesNotExceedSafeInteger$1(targetIndex + 1);
|
|
@@ -7734,21 +7972,21 @@ var arraySpeciesCreate$2 = function (originalArray, length) {
|
|
|
7734
7972
|
return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
|
|
7735
7973
|
};
|
|
7736
7974
|
|
|
7737
|
-
var $$
|
|
7975
|
+
var $$b = _export;
|
|
7738
7976
|
var flattenIntoArray$1 = flattenIntoArray_1;
|
|
7739
|
-
var aCallable$
|
|
7740
|
-
var toObject$
|
|
7741
|
-
var lengthOfArrayLike$
|
|
7977
|
+
var aCallable$1 = aCallable$k;
|
|
7978
|
+
var toObject$3 = toObject$c;
|
|
7979
|
+
var lengthOfArrayLike$3 = lengthOfArrayLike$c;
|
|
7742
7980
|
var arraySpeciesCreate$1 = arraySpeciesCreate$2;
|
|
7743
7981
|
|
|
7744
7982
|
// `Array.prototype.flatMap` method
|
|
7745
7983
|
// https://tc39.es/ecma262/#sec-array.prototype.flatmap
|
|
7746
|
-
$$
|
|
7984
|
+
$$b({ target: 'Array', proto: true }, {
|
|
7747
7985
|
flatMap: function flatMap(callbackfn /* , thisArg */) {
|
|
7748
|
-
var O = toObject$
|
|
7749
|
-
var sourceLen = lengthOfArrayLike$
|
|
7986
|
+
var O = toObject$3(this);
|
|
7987
|
+
var sourceLen = lengthOfArrayLike$3(O);
|
|
7750
7988
|
var A;
|
|
7751
|
-
aCallable$
|
|
7989
|
+
aCallable$1(callbackfn);
|
|
7752
7990
|
A = arraySpeciesCreate$1(O, 0);
|
|
7753
7991
|
A.length = flattenIntoArray$1(A, O, O, sourceLen, 0, 1, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
|
7754
7992
|
return A;
|
|
@@ -7763,7 +8001,7 @@ var addToUnscopables$1 = addToUnscopables$5;
|
|
|
7763
8001
|
addToUnscopables$1('flatMap');
|
|
7764
8002
|
|
|
7765
8003
|
var call$6 = functionCall;
|
|
7766
|
-
var uncurryThis$
|
|
8004
|
+
var uncurryThis$a = functionUncurryThis;
|
|
7767
8005
|
var fixRegExpWellKnownSymbolLogic$1 = fixRegexpWellKnownSymbolLogic;
|
|
7768
8006
|
var anObject$4 = anObject$t;
|
|
7769
8007
|
var isNullOrUndefined$1 = isNullOrUndefined$7;
|
|
@@ -7771,21 +8009,21 @@ var requireObjectCoercible$4 = requireObjectCoercible$e;
|
|
|
7771
8009
|
var speciesConstructor = speciesConstructor$2;
|
|
7772
8010
|
var advanceStringIndex$1 = advanceStringIndex$3;
|
|
7773
8011
|
var toLength$3 = toLength$7;
|
|
7774
|
-
var toString$
|
|
8012
|
+
var toString$9 = toString$n;
|
|
7775
8013
|
var getMethod$1 = getMethod$7;
|
|
7776
8014
|
var regExpExec$1 = regexpExecAbstract;
|
|
7777
8015
|
var stickyHelpers = regexpStickyHelpers;
|
|
7778
|
-
var fails$
|
|
8016
|
+
var fails$2 = fails$y;
|
|
7779
8017
|
|
|
7780
8018
|
var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y;
|
|
7781
8019
|
var MAX_UINT32 = 0xFFFFFFFF;
|
|
7782
8020
|
var min$1 = Math.min;
|
|
7783
|
-
var push$
|
|
7784
|
-
var stringSlice$4 = uncurryThis$
|
|
8021
|
+
var push$4 = uncurryThis$a([].push);
|
|
8022
|
+
var stringSlice$4 = uncurryThis$a(''.slice);
|
|
7785
8023
|
|
|
7786
8024
|
// Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
|
|
7787
8025
|
// Weex JS has frozen built-in prototypes, so use try / catch wrapper
|
|
7788
|
-
var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails$
|
|
8026
|
+
var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails$2(function () {
|
|
7789
8027
|
// eslint-disable-next-line regexp/no-empty-group -- required for testing
|
|
7790
8028
|
var re = /(?:)/;
|
|
7791
8029
|
var originalExec = re.exec;
|
|
@@ -7817,7 +8055,7 @@ fixRegExpWellKnownSymbolLogic$1('split', function (SPLIT, nativeSplit, maybeCall
|
|
|
7817
8055
|
var splitter = isNullOrUndefined$1(separator) ? undefined : getMethod$1(separator, SPLIT);
|
|
7818
8056
|
return splitter
|
|
7819
8057
|
? call$6(splitter, separator, O, limit)
|
|
7820
|
-
: call$6(internalSplit, toString$
|
|
8058
|
+
: call$6(internalSplit, toString$9(O), separator, limit);
|
|
7821
8059
|
},
|
|
7822
8060
|
// `RegExp.prototype[@@split]` method
|
|
7823
8061
|
// https://tc39.es/ecma262/#sec-regexp.prototype-@@split
|
|
@@ -7826,7 +8064,7 @@ fixRegExpWellKnownSymbolLogic$1('split', function (SPLIT, nativeSplit, maybeCall
|
|
|
7826
8064
|
// the 'y' flag.
|
|
7827
8065
|
function (string, limit) {
|
|
7828
8066
|
var rx = anObject$4(this);
|
|
7829
|
-
var S = toString$
|
|
8067
|
+
var S = toString$9(string);
|
|
7830
8068
|
|
|
7831
8069
|
if (!BUGGY) {
|
|
7832
8070
|
var res = maybeCallNative(internalSplit, rx, S, limit, internalSplit !== nativeSplit);
|
|
@@ -7858,16 +8096,16 @@ fixRegExpWellKnownSymbolLogic$1('split', function (SPLIT, nativeSplit, maybeCall
|
|
|
7858
8096
|
) {
|
|
7859
8097
|
q = advanceStringIndex$1(S, q, unicodeMatching);
|
|
7860
8098
|
} else {
|
|
7861
|
-
push$
|
|
8099
|
+
push$4(A, stringSlice$4(S, p, q));
|
|
7862
8100
|
if (A.length === lim) return A;
|
|
7863
8101
|
for (var i = 1; i <= z.length - 1; i++) {
|
|
7864
|
-
push$
|
|
8102
|
+
push$4(A, z[i]);
|
|
7865
8103
|
if (A.length === lim) return A;
|
|
7866
8104
|
}
|
|
7867
8105
|
q = p = e;
|
|
7868
8106
|
}
|
|
7869
8107
|
}
|
|
7870
|
-
push$
|
|
8108
|
+
push$4(A, stringSlice$4(S, p));
|
|
7871
8109
|
return A;
|
|
7872
8110
|
}
|
|
7873
8111
|
];
|
|
@@ -7884,9 +8122,9 @@ var getIteratorFlattenable$1 = function (obj, stringHandling) {
|
|
|
7884
8122
|
return getIteratorDirect$1(anObject$3(method !== undefined ? call$5(method, obj) : obj));
|
|
7885
8123
|
};
|
|
7886
8124
|
|
|
7887
|
-
var $$
|
|
8125
|
+
var $$a = _export;
|
|
7888
8126
|
var call$4 = functionCall;
|
|
7889
|
-
var aCallable
|
|
8127
|
+
var aCallable = aCallable$k;
|
|
7890
8128
|
var anObject$2 = anObject$t;
|
|
7891
8129
|
var getIteratorDirect = getIteratorDirect$a;
|
|
7892
8130
|
var getIteratorFlattenable = getIteratorFlattenable$1;
|
|
@@ -7918,10 +8156,10 @@ var IteratorProxy = createIteratorProxy(function () {
|
|
|
7918
8156
|
|
|
7919
8157
|
// `Iterator.prototype.flatMap` method
|
|
7920
8158
|
// https://github.com/tc39/proposal-iterator-helpers
|
|
7921
|
-
$$
|
|
8159
|
+
$$a({ target: 'Iterator', proto: true, real: true, forced: IS_PURE$1 }, {
|
|
7922
8160
|
flatMap: function flatMap(mapper) {
|
|
7923
8161
|
anObject$2(this);
|
|
7924
|
-
aCallable
|
|
8162
|
+
aCallable(mapper);
|
|
7925
8163
|
return new IteratorProxy(getIteratorDirect(this), {
|
|
7926
8164
|
mapper: mapper,
|
|
7927
8165
|
inner: null
|
|
@@ -8087,49 +8325,226 @@ const createAutoPopulateMiddleware = (uischema, user) => (state, action, default
|
|
|
8087
8325
|
*/
|
|
8088
8326
|
const autoPopulatePropertiesMonaco = [];
|
|
8089
8327
|
|
|
8090
|
-
|
|
8091
|
-
|
|
8092
|
-
|
|
8093
|
-
|
|
8094
|
-
|
|
8095
|
-
|
|
8096
|
-
|
|
8097
|
-
|
|
8098
|
-
|
|
8099
|
-
|
|
8100
|
-
|
|
8101
|
-
|
|
8102
|
-
|
|
8103
|
-
|
|
8104
|
-
|
|
8105
|
-
|
|
8106
|
-
|
|
8107
|
-
|
|
8108
|
-
|
|
8109
|
-
|
|
8110
|
-
|
|
8111
|
-
|
|
8112
|
-
|
|
8113
|
-
//
|
|
8114
|
-
|
|
8115
|
-
|
|
8116
|
-
|
|
8117
|
-
|
|
8118
|
-
|
|
8119
|
-
|
|
8120
|
-
|
|
8121
|
-
|
|
8122
|
-
|
|
8123
|
-
|
|
8124
|
-
|
|
8125
|
-
|
|
8126
|
-
|
|
8127
|
-
|
|
8128
|
-
|
|
8129
|
-
|
|
8130
|
-
|
|
8131
|
-
|
|
8132
|
-
|
|
8328
|
+
class ContextProviderClass {
|
|
8329
|
+
async addDataByUrl(key, url, processDataFunction, token) {
|
|
8330
|
+
let header = {};
|
|
8331
|
+
const [requestId, axiosWithConfig] = this.getAxiosInterceptorConfig(axios);
|
|
8332
|
+
if (token) {
|
|
8333
|
+
header = Object.assign({}, header, {
|
|
8334
|
+
Authorization: `Bearer ${token}`
|
|
8335
|
+
});
|
|
8336
|
+
}
|
|
8337
|
+
await axiosWithConfig.get(url, header).then(response => {
|
|
8338
|
+
const processedData = processDataFunction(response.data);
|
|
8339
|
+
this.enumValues.set(key, () => processedData);
|
|
8340
|
+
}).catch(err => {
|
|
8341
|
+
if (err.message.includes('CORS')) {
|
|
8342
|
+
console.warn(err.message);
|
|
8343
|
+
} else {
|
|
8344
|
+
console.warn(`addDataByUrl: ${err.message}`);
|
|
8345
|
+
}
|
|
8346
|
+
});
|
|
8347
|
+
axiosWithConfig.interceptors.request.eject(requestId);
|
|
8348
|
+
}
|
|
8349
|
+
constructor() {
|
|
8350
|
+
this.selfProps = void 0;
|
|
8351
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8352
|
+
this.enumValues = new Map();
|
|
8353
|
+
this.enumFunctions = new Map();
|
|
8354
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8355
|
+
this.enumSubmitFunctions = new Map();
|
|
8356
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8357
|
+
this.enumSaveFunctions = new Map();
|
|
8358
|
+
this.baseEnumerator = void 0;
|
|
8359
|
+
this.addFormContextData = (key, data) => {
|
|
8360
|
+
this.enumValues.set(key, () => data);
|
|
8361
|
+
};
|
|
8362
|
+
this.setup = props => {
|
|
8363
|
+
var _props$isFormSubmitte, _props$autoPopulatedD, _this$selfProps;
|
|
8364
|
+
this.selfProps = props;
|
|
8365
|
+
if (props.fileManagement) {
|
|
8366
|
+
const {
|
|
8367
|
+
fileList,
|
|
8368
|
+
uploadFile,
|
|
8369
|
+
downloadFile,
|
|
8370
|
+
deleteFile
|
|
8371
|
+
} = props.fileManagement;
|
|
8372
|
+
this.enumValues.set('file-list', () => fileList);
|
|
8373
|
+
this.enumFunctions.set('upload-file', () => uploadFile);
|
|
8374
|
+
this.enumFunctions.set('download-file', () => downloadFile);
|
|
8375
|
+
this.enumFunctions.set('delete-file', () => deleteFile);
|
|
8376
|
+
}
|
|
8377
|
+
if (props.submit) {
|
|
8378
|
+
const {
|
|
8379
|
+
submitForm,
|
|
8380
|
+
saveForm
|
|
8381
|
+
} = props.submit;
|
|
8382
|
+
const submitFunction = submitForm;
|
|
8383
|
+
const saveFormFunction = saveForm;
|
|
8384
|
+
this.enumSubmitFunctions.set('submit-form', () => submitFunction);
|
|
8385
|
+
this.enumSaveFunctions.set('save-form', () => saveFormFunction);
|
|
8386
|
+
}
|
|
8387
|
+
if (props.data) {
|
|
8388
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8389
|
+
Object.keys(props.data).forEach(item => {
|
|
8390
|
+
this.enumValues.set(item, () => props.data[item]);
|
|
8391
|
+
});
|
|
8392
|
+
}
|
|
8393
|
+
if (!props.children) {
|
|
8394
|
+
return null;
|
|
8395
|
+
}
|
|
8396
|
+
if (props.formUrl) {
|
|
8397
|
+
this.baseEnumerator.formUrl = props.formUrl;
|
|
8398
|
+
}
|
|
8399
|
+
this.baseEnumerator.isFormSubmitted = (_props$isFormSubmitte = props.isFormSubmitted) != null ? _props$isFormSubmitte : false;
|
|
8400
|
+
this.baseEnumerator.autoPopulatedData = (_props$autoPopulatedD = props.autoPopulatedData) != null ? _props$autoPopulatedD : [];
|
|
8401
|
+
this.baseEnumerator.formId = props.formId;
|
|
8402
|
+
return jsx(JsonFormContext.Provider, {
|
|
8403
|
+
value: this.baseEnumerator,
|
|
8404
|
+
children: (_this$selfProps = this.selfProps) == null ? void 0 : _this$selfProps.children
|
|
8405
|
+
});
|
|
8406
|
+
};
|
|
8407
|
+
this.getContextProvider = () => {
|
|
8408
|
+
var _this$selfProps2;
|
|
8409
|
+
return jsx(JsonFormContext.Provider, {
|
|
8410
|
+
value: this.baseEnumerator,
|
|
8411
|
+
children: (_this$selfProps2 = this.selfProps) == null ? void 0 : _this$selfProps2.children
|
|
8412
|
+
});
|
|
8413
|
+
};
|
|
8414
|
+
this.getFormUrl = () => {
|
|
8415
|
+
var _this$selfProps3;
|
|
8416
|
+
return (_this$selfProps3 = this.selfProps) == null ? void 0 : _this$selfProps3.formUrl;
|
|
8417
|
+
};
|
|
8418
|
+
this.getAxiosInterceptorConfig = axios => {
|
|
8419
|
+
const requestId = axios.interceptors.request.use(req => {
|
|
8420
|
+
if (req.data === undefined) {
|
|
8421
|
+
throw new Error(`The URL: ${req.url} encountered a CORS error.`);
|
|
8422
|
+
}
|
|
8423
|
+
return req;
|
|
8424
|
+
});
|
|
8425
|
+
return [requestId, axios];
|
|
8426
|
+
};
|
|
8427
|
+
/**
|
|
8428
|
+
* Grabs data stored under a given key
|
|
8429
|
+
*
|
|
8430
|
+
*/
|
|
8431
|
+
this.getFormContextData = key => {
|
|
8432
|
+
const dataFunction = this.baseEnumerator.data.get(key);
|
|
8433
|
+
return dataFunction && dataFunction();
|
|
8434
|
+
};
|
|
8435
|
+
/**
|
|
8436
|
+
* Grabs all data
|
|
8437
|
+
*
|
|
8438
|
+
*/
|
|
8439
|
+
this.getAllFormContextData = () => {
|
|
8440
|
+
const allData = [];
|
|
8441
|
+
this.baseEnumerator.data.forEach((d, key) => {
|
|
8442
|
+
allData.push({
|
|
8443
|
+
[key]: d()
|
|
8444
|
+
});
|
|
8445
|
+
});
|
|
8446
|
+
return allData;
|
|
8447
|
+
};
|
|
8448
|
+
this.baseEnumerator = {
|
|
8449
|
+
data: this.enumValues,
|
|
8450
|
+
functions: this.enumFunctions,
|
|
8451
|
+
submitFunction: this.enumSubmitFunctions,
|
|
8452
|
+
saveFunction: this.enumSaveFunctions,
|
|
8453
|
+
addFormContextData: this.addFormContextData,
|
|
8454
|
+
getFormContextData: this.getFormContextData,
|
|
8455
|
+
getAllFormContextData: this.getAllFormContextData,
|
|
8456
|
+
formUrl: this.getFormUrl()
|
|
8457
|
+
};
|
|
8458
|
+
this.selfProps = {};
|
|
8459
|
+
}
|
|
8460
|
+
}
|
|
8461
|
+
const ContextProviderC = new ContextProviderClass();
|
|
8462
|
+
const ContextProviderFactory = () => new ContextProviderClass().setup;
|
|
8463
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8464
|
+
const JsonFormContext = /*#__PURE__*/createContext(null);
|
|
8465
|
+
|
|
8466
|
+
const REVIEW_CHANGE_ACTION = 'jsonforms/review/change';
|
|
8467
|
+
function reviewReducer(_state, action) {
|
|
8468
|
+
if (action.type === REVIEW_CHANGE_ACTION) {
|
|
8469
|
+
return action.payload;
|
|
8470
|
+
}
|
|
8471
|
+
return null;
|
|
8472
|
+
}
|
|
8473
|
+
const ReviewRenderContext = /*#__PURE__*/createContext(undefined);
|
|
8474
|
+
const ReviewRenderProvider = ({
|
|
8475
|
+
children,
|
|
8476
|
+
onReviewChange
|
|
8477
|
+
}) => {
|
|
8478
|
+
const [reviewChange, dispatch] = useReducer(reviewReducer, null);
|
|
8479
|
+
const onChangeDispatch = useCallback((stepId, scope) => {
|
|
8480
|
+
dispatch({
|
|
8481
|
+
type: REVIEW_CHANGE_ACTION,
|
|
8482
|
+
payload: {
|
|
8483
|
+
stepId,
|
|
8484
|
+
scope
|
|
8485
|
+
}
|
|
8486
|
+
});
|
|
8487
|
+
onReviewChange == null || onReviewChange(stepId, scope);
|
|
8488
|
+
}, [onReviewChange]);
|
|
8489
|
+
const context = useMemo(() => ({
|
|
8490
|
+
isProvided: true,
|
|
8491
|
+
onChangeDispatch,
|
|
8492
|
+
reviewChange
|
|
8493
|
+
}), [onChangeDispatch, reviewChange]);
|
|
8494
|
+
return jsx(ReviewRenderContext.Provider, {
|
|
8495
|
+
value: context,
|
|
8496
|
+
children: children
|
|
8497
|
+
});
|
|
8498
|
+
};
|
|
8499
|
+
const useReviewContext = () => {
|
|
8500
|
+
return useContext(ReviewRenderContext);
|
|
8501
|
+
};
|
|
8502
|
+
|
|
8503
|
+
const createStepperContextInitData = (props, options) => {
|
|
8504
|
+
var _uischema$options, _uischema$options2, _categorization$eleme;
|
|
8505
|
+
const {
|
|
8506
|
+
uischema,
|
|
8507
|
+
data,
|
|
8508
|
+
schema,
|
|
8509
|
+
ajv,
|
|
8510
|
+
t,
|
|
8511
|
+
path
|
|
8512
|
+
} = props;
|
|
8513
|
+
const categorization = uischema;
|
|
8514
|
+
const filteredErrors = ajv.errors && ajv.errors.filter(error => (error == null ? void 0 : error.data) != null);
|
|
8515
|
+
// run validation once, capture errors
|
|
8516
|
+
const valid = ajv.validate(schema, data || {});
|
|
8517
|
+
const isPage = (uischema == null || (_uischema$options = uischema.options) == null ? void 0 : _uischema$options.variant) === 'pages';
|
|
8518
|
+
//TODO: Determine if cachedStatus is still being used by anything in the library
|
|
8519
|
+
// If not, do a proper clean up.
|
|
8520
|
+
const isCacheStatus = (_uischema$options2 = uischema.options) == null ? void 0 : _uischema$options2.cacheStatus;
|
|
8521
|
+
isCacheStatus && getIsVisitFromLocalStorage() || [];
|
|
8522
|
+
const categories = (_categorization$eleme = categorization.elements) == null ? void 0 : _categorization$eleme.map((c, id) => {
|
|
8523
|
+
var _options$visitedIds$h, _options$visitedIds, _deriveLabelForUISche;
|
|
8524
|
+
const scopes = pickPropertyValues(c, 'scope', 'ListWithDetail');
|
|
8525
|
+
// On first mount nothing is visited, so status is driven by whether the step already holds
|
|
8526
|
+
// user-entered data. Auto-populated fields (system-filled from the user profile) are excluded
|
|
8527
|
+
// so an unopened page with only auto-populated values stays NotStarted, while a resumed form
|
|
8528
|
+
// the user actually filled still shows its saved status. On the recomputes that follow every
|
|
8529
|
+
// data change, pages the user has already opened keep their visited state.
|
|
8530
|
+
let visited = (_options$visitedIds$h = options == null || (_options$visitedIds = options.visitedIds) == null ? void 0 : _options$visitedIds.has(id)) != null ? _options$visitedIds$h : false;
|
|
8531
|
+
const autoPopulatedScopes = getAutoPopulateControls(c).map(control => control.scope);
|
|
8532
|
+
const {
|
|
8533
|
+
status,
|
|
8534
|
+
hasRequiredFields
|
|
8535
|
+
} = getStepStatus({
|
|
8536
|
+
scopes,
|
|
8537
|
+
data,
|
|
8538
|
+
errors: filteredErrors != null ? filteredErrors : [],
|
|
8539
|
+
schema,
|
|
8540
|
+
visited,
|
|
8541
|
+
autoPopulatedScopes,
|
|
8542
|
+
autoPopulatedValues: options == null ? void 0 : options.autoPopulatedValues
|
|
8543
|
+
});
|
|
8544
|
+
//If the step has all conditional fields, set visited to true so that the step status will be
|
|
8545
|
+
//completed to enable form to be saved.
|
|
8546
|
+
if (!hasRequiredFields) {
|
|
8547
|
+
visited = true;
|
|
8133
8548
|
}
|
|
8134
8549
|
return {
|
|
8135
8550
|
id,
|
|
@@ -8138,6 +8553,10 @@ const createStepperContextInitData = props => {
|
|
|
8138
8553
|
isCompleted: status === StepStatus.COMPLETED || visited && !hasRequiredFields,
|
|
8139
8554
|
isValid: status === StepStatus.COMPLETED || visited && !hasRequiredFields,
|
|
8140
8555
|
isVisited: [StepStatus.COMPLETED, StepStatus.IN_PROGRESS].includes(status),
|
|
8556
|
+
// Navigation is tracked by the reducer, which merges this value forward on every recompute.
|
|
8557
|
+
// It starts false so a freshly opened form shows no validation messages until the user has
|
|
8558
|
+
// actually worked through a step; deriving it here from data would defeat the point.
|
|
8559
|
+
isNavigatedAway: false,
|
|
8141
8560
|
status,
|
|
8142
8561
|
uischema: c,
|
|
8143
8562
|
isEnabled: isEnabled(c, data, '', ajv, undefined),
|
|
@@ -8174,7 +8593,21 @@ const JsonFormsStepperContextProvider = ({
|
|
|
8174
8593
|
data,
|
|
8175
8594
|
uischema
|
|
8176
8595
|
} = StepperProps;
|
|
8177
|
-
const
|
|
8596
|
+
const formCtx = useContext(JsonFormContext);
|
|
8597
|
+
const autoPopulatedValues = formCtx == null ? void 0 : formCtx.autoPopulatedData;
|
|
8598
|
+
const formId = formCtx == null ? void 0 : formCtx.formId;
|
|
8599
|
+
// Steps opened in an earlier session. Seeding these on first mount is what keeps a step the user
|
|
8600
|
+
// has been through from dropping back to NotStarted on resume — including the case where they
|
|
8601
|
+
// edited an auto-populated field and then restored the original value, which leaves nothing in
|
|
8602
|
+
// the data to distinguish it from a step that was never opened.
|
|
8603
|
+
const persistedVisitedIds = useMemo(() => {
|
|
8604
|
+
var _getVisitedSteps;
|
|
8605
|
+
return new Set((_getVisitedSteps = getVisitedSteps(formId)) != null ? _getVisitedSteps : []);
|
|
8606
|
+
}, [formId]);
|
|
8607
|
+
const [stepperState, dispatch] = useReducer(stepperReducer, createStepperContextInitData(StepperProps, {
|
|
8608
|
+
visitedIds: persistedVisitedIds,
|
|
8609
|
+
autoPopulatedValues
|
|
8610
|
+
}));
|
|
8178
8611
|
const stepperDispatch = (StepperProps == null ? void 0 : StepperProps.customDispatch) || dispatch;
|
|
8179
8612
|
const isCacheStatus = (_uischema$options3 = uischema.options) == null ? void 0 : _uischema$options3.cacheStatus;
|
|
8180
8613
|
//prevents infinite loop refresh
|
|
@@ -8276,12 +8709,31 @@ const JsonFormsStepperContextProvider = ({
|
|
|
8276
8709
|
});
|
|
8277
8710
|
//eslint-disable-next-line
|
|
8278
8711
|
}, [ctx == null || (_ctx$core5 = ctx.core) == null ? void 0 : _ctx$core5.errors]);
|
|
8712
|
+
// Persist as the user goes rather than on unload: a draft resumed on another tab, or after a
|
|
8713
|
+
// crash or a killed mobile tab, never fires beforeunload and would otherwise lose the visits.
|
|
8714
|
+
// The categories array is rebuilt on every data change, so this effect runs on each keystroke —
|
|
8715
|
+
// only touch storage when the set has actually grown.
|
|
8716
|
+
const lastPersistedVisited = useRef(null);
|
|
8717
|
+
useEffect(() => {
|
|
8718
|
+
var _stepperState$categor3, _stepperState$categor4;
|
|
8719
|
+
const visitedIds = (_stepperState$categor3 = stepperState == null || (_stepperState$categor4 = stepperState.categories) == null ? void 0 : _stepperState$categor4.filter(c => c.isVisited).map(c => c.id)) != null ? _stepperState$categor3 : [];
|
|
8720
|
+
const merged = [...new Set([...persistedVisitedIds, ...visitedIds])].sort((a, b) => a - b);
|
|
8721
|
+
if (merged.length === 0) {
|
|
8722
|
+
return;
|
|
8723
|
+
}
|
|
8724
|
+
const serialized = JSON.stringify(merged);
|
|
8725
|
+
if (serialized === lastPersistedVisited.current) {
|
|
8726
|
+
return;
|
|
8727
|
+
}
|
|
8728
|
+
lastPersistedVisited.current = serialized;
|
|
8729
|
+
saveVisitedSteps(formId, merged);
|
|
8730
|
+
}, [formId, persistedVisitedIds, stepperState == null ? void 0 : stepperState.categories]);
|
|
8279
8731
|
/* istanbul ignore next */
|
|
8280
8732
|
useEffect(() => {
|
|
8281
8733
|
const handleBeforeUnload = () => {
|
|
8282
8734
|
if (isCacheStatus) {
|
|
8283
|
-
var _stepperState$
|
|
8284
|
-
saveIsVisitFromLocalStorage((stepperState == null || (_stepperState$
|
|
8735
|
+
var _stepperState$categor5;
|
|
8736
|
+
saveIsVisitFromLocalStorage((stepperState == null || (_stepperState$categor5 = stepperState.categories) == null ? void 0 : _stepperState$categor5.map(c => c == null ? void 0 : c.isVisited)) || []);
|
|
8285
8737
|
}
|
|
8286
8738
|
};
|
|
8287
8739
|
window.addEventListener('beforeunload', handleBeforeUnload);
|
|
@@ -8292,13 +8744,17 @@ const JsonFormsStepperContextProvider = ({
|
|
|
8292
8744
|
}, [stepperState]);
|
|
8293
8745
|
useEffect(() => {
|
|
8294
8746
|
if ((context == null ? void 0 : context.isProvided) === true) {
|
|
8747
|
+
var _stepperState$categor6, _stepperState$categor7;
|
|
8295
8748
|
/* The block is used to cache the state for the tenant web app review editor */
|
|
8296
8749
|
stepperDispatch({
|
|
8297
8750
|
type: 'update/uischema',
|
|
8298
8751
|
payload: {
|
|
8299
8752
|
state: createStepperContextInitData(Object.assign({}, StepperProps, {
|
|
8300
8753
|
activeId: Math.min(stepperState == null ? void 0 : stepperState.activeId, stepperState.maxReachedStep)
|
|
8301
|
-
})
|
|
8754
|
+
}), {
|
|
8755
|
+
visitedIds: new Set([...persistedVisitedIds, ...((_stepperState$categor6 = stepperState == null || (_stepperState$categor7 = stepperState.categories) == null ? void 0 : _stepperState$categor7.filter(c => c.isVisited).map(c => c.id)) != null ? _stepperState$categor6 : [])]),
|
|
8756
|
+
autoPopulatedValues
|
|
8757
|
+
})
|
|
8302
8758
|
}
|
|
8303
8759
|
});
|
|
8304
8760
|
if (stepperState.activeId !== stepperState.categories.length + 1) {
|
|
@@ -8450,7 +8906,7 @@ const GoAInputBaseControl = props => {
|
|
|
8450
8906
|
id: isStepperReview === true ? `review-base-${path}-element-wrapper` : `${path}-element-wrapper`,
|
|
8451
8907
|
children: jsx(GoabFormItem, {
|
|
8452
8908
|
requirement: (_uischema$options$com = uischema == null || (_uischema$options = uischema.options) == null || (_uischema$options = _uischema$options.componentProps) == null ? void 0 : _uischema$options.requirement) != null ? _uischema$options$com : requiredNow ? 'required' : undefined,
|
|
8453
|
-
error: (currentCategory == null ? void 0 : currentCategory.
|
|
8909
|
+
error: (currentCategory == null ? void 0 : currentCategory.isNavigatedAway) === true || isVisited || hasValue ? modifiedErrors : undefined,
|
|
8454
8910
|
testId: isStepperReview === true ? `review-base-${path}` : path,
|
|
8455
8911
|
label: getFormItemLabel(labelToUpdate, props == null ? void 0 : props.noLabel),
|
|
8456
8912
|
helpText: typeof (uischema == null || (_uischema$options2 = uischema.options) == null ? void 0 : _uischema$options2.help) === 'string' && !isStepperReview ? uischema == null || (_uischema$options3 = uischema.options) == null ? void 0 : _uischema$options3.help : '',
|
|
@@ -8467,14 +8923,14 @@ const GoAInputBaseControl = props => {
|
|
|
8467
8923
|
});
|
|
8468
8924
|
};
|
|
8469
8925
|
|
|
8470
|
-
var $$
|
|
8926
|
+
var $$9 = _export;
|
|
8471
8927
|
var DESCRIPTORS$4 = descriptors;
|
|
8472
8928
|
var global$4 = global$t;
|
|
8473
|
-
var uncurryThis$
|
|
8929
|
+
var uncurryThis$9 = functionUncurryThis;
|
|
8474
8930
|
var hasOwn$2 = hasOwnProperty_1;
|
|
8475
8931
|
var isCallable$1 = isCallable$t;
|
|
8476
8932
|
var isPrototypeOf = objectIsPrototypeOf;
|
|
8477
|
-
var toString$
|
|
8933
|
+
var toString$8 = toString$n;
|
|
8478
8934
|
var defineBuiltInAccessor$3 = defineBuiltInAccessor$7;
|
|
8479
8935
|
var copyConstructorProperties = copyConstructorProperties$3;
|
|
8480
8936
|
|
|
@@ -8488,7 +8944,7 @@ if (DESCRIPTORS$4 && isCallable$1(NativeSymbol) && (!('description' in SymbolPro
|
|
|
8488
8944
|
var EmptyStringDescriptionStore = {};
|
|
8489
8945
|
// wrap Symbol constructor for correct work with undefined description
|
|
8490
8946
|
var SymbolWrapper = function Symbol() {
|
|
8491
|
-
var description = arguments.length < 1 || arguments[0] === undefined ? undefined : toString$
|
|
8947
|
+
var description = arguments.length < 1 || arguments[0] === undefined ? undefined : toString$8(arguments[0]);
|
|
8492
8948
|
var result = isPrototypeOf(SymbolPrototype, this)
|
|
8493
8949
|
? new NativeSymbol(description)
|
|
8494
8950
|
// in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)'
|
|
@@ -8502,11 +8958,11 @@ if (DESCRIPTORS$4 && isCallable$1(NativeSymbol) && (!('description' in SymbolPro
|
|
|
8502
8958
|
SymbolPrototype.constructor = SymbolWrapper;
|
|
8503
8959
|
|
|
8504
8960
|
var NATIVE_SYMBOL = String(NativeSymbol('description detection')) === 'Symbol(description detection)';
|
|
8505
|
-
var thisSymbolValue = uncurryThis$
|
|
8506
|
-
var symbolDescriptiveString = uncurryThis$
|
|
8961
|
+
var thisSymbolValue = uncurryThis$9(SymbolPrototype.valueOf);
|
|
8962
|
+
var symbolDescriptiveString = uncurryThis$9(SymbolPrototype.toString);
|
|
8507
8963
|
var regexp = /^Symbol\((.*)\)[^)]+$/;
|
|
8508
|
-
var replace$3 = uncurryThis$
|
|
8509
|
-
var stringSlice$3 = uncurryThis$
|
|
8964
|
+
var replace$3 = uncurryThis$9(''.replace);
|
|
8965
|
+
var stringSlice$3 = uncurryThis$9(''.slice);
|
|
8510
8966
|
|
|
8511
8967
|
defineBuiltInAccessor$3(SymbolPrototype, 'description', {
|
|
8512
8968
|
configurable: true,
|
|
@@ -8519,7 +8975,7 @@ if (DESCRIPTORS$4 && isCallable$1(NativeSymbol) && (!('description' in SymbolPro
|
|
|
8519
8975
|
}
|
|
8520
8976
|
});
|
|
8521
8977
|
|
|
8522
|
-
$$
|
|
8978
|
+
$$9({ global: true, constructor: true, forced: true }, {
|
|
8523
8979
|
Symbol: SymbolWrapper
|
|
8524
8980
|
});
|
|
8525
8981
|
}
|
|
@@ -8529,7 +8985,7 @@ var fixRegExpWellKnownSymbolLogic = fixRegexpWellKnownSymbolLogic;
|
|
|
8529
8985
|
var anObject$1 = anObject$t;
|
|
8530
8986
|
var isNullOrUndefined = isNullOrUndefined$7;
|
|
8531
8987
|
var toLength$2 = toLength$7;
|
|
8532
|
-
var toString$
|
|
8988
|
+
var toString$7 = toString$n;
|
|
8533
8989
|
var requireObjectCoercible$3 = requireObjectCoercible$e;
|
|
8534
8990
|
var getMethod = getMethod$7;
|
|
8535
8991
|
var advanceStringIndex = advanceStringIndex$3;
|
|
@@ -8543,13 +8999,13 @@ fixRegExpWellKnownSymbolLogic('match', function (MATCH, nativeMatch, maybeCallNa
|
|
|
8543
8999
|
function match(regexp) {
|
|
8544
9000
|
var O = requireObjectCoercible$3(this);
|
|
8545
9001
|
var matcher = isNullOrUndefined(regexp) ? undefined : getMethod(regexp, MATCH);
|
|
8546
|
-
return matcher ? call$3(matcher, regexp, O) : new RegExp(regexp)[MATCH](toString$
|
|
9002
|
+
return matcher ? call$3(matcher, regexp, O) : new RegExp(regexp)[MATCH](toString$7(O));
|
|
8547
9003
|
},
|
|
8548
9004
|
// `RegExp.prototype[@@match]` method
|
|
8549
9005
|
// https://tc39.es/ecma262/#sec-regexp.prototype-@@match
|
|
8550
9006
|
function (string) {
|
|
8551
9007
|
var rx = anObject$1(this);
|
|
8552
|
-
var S = toString$
|
|
9008
|
+
var S = toString$7(string);
|
|
8553
9009
|
var res = maybeCallNative(nativeMatch, rx, S);
|
|
8554
9010
|
|
|
8555
9011
|
if (res.done) return res.value;
|
|
@@ -8562,7 +9018,7 @@ fixRegExpWellKnownSymbolLogic('match', function (MATCH, nativeMatch, maybeCallNa
|
|
|
8562
9018
|
var n = 0;
|
|
8563
9019
|
var result;
|
|
8564
9020
|
while ((result = regExpExec(rx, S)) !== null) {
|
|
8565
|
-
var matchStr = toString$
|
|
9021
|
+
var matchStr = toString$7(result[0]);
|
|
8566
9022
|
A[n] = matchStr;
|
|
8567
9023
|
if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength$2(rx.lastIndex), fullUnicode);
|
|
8568
9024
|
n++;
|
|
@@ -8876,7 +9332,7 @@ function useDebouncedCommit(externalValue, commit, delay = COMMIT_DELAY) {
|
|
|
8876
9332
|
if (pendingRef.current !== null) {
|
|
8877
9333
|
return;
|
|
8878
9334
|
}
|
|
8879
|
-
setLocalValue(current => isEqual(current, externalValue) ? current : externalValue);
|
|
9335
|
+
setLocalValue(current => isEqual$1(current, externalValue) ? current : externalValue);
|
|
8880
9336
|
}, [externalValue]);
|
|
8881
9337
|
// Don't drop the tail of what was typed when the control goes away, e.g. on stepper navigation.
|
|
8882
9338
|
useEffect(() => flush, [flush]);
|
|
@@ -8968,7 +9424,7 @@ function _objectWithoutPropertiesLoose(r, e) {
|
|
|
8968
9424
|
}
|
|
8969
9425
|
|
|
8970
9426
|
var toIntegerOrInfinity$1 = toIntegerOrInfinity$9;
|
|
8971
|
-
var toString$
|
|
9427
|
+
var toString$6 = toString$n;
|
|
8972
9428
|
var requireObjectCoercible$2 = requireObjectCoercible$e;
|
|
8973
9429
|
|
|
8974
9430
|
var $RangeError$1 = RangeError;
|
|
@@ -8976,7 +9432,7 @@ var $RangeError$1 = RangeError;
|
|
|
8976
9432
|
// `String.prototype.repeat` method implementation
|
|
8977
9433
|
// https://tc39.es/ecma262/#sec-string.prototype.repeat
|
|
8978
9434
|
var stringRepeat = function repeat(count) {
|
|
8979
|
-
var str = toString$
|
|
9435
|
+
var str = toString$6(requireObjectCoercible$2(this));
|
|
8980
9436
|
var result = '';
|
|
8981
9437
|
var n = toIntegerOrInfinity$1(count);
|
|
8982
9438
|
if (n < 0 || n === Infinity) throw new $RangeError$1('Wrong number of repetitions');
|
|
@@ -8985,23 +9441,23 @@ var stringRepeat = function repeat(count) {
|
|
|
8985
9441
|
};
|
|
8986
9442
|
|
|
8987
9443
|
// https://github.com/tc39/proposal-string-pad-start-end
|
|
8988
|
-
var uncurryThis$
|
|
9444
|
+
var uncurryThis$8 = functionUncurryThis;
|
|
8989
9445
|
var toLength$1 = toLength$7;
|
|
8990
|
-
var toString$
|
|
9446
|
+
var toString$5 = toString$n;
|
|
8991
9447
|
var $repeat = stringRepeat;
|
|
8992
9448
|
var requireObjectCoercible$1 = requireObjectCoercible$e;
|
|
8993
9449
|
|
|
8994
|
-
var repeat = uncurryThis$
|
|
8995
|
-
var stringSlice$2 = uncurryThis$
|
|
9450
|
+
var repeat = uncurryThis$8($repeat);
|
|
9451
|
+
var stringSlice$2 = uncurryThis$8(''.slice);
|
|
8996
9452
|
var ceil = Math.ceil;
|
|
8997
9453
|
|
|
8998
9454
|
// `String.prototype.{ padStart, padEnd }` methods implementation
|
|
8999
9455
|
var createMethod = function (IS_END) {
|
|
9000
9456
|
return function ($this, maxLength, fillString) {
|
|
9001
|
-
var S = toString$
|
|
9457
|
+
var S = toString$5(requireObjectCoercible$1($this));
|
|
9002
9458
|
var intMaxLength = toLength$1(maxLength);
|
|
9003
9459
|
var stringLength = S.length;
|
|
9004
|
-
var fillStr = fillString === undefined ? ' ' : toString$
|
|
9460
|
+
var fillStr = fillString === undefined ? ' ' : toString$5(fillString);
|
|
9005
9461
|
var fillLen, stringFiller;
|
|
9006
9462
|
if (intMaxLength <= stringLength || fillStr === '') return S;
|
|
9007
9463
|
fillLen = intMaxLength - stringLength;
|
|
@@ -9017,17 +9473,17 @@ var stringPad = {
|
|
|
9017
9473
|
start: createMethod(false)};
|
|
9018
9474
|
|
|
9019
9475
|
// https://github.com/zloirock/core-js/issues/280
|
|
9020
|
-
var userAgent
|
|
9476
|
+
var userAgent = engineUserAgent;
|
|
9021
9477
|
|
|
9022
|
-
var stringPadWebkitBug = /Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(userAgent
|
|
9478
|
+
var stringPadWebkitBug = /Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(userAgent);
|
|
9023
9479
|
|
|
9024
|
-
var $$
|
|
9480
|
+
var $$8 = _export;
|
|
9025
9481
|
var $padStart = stringPad.start;
|
|
9026
9482
|
var WEBKIT_BUG = stringPadWebkitBug;
|
|
9027
9483
|
|
|
9028
9484
|
// `String.prototype.padStart` method
|
|
9029
9485
|
// https://tc39.es/ecma262/#sec-string.prototype.padstart
|
|
9030
|
-
$$
|
|
9486
|
+
$$8({ target: 'String', proto: true, forced: WEBKIT_BUG }, {
|
|
9031
9487
|
padStart: function padStart(maxLength /* , fillString = ' ' */) {
|
|
9032
9488
|
return $padStart(this, maxLength, arguments.length > 1 ? arguments[1] : undefined);
|
|
9033
9489
|
}
|
|
@@ -9572,7 +10028,9 @@ const EnumSelect = props => {
|
|
|
9572
10028
|
options,
|
|
9573
10029
|
uischema,
|
|
9574
10030
|
schema,
|
|
9575
|
-
errors
|
|
10031
|
+
errors,
|
|
10032
|
+
isVisited,
|
|
10033
|
+
setIsVisited
|
|
9576
10034
|
} = props;
|
|
9577
10035
|
const registerCtx = useContext(JsonFormsRegisterContext);
|
|
9578
10036
|
const registerConfig = fetchRegisterConfigFromOptions((_props$uischema = props.uischema) == null || (_props$uischema = _props$uischema.options) == null ? void 0 : _props$uischema.register);
|
|
@@ -9630,6 +10088,12 @@ const EnumSelect = props => {
|
|
|
9630
10088
|
id: `jsonforms-${path}-dropdown`,
|
|
9631
10089
|
filterable: autoCompletion,
|
|
9632
10090
|
onChange: detail => {
|
|
10091
|
+
// goa-dropdown exposes no blur event, so a selection is the only interaction available
|
|
10092
|
+
// to mark visited on. This is what surfaces the error when the user picks the empty
|
|
10093
|
+
// placeholder on a required control, which leaves no value to fall back on.
|
|
10094
|
+
if (isVisited === false && setIsVisited) {
|
|
10095
|
+
setIsVisited();
|
|
10096
|
+
}
|
|
9633
10097
|
if (expectsObjectValue(schema)) {
|
|
9634
10098
|
handleChange(path, registerData.find(o => {
|
|
9635
10099
|
return ___default.get(o, valuePath) === detail.value;
|
|
@@ -9676,6 +10140,7 @@ const RadioGroup = props => {
|
|
|
9676
10140
|
config,
|
|
9677
10141
|
label,
|
|
9678
10142
|
isVisited,
|
|
10143
|
+
setIsVisited,
|
|
9679
10144
|
errors
|
|
9680
10145
|
} = props;
|
|
9681
10146
|
const oneOF = (schema == null ? void 0 : schema.oneOf) || [];
|
|
@@ -9701,7 +10166,15 @@ const RadioGroup = props => {
|
|
|
9701
10166
|
value: data,
|
|
9702
10167
|
disabled: !enabled
|
|
9703
10168
|
}, appliedUiSchemaOptions, {
|
|
9704
|
-
onChange: detail =>
|
|
10169
|
+
onChange: detail => {
|
|
10170
|
+
// goa-radio-group exposes no blur event, so selecting an option is the only interaction we
|
|
10171
|
+
// can mark visited on. Without this the group never reports its own error state, and on a
|
|
10172
|
+
// non stepper form a required control the user cleared would stay silent.
|
|
10173
|
+
if (isVisited === false && setIsVisited) {
|
|
10174
|
+
setIsVisited();
|
|
10175
|
+
}
|
|
10176
|
+
handleChange(path, detail.value);
|
|
10177
|
+
}
|
|
9705
10178
|
}, uischema == null || (_uischema$options = uischema.options) == null ? void 0 : _uischema$options.componentProps, {
|
|
9706
10179
|
children: items.map((item, index) => jsx(GoabRadioItem$1, {
|
|
9707
10180
|
name: item.value,
|
|
@@ -10028,19 +10501,11 @@ const GoInputBaseReview = props => jsx(GoAInputBaseControl, Object.assign({}, pr
|
|
|
10028
10501
|
}));
|
|
10029
10502
|
const GoAInputBaseReviewControl = withJsonFormsControlProps(GoInputBaseReview);
|
|
10030
10503
|
|
|
10031
|
-
var
|
|
10032
|
-
|
|
10033
|
-
var $
|
|
10034
|
-
|
|
10035
|
-
var deletePropertyOrThrow$2 = function (O, P) {
|
|
10036
|
-
if (!delete O[P]) throw new $TypeError('Cannot delete property ' + tryToString(P) + ' of ' + tryToString(O));
|
|
10037
|
-
};
|
|
10038
|
-
|
|
10039
|
-
var $$8 = _export;
|
|
10040
|
-
var toObject$3 = toObject$c;
|
|
10041
|
-
var lengthOfArrayLike$3 = lengthOfArrayLike$c;
|
|
10504
|
+
var $$7 = _export;
|
|
10505
|
+
var toObject$2 = toObject$c;
|
|
10506
|
+
var lengthOfArrayLike$2 = lengthOfArrayLike$c;
|
|
10042
10507
|
var setArrayLength = arraySetLength;
|
|
10043
|
-
var deletePropertyOrThrow
|
|
10508
|
+
var deletePropertyOrThrow = deletePropertyOrThrow$2;
|
|
10044
10509
|
var doesNotExceedSafeInteger = doesNotExceedSafeInteger$3;
|
|
10045
10510
|
|
|
10046
10511
|
// IE8-
|
|
@@ -10056,15 +10521,15 @@ var properErrorOnNonWritableLength = function () {
|
|
|
10056
10521
|
}
|
|
10057
10522
|
};
|
|
10058
10523
|
|
|
10059
|
-
var FORCED$
|
|
10524
|
+
var FORCED$1 = INCORRECT_RESULT || !properErrorOnNonWritableLength();
|
|
10060
10525
|
|
|
10061
10526
|
// `Array.prototype.unshift` method
|
|
10062
10527
|
// https://tc39.es/ecma262/#sec-array.prototype.unshift
|
|
10063
|
-
$$
|
|
10528
|
+
$$7({ target: 'Array', proto: true, arity: 1, forced: FORCED$1 }, {
|
|
10064
10529
|
// eslint-disable-next-line no-unused-vars -- required for `.length`
|
|
10065
10530
|
unshift: function unshift(item) {
|
|
10066
|
-
var O = toObject$
|
|
10067
|
-
var len = lengthOfArrayLike$
|
|
10531
|
+
var O = toObject$2(this);
|
|
10532
|
+
var len = lengthOfArrayLike$2(O);
|
|
10068
10533
|
var argCount = arguments.length;
|
|
10069
10534
|
if (argCount) {
|
|
10070
10535
|
doesNotExceedSafeInteger(len + argCount);
|
|
@@ -10072,7 +10537,7 @@ $$8({ target: 'Array', proto: true, arity: 1, forced: FORCED$2 }, {
|
|
|
10072
10537
|
while (k--) {
|
|
10073
10538
|
var to = k + argCount;
|
|
10074
10539
|
if (k in O) O[to] = O[k];
|
|
10075
|
-
else deletePropertyOrThrow
|
|
10540
|
+
else deletePropertyOrThrow(O, to);
|
|
10076
10541
|
}
|
|
10077
10542
|
for (var j = 0; j < argCount; j++) {
|
|
10078
10543
|
O[j] = arguments[j];
|
|
@@ -11511,43 +11976,6 @@ class ListWithDetailControl extends React.Component {
|
|
|
11511
11976
|
}
|
|
11512
11977
|
}
|
|
11513
11978
|
|
|
11514
|
-
const REVIEW_CHANGE_ACTION = 'jsonforms/review/change';
|
|
11515
|
-
function reviewReducer(_state, action) {
|
|
11516
|
-
if (action.type === REVIEW_CHANGE_ACTION) {
|
|
11517
|
-
return action.payload;
|
|
11518
|
-
}
|
|
11519
|
-
return null;
|
|
11520
|
-
}
|
|
11521
|
-
const ReviewRenderContext = /*#__PURE__*/createContext(undefined);
|
|
11522
|
-
const ReviewRenderProvider = ({
|
|
11523
|
-
children,
|
|
11524
|
-
onReviewChange
|
|
11525
|
-
}) => {
|
|
11526
|
-
const [reviewChange, dispatch] = useReducer(reviewReducer, null);
|
|
11527
|
-
const onChangeDispatch = useCallback((stepId, scope) => {
|
|
11528
|
-
dispatch({
|
|
11529
|
-
type: REVIEW_CHANGE_ACTION,
|
|
11530
|
-
payload: {
|
|
11531
|
-
stepId,
|
|
11532
|
-
scope
|
|
11533
|
-
}
|
|
11534
|
-
});
|
|
11535
|
-
onReviewChange == null || onReviewChange(stepId, scope);
|
|
11536
|
-
}, [onReviewChange]);
|
|
11537
|
-
const context = useMemo(() => ({
|
|
11538
|
-
isProvided: true,
|
|
11539
|
-
onChangeDispatch,
|
|
11540
|
-
reviewChange
|
|
11541
|
-
}), [onChangeDispatch, reviewChange]);
|
|
11542
|
-
return jsx(ReviewRenderContext.Provider, {
|
|
11543
|
-
value: context,
|
|
11544
|
-
children: children
|
|
11545
|
-
});
|
|
11546
|
-
};
|
|
11547
|
-
const useReviewContext = () => {
|
|
11548
|
-
return useContext(ReviewRenderContext);
|
|
11549
|
-
};
|
|
11550
|
-
|
|
11551
11979
|
const GoAInputBaseTableReview = props => {
|
|
11552
11980
|
var _uischema$options, _uischema$scope2, _jsonForms$core, _uischema$options4, _uischema$options5, _uischema$options6;
|
|
11553
11981
|
const {
|
|
@@ -12206,142 +12634,6 @@ const SummaryTd = styled.td(_t28 || (_t28 = _$6`
|
|
|
12206
12634
|
padding: 0 !important;
|
|
12207
12635
|
`));
|
|
12208
12636
|
|
|
12209
|
-
class ContextProviderClass {
|
|
12210
|
-
async addDataByUrl(key, url, processDataFunction, token) {
|
|
12211
|
-
let header = {};
|
|
12212
|
-
const [requestId, axiosWithConfig] = this.getAxiosInterceptorConfig(axios);
|
|
12213
|
-
if (token) {
|
|
12214
|
-
header = Object.assign({}, header, {
|
|
12215
|
-
Authorization: `Bearer ${token}`
|
|
12216
|
-
});
|
|
12217
|
-
}
|
|
12218
|
-
await axiosWithConfig.get(url, header).then(response => {
|
|
12219
|
-
const processedData = processDataFunction(response.data);
|
|
12220
|
-
this.enumValues.set(key, () => processedData);
|
|
12221
|
-
}).catch(err => {
|
|
12222
|
-
if (err.message.includes('CORS')) {
|
|
12223
|
-
console.warn(err.message);
|
|
12224
|
-
} else {
|
|
12225
|
-
console.warn(`addDataByUrl: ${err.message}`);
|
|
12226
|
-
}
|
|
12227
|
-
});
|
|
12228
|
-
axiosWithConfig.interceptors.request.eject(requestId);
|
|
12229
|
-
}
|
|
12230
|
-
constructor() {
|
|
12231
|
-
this.selfProps = void 0;
|
|
12232
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12233
|
-
this.enumValues = new Map();
|
|
12234
|
-
this.enumFunctions = new Map();
|
|
12235
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12236
|
-
this.enumSubmitFunctions = new Map();
|
|
12237
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12238
|
-
this.enumSaveFunctions = new Map();
|
|
12239
|
-
this.baseEnumerator = void 0;
|
|
12240
|
-
this.addFormContextData = (key, data) => {
|
|
12241
|
-
this.enumValues.set(key, () => data);
|
|
12242
|
-
};
|
|
12243
|
-
this.setup = props => {
|
|
12244
|
-
var _props$isFormSubmitte, _this$selfProps;
|
|
12245
|
-
this.selfProps = props;
|
|
12246
|
-
if (props.fileManagement) {
|
|
12247
|
-
const {
|
|
12248
|
-
fileList,
|
|
12249
|
-
uploadFile,
|
|
12250
|
-
downloadFile,
|
|
12251
|
-
deleteFile
|
|
12252
|
-
} = props.fileManagement;
|
|
12253
|
-
this.enumValues.set('file-list', () => fileList);
|
|
12254
|
-
this.enumFunctions.set('upload-file', () => uploadFile);
|
|
12255
|
-
this.enumFunctions.set('download-file', () => downloadFile);
|
|
12256
|
-
this.enumFunctions.set('delete-file', () => deleteFile);
|
|
12257
|
-
}
|
|
12258
|
-
if (props.submit) {
|
|
12259
|
-
const {
|
|
12260
|
-
submitForm,
|
|
12261
|
-
saveForm
|
|
12262
|
-
} = props.submit;
|
|
12263
|
-
const submitFunction = submitForm;
|
|
12264
|
-
const saveFormFunction = saveForm;
|
|
12265
|
-
this.enumSubmitFunctions.set('submit-form', () => submitFunction);
|
|
12266
|
-
this.enumSaveFunctions.set('save-form', () => saveFormFunction);
|
|
12267
|
-
}
|
|
12268
|
-
if (props.data) {
|
|
12269
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12270
|
-
Object.keys(props.data).forEach(item => {
|
|
12271
|
-
this.enumValues.set(item, () => props.data[item]);
|
|
12272
|
-
});
|
|
12273
|
-
}
|
|
12274
|
-
if (!props.children) {
|
|
12275
|
-
return null;
|
|
12276
|
-
}
|
|
12277
|
-
if (props.formUrl) {
|
|
12278
|
-
this.baseEnumerator.formUrl = props.formUrl;
|
|
12279
|
-
}
|
|
12280
|
-
this.baseEnumerator.isFormSubmitted = (_props$isFormSubmitte = props.isFormSubmitted) != null ? _props$isFormSubmitte : false;
|
|
12281
|
-
return jsx(JsonFormContext.Provider, {
|
|
12282
|
-
value: this.baseEnumerator,
|
|
12283
|
-
children: (_this$selfProps = this.selfProps) == null ? void 0 : _this$selfProps.children
|
|
12284
|
-
});
|
|
12285
|
-
};
|
|
12286
|
-
this.getContextProvider = () => {
|
|
12287
|
-
var _this$selfProps2;
|
|
12288
|
-
return jsx(JsonFormContext.Provider, {
|
|
12289
|
-
value: this.baseEnumerator,
|
|
12290
|
-
children: (_this$selfProps2 = this.selfProps) == null ? void 0 : _this$selfProps2.children
|
|
12291
|
-
});
|
|
12292
|
-
};
|
|
12293
|
-
this.getFormUrl = () => {
|
|
12294
|
-
var _this$selfProps3;
|
|
12295
|
-
return (_this$selfProps3 = this.selfProps) == null ? void 0 : _this$selfProps3.formUrl;
|
|
12296
|
-
};
|
|
12297
|
-
this.getAxiosInterceptorConfig = axios => {
|
|
12298
|
-
const requestId = axios.interceptors.request.use(req => {
|
|
12299
|
-
if (req.data === undefined) {
|
|
12300
|
-
throw new Error(`The URL: ${req.url} encountered a CORS error.`);
|
|
12301
|
-
}
|
|
12302
|
-
return req;
|
|
12303
|
-
});
|
|
12304
|
-
return [requestId, axios];
|
|
12305
|
-
};
|
|
12306
|
-
/**
|
|
12307
|
-
* Grabs data stored under a given key
|
|
12308
|
-
*
|
|
12309
|
-
*/
|
|
12310
|
-
this.getFormContextData = key => {
|
|
12311
|
-
const dataFunction = this.baseEnumerator.data.get(key);
|
|
12312
|
-
return dataFunction && dataFunction();
|
|
12313
|
-
};
|
|
12314
|
-
/**
|
|
12315
|
-
* Grabs all data
|
|
12316
|
-
*
|
|
12317
|
-
*/
|
|
12318
|
-
this.getAllFormContextData = () => {
|
|
12319
|
-
const allData = [];
|
|
12320
|
-
this.baseEnumerator.data.forEach((d, key) => {
|
|
12321
|
-
allData.push({
|
|
12322
|
-
[key]: d()
|
|
12323
|
-
});
|
|
12324
|
-
});
|
|
12325
|
-
return allData;
|
|
12326
|
-
};
|
|
12327
|
-
this.baseEnumerator = {
|
|
12328
|
-
data: this.enumValues,
|
|
12329
|
-
functions: this.enumFunctions,
|
|
12330
|
-
submitFunction: this.enumSubmitFunctions,
|
|
12331
|
-
saveFunction: this.enumSaveFunctions,
|
|
12332
|
-
addFormContextData: this.addFormContextData,
|
|
12333
|
-
getFormContextData: this.getFormContextData,
|
|
12334
|
-
getAllFormContextData: this.getAllFormContextData,
|
|
12335
|
-
formUrl: this.getFormUrl()
|
|
12336
|
-
};
|
|
12337
|
-
this.selfProps = {};
|
|
12338
|
-
}
|
|
12339
|
-
}
|
|
12340
|
-
const ContextProviderC = new ContextProviderClass();
|
|
12341
|
-
const ContextProviderFactory = () => new ContextProviderClass().setup;
|
|
12342
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12343
|
-
const JsonFormContext = /*#__PURE__*/createContext(null);
|
|
12344
|
-
|
|
12345
12637
|
const RenderStepElements = props => {
|
|
12346
12638
|
var _props$category;
|
|
12347
12639
|
const memoizedSchema = useMemo(() => Object.assign({}, props.schema), [props.schema]);
|
|
@@ -12363,20 +12655,20 @@ const RenderStepElements = props => {
|
|
|
12363
12655
|
});
|
|
12364
12656
|
};
|
|
12365
12657
|
|
|
12366
|
-
var $$
|
|
12658
|
+
var $$6 = _export;
|
|
12367
12659
|
var flattenIntoArray = flattenIntoArray_1;
|
|
12368
|
-
var toObject$
|
|
12369
|
-
var lengthOfArrayLike$
|
|
12660
|
+
var toObject$1 = toObject$c;
|
|
12661
|
+
var lengthOfArrayLike$1 = lengthOfArrayLike$c;
|
|
12370
12662
|
var toIntegerOrInfinity = toIntegerOrInfinity$9;
|
|
12371
12663
|
var arraySpeciesCreate = arraySpeciesCreate$2;
|
|
12372
12664
|
|
|
12373
12665
|
// `Array.prototype.flat` method
|
|
12374
12666
|
// https://tc39.es/ecma262/#sec-array.prototype.flat
|
|
12375
|
-
$$
|
|
12667
|
+
$$6({ target: 'Array', proto: true }, {
|
|
12376
12668
|
flat: function flat(/* depthArg = 1 */) {
|
|
12377
12669
|
var depthArg = arguments.length ? arguments[0] : undefined;
|
|
12378
|
-
var O = toObject$
|
|
12379
|
-
var sourceLen = lengthOfArrayLike$
|
|
12670
|
+
var O = toObject$1(this);
|
|
12671
|
+
var sourceLen = lengthOfArrayLike$1(O);
|
|
12380
12672
|
var A = arraySpeciesCreate(O, 0);
|
|
12381
12673
|
A.length = flattenIntoArray(A, O, O, sourceLen, 0, depthArg === undefined ? 1 : toIntegerOrInfinity(depthArg));
|
|
12382
12674
|
return A;
|
|
@@ -12904,170 +13196,6 @@ const GoAContractInfoControlReview = withJsonFormsAllOfProps(ContractInfoControl
|
|
|
12904
13196
|
const isContactInformation = createSchemaMatchTester(['email', 'phone', 'preferredContactMethod']);
|
|
12905
13197
|
const ContactInformationTester = rankWith(4, isContactInformation);
|
|
12906
13198
|
|
|
12907
|
-
var arraySlice$1 = arraySlice$4;
|
|
12908
|
-
|
|
12909
|
-
var floor$2 = Math.floor;
|
|
12910
|
-
|
|
12911
|
-
var sort = function (array, comparefn) {
|
|
12912
|
-
var length = array.length;
|
|
12913
|
-
|
|
12914
|
-
if (length < 8) {
|
|
12915
|
-
// insertion sort
|
|
12916
|
-
var i = 1;
|
|
12917
|
-
var element, j;
|
|
12918
|
-
|
|
12919
|
-
while (i < length) {
|
|
12920
|
-
j = i;
|
|
12921
|
-
element = array[i];
|
|
12922
|
-
while (j && comparefn(array[j - 1], element) > 0) {
|
|
12923
|
-
array[j] = array[--j];
|
|
12924
|
-
}
|
|
12925
|
-
if (j !== i++) array[j] = element;
|
|
12926
|
-
}
|
|
12927
|
-
} else {
|
|
12928
|
-
// merge sort
|
|
12929
|
-
var middle = floor$2(length / 2);
|
|
12930
|
-
var left = sort(arraySlice$1(array, 0, middle), comparefn);
|
|
12931
|
-
var right = sort(arraySlice$1(array, middle), comparefn);
|
|
12932
|
-
var llength = left.length;
|
|
12933
|
-
var rlength = right.length;
|
|
12934
|
-
var lindex = 0;
|
|
12935
|
-
var rindex = 0;
|
|
12936
|
-
|
|
12937
|
-
while (lindex < llength || rindex < rlength) {
|
|
12938
|
-
array[lindex + rindex] = (lindex < llength && rindex < rlength)
|
|
12939
|
-
? comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++]
|
|
12940
|
-
: lindex < llength ? left[lindex++] : right[rindex++];
|
|
12941
|
-
}
|
|
12942
|
-
}
|
|
12943
|
-
|
|
12944
|
-
return array;
|
|
12945
|
-
};
|
|
12946
|
-
|
|
12947
|
-
var arraySort$1 = sort;
|
|
12948
|
-
|
|
12949
|
-
var userAgent$1 = engineUserAgent;
|
|
12950
|
-
|
|
12951
|
-
var firefox = userAgent$1.match(/firefox\/(\d+)/i);
|
|
12952
|
-
|
|
12953
|
-
var engineFfVersion = !!firefox && +firefox[1];
|
|
12954
|
-
|
|
12955
|
-
var UA = engineUserAgent;
|
|
12956
|
-
|
|
12957
|
-
var engineIsIeOrEdge = /MSIE|Trident/.test(UA);
|
|
12958
|
-
|
|
12959
|
-
var userAgent = engineUserAgent;
|
|
12960
|
-
|
|
12961
|
-
var webkit = userAgent.match(/AppleWebKit\/(\d+)\./);
|
|
12962
|
-
|
|
12963
|
-
var engineWebkitVersion = !!webkit && +webkit[1];
|
|
12964
|
-
|
|
12965
|
-
var $$6 = _export;
|
|
12966
|
-
var uncurryThis$8 = functionUncurryThis;
|
|
12967
|
-
var aCallable = aCallable$k;
|
|
12968
|
-
var toObject$1 = toObject$c;
|
|
12969
|
-
var lengthOfArrayLike$1 = lengthOfArrayLike$c;
|
|
12970
|
-
var deletePropertyOrThrow = deletePropertyOrThrow$2;
|
|
12971
|
-
var toString$5 = toString$n;
|
|
12972
|
-
var fails$2 = fails$y;
|
|
12973
|
-
var internalSort = arraySort$1;
|
|
12974
|
-
var arrayMethodIsStrict = arrayMethodIsStrict$2;
|
|
12975
|
-
var FF = engineFfVersion;
|
|
12976
|
-
var IE_OR_EDGE = engineIsIeOrEdge;
|
|
12977
|
-
var V8 = engineV8Version;
|
|
12978
|
-
var WEBKIT = engineWebkitVersion;
|
|
12979
|
-
|
|
12980
|
-
var test = [];
|
|
12981
|
-
var nativeSort = uncurryThis$8(test.sort);
|
|
12982
|
-
var push$4 = uncurryThis$8(test.push);
|
|
12983
|
-
|
|
12984
|
-
// IE8-
|
|
12985
|
-
var FAILS_ON_UNDEFINED = fails$2(function () {
|
|
12986
|
-
test.sort(undefined);
|
|
12987
|
-
});
|
|
12988
|
-
// V8 bug
|
|
12989
|
-
var FAILS_ON_NULL = fails$2(function () {
|
|
12990
|
-
test.sort(null);
|
|
12991
|
-
});
|
|
12992
|
-
// Old WebKit
|
|
12993
|
-
var STRICT_METHOD = arrayMethodIsStrict('sort');
|
|
12994
|
-
|
|
12995
|
-
var STABLE_SORT = !fails$2(function () {
|
|
12996
|
-
// feature detection can be too slow, so check engines versions
|
|
12997
|
-
if (V8) return V8 < 70;
|
|
12998
|
-
if (FF && FF > 3) return;
|
|
12999
|
-
if (IE_OR_EDGE) return true;
|
|
13000
|
-
if (WEBKIT) return WEBKIT < 603;
|
|
13001
|
-
|
|
13002
|
-
var result = '';
|
|
13003
|
-
var code, chr, value, index;
|
|
13004
|
-
|
|
13005
|
-
// generate an array with more 512 elements (Chakra and old V8 fails only in this case)
|
|
13006
|
-
for (code = 65; code < 76; code++) {
|
|
13007
|
-
chr = String.fromCharCode(code);
|
|
13008
|
-
|
|
13009
|
-
switch (code) {
|
|
13010
|
-
case 66: case 69: case 70: case 72: value = 3; break;
|
|
13011
|
-
case 68: case 71: value = 4; break;
|
|
13012
|
-
default: value = 2;
|
|
13013
|
-
}
|
|
13014
|
-
|
|
13015
|
-
for (index = 0; index < 47; index++) {
|
|
13016
|
-
test.push({ k: chr + index, v: value });
|
|
13017
|
-
}
|
|
13018
|
-
}
|
|
13019
|
-
|
|
13020
|
-
test.sort(function (a, b) { return b.v - a.v; });
|
|
13021
|
-
|
|
13022
|
-
for (index = 0; index < test.length; index++) {
|
|
13023
|
-
chr = test[index].k.charAt(0);
|
|
13024
|
-
if (result.charAt(result.length - 1) !== chr) result += chr;
|
|
13025
|
-
}
|
|
13026
|
-
|
|
13027
|
-
return result !== 'DGBEFHACIJK';
|
|
13028
|
-
});
|
|
13029
|
-
|
|
13030
|
-
var FORCED$1 = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD || !STABLE_SORT;
|
|
13031
|
-
|
|
13032
|
-
var getSortCompare = function (comparefn) {
|
|
13033
|
-
return function (x, y) {
|
|
13034
|
-
if (y === undefined) return -1;
|
|
13035
|
-
if (x === undefined) return 1;
|
|
13036
|
-
if (comparefn !== undefined) return +comparefn(x, y) || 0;
|
|
13037
|
-
return toString$5(x) > toString$5(y) ? 1 : -1;
|
|
13038
|
-
};
|
|
13039
|
-
};
|
|
13040
|
-
|
|
13041
|
-
// `Array.prototype.sort` method
|
|
13042
|
-
// https://tc39.es/ecma262/#sec-array.prototype.sort
|
|
13043
|
-
$$6({ target: 'Array', proto: true, forced: FORCED$1 }, {
|
|
13044
|
-
sort: function sort(comparefn) {
|
|
13045
|
-
if (comparefn !== undefined) aCallable(comparefn);
|
|
13046
|
-
|
|
13047
|
-
var array = toObject$1(this);
|
|
13048
|
-
|
|
13049
|
-
if (STABLE_SORT) return comparefn === undefined ? nativeSort(array) : nativeSort(array, comparefn);
|
|
13050
|
-
|
|
13051
|
-
var items = [];
|
|
13052
|
-
var arrayLength = lengthOfArrayLike$1(array);
|
|
13053
|
-
var itemsLength, index;
|
|
13054
|
-
|
|
13055
|
-
for (index = 0; index < arrayLength; index++) {
|
|
13056
|
-
if (index in array) push$4(items, array[index]);
|
|
13057
|
-
}
|
|
13058
|
-
|
|
13059
|
-
internalSort(items, getSortCompare(comparefn));
|
|
13060
|
-
|
|
13061
|
-
itemsLength = lengthOfArrayLike$1(items);
|
|
13062
|
-
index = 0;
|
|
13063
|
-
|
|
13064
|
-
while (index < itemsLength) array[index] = items[index++];
|
|
13065
|
-
while (index < arrayLength) deletePropertyOrThrow(array, index++);
|
|
13066
|
-
|
|
13067
|
-
return array;
|
|
13068
|
-
}
|
|
13069
|
-
});
|
|
13070
|
-
|
|
13071
13199
|
var $$5 = _export;
|
|
13072
13200
|
var iterate = iterate$a;
|
|
13073
13201
|
var createProperty$1 = createProperty$4;
|