@abgov/jsonforms-components 1.4.0 → 1.5.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 +35 -10
- package/package.json +1 -1
package/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { withAjvProps, materialSliderControlTester, MaterialSliderControl, materialObjectControlTester, MaterialObjectRenderer, materialAllOfControlTester, MaterialAllOfRenderer, materialAnyOfControlTester, MaterialAnyOfRenderer, materialOneOfControlTester, MaterialOneOfRenderer, materialOneOfRadioGroupControlTester, MaterialOneOfRadioGroupControl, materialOneOfEnumControlTester, MaterialOneOfEnumControl, materialHorizontalLayoutTester, materialVerticalLayoutTester, materialArrayLayoutTester, MaterialArrayLayout, materialAnyOfStringOrEnumControlTester, MaterialAnyOfStringOrEnumControl, materialEnumArrayRendererTester, MaterialEnumArrayRenderer, materialBooleanCellTester, MaterialBooleanCell, materialBooleanToggleCellTester, MaterialBooleanToggleCell, materialEnumCellTester, MaterialEnumCell, materialOneOfEnumCellTester, MaterialOneOfEnumCell } from '@jsonforms/material-renderers';
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
-
import { GoAFormItem, GoACallout, GoAInputDate, GoAInput, GoATextArea, GoAInputDateTime, GoAInputTime, GoADropdown, GoADropdownItem, GoARadioGroup, GoARadioItem, GoACheckbox, GoAFormStepper, GoAFormStep, GoAPages, GoAButton, GoAIconButton, GoAFileUploadInput,
|
|
3
|
+
import { GoAFormItem, GoACallout, GoAInputDate, GoAInput, GoATextArea, GoAInputDateTime, GoAInputTime, GoADropdown, GoADropdownItem, GoARadioGroup, GoARadioItem, GoACheckbox, GoAFormStepper, GoAFormStep, GoAPages, GoAButton, GoAModal, GoAButtonGroup, GoAIconButton, GoAFileUploadInput, GoACircularProgress, GoAGrid, GoAContainer, GoADetails } from '@abgov/react-components';
|
|
4
4
|
import { Hidden, Typography, FormHelperText } from '@mui/material';
|
|
5
5
|
import styled from 'styled-components';
|
|
6
6
|
import { rankWith, uiTypeIs, isDateControl, isStringControl, and, optionIs, isNumberControl, isIntegerControl, isDateTimeControl, isTimeControl, isEnumControl, isBooleanControl, isDescriptionHidden, isVisible, isEnabled, deriveLabelForUISchemaElement, schemaTypeIs, formatIs, createDefaultValue, Paths, or, isObjectArrayControl, isPrimitiveArrayControl, withIncreasedRank, hasType, isControl, isCategorization, isLayout } from '@jsonforms/core';
|
|
@@ -3866,6 +3866,7 @@ const FormStepper = ({
|
|
|
3866
3866
|
const [step, setStep] = useState(1);
|
|
3867
3867
|
const [isFormValid, setIsFormValid] = useState(false);
|
|
3868
3868
|
const [showNextBtn, setShowNextBtn] = useState(true);
|
|
3869
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
3869
3870
|
const [categories, setCategories] = useState(categorization.elements);
|
|
3870
3871
|
useEffect(() => {
|
|
3871
3872
|
const cates = categorization.elements.filter(category => isVisible(category, data, '', ajv));
|
|
@@ -3873,6 +3874,11 @@ const FormStepper = ({
|
|
|
3873
3874
|
}, [categorization, data, ajv]);
|
|
3874
3875
|
const disabledCategoryMap = categories.map(c => !isEnabled(c, data, '', ajv));
|
|
3875
3876
|
const handleSubmit = () => {
|
|
3877
|
+
setIsOpen(true);
|
|
3878
|
+
console.log('submitted', data);
|
|
3879
|
+
};
|
|
3880
|
+
const onSubmit = () => {
|
|
3881
|
+
setIsOpen(false);
|
|
3876
3882
|
console.log('submitted', data);
|
|
3877
3883
|
};
|
|
3878
3884
|
const CategoryLabels = useMemo(() => {
|
|
@@ -3908,15 +3914,17 @@ const FormStepper = ({
|
|
|
3908
3914
|
}
|
|
3909
3915
|
function setTab(page) {
|
|
3910
3916
|
const rawCategoryLabels = rawCategories.elements.map(category => category.label);
|
|
3911
|
-
if (
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
page
|
|
3917
|
+
if (rawCategoryLabels.length !== CategoryLabels.length) {
|
|
3918
|
+
if (page > 1 && page <= rawCategoryLabels.length) {
|
|
3919
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3920
|
+
const selectedTabLabel = rawCategoryLabels[page - 1];
|
|
3921
|
+
const selectedTab = CategoryLabels.indexOf(selectedTabLabel);
|
|
3922
|
+
const newStep = selectedTab !== -1 ? selectedTab + 1 : page;
|
|
3923
|
+
page = newStep;
|
|
3924
|
+
}
|
|
3925
|
+
if (page > rawCategoryLabels.length) {
|
|
3926
|
+
page = page - 1;
|
|
3927
|
+
}
|
|
3920
3928
|
}
|
|
3921
3929
|
setStep(page);
|
|
3922
3930
|
if (page < 1 || page > categories.length + 1) return;
|
|
@@ -4040,6 +4048,23 @@ const FormStepper = ({
|
|
|
4040
4048
|
children: "Submit"
|
|
4041
4049
|
})
|
|
4042
4050
|
})]
|
|
4051
|
+
}), jsxs(GoAModal, {
|
|
4052
|
+
testId: "submit-confirmation",
|
|
4053
|
+
open: isOpen,
|
|
4054
|
+
heading: 'Form Submitted',
|
|
4055
|
+
width: "640px",
|
|
4056
|
+
actions: jsx(GoAButtonGroup, {
|
|
4057
|
+
alignment: "end",
|
|
4058
|
+
children: jsx(GoAButton, {
|
|
4059
|
+
type: "secondary",
|
|
4060
|
+
testId: "submit-form",
|
|
4061
|
+
onClick: onSubmit,
|
|
4062
|
+
children: "Ok"
|
|
4063
|
+
})
|
|
4064
|
+
}),
|
|
4065
|
+
children: [jsx("b", {
|
|
4066
|
+
children: "Submit is a test for preview purposes"
|
|
4067
|
+
}), "(i.e. no actual form is being submitted)"]
|
|
4043
4068
|
})]
|
|
4044
4069
|
})
|
|
4045
4070
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abgov/jsonforms-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.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",
|