@abgov/jsonforms-components 2.70.1 → 2.70.3

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
@@ -4,7 +4,7 @@ import Ajv from 'ajv';
4
4
  import styled from 'styled-components';
5
5
  import axios from 'axios';
6
6
  import get$1 from 'lodash/get';
7
- import { isVisible, isEnabled, deriveLabelForUISchemaElement, rankWith, isStringControl, and, optionIs, isDateControl, isNumberControl, isIntegerControl, isDateTimeControl, isTimeControl, uiTypeIs, isControl as isControl$1, isEnumControl, or, isOneOfEnumControl, isBooleanControl, createDefaultValue, Paths, Resolve, toDataPath, schemaTypeIs, formatIs, getAjv, schemaMatches, isObjectArrayControl, isPrimitiveArrayControl, composePaths, hasType, isCategorization, isLayout, INIT, UPDATE_CORE } from '@jsonforms/core';
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
9
  import ___default, { isEmpty, isObject as isObject$i } from 'lodash';
10
10
  import { useJsonForms, withJsonFormsControlProps, withJsonFormsEnumProps, withTranslateProps, JsonFormsDispatch, withJsonFormsAllOfProps, withJsonFormsArrayLayoutProps, withJsonFormsLayoutProps, withJsonFormsCellProps } from '@jsonforms/react';
@@ -7272,10 +7272,6 @@ const getAddressLookupFieldLabel = fieldName => {
7272
7272
  return ADDRESS_LOOKUP_LABELS[fieldName] || fieldName;
7273
7273
  };
7274
7274
 
7275
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
7276
- function getValueAtPath(obj, path) {
7277
- return path.split('.').reduce((acc, key) => acc == null ? void 0 : acc[key], obj);
7278
- }
7279
7275
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
7280
7276
  function hasMeaningfulValue(val) {
7281
7277
  if (val === undefined || val === null) return false;
@@ -7347,43 +7343,36 @@ function anyRequiredFieldEmpty(scopes, data, required, schema) {
7347
7343
  }
7348
7344
  return false;
7349
7345
  }
7350
- // Resolve a single schema scope against the provided data and determine whether
7351
- // it already holds a meaningful value. Used to derive the initial "visited"
7352
- // state of a step from populated form data.
7353
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
7354
- function hasValueAtScope(data, scope) {
7355
- const path = normalizeSchemaPath(scope);
7356
- if (!path) return false;
7357
- return hasMeaningfulValue(getValueAtPath(data, path));
7358
- }
7359
7346
  function getStepStatus(opts) {
7360
7347
  const {
7361
7348
  scopes,
7362
7349
  errors,
7363
7350
  schema,
7364
7351
  data,
7365
- visited
7352
+ visited,
7353
+ autoPopulatedScopes = []
7366
7354
  } = opts;
7367
7355
  const normalizedScopes = scopes.map(normalizeSchemaPath).filter(Boolean);
7368
- // A step with no required fields has nothing that must be filled in, so once
7369
- // the user has visited it (e.g. navigated back to the application overview
7370
- // page) it is trivially Completed, regardless of whether its optional
7371
- // fields hold any data.
7372
7356
  const requiredForScopes = getRequiredForScopes(scopes, schema);
7373
7357
  const stepHasRequiredFields = isScopeRequired(normalizedScopes, requiredForScopes);
7374
- // NotStarted is data-driven: if any scoped field has a defined value the step has been started.
7375
- // For non-standard scopes that cannot be normalised, fall back to the visited flag so those
7376
- // steps are never stuck in NotStarted when the form is pre-populated or already visited.
7377
- const stepHasData = normalizedScopes.length > 0 ? normalizedScopes.some(path => hasMeaningfulValue(get$1(data || {}, path))) : visited != null ? visited : false;
7378
- if (!stepHasRequiredFields && (visited || stepHasData)) {
7358
+ // A step is "started" when the user has visited it OR it already holds user-entered data.
7359
+ // Auto-populated values (system-filled from the user profile) are excluded, so:
7360
+ // - a page the user has never opened is NotStarted even when auto-populated, and
7361
+ // - a saved form the user actually filled still shows its status when resumed.
7362
+ const autoPopulatedSet = new Set(autoPopulatedScopes.map(normalizeSchemaPath).filter(Boolean));
7363
+ const userDataScopes = normalizedScopes.filter(path => !autoPopulatedSet.has(path));
7364
+ const stepHasUserData = userDataScopes.length > 0 ? userDataScopes.some(path => hasMeaningfulValue(get$1(data || {}, path))) : false;
7365
+ const started = (visited != null ? visited : false) || stepHasUserData;
7366
+ if (!started) {
7379
7367
  return {
7380
- status: StepStatus.COMPLETED,
7368
+ status: StepStatus.NOT_STARTED,
7381
7369
  hasRequiredFields: stepHasRequiredFields
7382
7370
  };
7383
7371
  }
7384
- if (!stepHasData) {
7372
+ // A started step with no required fields has nothing left to fill in, so it is trivially Completed.
7373
+ if (!stepHasRequiredFields) {
7385
7374
  return {
7386
- status: StepStatus.NOT_STARTED,
7375
+ status: StepStatus.COMPLETED,
7387
7376
  hasRequiredFields: stepHasRequiredFields
7388
7377
  };
7389
7378
  }
@@ -7680,6 +7669,424 @@ const stepperReducer = (state, action) => {
7680
7669
  }
7681
7670
  };
7682
7671
 
7672
+ var isArray$1 = isArray$5;
7673
+ var lengthOfArrayLike$5 = lengthOfArrayLike$c;
7674
+ var doesNotExceedSafeInteger$1 = doesNotExceedSafeInteger$3;
7675
+ var bind$3 = functionBindContext;
7676
+
7677
+ // `FlattenIntoArray` abstract operation
7678
+ // https://tc39.github.io/proposal-flatMap/#sec-FlattenIntoArray
7679
+ var flattenIntoArray$2 = function (target, original, source, sourceLen, start, depth, mapper, thisArg) {
7680
+ var targetIndex = start;
7681
+ var sourceIndex = 0;
7682
+ var mapFn = mapper ? bind$3(mapper, thisArg) : false;
7683
+ var element, elementLen;
7684
+
7685
+ while (sourceIndex < sourceLen) {
7686
+ if (sourceIndex in source) {
7687
+ element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex];
7688
+
7689
+ if (depth > 0 && isArray$1(element)) {
7690
+ elementLen = lengthOfArrayLike$5(element);
7691
+ targetIndex = flattenIntoArray$2(target, original, element, elementLen, targetIndex, depth - 1) - 1;
7692
+ } else {
7693
+ doesNotExceedSafeInteger$1(targetIndex + 1);
7694
+ target[targetIndex] = element;
7695
+ }
7696
+
7697
+ targetIndex++;
7698
+ }
7699
+ sourceIndex++;
7700
+ }
7701
+ return targetIndex;
7702
+ };
7703
+
7704
+ var flattenIntoArray_1 = flattenIntoArray$2;
7705
+
7706
+ var isArray = isArray$5;
7707
+ var isConstructor$1 = isConstructor$3;
7708
+ var isObject$1 = isObject$h;
7709
+ var wellKnownSymbol$2 = wellKnownSymbol$o;
7710
+
7711
+ var SPECIES = wellKnownSymbol$2('species');
7712
+ var $Array$1 = Array;
7713
+
7714
+ // a part of `ArraySpeciesCreate` abstract operation
7715
+ // https://tc39.es/ecma262/#sec-arrayspeciescreate
7716
+ var arraySpeciesConstructor$1 = function (originalArray) {
7717
+ var C;
7718
+ if (isArray(originalArray)) {
7719
+ C = originalArray.constructor;
7720
+ // cross-realm fallback
7721
+ if (isConstructor$1(C) && (C === $Array$1 || isArray(C.prototype))) C = undefined;
7722
+ else if (isObject$1(C)) {
7723
+ C = C[SPECIES];
7724
+ if (C === null) C = undefined;
7725
+ }
7726
+ } return C === undefined ? $Array$1 : C;
7727
+ };
7728
+
7729
+ var arraySpeciesConstructor = arraySpeciesConstructor$1;
7730
+
7731
+ // `ArraySpeciesCreate` abstract operation
7732
+ // https://tc39.es/ecma262/#sec-arrayspeciescreate
7733
+ var arraySpeciesCreate$2 = function (originalArray, length) {
7734
+ return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
7735
+ };
7736
+
7737
+ var $$c = _export;
7738
+ var flattenIntoArray$1 = flattenIntoArray_1;
7739
+ var aCallable$2 = aCallable$k;
7740
+ var toObject$4 = toObject$c;
7741
+ var lengthOfArrayLike$4 = lengthOfArrayLike$c;
7742
+ var arraySpeciesCreate$1 = arraySpeciesCreate$2;
7743
+
7744
+ // `Array.prototype.flatMap` method
7745
+ // https://tc39.es/ecma262/#sec-array.prototype.flatmap
7746
+ $$c({ target: 'Array', proto: true }, {
7747
+ flatMap: function flatMap(callbackfn /* , thisArg */) {
7748
+ var O = toObject$4(this);
7749
+ var sourceLen = lengthOfArrayLike$4(O);
7750
+ var A;
7751
+ aCallable$2(callbackfn);
7752
+ A = arraySpeciesCreate$1(O, 0);
7753
+ A.length = flattenIntoArray$1(A, O, O, sourceLen, 0, 1, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
7754
+ return A;
7755
+ }
7756
+ });
7757
+
7758
+ // this method was added to unscopables after implementation
7759
+ // in popular engines, so it's moved to a separate module
7760
+ var addToUnscopables$1 = addToUnscopables$5;
7761
+
7762
+ // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
7763
+ addToUnscopables$1('flatMap');
7764
+
7765
+ var call$6 = functionCall;
7766
+ var uncurryThis$b = functionUncurryThis;
7767
+ var fixRegExpWellKnownSymbolLogic$1 = fixRegexpWellKnownSymbolLogic;
7768
+ var anObject$4 = anObject$t;
7769
+ var isNullOrUndefined$1 = isNullOrUndefined$7;
7770
+ var requireObjectCoercible$4 = requireObjectCoercible$e;
7771
+ var speciesConstructor = speciesConstructor$2;
7772
+ var advanceStringIndex$1 = advanceStringIndex$3;
7773
+ var toLength$3 = toLength$7;
7774
+ var toString$a = toString$n;
7775
+ var getMethod$1 = getMethod$7;
7776
+ var regExpExec$1 = regexpExecAbstract;
7777
+ var stickyHelpers = regexpStickyHelpers;
7778
+ var fails$3 = fails$y;
7779
+
7780
+ var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y;
7781
+ var MAX_UINT32 = 0xFFFFFFFF;
7782
+ var min$1 = Math.min;
7783
+ var push$5 = uncurryThis$b([].push);
7784
+ var stringSlice$4 = uncurryThis$b(''.slice);
7785
+
7786
+ // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
7787
+ // Weex JS has frozen built-in prototypes, so use try / catch wrapper
7788
+ var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails$3(function () {
7789
+ // eslint-disable-next-line regexp/no-empty-group -- required for testing
7790
+ var re = /(?:)/;
7791
+ var originalExec = re.exec;
7792
+ re.exec = function () { return originalExec.apply(this, arguments); };
7793
+ var result = 'ab'.split(re);
7794
+ return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
7795
+ });
7796
+
7797
+ var BUGGY = 'abbc'.split(/(b)*/)[1] === 'c' ||
7798
+ // eslint-disable-next-line regexp/no-empty-group -- required for testing
7799
+ 'test'.split(/(?:)/, -1).length !== 4 ||
7800
+ 'ab'.split(/(?:ab)*/).length !== 2 ||
7801
+ '.'.split(/(.?)(.?)/).length !== 4 ||
7802
+ // eslint-disable-next-line regexp/no-empty-capturing-group, regexp/no-empty-group -- required for testing
7803
+ '.'.split(/()()/).length > 1 ||
7804
+ ''.split(/.?/).length;
7805
+
7806
+ // @@split logic
7807
+ fixRegExpWellKnownSymbolLogic$1('split', function (SPLIT, nativeSplit, maybeCallNative) {
7808
+ var internalSplit = '0'.split(undefined, 0).length ? function (separator, limit) {
7809
+ return separator === undefined && limit === 0 ? [] : call$6(nativeSplit, this, separator, limit);
7810
+ } : nativeSplit;
7811
+
7812
+ return [
7813
+ // `String.prototype.split` method
7814
+ // https://tc39.es/ecma262/#sec-string.prototype.split
7815
+ function split(separator, limit) {
7816
+ var O = requireObjectCoercible$4(this);
7817
+ var splitter = isNullOrUndefined$1(separator) ? undefined : getMethod$1(separator, SPLIT);
7818
+ return splitter
7819
+ ? call$6(splitter, separator, O, limit)
7820
+ : call$6(internalSplit, toString$a(O), separator, limit);
7821
+ },
7822
+ // `RegExp.prototype[@@split]` method
7823
+ // https://tc39.es/ecma262/#sec-regexp.prototype-@@split
7824
+ //
7825
+ // NOTE: This cannot be properly polyfilled in engines that don't support
7826
+ // the 'y' flag.
7827
+ function (string, limit) {
7828
+ var rx = anObject$4(this);
7829
+ var S = toString$a(string);
7830
+
7831
+ if (!BUGGY) {
7832
+ var res = maybeCallNative(internalSplit, rx, S, limit, internalSplit !== nativeSplit);
7833
+ if (res.done) return res.value;
7834
+ }
7835
+
7836
+ var C = speciesConstructor(rx, RegExp);
7837
+ var unicodeMatching = rx.unicode;
7838
+ var flags = (rx.ignoreCase ? 'i' : '') +
7839
+ (rx.multiline ? 'm' : '') +
7840
+ (rx.unicode ? 'u' : '') +
7841
+ (UNSUPPORTED_Y ? 'g' : 'y');
7842
+ // ^(? + rx + ) is needed, in combination with some S slicing, to
7843
+ // simulate the 'y' flag.
7844
+ var splitter = new C(UNSUPPORTED_Y ? '^(?:' + rx.source + ')' : rx, flags);
7845
+ var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
7846
+ if (lim === 0) return [];
7847
+ if (S.length === 0) return regExpExec$1(splitter, S) === null ? [S] : [];
7848
+ var p = 0;
7849
+ var q = 0;
7850
+ var A = [];
7851
+ while (q < S.length) {
7852
+ splitter.lastIndex = UNSUPPORTED_Y ? 0 : q;
7853
+ var z = regExpExec$1(splitter, UNSUPPORTED_Y ? stringSlice$4(S, q) : S);
7854
+ var e;
7855
+ if (
7856
+ z === null ||
7857
+ (e = min$1(toLength$3(splitter.lastIndex + (UNSUPPORTED_Y ? q : 0)), S.length)) === p
7858
+ ) {
7859
+ q = advanceStringIndex$1(S, q, unicodeMatching);
7860
+ } else {
7861
+ push$5(A, stringSlice$4(S, p, q));
7862
+ if (A.length === lim) return A;
7863
+ for (var i = 1; i <= z.length - 1; i++) {
7864
+ push$5(A, z[i]);
7865
+ if (A.length === lim) return A;
7866
+ }
7867
+ q = p = e;
7868
+ }
7869
+ }
7870
+ push$5(A, stringSlice$4(S, p));
7871
+ return A;
7872
+ }
7873
+ ];
7874
+ }, BUGGY || !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC, UNSUPPORTED_Y);
7875
+
7876
+ var call$5 = functionCall;
7877
+ var anObject$3 = anObject$t;
7878
+ var getIteratorDirect$1 = getIteratorDirect$a;
7879
+ var getIteratorMethod$2 = getIteratorMethod$5;
7880
+
7881
+ var getIteratorFlattenable$1 = function (obj, stringHandling) {
7882
+ if (!stringHandling || typeof obj !== 'string') anObject$3(obj);
7883
+ var method = getIteratorMethod$2(obj);
7884
+ return getIteratorDirect$1(anObject$3(method !== undefined ? call$5(method, obj) : obj));
7885
+ };
7886
+
7887
+ var $$b = _export;
7888
+ var call$4 = functionCall;
7889
+ var aCallable$1 = aCallable$k;
7890
+ var anObject$2 = anObject$t;
7891
+ var getIteratorDirect = getIteratorDirect$a;
7892
+ var getIteratorFlattenable = getIteratorFlattenable$1;
7893
+ var createIteratorProxy = iteratorCreateProxy;
7894
+ var iteratorClose = iteratorClose$6;
7895
+ var IS_PURE$1 = isPure;
7896
+
7897
+ var IteratorProxy = createIteratorProxy(function () {
7898
+ var iterator = this.iterator;
7899
+ var mapper = this.mapper;
7900
+ var result, inner;
7901
+
7902
+ while (true) {
7903
+ if (inner = this.inner) try {
7904
+ result = anObject$2(call$4(inner.next, inner.iterator));
7905
+ if (!result.done) return result.value;
7906
+ this.inner = null;
7907
+ } catch (error) { iteratorClose(iterator, 'throw', error); }
7908
+
7909
+ result = anObject$2(call$4(this.next, iterator));
7910
+
7911
+ if (this.done = !!result.done) return;
7912
+
7913
+ try {
7914
+ this.inner = getIteratorFlattenable(mapper(result.value, this.counter++), false);
7915
+ } catch (error) { iteratorClose(iterator, 'throw', error); }
7916
+ }
7917
+ });
7918
+
7919
+ // `Iterator.prototype.flatMap` method
7920
+ // https://github.com/tc39/proposal-iterator-helpers
7921
+ $$b({ target: 'Iterator', proto: true, real: true, forced: IS_PURE$1 }, {
7922
+ flatMap: function flatMap(mapper) {
7923
+ anObject$2(this);
7924
+ aCallable$1(mapper);
7925
+ return new IteratorProxy(getIteratorDirect(this), {
7926
+ mapper: mapper,
7927
+ inner: null
7928
+ });
7929
+ }
7930
+ });
7931
+
7932
+ const AUTO_POPULATE_SOURCES = ['firstName', 'lastName', 'email'];
7933
+ const getNameParts = user => {
7934
+ const parts = ((user == null ? void 0 : user.name) || '').trim().split(/\s+/).filter(Boolean);
7935
+ return {
7936
+ firstName: parts[0] || '',
7937
+ lastName: parts.length > 1 ? parts[parts.length - 1] : ''
7938
+ };
7939
+ };
7940
+ /**
7941
+ * @deprecated Field names no longer control auto-population. Use the
7942
+ * UI-schema `options.autoPopulate` directive.
7943
+ */
7944
+ const USER_FIELD_DEFINITIONS = {
7945
+ fullName: {
7946
+ schema: {
7947
+ type: 'string'
7948
+ },
7949
+ getValue: user => user == null ? void 0 : user.name
7950
+ },
7951
+ name: {
7952
+ schema: {
7953
+ type: 'string'
7954
+ },
7955
+ getValue: user => user == null ? void 0 : user.name
7956
+ },
7957
+ firstName: {
7958
+ schema: {
7959
+ type: 'string'
7960
+ },
7961
+ getValue: user => getNameParts(user).firstName
7962
+ },
7963
+ givenName: {
7964
+ schema: {
7965
+ type: 'string'
7966
+ },
7967
+ getValue: user => getNameParts(user).firstName
7968
+ },
7969
+ lastName: {
7970
+ schema: {
7971
+ type: 'string'
7972
+ },
7973
+ getValue: user => getNameParts(user).lastName
7974
+ },
7975
+ familyName: {
7976
+ schema: {
7977
+ type: 'string'
7978
+ },
7979
+ getValue: user => getNameParts(user).lastName
7980
+ },
7981
+ surname: {
7982
+ schema: {
7983
+ type: 'string'
7984
+ },
7985
+ getValue: user => getNameParts(user).lastName
7986
+ },
7987
+ email: {
7988
+ schema: {
7989
+ type: 'string',
7990
+ format: 'email'
7991
+ },
7992
+ getValue: user => (user == null ? void 0 : user.email) || ''
7993
+ },
7994
+ emailAddress: {
7995
+ schema: {
7996
+ type: 'string',
7997
+ format: 'email'
7998
+ },
7999
+ getValue: user => (user == null ? void 0 : user.email) || ''
8000
+ },
8001
+ primaryEmail: {
8002
+ schema: {
8003
+ type: 'string',
8004
+ format: 'email'
8005
+ },
8006
+ getValue: user => (user == null ? void 0 : user.email) || ''
8007
+ }
8008
+ };
8009
+ const AUTO_POPULATE_ACTION_TYPES = new Set([INIT, UPDATE_CORE]);
8010
+ // clean-code-ignore: RULE-19 — covered by ./autoPopulate.spec.tsx, colocated. The rule only looks
8011
+ // for a .test.ts sibling; adding one would duplicate the existing suite.
8012
+ // Only a value the user has never set is a populate target. An empty string is a real value here:
8013
+ // the text controls write '' when a field is cleared (see onChangeForInputControl), so treating it
8014
+ // as empty made auto-populate refill the field the instant it was emptied, and the user could
8015
+ // never clear it.
8016
+ const isEmptyAutoPopulateTarget = value => value === undefined || value === null;
8017
+ const shouldAutoPopulate = actionType => AUTO_POPULATE_ACTION_TYPES.has(actionType);
8018
+ const isAutoPopulateSource = value => typeof value === 'string' && AUTO_POPULATE_SOURCES.includes(value);
8019
+ const autoPopulateValue = (user, props) => {
8020
+ var _props$uischema;
8021
+ const source = (_props$uischema = props.uischema) == null || (_props$uischema = _props$uischema.options) == null ? void 0 : _props$uischema.autoPopulate;
8022
+ if (!isAutoPopulateSource(source)) {
8023
+ return undefined;
8024
+ }
8025
+ const name = getNameParts(user);
8026
+ const values = {
8027
+ firstName: name.firstName,
8028
+ lastName: name.lastName,
8029
+ email: (user == null ? void 0 : user.email) || ''
8030
+ };
8031
+ return values[source];
8032
+ };
8033
+ const getAutoPopulateControls = element => {
8034
+ var _element$options, _element$elements;
8035
+ if (!element) {
8036
+ return [];
8037
+ }
8038
+ const controls = element.type === 'Control' && (_element$options = element.options) != null && _element$options.autoPopulate ? [element] : [];
8039
+ const children = (_element$elements = element.elements) != null ? _element$elements : [];
8040
+ return [...controls, ...children.flatMap(getAutoPopulateControls)];
8041
+ };
8042
+ const getAutoPopulatedData = (uischema, user) => {
8043
+ if (!user) {
8044
+ return [];
8045
+ }
8046
+ return getAutoPopulateControls(uischema).map(control => ({
8047
+ path: toDataPath(control.scope),
8048
+ value: autoPopulateValue(user, {
8049
+ uischema: control
8050
+ })
8051
+ })).filter(({
8052
+ path,
8053
+ value
8054
+ }) => Boolean(path) && value !== undefined && value !== null);
8055
+ };
8056
+ const mergeAutoPopulatedData = (data, autoPopulatedData) => {
8057
+ if (autoPopulatedData.length === 0) {
8058
+ return data;
8059
+ }
8060
+ const defaults = autoPopulatedData.reduce((values, {
8061
+ path,
8062
+ value
8063
+ }) => _$c.set(values, path, value), {});
8064
+ const normalizedData = _$c.cloneDeep(data != null ? data : {});
8065
+ autoPopulatedData.forEach(({
8066
+ path,
8067
+ value
8068
+ }) => {
8069
+ if (isEmptyAutoPopulateTarget(_$c.get(normalizedData, path)) && value !== undefined && value !== null) {
8070
+ _$c.unset(normalizedData, path);
8071
+ }
8072
+ });
8073
+ return _$c.defaultsDeep({}, normalizedData, defaults);
8074
+ };
8075
+ const createAutoPopulateMiddleware = (uischema, user) => (state, action, defaultReducer) => {
8076
+ const newState = defaultReducer(state, action);
8077
+ if (!shouldAutoPopulate(action.type)) {
8078
+ return newState;
8079
+ }
8080
+ return Object.assign({}, newState, {
8081
+ data: mergeAutoPopulatedData(newState.data, getAutoPopulatedData(uischema, user))
8082
+ });
8083
+ };
8084
+ /**
8085
+ * Retained for compatibility with consumers of the previous data-schema
8086
+ * autocomplete API. Auto-population is now configured in the UI schema.
8087
+ */
8088
+ const autoPopulatePropertiesMonaco = [];
8089
+
7683
8090
  const createStepperContextInitData = props => {
7684
8091
  var _uischema$options, _uischema$options2, _categorization$eleme;
7685
8092
  const {
@@ -7702,9 +8109,12 @@ const createStepperContextInitData = props => {
7702
8109
  const categories = (_categorization$eleme = categorization.elements) == null ? void 0 : _categorization$eleme.map((c, id) => {
7703
8110
  var _deriveLabelForUISche;
7704
8111
  const scopes = pickPropertyValues(c, 'scope', 'ListWithDetail');
7705
- // Treat a step as visited when its scoped fields already contain data so
7706
- // that getStepStatus returns the real data-driven status on initial mount initially.
7707
- let visited = scopes.some(scope => hasValueAtScope(data, scope));
8112
+ // A step is not visited on initial mount, so its status is driven by whether it already holds
8113
+ // user-entered data. Auto-populated fields (system-filled from the user profile) are excluded
8114
+ // so an unopened page with only auto-populated values stays NotStarted, while a resumed form
8115
+ // the user actually filled still shows its saved status.
8116
+ let visited = false;
8117
+ const autoPopulatedScopes = getAutoPopulateControls(c).map(control => control.scope);
7708
8118
  const {
7709
8119
  status,
7710
8120
  hasRequiredFields
@@ -7713,7 +8123,8 @@ const createStepperContextInitData = props => {
7713
8123
  data,
7714
8124
  errors: filteredErrors != null ? filteredErrors : [],
7715
8125
  schema,
7716
- visited
8126
+ visited,
8127
+ autoPopulatedScopes
7717
8128
  });
7718
8129
  //If the step has all conditional fields, set visited to true so that the step status will be
7719
8130
  //completed to enable form to be saved.
@@ -8056,14 +8467,14 @@ const GoAInputBaseControl = props => {
8056
8467
  });
8057
8468
  };
8058
8469
 
8059
- var $$c = _export;
8470
+ var $$a = _export;
8060
8471
  var DESCRIPTORS$4 = descriptors;
8061
8472
  var global$4 = global$t;
8062
- var uncurryThis$b = functionUncurryThis;
8473
+ var uncurryThis$a = functionUncurryThis;
8063
8474
  var hasOwn$2 = hasOwnProperty_1;
8064
8475
  var isCallable$1 = isCallable$t;
8065
8476
  var isPrototypeOf = objectIsPrototypeOf;
8066
- var toString$a = toString$n;
8477
+ var toString$9 = toString$n;
8067
8478
  var defineBuiltInAccessor$3 = defineBuiltInAccessor$7;
8068
8479
  var copyConstructorProperties = copyConstructorProperties$3;
8069
8480
 
@@ -8077,7 +8488,7 @@ if (DESCRIPTORS$4 && isCallable$1(NativeSymbol) && (!('description' in SymbolPro
8077
8488
  var EmptyStringDescriptionStore = {};
8078
8489
  // wrap Symbol constructor for correct work with undefined description
8079
8490
  var SymbolWrapper = function Symbol() {
8080
- var description = arguments.length < 1 || arguments[0] === undefined ? undefined : toString$a(arguments[0]);
8491
+ var description = arguments.length < 1 || arguments[0] === undefined ? undefined : toString$9(arguments[0]);
8081
8492
  var result = isPrototypeOf(SymbolPrototype, this)
8082
8493
  ? new NativeSymbol(description)
8083
8494
  // in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)'
@@ -8091,11 +8502,11 @@ if (DESCRIPTORS$4 && isCallable$1(NativeSymbol) && (!('description' in SymbolPro
8091
8502
  SymbolPrototype.constructor = SymbolWrapper;
8092
8503
 
8093
8504
  var NATIVE_SYMBOL = String(NativeSymbol('description detection')) === 'Symbol(description detection)';
8094
- var thisSymbolValue = uncurryThis$b(SymbolPrototype.valueOf);
8095
- var symbolDescriptiveString = uncurryThis$b(SymbolPrototype.toString);
8505
+ var thisSymbolValue = uncurryThis$a(SymbolPrototype.valueOf);
8506
+ var symbolDescriptiveString = uncurryThis$a(SymbolPrototype.toString);
8096
8507
  var regexp = /^Symbol\((.*)\)[^)]+$/;
8097
- var replace$3 = uncurryThis$b(''.replace);
8098
- var stringSlice$4 = uncurryThis$b(''.slice);
8508
+ var replace$3 = uncurryThis$a(''.replace);
8509
+ var stringSlice$3 = uncurryThis$a(''.slice);
8099
8510
 
8100
8511
  defineBuiltInAccessor$3(SymbolPrototype, 'description', {
8101
8512
  configurable: true,
@@ -8103,57 +8514,57 @@ if (DESCRIPTORS$4 && isCallable$1(NativeSymbol) && (!('description' in SymbolPro
8103
8514
  var symbol = thisSymbolValue(this);
8104
8515
  if (hasOwn$2(EmptyStringDescriptionStore, symbol)) return '';
8105
8516
  var string = symbolDescriptiveString(symbol);
8106
- var desc = NATIVE_SYMBOL ? stringSlice$4(string, 7, -1) : replace$3(string, regexp, '$1');
8517
+ var desc = NATIVE_SYMBOL ? stringSlice$3(string, 7, -1) : replace$3(string, regexp, '$1');
8107
8518
  return desc === '' ? undefined : desc;
8108
8519
  }
8109
8520
  });
8110
8521
 
8111
- $$c({ global: true, constructor: true, forced: true }, {
8522
+ $$a({ global: true, constructor: true, forced: true }, {
8112
8523
  Symbol: SymbolWrapper
8113
8524
  });
8114
8525
  }
8115
8526
 
8116
- var call$6 = functionCall;
8117
- var fixRegExpWellKnownSymbolLogic$1 = fixRegexpWellKnownSymbolLogic;
8118
- var anObject$4 = anObject$t;
8119
- var isNullOrUndefined$1 = isNullOrUndefined$7;
8120
- var toLength$3 = toLength$7;
8121
- var toString$9 = toString$n;
8122
- var requireObjectCoercible$4 = requireObjectCoercible$e;
8123
- var getMethod$1 = getMethod$7;
8124
- var advanceStringIndex$1 = advanceStringIndex$3;
8125
- var regExpExec$1 = regexpExecAbstract;
8527
+ var call$3 = functionCall;
8528
+ var fixRegExpWellKnownSymbolLogic = fixRegexpWellKnownSymbolLogic;
8529
+ var anObject$1 = anObject$t;
8530
+ var isNullOrUndefined = isNullOrUndefined$7;
8531
+ var toLength$2 = toLength$7;
8532
+ var toString$8 = toString$n;
8533
+ var requireObjectCoercible$3 = requireObjectCoercible$e;
8534
+ var getMethod = getMethod$7;
8535
+ var advanceStringIndex = advanceStringIndex$3;
8536
+ var regExpExec = regexpExecAbstract;
8126
8537
 
8127
8538
  // @@match logic
8128
- fixRegExpWellKnownSymbolLogic$1('match', function (MATCH, nativeMatch, maybeCallNative) {
8539
+ fixRegExpWellKnownSymbolLogic('match', function (MATCH, nativeMatch, maybeCallNative) {
8129
8540
  return [
8130
8541
  // `String.prototype.match` method
8131
8542
  // https://tc39.es/ecma262/#sec-string.prototype.match
8132
8543
  function match(regexp) {
8133
- var O = requireObjectCoercible$4(this);
8134
- var matcher = isNullOrUndefined$1(regexp) ? undefined : getMethod$1(regexp, MATCH);
8135
- return matcher ? call$6(matcher, regexp, O) : new RegExp(regexp)[MATCH](toString$9(O));
8544
+ var O = requireObjectCoercible$3(this);
8545
+ var matcher = isNullOrUndefined(regexp) ? undefined : getMethod(regexp, MATCH);
8546
+ return matcher ? call$3(matcher, regexp, O) : new RegExp(regexp)[MATCH](toString$8(O));
8136
8547
  },
8137
8548
  // `RegExp.prototype[@@match]` method
8138
8549
  // https://tc39.es/ecma262/#sec-regexp.prototype-@@match
8139
8550
  function (string) {
8140
- var rx = anObject$4(this);
8141
- var S = toString$9(string);
8551
+ var rx = anObject$1(this);
8552
+ var S = toString$8(string);
8142
8553
  var res = maybeCallNative(nativeMatch, rx, S);
8143
8554
 
8144
8555
  if (res.done) return res.value;
8145
8556
 
8146
- if (!rx.global) return regExpExec$1(rx, S);
8557
+ if (!rx.global) return regExpExec(rx, S);
8147
8558
 
8148
8559
  var fullUnicode = rx.unicode;
8149
8560
  rx.lastIndex = 0;
8150
8561
  var A = [];
8151
8562
  var n = 0;
8152
8563
  var result;
8153
- while ((result = regExpExec$1(rx, S)) !== null) {
8154
- var matchStr = toString$9(result[0]);
8564
+ while ((result = regExpExec(rx, S)) !== null) {
8565
+ var matchStr = toString$8(result[0]);
8155
8566
  A[n] = matchStr;
8156
- if (matchStr === '') rx.lastIndex = advanceStringIndex$1(S, toLength$3(rx.lastIndex), fullUnicode);
8567
+ if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength$2(rx.lastIndex), fullUnicode);
8157
8568
  n++;
8158
8569
  }
8159
8570
  return n === 0 ? null : A;
@@ -8489,15 +8900,15 @@ function _objectWithoutPropertiesLoose(r, e) {
8489
8900
  }
8490
8901
 
8491
8902
  var toIntegerOrInfinity$1 = toIntegerOrInfinity$9;
8492
- var toString$8 = toString$n;
8493
- var requireObjectCoercible$3 = requireObjectCoercible$e;
8903
+ var toString$7 = toString$n;
8904
+ var requireObjectCoercible$2 = requireObjectCoercible$e;
8494
8905
 
8495
8906
  var $RangeError$1 = RangeError;
8496
8907
 
8497
8908
  // `String.prototype.repeat` method implementation
8498
8909
  // https://tc39.es/ecma262/#sec-string.prototype.repeat
8499
8910
  var stringRepeat = function repeat(count) {
8500
- var str = toString$8(requireObjectCoercible$3(this));
8911
+ var str = toString$7(requireObjectCoercible$2(this));
8501
8912
  var result = '';
8502
8913
  var n = toIntegerOrInfinity$1(count);
8503
8914
  if (n < 0 || n === Infinity) throw new $RangeError$1('Wrong number of repetitions');
@@ -8506,28 +8917,28 @@ var stringRepeat = function repeat(count) {
8506
8917
  };
8507
8918
 
8508
8919
  // https://github.com/tc39/proposal-string-pad-start-end
8509
- var uncurryThis$a = functionUncurryThis;
8510
- var toLength$2 = toLength$7;
8511
- var toString$7 = toString$n;
8920
+ var uncurryThis$9 = functionUncurryThis;
8921
+ var toLength$1 = toLength$7;
8922
+ var toString$6 = toString$n;
8512
8923
  var $repeat = stringRepeat;
8513
- var requireObjectCoercible$2 = requireObjectCoercible$e;
8924
+ var requireObjectCoercible$1 = requireObjectCoercible$e;
8514
8925
 
8515
- var repeat = uncurryThis$a($repeat);
8516
- var stringSlice$3 = uncurryThis$a(''.slice);
8926
+ var repeat = uncurryThis$9($repeat);
8927
+ var stringSlice$2 = uncurryThis$9(''.slice);
8517
8928
  var ceil = Math.ceil;
8518
8929
 
8519
8930
  // `String.prototype.{ padStart, padEnd }` methods implementation
8520
8931
  var createMethod = function (IS_END) {
8521
8932
  return function ($this, maxLength, fillString) {
8522
- var S = toString$7(requireObjectCoercible$2($this));
8523
- var intMaxLength = toLength$2(maxLength);
8933
+ var S = toString$6(requireObjectCoercible$1($this));
8934
+ var intMaxLength = toLength$1(maxLength);
8524
8935
  var stringLength = S.length;
8525
- var fillStr = fillString === undefined ? ' ' : toString$7(fillString);
8936
+ var fillStr = fillString === undefined ? ' ' : toString$6(fillString);
8526
8937
  var fillLen, stringFiller;
8527
8938
  if (intMaxLength <= stringLength || fillStr === '') return S;
8528
8939
  fillLen = intMaxLength - stringLength;
8529
8940
  stringFiller = repeat(fillStr, ceil(fillLen / fillStr.length));
8530
- if (stringFiller.length > fillLen) stringFiller = stringSlice$3(stringFiller, 0, fillLen);
8941
+ if (stringFiller.length > fillLen) stringFiller = stringSlice$2(stringFiller, 0, fillLen);
8531
8942
  return IS_END ? S + stringFiller : stringFiller + S;
8532
8943
  };
8533
8944
  };
@@ -8542,13 +8953,13 @@ var userAgent$2 = engineUserAgent;
8542
8953
 
8543
8954
  var stringPadWebkitBug = /Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(userAgent$2);
8544
8955
 
8545
- var $$b = _export;
8956
+ var $$9 = _export;
8546
8957
  var $padStart = stringPad.start;
8547
8958
  var WEBKIT_BUG = stringPadWebkitBug;
8548
8959
 
8549
8960
  // `String.prototype.padStart` method
8550
8961
  // https://tc39.es/ecma262/#sec-string.prototype.padstart
8551
- $$b({ target: 'String', proto: true, forced: WEBKIT_BUG }, {
8962
+ $$9({ target: 'String', proto: true, forced: WEBKIT_BUG }, {
8552
8963
  padStart: function padStart(maxLength /* , fillString = ' ' */) {
8553
8964
  return $padStart(this, maxLength, arguments.length > 1 ? arguments[1] : undefined);
8554
8965
  }
@@ -9519,128 +9930,35 @@ const GoABaseInputReviewComponent = props => {
9519
9930
  if (isTime) {
9520
9931
  reviewText = reviewText && to12HourFormat(reviewText);
9521
9932
  }
9522
- if (isDateTime) {
9523
- reviewText = reviewText && UTCToFullLocalTime(reviewText);
9524
- }
9525
- if (Array.isArray(data) && data.length > 0) {
9526
- reviewText = jsx("ul", {
9527
- children: data.map((checkbox, index) => {
9528
- const checkboxLabel = getFallbackCheckboxLabel();
9529
- return jsx("li", {
9530
- children: checkbox.trim() || checkboxLabel
9531
- }, index);
9532
- })
9533
- });
9534
- }
9535
- return jsxs("div", {
9536
- style: {
9537
- fontWeight: '400',
9538
- textWrap: 'wrap',
9539
- wordBreak: 'break-word'
9540
- },
9541
- "data-testid": `review-control-${id}`,
9542
- children: [reviewText, renderRequiredLabel(), renderWarningMessage()]
9543
- });
9544
- };
9545
- const GoInputBaseReview = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
9546
- input: GoABaseInputReviewComponent,
9547
- isStepperReview: true,
9548
- skipInitialValidation: true
9549
- }));
9550
- const GoAInputBaseReviewControl = withJsonFormsControlProps(GoInputBaseReview);
9551
-
9552
- var isArray$1 = isArray$5;
9553
- var lengthOfArrayLike$5 = lengthOfArrayLike$c;
9554
- var doesNotExceedSafeInteger$1 = doesNotExceedSafeInteger$3;
9555
- var bind$3 = functionBindContext;
9556
-
9557
- // `FlattenIntoArray` abstract operation
9558
- // https://tc39.github.io/proposal-flatMap/#sec-FlattenIntoArray
9559
- var flattenIntoArray$2 = function (target, original, source, sourceLen, start, depth, mapper, thisArg) {
9560
- var targetIndex = start;
9561
- var sourceIndex = 0;
9562
- var mapFn = mapper ? bind$3(mapper, thisArg) : false;
9563
- var element, elementLen;
9564
-
9565
- while (sourceIndex < sourceLen) {
9566
- if (sourceIndex in source) {
9567
- element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex];
9568
-
9569
- if (depth > 0 && isArray$1(element)) {
9570
- elementLen = lengthOfArrayLike$5(element);
9571
- targetIndex = flattenIntoArray$2(target, original, element, elementLen, targetIndex, depth - 1) - 1;
9572
- } else {
9573
- doesNotExceedSafeInteger$1(targetIndex + 1);
9574
- target[targetIndex] = element;
9575
- }
9576
-
9577
- targetIndex++;
9578
- }
9579
- sourceIndex++;
9580
- }
9581
- return targetIndex;
9582
- };
9583
-
9584
- var flattenIntoArray_1 = flattenIntoArray$2;
9585
-
9586
- var isArray = isArray$5;
9587
- var isConstructor$1 = isConstructor$3;
9588
- var isObject$1 = isObject$h;
9589
- var wellKnownSymbol$2 = wellKnownSymbol$o;
9590
-
9591
- var SPECIES = wellKnownSymbol$2('species');
9592
- var $Array$1 = Array;
9593
-
9594
- // a part of `ArraySpeciesCreate` abstract operation
9595
- // https://tc39.es/ecma262/#sec-arrayspeciescreate
9596
- var arraySpeciesConstructor$1 = function (originalArray) {
9597
- var C;
9598
- if (isArray(originalArray)) {
9599
- C = originalArray.constructor;
9600
- // cross-realm fallback
9601
- if (isConstructor$1(C) && (C === $Array$1 || isArray(C.prototype))) C = undefined;
9602
- else if (isObject$1(C)) {
9603
- C = C[SPECIES];
9604
- if (C === null) C = undefined;
9605
- }
9606
- } return C === undefined ? $Array$1 : C;
9607
- };
9608
-
9609
- var arraySpeciesConstructor = arraySpeciesConstructor$1;
9610
-
9611
- // `ArraySpeciesCreate` abstract operation
9612
- // https://tc39.es/ecma262/#sec-arrayspeciescreate
9613
- var arraySpeciesCreate$2 = function (originalArray, length) {
9614
- return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
9615
- };
9616
-
9617
- var $$a = _export;
9618
- var flattenIntoArray$1 = flattenIntoArray_1;
9619
- var aCallable$2 = aCallable$k;
9620
- var toObject$4 = toObject$c;
9621
- var lengthOfArrayLike$4 = lengthOfArrayLike$c;
9622
- var arraySpeciesCreate$1 = arraySpeciesCreate$2;
9623
-
9624
- // `Array.prototype.flatMap` method
9625
- // https://tc39.es/ecma262/#sec-array.prototype.flatmap
9626
- $$a({ target: 'Array', proto: true }, {
9627
- flatMap: function flatMap(callbackfn /* , thisArg */) {
9628
- var O = toObject$4(this);
9629
- var sourceLen = lengthOfArrayLike$4(O);
9630
- var A;
9631
- aCallable$2(callbackfn);
9632
- A = arraySpeciesCreate$1(O, 0);
9633
- A.length = flattenIntoArray$1(A, O, O, sourceLen, 0, 1, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
9634
- return A;
9635
- }
9636
- });
9637
-
9638
- // this method was added to unscopables after implementation
9639
- // in popular engines, so it's moved to a separate module
9640
- var addToUnscopables$1 = addToUnscopables$5;
9641
-
9642
- // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
9643
- addToUnscopables$1('flatMap');
9933
+ if (isDateTime) {
9934
+ reviewText = reviewText && UTCToFullLocalTime(reviewText);
9935
+ }
9936
+ if (Array.isArray(data) && data.length > 0) {
9937
+ reviewText = jsx("ul", {
9938
+ children: data.map((checkbox, index) => {
9939
+ const checkboxLabel = getFallbackCheckboxLabel();
9940
+ return jsx("li", {
9941
+ children: checkbox.trim() || checkboxLabel
9942
+ }, index);
9943
+ })
9944
+ });
9945
+ }
9946
+ return jsxs("div", {
9947
+ style: {
9948
+ fontWeight: '400',
9949
+ textWrap: 'wrap',
9950
+ wordBreak: 'break-word'
9951
+ },
9952
+ "data-testid": `review-control-${id}`,
9953
+ children: [reviewText, renderRequiredLabel(), renderWarningMessage()]
9954
+ });
9955
+ };
9956
+ const GoInputBaseReview = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
9957
+ input: GoABaseInputReviewComponent,
9958
+ isStepperReview: true,
9959
+ skipInitialValidation: true
9960
+ }));
9961
+ const GoAInputBaseReviewControl = withJsonFormsControlProps(GoInputBaseReview);
9644
9962
 
9645
9963
  var tryToString = tryToString$5;
9646
9964
 
@@ -9650,7 +9968,7 @@ var deletePropertyOrThrow$2 = function (O, P) {
9650
9968
  if (!delete O[P]) throw new $TypeError('Cannot delete property ' + tryToString(P) + ' of ' + tryToString(O));
9651
9969
  };
9652
9970
 
9653
- var $$9 = _export;
9971
+ var $$8 = _export;
9654
9972
  var toObject$3 = toObject$c;
9655
9973
  var lengthOfArrayLike$3 = lengthOfArrayLike$c;
9656
9974
  var setArrayLength = arraySetLength;
@@ -9674,7 +9992,7 @@ var FORCED$2 = INCORRECT_RESULT || !properErrorOnNonWritableLength();
9674
9992
 
9675
9993
  // `Array.prototype.unshift` method
9676
9994
  // https://tc39.es/ecma262/#sec-array.prototype.unshift
9677
- $$9({ target: 'Array', proto: true, arity: 1, forced: FORCED$2 }, {
9995
+ $$8({ target: 'Array', proto: true, arity: 1, forced: FORCED$2 }, {
9678
9996
  // eslint-disable-next-line no-unused-vars -- required for `.length`
9679
9997
  unshift: function unshift(item) {
9680
9998
  var O = toObject$3(this);
@@ -9695,62 +10013,6 @@ $$9({ target: 'Array', proto: true, arity: 1, forced: FORCED$2 }, {
9695
10013
  }
9696
10014
  });
9697
10015
 
9698
- var call$5 = functionCall;
9699
- var anObject$3 = anObject$t;
9700
- var getIteratorDirect$1 = getIteratorDirect$a;
9701
- var getIteratorMethod$2 = getIteratorMethod$5;
9702
-
9703
- var getIteratorFlattenable$1 = function (obj, stringHandling) {
9704
- if (!stringHandling || typeof obj !== 'string') anObject$3(obj);
9705
- var method = getIteratorMethod$2(obj);
9706
- return getIteratorDirect$1(anObject$3(method !== undefined ? call$5(method, obj) : obj));
9707
- };
9708
-
9709
- var $$8 = _export;
9710
- var call$4 = functionCall;
9711
- var aCallable$1 = aCallable$k;
9712
- var anObject$2 = anObject$t;
9713
- var getIteratorDirect = getIteratorDirect$a;
9714
- var getIteratorFlattenable = getIteratorFlattenable$1;
9715
- var createIteratorProxy = iteratorCreateProxy;
9716
- var iteratorClose = iteratorClose$6;
9717
- var IS_PURE$1 = isPure;
9718
-
9719
- var IteratorProxy = createIteratorProxy(function () {
9720
- var iterator = this.iterator;
9721
- var mapper = this.mapper;
9722
- var result, inner;
9723
-
9724
- while (true) {
9725
- if (inner = this.inner) try {
9726
- result = anObject$2(call$4(inner.next, inner.iterator));
9727
- if (!result.done) return result.value;
9728
- this.inner = null;
9729
- } catch (error) { iteratorClose(iterator, 'throw', error); }
9730
-
9731
- result = anObject$2(call$4(this.next, iterator));
9732
-
9733
- if (this.done = !!result.done) return;
9734
-
9735
- try {
9736
- this.inner = getIteratorFlattenable(mapper(result.value, this.counter++), false);
9737
- } catch (error) { iteratorClose(iterator, 'throw', error); }
9738
- }
9739
- });
9740
-
9741
- // `Iterator.prototype.flatMap` method
9742
- // https://github.com/tc39/proposal-iterator-helpers
9743
- $$8({ target: 'Iterator', proto: true, real: true, forced: IS_PURE$1 }, {
9744
- flatMap: function flatMap(mapper) {
9745
- anObject$2(this);
9746
- aCallable$1(mapper);
9747
- return new IteratorProxy(getIteratorDirect(this), {
9748
- mapper: mapper,
9749
- inner: null
9750
- });
9751
- }
9752
- });
9753
-
9754
10016
  let _$8 = t => t,
9755
10017
  _t$9,
9756
10018
  _t2$4,
@@ -11381,182 +11643,71 @@ const GoAInputBaseTableReview = props => {
11381
11643
  // below instead of being clobbered here.
11382
11644
  if (required && isNilOrEmptyValue(data, true)) {
11383
11645
  // clean-code-ignore: 2.18
11384
- activeError = `${labelToUpdate} is required`;
11385
- }
11386
- const isRegisterBackedEnumFalsePositive = (uischema == null || (_uischema$options4 = uischema.options) == null ? void 0 : _uischema$options4.register) !== undefined && !isNilOrEmptyValue(data, true) && typeof activeError === 'string' && activeError.toLowerCase().includes('must be equal to one of the allowed values');
11387
- if (isRegisterBackedEnumFalsePositive) {
11388
- activeError = undefined;
11389
- }
11390
- if (activeError && /\sis required$/i.test(activeError)) {
11391
- activeError = `${labelToUpdate} is required`;
11392
- }
11393
- // For required boolean fields (e.g. anyOf: [{enum: [true]}]), suppress the raw AJV
11394
- // "must be equal to one of the allowed values" error and show a friendly message instead.
11395
- if ((schema == null ? void 0 : schema.type) === 'boolean' && activeError && activeError.toLowerCase().includes('must be equal')) {
11396
- activeError = data === false ? `${labelToUpdate} is required` : undefined;
11397
- }
11398
- // If a required checkbox is unchecked, show only the validation message in
11399
- // review mode (not a contradictory "No (...)" value line).
11400
- let isBooleanRequiredError = false;
11401
- if ((schema == null ? void 0 : schema.type) === 'boolean' && data === false && activeError && /\sis required$/i.test(activeError)) {
11402
- reviewText = '';
11403
- isBooleanRequiredError = true;
11404
- }
11405
- // eslint-disable-next-line
11406
- const stepId = (_uischema$options5 = uischema.options) == null ? void 0 : _uischema$options5.stepId;
11407
- function handleChangeClick() {
11408
- context == null || context.goToPage(stepId, uischema.scope);
11409
- reviewCtx == null || reviewCtx.onChangeDispatch(stepId, uischema.scope);
11410
- }
11411
- const showInlineValue = reviewText === null || reviewText === undefined || typeof reviewText === 'string' || typeof reviewText === 'number' || /*#__PURE__*/React.isValidElement(reviewText) || Array.isArray(reviewText) && reviewText.length === 0;
11412
- const isValueEmpty = !isBooleanRequiredError && (reviewText === null || reviewText === undefined || reviewText === '' || Array.isArray(reviewText) && reviewText.length === 0);
11413
- return jsx("tr", {
11414
- "data-testid": `input-base-table-${label}-row`,
11415
- children: jsxs(PageReviewContainer, {
11416
- colSpan: 3,
11417
- children: [jsxs(ReviewHeader, {
11418
- children: [jsxs(ReviewLabel, {
11419
- children: [labelToUpdate, required && jsx(RequiredTextLabel, {
11420
- children: " (required)"
11421
- })]
11422
- }), stepId !== undefined && !((_uischema$options6 = uischema.options) != null && (_uischema$options6 = _uischema$options6.componentProps) != null && _uischema$options6.readOnly) && jsx(GoabButton, {
11423
- type: "tertiary",
11424
- onClick: handleChangeClick,
11425
- children: "Change"
11426
- })]
11427
- }), jsxs(ReviewValue, {
11428
- children: [showInlineValue ? jsx("div", {
11429
- "data-testid": `review-value-${label}`,
11430
- children: isValueEmpty ? jsx(NoneGivenText, {
11431
- children: "(none given)"
11432
- }) : reviewText != null ? reviewText : ''
11433
- }) : jsx(JsonFormsDispatch, {
11434
- "data-testid": `jsonforms-object-list-defined-elements-dispatch`,
11435
- schema: schema,
11436
- uischema: uischema,
11437
- enabled: enabled,
11438
- renderers: jsonForms.renderers,
11439
- cells: cells
11440
- }), activeError && jsx(GoabFormItem, {
11441
- error: activeError,
11442
- label: ""
11443
- })]
11444
- })]
11445
- })
11446
- });
11447
- };
11448
- const GoAInputBaseTableReviewControl = withJsonFormsControlProps(GoAInputBaseTableReview);
11449
-
11450
- var call$3 = functionCall;
11451
- var uncurryThis$9 = functionUncurryThis;
11452
- var fixRegExpWellKnownSymbolLogic = fixRegexpWellKnownSymbolLogic;
11453
- var anObject$1 = anObject$t;
11454
- var isNullOrUndefined = isNullOrUndefined$7;
11455
- var requireObjectCoercible$1 = requireObjectCoercible$e;
11456
- var speciesConstructor = speciesConstructor$2;
11457
- var advanceStringIndex = advanceStringIndex$3;
11458
- var toLength$1 = toLength$7;
11459
- var toString$6 = toString$n;
11460
- var getMethod = getMethod$7;
11461
- var regExpExec = regexpExecAbstract;
11462
- var stickyHelpers = regexpStickyHelpers;
11463
- var fails$3 = fails$y;
11464
-
11465
- var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y;
11466
- var MAX_UINT32 = 0xFFFFFFFF;
11467
- var min$1 = Math.min;
11468
- var push$5 = uncurryThis$9([].push);
11469
- var stringSlice$2 = uncurryThis$9(''.slice);
11470
-
11471
- // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
11472
- // Weex JS has frozen built-in prototypes, so use try / catch wrapper
11473
- var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails$3(function () {
11474
- // eslint-disable-next-line regexp/no-empty-group -- required for testing
11475
- var re = /(?:)/;
11476
- var originalExec = re.exec;
11477
- re.exec = function () { return originalExec.apply(this, arguments); };
11478
- var result = 'ab'.split(re);
11479
- return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
11480
- });
11481
-
11482
- var BUGGY = 'abbc'.split(/(b)*/)[1] === 'c' ||
11483
- // eslint-disable-next-line regexp/no-empty-group -- required for testing
11484
- 'test'.split(/(?:)/, -1).length !== 4 ||
11485
- 'ab'.split(/(?:ab)*/).length !== 2 ||
11486
- '.'.split(/(.?)(.?)/).length !== 4 ||
11487
- // eslint-disable-next-line regexp/no-empty-capturing-group, regexp/no-empty-group -- required for testing
11488
- '.'.split(/()()/).length > 1 ||
11489
- ''.split(/.?/).length;
11490
-
11491
- // @@split logic
11492
- fixRegExpWellKnownSymbolLogic('split', function (SPLIT, nativeSplit, maybeCallNative) {
11493
- var internalSplit = '0'.split(undefined, 0).length ? function (separator, limit) {
11494
- return separator === undefined && limit === 0 ? [] : call$3(nativeSplit, this, separator, limit);
11495
- } : nativeSplit;
11496
-
11497
- return [
11498
- // `String.prototype.split` method
11499
- // https://tc39.es/ecma262/#sec-string.prototype.split
11500
- function split(separator, limit) {
11501
- var O = requireObjectCoercible$1(this);
11502
- var splitter = isNullOrUndefined(separator) ? undefined : getMethod(separator, SPLIT);
11503
- return splitter
11504
- ? call$3(splitter, separator, O, limit)
11505
- : call$3(internalSplit, toString$6(O), separator, limit);
11506
- },
11507
- // `RegExp.prototype[@@split]` method
11508
- // https://tc39.es/ecma262/#sec-regexp.prototype-@@split
11509
- //
11510
- // NOTE: This cannot be properly polyfilled in engines that don't support
11511
- // the 'y' flag.
11512
- function (string, limit) {
11513
- var rx = anObject$1(this);
11514
- var S = toString$6(string);
11515
-
11516
- if (!BUGGY) {
11517
- var res = maybeCallNative(internalSplit, rx, S, limit, internalSplit !== nativeSplit);
11518
- if (res.done) return res.value;
11519
- }
11520
-
11521
- var C = speciesConstructor(rx, RegExp);
11522
- var unicodeMatching = rx.unicode;
11523
- var flags = (rx.ignoreCase ? 'i' : '') +
11524
- (rx.multiline ? 'm' : '') +
11525
- (rx.unicode ? 'u' : '') +
11526
- (UNSUPPORTED_Y ? 'g' : 'y');
11527
- // ^(? + rx + ) is needed, in combination with some S slicing, to
11528
- // simulate the 'y' flag.
11529
- var splitter = new C(UNSUPPORTED_Y ? '^(?:' + rx.source + ')' : rx, flags);
11530
- var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
11531
- if (lim === 0) return [];
11532
- if (S.length === 0) return regExpExec(splitter, S) === null ? [S] : [];
11533
- var p = 0;
11534
- var q = 0;
11535
- var A = [];
11536
- while (q < S.length) {
11537
- splitter.lastIndex = UNSUPPORTED_Y ? 0 : q;
11538
- var z = regExpExec(splitter, UNSUPPORTED_Y ? stringSlice$2(S, q) : S);
11539
- var e;
11540
- if (
11541
- z === null ||
11542
- (e = min$1(toLength$1(splitter.lastIndex + (UNSUPPORTED_Y ? q : 0)), S.length)) === p
11543
- ) {
11544
- q = advanceStringIndex(S, q, unicodeMatching);
11545
- } else {
11546
- push$5(A, stringSlice$2(S, p, q));
11547
- if (A.length === lim) return A;
11548
- for (var i = 1; i <= z.length - 1; i++) {
11549
- push$5(A, z[i]);
11550
- if (A.length === lim) return A;
11551
- }
11552
- q = p = e;
11553
- }
11554
- }
11555
- push$5(A, stringSlice$2(S, p));
11556
- return A;
11557
- }
11558
- ];
11559
- }, BUGGY || !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC, UNSUPPORTED_Y);
11646
+ activeError = `${labelToUpdate} is required`;
11647
+ }
11648
+ const isRegisterBackedEnumFalsePositive = (uischema == null || (_uischema$options4 = uischema.options) == null ? void 0 : _uischema$options4.register) !== undefined && !isNilOrEmptyValue(data, true) && typeof activeError === 'string' && activeError.toLowerCase().includes('must be equal to one of the allowed values');
11649
+ if (isRegisterBackedEnumFalsePositive) {
11650
+ activeError = undefined;
11651
+ }
11652
+ if (activeError && /\sis required$/i.test(activeError)) {
11653
+ activeError = `${labelToUpdate} is required`;
11654
+ }
11655
+ // For required boolean fields (e.g. anyOf: [{enum: [true]}]), suppress the raw AJV
11656
+ // "must be equal to one of the allowed values" error and show a friendly message instead.
11657
+ if ((schema == null ? void 0 : schema.type) === 'boolean' && activeError && activeError.toLowerCase().includes('must be equal')) {
11658
+ activeError = data === false ? `${labelToUpdate} is required` : undefined;
11659
+ }
11660
+ // If a required checkbox is unchecked, show only the validation message in
11661
+ // review mode (not a contradictory "No (...)" value line).
11662
+ let isBooleanRequiredError = false;
11663
+ if ((schema == null ? void 0 : schema.type) === 'boolean' && data === false && activeError && /\sis required$/i.test(activeError)) {
11664
+ reviewText = '';
11665
+ isBooleanRequiredError = true;
11666
+ }
11667
+ // eslint-disable-next-line
11668
+ const stepId = (_uischema$options5 = uischema.options) == null ? void 0 : _uischema$options5.stepId;
11669
+ function handleChangeClick() {
11670
+ context == null || context.goToPage(stepId, uischema.scope);
11671
+ reviewCtx == null || reviewCtx.onChangeDispatch(stepId, uischema.scope);
11672
+ }
11673
+ const showInlineValue = reviewText === null || reviewText === undefined || typeof reviewText === 'string' || typeof reviewText === 'number' || /*#__PURE__*/React.isValidElement(reviewText) || Array.isArray(reviewText) && reviewText.length === 0;
11674
+ const isValueEmpty = !isBooleanRequiredError && (reviewText === null || reviewText === undefined || reviewText === '' || Array.isArray(reviewText) && reviewText.length === 0);
11675
+ return jsx("tr", {
11676
+ "data-testid": `input-base-table-${label}-row`,
11677
+ children: jsxs(PageReviewContainer, {
11678
+ colSpan: 3,
11679
+ children: [jsxs(ReviewHeader, {
11680
+ children: [jsxs(ReviewLabel, {
11681
+ children: [labelToUpdate, required && jsx(RequiredTextLabel, {
11682
+ children: " (required)"
11683
+ })]
11684
+ }), stepId !== undefined && !((_uischema$options6 = uischema.options) != null && (_uischema$options6 = _uischema$options6.componentProps) != null && _uischema$options6.readOnly) && jsx(GoabButton, {
11685
+ type: "tertiary",
11686
+ onClick: handleChangeClick,
11687
+ children: "Change"
11688
+ })]
11689
+ }), jsxs(ReviewValue, {
11690
+ children: [showInlineValue ? jsx("div", {
11691
+ "data-testid": `review-value-${label}`,
11692
+ children: isValueEmpty ? jsx(NoneGivenText, {
11693
+ children: "(none given)"
11694
+ }) : reviewText != null ? reviewText : ''
11695
+ }) : jsx(JsonFormsDispatch, {
11696
+ "data-testid": `jsonforms-object-list-defined-elements-dispatch`,
11697
+ schema: schema,
11698
+ uischema: uischema,
11699
+ enabled: enabled,
11700
+ renderers: jsonForms.renderers,
11701
+ cells: cells
11702
+ }), activeError && jsx(GoabFormItem, {
11703
+ error: activeError,
11704
+ label: ""
11705
+ })]
11706
+ })]
11707
+ })
11708
+ });
11709
+ };
11710
+ const GoAInputBaseTableReviewControl = withJsonFormsControlProps(GoAInputBaseTableReview);
11560
11711
 
11561
11712
  const defaultLabel = 'Email address';
11562
11713
  const GoAEmailInput = props => {
@@ -15345,7 +15496,7 @@ const ApplicationStatus = ({
15345
15496
  icon: false
15346
15497
  });
15347
15498
  const mainHeading = 'Application Progress';
15348
- const progressPercentageAccurate = 100 * completed / totalGroups;
15499
+ const progressPercentageAccurate = totalGroups > 0 ? 100 * completed / totalGroups : 0;
15349
15500
  return jsxs(CompletionStatus, {
15350
15501
  children: [jsxs(CompletionTextHeader, {
15351
15502
  children: [mainHeading, jsx(BadgeWrapper, {
@@ -15372,6 +15523,26 @@ const ApplicationStatus = ({
15372
15523
  });
15373
15524
  };
15374
15525
 
15526
+ var PageStatus;
15527
+ (function (PageStatus) {
15528
+ PageStatus["Complete"] = "Completed";
15529
+ PageStatus["Inprogress"] = "In progress";
15530
+ PageStatus["NotStarted"] = "Not started";
15531
+ })(PageStatus || (PageStatus = {}));
15532
+ const getCategoryStatus = category => {
15533
+ return category.isVisited ? category.isCompleted && category.isValid ? PageStatus.Complete : PageStatus.Inprogress : PageStatus.NotStarted;
15534
+ };
15535
+ const getCategoryStatusBadge = category => {
15536
+ const status = getCategoryStatus(category);
15537
+ const badgeType = status === PageStatus.Complete ? 'success' : 'information';
15538
+ return jsx(GoabBadge, {
15539
+ type: badgeType,
15540
+ content: status,
15541
+ ariaLabel: status,
15542
+ icon: false
15543
+ });
15544
+ };
15545
+
15375
15546
  const getCategorySections = categories => {
15376
15547
  const sectionMap = new Map();
15377
15548
  categories.forEach(category => {
@@ -15406,26 +15577,6 @@ const SectionHeaderRow = ({
15406
15577
  });
15407
15578
  };
15408
15579
 
15409
- var PageStatus;
15410
- (function (PageStatus) {
15411
- PageStatus["Complete"] = "Completed";
15412
- PageStatus["Inprogress"] = "In progress";
15413
- PageStatus["NotStarted"] = "Not started";
15414
- })(PageStatus || (PageStatus = {}));
15415
- const getCategoryStatus = category => {
15416
- return category.isVisited ? category.isCompleted && category.isValid ? PageStatus.Complete : PageStatus.Inprogress : PageStatus.NotStarted;
15417
- };
15418
- const getCategoryStatusBadge = category => {
15419
- const status = getCategoryStatus(category);
15420
- const badgeType = status === PageStatus.Complete ? 'success' : 'information';
15421
- return jsx(GoabBadge, {
15422
- type: badgeType,
15423
- content: status,
15424
- ariaLabel: status,
15425
- icon: false
15426
- });
15427
- };
15428
-
15429
15580
  /* eslint-disable jsx-a11y/anchor-is-valid */
15430
15581
  const CategoryRow = ({
15431
15582
  category,
@@ -15563,6 +15714,17 @@ function updateCompletion(group, index) {
15563
15714
  isValid: newIsCompleted ? category.isValid : false
15564
15715
  });
15565
15716
  }
15717
+ // The rows the progress bar is counting: the ones actually rendered in the task list.
15718
+ const isCounted = cat => shouldShow(cat) && (cat == null ? void 0 : cat.visible) !== false;
15719
+ // A page counts as completed only when its own badge says so. A page with no required fields is
15720
+ // flagged isCompleted on mount (so an untouched optional page does not block submission), while its
15721
+ // badge still reads "Not started" - counting isCompleted alone credits pages the user never opened.
15722
+ // updateCompletion rolls up the detail pages hidden from the task list, exactly as the rendered row
15723
+ // does, so the count never runs ahead of the badges.
15724
+ const isCountedComplete = (group, index) => getCategoryStatus(updateCompletion(group, index)) === PageStatus.Complete;
15725
+ const countCountedPages = group => group.filter(isCounted).length;
15726
+ const countCompletedPages = group => group.filter((cat, index) => isCounted(cat) && isCountedComplete(group, index)).length;
15727
+ const sumOverSections = (sections, count) => sections.reduce((total, section) => total + count(section.categories), 0);
15566
15728
  const TaskList = ({
15567
15729
  categories,
15568
15730
  onClick,
@@ -15589,8 +15751,8 @@ const TaskList = ({
15589
15751
  const sections = mergeOrphanSections(getCategorySections(categories));
15590
15752
  return sections;
15591
15753
  }, [categories]);
15592
- const totalPages = useMemo(() => mergedSections.reduce((count, section) => count + section.categories.filter(shouldShow).length, 0), [mergedSections]);
15593
- const completedPages = useMemo(() => mergedSections.reduce((count, section) => count + section.categories.filter(cat => shouldShow(cat) && cat.isCompleted).length, 0), [mergedSections]);
15754
+ const totalPages = useMemo(() => sumOverSections(mergedSections, countCountedPages), [mergedSections]);
15755
+ const completedPages = useMemo(() => sumOverSections(mergedSections, countCompletedPages), [mergedSections]);
15594
15756
  let globalIndex = 0;
15595
15757
  let sectionIndex = 1;
15596
15758
  return jsx(PageBorder, {
@@ -19777,158 +19939,6 @@ async function tryResolveRefs(schema, ...refSchemas) {
19777
19939
  }
19778
19940
  }
19779
19941
 
19780
- const AUTO_POPULATE_SOURCES = ['firstName', 'lastName', 'email'];
19781
- const getNameParts = user => {
19782
- const parts = ((user == null ? void 0 : user.name) || '').trim().split(/\s+/).filter(Boolean);
19783
- return {
19784
- firstName: parts[0] || '',
19785
- lastName: parts.length > 1 ? parts[parts.length - 1] : ''
19786
- };
19787
- };
19788
- /**
19789
- * @deprecated Field names no longer control auto-population. Use the
19790
- * UI-schema `options.autoPopulate` directive.
19791
- */
19792
- const USER_FIELD_DEFINITIONS = {
19793
- fullName: {
19794
- schema: {
19795
- type: 'string'
19796
- },
19797
- getValue: user => user == null ? void 0 : user.name
19798
- },
19799
- name: {
19800
- schema: {
19801
- type: 'string'
19802
- },
19803
- getValue: user => user == null ? void 0 : user.name
19804
- },
19805
- firstName: {
19806
- schema: {
19807
- type: 'string'
19808
- },
19809
- getValue: user => getNameParts(user).firstName
19810
- },
19811
- givenName: {
19812
- schema: {
19813
- type: 'string'
19814
- },
19815
- getValue: user => getNameParts(user).firstName
19816
- },
19817
- lastName: {
19818
- schema: {
19819
- type: 'string'
19820
- },
19821
- getValue: user => getNameParts(user).lastName
19822
- },
19823
- familyName: {
19824
- schema: {
19825
- type: 'string'
19826
- },
19827
- getValue: user => getNameParts(user).lastName
19828
- },
19829
- surname: {
19830
- schema: {
19831
- type: 'string'
19832
- },
19833
- getValue: user => getNameParts(user).lastName
19834
- },
19835
- email: {
19836
- schema: {
19837
- type: 'string',
19838
- format: 'email'
19839
- },
19840
- getValue: user => (user == null ? void 0 : user.email) || ''
19841
- },
19842
- emailAddress: {
19843
- schema: {
19844
- type: 'string',
19845
- format: 'email'
19846
- },
19847
- getValue: user => (user == null ? void 0 : user.email) || ''
19848
- },
19849
- primaryEmail: {
19850
- schema: {
19851
- type: 'string',
19852
- format: 'email'
19853
- },
19854
- getValue: user => (user == null ? void 0 : user.email) || ''
19855
- }
19856
- };
19857
- const AUTO_POPULATE_ACTION_TYPES = new Set([INIT, UPDATE_CORE]);
19858
- const isEmptyAutoPopulateTarget = value => value === undefined || value === null || value === '';
19859
- const shouldAutoPopulate = actionType => AUTO_POPULATE_ACTION_TYPES.has(actionType);
19860
- const isAutoPopulateSource = value => typeof value === 'string' && AUTO_POPULATE_SOURCES.includes(value);
19861
- const autoPopulateValue = (user, props) => {
19862
- var _props$uischema;
19863
- const source = (_props$uischema = props.uischema) == null || (_props$uischema = _props$uischema.options) == null ? void 0 : _props$uischema.autoPopulate;
19864
- if (!isAutoPopulateSource(source)) {
19865
- return undefined;
19866
- }
19867
- const name = getNameParts(user);
19868
- const values = {
19869
- firstName: name.firstName,
19870
- lastName: name.lastName,
19871
- email: (user == null ? void 0 : user.email) || ''
19872
- };
19873
- return values[source];
19874
- };
19875
- const getAutoPopulateControls = element => {
19876
- var _element$options, _element$elements;
19877
- if (!element) {
19878
- return [];
19879
- }
19880
- const controls = element.type === 'Control' && (_element$options = element.options) != null && _element$options.autoPopulate ? [element] : [];
19881
- const children = (_element$elements = element.elements) != null ? _element$elements : [];
19882
- return [...controls, ...children.flatMap(getAutoPopulateControls)];
19883
- };
19884
- const getAutoPopulatedData = (uischema, user) => {
19885
- if (!user) {
19886
- return [];
19887
- }
19888
- return getAutoPopulateControls(uischema).map(control => ({
19889
- path: toDataPath(control.scope),
19890
- value: autoPopulateValue(user, {
19891
- uischema: control
19892
- })
19893
- })).filter(({
19894
- path,
19895
- value
19896
- }) => Boolean(path) && value !== undefined && value !== null);
19897
- };
19898
- const mergeAutoPopulatedData = (data, autoPopulatedData) => {
19899
- if (autoPopulatedData.length === 0) {
19900
- return data;
19901
- }
19902
- const defaults = autoPopulatedData.reduce((values, {
19903
- path,
19904
- value
19905
- }) => _$c.set(values, path, value), {});
19906
- const normalizedData = _$c.cloneDeep(data != null ? data : {});
19907
- autoPopulatedData.forEach(({
19908
- path,
19909
- value
19910
- }) => {
19911
- if (isEmptyAutoPopulateTarget(_$c.get(normalizedData, path)) && value !== undefined && value !== null) {
19912
- _$c.unset(normalizedData, path);
19913
- }
19914
- });
19915
- return _$c.defaultsDeep({}, normalizedData, defaults);
19916
- };
19917
- const createAutoPopulateMiddleware = (uischema, user) => (state, action, defaultReducer) => {
19918
- const newState = defaultReducer(state, action);
19919
- if (!shouldAutoPopulate(action.type)) {
19920
- return newState;
19921
- }
19922
- return Object.assign({}, newState, {
19923
- data: mergeAutoPopulatedData(newState.data, getAutoPopulatedData(uischema, user))
19924
- });
19925
- };
19926
- /**
19927
- * Retained for compatibility with consumers of the previous data-schema
19928
- * autocomplete API. Auto-population is now configured in the UI schema.
19929
- */
19930
- const autoPopulatePropertiesMonaco = [];
19931
-
19932
19942
  const GoABaseRenderers = [
19933
19943
  // controls
19934
19944
  {