@abgov/jsonforms-components 1.14.5 → 1.15.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
@@ -3823,11 +3823,13 @@ const enumSubmitFunctions = new Map();
3823
3823
  const baseEnumerator = {
3824
3824
  data: enumValues,
3825
3825
  functions: enumFunctions,
3826
- submitFunction: enumSubmitFunctions
3826
+ submitFunction: enumSubmitFunctions,
3827
+ isFormSubmitted: false
3827
3828
  };
3828
3829
  const JsonFormContext = /*#__PURE__*/createContext(baseEnumerator);
3829
3830
  function ContextProvider(props) {
3830
- var _a;
3831
+ var _a, _b;
3832
+ baseEnumerator.isFormSubmitted = (_a = props.isFormSubmitted) !== null && _a !== void 0 ? _a : false;
3831
3833
  if (props.fileManagement) {
3832
3834
  const {
3833
3835
  fileList,
@@ -3849,7 +3851,7 @@ function ContextProvider(props) {
3849
3851
  }
3850
3852
  if (props.data) {
3851
3853
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3852
- (_a = props.data) === null || _a === void 0 ? void 0 : _a.forEach(item => {
3854
+ (_b = props.data) === null || _b === void 0 ? void 0 : _b.forEach(item => {
3853
3855
  enumValues.set(Object.keys(item)[0], () => item);
3854
3856
  });
3855
3857
  }
@@ -4604,7 +4606,7 @@ const mapToVisibleStep = (step, allSteps, visibleSteps) => {
4604
4606
 
4605
4607
  const summaryLabel = 'Summary';
4606
4608
  const FormStepper = props => {
4607
- var _a, _b, _c, _d;
4609
+ var _a, _b, _c, _d, _e;
4608
4610
  const {
4609
4611
  uischema,
4610
4612
  data,
@@ -4703,6 +4705,7 @@ const FormStepper = props => {
4703
4705
  return inputId in inputStatuses;
4704
4706
  };
4705
4707
  const readOnly = (_c = (_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps) === null || _b === void 0 ? void 0 : _b.readOnly) !== null && _c !== void 0 ? _c : false;
4708
+ const isFormSubmitted = (_d = enumerators === null || enumerators === void 0 ? void 0 : enumerators.isFormSubmitted) !== null && _d !== void 0 ? _d : false;
4706
4709
  return jsx("div", {
4707
4710
  "data-testid": "form-stepper-test-wrapper",
4708
4711
  children: jsx(Visible, {
@@ -4711,7 +4714,7 @@ const FormStepper = props => {
4711
4714
  id: `${path || `goa`}-form-stepper`,
4712
4715
  className: "formStepper",
4713
4716
  children: [jsxs(GoAFormStepper, {
4714
- testId: ((_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.testId) || 'form-stepper-test',
4717
+ testId: ((_e = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _e === void 0 ? void 0 : _e.testId) || 'form-stepper-test',
4715
4718
  step: step,
4716
4719
  onChange: step => {
4717
4720
  setTab(step);
@@ -4792,7 +4795,7 @@ const FormStepper = props => {
4792
4795
  children: [jsx("div", {
4793
4796
  children: step !== 1 ? jsx(GoAButton, {
4794
4797
  type: "secondary",
4795
- disabled: disabledCategoryMap[step - 1] || !enabled,
4798
+ disabled: disabledCategoryMap[step - 1],
4796
4799
  onClick: () => prevPage(step, disabledCategoryMap),
4797
4800
  testId: "prev-button",
4798
4801
  children: "Previous"
@@ -4800,15 +4803,15 @@ const FormStepper = props => {
4800
4803
  }), jsxs(RightAlignmentDiv, {
4801
4804
  children: [step !== null && showNextBtn && jsx(GoAButton, {
4802
4805
  type: "primary",
4803
- disabled: disabledCategoryMap[step - 1] || !enabled,
4806
+ disabled: disabledCategoryMap[step - 1],
4804
4807
  onClick: () => nextPage(step, disabledCategoryMap),
4805
4808
  testId: "next-button",
4806
4809
  children: "Next"
4807
- }), !showNextBtn && jsx("div", {
4810
+ }), !showNextBtn && !isFormSubmitted && jsx("div", {
4808
4811
  children: jsx(GoAButton, {
4809
4812
  type: "primary",
4810
4813
  onClick: handleSubmit,
4811
- disabled: !isFormValid || !enabled,
4814
+ disabled: !isFormValid,
4812
4815
  testId: "stepper-submit-btn",
4813
4816
  children: "Submit"
4814
4817
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "1.14.5",
3
+ "version": "1.15.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",
@@ -19,12 +19,14 @@ type Props = {
19
19
  children?: React.ReactNode;
20
20
  fileManagement?: FileManagement;
21
21
  submit?: SubmitManagement;
22
+ isFormSubmitted?: boolean;
22
23
  data?: any;
23
24
  };
24
25
  export declare const JsonFormContext: React.Context<{
25
26
  data: Map<string, () => Record<string, any>>;
26
27
  functions: Map<string, () => ((file: File, propertyId: string) => void) | undefined>;
27
28
  submitFunction: Map<string, () => ((data: any) => void) | undefined>;
29
+ isFormSubmitted: boolean;
28
30
  }>;
29
31
  export declare function ContextProvider(props: Props): JSX.Element | null;
30
32
  /**
@@ -2,7 +2,6 @@ import { StatePropsOfLayout } from '@jsonforms/core';
2
2
  import { TranslateProps } from '@jsonforms/react';
3
3
  import { AjvProps } from '../../util/layout';
4
4
  export interface CategorizationStepperLayoutRendererProps extends StatePropsOfLayout, AjvProps, TranslateProps {
5
- data: unknown;
6
5
  }
7
6
  export declare const FormStepper: (props: CategorizationStepperLayoutRendererProps) => JSX.Element;
8
7
  export declare const FormStepperControl: (props: CategorizationStepperLayoutRendererProps & import("@jsonforms/core").OwnPropsOfLayout) => import("react/jsx-runtime").JSX.Element;