@abgov/jsonforms-components 2.70.1 → 2.70.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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,418 @@ 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
+ const isEmptyAutoPopulateTarget = value => value === undefined || value === null || value === '';
8011
+ const shouldAutoPopulate = actionType => AUTO_POPULATE_ACTION_TYPES.has(actionType);
8012
+ const isAutoPopulateSource = value => typeof value === 'string' && AUTO_POPULATE_SOURCES.includes(value);
8013
+ const autoPopulateValue = (user, props) => {
8014
+ var _props$uischema;
8015
+ const source = (_props$uischema = props.uischema) == null || (_props$uischema = _props$uischema.options) == null ? void 0 : _props$uischema.autoPopulate;
8016
+ if (!isAutoPopulateSource(source)) {
8017
+ return undefined;
8018
+ }
8019
+ const name = getNameParts(user);
8020
+ const values = {
8021
+ firstName: name.firstName,
8022
+ lastName: name.lastName,
8023
+ email: (user == null ? void 0 : user.email) || ''
8024
+ };
8025
+ return values[source];
8026
+ };
8027
+ const getAutoPopulateControls = element => {
8028
+ var _element$options, _element$elements;
8029
+ if (!element) {
8030
+ return [];
8031
+ }
8032
+ const controls = element.type === 'Control' && (_element$options = element.options) != null && _element$options.autoPopulate ? [element] : [];
8033
+ const children = (_element$elements = element.elements) != null ? _element$elements : [];
8034
+ return [...controls, ...children.flatMap(getAutoPopulateControls)];
8035
+ };
8036
+ const getAutoPopulatedData = (uischema, user) => {
8037
+ if (!user) {
8038
+ return [];
8039
+ }
8040
+ return getAutoPopulateControls(uischema).map(control => ({
8041
+ path: toDataPath(control.scope),
8042
+ value: autoPopulateValue(user, {
8043
+ uischema: control
8044
+ })
8045
+ })).filter(({
8046
+ path,
8047
+ value
8048
+ }) => Boolean(path) && value !== undefined && value !== null);
8049
+ };
8050
+ const mergeAutoPopulatedData = (data, autoPopulatedData) => {
8051
+ if (autoPopulatedData.length === 0) {
8052
+ return data;
8053
+ }
8054
+ const defaults = autoPopulatedData.reduce((values, {
8055
+ path,
8056
+ value
8057
+ }) => _$c.set(values, path, value), {});
8058
+ const normalizedData = _$c.cloneDeep(data != null ? data : {});
8059
+ autoPopulatedData.forEach(({
8060
+ path,
8061
+ value
8062
+ }) => {
8063
+ if (isEmptyAutoPopulateTarget(_$c.get(normalizedData, path)) && value !== undefined && value !== null) {
8064
+ _$c.unset(normalizedData, path);
8065
+ }
8066
+ });
8067
+ return _$c.defaultsDeep({}, normalizedData, defaults);
8068
+ };
8069
+ const createAutoPopulateMiddleware = (uischema, user) => (state, action, defaultReducer) => {
8070
+ const newState = defaultReducer(state, action);
8071
+ if (!shouldAutoPopulate(action.type)) {
8072
+ return newState;
8073
+ }
8074
+ return Object.assign({}, newState, {
8075
+ data: mergeAutoPopulatedData(newState.data, getAutoPopulatedData(uischema, user))
8076
+ });
8077
+ };
8078
+ /**
8079
+ * Retained for compatibility with consumers of the previous data-schema
8080
+ * autocomplete API. Auto-population is now configured in the UI schema.
8081
+ */
8082
+ const autoPopulatePropertiesMonaco = [];
8083
+
7683
8084
  const createStepperContextInitData = props => {
7684
8085
  var _uischema$options, _uischema$options2, _categorization$eleme;
7685
8086
  const {
@@ -7702,9 +8103,12 @@ const createStepperContextInitData = props => {
7702
8103
  const categories = (_categorization$eleme = categorization.elements) == null ? void 0 : _categorization$eleme.map((c, id) => {
7703
8104
  var _deriveLabelForUISche;
7704
8105
  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));
8106
+ // A step is not visited on initial mount, so its status is driven by whether it already holds
8107
+ // user-entered data. Auto-populated fields (system-filled from the user profile) are excluded
8108
+ // so an unopened page with only auto-populated values stays NotStarted, while a resumed form
8109
+ // the user actually filled still shows its saved status.
8110
+ let visited = false;
8111
+ const autoPopulatedScopes = getAutoPopulateControls(c).map(control => control.scope);
7708
8112
  const {
7709
8113
  status,
7710
8114
  hasRequiredFields
@@ -7713,7 +8117,8 @@ const createStepperContextInitData = props => {
7713
8117
  data,
7714
8118
  errors: filteredErrors != null ? filteredErrors : [],
7715
8119
  schema,
7716
- visited
8120
+ visited,
8121
+ autoPopulatedScopes
7717
8122
  });
7718
8123
  //If the step has all conditional fields, set visited to true so that the step status will be
7719
8124
  //completed to enable form to be saved.
@@ -8056,14 +8461,14 @@ const GoAInputBaseControl = props => {
8056
8461
  });
8057
8462
  };
8058
8463
 
8059
- var $$c = _export;
8464
+ var $$a = _export;
8060
8465
  var DESCRIPTORS$4 = descriptors;
8061
8466
  var global$4 = global$t;
8062
- var uncurryThis$b = functionUncurryThis;
8467
+ var uncurryThis$a = functionUncurryThis;
8063
8468
  var hasOwn$2 = hasOwnProperty_1;
8064
8469
  var isCallable$1 = isCallable$t;
8065
8470
  var isPrototypeOf = objectIsPrototypeOf;
8066
- var toString$a = toString$n;
8471
+ var toString$9 = toString$n;
8067
8472
  var defineBuiltInAccessor$3 = defineBuiltInAccessor$7;
8068
8473
  var copyConstructorProperties = copyConstructorProperties$3;
8069
8474
 
@@ -8077,7 +8482,7 @@ if (DESCRIPTORS$4 && isCallable$1(NativeSymbol) && (!('description' in SymbolPro
8077
8482
  var EmptyStringDescriptionStore = {};
8078
8483
  // wrap Symbol constructor for correct work with undefined description
8079
8484
  var SymbolWrapper = function Symbol() {
8080
- var description = arguments.length < 1 || arguments[0] === undefined ? undefined : toString$a(arguments[0]);
8485
+ var description = arguments.length < 1 || arguments[0] === undefined ? undefined : toString$9(arguments[0]);
8081
8486
  var result = isPrototypeOf(SymbolPrototype, this)
8082
8487
  ? new NativeSymbol(description)
8083
8488
  // in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)'
@@ -8091,11 +8496,11 @@ if (DESCRIPTORS$4 && isCallable$1(NativeSymbol) && (!('description' in SymbolPro
8091
8496
  SymbolPrototype.constructor = SymbolWrapper;
8092
8497
 
8093
8498
  var NATIVE_SYMBOL = String(NativeSymbol('description detection')) === 'Symbol(description detection)';
8094
- var thisSymbolValue = uncurryThis$b(SymbolPrototype.valueOf);
8095
- var symbolDescriptiveString = uncurryThis$b(SymbolPrototype.toString);
8499
+ var thisSymbolValue = uncurryThis$a(SymbolPrototype.valueOf);
8500
+ var symbolDescriptiveString = uncurryThis$a(SymbolPrototype.toString);
8096
8501
  var regexp = /^Symbol\((.*)\)[^)]+$/;
8097
- var replace$3 = uncurryThis$b(''.replace);
8098
- var stringSlice$4 = uncurryThis$b(''.slice);
8502
+ var replace$3 = uncurryThis$a(''.replace);
8503
+ var stringSlice$3 = uncurryThis$a(''.slice);
8099
8504
 
8100
8505
  defineBuiltInAccessor$3(SymbolPrototype, 'description', {
8101
8506
  configurable: true,
@@ -8103,57 +8508,57 @@ if (DESCRIPTORS$4 && isCallable$1(NativeSymbol) && (!('description' in SymbolPro
8103
8508
  var symbol = thisSymbolValue(this);
8104
8509
  if (hasOwn$2(EmptyStringDescriptionStore, symbol)) return '';
8105
8510
  var string = symbolDescriptiveString(symbol);
8106
- var desc = NATIVE_SYMBOL ? stringSlice$4(string, 7, -1) : replace$3(string, regexp, '$1');
8511
+ var desc = NATIVE_SYMBOL ? stringSlice$3(string, 7, -1) : replace$3(string, regexp, '$1');
8107
8512
  return desc === '' ? undefined : desc;
8108
8513
  }
8109
8514
  });
8110
8515
 
8111
- $$c({ global: true, constructor: true, forced: true }, {
8516
+ $$a({ global: true, constructor: true, forced: true }, {
8112
8517
  Symbol: SymbolWrapper
8113
8518
  });
8114
8519
  }
8115
8520
 
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;
8521
+ var call$3 = functionCall;
8522
+ var fixRegExpWellKnownSymbolLogic = fixRegexpWellKnownSymbolLogic;
8523
+ var anObject$1 = anObject$t;
8524
+ var isNullOrUndefined = isNullOrUndefined$7;
8525
+ var toLength$2 = toLength$7;
8526
+ var toString$8 = toString$n;
8527
+ var requireObjectCoercible$3 = requireObjectCoercible$e;
8528
+ var getMethod = getMethod$7;
8529
+ var advanceStringIndex = advanceStringIndex$3;
8530
+ var regExpExec = regexpExecAbstract;
8126
8531
 
8127
8532
  // @@match logic
8128
- fixRegExpWellKnownSymbolLogic$1('match', function (MATCH, nativeMatch, maybeCallNative) {
8533
+ fixRegExpWellKnownSymbolLogic('match', function (MATCH, nativeMatch, maybeCallNative) {
8129
8534
  return [
8130
8535
  // `String.prototype.match` method
8131
8536
  // https://tc39.es/ecma262/#sec-string.prototype.match
8132
8537
  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));
8538
+ var O = requireObjectCoercible$3(this);
8539
+ var matcher = isNullOrUndefined(regexp) ? undefined : getMethod(regexp, MATCH);
8540
+ return matcher ? call$3(matcher, regexp, O) : new RegExp(regexp)[MATCH](toString$8(O));
8136
8541
  },
8137
8542
  // `RegExp.prototype[@@match]` method
8138
8543
  // https://tc39.es/ecma262/#sec-regexp.prototype-@@match
8139
8544
  function (string) {
8140
- var rx = anObject$4(this);
8141
- var S = toString$9(string);
8545
+ var rx = anObject$1(this);
8546
+ var S = toString$8(string);
8142
8547
  var res = maybeCallNative(nativeMatch, rx, S);
8143
8548
 
8144
8549
  if (res.done) return res.value;
8145
8550
 
8146
- if (!rx.global) return regExpExec$1(rx, S);
8551
+ if (!rx.global) return regExpExec(rx, S);
8147
8552
 
8148
8553
  var fullUnicode = rx.unicode;
8149
8554
  rx.lastIndex = 0;
8150
8555
  var A = [];
8151
8556
  var n = 0;
8152
8557
  var result;
8153
- while ((result = regExpExec$1(rx, S)) !== null) {
8154
- var matchStr = toString$9(result[0]);
8558
+ while ((result = regExpExec(rx, S)) !== null) {
8559
+ var matchStr = toString$8(result[0]);
8155
8560
  A[n] = matchStr;
8156
- if (matchStr === '') rx.lastIndex = advanceStringIndex$1(S, toLength$3(rx.lastIndex), fullUnicode);
8561
+ if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength$2(rx.lastIndex), fullUnicode);
8157
8562
  n++;
8158
8563
  }
8159
8564
  return n === 0 ? null : A;
@@ -8489,15 +8894,15 @@ function _objectWithoutPropertiesLoose(r, e) {
8489
8894
  }
8490
8895
 
8491
8896
  var toIntegerOrInfinity$1 = toIntegerOrInfinity$9;
8492
- var toString$8 = toString$n;
8493
- var requireObjectCoercible$3 = requireObjectCoercible$e;
8897
+ var toString$7 = toString$n;
8898
+ var requireObjectCoercible$2 = requireObjectCoercible$e;
8494
8899
 
8495
8900
  var $RangeError$1 = RangeError;
8496
8901
 
8497
8902
  // `String.prototype.repeat` method implementation
8498
8903
  // https://tc39.es/ecma262/#sec-string.prototype.repeat
8499
8904
  var stringRepeat = function repeat(count) {
8500
- var str = toString$8(requireObjectCoercible$3(this));
8905
+ var str = toString$7(requireObjectCoercible$2(this));
8501
8906
  var result = '';
8502
8907
  var n = toIntegerOrInfinity$1(count);
8503
8908
  if (n < 0 || n === Infinity) throw new $RangeError$1('Wrong number of repetitions');
@@ -8506,28 +8911,28 @@ var stringRepeat = function repeat(count) {
8506
8911
  };
8507
8912
 
8508
8913
  // 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;
8914
+ var uncurryThis$9 = functionUncurryThis;
8915
+ var toLength$1 = toLength$7;
8916
+ var toString$6 = toString$n;
8512
8917
  var $repeat = stringRepeat;
8513
- var requireObjectCoercible$2 = requireObjectCoercible$e;
8918
+ var requireObjectCoercible$1 = requireObjectCoercible$e;
8514
8919
 
8515
- var repeat = uncurryThis$a($repeat);
8516
- var stringSlice$3 = uncurryThis$a(''.slice);
8920
+ var repeat = uncurryThis$9($repeat);
8921
+ var stringSlice$2 = uncurryThis$9(''.slice);
8517
8922
  var ceil = Math.ceil;
8518
8923
 
8519
8924
  // `String.prototype.{ padStart, padEnd }` methods implementation
8520
8925
  var createMethod = function (IS_END) {
8521
8926
  return function ($this, maxLength, fillString) {
8522
- var S = toString$7(requireObjectCoercible$2($this));
8523
- var intMaxLength = toLength$2(maxLength);
8927
+ var S = toString$6(requireObjectCoercible$1($this));
8928
+ var intMaxLength = toLength$1(maxLength);
8524
8929
  var stringLength = S.length;
8525
- var fillStr = fillString === undefined ? ' ' : toString$7(fillString);
8930
+ var fillStr = fillString === undefined ? ' ' : toString$6(fillString);
8526
8931
  var fillLen, stringFiller;
8527
8932
  if (intMaxLength <= stringLength || fillStr === '') return S;
8528
8933
  fillLen = intMaxLength - stringLength;
8529
8934
  stringFiller = repeat(fillStr, ceil(fillLen / fillStr.length));
8530
- if (stringFiller.length > fillLen) stringFiller = stringSlice$3(stringFiller, 0, fillLen);
8935
+ if (stringFiller.length > fillLen) stringFiller = stringSlice$2(stringFiller, 0, fillLen);
8531
8936
  return IS_END ? S + stringFiller : stringFiller + S;
8532
8937
  };
8533
8938
  };
@@ -8542,13 +8947,13 @@ var userAgent$2 = engineUserAgent;
8542
8947
 
8543
8948
  var stringPadWebkitBug = /Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(userAgent$2);
8544
8949
 
8545
- var $$b = _export;
8950
+ var $$9 = _export;
8546
8951
  var $padStart = stringPad.start;
8547
8952
  var WEBKIT_BUG = stringPadWebkitBug;
8548
8953
 
8549
8954
  // `String.prototype.padStart` method
8550
8955
  // https://tc39.es/ecma262/#sec-string.prototype.padstart
8551
- $$b({ target: 'String', proto: true, forced: WEBKIT_BUG }, {
8956
+ $$9({ target: 'String', proto: true, forced: WEBKIT_BUG }, {
8552
8957
  padStart: function padStart(maxLength /* , fillString = ' ' */) {
8553
8958
  return $padStart(this, maxLength, arguments.length > 1 ? arguments[1] : undefined);
8554
8959
  }
@@ -9517,130 +9922,37 @@ const GoABaseInputReviewComponent = props => {
9517
9922
  }
9518
9923
  }
9519
9924
  if (isTime) {
9520
- reviewText = reviewText && to12HourFormat(reviewText);
9521
- }
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;
9925
+ reviewText = reviewText && to12HourFormat(reviewText);
9635
9926
  }
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');
9927
+ if (isDateTime) {
9928
+ reviewText = reviewText && UTCToFullLocalTime(reviewText);
9929
+ }
9930
+ if (Array.isArray(data) && data.length > 0) {
9931
+ reviewText = jsx("ul", {
9932
+ children: data.map((checkbox, index) => {
9933
+ const checkboxLabel = getFallbackCheckboxLabel();
9934
+ return jsx("li", {
9935
+ children: checkbox.trim() || checkboxLabel
9936
+ }, index);
9937
+ })
9938
+ });
9939
+ }
9940
+ return jsxs("div", {
9941
+ style: {
9942
+ fontWeight: '400',
9943
+ textWrap: 'wrap',
9944
+ wordBreak: 'break-word'
9945
+ },
9946
+ "data-testid": `review-control-${id}`,
9947
+ children: [reviewText, renderRequiredLabel(), renderWarningMessage()]
9948
+ });
9949
+ };
9950
+ const GoInputBaseReview = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
9951
+ input: GoABaseInputReviewComponent,
9952
+ isStepperReview: true,
9953
+ skipInitialValidation: true
9954
+ }));
9955
+ const GoAInputBaseReviewControl = withJsonFormsControlProps(GoInputBaseReview);
9644
9956
 
9645
9957
  var tryToString = tryToString$5;
9646
9958
 
@@ -9650,7 +9962,7 @@ var deletePropertyOrThrow$2 = function (O, P) {
9650
9962
  if (!delete O[P]) throw new $TypeError('Cannot delete property ' + tryToString(P) + ' of ' + tryToString(O));
9651
9963
  };
9652
9964
 
9653
- var $$9 = _export;
9965
+ var $$8 = _export;
9654
9966
  var toObject$3 = toObject$c;
9655
9967
  var lengthOfArrayLike$3 = lengthOfArrayLike$c;
9656
9968
  var setArrayLength = arraySetLength;
@@ -9674,7 +9986,7 @@ var FORCED$2 = INCORRECT_RESULT || !properErrorOnNonWritableLength();
9674
9986
 
9675
9987
  // `Array.prototype.unshift` method
9676
9988
  // https://tc39.es/ecma262/#sec-array.prototype.unshift
9677
- $$9({ target: 'Array', proto: true, arity: 1, forced: FORCED$2 }, {
9989
+ $$8({ target: 'Array', proto: true, arity: 1, forced: FORCED$2 }, {
9678
9990
  // eslint-disable-next-line no-unused-vars -- required for `.length`
9679
9991
  unshift: function unshift(item) {
9680
9992
  var O = toObject$3(this);
@@ -9695,62 +10007,6 @@ $$9({ target: 'Array', proto: true, arity: 1, forced: FORCED$2 }, {
9695
10007
  }
9696
10008
  });
9697
10009
 
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
10010
  let _$8 = t => t,
9755
10011
  _t$9,
9756
10012
  _t2$4,
@@ -11382,181 +11638,70 @@ const GoAInputBaseTableReview = props => {
11382
11638
  if (required && isNilOrEmptyValue(data, true)) {
11383
11639
  // clean-code-ignore: 2.18
11384
11640
  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);
11641
+ }
11642
+ 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');
11643
+ if (isRegisterBackedEnumFalsePositive) {
11644
+ activeError = undefined;
11645
+ }
11646
+ if (activeError && /\sis required$/i.test(activeError)) {
11647
+ activeError = `${labelToUpdate} is required`;
11648
+ }
11649
+ // For required boolean fields (e.g. anyOf: [{enum: [true]}]), suppress the raw AJV
11650
+ // "must be equal to one of the allowed values" error and show a friendly message instead.
11651
+ if ((schema == null ? void 0 : schema.type) === 'boolean' && activeError && activeError.toLowerCase().includes('must be equal')) {
11652
+ activeError = data === false ? `${labelToUpdate} is required` : undefined;
11653
+ }
11654
+ // If a required checkbox is unchecked, show only the validation message in
11655
+ // review mode (not a contradictory "No (...)" value line).
11656
+ let isBooleanRequiredError = false;
11657
+ if ((schema == null ? void 0 : schema.type) === 'boolean' && data === false && activeError && /\sis required$/i.test(activeError)) {
11658
+ reviewText = '';
11659
+ isBooleanRequiredError = true;
11660
+ }
11661
+ // eslint-disable-next-line
11662
+ const stepId = (_uischema$options5 = uischema.options) == null ? void 0 : _uischema$options5.stepId;
11663
+ function handleChangeClick() {
11664
+ context == null || context.goToPage(stepId, uischema.scope);
11665
+ reviewCtx == null || reviewCtx.onChangeDispatch(stepId, uischema.scope);
11666
+ }
11667
+ const showInlineValue = reviewText === null || reviewText === undefined || typeof reviewText === 'string' || typeof reviewText === 'number' || /*#__PURE__*/React.isValidElement(reviewText) || Array.isArray(reviewText) && reviewText.length === 0;
11668
+ const isValueEmpty = !isBooleanRequiredError && (reviewText === null || reviewText === undefined || reviewText === '' || Array.isArray(reviewText) && reviewText.length === 0);
11669
+ return jsx("tr", {
11670
+ "data-testid": `input-base-table-${label}-row`,
11671
+ children: jsxs(PageReviewContainer, {
11672
+ colSpan: 3,
11673
+ children: [jsxs(ReviewHeader, {
11674
+ children: [jsxs(ReviewLabel, {
11675
+ children: [labelToUpdate, required && jsx(RequiredTextLabel, {
11676
+ children: " (required)"
11677
+ })]
11678
+ }), stepId !== undefined && !((_uischema$options6 = uischema.options) != null && (_uischema$options6 = _uischema$options6.componentProps) != null && _uischema$options6.readOnly) && jsx(GoabButton, {
11679
+ type: "tertiary",
11680
+ onClick: handleChangeClick,
11681
+ children: "Change"
11682
+ })]
11683
+ }), jsxs(ReviewValue, {
11684
+ children: [showInlineValue ? jsx("div", {
11685
+ "data-testid": `review-value-${label}`,
11686
+ children: isValueEmpty ? jsx(NoneGivenText, {
11687
+ children: "(none given)"
11688
+ }) : reviewText != null ? reviewText : ''
11689
+ }) : jsx(JsonFormsDispatch, {
11690
+ "data-testid": `jsonforms-object-list-defined-elements-dispatch`,
11691
+ schema: schema,
11692
+ uischema: uischema,
11693
+ enabled: enabled,
11694
+ renderers: jsonForms.renderers,
11695
+ cells: cells
11696
+ }), activeError && jsx(GoabFormItem, {
11697
+ error: activeError,
11698
+ label: ""
11699
+ })]
11700
+ })]
11701
+ })
11702
+ });
11703
+ };
11704
+ const GoAInputBaseTableReviewControl = withJsonFormsControlProps(GoAInputBaseTableReview);
11560
11705
 
11561
11706
  const defaultLabel = 'Email address';
11562
11707
  const GoAEmailInput = props => {
@@ -15345,7 +15490,7 @@ const ApplicationStatus = ({
15345
15490
  icon: false
15346
15491
  });
15347
15492
  const mainHeading = 'Application Progress';
15348
- const progressPercentageAccurate = 100 * completed / totalGroups;
15493
+ const progressPercentageAccurate = totalGroups > 0 ? 100 * completed / totalGroups : 0;
15349
15494
  return jsxs(CompletionStatus, {
15350
15495
  children: [jsxs(CompletionTextHeader, {
15351
15496
  children: [mainHeading, jsx(BadgeWrapper, {
@@ -15372,6 +15517,26 @@ const ApplicationStatus = ({
15372
15517
  });
15373
15518
  };
15374
15519
 
15520
+ var PageStatus;
15521
+ (function (PageStatus) {
15522
+ PageStatus["Complete"] = "Completed";
15523
+ PageStatus["Inprogress"] = "In progress";
15524
+ PageStatus["NotStarted"] = "Not started";
15525
+ })(PageStatus || (PageStatus = {}));
15526
+ const getCategoryStatus = category => {
15527
+ return category.isVisited ? category.isCompleted && category.isValid ? PageStatus.Complete : PageStatus.Inprogress : PageStatus.NotStarted;
15528
+ };
15529
+ const getCategoryStatusBadge = category => {
15530
+ const status = getCategoryStatus(category);
15531
+ const badgeType = status === PageStatus.Complete ? 'success' : 'information';
15532
+ return jsx(GoabBadge, {
15533
+ type: badgeType,
15534
+ content: status,
15535
+ ariaLabel: status,
15536
+ icon: false
15537
+ });
15538
+ };
15539
+
15375
15540
  const getCategorySections = categories => {
15376
15541
  const sectionMap = new Map();
15377
15542
  categories.forEach(category => {
@@ -15406,26 +15571,6 @@ const SectionHeaderRow = ({
15406
15571
  });
15407
15572
  };
15408
15573
 
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
15574
  /* eslint-disable jsx-a11y/anchor-is-valid */
15430
15575
  const CategoryRow = ({
15431
15576
  category,
@@ -15563,6 +15708,17 @@ function updateCompletion(group, index) {
15563
15708
  isValid: newIsCompleted ? category.isValid : false
15564
15709
  });
15565
15710
  }
15711
+ // The rows the progress bar is counting: the ones actually rendered in the task list.
15712
+ const isCounted = cat => shouldShow(cat) && (cat == null ? void 0 : cat.visible) !== false;
15713
+ // A page counts as completed only when its own badge says so. A page with no required fields is
15714
+ // flagged isCompleted on mount (so an untouched optional page does not block submission), while its
15715
+ // badge still reads "Not started" - counting isCompleted alone credits pages the user never opened.
15716
+ // updateCompletion rolls up the detail pages hidden from the task list, exactly as the rendered row
15717
+ // does, so the count never runs ahead of the badges.
15718
+ const isCountedComplete = (group, index) => getCategoryStatus(updateCompletion(group, index)) === PageStatus.Complete;
15719
+ const countCountedPages = group => group.filter(isCounted).length;
15720
+ const countCompletedPages = group => group.filter((cat, index) => isCounted(cat) && isCountedComplete(group, index)).length;
15721
+ const sumOverSections = (sections, count) => sections.reduce((total, section) => total + count(section.categories), 0);
15566
15722
  const TaskList = ({
15567
15723
  categories,
15568
15724
  onClick,
@@ -15589,8 +15745,8 @@ const TaskList = ({
15589
15745
  const sections = mergeOrphanSections(getCategorySections(categories));
15590
15746
  return sections;
15591
15747
  }, [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]);
15748
+ const totalPages = useMemo(() => sumOverSections(mergedSections, countCountedPages), [mergedSections]);
15749
+ const completedPages = useMemo(() => sumOverSections(mergedSections, countCompletedPages), [mergedSections]);
15594
15750
  let globalIndex = 0;
15595
15751
  let sectionIndex = 1;
15596
15752
  return jsx(PageBorder, {
@@ -19777,158 +19933,6 @@ async function tryResolveRefs(schema, ...refSchemas) {
19777
19933
  }
19778
19934
  }
19779
19935
 
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
19936
  const GoABaseRenderers = [
19933
19937
  // controls
19934
19938
  {