@abgov/jsonforms-components 1.57.1 → 1.58.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.esm.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import * as runtime from 'react/jsx-runtime';
2
2
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
3
3
  import React, { createContext, useContext, useReducer, useMemo, useEffect, useState, useRef, useCallback } from 'react';
4
- import { GoAFormItem, GoAInput, GoATextArea, GoACallout, GoAInputDate, GoAInputDateTime, GoAInputTime, GoARadioGroup, GoARadioItem, GoACheckbox, GoAIcon, GoAGrid, GoAFormStepper, GoAFormStep, GoAPages, GoAButton, GoAModal, GoAButtonGroup, GoAIconButton, GoAFileUploadInput, GoACircularProgress, GoAContainer, GoATable, GoADropdown, GoADropdownItem, GoADetails, GoASpinner } from '@abgov/react-components';
4
+ import { GoAFormItem, GoAInput, GoATextArea, GoACallout, GoAInputDate, GoAInputDateTime, GoAInputTime, GoARadioGroup, GoARadioItem, GoACheckbox, GoAIcon, GoAButton, GoAGrid, GoAFormStepper, GoAFormStep, GoAPages, GoAModal, GoAButtonGroup, GoATable, GoAIconButton, GoAFileUploadInput, GoACircularProgress, GoAContainer, GoADropdown, GoADropdownItem, GoADetails, GoASpinner } from '@abgov/react-components';
5
5
  import styled from 'styled-components';
6
6
  import axios from 'axios';
7
7
  import get$1 from 'lodash/get';
8
- import { rankWith, isStringControl, and, optionIs, uiTypeIs, isDateControl, isNumberControl, isIntegerControl, isDateTimeControl, isTimeControl, isEnumControl, isBooleanControl, getAjv, isVisible, getControlPath, toDataPath, deriveLabelForUISchemaElement, isEnabled, schemaTypeIs, formatIs, createDefaultValue, or, isObjectArrayControl, isPrimitiveArrayControl, Paths, schemaMatches, hasType, isControl, isCategorization, isLayout } from '@jsonforms/core';
8
+ import { rankWith, isStringControl, and, optionIs, uiTypeIs, isDateControl, isNumberControl, isIntegerControl, isDateTimeControl, isTimeControl, isEnumControl, isBooleanControl, getControlPath, toDataPath, deriveLabelForUISchemaElement, isEnabled, getAjv, isVisible, schemaTypeIs, formatIs, createDefaultValue, or, isObjectArrayControl, isPrimitiveArrayControl, Paths, schemaMatches, hasType, isControl, isCategorization, isLayout } from '@jsonforms/core';
9
9
  import { withJsonFormsControlProps, withJsonFormsRendererProps, withJsonFormsEnumProps, withTranslateProps, useJsonForms, JsonFormsDispatch, withJsonFormsLayoutProps, withJsonFormsArrayLayoutProps, withJsonFormsCellProps } from '@jsonforms/react';
10
10
  import * as _$c from 'lodash';
11
11
  import { isEqual, isObject as isObject$f } from 'lodash';
@@ -3800,7 +3800,11 @@ const JsonFormRegisterProvider = ({
3800
3800
  let _$a = t => t,
3801
3801
  _t$a,
3802
3802
  _t2$6,
3803
- _t3$5;
3803
+ _t3$5,
3804
+ _t4$5,
3805
+ _t5$3,
3806
+ _t6$3,
3807
+ _t7$2;
3804
3808
  const FormFieldWrapper = styled.div(_t$a || (_t$a = _$a`
3805
3809
  margin-bottom: var(--goa-space-l);
3806
3810
  `));
@@ -3818,6 +3822,23 @@ const RequiredTextLabel = styled.label(_t3$5 || (_t3$5 = _$a`
3818
3822
  line-height: var(--goa-line-height-1);
3819
3823
  font-style: normal;
3820
3824
  `));
3825
+ const PageReviewNameCol = styled.td(_t4$5 || (_t4$5 = _$a`
3826
+ width: 70%;
3827
+ padding-top: var(--goa-space-s);
3828
+ padding-bottom: var(--goa-space-s);
3829
+ padding-right: var(--goa-space-m);
3830
+ `));
3831
+ const PageReviewValueCol = styled.td(_t5$3 || (_t5$3 = _$a`
3832
+ width: 20%;
3833
+ text-align: left;
3834
+ `));
3835
+ const PageReviewActionCol = styled.td(_t6$3 || (_t6$3 = _$a`
3836
+ width: 10%;
3837
+ `));
3838
+ //Check and unchecked are different heights otherwise
3839
+ const CheckboxWrapper = styled.div(_t7$2 || (_t7$2 = _$a`
3840
+ height: 28px;
3841
+ `));
3821
3842
 
3822
3843
  const GoAInputBaseControl = props => {
3823
3844
  var _a, _b;
@@ -5057,19 +5078,21 @@ const BooleanComponent = ({
5057
5078
  }) => {
5058
5079
  var _a, _b, _c;
5059
5080
  const text = `${((_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.text) ? (_b = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _b === void 0 ? void 0 : _b.text : (schema === null || schema === void 0 ? void 0 : schema.title) ? schema === null || schema === void 0 ? void 0 : schema.title : schema === null || schema === void 0 ? void 0 : schema.description}${required ? ' (required)' : ''}`;
5060
- return jsx(GoACheckbox, Object.assign({
5061
- error: isVisited && errors.length > 0,
5062
- testId: `${path}-checkbox-test-id`,
5063
- disabled: !enabled,
5064
- text: text && text !== 'undefined' ? text : convertToReadableFormat(getLastSegmentFromPointer(uischema.scope)),
5065
- name: `${path}`,
5066
- checked: data,
5067
- onChange: (_, checked) => {
5068
- handleChange(path, checked);
5069
- }
5070
- }, (_c = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _c === void 0 ? void 0 : _c.componentProps, {
5071
- mb: "none"
5072
- }));
5081
+ return jsx(CheckboxWrapper, {
5082
+ children: jsx(GoACheckbox, Object.assign({
5083
+ error: isVisited && errors.length > 0,
5084
+ testId: `${path}-checkbox-test-id`,
5085
+ disabled: !enabled,
5086
+ text: text && text !== 'undefined' ? text : convertToReadableFormat(getLastSegmentFromPointer(uischema.scope)),
5087
+ name: `${path}`,
5088
+ checked: data,
5089
+ onChange: (_, checked) => {
5090
+ handleChange(path, checked);
5091
+ }
5092
+ }, (_c = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _c === void 0 ? void 0 : _c.componentProps, {
5093
+ mb: "none"
5094
+ }))
5095
+ });
5073
5096
  };
5074
5097
  const BooleanControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
5075
5098
  input: BooleanComponent
@@ -5158,10 +5181,9 @@ const CheckBoxGroupDiv = styled.div(_t$8 || (_t$8 = _$8`
5158
5181
  `));
5159
5182
 
5160
5183
  const CheckboxGroup = props => {
5161
- var _a, _b;
5184
+ var _a, _b, _c;
5162
5185
  const {
5163
5186
  data,
5164
- className,
5165
5187
  id,
5166
5188
  schema,
5167
5189
  uischema,
@@ -5172,10 +5194,11 @@ const CheckboxGroup = props => {
5172
5194
  label,
5173
5195
  t
5174
5196
  } = props;
5175
- const enumData = (schema === null || schema === void 0 ? void 0 : schema.enum) || [];
5197
+ const newSchema = schema;
5198
+ const enumData = (schema === null || schema === void 0 ? void 0 : schema.enum) || ((_a = newSchema === null || newSchema === void 0 ? void 0 : newSchema.items) === null || _a === void 0 ? void 0 : _a.enum) || [];
5176
5199
  const appliedUiSchemaOptions = merge({}, config, props.uischema.options, options);
5177
5200
  return jsx(Checkboxes, {
5178
- orientation: ((_a = uischema.options) === null || _a === void 0 ? void 0 : _a.orientation) ? (_b = uischema.options) === null || _b === void 0 ? void 0 : _b.orientation : 'vertical',
5201
+ orientation: ((_b = uischema.options) === null || _b === void 0 ? void 0 : _b.orientation) ? (_c = uischema.options) === null || _c === void 0 ? void 0 : _c.orientation : 'vertical',
5179
5202
  testId: `${label || id}-jsonforms-checkboxes`,
5180
5203
  children: enumData.map(enumValue => {
5181
5204
  return jsx(GoACheckbox, Object.assign({
@@ -5186,7 +5209,13 @@ const CheckboxGroup = props => {
5186
5209
  text: enumValue,
5187
5210
  testId: `${enumValue}-checkbox`,
5188
5211
  onChange: (name, value) => {
5189
- handleChange(path, value === 'true' ? 'Yes' : 'No');
5212
+ let newData = Array.isArray(data) ? [...data] : [];
5213
+ if (value) {
5214
+ newData.push(enumValue);
5215
+ } else {
5216
+ newData = newData.filter(item => item !== enumValue);
5217
+ }
5218
+ handleChange(path, newData);
5190
5219
  }
5191
5220
  }));
5192
5221
  })
@@ -5198,7 +5227,7 @@ const EnumCheckboxControl = props => {
5198
5227
  }));
5199
5228
  };
5200
5229
  const GoAEnumCheckboxGroupControl = withJsonFormsEnumProps(withTranslateProps(EnumCheckboxControl), true);
5201
- const GoACheckoutGroupControlTester = rankWith(18, and(isEnumControl, optionIs('format', 'checkbox')));
5230
+ const GoACheckoutGroupControlTester = rankWith(18, and(optionIs('format', 'checkbox')));
5202
5231
 
5203
5232
  const warningIcon = errorMessage => {
5204
5233
  return jsxs(WarningIconDiv, {
@@ -5206,7 +5235,8 @@ const warningIcon = errorMessage => {
5206
5235
  type: "warning",
5207
5236
  size: "small",
5208
5237
  theme: "filled",
5209
- mt: "2xs"
5238
+ mt: "2xs",
5239
+ ariaLabel: "warning"
5210
5240
  }), errorMessage]
5211
5241
  });
5212
5242
  };
@@ -5267,888 +5297,974 @@ const GoInputBaseReview = props => jsx(GoAInputBaseControl, Object.assign({}, pr
5267
5297
  }));
5268
5298
  const GoInputBaseReviewControl = withJsonFormsControlProps(GoInputBaseReview);
5269
5299
 
5270
- let _$7 = t => t,
5271
- _t$7;
5272
- const renderLayoutElements = (elements, schema, path, enabled, renderers, cells) => {
5273
- return elements.map((child, index) => jsx("div", {
5274
- children: jsx(JsonFormsDispatch, {
5275
- uischema: child,
5276
- schema: schema,
5277
- path: path,
5278
- enabled: enabled,
5279
- renderers: renderers,
5280
- cells: cells
5281
- }, path)
5282
- }, index));
5283
- };
5284
- const withAjvProps = Component => function WithAjvProps(props) {
5285
- const ctx = useJsonForms();
5286
- const ajv = getAjv({
5287
- jsonforms: Object.assign({}, ctx)
5288
- });
5289
- return jsx(Component, Object.assign({}, props, {
5290
- ajv: ajv
5291
- }));
5292
- };
5293
- const LayoutRenderer = ({
5294
- elements,
5295
- schema,
5296
- path,
5297
- enabled,
5298
- direction,
5299
- renderers,
5300
- cells,
5301
- visible,
5302
- width
5303
- }) => {
5304
- if (isEmpty(elements)) {
5305
- return null;
5306
- } else {
5307
- if (direction === 'row') {
5308
- return jsx(Visible, {
5309
- visible: visible,
5310
- children: jsx(GoAGrid, {
5311
- minChildWidth: width || '10ch',
5312
- children: renderLayoutElements(elements, schema, path, enabled, renderers, cells)
5313
- })
5314
- });
5315
- } else {
5316
- return jsx(Visible, {
5317
- visible: visible,
5318
- children: renderLayoutElements(elements, schema, path, enabled, renderers, cells)
5319
- });
5300
+ // eslint-disable-next-line
5301
+ const getProperty = (obj, propName) => {
5302
+ if (obj[propName] !== undefined) return obj[propName];
5303
+ for (const key in obj) {
5304
+ if (typeof obj[key] === 'object' && obj[key] !== null) {
5305
+ const result = getProperty(obj[key], propName);
5306
+ if (result !== undefined) return result;
5320
5307
  }
5321
5308
  }
5322
5309
  };
5323
- const ReviewLayoutRenderer = ({
5324
- elements,
5325
- schema,
5326
- path,
5327
- enabled,
5328
- direction,
5329
- renderers,
5330
- cells,
5331
- visible,
5332
- width
5333
- }) => {
5334
- if (isEmpty(elements)) {
5335
- return null;
5336
- } else {
5337
- if (direction === 'row') {
5338
- return jsx(Visible, {
5339
- visible: visible,
5340
- children: jsx(ReviewGrid, {
5341
- children: renderLayoutElements(elements, schema, path, enabled, renderers, cells)
5342
- })
5343
- });
5344
- } else {
5345
- return jsx(Visible, {
5346
- visible: visible,
5347
- children: renderLayoutElements(elements, schema, path, enabled, renderers, cells)
5310
+ // eslint-disable-next-line
5311
+ const pickPropertyValues = (obj, property, endWithType) => {
5312
+ let values = [];
5313
+ Object.keys(obj).forEach(function (key) {
5314
+ var _a;
5315
+ if (key === property) {
5316
+ values.push(obj[key]);
5317
+ } else if (_$c.isObject(obj[key])) {
5318
+ // if the object type is equal to end type, we are not going to continue the recursive approach
5319
+ if (endWithType && ((_a = obj[key]) === null || _a === void 0 ? void 0 : _a.type) === endWithType) {
5320
+ if (property in obj[key]) {
5321
+ values.push(obj[key][property]);
5322
+ }
5323
+ } else {
5324
+ values = [...values, ...pickPropertyValues(obj[key], property, endWithType)];
5325
+ }
5326
+ } else if (_$c.isArray(obj[key])) {
5327
+ const nextValues = obj[key].map(function (arrayObj) {
5328
+ return pickPropertyValues(arrayObj, property, endWithType);
5348
5329
  });
5330
+ values = [...values, ...nextValues];
5349
5331
  }
5350
- }
5332
+ });
5333
+ return values;
5351
5334
  };
5352
- const ReviewGrid = styled.div(_t$7 || (_t$7 = _$7`
5353
- display: grid;
5354
- grid-template-columns: repeat(auto-fit, minmax(250px, calc(50% - 8px)));
5355
- gap: 16px;
5356
- `));
5357
5335
 
5358
- let _$6 = t => t,
5359
- _t$6,
5360
- _t2$4,
5361
- _t3$3,
5362
- _t4$3,
5363
- _t5$2,
5364
- _t6$2,
5365
- _t7$1,
5366
- _t8$1,
5367
- _t9$1,
5368
- _t10$1,
5369
- _t11$1,
5370
- _t12$1,
5371
- _t13$1;
5372
- const ReviewItem = styled.div(_t$6 || (_t$6 = _$6`
5373
- display: flex;
5374
- flex-direction: column;
5375
- border: var(--goa-border-width-s) solid grey;
5376
- border-radius: var(--goa-border-radius-m);
5377
- margin: var(--goa-space-2xs);
5378
- padding: var(--goa-space-xs);
5379
- div:empty {
5380
- display: none;
5336
+ const isErrorPathIncluded = (errorPaths, path) => {
5337
+ return errorPaths.some(ePath => {
5338
+ /**
5339
+ * case A: errorPaths: [name] path: [name]
5340
+ *
5341
+ * case B: errorPath: [name] path: [name.firstName]
5342
+ * */
5343
+ return ePath === path || path.startsWith(ePath + '.');
5344
+ });
5345
+ };
5346
+ function isNumber(value) {
5347
+ return value != null && value !== '' && !isNaN(Number(value.toString()));
5348
+ }
5349
+ const getIncompletePaths = (ajv, scopes) => {
5350
+ var _a;
5351
+ const requiredErrorPaths = (_a = ajv === null || ajv === void 0 ? void 0 : ajv.errors) === null || _a === void 0 ? void 0 : _a.filter(e => e.keyword === 'required' || e.keyword === 'minLength').map(e => {
5352
+ return getControlPath(e);
5353
+ });
5354
+ const _scopes = scopes.map(scope => toDataPath(scope)).filter(path => requiredErrorPaths && isErrorPathIncluded(requiredErrorPaths, path));
5355
+ return _scopes;
5356
+ };
5357
+ const subErrorInParent = (error, paths) => {
5358
+ /*
5359
+ Detect is there sub error in an object array.
5360
+ For example: error with instance path /roadmap/0/when belongs to /roadmap
5361
+ */
5362
+ const errorPaths = error.instancePath.split('/');
5363
+ if (errorPaths.length < 2) return false;
5364
+ // For case /roadmap/0
5365
+ if (errorPaths.length > 1 && isNumber(errorPaths[errorPaths.length - 1])) {
5366
+ const parentPath = errorPaths.slice(0, errorPaths.length - 1).join('/');
5367
+ return paths.includes(parentPath);
5381
5368
  }
5382
- `));
5383
- const ReviewItemSection = styled.div(_t2$4 || (_t2$4 = _$6`
5384
- background-color: #f1f1f1;
5385
- margin-bottom: var(--goa-space-m);
5386
- padding: var(--goa-space-m);
5387
- border: 1px solid #dcdcdc;
5388
- border-radius: 5px;
5389
-
5390
- .element-style {
5391
- max-width: 1600px;
5369
+ // For case /roadmap/0/when
5370
+ if (errorPaths.length > 2 && isNumber(errorPaths[errorPaths.length - 2])) {
5371
+ const parentPath = errorPaths.slice(0, errorPaths.length - 2).join('/');
5372
+ return paths.includes(parentPath);
5392
5373
  }
5393
- `));
5394
- const ReviewItemHeader = styled.div(_t3$3 || (_t3$3 = _$6`
5395
- display: flex;
5396
- align-items: center;
5397
- justify-content: space-between;
5398
- margin-bottom: var(--goa-space-xl);
5399
- `));
5400
- const ReviewItemTitle = styled.div(_t4$3 || (_t4$3 = _$6`
5401
- font-size: var(--goa-space-l);
5402
- line-height: var(--goa-space-xl);
5403
- font-weight: 300;
5404
- `));
5405
- const Anchor = styled.div(_t5$2 || (_t5$2 = _$6`
5406
- color: #0070c4;
5407
- text-decoration: underline;
5408
- outline: none;
5409
- cursor: pointer;
5374
+ return false;
5375
+ };
5376
+ const getErrorsInScopes = (errors, scopes) => {
5377
+ return errors.filter(e => {
5378
+ // transfer scope #properties/value to data path /value
5379
+ const dataPaths = scopes.map(s => '/' + toDataPath(s));
5380
+ return dataPaths.includes(e.instancePath) || subErrorInParent(e, dataPaths);
5381
+ });
5382
+ };
5410
5383
 
5411
- &:focus {
5412
- outline: 2px solid #0070c4;
5413
- background-color: #e6f7ff;
5414
- }
5415
- `));
5416
- styled.div(_t6$2 || (_t6$2 = _$6`
5417
- margin-left: var(--goa-space-m);
5418
- `));
5419
- styled.div(_t7$1 || (_t7$1 = _$6`
5420
- margin-bottom: var(--goa-space-m);
5421
- `));
5422
- styled.div(_t8$1 || (_t8$1 = _$6`
5423
- margin: var(--goa-space-s);
5424
- width: 100%;
5425
- `));
5426
- styled.h3(_t9$1 || (_t9$1 = _$6`
5427
- text-transform: capitalize;
5428
- `));
5429
- const RightAlignmentDiv = styled.div(_t10$1 || (_t10$1 = _$6`
5430
- @media screen and (max-width: 767px) {
5431
- margin-bottom: var(--goa-space-l);
5432
- }
5433
- @media screen and (min-width: 768px) {
5434
- display: flex;
5435
- justify-content: flex-end;
5436
- margin-bottom: var(--goa-space-l);
5437
- }
5438
- `));
5439
- const FormStepperSummaryH3 = styled.h3(_t11$1 || (_t11$1 = _$6`
5440
- flex: 1;
5441
- margin-bottom: var(--goa-space-m);
5442
- font-size: var(--goa-font-size-7);
5443
- line-height: var(--goa-line-height-4);
5444
- font-weight: var(--goa-font-weight-regular);
5445
- `));
5446
- const PageRenderPadding = styled.h3(_t12$1 || (_t12$1 = _$6`
5447
- margin-top: var(--goa-space-2xl);
5448
- `));
5449
- const PageBorder = styled.h3(_t13$1 || (_t13$1 = _$6`
5450
- padding: var(--goa-space-3xl);
5451
- `));
5452
-
5453
- class ContextProviderClass {
5454
- addDataByUrl(key, url, processDataFunction, token) {
5455
- return __awaiter(this, void 0, void 0, function* () {
5456
- let header = {};
5457
- const [requestId, axiosWithConfig] = this.getAxiosInterceptorConfig(axios);
5458
- if (token) {
5459
- header = Object.assign(Object.assign({}, header), {
5460
- Authorization: `Bearer ${token}`
5461
- });
5384
+ const stepperReducer = (state, action) => {
5385
+ var _a, _b;
5386
+ const {
5387
+ activeId,
5388
+ categories
5389
+ } = state;
5390
+ const lastId = categories[categories.length - 1].id;
5391
+ switch (action.type) {
5392
+ case 'update/uischema':
5393
+ {
5394
+ return Object.assign({}, action.payload.state);
5462
5395
  }
5463
- yield axiosWithConfig.get(url, header).then(response => {
5464
- const processedData = processDataFunction(response.data);
5465
- this.enumValues.set(key, () => processedData);
5466
- }).catch(err => {
5467
- if (err.message.includes('CORS')) {
5468
- console.warn(err.message);
5396
+ case 'page/next':
5397
+ {
5398
+ state.activeId += 1;
5399
+ if (activeId === lastId) {
5400
+ state.isOnReview = true;
5401
+ state.hasNextButton = false;
5402
+ state.hasPrevButton = false;
5469
5403
  } else {
5470
- console.warn(`addDataByUrl: ${err.message}`);
5404
+ state.hasNextButton = true;
5405
+ state.hasPrevButton = true;
5406
+ state.isOnReview = false;
5471
5407
  }
5472
- });
5473
- axiosWithConfig.interceptors.request.eject(requestId);
5474
- });
5475
- }
5476
- constructor() {
5477
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
5478
- this.enumValues = new Map();
5479
- this.enumFunctions = new Map();
5480
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
5481
- this.enumSubmitFunctions = new Map();
5482
- this.addFormContextData = (key, data) => {
5483
- this.enumValues.set(key, () => data);
5484
- };
5485
- this.setup = props => {
5486
- var _a, _b;
5487
- this.selfProps = props;
5488
- if (props.fileManagement) {
5489
- const {
5490
- fileList,
5491
- uploadFile,
5492
- downloadFile,
5493
- deleteFile
5494
- } = props.fileManagement;
5495
- this.enumValues.set('file-list', () => fileList);
5496
- this.enumFunctions.set('upload-file', () => uploadFile);
5497
- this.enumFunctions.set('download-file', () => downloadFile);
5498
- this.enumFunctions.set('delete-file', () => deleteFile);
5408
+ state.categories[activeId].isVisited = true;
5409
+ return Object.assign({}, state);
5499
5410
  }
5500
- if (props.submit) {
5411
+ case 'page/prev':
5412
+ {
5413
+ state.categories[activeId].isVisited = true;
5414
+ if (activeId > 0) {
5415
+ state.activeId -= 1;
5416
+ state.hasPrevButton = state.activeId !== 0;
5417
+ state.hasNextButton = true;
5418
+ state.isOnReview = false;
5419
+ }
5420
+ return Object.assign({}, state);
5421
+ }
5422
+ case 'page/to/index':
5423
+ {
5501
5424
  const {
5502
- submitForm
5503
- } = props.submit;
5504
- const submitFunction = submitForm;
5505
- this.enumSubmitFunctions.set('submit-form', () => submitFunction);
5425
+ id
5426
+ } = action.payload;
5427
+ state.activeId = id;
5428
+ if (id > lastId) {
5429
+ state.isOnReview = true;
5430
+ state.hasNextButton = false;
5431
+ state.hasPrevButton = true;
5432
+ return Object.assign({}, state);
5433
+ } else {
5434
+ state.categories[id].isVisited = true;
5435
+ state.hasNextButton = id <= lastId;
5436
+ state.hasPrevButton = id !== 0;
5437
+ state.isOnReview = false;
5438
+ state.maxReachedStep = Math.max(state.maxReachedStep, activeId);
5439
+ return Object.assign({}, state);
5440
+ }
5506
5441
  }
5507
- if (props.data) {
5508
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
5509
- Object.keys(props.data).forEach(item => {
5510
- this.enumValues.set(item, () => props.data[item]);
5511
- });
5442
+ case 'update/category':
5443
+ {
5444
+ const {
5445
+ id,
5446
+ ajv,
5447
+ errors
5448
+ } = action.payload;
5449
+ if (id === state.categories.length) {
5450
+ return Object.assign({}, state);
5451
+ }
5452
+ /*
5453
+ ctx.core.errors only includes required errors when the fields are touched. In this case, we still ajv to figure out the required errors at the very beginning.
5454
+ */
5455
+ const incompletePaths = getIncompletePaths(ajv, ((_a = state.categories[id]) === null || _a === void 0 ? void 0 : _a.scopes) || []);
5456
+ const errorsInCategory = getErrorsInScopes(errors, ((_b = state.categories[id]) === null || _b === void 0 ? void 0 : _b.scopes) || []);
5457
+ state.categories[id].isCompleted = (incompletePaths === null || incompletePaths === void 0 ? void 0 : incompletePaths.length) === 0;
5458
+ state.categories[id].isValid = errorsInCategory.length === 0;
5459
+ state.categories[id].isVisited = true;
5460
+ return Object.assign({}, state);
5512
5461
  }
5513
- if (!props.children) {
5514
- return null;
5462
+ case 'validate/form':
5463
+ {
5464
+ const {
5465
+ errors
5466
+ } = action.payload;
5467
+ state.isValid = errors.length === 0;
5468
+ return Object.assign({}, state);
5515
5469
  }
5516
- if (props.formUrl) {
5517
- this.baseEnumerator.formUrl = props.formUrl;
5470
+ case 'toggle/category/review-link':
5471
+ {
5472
+ const {
5473
+ id
5474
+ } = action.payload;
5475
+ state.categories[id].showReviewPageLink = !state.categories[id].showReviewPageLink;
5476
+ return Object.assign({}, state);
5518
5477
  }
5519
- this.baseEnumerator.isFormSubmitted = (_a = props.isFormSubmitted) !== null && _a !== void 0 ? _a : false;
5520
- return jsx(JsonFormContext.Provider, {
5521
- value: this.baseEnumerator,
5522
- children: (_b = this.selfProps) === null || _b === void 0 ? void 0 : _b.children
5523
- });
5524
- };
5525
- this.getContextProvider = () => {
5526
- var _a;
5527
- return jsx(JsonFormContext.Provider, {
5528
- value: this.baseEnumerator,
5529
- children: (_a = this.selfProps) === null || _a === void 0 ? void 0 : _a.children
5530
- });
5531
- };
5532
- this.getFormUrl = () => {
5533
- var _a;
5534
- return (_a = this.selfProps) === null || _a === void 0 ? void 0 : _a.formUrl;
5535
- };
5536
- this.getAxiosInterceptorConfig = axios => {
5537
- const requestId = axios.interceptors.request.use(req => {
5538
- if (req.data === undefined) {
5539
- throw new Error(`The URL: ${req.url} encountered a CORS error.`);
5540
- }
5541
- return req;
5542
- });
5543
- return [requestId, axios];
5544
- };
5545
- /**
5546
- * Grabs data stored under a given key
5547
- *
5548
- */
5549
- this.getFormContextData = key => {
5550
- const dataFunction = this.baseEnumerator.data.get(key);
5551
- return dataFunction && dataFunction();
5552
- };
5553
- /**
5554
- * Grabs all data
5555
- *
5556
- */
5557
- this.getAllFormContextData = () => {
5558
- const allData = [];
5559
- this.baseEnumerator.data.forEach((d, key) => {
5560
- allData.push({
5561
- [key]: d()
5562
- });
5563
- });
5564
- return allData;
5565
- };
5566
- this.baseEnumerator = {
5567
- data: this.enumValues,
5568
- functions: this.enumFunctions,
5569
- submitFunction: this.enumSubmitFunctions,
5570
- addFormContextData: this.addFormContextData,
5571
- getFormContextData: this.getFormContextData,
5572
- getAllFormContextData: this.getAllFormContextData,
5573
- formUrl: this.getFormUrl()
5574
- };
5575
- this.selfProps = {};
5478
+ default:
5479
+ return state;
5576
5480
  }
5577
- }
5578
- const ContextProviderC = new ContextProviderClass();
5579
- const ContextProviderFactory = () => new ContextProviderClass().setup;
5580
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
5581
- const JsonFormContext = /*#__PURE__*/createContext(null);
5582
-
5583
- const RenderStepElements = props => {
5584
- return jsx(Visible, {
5585
- visible: props.visible,
5586
- "date-testid": `${props.path}-categories-${props.categoryIndex}`,
5587
- children: props.category.elements.map((uiSchema, index) => {
5588
- return jsx(JsonFormsDispatch, {
5589
- schema: props.schema,
5590
- uischema: uiSchema,
5591
- renderers: props.renderers,
5592
- cells: props.cells,
5593
- path: props.path,
5594
- visible: props.visible,
5595
- enabled: props.enabled
5596
- }, `${props.path}-category-page-${index}`);
5597
- })
5598
- });
5599
- };
5600
-
5601
- var uncurryThis$3 = functionUncurryThisClause;
5602
- var aCallable$6 = aCallable$9;
5603
- var NATIVE_BIND = functionBindNative;
5604
-
5605
- var bind$5 = uncurryThis$3(uncurryThis$3.bind);
5606
-
5607
- // optional / simple context binding
5608
- var functionBindContext = function (fn, that) {
5609
- aCallable$6(fn);
5610
- return that === undefined ? fn : NATIVE_BIND ? bind$5(fn, that) : function (/* ...args */) {
5611
- return fn.apply(that, arguments);
5612
- };
5613
5481
  };
5614
5482
 
5615
- var isArray$1 = isArray$4;
5616
- var lengthOfArrayLike$3 = lengthOfArrayLike$7;
5617
- var doesNotExceedSafeInteger = doesNotExceedSafeInteger$2;
5618
- var bind$4 = functionBindContext;
5619
-
5620
- // `FlattenIntoArray` abstract operation
5621
- // https://tc39.github.io/proposal-flatMap/#sec-FlattenIntoArray
5622
- var flattenIntoArray$1 = function (target, original, source, sourceLen, start, depth, mapper, thisArg) {
5623
- var targetIndex = start;
5624
- var sourceIndex = 0;
5625
- var mapFn = mapper ? bind$4(mapper, thisArg) : false;
5626
- var element, elementLen;
5627
-
5628
- while (sourceIndex < sourceLen) {
5629
- if (sourceIndex in source) {
5630
- element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex];
5483
+ const createStepperContextInitData = props => {
5484
+ var _a;
5485
+ const {
5486
+ uischema,
5487
+ data,
5488
+ schema,
5489
+ ajv,
5490
+ t,
5491
+ visible,
5492
+ path
5493
+ } = props;
5494
+ const categorization = uischema;
5495
+ const valid = ajv.validate(schema, data || {});
5496
+ const categories = (_a = categorization.elements) === null || _a === void 0 ? void 0 : _a.map((c, id) => {
5497
+ const scopes = pickPropertyValues(c, 'scope', 'ListWithDetail');
5498
+ const incompletePaths = getIncompletePaths(ajv, scopes);
5499
+ return {
5500
+ id,
5501
+ label: deriveLabelForUISchemaElement(c, t),
5502
+ scopes,
5503
+ isVisited: false,
5504
+ isCompleted: (incompletePaths === null || incompletePaths === void 0 ? void 0 : incompletePaths.length) === 0,
5505
+ isValid: (incompletePaths === null || incompletePaths === void 0 ? void 0 : incompletePaths.length) === 0,
5506
+ uischema: c,
5507
+ showReviewPageLink: props.withBackReviewBtn || false,
5508
+ isEnabled: isEnabled(c, data, '', ajv),
5509
+ visible
5510
+ };
5511
+ });
5512
+ const activeId = (props === null || props === void 0 ? void 0 : props.activeId) || 0;
5513
+ return {
5514
+ categories: categories,
5515
+ activeId,
5516
+ hasNextButton: activeId !== (categories === null || categories === void 0 ? void 0 : categories.length),
5517
+ hasPrevButton: activeId > 0 && activeId !== (categories === null || categories === void 0 ? void 0 : categories.length),
5518
+ path,
5519
+ isOnReview: activeId === (categories === null || categories === void 0 ? void 0 : categories.length),
5520
+ isValid: valid === true,
5521
+ maxReachedStep: 0
5522
+ };
5523
+ };
5524
+ const JsonFormsStepperContext = /*#__PURE__*/createContext(undefined);
5525
+ const JsonFormsStepperContextProvider = ({
5526
+ children,
5527
+ StepperProps
5528
+ }) => {
5529
+ var _a;
5530
+ const ctx = useJsonForms();
5531
+ const {
5532
+ schema,
5533
+ ajv
5534
+ } = StepperProps;
5535
+ const [stepperState, dispatch] = useReducer(stepperReducer, createStepperContextInitData(StepperProps));
5536
+ const stepperDispatch = (StepperProps === null || StepperProps === void 0 ? void 0 : StepperProps.customDispatch) || dispatch;
5537
+ const context = useMemo(() => {
5538
+ return {
5539
+ isProvided: true,
5540
+ stepperDispatch,
5541
+ selectStepperState: () => {
5542
+ return stepperState;
5543
+ },
5544
+ selectIsDisabled: () => {
5545
+ var _a;
5546
+ const category = (_a = stepperState.categories) === null || _a === void 0 ? void 0 : _a[stepperState.activeId];
5547
+ return category === undefined ? false : !(category === null || category === void 0 ? void 0 : category.isEnabled);
5548
+ },
5549
+ selectIsActive: id => {
5550
+ return id === stepperState.activeId;
5551
+ },
5552
+ selectPath: () => {
5553
+ return stepperState.path;
5554
+ },
5555
+ selectCategory: id => {
5556
+ return stepperState.categories[id];
5557
+ },
5558
+ validatePage: id => {
5559
+ var _a;
5560
+ stepperDispatch({
5561
+ type: 'update/category',
5562
+ payload: {
5563
+ errors: (_a = ctx === null || ctx === void 0 ? void 0 : ctx.core) === null || _a === void 0 ? void 0 : _a.errors,
5564
+ id,
5565
+ ajv
5566
+ }
5567
+ });
5568
+ },
5569
+ goToPage: (id, updateCategoryId) => {
5570
+ var _a, _b, _c;
5571
+ ajv.validate(schema, ((_a = ctx.core) === null || _a === void 0 ? void 0 : _a.data) || {});
5572
+ if (stepperState.isOnReview !== true) {
5573
+ for (let i = 0; i < id; i++) {
5574
+ stepperDispatch({
5575
+ type: 'update/category',
5576
+ payload: {
5577
+ errors: (_b = ctx === null || ctx === void 0 ? void 0 : ctx.core) === null || _b === void 0 ? void 0 : _b.errors,
5578
+ id: i,
5579
+ ajv
5580
+ }
5581
+ });
5582
+ }
5583
+ }
5584
+ stepperDispatch({
5585
+ type: 'validate/form',
5586
+ payload: {
5587
+ errors: (_c = ctx === null || ctx === void 0 ? void 0 : ctx.core) === null || _c === void 0 ? void 0 : _c.errors
5588
+ }
5589
+ });
5590
+ stepperDispatch({
5591
+ type: 'page/to/index',
5592
+ payload: {
5593
+ id
5594
+ }
5595
+ });
5596
+ },
5597
+ toggleShowReviewLink: id => {
5598
+ stepperDispatch({
5599
+ type: 'toggle/category/review-link',
5600
+ payload: {
5601
+ id
5602
+ }
5603
+ });
5604
+ }
5605
+ };
5606
+ }, [stepperDispatch, stepperState, (_a = ctx.core) === null || _a === void 0 ? void 0 : _a.errors]);
5607
+ useEffect(() => {
5608
+ if ((context === null || context === void 0 ? void 0 : context.isProvided) === true) {
5609
+ /* The block is used to cache the state for the tenant web app review editor */
5610
+ stepperDispatch({
5611
+ type: 'update/uischema',
5612
+ payload: {
5613
+ state: createStepperContextInitData(Object.assign(Object.assign({}, StepperProps), {
5614
+ activeId: stepperState === null || stepperState === void 0 ? void 0 : stepperState.activeId
5615
+ }))
5616
+ }
5617
+ });
5618
+ context.goToPage(stepperState.maxReachedStep);
5619
+ context.goToPage(stepperState.activeId);
5620
+ }
5621
+ }, [JSON.stringify(StepperProps.uischema), JSON.stringify(StepperProps.schema)]);
5622
+ return jsx(JsonFormsStepperContext.Provider, {
5623
+ value: context,
5624
+ children: children
5625
+ });
5626
+ };
5631
5627
 
5632
- if (depth > 0 && isArray$1(element)) {
5633
- elementLen = lengthOfArrayLike$3(element);
5634
- targetIndex = flattenIntoArray$1(target, original, element, elementLen, targetIndex, depth - 1) - 1;
5628
+ const GoAInputBaseTableReview = props => {
5629
+ var _a, _b, _c, _d;
5630
+ const {
5631
+ data,
5632
+ uischema,
5633
+ label
5634
+ } = props;
5635
+ const labelToUpdate = convertToSentenceCase(getLabelText(uischema.scope, label || ''));
5636
+ const categoryIndex = (_a = uischema.options) === null || _a === void 0 ? void 0 : _a.categoryIndex;
5637
+ const formStepperCtx = useContext(JsonFormsStepperContext);
5638
+ let reviewText = data;
5639
+ const isBoolean = typeof data === 'boolean';
5640
+ if (isBoolean) {
5641
+ const checkboxLabel = ((_c = (_b = uischema.options) === null || _b === void 0 ? void 0 : _b.text) === null || _c === void 0 ? void 0 : _c.trim()) || convertToSentenceCase(getLastSegmentFromPointer(uischema.scope));
5642
+ if (((_d = uischema.options) === null || _d === void 0 ? void 0 : _d.radio) === true) {
5643
+ reviewText = data ? `Yes` : `No`;
5644
+ } else {
5645
+ if (label !== '' || typeof label === 'boolean') {
5646
+ reviewText = data ? `Yes` : `No`;
5635
5647
  } else {
5636
- doesNotExceedSafeInteger(targetIndex + 1);
5637
- target[targetIndex] = element;
5648
+ reviewText = data ? `Yes (${checkboxLabel.trim()})` : `No (${checkboxLabel.trim()})`;
5638
5649
  }
5639
-
5640
- targetIndex++;
5641
5650
  }
5642
- sourceIndex++;
5643
5651
  }
5644
- return targetIndex;
5652
+ return jsxs("tr", {
5653
+ "data-testid": `input-base-table-${label}-row`,
5654
+ children: [jsx(PageReviewNameCol, {
5655
+ children: jsx("strong", {
5656
+ children: labelToUpdate
5657
+ })
5658
+ }), jsx(PageReviewValueCol, {
5659
+ children: reviewText
5660
+ }), jsx(PageReviewActionCol, {
5661
+ children: jsx(GoAButton, {
5662
+ type: "tertiary",
5663
+ testId: `page-review-change-${label}-btn`,
5664
+ onClick: () => {
5665
+ if (formStepperCtx) {
5666
+ formStepperCtx.toggleShowReviewLink(categoryIndex);
5667
+ formStepperCtx.goToPage(categoryIndex);
5668
+ }
5669
+ },
5670
+ children: "Change"
5671
+ })
5672
+ })]
5673
+ });
5645
5674
  };
5675
+ const GoAInputBaseTableReviewControl = withJsonFormsControlProps(GoAInputBaseTableReview);
5646
5676
 
5647
- var flattenIntoArray_1 = flattenIntoArray$1;
5648
-
5649
- var uncurryThis$2 = functionUncurryThis;
5650
- var fails$3 = fails$s;
5651
- var isCallable$4 = isCallable$q;
5652
- var classof$2 = classof$9;
5653
- var getBuiltIn$2 = getBuiltIn$9;
5654
- var inspectSource$1 = inspectSource$3;
5655
-
5656
- var noop = function () { /* empty */ };
5657
- var construct = getBuiltIn$2('Reflect', 'construct');
5658
- var constructorRegExp = /^\s*(?:class|function)\b/;
5659
- var exec$1 = uncurryThis$2(constructorRegExp.exec);
5660
- var INCORRECT_TO_STRING = !constructorRegExp.test(noop);
5661
-
5662
- var isConstructorModern = function isConstructor(argument) {
5663
- if (!isCallable$4(argument)) return false;
5664
- try {
5665
- construct(noop, [], argument);
5666
- return true;
5667
- } catch (error) {
5668
- return false;
5669
- }
5677
+ let _$7 = t => t,
5678
+ _t$7;
5679
+ const renderLayoutElements = (elements, schema, path, enabled, renderers, cells) => {
5680
+ return elements.map((child, index) => jsx("div", {
5681
+ children: jsx(JsonFormsDispatch, {
5682
+ uischema: child,
5683
+ schema: schema,
5684
+ path: path,
5685
+ enabled: enabled,
5686
+ renderers: renderers,
5687
+ cells: cells
5688
+ }, path)
5689
+ }, index));
5670
5690
  };
5671
-
5672
- var isConstructorLegacy = function isConstructor(argument) {
5673
- if (!isCallable$4(argument)) return false;
5674
- switch (classof$2(argument)) {
5675
- case 'AsyncFunction':
5676
- case 'GeneratorFunction':
5677
- case 'AsyncGeneratorFunction': return false;
5678
- }
5679
- try {
5680
- // we can't check .prototype since constructors produced by .bind haven't it
5681
- // `Function#toString` throws on some built-it function in some legacy engines
5682
- // (for example, `DOMQuad` and similar in FF41-)
5683
- return INCORRECT_TO_STRING || !!exec$1(constructorRegExp, inspectSource$1(argument));
5684
- } catch (error) {
5685
- return true;
5686
- }
5691
+ const withAjvProps = Component => function WithAjvProps(props) {
5692
+ const ctx = useJsonForms();
5693
+ const ajv = getAjv({
5694
+ jsonforms: Object.assign({}, ctx)
5695
+ });
5696
+ return jsx(Component, Object.assign({}, props, {
5697
+ ajv: ajv
5698
+ }));
5687
5699
  };
5688
-
5689
- isConstructorLegacy.sham = true;
5690
-
5691
- // `IsConstructor` abstract operation
5692
- // https://tc39.es/ecma262/#sec-isconstructor
5693
- var isConstructor$2 = !construct || fails$3(function () {
5694
- var called;
5695
- return isConstructorModern(isConstructorModern.call)
5696
- || !isConstructorModern(Object)
5697
- || !isConstructorModern(function () { called = true; })
5698
- || called;
5699
- }) ? isConstructorLegacy : isConstructorModern;
5700
-
5701
- var isArray = isArray$4;
5702
- var isConstructor$1 = isConstructor$2;
5703
- var isObject$2 = isObject$e;
5704
- var wellKnownSymbol$5 = wellKnownSymbol$k;
5705
-
5706
- var SPECIES$2 = wellKnownSymbol$5('species');
5707
- var $Array = Array;
5708
-
5709
- // a part of `ArraySpeciesCreate` abstract operation
5710
- // https://tc39.es/ecma262/#sec-arrayspeciescreate
5711
- var arraySpeciesConstructor$1 = function (originalArray) {
5712
- var C;
5713
- if (isArray(originalArray)) {
5714
- C = originalArray.constructor;
5715
- // cross-realm fallback
5716
- if (isConstructor$1(C) && (C === $Array || isArray(C.prototype))) C = undefined;
5717
- else if (isObject$2(C)) {
5718
- C = C[SPECIES$2];
5719
- if (C === null) C = undefined;
5700
+ const LayoutRenderer = ({
5701
+ elements,
5702
+ schema,
5703
+ path,
5704
+ enabled,
5705
+ direction,
5706
+ renderers,
5707
+ cells,
5708
+ visible,
5709
+ width
5710
+ }) => {
5711
+ if (isEmpty(elements)) {
5712
+ return null;
5713
+ } else {
5714
+ if (direction === 'row') {
5715
+ return jsx(Visible, {
5716
+ visible: visible,
5717
+ children: jsx(GoAGrid, {
5718
+ minChildWidth: width || '10ch',
5719
+ children: renderLayoutElements(elements, schema, path, enabled, renderers, cells)
5720
+ })
5721
+ });
5722
+ } else {
5723
+ return jsx(Visible, {
5724
+ visible: visible,
5725
+ children: renderLayoutElements(elements, schema, path, enabled, renderers, cells)
5726
+ });
5720
5727
  }
5721
- } return C === undefined ? $Array : C;
5728
+ }
5722
5729
  };
5723
-
5724
- var arraySpeciesConstructor = arraySpeciesConstructor$1;
5725
-
5726
- // `ArraySpeciesCreate` abstract operation
5727
- // https://tc39.es/ecma262/#sec-arrayspeciescreate
5728
- var arraySpeciesCreate$1 = function (originalArray, length) {
5729
- return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
5730
+ const ReviewLayoutRenderer = ({
5731
+ elements,
5732
+ schema,
5733
+ path,
5734
+ enabled,
5735
+ direction,
5736
+ renderers,
5737
+ cells,
5738
+ visible,
5739
+ width
5740
+ }) => {
5741
+ if (isEmpty(elements)) {
5742
+ return null;
5743
+ } else {
5744
+ if (direction === 'row') {
5745
+ return jsx(Visible, {
5746
+ visible: visible,
5747
+ children: jsx(ReviewGrid, {
5748
+ children: renderLayoutElements(elements, schema, path, enabled, renderers, cells)
5749
+ })
5750
+ });
5751
+ } else {
5752
+ return jsx(Visible, {
5753
+ visible: visible,
5754
+ children: renderLayoutElements(elements, schema, path, enabled, renderers, cells)
5755
+ });
5756
+ }
5757
+ }
5730
5758
  };
5759
+ const ReviewGrid = styled.div(_t$7 || (_t$7 = _$7`
5760
+ display: grid;
5761
+ grid-template-columns: repeat(auto-fit, minmax(250px, calc(50% - 8px)));
5762
+ gap: 16px;
5763
+ `));
5731
5764
 
5732
- var $$a = _export;
5733
- var flattenIntoArray = flattenIntoArray_1;
5734
- var toObject$1 = toObject$8;
5735
- var lengthOfArrayLike$2 = lengthOfArrayLike$7;
5736
- var toIntegerOrInfinity = toIntegerOrInfinity$7;
5737
- var arraySpeciesCreate = arraySpeciesCreate$1;
5738
-
5739
- // `Array.prototype.flat` method
5740
- // https://tc39.es/ecma262/#sec-array.prototype.flat
5741
- $$a({ target: 'Array', proto: true }, {
5742
- flat: function flat(/* depthArg = 1 */) {
5743
- var depthArg = arguments.length ? arguments[0] : undefined;
5744
- var O = toObject$1(this);
5745
- var sourceLen = lengthOfArrayLike$2(O);
5746
- var A = arraySpeciesCreate(O, 0);
5747
- A.length = flattenIntoArray(A, O, O, sourceLen, 0, depthArg === undefined ? 1 : toIntegerOrInfinity(depthArg));
5748
- return A;
5765
+ let _$6 = t => t,
5766
+ _t$6,
5767
+ _t2$4,
5768
+ _t3$3,
5769
+ _t4$3,
5770
+ _t5$2,
5771
+ _t6$2,
5772
+ _t7$1,
5773
+ _t8$1,
5774
+ _t9$1,
5775
+ _t10$1,
5776
+ _t11$1,
5777
+ _t12$1,
5778
+ _t13$1,
5779
+ _t14$1,
5780
+ _t15$1,
5781
+ _t16;
5782
+ const ReviewItem = styled.div(_t$6 || (_t$6 = _$6`
5783
+ display: flex;
5784
+ flex-direction: column;
5785
+ border: var(--goa-border-width-s) solid grey;
5786
+ border-radius: var(--goa-border-radius-m);
5787
+ margin: var(--goa-space-2xs);
5788
+ padding: var(--goa-space-xs);
5789
+ div:empty {
5790
+ display: none;
5749
5791
  }
5750
- });
5751
-
5752
- // this method was added to unscopables after implementation
5753
- // in popular engines, so it's moved to a separate module
5754
- var addToUnscopables = addToUnscopables$4;
5792
+ `));
5793
+ const ReviewItemSection = styled.div(_t2$4 || (_t2$4 = _$6`
5794
+ background-color: #f1f1f1;
5795
+ margin-bottom: var(--goa-space-m);
5796
+ padding: var(--goa-space-m);
5797
+ border: 1px solid #dcdcdc;
5798
+ border-radius: 5px;
5755
5799
 
5756
- // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
5757
- addToUnscopables('flat');
5800
+ .element-style {
5801
+ max-width: 1600px;
5802
+ }
5803
+ `));
5804
+ const ReviewItemHeader = styled.div(_t3$3 || (_t3$3 = _$6`
5805
+ display: flex;
5806
+ align-items: center;
5807
+ justify-content: space-between;
5808
+ margin-bottom: var(--goa-space-xl);
5809
+ `));
5810
+ const ReviewItemTitle = styled.div(_t4$3 || (_t4$3 = _$6`
5811
+ font-size: var(--goa-space-l);
5812
+ line-height: var(--goa-space-xl);
5813
+ font-weight: 300;
5814
+ `));
5815
+ const Anchor = styled.div(_t5$2 || (_t5$2 = _$6`
5816
+ color: #0070c4;
5817
+ text-decoration: underline;
5818
+ outline: none;
5819
+ cursor: pointer;
5758
5820
 
5759
- // eslint-disable-next-line
5760
- const getProperty = (obj, propName) => {
5761
- if (obj[propName] !== undefined) return obj[propName];
5762
- for (const key in obj) {
5763
- if (typeof obj[key] === 'object' && obj[key] !== null) {
5764
- const result = getProperty(obj[key], propName);
5765
- if (result !== undefined) return result;
5766
- }
5821
+ &:focus {
5822
+ outline: 2px solid #0070c4;
5823
+ background-color: #e6f7ff;
5767
5824
  }
5768
- };
5769
- // eslint-disable-next-line
5770
- const pickPropertyValues = (obj, property, endWithType) => {
5771
- let values = [];
5772
- Object.keys(obj).forEach(function (key) {
5773
- var _a;
5774
- if (key === property) {
5775
- values.push(obj[key]);
5776
- } else if (_$c.isObject(obj[key])) {
5777
- // if the object type is equal to end type, we are not going to continue the recursive approach
5778
- if (endWithType && ((_a = obj[key]) === null || _a === void 0 ? void 0 : _a.type) === endWithType) {
5779
- if (property in obj[key]) {
5780
- values.push(obj[key][property]);
5781
- }
5782
- } else {
5783
- values = [...values, ...pickPropertyValues(obj[key], property, endWithType)];
5825
+ `));
5826
+ styled.div(_t6$2 || (_t6$2 = _$6`
5827
+ margin-left: var(--goa-space-m);
5828
+ `));
5829
+ styled.div(_t7$1 || (_t7$1 = _$6`
5830
+ margin-bottom: var(--goa-space-m);
5831
+ `));
5832
+ styled.div(_t8$1 || (_t8$1 = _$6`
5833
+ margin: var(--goa-space-s);
5834
+ width: 100%;
5835
+ `));
5836
+ styled.h3(_t9$1 || (_t9$1 = _$6`
5837
+ text-transform: capitalize;
5838
+ `));
5839
+ const RightAlignmentDiv = styled.div(_t10$1 || (_t10$1 = _$6`
5840
+ @media screen and (max-width: 767px) {
5841
+ margin-bottom: var(--goa-space-l);
5842
+ }
5843
+ @media screen and (min-width: 768px) {
5844
+ display: flex;
5845
+ justify-content: flex-end;
5846
+ margin-bottom: var(--goa-space-l);
5847
+ }
5848
+ `));
5849
+ const FormStepperSummaryH3 = styled.h3(_t11$1 || (_t11$1 = _$6`
5850
+ flex: 1;
5851
+ margin-bottom: var(--goa-space-m);
5852
+ font-size: var(--goa-font-size-7);
5853
+ line-height: var(--goa-line-height-4);
5854
+ font-weight: var(--goa-font-weight-regular);
5855
+ `));
5856
+ const PageRenderPadding = styled.h3(_t12$1 || (_t12$1 = _$6`
5857
+ margin-top: var(--goa-space-2xl);
5858
+ `));
5859
+ const PageBorder = styled.h3(_t13$1 || (_t13$1 = _$6`
5860
+ padding: var(--goa-space-3xl);
5861
+ `));
5862
+ const TableReviewItemSection = styled.div(_t14$1 || (_t14$1 = _$6`
5863
+ .element-style {
5864
+ max-width: 1600px;
5865
+ }
5866
+ `));
5867
+ const TableReviewItem = styled.div(_t15$1 || (_t15$1 = _$6`
5868
+ border: 1px solid #dcdcdc;
5869
+ border-radius: 5px;
5870
+ padding: var(--goa-space-2xl);
5871
+ `));
5872
+ const TableReviewCategoryLabel = styled.h3(_t16 || (_t16 = _$6`
5873
+ color: var(--goa-color-text-secondary) !important;
5874
+ `));
5875
+
5876
+ class ContextProviderClass {
5877
+ addDataByUrl(key, url, processDataFunction, token) {
5878
+ return __awaiter(this, void 0, void 0, function* () {
5879
+ let header = {};
5880
+ const [requestId, axiosWithConfig] = this.getAxiosInterceptorConfig(axios);
5881
+ if (token) {
5882
+ header = Object.assign(Object.assign({}, header), {
5883
+ Authorization: `Bearer ${token}`
5884
+ });
5784
5885
  }
5785
- } else if (_$c.isArray(obj[key])) {
5786
- const nextValues = obj[key].map(function (arrayObj) {
5787
- return pickPropertyValues(arrayObj, property, endWithType);
5886
+ yield axiosWithConfig.get(url, header).then(response => {
5887
+ const processedData = processDataFunction(response.data);
5888
+ this.enumValues.set(key, () => processedData);
5889
+ }).catch(err => {
5890
+ if (err.message.includes('CORS')) {
5891
+ console.warn(err.message);
5892
+ } else {
5893
+ console.warn(`addDataByUrl: ${err.message}`);
5894
+ }
5788
5895
  });
5789
- values = [...values, ...nextValues];
5790
- }
5791
- });
5792
- return values;
5793
- };
5794
-
5795
- const FormStepperReviewer = props => {
5796
- var _a, _b, _c;
5797
- const {
5798
- uischema,
5799
- data,
5800
- schema,
5801
- ajv,
5802
- cells,
5803
- enabled,
5804
- navigationFunc
5805
- } = props;
5806
- const componentProps = (_b = (_a = uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps) !== null && _b !== void 0 ? _b : {};
5807
- const readOnly = (_c = componentProps === null || componentProps === void 0 ? void 0 : componentProps.readOnly) !== null && _c !== void 0 ? _c : false;
5808
- const categorization = uischema;
5809
- const categories = categorization.elements.filter(category => isVisible(category, data, '', ajv));
5810
- const rescopeMaps = ['#/properties/albertaAddress', '#/properties/canadianAddress', '#/properties/sin'];
5811
- return jsx(ReviewItem, {
5812
- children: categories.map((category, index) => {
5813
- const categoryLabel = category.label || category.i18n || 'Unknown Category';
5814
- const testId = `${categoryLabel}-review-link`;
5815
- return jsxs(ReviewItemSection, {
5816
- children: [jsxs(ReviewItemHeader, {
5817
- children: [jsx(ReviewItemTitle, {
5818
- children: categoryLabel
5819
- }), navigationFunc && jsx(Anchor, {
5820
- onClick: () => {
5821
- navigationFunc(index);
5822
- },
5823
- "data-testid": testId,
5824
- onKeyDown: e => {
5825
- if (!readOnly && (e.key === ' ' || e.key === 'Enter')) {
5826
- e.preventDefault();
5827
- navigationFunc(index);
5828
- }
5829
- },
5830
- children: readOnly ? 'View' : 'Edit'
5831
- })]
5832
- }), jsx(GoAGrid, {
5833
- minChildWidth: "100%",
5834
- children: category.elements.filter(field => {
5835
- var _a, _b;
5836
- // [TODO] we need to double check why we cannot hide the elements at the element level
5837
- const conditionProps = (_a = field.rule) === null || _a === void 0 ? void 0 : _a.condition;
5838
- /* istanbul ignore next */
5839
- if (conditionProps && data) {
5840
- const canHideControlParts = (_b = conditionProps === null || conditionProps === void 0 ? void 0 : conditionProps.scope) === null || _b === void 0 ? void 0 : _b.split('/');
5841
- const canHideControl = canHideControlParts && canHideControlParts[(canHideControlParts === null || canHideControlParts === void 0 ? void 0 : canHideControlParts.length) - 1];
5842
- const isHidden = getProperty(data, canHideControl);
5843
- if (!isHidden) {
5844
- return field;
5845
- }
5846
- } else {
5847
- return field;
5848
- }
5849
- }).map(e => {
5850
- const layout = e;
5851
- if (rescopeMaps.some(scope => {
5852
- var _a;
5853
- return (_a = layout.elements) === null || _a === void 0 ? void 0 : _a.map(el => {
5854
- const element = el;
5855
- return element.scope;
5856
- }).includes(scope);
5857
- })) {
5858
- return layout.elements;
5859
- } else {
5860
- return e;
5861
- }
5862
- }).flat().map((element, index) => {
5863
- return jsx("div", {
5864
- className: "element-style",
5865
- children: jsx(JsonFormsDispatch, {
5866
- "data-testid": `jsonforms-object-list-defined-elements-dispatch`,
5867
- schema: schema,
5868
- uischema: element,
5869
- enabled: enabled,
5870
- renderers: GoAReviewRenderers,
5871
- cells: cells
5872
- })
5873
- }, `form-stepper-category-${index}`);
5874
- })
5875
- })]
5876
- }, index);
5877
- })
5878
- });
5879
- };
5880
- const FormStepperReviewControl = withAjvProps(withTranslateProps(withJsonFormsLayoutProps(FormStepperReviewer)));
5881
-
5882
- const isErrorPathIncluded = (errorPaths, path) => {
5883
- return errorPaths.some(ePath => {
5884
- /**
5885
- * case A: errorPaths: [name] path: [name]
5886
- *
5887
- * case B: errorPath: [name] path: [name.firstName]
5888
- * */
5889
- return ePath === path || path.startsWith(ePath + '.');
5890
- });
5891
- };
5892
- function isNumber(value) {
5893
- return value != null && value !== '' && !isNaN(Number(value.toString()));
5894
- }
5895
- const getIncompletePaths = (ajv, scopes) => {
5896
- var _a;
5897
- const requiredErrorPaths = (_a = ajv === null || ajv === void 0 ? void 0 : ajv.errors) === null || _a === void 0 ? void 0 : _a.filter(e => e.keyword === 'required' || e.keyword === 'minLength').map(e => {
5898
- return getControlPath(e);
5899
- });
5900
- const _scopes = scopes.map(scope => toDataPath(scope)).filter(path => requiredErrorPaths && isErrorPathIncluded(requiredErrorPaths, path));
5901
- return _scopes;
5902
- };
5903
- const subErrorInParent = (error, paths) => {
5904
- /*
5905
- Detect is there sub error in an object array.
5906
- For example: error with instance path /roadmap/0/when belongs to /roadmap
5907
- */
5908
- const errorPaths = error.instancePath.split('/');
5909
- if (errorPaths.length < 2) return false;
5910
- // For case /roadmap/0
5911
- if (errorPaths.length > 1 && isNumber(errorPaths[errorPaths.length - 1])) {
5912
- const parentPath = errorPaths.slice(0, errorPaths.length - 1).join('/');
5913
- return paths.includes(parentPath);
5914
- }
5915
- // For case /roadmap/0/when
5916
- if (errorPaths.length > 2 && isNumber(errorPaths[errorPaths.length - 2])) {
5917
- const parentPath = errorPaths.slice(0, errorPaths.length - 2).join('/');
5918
- return paths.includes(parentPath);
5896
+ axiosWithConfig.interceptors.request.eject(requestId);
5897
+ });
5919
5898
  }
5920
- return false;
5921
- };
5922
- const getErrorsInScopes = (errors, scopes) => {
5923
- return errors.filter(e => {
5924
- // transfer scope #properties/value to data path /value
5925
- const dataPaths = scopes.map(s => '/' + toDataPath(s));
5926
- return dataPaths.includes(e.instancePath) || subErrorInParent(e, dataPaths);
5927
- });
5928
- };
5929
-
5930
- const stepperReducer = (state, action) => {
5931
- const {
5932
- activeId,
5933
- categories
5934
- } = state;
5935
- const lastId = categories[categories.length - 1].id;
5936
- switch (action.type) {
5937
- case 'update/uischema':
5938
- {
5939
- return Object.assign({}, action.payload.state);
5940
- }
5941
- case 'page/next':
5942
- {
5943
- state.activeId += 1;
5944
- if (activeId === lastId) {
5945
- state.isOnReview = true;
5946
- state.hasNextButton = false;
5947
- state.hasPrevButton = false;
5948
- } else {
5949
- state.hasNextButton = true;
5950
- state.hasPrevButton = true;
5951
- state.isOnReview = false;
5952
- }
5953
- state.categories[activeId].isVisited = true;
5954
- return Object.assign({}, state);
5955
- }
5956
- case 'page/prev':
5957
- {
5958
- state.categories[activeId].isVisited = true;
5959
- if (activeId > 0) {
5960
- state.activeId -= 1;
5961
- state.hasPrevButton = state.activeId !== 0;
5962
- state.hasNextButton = true;
5963
- state.isOnReview = false;
5964
- }
5965
- return Object.assign({}, state);
5966
- }
5967
- case 'page/to/index':
5968
- {
5899
+ constructor() {
5900
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
5901
+ this.enumValues = new Map();
5902
+ this.enumFunctions = new Map();
5903
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
5904
+ this.enumSubmitFunctions = new Map();
5905
+ this.addFormContextData = (key, data) => {
5906
+ this.enumValues.set(key, () => data);
5907
+ };
5908
+ this.setup = props => {
5909
+ var _a, _b;
5910
+ this.selfProps = props;
5911
+ if (props.fileManagement) {
5969
5912
  const {
5970
- id
5971
- } = action.payload;
5972
- state.activeId = id;
5973
- if (id > lastId) {
5974
- state.isOnReview = true;
5975
- state.hasNextButton = false;
5976
- state.hasPrevButton = true;
5977
- return Object.assign({}, state);
5978
- } else {
5979
- state.categories[id].isVisited = true;
5980
- state.hasNextButton = id <= lastId;
5981
- state.hasPrevButton = id !== 0;
5982
- state.isOnReview = false;
5983
- state.maxReachedStep = Math.max(state.maxReachedStep, activeId);
5984
- return Object.assign({}, state);
5985
- }
5913
+ fileList,
5914
+ uploadFile,
5915
+ downloadFile,
5916
+ deleteFile
5917
+ } = props.fileManagement;
5918
+ this.enumValues.set('file-list', () => fileList);
5919
+ this.enumFunctions.set('upload-file', () => uploadFile);
5920
+ this.enumFunctions.set('download-file', () => downloadFile);
5921
+ this.enumFunctions.set('delete-file', () => deleteFile);
5986
5922
  }
5987
- case 'update/category':
5988
- {
5923
+ if (props.submit) {
5989
5924
  const {
5990
- id,
5991
- ajv,
5992
- errors
5993
- } = action.payload;
5994
- /*
5995
- ctx.core.errors only includes required errors when the fields are touched. In this case, we still ajv to figure out the required errors at the very beginning.
5996
- */
5997
- const incompletePaths = getIncompletePaths(ajv, state.categories[id].scopes);
5998
- const errorsInCategory = getErrorsInScopes(errors, state.categories[id].scopes || []);
5999
- state.categories[id].isCompleted = (incompletePaths === null || incompletePaths === void 0 ? void 0 : incompletePaths.length) === 0;
6000
- state.categories[id].isValid = errorsInCategory.length === 0;
6001
- state.categories[id].isVisited = true;
6002
- return Object.assign({}, state);
5925
+ submitForm
5926
+ } = props.submit;
5927
+ const submitFunction = submitForm;
5928
+ this.enumSubmitFunctions.set('submit-form', () => submitFunction);
6003
5929
  }
6004
- case 'validate/form':
6005
- {
6006
- const {
6007
- errors
6008
- } = action.payload;
6009
- state.isValid = errors.length === 0;
6010
- return Object.assign({}, state);
5930
+ if (props.data) {
5931
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
5932
+ Object.keys(props.data).forEach(item => {
5933
+ this.enumValues.set(item, () => props.data[item]);
5934
+ });
6011
5935
  }
6012
- default:
6013
- return state;
5936
+ if (!props.children) {
5937
+ return null;
5938
+ }
5939
+ if (props.formUrl) {
5940
+ this.baseEnumerator.formUrl = props.formUrl;
5941
+ }
5942
+ this.baseEnumerator.isFormSubmitted = (_a = props.isFormSubmitted) !== null && _a !== void 0 ? _a : false;
5943
+ return jsx(JsonFormContext.Provider, {
5944
+ value: this.baseEnumerator,
5945
+ children: (_b = this.selfProps) === null || _b === void 0 ? void 0 : _b.children
5946
+ });
5947
+ };
5948
+ this.getContextProvider = () => {
5949
+ var _a;
5950
+ return jsx(JsonFormContext.Provider, {
5951
+ value: this.baseEnumerator,
5952
+ children: (_a = this.selfProps) === null || _a === void 0 ? void 0 : _a.children
5953
+ });
5954
+ };
5955
+ this.getFormUrl = () => {
5956
+ var _a;
5957
+ return (_a = this.selfProps) === null || _a === void 0 ? void 0 : _a.formUrl;
5958
+ };
5959
+ this.getAxiosInterceptorConfig = axios => {
5960
+ const requestId = axios.interceptors.request.use(req => {
5961
+ if (req.data === undefined) {
5962
+ throw new Error(`The URL: ${req.url} encountered a CORS error.`);
5963
+ }
5964
+ return req;
5965
+ });
5966
+ return [requestId, axios];
5967
+ };
5968
+ /**
5969
+ * Grabs data stored under a given key
5970
+ *
5971
+ */
5972
+ this.getFormContextData = key => {
5973
+ const dataFunction = this.baseEnumerator.data.get(key);
5974
+ return dataFunction && dataFunction();
5975
+ };
5976
+ /**
5977
+ * Grabs all data
5978
+ *
5979
+ */
5980
+ this.getAllFormContextData = () => {
5981
+ const allData = [];
5982
+ this.baseEnumerator.data.forEach((d, key) => {
5983
+ allData.push({
5984
+ [key]: d()
5985
+ });
5986
+ });
5987
+ return allData;
5988
+ };
5989
+ this.baseEnumerator = {
5990
+ data: this.enumValues,
5991
+ functions: this.enumFunctions,
5992
+ submitFunction: this.enumSubmitFunctions,
5993
+ addFormContextData: this.addFormContextData,
5994
+ getFormContextData: this.getFormContextData,
5995
+ getAllFormContextData: this.getAllFormContextData,
5996
+ formUrl: this.getFormUrl()
5997
+ };
5998
+ this.selfProps = {};
6014
5999
  }
6015
- };
6000
+ }
6001
+ const ContextProviderC = new ContextProviderClass();
6002
+ const ContextProviderFactory = () => new ContextProviderClass().setup;
6003
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6004
+ const JsonFormContext = /*#__PURE__*/createContext(null);
6016
6005
 
6017
- const createStepperContextInitData = props => {
6018
- var _a;
6019
- const {
6020
- uischema,
6021
- data,
6022
- schema,
6023
- ajv,
6024
- t,
6025
- visible,
6026
- path
6027
- } = props;
6028
- const categorization = uischema;
6029
- const valid = ajv.validate(schema, data || {});
6030
- const categories = (_a = categorization.elements) === null || _a === void 0 ? void 0 : _a.map((c, id) => {
6031
- const scopes = pickPropertyValues(c, 'scope', 'ListWithDetail');
6032
- const incompletePaths = getIncompletePaths(ajv, scopes);
6033
- return {
6034
- id,
6035
- label: deriveLabelForUISchemaElement(c, t),
6036
- scopes,
6037
- isVisited: false,
6038
- isCompleted: (incompletePaths === null || incompletePaths === void 0 ? void 0 : incompletePaths.length) === 0,
6039
- isValid: (incompletePaths === null || incompletePaths === void 0 ? void 0 : incompletePaths.length) === 0,
6040
- uischema: c,
6041
- isEnabled: isEnabled(c, data, '', ajv),
6042
- visible
6043
- };
6006
+ const RenderStepElements = props => {
6007
+ return jsx(Visible, {
6008
+ visible: props.visible,
6009
+ "date-testid": `${props.path}-categories-${props.categoryIndex}`,
6010
+ children: props.category.elements.map((uiSchema, index) => {
6011
+ return jsx(JsonFormsDispatch, {
6012
+ schema: props.schema,
6013
+ uischema: uiSchema,
6014
+ renderers: props.renderers,
6015
+ cells: props.cells,
6016
+ path: props.path,
6017
+ visible: props.visible,
6018
+ enabled: props.enabled
6019
+ }, `${props.path}-category-page-${index}`);
6020
+ })
6044
6021
  });
6045
- const activeId = (props === null || props === void 0 ? void 0 : props.activeId) || 0;
6046
- return {
6047
- categories: categories,
6048
- activeId,
6049
- hasNextButton: activeId !== (categories === null || categories === void 0 ? void 0 : categories.length),
6050
- hasPrevButton: activeId > 0 && activeId !== (categories === null || categories === void 0 ? void 0 : categories.length),
6051
- path,
6052
- isOnReview: activeId === (categories === null || categories === void 0 ? void 0 : categories.length),
6053
- isValid: valid === true,
6054
- maxReachedStep: 0
6022
+ };
6023
+
6024
+ var uncurryThis$3 = functionUncurryThisClause;
6025
+ var aCallable$6 = aCallable$9;
6026
+ var NATIVE_BIND = functionBindNative;
6027
+
6028
+ var bind$5 = uncurryThis$3(uncurryThis$3.bind);
6029
+
6030
+ // optional / simple context binding
6031
+ var functionBindContext = function (fn, that) {
6032
+ aCallable$6(fn);
6033
+ return that === undefined ? fn : NATIVE_BIND ? bind$5(fn, that) : function (/* ...args */) {
6034
+ return fn.apply(that, arguments);
6055
6035
  };
6056
6036
  };
6057
- const JsonFormsStepperContext = /*#__PURE__*/createContext(undefined);
6058
- const JsonFormsStepperContextProvider = ({
6059
- children,
6060
- StepperProps
6061
- }) => {
6062
- var _a;
6063
- const ctx = useJsonForms();
6064
- const {
6065
- schema,
6066
- ajv
6067
- } = StepperProps;
6068
- const [stepperState, dispatch] = useReducer(stepperReducer, createStepperContextInitData(StepperProps));
6069
- const stepperDispatch = (StepperProps === null || StepperProps === void 0 ? void 0 : StepperProps.customDispatch) || dispatch;
6070
- const context = useMemo(() => {
6071
- return {
6072
- isProvided: true,
6073
- stepperDispatch,
6074
- selectStepperState: () => {
6075
- return stepperState;
6076
- },
6077
- selectIsDisabled: () => {
6078
- var _a;
6079
- const category = (_a = stepperState.categories) === null || _a === void 0 ? void 0 : _a[stepperState.activeId];
6080
- return category === undefined ? false : !(category === null || category === void 0 ? void 0 : category.isEnabled);
6081
- },
6082
- selectIsActive: id => {
6083
- return id === stepperState.activeId;
6084
- },
6085
- selectPath: () => {
6086
- return stepperState.path;
6087
- },
6088
- selectCategory: id => {
6089
- return stepperState.categories[id];
6090
- },
6091
- validatePage: id => {
6092
- var _a;
6093
- stepperDispatch({
6094
- type: 'update/category',
6095
- payload: {
6096
- errors: (_a = ctx === null || ctx === void 0 ? void 0 : ctx.core) === null || _a === void 0 ? void 0 : _a.errors,
6097
- id,
6098
- ajv
6099
- }
6100
- });
6101
- },
6102
- goToPage: (id, updateCategoryId) => {
6103
- var _a, _b, _c;
6104
- ajv.validate(schema, ((_a = ctx.core) === null || _a === void 0 ? void 0 : _a.data) || {});
6105
- if (stepperState.isOnReview !== true) {
6106
- for (let i = 0; i < id; i++) {
6107
- stepperDispatch({
6108
- type: 'update/category',
6109
- payload: {
6110
- errors: (_b = ctx === null || ctx === void 0 ? void 0 : ctx.core) === null || _b === void 0 ? void 0 : _b.errors,
6111
- id: i,
6112
- ajv
6113
- }
6114
- });
6115
- }
6116
- }
6117
- stepperDispatch({
6118
- type: 'validate/form',
6119
- payload: {
6120
- errors: (_c = ctx === null || ctx === void 0 ? void 0 : ctx.core) === null || _c === void 0 ? void 0 : _c.errors
6121
- }
6122
- });
6123
- stepperDispatch({
6124
- type: 'page/to/index',
6125
- payload: {
6126
- id
6127
- }
6128
- });
6037
+
6038
+ var isArray$1 = isArray$4;
6039
+ var lengthOfArrayLike$3 = lengthOfArrayLike$7;
6040
+ var doesNotExceedSafeInteger = doesNotExceedSafeInteger$2;
6041
+ var bind$4 = functionBindContext;
6042
+
6043
+ // `FlattenIntoArray` abstract operation
6044
+ // https://tc39.github.io/proposal-flatMap/#sec-FlattenIntoArray
6045
+ var flattenIntoArray$1 = function (target, original, source, sourceLen, start, depth, mapper, thisArg) {
6046
+ var targetIndex = start;
6047
+ var sourceIndex = 0;
6048
+ var mapFn = mapper ? bind$4(mapper, thisArg) : false;
6049
+ var element, elementLen;
6050
+
6051
+ while (sourceIndex < sourceLen) {
6052
+ if (sourceIndex in source) {
6053
+ element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex];
6054
+
6055
+ if (depth > 0 && isArray$1(element)) {
6056
+ elementLen = lengthOfArrayLike$3(element);
6057
+ targetIndex = flattenIntoArray$1(target, original, element, elementLen, targetIndex, depth - 1) - 1;
6058
+ } else {
6059
+ doesNotExceedSafeInteger(targetIndex + 1);
6060
+ target[targetIndex] = element;
6129
6061
  }
6130
- };
6131
- }, [stepperDispatch, stepperState, (_a = ctx.core) === null || _a === void 0 ? void 0 : _a.errors]);
6132
- useEffect(() => {
6133
- if ((context === null || context === void 0 ? void 0 : context.isProvided) === true) {
6134
- /* The block is used to cache the state for the tenant web app review editor */
6135
- stepperDispatch({
6136
- type: 'update/uischema',
6137
- payload: {
6138
- state: createStepperContextInitData(Object.assign(Object.assign({}, StepperProps), {
6139
- activeId: stepperState === null || stepperState === void 0 ? void 0 : stepperState.activeId
6140
- }))
6141
- }
6142
- });
6143
- context.goToPage(stepperState.maxReachedStep);
6144
- context.goToPage(stepperState.activeId);
6062
+
6063
+ targetIndex++;
6064
+ }
6065
+ sourceIndex++;
6066
+ }
6067
+ return targetIndex;
6068
+ };
6069
+
6070
+ var flattenIntoArray_1 = flattenIntoArray$1;
6071
+
6072
+ var uncurryThis$2 = functionUncurryThis;
6073
+ var fails$3 = fails$s;
6074
+ var isCallable$4 = isCallable$q;
6075
+ var classof$2 = classof$9;
6076
+ var getBuiltIn$2 = getBuiltIn$9;
6077
+ var inspectSource$1 = inspectSource$3;
6078
+
6079
+ var noop = function () { /* empty */ };
6080
+ var construct = getBuiltIn$2('Reflect', 'construct');
6081
+ var constructorRegExp = /^\s*(?:class|function)\b/;
6082
+ var exec$1 = uncurryThis$2(constructorRegExp.exec);
6083
+ var INCORRECT_TO_STRING = !constructorRegExp.test(noop);
6084
+
6085
+ var isConstructorModern = function isConstructor(argument) {
6086
+ if (!isCallable$4(argument)) return false;
6087
+ try {
6088
+ construct(noop, [], argument);
6089
+ return true;
6090
+ } catch (error) {
6091
+ return false;
6092
+ }
6093
+ };
6094
+
6095
+ var isConstructorLegacy = function isConstructor(argument) {
6096
+ if (!isCallable$4(argument)) return false;
6097
+ switch (classof$2(argument)) {
6098
+ case 'AsyncFunction':
6099
+ case 'GeneratorFunction':
6100
+ case 'AsyncGeneratorFunction': return false;
6101
+ }
6102
+ try {
6103
+ // we can't check .prototype since constructors produced by .bind haven't it
6104
+ // `Function#toString` throws on some built-it function in some legacy engines
6105
+ // (for example, `DOMQuad` and similar in FF41-)
6106
+ return INCORRECT_TO_STRING || !!exec$1(constructorRegExp, inspectSource$1(argument));
6107
+ } catch (error) {
6108
+ return true;
6109
+ }
6110
+ };
6111
+
6112
+ isConstructorLegacy.sham = true;
6113
+
6114
+ // `IsConstructor` abstract operation
6115
+ // https://tc39.es/ecma262/#sec-isconstructor
6116
+ var isConstructor$2 = !construct || fails$3(function () {
6117
+ var called;
6118
+ return isConstructorModern(isConstructorModern.call)
6119
+ || !isConstructorModern(Object)
6120
+ || !isConstructorModern(function () { called = true; })
6121
+ || called;
6122
+ }) ? isConstructorLegacy : isConstructorModern;
6123
+
6124
+ var isArray = isArray$4;
6125
+ var isConstructor$1 = isConstructor$2;
6126
+ var isObject$2 = isObject$e;
6127
+ var wellKnownSymbol$5 = wellKnownSymbol$k;
6128
+
6129
+ var SPECIES$2 = wellKnownSymbol$5('species');
6130
+ var $Array = Array;
6131
+
6132
+ // a part of `ArraySpeciesCreate` abstract operation
6133
+ // https://tc39.es/ecma262/#sec-arrayspeciescreate
6134
+ var arraySpeciesConstructor$1 = function (originalArray) {
6135
+ var C;
6136
+ if (isArray(originalArray)) {
6137
+ C = originalArray.constructor;
6138
+ // cross-realm fallback
6139
+ if (isConstructor$1(C) && (C === $Array || isArray(C.prototype))) C = undefined;
6140
+ else if (isObject$2(C)) {
6141
+ C = C[SPECIES$2];
6142
+ if (C === null) C = undefined;
6145
6143
  }
6146
- }, [JSON.stringify(StepperProps.uischema), JSON.stringify(StepperProps.schema)]);
6147
- return jsx(JsonFormsStepperContext.Provider, {
6148
- value: context,
6149
- children: children
6144
+ } return C === undefined ? $Array : C;
6145
+ };
6146
+
6147
+ var arraySpeciesConstructor = arraySpeciesConstructor$1;
6148
+
6149
+ // `ArraySpeciesCreate` abstract operation
6150
+ // https://tc39.es/ecma262/#sec-arrayspeciescreate
6151
+ var arraySpeciesCreate$1 = function (originalArray, length) {
6152
+ return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
6153
+ };
6154
+
6155
+ var $$a = _export;
6156
+ var flattenIntoArray = flattenIntoArray_1;
6157
+ var toObject$1 = toObject$8;
6158
+ var lengthOfArrayLike$2 = lengthOfArrayLike$7;
6159
+ var toIntegerOrInfinity = toIntegerOrInfinity$7;
6160
+ var arraySpeciesCreate = arraySpeciesCreate$1;
6161
+
6162
+ // `Array.prototype.flat` method
6163
+ // https://tc39.es/ecma262/#sec-array.prototype.flat
6164
+ $$a({ target: 'Array', proto: true }, {
6165
+ flat: function flat(/* depthArg = 1 */) {
6166
+ var depthArg = arguments.length ? arguments[0] : undefined;
6167
+ var O = toObject$1(this);
6168
+ var sourceLen = lengthOfArrayLike$2(O);
6169
+ var A = arraySpeciesCreate(O, 0);
6170
+ A.length = flattenIntoArray(A, O, O, sourceLen, 0, depthArg === undefined ? 1 : toIntegerOrInfinity(depthArg));
6171
+ return A;
6172
+ }
6173
+ });
6174
+
6175
+ // this method was added to unscopables after implementation
6176
+ // in popular engines, so it's moved to a separate module
6177
+ var addToUnscopables = addToUnscopables$4;
6178
+
6179
+ // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
6180
+ addToUnscopables('flat');
6181
+
6182
+ const FormStepperReviewer = props => {
6183
+ var _a, _b, _c;
6184
+ const {
6185
+ uischema,
6186
+ data,
6187
+ schema,
6188
+ ajv,
6189
+ cells,
6190
+ enabled,
6191
+ navigationFunc
6192
+ } = props;
6193
+ const componentProps = (_b = (_a = uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps) !== null && _b !== void 0 ? _b : {};
6194
+ const readOnly = (_c = componentProps === null || componentProps === void 0 ? void 0 : componentProps.readOnly) !== null && _c !== void 0 ? _c : false;
6195
+ const categorization = uischema;
6196
+ const categories = categorization.elements.filter(category => isVisible(category, data, '', ajv));
6197
+ const rescopeMaps = ['#/properties/albertaAddress', '#/properties/canadianAddress', '#/properties/sin'];
6198
+ return jsx(ReviewItem, {
6199
+ children: categories.map((category, index) => {
6200
+ const categoryLabel = category.label || category.i18n || 'Unknown Category';
6201
+ const testId = `${categoryLabel}-review-link`;
6202
+ return jsxs(ReviewItemSection, {
6203
+ children: [jsxs(ReviewItemHeader, {
6204
+ children: [jsx(ReviewItemTitle, {
6205
+ children: categoryLabel
6206
+ }), navigationFunc && jsx(Anchor, {
6207
+ onClick: () => {
6208
+ navigationFunc(index);
6209
+ },
6210
+ "data-testid": testId,
6211
+ onKeyDown: e => {
6212
+ if (!readOnly && (e.key === ' ' || e.key === 'Enter')) {
6213
+ e.preventDefault();
6214
+ navigationFunc(index);
6215
+ }
6216
+ },
6217
+ children: readOnly ? 'View' : 'Edit'
6218
+ })]
6219
+ }), jsx(GoAGrid, {
6220
+ minChildWidth: "100%",
6221
+ children: category.elements.filter(field => {
6222
+ var _a, _b;
6223
+ // [TODO] we need to double check why we cannot hide the elements at the element level
6224
+ const conditionProps = (_a = field.rule) === null || _a === void 0 ? void 0 : _a.condition;
6225
+ /* istanbul ignore next */
6226
+ if (conditionProps && data) {
6227
+ const canHideControlParts = (_b = conditionProps === null || conditionProps === void 0 ? void 0 : conditionProps.scope) === null || _b === void 0 ? void 0 : _b.split('/');
6228
+ const canHideControl = canHideControlParts && canHideControlParts[(canHideControlParts === null || canHideControlParts === void 0 ? void 0 : canHideControlParts.length) - 1];
6229
+ const isHidden = getProperty(data, canHideControl);
6230
+ if (!isHidden) {
6231
+ return field;
6232
+ }
6233
+ } else {
6234
+ return field;
6235
+ }
6236
+ }).map(e => {
6237
+ const layout = e;
6238
+ if (rescopeMaps.some(scope => {
6239
+ var _a;
6240
+ return (_a = layout.elements) === null || _a === void 0 ? void 0 : _a.map(el => {
6241
+ const element = el;
6242
+ return element.scope;
6243
+ }).includes(scope);
6244
+ })) {
6245
+ return layout.elements;
6246
+ } else {
6247
+ return e;
6248
+ }
6249
+ }).flat().map((element, index) => {
6250
+ return jsx("div", {
6251
+ className: "element-style",
6252
+ children: jsx(JsonFormsDispatch, {
6253
+ "data-testid": `jsonforms-object-list-defined-elements-dispatch`,
6254
+ schema: schema,
6255
+ uischema: element,
6256
+ enabled: enabled,
6257
+ renderers: GoAReviewRenderers,
6258
+ cells: cells
6259
+ })
6260
+ }, `form-stepper-category-${index}`);
6261
+ })
6262
+ })]
6263
+ }, index);
6264
+ })
6150
6265
  });
6151
6266
  };
6267
+ const FormStepperReviewControl = withAjvProps(withTranslateProps(withJsonFormsLayoutProps(FormStepperReviewer)));
6152
6268
 
6153
6269
  const summaryLabel = 'Summary';
6154
6270
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -6377,6 +6493,84 @@ const BackButton = ({
6377
6493
  });
6378
6494
  };
6379
6495
 
6496
+ const FormStepperPageReviewer = props => {
6497
+ var _a, _b;
6498
+ const {
6499
+ uischema,
6500
+ data,
6501
+ schema,
6502
+ ajv,
6503
+ cells,
6504
+ enabled,
6505
+ navigationFunc
6506
+ } = props;
6507
+ (_b = (_a = uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps) !== null && _b !== void 0 ? _b : {};
6508
+ const categorization = uischema;
6509
+ const categories = categorization.elements.filter(category => isVisible(category, data, '', ajv));
6510
+ const rescopeMaps = ['#/properties/albertaAddress', '#/properties/canadianAddress', '#/properties/sin'];
6511
+ return jsxs(TableReviewItem, {
6512
+ children: [jsx("h2", {
6513
+ children: "Review your answers"
6514
+ }), categories.map((category, index) => {
6515
+ const categoryLabel = category.label || category.i18n || 'Unknown Category';
6516
+ return jsxs(Fragment, {
6517
+ children: [jsx(TableReviewCategoryLabel, {
6518
+ children: categoryLabel
6519
+ }), jsx(TableReviewItemSection, {
6520
+ children: category.elements.filter(field => {
6521
+ var _a, _b;
6522
+ // [TODO] we need to double check why we cannot hide the elements at the element level
6523
+ const conditionProps = (_a = field.rule) === null || _a === void 0 ? void 0 : _a.condition;
6524
+ /* istanbul ignore next */
6525
+ if (conditionProps && data) {
6526
+ const canHideControlParts = (_b = conditionProps === null || conditionProps === void 0 ? void 0 : conditionProps.scope) === null || _b === void 0 ? void 0 : _b.split('/');
6527
+ const canHideControl = canHideControlParts && canHideControlParts[(canHideControlParts === null || canHideControlParts === void 0 ? void 0 : canHideControlParts.length) - 1];
6528
+ const isHidden = getProperty(data, canHideControl);
6529
+ if (!isHidden) {
6530
+ return field;
6531
+ }
6532
+ } else {
6533
+ return field;
6534
+ }
6535
+ }).map(e => {
6536
+ const layout = e;
6537
+ if (rescopeMaps.some(scope => {
6538
+ var _a;
6539
+ return (_a = layout.elements) === null || _a === void 0 ? void 0 : _a.map(el => {
6540
+ const element = el;
6541
+ return element.scope;
6542
+ }).includes(scope);
6543
+ })) {
6544
+ return layout.elements;
6545
+ } else {
6546
+ return e;
6547
+ }
6548
+ }).flat().map(element => {
6549
+ return jsx(GoATable, {
6550
+ width: "100%",
6551
+ children: jsx("tbody", {
6552
+ children: jsx(JsonFormsDispatch, {
6553
+ "data-testid": `jsonforms-object-list-defined-elements-dispatch`,
6554
+ schema: schema,
6555
+ uischema: Object.assign(Object.assign({}, element), {
6556
+ options: Object.assign(Object.assign({}, element === null || element === void 0 ? void 0 : element.options), {
6557
+ categoryIndex: index
6558
+ })
6559
+ }),
6560
+ enabled: enabled,
6561
+ renderers: GoABaseTableReviewRenderers,
6562
+ cells: cells
6563
+ })
6564
+ })
6565
+ });
6566
+ })
6567
+ }, index)]
6568
+ });
6569
+ })]
6570
+ });
6571
+ };
6572
+ withAjvProps(withTranslateProps(withJsonFormsLayoutProps(FormStepperPageReviewer)));
6573
+
6380
6574
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
6381
6575
  const FormPageStepper = props => {
6382
6576
  const formStepperCtx = useContext(JsonFormsStepperContext);
@@ -6406,7 +6600,8 @@ const FormPagesView = props => {
6406
6600
  const formStepperCtx = useContext(JsonFormsStepperContext);
6407
6601
  const {
6408
6602
  validatePage,
6409
- goToPage
6603
+ goToPage,
6604
+ toggleShowReviewLink
6410
6605
  } = formStepperCtx;
6411
6606
  const {
6412
6607
  categories,
@@ -6436,9 +6631,9 @@ const FormPagesView = props => {
6436
6631
  visible: visible,
6437
6632
  children: jsx("div", {
6438
6633
  id: `${path || `goa`}-form-pages`,
6439
- children: jsx(PageBorder, {
6440
- children: categories === null || categories === void 0 ? void 0 : categories.map((category, index) => {
6441
- const props = {
6634
+ children: jsxs(PageBorder, {
6635
+ children: [categories === null || categories === void 0 ? void 0 : categories.map((category, index) => {
6636
+ const categoryProps = {
6442
6637
  category: category.uischema,
6443
6638
  categoryIndex: category.id,
6444
6639
  visible: category === null || category === void 0 ? void 0 : category.visible,
@@ -6462,28 +6657,46 @@ const FormPagesView = props => {
6462
6657
  }), jsxs(PageRenderPadding, {
6463
6658
  children: [jsxs("h3", {
6464
6659
  children: ["Step ", index + 1, " of ", categories.length]
6465
- }), jsx(RenderStepElements, Object.assign({}, props))]
6660
+ }), jsx(RenderStepElements, Object.assign({}, categoryProps))]
6466
6661
  }), jsx(PageRenderPadding, {
6467
- children: index !== categories.length - 1 ? jsx(GoAButton, {
6468
- type: "submit",
6469
- onClick: () => goToPage(activeId + 1),
6470
- disabled: !(category.isValid && category.isCompleted),
6471
- testId: "pages-save-continue-btn",
6472
- children: "Save and continue"
6473
- }) : jsx(GoAButtonGroup, {
6474
- alignment: "end",
6475
- children: jsx(GoAButton, {
6476
- type: 'primary',
6477
- onClick: handleSubmit,
6478
- disabled: !isValid,
6479
- testId: "pages-submit-btn",
6480
- children: "Submit"
6481
- })
6662
+ children: jsxs(GoAButtonGroup, {
6663
+ alignment: "start",
6664
+ children: [jsx(GoAButton, {
6665
+ type: "submit",
6666
+ onClick: () => goToPage(activeId + 1),
6667
+ disabled: !(category.isValid && category.isCompleted),
6668
+ testId: "pages-save-continue-btn",
6669
+ children: "Save and continue"
6670
+ }), category.showReviewPageLink && jsx(GoAButton, {
6671
+ type: "tertiary",
6672
+ onClick: () => {
6673
+ toggleShowReviewLink(activeId);
6674
+ goToPage(categories.length);
6675
+ },
6676
+ testId: "pages-to-review-page-btn",
6677
+ children: "Back to application overview"
6678
+ })]
6482
6679
  })
6483
6680
  })]
6484
6681
  }, `${category.label}`);
6485
6682
  }
6486
- })
6683
+ }), isOnReview && jsxs("div", {
6684
+ "data-testid": "stepper-pages-review-page",
6685
+ children: [jsx(FormStepperPageReviewer, Object.assign({}, props, {
6686
+ navigationFunc: goToPage
6687
+ })), jsx(PageRenderPadding, {
6688
+ children: jsx(GoAButtonGroup, {
6689
+ alignment: "end",
6690
+ children: jsx(GoAButton, {
6691
+ type: 'primary',
6692
+ onClick: handleSubmit,
6693
+ disabled: !isValid,
6694
+ testId: "pages-submit-btn",
6695
+ children: "Submit"
6696
+ })
6697
+ })
6698
+ })]
6699
+ })]
6487
6700
  })
6488
6701
  })
6489
6702
  }), jsxs(GoAModal, {
@@ -7234,6 +7447,21 @@ function objectListReducer(state, action) {
7234
7447
  }
7235
7448
  }
7236
7449
 
7450
+ function extractNames(obj, names = []) {
7451
+ if (Array.isArray(obj)) {
7452
+ obj.forEach(item => extractNames(item, names));
7453
+ } else if (typeof obj === 'object' && obj !== null) {
7454
+ const typedObj = obj;
7455
+ if (typeof typedObj.label === 'string') {
7456
+ names.push(typedObj.label);
7457
+ } else if (typeof typedObj.scope === 'string') {
7458
+ const parts = typedObj.scope.split('/');
7459
+ names.push(parts[parts.length - 1]);
7460
+ }
7461
+ Object.values(typedObj).forEach(value => extractNames(value, names));
7462
+ }
7463
+ return names;
7464
+ }
7237
7465
  const GenerateRows$1 = (Cell, schema, rowPath, enabled, openDeleteDialog, handleChange, cells, uischema, isInReview, count, data,
7238
7466
  // eslint-disable-next-line
7239
7467
  errors) => {
@@ -7265,6 +7493,7 @@ errors) => {
7265
7493
  rowPath,
7266
7494
  cellPath: rowPath,
7267
7495
  enabled,
7496
+ uischema,
7268
7497
  isInReview,
7269
7498
  openDeleteDialog,
7270
7499
  handleChange,
@@ -7315,7 +7544,7 @@ function capitalizeFirstLetter(str) {
7315
7544
  return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
7316
7545
  }
7317
7546
  const NonEmptyCellComponent$1 = /*#__PURE__*/React.memo(function NonEmptyCellComponent(props) {
7318
- var _a, _b;
7547
+ var _a, _b, _c;
7319
7548
  const {
7320
7549
  schema,
7321
7550
  enabled,
@@ -7332,10 +7561,14 @@ const NonEmptyCellComponent$1 = /*#__PURE__*/React.memo(function NonEmptyCellCom
7332
7561
  } = props;
7333
7562
  const properties = (schema === null || schema === void 0 ? void 0 : schema.items) && 'properties' in schema.items && schema.items.properties || {};
7334
7563
  const required = (_a = schema.items) === null || _a === void 0 ? void 0 : _a.required;
7564
+ let tableKeys = extractNames((_b = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _b === void 0 ? void 0 : _b.detail);
7565
+ if (tableKeys.length === 0) {
7566
+ tableKeys = Object.keys(properties);
7567
+ }
7335
7568
  return jsxs(NonEmptyCellStyle, {
7336
7569
  children: [
7337
7570
  // eslint-disable-next-line
7338
- (_b = uischema === null || uischema === void 0 ? void 0 : uischema.elements) === null || _b === void 0 ? void 0 : _b.map(element => {
7571
+ (_c = uischema === null || uischema === void 0 ? void 0 : uischema.elements) === null || _c === void 0 ? void 0 : _c.map(element => {
7339
7572
  return jsx(JsonFormsDispatch, {
7340
7573
  "data-testid": `jsonforms-object-list-defined-elements-dispatch`,
7341
7574
  schema: schema,
@@ -7349,7 +7582,7 @@ const NonEmptyCellComponent$1 = /*#__PURE__*/React.memo(function NonEmptyCellCom
7349
7582
  width: "100%",
7350
7583
  children: [jsx("thead", {
7351
7584
  children: jsxs("tr", {
7352
- children: [Object.keys(properties).map((key, index) => {
7585
+ children: [tableKeys.map((key, index) => {
7353
7586
  if (!isInReview) {
7354
7587
  return jsx("th", {
7355
7588
  children: jsxs("p", {
@@ -7628,7 +7861,7 @@ const ObjectArrayControl = props => {
7628
7861
  };
7629
7862
  useEffect(() => {
7630
7863
  // eslint-disable-next-line
7631
- const updatedData = Object.fromEntries((parsedData || []).map((item, index) => [index, item]));
7864
+ const updatedData = Array.isArray(parsedData) ? Object.fromEntries(parsedData.map((item, index) => [index, item])) : {};
7632
7865
  const count = Object.keys(updatedData).length;
7633
7866
  const dispatchData = {
7634
7867
  [path]: {
@@ -10925,6 +11158,63 @@ const GoABaseReviewRenderers = [
10925
11158
  tester: HelpContentTester,
10926
11159
  renderer: HelpReviewContent
10927
11160
  }];
11161
+ const GoABaseTableReviewRenderers = [
11162
+ // controls
11163
+ {
11164
+ tester: GoAEnumControlTester,
11165
+ renderer: GoAInputBaseTableReviewControl
11166
+ }, {
11167
+ tester: GoAIntegerControlTester,
11168
+ renderer: GoAInputBaseTableReviewControl
11169
+ }, {
11170
+ tester: GoANumberControlTester,
11171
+ renderer: GoAInputBaseTableReviewControl
11172
+ }, {
11173
+ tester: GoATextControlTester,
11174
+ renderer: GoAInputBaseTableReviewControl
11175
+ }, {
11176
+ tester: GoADateControlTester,
11177
+ renderer: GoAInputBaseTableReviewControl
11178
+ }, {
11179
+ tester: GoADateTimeControlTester,
11180
+ renderer: GoAInputBaseTableReviewControl
11181
+ }, {
11182
+ tester: GoATimeControlTester,
11183
+ renderer: GoAInputBaseTableReviewControl
11184
+ }, {
11185
+ tester: GoARadioGroupControlTester,
11186
+ renderer: GoAInputBaseTableReviewControl
11187
+ }, {
11188
+ tester: GoACheckoutGroupControlTester,
11189
+ renderer: GoAInputBaseTableReviewControl
11190
+ }, {
11191
+ tester: GoABooleanControlTester,
11192
+ renderer: GoAInputBaseTableReviewControl
11193
+ }, {
11194
+ tester: GoABooleanRadioControlTester,
11195
+ renderer: GoAInputBaseTableReviewControl
11196
+ }, {
11197
+ tester: MultiLineTextControlTester,
11198
+ renderer: GoAInputBaseTableReviewControl
11199
+ }, {
11200
+ tester: GoAArrayControlTester,
11201
+ renderer: GoAInputBaseTableReviewControl
11202
+ }, {
11203
+ tester: GoAListWithDetailsTester,
11204
+ renderer: GoAInputBaseTableReviewControl
11205
+ }, {
11206
+ tester: GoAHorizontalLayoutTester,
11207
+ renderer: GoAInputBaseTableReviewControl
11208
+ }, {
11209
+ tester: GoAlVerticalLayoutTester,
11210
+ renderer: GoAInputBaseTableReviewControl
11211
+ }, {
11212
+ tester: GoAGroupReviewLayoutTester,
11213
+ renderer: GoAInputBaseTableReviewControl
11214
+ }, {
11215
+ tester: HelpContentTester,
11216
+ renderer: GoAInputBaseTableReviewControl
11217
+ }];
10928
11218
  const GoAReviewRenderers = [...GoABaseReviewRenderers, {
10929
11219
  tester: CategorizationStepperRendererTester,
10930
11220
  renderer: FormStepperReviewControl
@@ -10965,4 +11255,4 @@ const GoARenderers = [...GoABaseRenderers, {
10965
11255
  }];
10966
11256
  const GoACells = [...InputCells];
10967
11257
 
10968
- export { ADD_DATALIST_ACTION, ADD_NO_ANONYMOUS_ACTION, ADD_REGISTER_DATA_ACTION, ADD_REGISTER_DATA_ERROR, AddressLookUpControl, AddressLookUpControlReview, AddressLookUpTester, ArrayControl, ArrayControlBase, ArrayControlReview, BooleanComponent, BooleanControl, BooleanRadioComponent, BooleanRadioControl, CategorizationPagesRendererTester, CategorizationStepperRendererTester, CheckboxGroup, ContextProviderC, ContextProviderClass, ContextProviderFactory, EnumCheckboxControl, EnumRadioControl, EnumSelect, FileUploader, FileUploaderReview, FileUploaderTester, FormPageStepper, FormPagesView, FormStepper, FormStepperControl, FormStepperPagesControl, FormStepperReviewControl, FormStepperReviewer, FormStepperView, FullNameControl, FullNameDobControl, FullNameDobReviewControl, FullNameDobTester, FullNameReviewControl, FullNameTester, GoAArrayControlRenderer, GoAArrayControlReviewRenderer, GoAArrayControlTester, GoABaseInputReviewComponent, GoABaseRenderers, GoABaseReviewRenderers, GoABooleanControl, GoABooleanControlTester, GoABooleanRadioControl, GoABooleanRadioControlTester, GoACells, GoACheckoutGroupControlTester, GoADateControl, GoADateControlTester, GoADateInput, GoADateTimeControl, GoADateTimeControlTester, GoADateTimeInput, GoAEnumCheckboxGroupControl, GoAEnumControl, GoAEnumControlTester, GoAEnumRadioGroupControl, GoAInputBaseControl, GoAInputDateControl, GoAInputDateTimeControl, GoAInputInteger, GoAInputIntegerControl, GoAInputNumberControl, GoAInputText, GoAInputTextControl, GoAInputTimeControl, GoAIntegerControl, GoAIntegerControlTester, GoAListWithDetailsControlRenderer, GoAListWithDetailsTester, GoANumberControl, GoANumberControlTester, GoANumberInput, GoARadioGroupControlTester, GoARenderers, GoAReviewRenderers, GoATextControl, GoATextControlTester, GoATimeControl, GoATimeControlTester, GoATimeInput, GoInputBaseReview, GoInputBaseReviewControl, JsonFormContext, JsonFormRegisterProvider, JsonFormsRegisterContext, ListWithDetailsControl, MultiLineText, MultiLineTextControl, MultiLineTextControlInput, MultiLineTextControlTester, RadioGroup, categoriesAreValid, createDefaultAjv, enumControl, errMalformedDate, formatSin, isAddressLookup, isFullName, isFullNameDoB, registerReducer, resolveRefs, tryResolveRefs };
11258
+ export { ADD_DATALIST_ACTION, ADD_NO_ANONYMOUS_ACTION, ADD_REGISTER_DATA_ACTION, ADD_REGISTER_DATA_ERROR, AddressLookUpControl, AddressLookUpControlReview, AddressLookUpTester, ArrayControl, ArrayControlBase, ArrayControlReview, BooleanComponent, BooleanControl, BooleanRadioComponent, BooleanRadioControl, CategorizationPagesRendererTester, CategorizationStepperRendererTester, CheckboxGroup, ContextProviderC, ContextProviderClass, ContextProviderFactory, EnumCheckboxControl, EnumRadioControl, EnumSelect, FileUploader, FileUploaderReview, FileUploaderTester, FormPageStepper, FormPagesView, FormStepper, FormStepperControl, FormStepperPagesControl, FormStepperReviewControl, FormStepperReviewer, FormStepperView, FullNameControl, FullNameDobControl, FullNameDobReviewControl, FullNameDobTester, FullNameReviewControl, FullNameTester, GoAArrayControlRenderer, GoAArrayControlReviewRenderer, GoAArrayControlTester, GoABaseInputReviewComponent, GoABaseRenderers, GoABaseReviewRenderers, GoABaseTableReviewRenderers, GoABooleanControl, GoABooleanControlTester, GoABooleanRadioControl, GoABooleanRadioControlTester, GoACells, GoACheckoutGroupControlTester, GoADateControl, GoADateControlTester, GoADateInput, GoADateTimeControl, GoADateTimeControlTester, GoADateTimeInput, GoAEnumCheckboxGroupControl, GoAEnumControl, GoAEnumControlTester, GoAEnumRadioGroupControl, GoAInputBaseControl, GoAInputBaseTableReview, GoAInputBaseTableReviewControl, GoAInputDateControl, GoAInputDateTimeControl, GoAInputInteger, GoAInputIntegerControl, GoAInputNumberControl, GoAInputText, GoAInputTextControl, GoAInputTimeControl, GoAIntegerControl, GoAIntegerControlTester, GoAListWithDetailsControlRenderer, GoAListWithDetailsTester, GoANumberControl, GoANumberControlTester, GoANumberInput, GoARadioGroupControlTester, GoARenderers, GoAReviewRenderers, GoATextControl, GoATextControlTester, GoATimeControl, GoATimeControlTester, GoATimeInput, GoInputBaseReview, GoInputBaseReviewControl, JsonFormContext, JsonFormRegisterProvider, JsonFormsRegisterContext, ListWithDetailsControl, MultiLineText, MultiLineTextControl, MultiLineTextControlInput, MultiLineTextControlTester, RadioGroup, categoriesAreValid, createDefaultAjv, enumControl, errMalformedDate, formatSin, isAddressLookup, isFullName, isFullNameDoB, registerReducer, resolveRefs, tryResolveRefs };