@abgov/jsonforms-components 1.22.3 → 1.23.0
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
|
@@ -4880,6 +4880,7 @@ const FormStepper = props => {
|
|
|
4880
4880
|
const submitForm = submitFormFunction && submitFormFunction();
|
|
4881
4881
|
const categorization = uischema;
|
|
4882
4882
|
const allCategories = JSON.parse(JSON.stringify(categorization));
|
|
4883
|
+
const componentProps = (_b = (_a = uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps) !== null && _b !== void 0 ? _b : {};
|
|
4883
4884
|
const [step, setStep] = React.useState(0);
|
|
4884
4885
|
const [isFormValid, setIsFormValid] = React.useState(false);
|
|
4885
4886
|
const [showNextBtn, setShowNextBtn] = React.useState(true);
|
|
@@ -4918,10 +4919,9 @@ const FormStepper = props => {
|
|
|
4918
4919
|
setIsFormValid(isValid);
|
|
4919
4920
|
}, [ajv, data, schema]);
|
|
4920
4921
|
useEffect(() => {
|
|
4921
|
-
var _a, _b;
|
|
4922
4922
|
// Override the "controlled Navigation", if property is supplied
|
|
4923
4923
|
// Default: no controlled nav.
|
|
4924
|
-
setStep((
|
|
4924
|
+
setStep((componentProps === null || componentProps === void 0 ? void 0 : componentProps.controlledNav) ? 1 : 0);
|
|
4925
4925
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4926
4926
|
}, []);
|
|
4927
4927
|
if ((categories === null || categories === void 0 ? void 0 : categories.length) < 1) {
|
|
@@ -4960,7 +4960,7 @@ const FormStepper = props => {
|
|
|
4960
4960
|
const isInputInitialized = inputId => {
|
|
4961
4961
|
return inputId in inputStatuses;
|
|
4962
4962
|
};
|
|
4963
|
-
const readOnly = (_c =
|
|
4963
|
+
const readOnly = (_c = componentProps === null || componentProps === void 0 ? void 0 : componentProps.readOnly) !== null && _c !== void 0 ? _c : false;
|
|
4964
4964
|
const isFormSubmitted = (_d = enumerators === null || enumerators === void 0 ? void 0 : enumerators.isFormSubmitted) !== null && _d !== void 0 ? _d : false;
|
|
4965
4965
|
return jsx("div", {
|
|
4966
4966
|
"data-testid": "form-stepper-test-wrapper",
|
|
@@ -5051,7 +5051,7 @@ const FormStepper = props => {
|
|
|
5051
5051
|
minChildWidth: "100px",
|
|
5052
5052
|
children: [jsx("div", {
|
|
5053
5053
|
children: step !== 1 ? jsx(GoAButton, {
|
|
5054
|
-
type:
|
|
5054
|
+
type: (componentProps === null || componentProps === void 0 ? void 0 : componentProps.previousButtonType) ? componentProps === null || componentProps === void 0 ? void 0 : componentProps.previousButtonType : 'secondary',
|
|
5055
5055
|
disabled: disabledCategoryMap[step - 1],
|
|
5056
5056
|
onClick: () => {
|
|
5057
5057
|
const element = document.getElementById(`${path || `goa`}-form-stepper`);
|
|
@@ -5061,11 +5061,11 @@ const FormStepper = props => {
|
|
|
5061
5061
|
prevPage(step, disabledCategoryMap);
|
|
5062
5062
|
},
|
|
5063
5063
|
testId: "prev-button",
|
|
5064
|
-
children:
|
|
5064
|
+
children: (componentProps === null || componentProps === void 0 ? void 0 : componentProps.previousButtonLabel) ? componentProps === null || componentProps === void 0 ? void 0 : componentProps.previousButtonLabel : 'Previous'
|
|
5065
5065
|
}) : jsx("div", {})
|
|
5066
5066
|
}), jsxs(RightAlignmentDiv, {
|
|
5067
5067
|
children: [step !== null && showNextBtn && jsx(GoAButton, {
|
|
5068
|
-
type:
|
|
5068
|
+
type: (componentProps === null || componentProps === void 0 ? void 0 : componentProps.nextButtonType) ? componentProps === null || componentProps === void 0 ? void 0 : componentProps.nextButtonType : 'primary',
|
|
5069
5069
|
disabled: disabledCategoryMap[step - 1],
|
|
5070
5070
|
onClick: () => {
|
|
5071
5071
|
const element = document.getElementById(`${path || `goa`}-form-stepper`);
|
|
@@ -5075,10 +5075,10 @@ const FormStepper = props => {
|
|
|
5075
5075
|
nextPage(step, disabledCategoryMap);
|
|
5076
5076
|
},
|
|
5077
5077
|
testId: "next-button",
|
|
5078
|
-
children:
|
|
5078
|
+
children: (componentProps === null || componentProps === void 0 ? void 0 : componentProps.nextButtonLabel) ? componentProps === null || componentProps === void 0 ? void 0 : componentProps.nextButtonLabel : 'Next'
|
|
5079
5079
|
}), !showNextBtn && !isFormSubmitted && jsx("div", {
|
|
5080
5080
|
children: jsx(GoAButton, {
|
|
5081
|
-
type:
|
|
5081
|
+
type: 'primary',
|
|
5082
5082
|
onClick: handleSubmit,
|
|
5083
5083
|
disabled: !isFormValid,
|
|
5084
5084
|
testId: "stepper-submit-btn",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abgov/jsonforms-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.23.0",
|
|
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,8 +1,17 @@
|
|
|
1
|
+
import { GoAButtonType } from '@abgov/react-components-new';
|
|
1
2
|
import { StatePropsOfLayout } from '@jsonforms/core';
|
|
2
3
|
import { TranslateProps } from '@jsonforms/react';
|
|
3
4
|
import { AjvProps } from '../../util/layout';
|
|
4
5
|
export interface CategorizationStepperLayoutRendererProps extends StatePropsOfLayout, AjvProps, TranslateProps {
|
|
5
6
|
}
|
|
7
|
+
export interface FormStepperComponentProps {
|
|
8
|
+
nextButtonLabel?: string;
|
|
9
|
+
nextButtonType?: GoAButtonType;
|
|
10
|
+
previousButtonLabel?: string;
|
|
11
|
+
previousButtonType?: GoAButtonType;
|
|
12
|
+
controlledNav?: number;
|
|
13
|
+
readOnly?: boolean;
|
|
14
|
+
}
|
|
6
15
|
export declare const FormStepper: (props: CategorizationStepperLayoutRendererProps) => JSX.Element;
|
|
7
16
|
export declare const FormStepperControl: (props: CategorizationStepperLayoutRendererProps & import("@jsonforms/core").OwnPropsOfLayout) => import("react/jsx-runtime").JSX.Element;
|
|
8
17
|
export default FormStepper;
|