@abgov/jsonforms-components 2.45.1 → 2.46.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.js +365 -181
- package/package.json +1 -1
- package/src/lib/util/requiredUtil.d.ts +10 -0
package/index.esm.js
CHANGED
|
@@ -7,15 +7,15 @@ import axios from 'axios';
|
|
|
7
7
|
import get$1 from 'lodash/get';
|
|
8
8
|
import { isVisible, isEnabled, deriveLabelForUISchemaElement, rankWith, isStringControl, and, optionIs, isDateControl, isNumberControl, isIntegerControl, isDateTimeControl, isTimeControl, uiTypeIs, isControl as isControl$1, isEnumControl, isBooleanControl, schemaMatches, getAjv, createDefaultValue, or, isObjectArrayControl, isPrimitiveArrayControl, Paths, toDataPath, Resolve, schemaTypeIs, formatIs, hasType, isCategorization, isLayout } from '@jsonforms/core';
|
|
9
9
|
import * as _$c from 'lodash';
|
|
10
|
-
import ___default, { isEqual, isObject as isObject$
|
|
10
|
+
import ___default, { isEqual, isObject as isObject$h, isEmpty as isEmpty$1 } from 'lodash';
|
|
11
11
|
import { useJsonForms, withJsonFormsControlProps, withJsonFormsEnumProps, withTranslateProps, JsonFormsDispatch, withJsonFormsAllOfProps, withJsonFormsArrayLayoutProps, withJsonFormsLayoutProps, withJsonFormsCellProps } from '@jsonforms/react';
|
|
12
|
+
import Ajv from 'ajv';
|
|
12
13
|
import merge from 'lodash/merge';
|
|
13
14
|
import isEmpty from 'lodash/isEmpty';
|
|
14
15
|
import range from 'lodash/range';
|
|
15
16
|
import pluralize from 'pluralize';
|
|
16
17
|
import { evaluateSync, compileSync } from '@mdx-js/mdx';
|
|
17
18
|
import { Parser } from 'expr-eval-fork';
|
|
18
|
-
import Ajv from 'ajv';
|
|
19
19
|
import addErrors from 'ajv-errors';
|
|
20
20
|
import addFormats from 'ajv-formats';
|
|
21
21
|
|
|
@@ -276,18 +276,18 @@ var isCallable$s = typeof documentAll == 'undefined' && documentAll !== undefine
|
|
|
276
276
|
|
|
277
277
|
var isCallable$r = isCallable$s;
|
|
278
278
|
|
|
279
|
-
var isObject$
|
|
279
|
+
var isObject$g = function (it) {
|
|
280
280
|
return typeof it == 'object' ? it !== null : isCallable$r(it);
|
|
281
281
|
};
|
|
282
282
|
|
|
283
|
-
var isObject$
|
|
283
|
+
var isObject$f = isObject$g;
|
|
284
284
|
|
|
285
285
|
var $String$5 = String;
|
|
286
286
|
var $TypeError$k = TypeError;
|
|
287
287
|
|
|
288
288
|
// `Assert: Type(argument) is Object`
|
|
289
289
|
var anObject$s = function (argument) {
|
|
290
|
-
if (isObject$
|
|
290
|
+
if (isObject$f(argument)) return argument;
|
|
291
291
|
throw new $TypeError$k($String$5(argument) + ' is not an object');
|
|
292
292
|
};
|
|
293
293
|
|
|
@@ -317,11 +317,11 @@ var v8PrototypeDefineBug = DESCRIPTORS$j && fails$r(function () {
|
|
|
317
317
|
var objectDefineProperty = {};
|
|
318
318
|
|
|
319
319
|
var global$m = global$r;
|
|
320
|
-
var isObject$
|
|
320
|
+
var isObject$e = isObject$g;
|
|
321
321
|
|
|
322
322
|
var document$3 = global$m.document;
|
|
323
323
|
// typeof document.createElement is 'object' in old IE
|
|
324
|
-
var EXISTS$1 = isObject$
|
|
324
|
+
var EXISTS$1 = isObject$e(document$3) && isObject$e(document$3.createElement);
|
|
325
325
|
|
|
326
326
|
var documentCreateElement$2 = function (it) {
|
|
327
327
|
return EXISTS$1 ? document$3.createElement(it) : {};
|
|
@@ -409,7 +409,7 @@ var getMethod$7 = function (V, P) {
|
|
|
409
409
|
|
|
410
410
|
var call$s = functionCall;
|
|
411
411
|
var isCallable$n = isCallable$s;
|
|
412
|
-
var isObject$
|
|
412
|
+
var isObject$d = isObject$g;
|
|
413
413
|
|
|
414
414
|
var $TypeError$i = TypeError;
|
|
415
415
|
|
|
@@ -417,14 +417,14 @@ var $TypeError$i = TypeError;
|
|
|
417
417
|
// https://tc39.es/ecma262/#sec-ordinarytoprimitive
|
|
418
418
|
var ordinaryToPrimitive$1 = function (input, pref) {
|
|
419
419
|
var fn, val;
|
|
420
|
-
if (pref === 'string' && isCallable$n(fn = input.toString) && !isObject$
|
|
421
|
-
if (isCallable$n(fn = input.valueOf) && !isObject$
|
|
422
|
-
if (pref !== 'string' && isCallable$n(fn = input.toString) && !isObject$
|
|
420
|
+
if (pref === 'string' && isCallable$n(fn = input.toString) && !isObject$d(val = call$s(fn, input))) return val;
|
|
421
|
+
if (isCallable$n(fn = input.valueOf) && !isObject$d(val = call$s(fn, input))) return val;
|
|
422
|
+
if (pref !== 'string' && isCallable$n(fn = input.toString) && !isObject$d(val = call$s(fn, input))) return val;
|
|
423
423
|
throw new $TypeError$i("Can't convert object to primitive value");
|
|
424
424
|
};
|
|
425
425
|
|
|
426
426
|
var call$r = functionCall;
|
|
427
|
-
var isObject$
|
|
427
|
+
var isObject$c = isObject$g;
|
|
428
428
|
var isSymbol$2 = isSymbol$3;
|
|
429
429
|
var getMethod$6 = getMethod$7;
|
|
430
430
|
var ordinaryToPrimitive = ordinaryToPrimitive$1;
|
|
@@ -436,13 +436,13 @@ var TO_PRIMITIVE = wellKnownSymbol$l('toPrimitive');
|
|
|
436
436
|
// `ToPrimitive` abstract operation
|
|
437
437
|
// https://tc39.es/ecma262/#sec-toprimitive
|
|
438
438
|
var toPrimitive$1 = function (input, pref) {
|
|
439
|
-
if (!isObject$
|
|
439
|
+
if (!isObject$c(input) || isSymbol$2(input)) return input;
|
|
440
440
|
var exoticToPrim = getMethod$6(input, TO_PRIMITIVE);
|
|
441
441
|
var result;
|
|
442
442
|
if (exoticToPrim) {
|
|
443
443
|
if (pref === undefined) pref = 'default';
|
|
444
444
|
result = call$r(exoticToPrim, input, pref);
|
|
445
|
-
if (!isObject$
|
|
445
|
+
if (!isObject$c(result) || isSymbol$2(result)) return result;
|
|
446
446
|
throw new $TypeError$h("Can't convert object to primitive value");
|
|
447
447
|
}
|
|
448
448
|
if (pref === undefined) pref = 'number';
|
|
@@ -804,7 +804,7 @@ var createNonEnumerableProperty$a = DESCRIPTORS$f ? function (object, key, value
|
|
|
804
804
|
|
|
805
805
|
var NATIVE_WEAK_MAP = weakMapBasicDetection;
|
|
806
806
|
var global$j = global$r;
|
|
807
|
-
var isObject$
|
|
807
|
+
var isObject$b = isObject$g;
|
|
808
808
|
var createNonEnumerableProperty$9 = createNonEnumerableProperty$a;
|
|
809
809
|
var hasOwn$e = hasOwnProperty_1;
|
|
810
810
|
var shared$1 = sharedStoreExports;
|
|
@@ -823,7 +823,7 @@ var enforce = function (it) {
|
|
|
823
823
|
var getterFor = function (TYPE) {
|
|
824
824
|
return function (it) {
|
|
825
825
|
var state;
|
|
826
|
-
if (!isObject$
|
|
826
|
+
if (!isObject$b(it) || (state = get(it)).type !== TYPE) {
|
|
827
827
|
throw new TypeError$2('Incompatible receiver, ' + TYPE + ' required');
|
|
828
828
|
} return state;
|
|
829
829
|
};
|
|
@@ -1195,7 +1195,7 @@ var objectGetPrototypeOf = CORRECT_PROTOTYPE_GETTER ? $Object$1.getPrototypeOf :
|
|
|
1195
1195
|
|
|
1196
1196
|
var fails$m = fails$w;
|
|
1197
1197
|
var isCallable$g = isCallable$s;
|
|
1198
|
-
var isObject$
|
|
1198
|
+
var isObject$a = isObject$g;
|
|
1199
1199
|
var getPrototypeOf$2 = objectGetPrototypeOf;
|
|
1200
1200
|
var defineBuiltIn$7 = defineBuiltIn$9;
|
|
1201
1201
|
var wellKnownSymbol$j = wellKnownSymbol$m;
|
|
@@ -1218,7 +1218,7 @@ if ([].keys) {
|
|
|
1218
1218
|
}
|
|
1219
1219
|
}
|
|
1220
1220
|
|
|
1221
|
-
var NEW_ITERATOR_PROTOTYPE = !isObject$
|
|
1221
|
+
var NEW_ITERATOR_PROTOTYPE = !isObject$a(IteratorPrototype$4) || fails$m(function () {
|
|
1222
1222
|
var test = {};
|
|
1223
1223
|
// FF44- legacy iterators case
|
|
1224
1224
|
return IteratorPrototype$4[ITERATOR$7].call(test) !== test;
|
|
@@ -1278,10 +1278,10 @@ var functionUncurryThisAccessor = function (object, key, method) {
|
|
|
1278
1278
|
} catch (error) { /* empty */ }
|
|
1279
1279
|
};
|
|
1280
1280
|
|
|
1281
|
-
var isObject$
|
|
1281
|
+
var isObject$9 = isObject$g;
|
|
1282
1282
|
|
|
1283
1283
|
var isPossiblePrototype$1 = function (argument) {
|
|
1284
|
-
return isObject$
|
|
1284
|
+
return isObject$9(argument) || argument === null;
|
|
1285
1285
|
};
|
|
1286
1286
|
|
|
1287
1287
|
var isPossiblePrototype = isPossiblePrototype$1;
|
|
@@ -1296,7 +1296,7 @@ var aPossiblePrototype$1 = function (argument) {
|
|
|
1296
1296
|
|
|
1297
1297
|
/* eslint-disable no-proto -- safe */
|
|
1298
1298
|
var uncurryThisAccessor$1 = functionUncurryThisAccessor;
|
|
1299
|
-
var isObject$
|
|
1299
|
+
var isObject$8 = isObject$g;
|
|
1300
1300
|
var requireObjectCoercible$b = requireObjectCoercible$e;
|
|
1301
1301
|
var aPossiblePrototype = aPossiblePrototype$1;
|
|
1302
1302
|
|
|
@@ -1316,7 +1316,7 @@ var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? functio
|
|
|
1316
1316
|
return function setPrototypeOf(O, proto) {
|
|
1317
1317
|
requireObjectCoercible$b(O);
|
|
1318
1318
|
aPossiblePrototype(proto);
|
|
1319
|
-
if (!isObject$
|
|
1319
|
+
if (!isObject$8(O)) return O;
|
|
1320
1320
|
if (CORRECT_SETTER) setter(O, proto);
|
|
1321
1321
|
else O.__proto__ = proto;
|
|
1322
1322
|
return O;
|
|
@@ -1696,7 +1696,7 @@ var toString$j = function (argument) {
|
|
|
1696
1696
|
return $String$1(argument);
|
|
1697
1697
|
};
|
|
1698
1698
|
|
|
1699
|
-
var isObject$
|
|
1699
|
+
var isObject$7 = isObject$g;
|
|
1700
1700
|
var classof$7 = classofRaw$2;
|
|
1701
1701
|
var wellKnownSymbol$d = wellKnownSymbol$m;
|
|
1702
1702
|
|
|
@@ -1706,7 +1706,7 @@ var MATCH$2 = wellKnownSymbol$d('match');
|
|
|
1706
1706
|
// https://tc39.es/ecma262/#sec-isregexp
|
|
1707
1707
|
var isRegexp = function (it) {
|
|
1708
1708
|
var isRegExp;
|
|
1709
|
-
return isObject$
|
|
1709
|
+
return isObject$7(it) && ((isRegExp = it[MATCH$2]) !== undefined ? !!isRegExp : classof$7(it) === 'RegExp');
|
|
1710
1710
|
};
|
|
1711
1711
|
|
|
1712
1712
|
var isRegExp$1 = isRegexp;
|
|
@@ -1788,7 +1788,7 @@ var proxyAccessor$2 = function (Target, Source, key) {
|
|
|
1788
1788
|
};
|
|
1789
1789
|
|
|
1790
1790
|
var isCallable$d = isCallable$s;
|
|
1791
|
-
var isObject$
|
|
1791
|
+
var isObject$6 = isObject$g;
|
|
1792
1792
|
var setPrototypeOf$2 = objectSetPrototypeOf;
|
|
1793
1793
|
|
|
1794
1794
|
// makes subclassing work correct for wrapped built-ins
|
|
@@ -1800,7 +1800,7 @@ var inheritIfRequired$2 = function ($this, dummy, Wrapper) {
|
|
|
1800
1800
|
// we haven't completely correct pre-ES6 way for getting `new.target`, so use this
|
|
1801
1801
|
isCallable$d(NewTarget = dummy.constructor) &&
|
|
1802
1802
|
NewTarget !== Wrapper &&
|
|
1803
|
-
isObject$
|
|
1803
|
+
isObject$6(NewTargetPrototype = NewTarget.prototype) &&
|
|
1804
1804
|
NewTargetPrototype !== Wrapper.prototype
|
|
1805
1805
|
) setPrototypeOf$2($this, NewTargetPrototype);
|
|
1806
1806
|
return $this;
|
|
@@ -1812,13 +1812,13 @@ var normalizeStringArgument$1 = function (argument, $default) {
|
|
|
1812
1812
|
return argument === undefined ? arguments.length < 2 ? '' : $default : toString$h(argument);
|
|
1813
1813
|
};
|
|
1814
1814
|
|
|
1815
|
-
var isObject$
|
|
1815
|
+
var isObject$5 = isObject$g;
|
|
1816
1816
|
var createNonEnumerableProperty$5 = createNonEnumerableProperty$a;
|
|
1817
1817
|
|
|
1818
1818
|
// `InstallErrorCause` abstract operation
|
|
1819
1819
|
// https://tc39.es/proposal-error-cause/#sec-errorobjects-install-error-cause
|
|
1820
1820
|
var installErrorCause$1 = function (O, options) {
|
|
1821
|
-
if (isObject$
|
|
1821
|
+
if (isObject$5(options) && 'cause' in options) {
|
|
1822
1822
|
createNonEnumerableProperty$5(O, 'cause', options.cause);
|
|
1823
1823
|
}
|
|
1824
1824
|
};
|
|
@@ -4278,7 +4278,7 @@ var setToStringTag = setToStringTag$4;
|
|
|
4278
4278
|
var setSpecies$1 = setSpecies$2;
|
|
4279
4279
|
var aCallable$9 = aCallable$j;
|
|
4280
4280
|
var isCallable$3 = isCallable$s;
|
|
4281
|
-
var isObject$
|
|
4281
|
+
var isObject$4 = isObject$g;
|
|
4282
4282
|
var anInstance = anInstance$2;
|
|
4283
4283
|
var speciesConstructor$1 = speciesConstructor$2;
|
|
4284
4284
|
var task = task$1.set;
|
|
@@ -4320,7 +4320,7 @@ var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
|
|
|
4320
4320
|
// helpers
|
|
4321
4321
|
var isThenable = function (it) {
|
|
4322
4322
|
var then;
|
|
4323
|
-
return isObject$
|
|
4323
|
+
return isObject$4(it) && isCallable$3(then = it.then) ? then : false;
|
|
4324
4324
|
};
|
|
4325
4325
|
|
|
4326
4326
|
var callReaction = function (reaction, state) {
|
|
@@ -4710,12 +4710,12 @@ $$n({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR$1 }, {
|
|
|
4710
4710
|
});
|
|
4711
4711
|
|
|
4712
4712
|
var anObject$8 = anObject$s;
|
|
4713
|
-
var isObject$
|
|
4713
|
+
var isObject$3 = isObject$g;
|
|
4714
4714
|
var newPromiseCapability = newPromiseCapability$2;
|
|
4715
4715
|
|
|
4716
4716
|
var promiseResolve$1 = function (C, x) {
|
|
4717
4717
|
anObject$8(C);
|
|
4718
|
-
if (isObject$
|
|
4718
|
+
if (isObject$3(x) && x.constructor === C) return x;
|
|
4719
4719
|
var promiseCapability = newPromiseCapability.f(C);
|
|
4720
4720
|
var resolve = promiseCapability.resolve;
|
|
4721
4721
|
resolve(x);
|
|
@@ -5212,14 +5212,14 @@ const RequiredTextLabel = styled.label(_t3$5 || (_t3$5 = _$a`
|
|
|
5212
5212
|
line-height: var(--goa-line-height-1);
|
|
5213
5213
|
font-style: normal;
|
|
5214
5214
|
`));
|
|
5215
|
-
|
|
5215
|
+
styled.td(_t4$5 || (_t4$5 = _$a`
|
|
5216
5216
|
width: 40%;
|
|
5217
5217
|
padding-top: var(--goa-space-s);
|
|
5218
5218
|
padding-bottom: var(--goa-space-s);
|
|
5219
5219
|
padding-right: var(--goa-space-m);
|
|
5220
5220
|
vertical-align: top;
|
|
5221
5221
|
`));
|
|
5222
|
-
|
|
5222
|
+
styled.td(_t5$4 || (_t5$4 = _$a`
|
|
5223
5223
|
width: 40%;
|
|
5224
5224
|
text-align: left;
|
|
5225
5225
|
vertical-align: top;
|
|
@@ -5463,7 +5463,7 @@ var getBuiltIn$1 = getBuiltIn$b;
|
|
|
5463
5463
|
var uncurryThis$8 = functionUncurryThis;
|
|
5464
5464
|
var call$6 = functionCall;
|
|
5465
5465
|
var isCallable$1 = isCallable$s;
|
|
5466
|
-
var isObject$
|
|
5466
|
+
var isObject$2 = isObject$g;
|
|
5467
5467
|
var isArray$2 = isArray$5;
|
|
5468
5468
|
var hasOwn$1 = hasOwnProperty_1;
|
|
5469
5469
|
var toString$8 = toString$j;
|
|
@@ -5510,7 +5510,7 @@ var internalize = function (holder, name, reviver, node) {
|
|
|
5510
5510
|
var unmodified = node && val === node.value;
|
|
5511
5511
|
var context = unmodified && typeof node.source == 'string' ? { source: node.source } : {};
|
|
5512
5512
|
var elementRecordsLen, keys, len, i, P;
|
|
5513
|
-
if (isObject$
|
|
5513
|
+
if (isObject$2(val)) {
|
|
5514
5514
|
var nodeIsArray = isArray$2(val);
|
|
5515
5515
|
var nodes = unmodified ? node.nodes : nodeIsArray ? [] : {};
|
|
5516
5516
|
if (nodeIsArray) {
|
|
@@ -6591,6 +6591,143 @@ const JsonFormsStepperContextProvider = ({
|
|
|
6591
6591
|
});
|
|
6592
6592
|
};
|
|
6593
6593
|
|
|
6594
|
+
var $$9 = _export;
|
|
6595
|
+
var iterate$1 = iterate$a;
|
|
6596
|
+
var aCallable$2 = aCallable$j;
|
|
6597
|
+
var anObject$4 = anObject$s;
|
|
6598
|
+
var getIteratorDirect$2 = getIteratorDirect$a;
|
|
6599
|
+
|
|
6600
|
+
// `Iterator.prototype.every` method
|
|
6601
|
+
// https://github.com/tc39/proposal-iterator-helpers
|
|
6602
|
+
$$9({ target: 'Iterator', proto: true, real: true }, {
|
|
6603
|
+
every: function every(predicate) {
|
|
6604
|
+
anObject$4(this);
|
|
6605
|
+
aCallable$2(predicate);
|
|
6606
|
+
var record = getIteratorDirect$2(this);
|
|
6607
|
+
var counter = 0;
|
|
6608
|
+
return !iterate$1(record, function (value, stop) {
|
|
6609
|
+
if (!predicate(value, counter++)) return stop();
|
|
6610
|
+
}, { IS_RECORD: true, INTERRUPTED: true }).stopped;
|
|
6611
|
+
}
|
|
6612
|
+
});
|
|
6613
|
+
|
|
6614
|
+
const isObject$1 = v => v !== null && typeof v === 'object' && !Array.isArray(v);
|
|
6615
|
+
const splitPath = path => path.replace(/^#\/properties\//, '').replace(/\//g, '.').split('.').filter(Boolean);
|
|
6616
|
+
const getDataAt = (rootData, pathSegs) => {
|
|
6617
|
+
let cur = rootData;
|
|
6618
|
+
for (const seg of pathSegs) {
|
|
6619
|
+
if (cur == null) return undefined;
|
|
6620
|
+
if (Array.isArray(cur) && /^\d+$/.test(seg)) {
|
|
6621
|
+
cur = cur[Number(seg)];
|
|
6622
|
+
} else {
|
|
6623
|
+
cur = cur[seg];
|
|
6624
|
+
}
|
|
6625
|
+
}
|
|
6626
|
+
return cur;
|
|
6627
|
+
};
|
|
6628
|
+
const compileAndTest = (ajv, schema, data) => {
|
|
6629
|
+
var _validate$errors;
|
|
6630
|
+
const validate = ajv.compile(schema);
|
|
6631
|
+
const ok = validate(data);
|
|
6632
|
+
return {
|
|
6633
|
+
valid: ok,
|
|
6634
|
+
errors: (_validate$errors = validate.errors) != null ? _validate$errors : undefined
|
|
6635
|
+
};
|
|
6636
|
+
};
|
|
6637
|
+
const pickBranch = (ajv, branches, data, strategy) => {
|
|
6638
|
+
const results = branches.map(s => compileAndTest(ajv, s, data));
|
|
6639
|
+
const validIdx = results.map((r, i) => r.valid ? i : -1).filter(i => i >= 0);
|
|
6640
|
+
if (validIdx.length > 0) {
|
|
6641
|
+
if (strategy === 'union') return validIdx.map(i => branches[i]);
|
|
6642
|
+
if (strategy === 'intersection') return validIdx.map(i => branches[i]);
|
|
6643
|
+
// bestMatch
|
|
6644
|
+
return [branches[validIdx[0]]];
|
|
6645
|
+
}
|
|
6646
|
+
if (strategy === 'bestMatch') {
|
|
6647
|
+
let best = 0;
|
|
6648
|
+
let bestCount = Number.POSITIVE_INFINITY;
|
|
6649
|
+
results.forEach((r, i) => {
|
|
6650
|
+
var _r$errors$length, _r$errors;
|
|
6651
|
+
const c = (_r$errors$length = (_r$errors = r.errors) == null ? void 0 : _r$errors.length) != null ? _r$errors$length : 9999;
|
|
6652
|
+
if (c < bestCount) {
|
|
6653
|
+
bestCount = c;
|
|
6654
|
+
best = i;
|
|
6655
|
+
}
|
|
6656
|
+
});
|
|
6657
|
+
return [branches[best]];
|
|
6658
|
+
}
|
|
6659
|
+
return branches;
|
|
6660
|
+
};
|
|
6661
|
+
const mergeSets = (a, b) => {
|
|
6662
|
+
b.forEach(x => a.add(x));
|
|
6663
|
+
};
|
|
6664
|
+
const intersectSets = sets => {
|
|
6665
|
+
if (sets.length === 0) return new Set();
|
|
6666
|
+
const [first, ...rest] = sets;
|
|
6667
|
+
const out = new Set();
|
|
6668
|
+
first.forEach(x => {
|
|
6669
|
+
if (rest.every(s => s.has(x))) out.add(x);
|
|
6670
|
+
});
|
|
6671
|
+
return out;
|
|
6672
|
+
};
|
|
6673
|
+
const collectRequired = (ajv, schema, rootSchema, rootData, basePath, strategy) => {
|
|
6674
|
+
const requiredPaths = new Set();
|
|
6675
|
+
if (!schema || typeof schema !== 'object') return requiredPaths;
|
|
6676
|
+
const dataHere = basePath ? getDataAt(rootData, splitPath(basePath)) : rootData;
|
|
6677
|
+
if (schema.if && (schema.then || schema.else)) {
|
|
6678
|
+
const ifResult = compileAndTest(ajv, schema.if, dataHere);
|
|
6679
|
+
const branch = ifResult.valid ? schema.then : schema.else;
|
|
6680
|
+
if (branch) {
|
|
6681
|
+
mergeSets(requiredPaths, collectRequired(ajv, branch, rootSchema, rootData, basePath, strategy));
|
|
6682
|
+
}
|
|
6683
|
+
}
|
|
6684
|
+
if (Array.isArray(schema.allOf)) {
|
|
6685
|
+
schema.allOf.forEach(sub => {
|
|
6686
|
+
mergeSets(requiredPaths, collectRequired(ajv, sub, rootSchema, rootData, basePath, strategy));
|
|
6687
|
+
});
|
|
6688
|
+
}
|
|
6689
|
+
const altKey = Array.isArray(schema.oneOf) ? 'oneOf' : Array.isArray(schema.anyOf) ? 'anyOf' : null;
|
|
6690
|
+
if (altKey) {
|
|
6691
|
+
const branches = schema[altKey];
|
|
6692
|
+
const chosen = pickBranch(ajv, branches, dataHere, strategy);
|
|
6693
|
+
if (strategy === 'intersection') {
|
|
6694
|
+
const sets = chosen.map(sub => collectRequired(ajv, sub, rootSchema, rootData, basePath, strategy));
|
|
6695
|
+
return intersectSets([requiredPaths, ...sets]);
|
|
6696
|
+
}
|
|
6697
|
+
chosen.forEach(sub => {
|
|
6698
|
+
mergeSets(requiredPaths, collectRequired(ajv, sub, rootSchema, rootData, basePath, strategy));
|
|
6699
|
+
});
|
|
6700
|
+
}
|
|
6701
|
+
if (Array.isArray(schema.required) && isObject$1(schema.properties)) {
|
|
6702
|
+
for (const key of schema.required) {
|
|
6703
|
+
requiredPaths.add(basePath ? `${basePath}.${key}` : key);
|
|
6704
|
+
}
|
|
6705
|
+
}
|
|
6706
|
+
if (isObject$1(schema.properties)) {
|
|
6707
|
+
for (const [key, subSchema] of Object.entries(schema.properties)) {
|
|
6708
|
+
const nextPath = basePath ? `${basePath}.${key}` : key;
|
|
6709
|
+
mergeSets(requiredPaths, collectRequired(ajv, subSchema, rootSchema, rootData, nextPath, strategy));
|
|
6710
|
+
}
|
|
6711
|
+
}
|
|
6712
|
+
if (schema.type === 'array' && schema.items) {
|
|
6713
|
+
const nextPath = basePath ? `${basePath}.0` : '0';
|
|
6714
|
+
mergeSets(requiredPaths, collectRequired(ajv, schema.items, rootSchema, rootData, nextPath, strategy));
|
|
6715
|
+
}
|
|
6716
|
+
return requiredPaths;
|
|
6717
|
+
};
|
|
6718
|
+
const isRequiredBySchema = (rootSchema, rootData, path, options = {}) => {
|
|
6719
|
+
var _options$ajv, _options$strategy;
|
|
6720
|
+
if (!path) return false;
|
|
6721
|
+
const ajv = (_options$ajv = options.ajv) != null ? _options$ajv : new Ajv({
|
|
6722
|
+
allErrors: true,
|
|
6723
|
+
strict: false
|
|
6724
|
+
});
|
|
6725
|
+
const strategy = (_options$strategy = options.strategy) != null ? _options$strategy : 'bestMatch';
|
|
6726
|
+
const reqSet = collectRequired(ajv, rootSchema, rootSchema, rootData, '', strategy);
|
|
6727
|
+
const dotPath = splitPath(path).join('.');
|
|
6728
|
+
return reqSet.has(dotPath);
|
|
6729
|
+
};
|
|
6730
|
+
|
|
6594
6731
|
const GoAInputBaseControl = props => {
|
|
6595
6732
|
var _stepperState$categor, _uischema$options$com, _uischema$options, _uischema$options2, _uischema$options3;
|
|
6596
6733
|
const {
|
|
@@ -6613,6 +6750,10 @@ const GoAInputBaseControl = props => {
|
|
|
6613
6750
|
const currentCategory = stepperState == null || (_stepperState$categor = stepperState.categories) == null ? void 0 : _stepperState$categor[stepperState == null ? void 0 : stepperState.activeId];
|
|
6614
6751
|
const showReviewLink = currentCategory == null ? void 0 : currentCategory.showReviewPageLink;
|
|
6615
6752
|
const [isVisited, setIsVisited] = useState(skipInitialValidation === true);
|
|
6753
|
+
const {
|
|
6754
|
+
core
|
|
6755
|
+
} = useJsonForms();
|
|
6756
|
+
const rootData = core == null ? void 0 : core.data;
|
|
6616
6757
|
useEffect(() => {
|
|
6617
6758
|
if (showReviewLink === true && !isStepperReview) {
|
|
6618
6759
|
setIsVisited(true);
|
|
@@ -6651,6 +6792,9 @@ const GoAInputBaseControl = props => {
|
|
|
6651
6792
|
if (modifiedErrors === 'must be equal to one of the allowed values') {
|
|
6652
6793
|
modifiedErrors = '';
|
|
6653
6794
|
}
|
|
6795
|
+
const requiredNow = required || isRequiredBySchema(props.rootSchema, rootData, props.path, {
|
|
6796
|
+
strategy: 'bestMatch'
|
|
6797
|
+
});
|
|
6654
6798
|
return jsx(JsonFormRegisterProvider, {
|
|
6655
6799
|
defaultRegisters: undefined,
|
|
6656
6800
|
children: jsx(Visible, {
|
|
@@ -6658,7 +6802,7 @@ const GoAInputBaseControl = props => {
|
|
|
6658
6802
|
children: jsx(FormFieldWrapper, {
|
|
6659
6803
|
ref: controlRef,
|
|
6660
6804
|
children: jsx(GoabFormItem, {
|
|
6661
|
-
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 :
|
|
6805
|
+
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,
|
|
6662
6806
|
error: isVisited === true ? modifiedErrors : undefined,
|
|
6663
6807
|
testId: isStepperReview === true ? `review-base-${path}` : path,
|
|
6664
6808
|
label: (props == null ? void 0 : props.noLabel) === true ? '' : labelToUpdate,
|
|
@@ -6676,7 +6820,7 @@ const GoAInputBaseControl = props => {
|
|
|
6676
6820
|
});
|
|
6677
6821
|
};
|
|
6678
6822
|
|
|
6679
|
-
var $$
|
|
6823
|
+
var $$8 = _export;
|
|
6680
6824
|
var DESCRIPTORS = descriptors;
|
|
6681
6825
|
var global$2 = global$r;
|
|
6682
6826
|
var uncurryThis$5 = functionUncurryThis;
|
|
@@ -6728,14 +6872,14 @@ if (DESCRIPTORS && isCallable(NativeSymbol) && (!('description' in SymbolPrototy
|
|
|
6728
6872
|
}
|
|
6729
6873
|
});
|
|
6730
6874
|
|
|
6731
|
-
$$
|
|
6875
|
+
$$8({ global: true, constructor: true, forced: true }, {
|
|
6732
6876
|
Symbol: SymbolWrapper
|
|
6733
6877
|
});
|
|
6734
6878
|
}
|
|
6735
6879
|
|
|
6736
6880
|
var call$3 = functionCall;
|
|
6737
6881
|
var fixRegExpWellKnownSymbolLogic$1 = fixRegexpWellKnownSymbolLogic;
|
|
6738
|
-
var anObject$
|
|
6882
|
+
var anObject$3 = anObject$s;
|
|
6739
6883
|
var isNullOrUndefined$1 = isNullOrUndefined$7;
|
|
6740
6884
|
var toLength$3 = toLength$7;
|
|
6741
6885
|
var toString$6 = toString$j;
|
|
@@ -6757,7 +6901,7 @@ fixRegExpWellKnownSymbolLogic$1('match', function (MATCH, nativeMatch, maybeCall
|
|
|
6757
6901
|
// `RegExp.prototype[@@match]` method
|
|
6758
6902
|
// https://tc39.es/ecma262/#sec-regexp.prototype-@@match
|
|
6759
6903
|
function (string) {
|
|
6760
|
-
var rx = anObject$
|
|
6904
|
+
var rx = anObject$3(this);
|
|
6761
6905
|
var S = toString$6(string);
|
|
6762
6906
|
var res = maybeCallNative(nativeMatch, rx, S);
|
|
6763
6907
|
|
|
@@ -6826,13 +6970,13 @@ var stringTrimForced = function (METHOD_NAME) {
|
|
|
6826
6970
|
});
|
|
6827
6971
|
};
|
|
6828
6972
|
|
|
6829
|
-
var $$
|
|
6973
|
+
var $$7 = _export;
|
|
6830
6974
|
var $trim = stringTrim.trim;
|
|
6831
6975
|
var forcedStringTrimMethod = stringTrimForced;
|
|
6832
6976
|
|
|
6833
6977
|
// `String.prototype.trim` method
|
|
6834
6978
|
// https://tc39.es/ecma262/#sec-string.prototype.trim
|
|
6835
|
-
$$
|
|
6979
|
+
$$7({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
|
|
6836
6980
|
trim: function trim() {
|
|
6837
6981
|
return $trim(this);
|
|
6838
6982
|
}
|
|
@@ -7436,13 +7580,13 @@ var userAgent = engineUserAgent;
|
|
|
7436
7580
|
|
|
7437
7581
|
var stringPadWebkitBug = /Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(userAgent);
|
|
7438
7582
|
|
|
7439
|
-
var $$
|
|
7583
|
+
var $$6 = _export;
|
|
7440
7584
|
var $padStart = stringPad.start;
|
|
7441
7585
|
var WEBKIT_BUG = stringPadWebkitBug;
|
|
7442
7586
|
|
|
7443
7587
|
// `String.prototype.padStart` method
|
|
7444
7588
|
// https://tc39.es/ecma262/#sec-string.prototype.padstart
|
|
7445
|
-
$$
|
|
7589
|
+
$$6({ target: 'String', proto: true, forced: WEBKIT_BUG }, {
|
|
7446
7590
|
padStart: function padStart(maxLength /* , fillString = ' ' */) {
|
|
7447
7591
|
return $padStart(this, maxLength, arguments.length > 1 ? arguments[1] : undefined);
|
|
7448
7592
|
}
|
|
@@ -8437,7 +8581,7 @@ const GoAInputBaseTableReviewControl = withJsonFormsControlProps(GoAInputBaseTab
|
|
|
8437
8581
|
var call$2 = functionCall;
|
|
8438
8582
|
var uncurryThis$2 = functionUncurryThis;
|
|
8439
8583
|
var fixRegExpWellKnownSymbolLogic = fixRegexpWellKnownSymbolLogic;
|
|
8440
|
-
var anObject$
|
|
8584
|
+
var anObject$2 = anObject$s;
|
|
8441
8585
|
var isNullOrUndefined = isNullOrUndefined$7;
|
|
8442
8586
|
var requireObjectCoercible$1 = requireObjectCoercible$e;
|
|
8443
8587
|
var speciesConstructor = speciesConstructor$2;
|
|
@@ -8497,7 +8641,7 @@ fixRegExpWellKnownSymbolLogic('split', function (SPLIT, nativeSplit, maybeCallNa
|
|
|
8497
8641
|
// NOTE: This cannot be properly polyfilled in engines that don't support
|
|
8498
8642
|
// the 'y' flag.
|
|
8499
8643
|
function (string, limit) {
|
|
8500
|
-
var rx = anObject$
|
|
8644
|
+
var rx = anObject$2(this);
|
|
8501
8645
|
var S = toString$2(string);
|
|
8502
8646
|
|
|
8503
8647
|
if (!BUGGY) {
|
|
@@ -9138,7 +9282,7 @@ var flattenIntoArray_1 = flattenIntoArray$2;
|
|
|
9138
9282
|
|
|
9139
9283
|
var isArray = isArray$5;
|
|
9140
9284
|
var isConstructor = isConstructor$2;
|
|
9141
|
-
var isObject = isObject$
|
|
9285
|
+
var isObject = isObject$g;
|
|
9142
9286
|
var wellKnownSymbol = wellKnownSymbol$m;
|
|
9143
9287
|
|
|
9144
9288
|
var SPECIES = wellKnownSymbol('species');
|
|
@@ -9167,7 +9311,7 @@ var arraySpeciesCreate$2 = function (originalArray, length) {
|
|
|
9167
9311
|
return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
|
|
9168
9312
|
};
|
|
9169
9313
|
|
|
9170
|
-
var $$
|
|
9314
|
+
var $$5 = _export;
|
|
9171
9315
|
var flattenIntoArray$1 = flattenIntoArray_1;
|
|
9172
9316
|
var toObject$1 = toObject$9;
|
|
9173
9317
|
var lengthOfArrayLike$1 = lengthOfArrayLike$9;
|
|
@@ -9176,7 +9320,7 @@ var arraySpeciesCreate$1 = arraySpeciesCreate$2;
|
|
|
9176
9320
|
|
|
9177
9321
|
// `Array.prototype.flat` method
|
|
9178
9322
|
// https://tc39.es/ecma262/#sec-array.prototype.flat
|
|
9179
|
-
$$
|
|
9323
|
+
$$5({ target: 'Array', proto: true }, {
|
|
9180
9324
|
flat: function flat(/* depthArg = 1 */) {
|
|
9181
9325
|
var depthArg = arguments.length ? arguments[0] : undefined;
|
|
9182
9326
|
var O = toObject$1(this);
|
|
@@ -9194,28 +9338,8 @@ var addToUnscopables$1 = addToUnscopables$5;
|
|
|
9194
9338
|
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
9195
9339
|
addToUnscopables$1('flat');
|
|
9196
9340
|
|
|
9197
|
-
var $$5 = _export;
|
|
9198
|
-
var iterate$1 = iterate$a;
|
|
9199
|
-
var aCallable$2 = aCallable$j;
|
|
9200
|
-
var anObject$2 = anObject$s;
|
|
9201
|
-
var getIteratorDirect$2 = getIteratorDirect$a;
|
|
9202
|
-
|
|
9203
|
-
// `Iterator.prototype.every` method
|
|
9204
|
-
// https://github.com/tc39/proposal-iterator-helpers
|
|
9205
|
-
$$5({ target: 'Iterator', proto: true, real: true }, {
|
|
9206
|
-
every: function every(predicate) {
|
|
9207
|
-
anObject$2(this);
|
|
9208
|
-
aCallable$2(predicate);
|
|
9209
|
-
var record = getIteratorDirect$2(this);
|
|
9210
|
-
var counter = 0;
|
|
9211
|
-
return !iterate$1(record, function (value, stop) {
|
|
9212
|
-
if (!predicate(value, counter++)) return stop();
|
|
9213
|
-
}, { IS_RECORD: true, INTERRUPTED: true }).stopped;
|
|
9214
|
-
}
|
|
9215
|
-
});
|
|
9216
|
-
|
|
9217
9341
|
const isPropertiesMatch = (obj, props, isExactMatch) => {
|
|
9218
|
-
if (isObject$
|
|
9342
|
+
if (isObject$h(obj)) {
|
|
9219
9343
|
const keys = Object.keys(obj);
|
|
9220
9344
|
if (isExactMatch) {
|
|
9221
9345
|
return props.every(attr => keys.includes(attr)) && keys.length === props.length;
|
|
@@ -9235,27 +9359,24 @@ const isFullName = createSchemaMatchTester(['firstName', 'middleName', 'lastName
|
|
|
9235
9359
|
const FullNameTester = rankWith(4, isFullName);
|
|
9236
9360
|
|
|
9237
9361
|
const FullNameControlReview = props => {
|
|
9238
|
-
var _props$uischema
|
|
9362
|
+
var _props$uischema;
|
|
9239
9363
|
const context = useContext(JsonFormsStepperContext);
|
|
9240
9364
|
const stepId = (_props$uischema = props.uischema) == null || (_props$uischema = _props$uischema.options) == null ? void 0 : _props$uischema.stepId;
|
|
9241
9365
|
const {
|
|
9242
9366
|
label,
|
|
9243
9367
|
errors,
|
|
9244
9368
|
required,
|
|
9245
|
-
uischema
|
|
9369
|
+
uischema,
|
|
9370
|
+
data,
|
|
9371
|
+
id
|
|
9246
9372
|
} = props;
|
|
9247
|
-
const renderRow = (
|
|
9373
|
+
const renderRow = (fieldLabel, value, testId) => jsx("tr", {
|
|
9248
9374
|
children: jsxs(PageReviewContainer, {
|
|
9249
9375
|
colSpan: 3,
|
|
9250
|
-
children: [
|
|
9251
|
-
children:
|
|
9252
|
-
children:
|
|
9253
|
-
})
|
|
9254
|
-
type: "tertiary",
|
|
9255
|
-
size: "compact",
|
|
9256
|
-
onClick: () => context == null ? void 0 : context.goToPage(stepId, uischema.scope),
|
|
9257
|
-
children: "Change"
|
|
9258
|
-
})]
|
|
9376
|
+
children: [jsx(ReviewHeader, {
|
|
9377
|
+
children: jsx(ReviewLabel, {
|
|
9378
|
+
children: fieldLabel
|
|
9379
|
+
})
|
|
9259
9380
|
}), jsx(ReviewValue, {
|
|
9260
9381
|
children: jsx("div", {
|
|
9261
9382
|
"data-testid": testId,
|
|
@@ -9263,15 +9384,23 @@ const FullNameControlReview = props => {
|
|
|
9263
9384
|
})
|
|
9264
9385
|
})]
|
|
9265
9386
|
})
|
|
9266
|
-
});
|
|
9387
|
+
}, testId);
|
|
9267
9388
|
return jsxs(Fragment, {
|
|
9268
9389
|
children: [jsx("tr", {
|
|
9269
9390
|
"data-testid": "full-name-header",
|
|
9270
9391
|
children: jsxs(PageReviewContainer, {
|
|
9271
9392
|
colSpan: 3,
|
|
9272
|
-
children: [jsxs(
|
|
9273
|
-
children: [
|
|
9274
|
-
children:
|
|
9393
|
+
children: [jsxs(ReviewHeader, {
|
|
9394
|
+
children: [jsxs(ReviewLabel, {
|
|
9395
|
+
children: [label, required && jsx(RequiredTextLabel, {
|
|
9396
|
+
children: " (required)"
|
|
9397
|
+
})]
|
|
9398
|
+
}), stepId !== undefined && jsx(GoabButton, {
|
|
9399
|
+
type: "tertiary",
|
|
9400
|
+
size: "compact",
|
|
9401
|
+
onClick: () => context == null ? void 0 : context.goToPage(stepId, uischema.scope),
|
|
9402
|
+
testId: "full-name-change-btn",
|
|
9403
|
+
children: "Change"
|
|
9275
9404
|
})]
|
|
9276
9405
|
}), errors && jsxs(WarningIconDiv, {
|
|
9277
9406
|
children: [jsx(GoabIcon, {
|
|
@@ -9280,7 +9409,7 @@ const FullNameControlReview = props => {
|
|
|
9280
9409
|
}), errors != null && errors.includes('is a required property') ? `${label} is required` : errors]
|
|
9281
9410
|
})]
|
|
9282
9411
|
})
|
|
9283
|
-
}), renderRow('First name',
|
|
9412
|
+
}), renderRow('First name', data == null ? void 0 : data.firstName, `firstName-control-${id}`), (data == null ? void 0 : data.middleName) && renderRow('Middle name', data == null ? void 0 : data.middleName, `middleName-control-${id}`), renderRow('Last name', data == null ? void 0 : data.lastName, `lastName-control-${id}`)]
|
|
9284
9413
|
});
|
|
9285
9414
|
};
|
|
9286
9415
|
const GoAInputBaseFullNameControlReview = withJsonFormsAllOfProps(FullNameControlReview);
|
|
@@ -9293,32 +9422,53 @@ const FullNameDobReviewControl = props => {
|
|
|
9293
9422
|
const {
|
|
9294
9423
|
data,
|
|
9295
9424
|
id,
|
|
9296
|
-
uischema
|
|
9425
|
+
uischema,
|
|
9426
|
+
label,
|
|
9427
|
+
required,
|
|
9428
|
+
errors
|
|
9297
9429
|
} = props;
|
|
9298
9430
|
const context = useContext(JsonFormsStepperContext);
|
|
9299
9431
|
const stepId = uischema == null || (_uischema$options = uischema.options) == null ? void 0 : _uischema$options.stepId;
|
|
9300
|
-
const renderRow = (
|
|
9301
|
-
children:
|
|
9302
|
-
|
|
9303
|
-
|
|
9304
|
-
|
|
9305
|
-
|
|
9306
|
-
|
|
9307
|
-
|
|
9308
|
-
children:
|
|
9309
|
-
|
|
9310
|
-
|
|
9311
|
-
|
|
9312
|
-
|
|
9313
|
-
|
|
9314
|
-
|
|
9315
|
-
onClick: () => context == null ? void 0 : context.goToPage(stepId, uischema.scope),
|
|
9316
|
-
children: "Change"
|
|
9317
|
-
})
|
|
9318
|
-
})]
|
|
9319
|
-
});
|
|
9432
|
+
const renderRow = (fieldLabel, value, testId) => jsx("tr", {
|
|
9433
|
+
children: jsxs(PageReviewContainer, {
|
|
9434
|
+
colSpan: 3,
|
|
9435
|
+
children: [jsx(ReviewHeader, {
|
|
9436
|
+
children: jsx(ReviewLabel, {
|
|
9437
|
+
children: fieldLabel
|
|
9438
|
+
})
|
|
9439
|
+
}), jsx(ReviewValue, {
|
|
9440
|
+
children: jsx("div", {
|
|
9441
|
+
"data-testid": testId,
|
|
9442
|
+
children: value
|
|
9443
|
+
})
|
|
9444
|
+
})]
|
|
9445
|
+
})
|
|
9446
|
+
}, testId);
|
|
9320
9447
|
return jsxs(Fragment, {
|
|
9321
|
-
children: [
|
|
9448
|
+
children: [jsx("tr", {
|
|
9449
|
+
"data-testid": "fullname-dob-header",
|
|
9450
|
+
children: jsxs(PageReviewContainer, {
|
|
9451
|
+
colSpan: 3,
|
|
9452
|
+
children: [jsxs(ReviewHeader, {
|
|
9453
|
+
children: [jsxs(ReviewLabel, {
|
|
9454
|
+
children: [label, required && jsx(RequiredTextLabel, {
|
|
9455
|
+
children: " (required)"
|
|
9456
|
+
})]
|
|
9457
|
+
}), stepId !== undefined && jsx(GoabButton, {
|
|
9458
|
+
type: "tertiary",
|
|
9459
|
+
size: "compact",
|
|
9460
|
+
onClick: () => context == null ? void 0 : context.goToPage(stepId, uischema.scope),
|
|
9461
|
+
testId: "fullname-dob-change-btn",
|
|
9462
|
+
children: "Change"
|
|
9463
|
+
})]
|
|
9464
|
+
}), errors && jsxs(WarningIconDiv, {
|
|
9465
|
+
children: [jsx(GoabIcon, {
|
|
9466
|
+
type: "warning",
|
|
9467
|
+
size: "small"
|
|
9468
|
+
}), errors != null && errors.includes('is a required property') ? `${label} is required` : errors]
|
|
9469
|
+
})]
|
|
9470
|
+
})
|
|
9471
|
+
}), renderRow('First name', data == null ? void 0 : data.firstName, `firstName-control-${id}`), (data == null ? void 0 : data.middleName) && renderRow('Middle name', data == null ? void 0 : data.middleName, `middleName-control-${id}`), renderRow('Last name', data == null ? void 0 : data.lastName, `lastName-control-${id}`), renderRow('Date of birth', data == null ? void 0 : data.dateOfBirth, `dob-control-${id}`)]
|
|
9322
9472
|
});
|
|
9323
9473
|
};
|
|
9324
9474
|
const GoAInputBaseFullNameDobControlReview = withJsonFormsAllOfProps(FullNameDobReviewControl);
|
|
@@ -11672,10 +11822,11 @@ const AddressLoopUpControlTableReview = props => {
|
|
|
11672
11822
|
data,
|
|
11673
11823
|
schema,
|
|
11674
11824
|
uischema,
|
|
11675
|
-
path
|
|
11825
|
+
path,
|
|
11826
|
+
label,
|
|
11827
|
+
required
|
|
11676
11828
|
} = props;
|
|
11677
11829
|
const jsonForms = useJsonForms();
|
|
11678
|
-
// eslint-disable-next-line
|
|
11679
11830
|
const stepId = (_uischema$options = uischema.options) == null ? void 0 : _uischema$options.stepId;
|
|
11680
11831
|
const formStepperCtx = useContext(JsonFormsStepperContext);
|
|
11681
11832
|
const isAlbertaAddress = (schema == null || (_schema$properties2 = schema.properties) == null || (_schema$properties2 = _schema$properties2.subdivisionCode) == null ? void 0 : _schema$properties2.const) === 'AB';
|
|
@@ -11752,7 +11903,9 @@ const AddressLoopUpControlTableReview = props => {
|
|
|
11752
11903
|
var _schema$required;
|
|
11753
11904
|
return schema == null || (_schema$required = schema.required) == null ? void 0 : _schema$required.includes(propName);
|
|
11754
11905
|
};
|
|
11755
|
-
|
|
11906
|
+
// Build the target scope for the address control
|
|
11907
|
+
const targetScope = (uischema == null ? void 0 : uischema.scope) || (path ? `#/properties/${path}` : undefined);
|
|
11908
|
+
const renderRow = (label, value, propName, showButton = false) => {
|
|
11756
11909
|
var _error, _error2;
|
|
11757
11910
|
let error = getError(propName);
|
|
11758
11911
|
const required = isRequired(propName);
|
|
@@ -11767,10 +11920,11 @@ const AddressLoopUpControlTableReview = props => {
|
|
|
11767
11920
|
children: [label, required && jsx(RequiredTextLabel, {
|
|
11768
11921
|
children: " (required)"
|
|
11769
11922
|
})]
|
|
11770
|
-
}), showButton && jsx(GoabButton, {
|
|
11923
|
+
}), showButton && stepId !== undefined && jsx(GoabButton, {
|
|
11771
11924
|
type: "tertiary",
|
|
11772
11925
|
size: "compact",
|
|
11773
|
-
onClick: () => formStepperCtx == null ? void 0 : formStepperCtx.goToPage(stepId,
|
|
11926
|
+
onClick: () => formStepperCtx == null ? void 0 : formStepperCtx.goToPage(stepId, targetScope),
|
|
11927
|
+
testId: "address-change-btn",
|
|
11774
11928
|
children: "Change"
|
|
11775
11929
|
})]
|
|
11776
11930
|
}), jsxs(ReviewValue, {
|
|
@@ -11782,7 +11936,7 @@ const AddressLoopUpControlTableReview = props => {
|
|
|
11782
11936
|
})]
|
|
11783
11937
|
})]
|
|
11784
11938
|
})
|
|
11785
|
-
});
|
|
11939
|
+
}, propName);
|
|
11786
11940
|
};
|
|
11787
11941
|
return jsxs(Fragment, {
|
|
11788
11942
|
children: [jsx("tr", {
|
|
@@ -11793,7 +11947,7 @@ const AddressLoopUpControlTableReview = props => {
|
|
|
11793
11947
|
children: `${isAlbertaAddress ? 'Alberta' : 'Canada'} postal address`
|
|
11794
11948
|
})
|
|
11795
11949
|
})
|
|
11796
|
-
}), renderRow('Address line 1', data == null ? void 0 : data.addressLine1, 'addressLine1'), (data == null ? void 0 : data.addressLine2) && renderRow('Address line 2', data.addressLine2, 'addressLine2'), renderRow('City', data == null ? void 0 : data.municipality, 'municipality'), renderRow('Postal Code', data == null ? void 0 : data.postalCode, 'postalCode'), renderRow('Province', provinceLabel, 'subdivisionCode'), renderRow('Country', 'Canada', 'country', false)]
|
|
11950
|
+
}), renderRow('Address line 1', data == null ? void 0 : data.addressLine1, 'addressLine1', true), (data == null ? void 0 : data.addressLine2) && renderRow('Address line 2', data.addressLine2, 'addressLine2', false), renderRow('City', data == null ? void 0 : data.municipality, 'municipality', false), renderRow('Postal Code', data == null ? void 0 : data.postalCode, 'postalCode', false), renderRow('Province', provinceLabel, 'subdivisionCode', false), renderRow('Country', 'Canada', 'country', false)]
|
|
11797
11951
|
});
|
|
11798
11952
|
};
|
|
11799
11953
|
|
|
@@ -14047,10 +14201,12 @@ const AddressLookUpControl = props => {
|
|
|
14047
14201
|
} = props;
|
|
14048
14202
|
const isAlbertaAddress = (schema == null || (_schema$properties = schema.properties) == null || (_schema$properties = _schema$properties.subdivisionCode) == null ? void 0 : _schema$properties.const) === 'AB';
|
|
14049
14203
|
const formCtx = useContext(JsonFormContext);
|
|
14204
|
+
const formStepperCtx = useContext(JsonFormsStepperContext);
|
|
14050
14205
|
const formHost = formCtx == null ? void 0 : formCtx.formUrl;
|
|
14051
14206
|
const formUrl = `${formHost}/${ADDRESS_PATH}`;
|
|
14052
14207
|
const autocompletion = (uischema == null || (_uischema$options = uischema.options) == null ? void 0 : _uischema$options.autocomplete) !== false;
|
|
14053
14208
|
const [open, setOpen] = useState(false);
|
|
14209
|
+
const addressContainerRef = useRef(null);
|
|
14054
14210
|
const label = typeof (uischema == null ? void 0 : uischema.label) === 'string' && uischema.label ? uischema.label : '';
|
|
14055
14211
|
let defaultAddress = {};
|
|
14056
14212
|
if (isAlbertaAddress) {
|
|
@@ -14178,74 +14334,102 @@ const AddressLookUpControl = props => {
|
|
|
14178
14334
|
}
|
|
14179
14335
|
}
|
|
14180
14336
|
}, [activeIndex]);
|
|
14337
|
+
// Handle focus when navigated from review page
|
|
14338
|
+
useEffect(() => {
|
|
14339
|
+
const stepperState = formStepperCtx == null || formStepperCtx.selectStepperState == null ? void 0 : formStepperCtx.selectStepperState();
|
|
14340
|
+
if (stepperState != null && stepperState.targetScope && uischema != null && uischema.scope && stepperState.targetScope === uischema.scope && addressContainerRef.current) {
|
|
14341
|
+
const addressInput = addressContainerRef.current.querySelector('goa-input[name="addressLine1"]');
|
|
14342
|
+
if (addressInput) {
|
|
14343
|
+
addressContainerRef.current.scrollIntoView({
|
|
14344
|
+
behavior: 'smooth',
|
|
14345
|
+
block: 'center'
|
|
14346
|
+
});
|
|
14347
|
+
setTimeout(() => {
|
|
14348
|
+
if (typeof addressInput.focus === 'function') {
|
|
14349
|
+
addressInput.focus();
|
|
14350
|
+
}
|
|
14351
|
+
const shadowRoot = addressInput.shadowRoot;
|
|
14352
|
+
if (shadowRoot) {
|
|
14353
|
+
const actualInput = shadowRoot.querySelector('input');
|
|
14354
|
+
if (actualInput instanceof HTMLElement) {
|
|
14355
|
+
actualInput.focus();
|
|
14356
|
+
}
|
|
14357
|
+
}
|
|
14358
|
+
}, 300);
|
|
14359
|
+
}
|
|
14360
|
+
}
|
|
14361
|
+
}, [formStepperCtx, uischema == null ? void 0 : uischema.scope]);
|
|
14181
14362
|
const readOnly = (_uischema$options$com = uischema == null || (_uischema$options2 = uischema.options) == null || (_uischema$options2 = _uischema$options2.componentProps) == null ? void 0 : _uischema$options2.readOnly) != null ? _uischema$options$com : false;
|
|
14182
|
-
return
|
|
14363
|
+
return jsx(Visible, {
|
|
14183
14364
|
visible: visible,
|
|
14184
|
-
children:
|
|
14185
|
-
|
|
14186
|
-
|
|
14187
|
-
|
|
14188
|
-
|
|
14189
|
-
|
|
14190
|
-
|
|
14191
|
-
|
|
14192
|
-
|
|
14193
|
-
|
|
14194
|
-
children: [
|
|
14195
|
-
|
|
14196
|
-
|
|
14197
|
-
|
|
14198
|
-
|
|
14199
|
-
|
|
14200
|
-
|
|
14201
|
-
|
|
14202
|
-
|
|
14203
|
-
|
|
14204
|
-
|
|
14205
|
-
|
|
14206
|
-
|
|
14207
|
-
|
|
14208
|
-
|
|
14209
|
-
|
|
14210
|
-
|
|
14365
|
+
children: jsxs("div", {
|
|
14366
|
+
ref: addressContainerRef,
|
|
14367
|
+
children: [renderHelp(), jsx("h3", {
|
|
14368
|
+
children: label
|
|
14369
|
+
}), jsx(GoabFormItem, {
|
|
14370
|
+
requirement: 'required',
|
|
14371
|
+
label: 'Street address or P.O. box',
|
|
14372
|
+
error: (_errors$addressLine = errors == null ? void 0 : errors['addressLine1']) != null ? _errors$addressLine : '',
|
|
14373
|
+
"data-testId": "form-address-line1",
|
|
14374
|
+
children: jsxs(SearchBox, {
|
|
14375
|
+
children: [jsxs("div", {
|
|
14376
|
+
className: "input-container",
|
|
14377
|
+
children: [jsx(GoabInput, {
|
|
14378
|
+
leadingIcon: autocompletion && enabled ? 'search' : undefined,
|
|
14379
|
+
id: "goaInput",
|
|
14380
|
+
name: "addressLine1",
|
|
14381
|
+
testId: "address-form-address1",
|
|
14382
|
+
readonly: readOnly,
|
|
14383
|
+
disabled: !enabled,
|
|
14384
|
+
ariaLabel: 'address-form-address1',
|
|
14385
|
+
placeholder: "Start typing the first line of your address, required.",
|
|
14386
|
+
value: (address == null ? void 0 : address.addressLine1) || '',
|
|
14387
|
+
onChange: detail => handleDropdownChange(detail.value),
|
|
14388
|
+
onBlur: detail => handleRequiredFieldBlur(detail.name),
|
|
14389
|
+
width: "100%",
|
|
14390
|
+
onKeyPress: detail => {
|
|
14391
|
+
if (open) {
|
|
14392
|
+
const newIndex = handleAddressKeyDown(detail.key, detail.value, activeIndex, suggestions, val => handleInputChange('addressLine1', val), suggestion => handleSuggestionClick(suggestion));
|
|
14393
|
+
setActiveIndex(newIndex);
|
|
14394
|
+
}
|
|
14211
14395
|
}
|
|
14212
|
-
}
|
|
14213
|
-
|
|
14214
|
-
|
|
14215
|
-
|
|
14216
|
-
|
|
14217
|
-
|
|
14218
|
-
})
|
|
14396
|
+
}), loading && jsx("div", {
|
|
14397
|
+
className: "input-spinner",
|
|
14398
|
+
children: jsx(GoabSpinner, {
|
|
14399
|
+
type: "infinite",
|
|
14400
|
+
size: "small"
|
|
14401
|
+
})
|
|
14402
|
+
})]
|
|
14403
|
+
}), !loading && suggestions && autocompletion && jsx("ul", {
|
|
14404
|
+
ref: dropdownRef,
|
|
14405
|
+
className: "suggestions",
|
|
14406
|
+
children: suggestions && autocompletion && open && suggestions.map((suggestion, index) => jsx(ListItem, {
|
|
14407
|
+
"data-index": index,
|
|
14408
|
+
onMouseDown: e => {
|
|
14409
|
+
e.preventDefault();
|
|
14410
|
+
e.stopPropagation();
|
|
14411
|
+
},
|
|
14412
|
+
onClick: () => {
|
|
14413
|
+
handleSuggestionClick(suggestion);
|
|
14414
|
+
},
|
|
14415
|
+
selected: activeIndex,
|
|
14416
|
+
index: index,
|
|
14417
|
+
"data-testId": `listItem-${index}`,
|
|
14418
|
+
children: `${suggestion.Text} ${suggestion.Description}`
|
|
14419
|
+
}, index))
|
|
14219
14420
|
})]
|
|
14220
|
-
})
|
|
14221
|
-
|
|
14222
|
-
|
|
14223
|
-
|
|
14224
|
-
|
|
14225
|
-
|
|
14226
|
-
|
|
14227
|
-
|
|
14228
|
-
|
|
14229
|
-
|
|
14230
|
-
|
|
14231
|
-
|
|
14232
|
-
selected: activeIndex,
|
|
14233
|
-
index: index,
|
|
14234
|
-
"data-testId": `listItem-${index}`,
|
|
14235
|
-
children: `${suggestion.Text} ${suggestion.Description}`
|
|
14236
|
-
}, index))
|
|
14237
|
-
})]
|
|
14238
|
-
})
|
|
14239
|
-
}), jsx("br", {}), jsx(AddressInputs, {
|
|
14240
|
-
address: address,
|
|
14241
|
-
errors: errors,
|
|
14242
|
-
readOnly: readOnly,
|
|
14243
|
-
enabled: enabled,
|
|
14244
|
-
handleInputChange: handleInputChange,
|
|
14245
|
-
isAlbertaAddress: isAlbertaAddress,
|
|
14246
|
-
handleOnBlur: handleRequiredFieldBlur,
|
|
14247
|
-
requiredFields: requiredFields
|
|
14248
|
-
})]
|
|
14421
|
+
})
|
|
14422
|
+
}), jsx("br", {}), jsx(AddressInputs, {
|
|
14423
|
+
address: address,
|
|
14424
|
+
errors: errors,
|
|
14425
|
+
readOnly: readOnly,
|
|
14426
|
+
enabled: enabled,
|
|
14427
|
+
handleInputChange: handleInputChange,
|
|
14428
|
+
isAlbertaAddress: isAlbertaAddress,
|
|
14429
|
+
handleOnBlur: handleRequiredFieldBlur,
|
|
14430
|
+
requiredFields: requiredFields
|
|
14431
|
+
})]
|
|
14432
|
+
})
|
|
14249
14433
|
});
|
|
14250
14434
|
};
|
|
14251
14435
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abgov/jsonforms-components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.46.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Government of Alberta - React renderers for JSON Forms based on the design system.",
|
|
6
6
|
"repository": "https://github.com/GovAlta/adsp-monorepo",
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { JsonSchema7 } from '@jsonforms/core';
|
|
2
|
+
import Ajv from 'ajv';
|
|
3
|
+
type RequiredStrategy = 'bestMatch' | 'union' | 'intersection';
|
|
4
|
+
type Options = {
|
|
5
|
+
/** anyOf/oneOf required */
|
|
6
|
+
strategy?: RequiredStrategy;
|
|
7
|
+
ajv?: Ajv;
|
|
8
|
+
};
|
|
9
|
+
export declare const isRequiredBySchema: (rootSchema: JsonSchema7, rootData: any, path?: string, options?: Options) => boolean;
|
|
10
|
+
export {};
|