@abgov/jsonforms-components 1.32.0 → 1.32.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
@@ -3469,7 +3469,7 @@ const JsonFormRegisterProvider = ({
3469
3469
  return [];
3470
3470
  },
3471
3471
  fetchErrors: criteria => {
3472
- var _a;
3472
+ var _a, _b;
3473
3473
  if (criteria === null || criteria === void 0 ? void 0 : criteria.url) {
3474
3474
  const matchFound = registers === null || registers === void 0 ? void 0 : registers.registerData.some(listItem => {
3475
3475
  var _a;
@@ -3480,7 +3480,7 @@ const JsonFormRegisterProvider = ({
3480
3480
  });
3481
3481
  return matchFound ? '' : `${((_a = registers.errors[criteria === null || criteria === void 0 ? void 0 : criteria.url]) === null || _a === void 0 ? void 0 : _a.message) || ''}`;
3482
3482
  } else if (criteria === null || criteria === void 0 ? void 0 : criteria.urn) {
3483
- if (registers === null || registers === void 0 ? void 0 : registers.nonExistent) {
3483
+ if (((_b = registers === null || registers === void 0 ? void 0 : registers.nonExistent) === null || _b === void 0 ? void 0 : _b.length) > 0) {
3484
3484
  const matchFound = registers === null || registers === void 0 ? void 0 : registers.nonExistent.some(listItem => {
3485
3485
  var _a;
3486
3486
  if ((_a = criteria === null || criteria === void 0 ? void 0 : criteria.urn) === null || _a === void 0 ? void 0 : _a.toString().includes(listItem)) {
@@ -4869,7 +4869,7 @@ class ContextProviderClass {
4869
4869
  this.enumValues.set(key, () => data);
4870
4870
  };
4871
4871
  this.setup = props => {
4872
- var _a, _b, _c;
4872
+ var _a, _b;
4873
4873
  this.selfProps = props;
4874
4874
  if (props.fileManagement) {
4875
4875
  const {
@@ -4892,17 +4892,17 @@ class ContextProviderClass {
4892
4892
  }
4893
4893
  if (props.data) {
4894
4894
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4895
- (_a = props.data) === null || _a === void 0 ? void 0 : _a.forEach(item => {
4896
- this.enumValues.set(Object.keys(item)[0], () => item);
4895
+ Object.keys(props.data).forEach(item => {
4896
+ this.enumValues.set(item, () => props.data[item]);
4897
4897
  });
4898
4898
  }
4899
4899
  if (!props.children) {
4900
4900
  return null;
4901
4901
  }
4902
- this.baseEnumerator.isFormSubmitted = (_b = props.isFormSubmitted) !== null && _b !== void 0 ? _b : false;
4902
+ this.baseEnumerator.isFormSubmitted = (_a = props.isFormSubmitted) !== null && _a !== void 0 ? _a : false;
4903
4903
  return jsx(JsonFormContext.Provider, {
4904
4904
  value: this.baseEnumerator,
4905
- children: (_c = this.selfProps) === null || _c === void 0 ? void 0 : _c.children
4905
+ children: (_b = this.selfProps) === null || _b === void 0 ? void 0 : _b.children
4906
4906
  });
4907
4907
  };
4908
4908
  this.getContextProvider = () => {
@@ -4925,8 +4925,6 @@ class ContextProviderClass {
4925
4925
  * Grabs data stored under a given key
4926
4926
  *
4927
4927
  */
4928
- // FIXME give some clue as to what data is being fetched.
4929
- // e.g.is it getFormContextData?
4930
4928
  this.getFormContextData = key => {
4931
4929
  const dataFunction = this.baseEnumerator.data.get(key);
4932
4930
  return dataFunction && dataFunction();
@@ -5412,6 +5410,7 @@ const FileUploader = _a => {
5412
5410
  const fileListValue = enumerators.data.get('file-list');
5413
5411
  const countries = ['Argentina', 'Brazil', 'Canada', 'Denmark', 'Egypt', 'France', 'Greece', 'India', 'Japan', 'Kenya'];
5414
5412
  enumerators.addFormContextData('countries', countries);
5413
+ const user = enumerators === null || enumerators === void 0 ? void 0 : enumerators.getFormContextData('user');
5415
5414
  // eslint-disable-next-line
5416
5415
  const fileList = fileListValue && fileListValue();
5417
5416
  const {
@@ -5460,7 +5459,7 @@ const FileUploader = _a => {
5460
5459
  const timeoutId = setTimeout(delayedFunction, 1);
5461
5460
  return () => clearTimeout(timeoutId);
5462
5461
  }, [handleChange, fileList, propertyId]);
5463
- const readOnly = ((_d = (_c = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _c === void 0 ? void 0 : _c.componentProps) === null || _d === void 0 ? void 0 : _d.readOnly) === true || (props === null || props === void 0 ? void 0 : props.isStepperReview) === true;
5462
+ const readOnly = ((_d = (_c = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _c === void 0 ? void 0 : _c.componentProps) === null || _d === void 0 ? void 0 : _d.readOnly) === true || (props === null || props === void 0 ? void 0 : props.isStepperReview) === true || user === null;
5464
5463
  const maxFileSize = (_g = (_f = (_e = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _e === void 0 ? void 0 : _e.componentProps) === null || _f === void 0 ? void 0 : _f.maxFileSize) !== null && _g !== void 0 ? _g : '';
5465
5464
  const accept = (_k = (_j = (_h = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _h === void 0 ? void 0 : _h.componentProps) === null || _j === void 0 ? void 0 : _j.accept) !== null && _k !== void 0 ? _k : '';
5466
5465
  return jsxs(FileUploaderStyle, {
@@ -6603,7 +6602,8 @@ const GoAGroupControlComponent = props => {
6603
6602
  enabled,
6604
6603
  renderers,
6605
6604
  cells,
6606
- visible
6605
+ visible,
6606
+ isStepperReview
6607
6607
  } = props;
6608
6608
  const group = uischema;
6609
6609
  return jsxs(Visible, {
@@ -6627,7 +6627,9 @@ const GoAGroupControlComponent = props => {
6627
6627
  }), !((_o = group.options) === null || _o === void 0 ? void 0 : _o.componentProps) && jsxs("div", {
6628
6628
  children: [group.label && jsx("h3", {
6629
6629
  children: group.label
6630
- }), jsx(GoAContainer, {
6630
+ }), isStepperReview && jsx(Fragment, {
6631
+ children: renderLayoutElements(group.elements, schema, path, enabled, renderers, cells)
6632
+ }), !isStepperReview && jsx(GoAContainer, {
6631
6633
  children: renderLayoutElements(group.elements, schema, path, enabled, renderers, cells)
6632
6634
  })]
6633
6635
  })]
@@ -6984,6 +6986,14 @@ const GoAErrorControlTester = rankWith(1000, (uischema, schema, context) => {
6984
6986
  });
6985
6987
  var GoAErrorControl = withJsonFormsControlProps(ErrorControl);
6986
6988
 
6989
+ const GoAGroupReviewControlComponent = props => {
6990
+ return jsx(GoAGroupControlComponent, Object.assign({}, props, {
6991
+ isStepperReview: true
6992
+ }));
6993
+ };
6994
+ const GoAGroupReviewLayoutTester = rankWith(1, uiTypeIs('Group'));
6995
+ const GoAGroupReviewControl = withJsonFormsLayoutProps(GoAGroupReviewControlComponent, true);
6996
+
6987
6997
  const createDefaultAjv = (...schemas) => {
6988
6998
  const ajv = new Ajv({
6989
6999
  allErrors: true,
@@ -8312,8 +8322,8 @@ const GoABaseReviewRenderers = [
8312
8322
  tester: GoAlVerticalLayoutTester,
8313
8323
  renderer: GoAVerticalLayout
8314
8324
  }, {
8315
- tester: GoAGroupLayoutTester,
8316
- renderer: GoAGroupControl
8325
+ tester: GoAGroupReviewLayoutTester,
8326
+ renderer: GoAGroupReviewControl
8317
8327
  }, {
8318
8328
  tester: HelpContentTester,
8319
8329
  renderer: HelpReviewContent
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "1.32.0",
3
+ "version": "1.32.1",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Government of Alberta - React renderers for JSON Forms based on the design system.",
6
6
  "repository": "https://github.com/GovAlta/adsp-monorepo",
@@ -1,5 +1,8 @@
1
1
  import React from 'react';
2
2
  import { LayoutProps, RankedTester } from '@jsonforms/core';
3
- export declare const GoAGroupControlComponent: (props: LayoutProps) => JSX.Element;
3
+ export interface withIsStepper {
4
+ isStepperReview: boolean;
5
+ }
6
+ export declare const GoAGroupControlComponent: (props: LayoutProps & withIsStepper) => JSX.Element;
4
7
  export declare const GoAGroupLayoutTester: RankedTester;
5
- export declare const GoAGroupControl: React.ComponentType<LayoutProps & import("@jsonforms/core").OwnPropsOfLayout>;
8
+ export declare const GoAGroupControl: React.ComponentType<LayoutProps & withIsStepper & import("@jsonforms/core").OwnPropsOfLayout>;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { LayoutProps, RankedTester } from '@jsonforms/core';
3
+ export declare const GoAGroupReviewControlComponent: (props: LayoutProps) => JSX.Element;
4
+ export declare const GoAGroupReviewLayoutTester: RankedTester;
5
+ export declare const GoAGroupReviewControl: React.ComponentType<LayoutProps & import("@jsonforms/core").OwnPropsOfLayout>;