@abgov/jsonforms-components 1.54.4 → 1.55.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 +277 -67
- package/package.json +1 -1
- package/src/lib/Controls/FormStepper/BackButton.d.ts +7 -0
- package/src/lib/Controls/FormStepper/FormStepperTester.d.ts +2 -1
- package/src/lib/Controls/FormStepper/PageStepperControl.d.ts +12 -0
- package/src/lib/Controls/FormStepper/index.d.ts +1 -0
- package/src/lib/Controls/FormStepper/styled-components.d.ts +2 -0
- package/src/lib/Controls/Inputs/InputBaseControl.d.ts +1 -1
package/index.esm.js
CHANGED
|
@@ -7,7 +7,7 @@ import axios from 'axios';
|
|
|
7
7
|
import get$1 from 'lodash/get';
|
|
8
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';
|
|
9
9
|
import { withJsonFormsControlProps, withJsonFormsRendererProps, withJsonFormsEnumProps, withTranslateProps, useJsonForms, JsonFormsDispatch, withJsonFormsLayoutProps, withJsonFormsArrayLayoutProps, withJsonFormsCellProps } from '@jsonforms/react';
|
|
10
|
-
import * as _$
|
|
10
|
+
import * as _$c from 'lodash';
|
|
11
11
|
import { isEqual, isObject as isObject$f } from 'lodash';
|
|
12
12
|
import merge from 'lodash/merge';
|
|
13
13
|
import isEmpty from 'lodash/isEmpty';
|
|
@@ -3028,16 +3028,16 @@ const onChangeForNumericControl = props => {
|
|
|
3028
3028
|
}
|
|
3029
3029
|
};
|
|
3030
3030
|
|
|
3031
|
-
let _$
|
|
3032
|
-
_t$
|
|
3031
|
+
let _$b = t => t,
|
|
3032
|
+
_t$b,
|
|
3033
3033
|
_t2$7;
|
|
3034
|
-
styled.div(_t$
|
|
3034
|
+
styled.div(_t$b || (_t$b = _$b`
|
|
3035
3035
|
height: 70vh;
|
|
3036
3036
|
overflow-y: auto;
|
|
3037
3037
|
padding-left: var(--goa-space-2xs);
|
|
3038
3038
|
padding-right: var(--goa-space-2xs);
|
|
3039
3039
|
`));
|
|
3040
|
-
const Visible = styled.div(_t2$7 || (_t2$7 = _$
|
|
3040
|
+
const Visible = styled.div(_t2$7 || (_t2$7 = _$b`
|
|
3041
3041
|
display: ${0};
|
|
3042
3042
|
`), p => p.visible ? 'initial' : 'none');
|
|
3043
3043
|
|
|
@@ -3797,21 +3797,21 @@ const JsonFormRegisterProvider = ({
|
|
|
3797
3797
|
});
|
|
3798
3798
|
};
|
|
3799
3799
|
|
|
3800
|
-
let _$
|
|
3801
|
-
_t$
|
|
3800
|
+
let _$a = t => t,
|
|
3801
|
+
_t$a,
|
|
3802
3802
|
_t2$6,
|
|
3803
3803
|
_t3$5;
|
|
3804
|
-
const FormFieldWrapper = styled.div(_t$
|
|
3804
|
+
const FormFieldWrapper = styled.div(_t$a || (_t$a = _$a`
|
|
3805
3805
|
margin-bottom: var(--goa-space-l);
|
|
3806
3806
|
`));
|
|
3807
|
-
const WarningIconDiv = styled.div(_t2$6 || (_t2$6 = _$
|
|
3807
|
+
const WarningIconDiv = styled.div(_t2$6 || (_t2$6 = _$a`
|
|
3808
3808
|
display: inline-flex;
|
|
3809
3809
|
align-items: flex-start;
|
|
3810
3810
|
gap: 0.25rem;
|
|
3811
3811
|
font-size: var(--goa-font-size-2);
|
|
3812
3812
|
color: var(--goa-color-interactive-error);
|
|
3813
3813
|
`));
|
|
3814
|
-
const RequiredTextLabel = styled.label(_t3$5 || (_t3$5 = _$
|
|
3814
|
+
const RequiredTextLabel = styled.label(_t3$5 || (_t3$5 = _$a`
|
|
3815
3815
|
color: var(--goa-color-greyscale-700);
|
|
3816
3816
|
font-weight: var(--goa-font-weight-regular);
|
|
3817
3817
|
font-size: var(--goa-font-size-2);
|
|
@@ -3829,12 +3829,12 @@ const GoAInputBaseControl = props => {
|
|
|
3829
3829
|
required,
|
|
3830
3830
|
path,
|
|
3831
3831
|
isStepperReview,
|
|
3832
|
-
|
|
3832
|
+
skipInitialValidation
|
|
3833
3833
|
} = props;
|
|
3834
3834
|
const InnerComponent = input;
|
|
3835
3835
|
const labelToUpdate = convertToSentenceCase(getLabelText(uischema.scope, label || ''));
|
|
3836
3836
|
let modifiedErrors = checkFieldValidity(props);
|
|
3837
|
-
const [isVisited, setIsVisited] = useState(
|
|
3837
|
+
const [isVisited, setIsVisited] = useState(skipInitialValidation === true);
|
|
3838
3838
|
if (modifiedErrors === 'must be equal to one of the allowed values') {
|
|
3839
3839
|
modifiedErrors = '';
|
|
3840
3840
|
}
|
|
@@ -4039,12 +4039,12 @@ const SPACE_KEY = ' ';
|
|
|
4039
4039
|
const ALT_KEY = 'Alt';
|
|
4040
4040
|
const SHIFT_KEY = 'Shift';
|
|
4041
4041
|
|
|
4042
|
-
let _$
|
|
4043
|
-
_t$
|
|
4042
|
+
let _$9 = t => t,
|
|
4043
|
+
_t$9,
|
|
4044
4044
|
_t2$5,
|
|
4045
4045
|
_t3$4,
|
|
4046
4046
|
_t4$4;
|
|
4047
|
-
const GoADropdownTextbox = styled.div(_t$
|
|
4047
|
+
const GoADropdownTextbox = styled.div(_t$9 || (_t$9 = _$9`
|
|
4048
4048
|
border-radius: var(--goa-space-2xs);
|
|
4049
4049
|
box-shadow: ${0};
|
|
4050
4050
|
&:hover {
|
|
@@ -4055,11 +4055,11 @@ const GoADropdownTextbox = styled.div(_t$8 || (_t$8 = _$8`
|
|
|
4055
4055
|
box-shadow: ${0};
|
|
4056
4056
|
}
|
|
4057
4057
|
`), p => p.isOpen ? `0 0 0 3px var(--goa-color-interactive-focus)` : '', p => p.isOpen ? `0 0 0 3px var(--goa-color-interactive-focus) !important` : '');
|
|
4058
|
-
const GoADropdownListContainerWrapper = styled.div(_t2$5 || (_t2$5 = _$
|
|
4058
|
+
const GoADropdownListContainerWrapper = styled.div(_t2$5 || (_t2$5 = _$9`
|
|
4059
4059
|
position: relative;
|
|
4060
4060
|
display: ${0};
|
|
4061
4061
|
`), p => !(p === null || p === void 0 ? void 0 : p.isOpen) && 'none');
|
|
4062
|
-
const GoADropdownListContainer = styled.div(_t3$4 || (_t3$4 = _$
|
|
4062
|
+
const GoADropdownListContainer = styled.div(_t3$4 || (_t3$4 = _$9`
|
|
4063
4063
|
border: solid 1px var(--goa-color-greyscale-200);
|
|
4064
4064
|
border-radius: var(--goa-space-2xs);
|
|
4065
4065
|
background: var(--goa-color-greyscale-white);
|
|
@@ -4083,7 +4083,7 @@ const GoADropdownListContainer = styled.div(_t3$4 || (_t3$4 = _$8`
|
|
|
4083
4083
|
scrollbar-color: #a8a8a8 var(--goa-color-greyscale-100) !important;
|
|
4084
4084
|
}
|
|
4085
4085
|
`), p => p.optionListMaxHeight || '272px');
|
|
4086
|
-
const GoADropdownListOption = styled.div(_t4$4 || (_t4$4 = _$
|
|
4086
|
+
const GoADropdownListOption = styled.div(_t4$4 || (_t4$4 = _$9`
|
|
4087
4087
|
padding: var(--goa-space-2xs) var(--goa-space-s);
|
|
4088
4088
|
text-overflow: ellipsis;
|
|
4089
4089
|
color: ${0} !important;
|
|
@@ -5162,8 +5162,8 @@ const BooleanRadioControl = props => jsx(GoAInputBaseControl, Object.assign({},
|
|
|
5162
5162
|
const GoABooleanRadioControlTester = rankWith(3, and(isBooleanControl, optionIs('radio', true)));
|
|
5163
5163
|
const GoABooleanRadioControl = withJsonFormsControlProps(BooleanRadioControl);
|
|
5164
5164
|
|
|
5165
|
-
let _$
|
|
5166
|
-
_t$
|
|
5165
|
+
let _$8 = t => t,
|
|
5166
|
+
_t$8;
|
|
5167
5167
|
const Checkboxes = ({
|
|
5168
5168
|
children,
|
|
5169
5169
|
orientation,
|
|
@@ -5175,7 +5175,7 @@ const Checkboxes = ({
|
|
|
5175
5175
|
children: children
|
|
5176
5176
|
});
|
|
5177
5177
|
};
|
|
5178
|
-
const CheckBoxGroupDiv = styled.div(_t$
|
|
5178
|
+
const CheckBoxGroupDiv = styled.div(_t$8 || (_t$8 = _$8`
|
|
5179
5179
|
.horizontal {
|
|
5180
5180
|
display: flex;
|
|
5181
5181
|
flex-direction: row;
|
|
@@ -5292,12 +5292,12 @@ const GoABaseInputReviewComponent = props => {
|
|
|
5292
5292
|
const GoInputBaseReview = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
|
|
5293
5293
|
input: GoABaseInputReviewComponent,
|
|
5294
5294
|
isStepperReview: true,
|
|
5295
|
-
|
|
5295
|
+
skipInitialValidation: true
|
|
5296
5296
|
}));
|
|
5297
5297
|
const GoInputBaseReviewControl = withJsonFormsControlProps(GoInputBaseReview);
|
|
5298
5298
|
|
|
5299
|
-
let _$
|
|
5300
|
-
_t$
|
|
5299
|
+
let _$7 = t => t,
|
|
5300
|
+
_t$7;
|
|
5301
5301
|
const renderLayoutElements = (elements, schema, path, enabled, renderers, cells) => {
|
|
5302
5302
|
return elements.map((child, index) => jsx("div", {
|
|
5303
5303
|
children: jsx(JsonFormsDispatch, {
|
|
@@ -5378,14 +5378,14 @@ const ReviewLayoutRenderer = ({
|
|
|
5378
5378
|
}
|
|
5379
5379
|
}
|
|
5380
5380
|
};
|
|
5381
|
-
const ReviewGrid = styled.div(_t$
|
|
5381
|
+
const ReviewGrid = styled.div(_t$7 || (_t$7 = _$7`
|
|
5382
5382
|
display: grid;
|
|
5383
5383
|
grid-template-columns: repeat(auto-fit, minmax(250px, calc(50% - 8px)));
|
|
5384
5384
|
gap: 16px;
|
|
5385
5385
|
`));
|
|
5386
5386
|
|
|
5387
|
-
let _$
|
|
5388
|
-
_t$
|
|
5387
|
+
let _$6 = t => t,
|
|
5388
|
+
_t$6,
|
|
5389
5389
|
_t2$4,
|
|
5390
5390
|
_t3$3,
|
|
5391
5391
|
_t4$3,
|
|
@@ -5395,8 +5395,10 @@ let _$5 = t => t,
|
|
|
5395
5395
|
_t8$1,
|
|
5396
5396
|
_t9$1,
|
|
5397
5397
|
_t10$1,
|
|
5398
|
-
_t11$1
|
|
5399
|
-
|
|
5398
|
+
_t11$1,
|
|
5399
|
+
_t12$1,
|
|
5400
|
+
_t13$1;
|
|
5401
|
+
const ReviewItem = styled.div(_t$6 || (_t$6 = _$6`
|
|
5400
5402
|
display: flex;
|
|
5401
5403
|
flex-direction: column;
|
|
5402
5404
|
border: var(--goa-border-width-s) solid grey;
|
|
@@ -5407,7 +5409,7 @@ const ReviewItem = styled.div(_t$5 || (_t$5 = _$5`
|
|
|
5407
5409
|
display: none;
|
|
5408
5410
|
}
|
|
5409
5411
|
`));
|
|
5410
|
-
const ReviewItemSection = styled.div(_t2$4 || (_t2$4 = _$
|
|
5412
|
+
const ReviewItemSection = styled.div(_t2$4 || (_t2$4 = _$6`
|
|
5411
5413
|
background-color: #f1f1f1;
|
|
5412
5414
|
margin-bottom: var(--goa-space-m);
|
|
5413
5415
|
padding: var(--goa-space-m);
|
|
@@ -5418,18 +5420,18 @@ const ReviewItemSection = styled.div(_t2$4 || (_t2$4 = _$5`
|
|
|
5418
5420
|
max-width: 1600px;
|
|
5419
5421
|
}
|
|
5420
5422
|
`));
|
|
5421
|
-
const ReviewItemHeader = styled.div(_t3$3 || (_t3$3 = _$
|
|
5423
|
+
const ReviewItemHeader = styled.div(_t3$3 || (_t3$3 = _$6`
|
|
5422
5424
|
display: flex;
|
|
5423
5425
|
align-items: center;
|
|
5424
5426
|
justify-content: space-between;
|
|
5425
5427
|
margin-bottom: var(--goa-space-xl);
|
|
5426
5428
|
`));
|
|
5427
|
-
const ReviewItemTitle = styled.div(_t4$3 || (_t4$3 = _$
|
|
5429
|
+
const ReviewItemTitle = styled.div(_t4$3 || (_t4$3 = _$6`
|
|
5428
5430
|
font-size: var(--goa-space-l);
|
|
5429
5431
|
line-height: var(--goa-space-xl);
|
|
5430
5432
|
font-weight: 300;
|
|
5431
5433
|
`));
|
|
5432
|
-
const Anchor = styled.div(_t5$2 || (_t5$2 = _$
|
|
5434
|
+
const Anchor = styled.div(_t5$2 || (_t5$2 = _$6`
|
|
5433
5435
|
color: #0070c4;
|
|
5434
5436
|
text-decoration: underline;
|
|
5435
5437
|
outline: none;
|
|
@@ -5440,20 +5442,20 @@ const Anchor = styled.div(_t5$2 || (_t5$2 = _$5`
|
|
|
5440
5442
|
background-color: #e6f7ff;
|
|
5441
5443
|
}
|
|
5442
5444
|
`));
|
|
5443
|
-
styled.div(_t6$2 || (_t6$2 = _$
|
|
5445
|
+
styled.div(_t6$2 || (_t6$2 = _$6`
|
|
5444
5446
|
margin-left: var(--goa-space-m);
|
|
5445
5447
|
`));
|
|
5446
|
-
styled.div(_t7$1 || (_t7$1 = _$
|
|
5448
|
+
styled.div(_t7$1 || (_t7$1 = _$6`
|
|
5447
5449
|
margin-bottom: var(--goa-space-m);
|
|
5448
5450
|
`));
|
|
5449
|
-
styled.div(_t8$1 || (_t8$1 = _$
|
|
5451
|
+
styled.div(_t8$1 || (_t8$1 = _$6`
|
|
5450
5452
|
margin: var(--goa-space-s);
|
|
5451
5453
|
width: 100%;
|
|
5452
5454
|
`));
|
|
5453
|
-
styled.h3(_t9$1 || (_t9$1 = _$
|
|
5455
|
+
styled.h3(_t9$1 || (_t9$1 = _$6`
|
|
5454
5456
|
text-transform: capitalize;
|
|
5455
5457
|
`));
|
|
5456
|
-
const RightAlignmentDiv = styled.div(_t10$1 || (_t10$1 = _$
|
|
5458
|
+
const RightAlignmentDiv = styled.div(_t10$1 || (_t10$1 = _$6`
|
|
5457
5459
|
@media screen and (max-width: 767px) {
|
|
5458
5460
|
margin-bottom: var(--goa-space-l);
|
|
5459
5461
|
}
|
|
@@ -5463,13 +5465,19 @@ const RightAlignmentDiv = styled.div(_t10$1 || (_t10$1 = _$5`
|
|
|
5463
5465
|
margin-bottom: var(--goa-space-l);
|
|
5464
5466
|
}
|
|
5465
5467
|
`));
|
|
5466
|
-
const FormStepperSummaryH3 = styled.h3(_t11$1 || (_t11$1 = _$
|
|
5468
|
+
const FormStepperSummaryH3 = styled.h3(_t11$1 || (_t11$1 = _$6`
|
|
5467
5469
|
flex: 1;
|
|
5468
5470
|
margin-bottom: var(--goa-space-m);
|
|
5469
5471
|
font-size: var(--goa-font-size-7);
|
|
5470
5472
|
line-height: var(--goa-line-height-4);
|
|
5471
5473
|
font-weight: var(--goa-font-weight-regular);
|
|
5472
5474
|
`));
|
|
5475
|
+
const PageRenderPadding = styled.h3(_t12$1 || (_t12$1 = _$6`
|
|
5476
|
+
margin-top: var(--goa-space-2xl);
|
|
5477
|
+
`));
|
|
5478
|
+
const PageBorder = styled.h3(_t13$1 || (_t13$1 = _$6`
|
|
5479
|
+
padding: var(--goa-space-3xl);
|
|
5480
|
+
`));
|
|
5473
5481
|
|
|
5474
5482
|
class ContextProviderClass {
|
|
5475
5483
|
addDataByUrl(key, url, processDataFunction, token) {
|
|
@@ -5794,7 +5802,7 @@ const pickPropertyValues = (obj, property, endWithType) => {
|
|
|
5794
5802
|
var _a;
|
|
5795
5803
|
if (key === property) {
|
|
5796
5804
|
values.push(obj[key]);
|
|
5797
|
-
} else if (_$
|
|
5805
|
+
} else if (_$c.isObject(obj[key])) {
|
|
5798
5806
|
// if the object type is equal to end type, we are not going to continue the recursive approach
|
|
5799
5807
|
if (endWithType && ((_a = obj[key]) === null || _a === void 0 ? void 0 : _a.type) === endWithType) {
|
|
5800
5808
|
if (property in obj[key]) {
|
|
@@ -5803,7 +5811,7 @@ const pickPropertyValues = (obj, property, endWithType) => {
|
|
|
5803
5811
|
} else {
|
|
5804
5812
|
values = [...values, ...pickPropertyValues(obj[key], property, endWithType)];
|
|
5805
5813
|
}
|
|
5806
|
-
} else if (_$
|
|
5814
|
+
} else if (_$c.isArray(obj[key])) {
|
|
5807
5815
|
const nextValues = obj[key].map(function (arrayObj) {
|
|
5808
5816
|
return pickPropertyValues(arrayObj, property, endWithType);
|
|
5809
5817
|
});
|
|
@@ -5915,7 +5923,7 @@ function isNumber(value) {
|
|
|
5915
5923
|
}
|
|
5916
5924
|
const getIncompletePaths = (ajv, scopes) => {
|
|
5917
5925
|
var _a;
|
|
5918
|
-
const requiredErrorPaths = (_a = ajv === null || ajv === void 0 ? void 0 : ajv.errors) === null || _a === void 0 ? void 0 : _a.filter(e => e.keyword === 'required').map(e => {
|
|
5926
|
+
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 => {
|
|
5919
5927
|
return getControlPath(e);
|
|
5920
5928
|
});
|
|
5921
5929
|
const _scopes = scopes.map(scope => toDataPath(scope)).filter(path => requiredErrorPaths && isErrorPathIncluded(requiredErrorPaths, path));
|
|
@@ -6049,7 +6057,6 @@ const createStepperContextInitData = props => {
|
|
|
6049
6057
|
const valid = ajv.validate(schema, data || {});
|
|
6050
6058
|
const categories = (_a = categorization.elements) === null || _a === void 0 ? void 0 : _a.map((c, id) => {
|
|
6051
6059
|
const scopes = pickPropertyValues(c, 'scope', 'ListWithDetail');
|
|
6052
|
-
// ListWithDetail path might have conflicts with others. The errors in ListWithDetail will still be caught in the ctx.core.errors
|
|
6053
6060
|
const incompletePaths = getIncompletePaths(ajv, scopes);
|
|
6054
6061
|
return {
|
|
6055
6062
|
id,
|
|
@@ -6150,6 +6157,19 @@ const JsonFormsStepperContextProvider = ({
|
|
|
6150
6157
|
});
|
|
6151
6158
|
}
|
|
6152
6159
|
}, [JSON.stringify(StepperProps.uischema), JSON.stringify(StepperProps.schema)]);
|
|
6160
|
+
useEffect(() => {
|
|
6161
|
+
const newState = createStepperContextInitData(Object.assign(Object.assign({}, StepperProps), {
|
|
6162
|
+
activeId: stepperState === null || stepperState === void 0 ? void 0 : stepperState.activeId
|
|
6163
|
+
}));
|
|
6164
|
+
if (JSON.stringify(newState) !== JSON.stringify(stepperState)) {
|
|
6165
|
+
stepperDispatch({
|
|
6166
|
+
type: 'update/uischema',
|
|
6167
|
+
payload: {
|
|
6168
|
+
state: newState
|
|
6169
|
+
}
|
|
6170
|
+
});
|
|
6171
|
+
}
|
|
6172
|
+
}, [StepperProps]);
|
|
6153
6173
|
return jsx(JsonFormsStepperContext.Provider, {
|
|
6154
6174
|
value: context,
|
|
6155
6175
|
children: children
|
|
@@ -6212,9 +6232,11 @@ const FormStepperView = props => {
|
|
|
6212
6232
|
const onCloseModal = () => {
|
|
6213
6233
|
setIsOpen(false);
|
|
6214
6234
|
};
|
|
6215
|
-
|
|
6235
|
+
// eslint-disable-next-line
|
|
6236
|
+
uischema.options;
|
|
6237
|
+
return jsxs("div", {
|
|
6216
6238
|
"data-testid": "form-stepper-test-wrapper",
|
|
6217
|
-
children: jsx(Visible, {
|
|
6239
|
+
children: [jsx(Visible, {
|
|
6218
6240
|
visible: visible,
|
|
6219
6241
|
children: jsxs("div", {
|
|
6220
6242
|
id: `${path || `goa`}-form-stepper`,
|
|
@@ -6306,30 +6328,205 @@ const FormStepperView = props => {
|
|
|
6306
6328
|
})
|
|
6307
6329
|
})
|
|
6308
6330
|
})]
|
|
6309
|
-
}), jsxs(GoAModal, {
|
|
6310
|
-
testId: "submit-confirmation",
|
|
6311
|
-
open: isOpen,
|
|
6312
|
-
heading: 'Form Submitted',
|
|
6313
|
-
width: "640px",
|
|
6314
|
-
actions: jsx(GoAButtonGroup, {
|
|
6315
|
-
alignment: "end",
|
|
6316
|
-
children: jsx(GoAButton, {
|
|
6317
|
-
type: "primary",
|
|
6318
|
-
testId: "close-submit-modal",
|
|
6319
|
-
onClick: onCloseModal,
|
|
6320
|
-
children: "Close"
|
|
6321
|
-
})
|
|
6322
|
-
}),
|
|
6323
|
-
children: [jsx("b", {
|
|
6324
|
-
children: "Submit is a test for preview purposes "
|
|
6325
|
-
}), "(i.e. no actual form is being submitted)"]
|
|
6326
6331
|
})]
|
|
6327
6332
|
})
|
|
6328
|
-
})
|
|
6333
|
+
}), jsxs(GoAModal, {
|
|
6334
|
+
testId: "submit-confirmation",
|
|
6335
|
+
open: isOpen,
|
|
6336
|
+
heading: 'Form Submitted',
|
|
6337
|
+
width: "640px",
|
|
6338
|
+
actions: jsx(GoAButtonGroup, {
|
|
6339
|
+
alignment: "end",
|
|
6340
|
+
children: jsx(GoAButton, {
|
|
6341
|
+
type: "primary",
|
|
6342
|
+
testId: "close-submit-modal",
|
|
6343
|
+
onClick: onCloseModal,
|
|
6344
|
+
children: "Close"
|
|
6345
|
+
})
|
|
6346
|
+
}),
|
|
6347
|
+
children: [jsx("b", {
|
|
6348
|
+
children: "Submit is a test for preview purposes "
|
|
6349
|
+
}), "(i.e. no actual form is being submitted)"]
|
|
6350
|
+
})]
|
|
6329
6351
|
});
|
|
6330
6352
|
};
|
|
6331
6353
|
const FormStepperControl = withAjvProps(withTranslateProps(withJsonFormsLayoutProps(FormStepper)));
|
|
6332
6354
|
|
|
6355
|
+
let _$5 = t => t,
|
|
6356
|
+
_t$5;
|
|
6357
|
+
const BackButtonWrapper = styled.span(_t$5 || (_t$5 = _$5`
|
|
6358
|
+
.back-link::before {
|
|
6359
|
+
content: '';
|
|
6360
|
+
display: inline-block;
|
|
6361
|
+
width: 42px;
|
|
6362
|
+
height: 24px;
|
|
6363
|
+
vertical-align: middle;
|
|
6364
|
+
background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 2 22 22" fill="none" stroke="%230070C4" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="15 18 9 12 15 6"></polyline></svg>')
|
|
6365
|
+
center center no-repeat;
|
|
6366
|
+
}
|
|
6367
|
+
|
|
6368
|
+
.back-link:visited::before,
|
|
6369
|
+
.back-link:hover::before {
|
|
6370
|
+
background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 2 22 22" fill="none" stroke="%23004f84" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="15 18 9 12 15 6"></polyline></svg>')
|
|
6371
|
+
center center no-repeat;
|
|
6372
|
+
}
|
|
6373
|
+
|
|
6374
|
+
.back-link {
|
|
6375
|
+
margin-top: var(--goa-space-m);
|
|
6376
|
+
}
|
|
6377
|
+
display: inline-block;
|
|
6378
|
+
color: #0070c4;
|
|
6379
|
+
cursor: pointer;
|
|
6380
|
+
|
|
6381
|
+
on .goa-icon {
|
|
6382
|
+
display: inline-block !important;
|
|
6383
|
+
position: relative;
|
|
6384
|
+
top: 3px;
|
|
6385
|
+
right: 2px;
|
|
6386
|
+
color: #0070c4;
|
|
6387
|
+
margin-left: 4px;
|
|
6388
|
+
}
|
|
6389
|
+
`));
|
|
6390
|
+
const BackButton = ({
|
|
6391
|
+
text,
|
|
6392
|
+
testId,
|
|
6393
|
+
link
|
|
6394
|
+
}) => {
|
|
6395
|
+
return jsx(BackButtonWrapper, {
|
|
6396
|
+
"data-testid": "back-button-click",
|
|
6397
|
+
onClick: link,
|
|
6398
|
+
children: jsx("div", {
|
|
6399
|
+
className: "back-link",
|
|
6400
|
+
children: text
|
|
6401
|
+
})
|
|
6402
|
+
});
|
|
6403
|
+
};
|
|
6404
|
+
|
|
6405
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6406
|
+
const FormPageStepper = props => {
|
|
6407
|
+
const formStepperCtx = useContext(JsonFormsStepperContext);
|
|
6408
|
+
/**
|
|
6409
|
+
* StepperCtx can only be provided once to prevent issues from categorization in categorization
|
|
6410
|
+
* */
|
|
6411
|
+
if ((formStepperCtx === null || formStepperCtx === void 0 ? void 0 : formStepperCtx.isProvided) === true) {
|
|
6412
|
+
return jsx(FormPagesView, Object.assign({}, props));
|
|
6413
|
+
}
|
|
6414
|
+
return jsx(JsonFormsStepperContextProvider, {
|
|
6415
|
+
StepperProps: Object.assign({}, props),
|
|
6416
|
+
children: jsx(FormPagesView, Object.assign({}, props))
|
|
6417
|
+
});
|
|
6418
|
+
};
|
|
6419
|
+
const FormPagesView = props => {
|
|
6420
|
+
const {
|
|
6421
|
+
uischema,
|
|
6422
|
+
data,
|
|
6423
|
+
schema,
|
|
6424
|
+
path,
|
|
6425
|
+
cells,
|
|
6426
|
+
renderers,
|
|
6427
|
+
visible,
|
|
6428
|
+
t
|
|
6429
|
+
} = props;
|
|
6430
|
+
const enumerators = useContext(JsonFormContext);
|
|
6431
|
+
const formStepperCtx = useContext(JsonFormsStepperContext);
|
|
6432
|
+
const {
|
|
6433
|
+
categories,
|
|
6434
|
+
isOnReview,
|
|
6435
|
+
isValid
|
|
6436
|
+
} = formStepperCtx.selectStepperState();
|
|
6437
|
+
const submitFormFunction = enumerators === null || enumerators === void 0 ? void 0 : enumerators.submitFunction.get('submit-form');
|
|
6438
|
+
const submitForm = submitFormFunction && submitFormFunction();
|
|
6439
|
+
uischema.options || {};
|
|
6440
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
6441
|
+
useState(false);
|
|
6442
|
+
const [selectedPage, setSelectedPage] = useState(0);
|
|
6443
|
+
const handleSubmit = () => {
|
|
6444
|
+
if (submitForm) {
|
|
6445
|
+
submitForm(data);
|
|
6446
|
+
} else {
|
|
6447
|
+
setIsOpen(true);
|
|
6448
|
+
}
|
|
6449
|
+
};
|
|
6450
|
+
const onCloseModal = () => {
|
|
6451
|
+
setIsOpen(false);
|
|
6452
|
+
};
|
|
6453
|
+
// eslint-disable-next-line
|
|
6454
|
+
uischema.options;
|
|
6455
|
+
return jsxs("div", {
|
|
6456
|
+
"data-testid": "form-stepper-test-wrapper",
|
|
6457
|
+
children: [jsx(Visible, {
|
|
6458
|
+
visible: visible,
|
|
6459
|
+
children: jsx("div", {
|
|
6460
|
+
id: `${path || `goa`}-form-pages`,
|
|
6461
|
+
children: jsx(PageBorder, {
|
|
6462
|
+
children: categories === null || categories === void 0 ? void 0 : categories.map((category, index) => {
|
|
6463
|
+
const props = {
|
|
6464
|
+
category: category.uischema,
|
|
6465
|
+
categoryIndex: category.id,
|
|
6466
|
+
visible: category === null || category === void 0 ? void 0 : category.visible,
|
|
6467
|
+
enabled: category === null || category === void 0 ? void 0 : category.isEnabled,
|
|
6468
|
+
path,
|
|
6469
|
+
schema,
|
|
6470
|
+
renderers,
|
|
6471
|
+
cells,
|
|
6472
|
+
data
|
|
6473
|
+
};
|
|
6474
|
+
if (index === selectedPage && !isOnReview) {
|
|
6475
|
+
return jsxs("div", {
|
|
6476
|
+
"data-testid": `step_${index}-content-pages`,
|
|
6477
|
+
style: {
|
|
6478
|
+
marginTop: '1.5rem'
|
|
6479
|
+
},
|
|
6480
|
+
children: [index > 0 && jsx(BackButton, {
|
|
6481
|
+
testId: "back-button",
|
|
6482
|
+
link: () => setSelectedPage(index - 1),
|
|
6483
|
+
text: "Back"
|
|
6484
|
+
}), jsxs(PageRenderPadding, {
|
|
6485
|
+
children: [jsxs("h3", {
|
|
6486
|
+
children: ["Step ", index + 1, " of ", categories.length]
|
|
6487
|
+
}), jsx(RenderStepElements, Object.assign({}, props))]
|
|
6488
|
+
}), jsx(PageRenderPadding, {
|
|
6489
|
+
children: index !== categories.length - 1 ? jsx(GoAButton, {
|
|
6490
|
+
type: "submit",
|
|
6491
|
+
onClick: () => setSelectedPage(index + 1),
|
|
6492
|
+
disabled: !category.isValid,
|
|
6493
|
+
testId: "pages-save-continue-btn",
|
|
6494
|
+
children: "Save and continue"
|
|
6495
|
+
}) : jsx(GoAButton, {
|
|
6496
|
+
type: 'primary',
|
|
6497
|
+
onClick: handleSubmit,
|
|
6498
|
+
disabled: !isValid,
|
|
6499
|
+
testId: "pages-submit-btn",
|
|
6500
|
+
children: "Submit"
|
|
6501
|
+
})
|
|
6502
|
+
})]
|
|
6503
|
+
}, `${category.label}`);
|
|
6504
|
+
}
|
|
6505
|
+
})
|
|
6506
|
+
})
|
|
6507
|
+
})
|
|
6508
|
+
}), jsxs(GoAModal, {
|
|
6509
|
+
testId: "submit-confirmation",
|
|
6510
|
+
open: isOpen,
|
|
6511
|
+
heading: 'Form Submitted',
|
|
6512
|
+
width: "640px",
|
|
6513
|
+
actions: jsx(GoAButtonGroup, {
|
|
6514
|
+
alignment: "end",
|
|
6515
|
+
children: jsx(GoAButton, {
|
|
6516
|
+
type: "primary",
|
|
6517
|
+
testId: "close-submit-modal",
|
|
6518
|
+
onClick: onCloseModal,
|
|
6519
|
+
children: "Close"
|
|
6520
|
+
})
|
|
6521
|
+
}),
|
|
6522
|
+
children: [jsx("b", {
|
|
6523
|
+
children: "Submit is a test for preview purposes "
|
|
6524
|
+
}), "(i.e. no actual form is being submitted)"]
|
|
6525
|
+
})]
|
|
6526
|
+
});
|
|
6527
|
+
};
|
|
6528
|
+
const FormStepperPagesControl = withAjvProps(withTranslateProps(withJsonFormsLayoutProps(FormPageStepper)));
|
|
6529
|
+
|
|
6333
6530
|
// Ensure that all children (Category) have valid elements or things tend
|
|
6334
6531
|
// to blow up. If not, the the error control will report the problem.
|
|
6335
6532
|
const categoriesAreValid = uischema => {
|
|
@@ -6345,7 +6542,14 @@ const categoriesAreValid = uischema => {
|
|
|
6345
6542
|
}
|
|
6346
6543
|
return isValid;
|
|
6347
6544
|
};
|
|
6348
|
-
const
|
|
6545
|
+
const CategorizationStepperRendererTester = rankWith(2, and(uiTypeIs('Categorization'), categoriesAreValid, uischema => {
|
|
6546
|
+
var _a;
|
|
6547
|
+
return ((_a = uischema.options) === null || _a === void 0 ? void 0 : _a.variant) === 'stepper';
|
|
6548
|
+
}));
|
|
6549
|
+
const CategorizationPagesRendererTester = rankWith(2, and(uiTypeIs('Categorization'), categoriesAreValid, uischema => {
|
|
6550
|
+
var _a;
|
|
6551
|
+
return ((_a = uischema.options) === null || _a === void 0 ? void 0 : _a.variant) === 'pages';
|
|
6552
|
+
}));
|
|
6349
6553
|
|
|
6350
6554
|
let _$4 = t => t,
|
|
6351
6555
|
_t$4;
|
|
@@ -10749,7 +10953,10 @@ const GoABaseReviewRenderers = [
|
|
|
10749
10953
|
renderer: HelpReviewContent
|
|
10750
10954
|
}];
|
|
10751
10955
|
const GoAReviewRenderers = [...GoABaseReviewRenderers, {
|
|
10752
|
-
tester:
|
|
10956
|
+
tester: CategorizationStepperRendererTester,
|
|
10957
|
+
renderer: FormStepperReviewControl
|
|
10958
|
+
}, {
|
|
10959
|
+
tester: CategorizationPagesRendererTester,
|
|
10753
10960
|
renderer: FormStepperReviewControl
|
|
10754
10961
|
}, {
|
|
10755
10962
|
tester: FileUploaderTester,
|
|
@@ -10765,8 +10972,11 @@ const GoAReviewRenderers = [...GoABaseReviewRenderers, {
|
|
|
10765
10972
|
renderer: withJsonFormsControlProps(AddressLookUpControlReview)
|
|
10766
10973
|
}];
|
|
10767
10974
|
const GoARenderers = [...GoABaseRenderers, {
|
|
10768
|
-
tester:
|
|
10975
|
+
tester: CategorizationStepperRendererTester,
|
|
10769
10976
|
renderer: FormStepperControl
|
|
10977
|
+
}, {
|
|
10978
|
+
tester: CategorizationPagesRendererTester,
|
|
10979
|
+
renderer: FormStepperPagesControl
|
|
10770
10980
|
}, {
|
|
10771
10981
|
tester: FileUploaderTester,
|
|
10772
10982
|
renderer: withJsonFormsControlProps(FileUploader)
|
|
@@ -10782,4 +10992,4 @@ const GoARenderers = [...GoABaseRenderers, {
|
|
|
10782
10992
|
}];
|
|
10783
10993
|
const GoACells = [...InputCells];
|
|
10784
10994
|
|
|
10785
|
-
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,
|
|
10995
|
+
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 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abgov/jsonforms-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.55.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,3 +1,4 @@
|
|
|
1
1
|
import { RankedTester, UISchemaElement } from '@jsonforms/core';
|
|
2
2
|
export declare const categoriesAreValid: (uischema: UISchemaElement) => boolean;
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const CategorizationStepperRendererTester: RankedTester;
|
|
4
|
+
export declare const CategorizationPagesRendererTester: RankedTester;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { GoAButtonType } from '@abgov/react-components-new';
|
|
2
|
+
import { CategorizationStepperLayoutRendererProps } from './types';
|
|
3
|
+
export interface FormPageOptionProps {
|
|
4
|
+
nextButtonLabel?: string;
|
|
5
|
+
nextButtonType?: GoAButtonType;
|
|
6
|
+
previousButtonLabel?: string;
|
|
7
|
+
previousButtonType?: GoAButtonType;
|
|
8
|
+
}
|
|
9
|
+
export declare const FormPageStepper: (props: CategorizationStepperLayoutRendererProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare const FormPagesView: (props: CategorizationStepperLayoutRendererProps) => JSX.Element;
|
|
11
|
+
export declare const FormStepperPagesControl: (props: CategorizationStepperLayoutRendererProps & import("@jsonforms/core").OwnPropsOfLayout) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export default FormPageStepper;
|
|
@@ -10,3 +10,5 @@ export declare const ListWithDetail: import("styled-components/dist/types").ISty
|
|
|
10
10
|
export declare const ListWithDetailHeading: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, never>> & string;
|
|
11
11
|
export declare const RightAlignmentDiv: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
12
12
|
export declare const FormStepperSummaryH3: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, never>> & string;
|
|
13
|
+
export declare const PageRenderPadding: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, never>> & string;
|
|
14
|
+
export declare const PageBorder: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, never>> & string;
|
|
@@ -5,6 +5,6 @@ export interface WithInput {
|
|
|
5
5
|
noLabel?: boolean;
|
|
6
6
|
isStepperReview?: boolean;
|
|
7
7
|
setIsVisited?: () => void;
|
|
8
|
-
|
|
8
|
+
skipInitialValidation?: boolean;
|
|
9
9
|
}
|
|
10
10
|
export declare const GoAInputBaseControl: (props: ControlProps & WithInput) => JSX.Element;
|