@abgov/jsonforms-components 2.46.0 → 2.46.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
|
@@ -6326,7 +6326,8 @@ const stepperReducer = (state, action) => {
|
|
|
6326
6326
|
hasNextButton: !isOnReview,
|
|
6327
6327
|
hasPrevButton: newActive !== 0,
|
|
6328
6328
|
maxReachedStep: Math.max(state.maxReachedStep, activeId),
|
|
6329
|
-
targetScope
|
|
6329
|
+
targetScope,
|
|
6330
|
+
validationTrigger: (state.validationTrigger || 0) + 1
|
|
6330
6331
|
});
|
|
6331
6332
|
}
|
|
6332
6333
|
case 'update/category':
|
|
@@ -6433,7 +6434,8 @@ const createStepperContextInitData = props => {
|
|
|
6433
6434
|
path,
|
|
6434
6435
|
isOnReview: activeId === (categories == null ? void 0 : categories.length),
|
|
6435
6436
|
isValid: valid === true,
|
|
6436
|
-
maxReachedStep: 0
|
|
6437
|
+
maxReachedStep: 0,
|
|
6438
|
+
validationTrigger: 0
|
|
6437
6439
|
};
|
|
6438
6440
|
};
|
|
6439
6441
|
const JsonFormsStepperContext = /*#__PURE__*/createContext(undefined);
|
|
@@ -6441,7 +6443,7 @@ const JsonFormsStepperContextProvider = ({
|
|
|
6441
6443
|
children,
|
|
6442
6444
|
StepperProps
|
|
6443
6445
|
}) => {
|
|
6444
|
-
var _uischema$options3, _ctx$core2, _ctx$
|
|
6446
|
+
var _uischema$options3, _ctx$core2, _ctx$core3;
|
|
6445
6447
|
const ctx = useJsonForms();
|
|
6446
6448
|
/* istanbul ignore next */
|
|
6447
6449
|
const {
|
|
@@ -6512,28 +6514,6 @@ const JsonFormsStepperContextProvider = ({
|
|
|
6512
6514
|
},
|
|
6513
6515
|
validatePage: doValidatePage,
|
|
6514
6516
|
goToPage: (id, targetScope) => {
|
|
6515
|
-
var _ctx$core3, _ctx$core5;
|
|
6516
|
-
ajv.validate(schema, ((_ctx$core3 = ctx.core) == null ? void 0 : _ctx$core3.data) || {});
|
|
6517
|
-
// Only update the current category
|
|
6518
|
-
if (!stepperState.isOnReview && id < stepperState.categories.length) {
|
|
6519
|
-
var _ctx$core4;
|
|
6520
|
-
stepperDispatch({
|
|
6521
|
-
type: 'update/category',
|
|
6522
|
-
payload: {
|
|
6523
|
-
errors: ctx == null || (_ctx$core4 = ctx.core) == null ? void 0 : _ctx$core4.errors,
|
|
6524
|
-
id,
|
|
6525
|
-
ajv,
|
|
6526
|
-
schema,
|
|
6527
|
-
data
|
|
6528
|
-
}
|
|
6529
|
-
});
|
|
6530
|
-
}
|
|
6531
|
-
stepperDispatch({
|
|
6532
|
-
type: 'validate/form',
|
|
6533
|
-
payload: {
|
|
6534
|
-
errors: ctx == null || (_ctx$core5 = ctx.core) == null ? void 0 : _ctx$core5.errors
|
|
6535
|
-
}
|
|
6536
|
-
});
|
|
6537
6517
|
stepperDispatch({
|
|
6538
6518
|
type: 'page/to/index',
|
|
6539
6519
|
payload: {
|
|
@@ -6552,7 +6532,7 @@ const JsonFormsStepperContextProvider = ({
|
|
|
6552
6532
|
}
|
|
6553
6533
|
};
|
|
6554
6534
|
//eslint-disable-next-line
|
|
6555
|
-
}, [stepperDispatch, stepperState, (_ctx$
|
|
6535
|
+
}, [stepperDispatch, stepperState, (_ctx$core3 = ctx.core) == null ? void 0 : _ctx$core3.errors, ajv, schema, data]);
|
|
6556
6536
|
/* istanbul ignore next */
|
|
6557
6537
|
useEffect(() => {
|
|
6558
6538
|
const handleBeforeUnload = () => {
|
|
@@ -9229,12 +9209,13 @@ const ContextProviderFactory = () => new ContextProviderClass().setup;
|
|
|
9229
9209
|
const JsonFormContext = /*#__PURE__*/createContext(null);
|
|
9230
9210
|
|
|
9231
9211
|
const RenderStepElements = props => {
|
|
9212
|
+
const memoizedSchema = useMemo(() => Object.assign({}, props.schema), [props.schema, props.validationTrigger]);
|
|
9232
9213
|
return jsx(Visible, {
|
|
9233
9214
|
visible: props.visible,
|
|
9234
|
-
"
|
|
9215
|
+
"data-testid": `${props.path}-categories-${props.categoryIndex}`,
|
|
9235
9216
|
children: props.category.elements.map((uiSchema, index) => {
|
|
9236
9217
|
return jsx(JsonFormsDispatch, {
|
|
9237
|
-
schema:
|
|
9218
|
+
schema: memoizedSchema,
|
|
9238
9219
|
uischema: uiSchema,
|
|
9239
9220
|
renderers: props.renderers,
|
|
9240
9221
|
cells: props.cells,
|
|
@@ -12791,7 +12772,8 @@ const FormStepperView = props => {
|
|
|
12791
12772
|
hasNextButton,
|
|
12792
12773
|
hasPrevButton,
|
|
12793
12774
|
isOnReview,
|
|
12794
|
-
isValid
|
|
12775
|
+
isValid,
|
|
12776
|
+
validationTrigger
|
|
12795
12777
|
} = formStepperCtx.selectStepperState();
|
|
12796
12778
|
const {
|
|
12797
12779
|
selectIsDisabled,
|
|
@@ -12852,7 +12834,8 @@ const FormStepperView = props => {
|
|
|
12852
12834
|
schema,
|
|
12853
12835
|
renderers,
|
|
12854
12836
|
cells,
|
|
12855
|
-
data
|
|
12837
|
+
data,
|
|
12838
|
+
validationTrigger
|
|
12856
12839
|
};
|
|
12857
12840
|
return jsx("div", {
|
|
12858
12841
|
"data-testid": `step_${index}-content`,
|
|
@@ -13328,7 +13311,8 @@ const RenderPages = props => {
|
|
|
13328
13311
|
categories,
|
|
13329
13312
|
isOnReview,
|
|
13330
13313
|
isValid,
|
|
13331
|
-
activeId
|
|
13314
|
+
activeId,
|
|
13315
|
+
validationTrigger
|
|
13332
13316
|
} = formStepperCtx.selectStepperState();
|
|
13333
13317
|
const hideSubmit = (_props$categoryProps$ = (_props$categoryProps$2 = props.categoryProps.uischema.options) == null ? void 0 : _props$categoryProps$2.hideSubmit) != null ? _props$categoryProps$ : false;
|
|
13334
13318
|
const toAppOverviewLabel = (_props$categoryProps$3 = (_props$categoryProps$4 = props.categoryProps.uischema.options) == null ? void 0 : _props$categoryProps$4.toAppOverviewLabel) != null ? _props$categoryProps$3 : 'Back to application overview';
|
|
@@ -13381,12 +13365,15 @@ const RenderPages = props => {
|
|
|
13381
13365
|
schema,
|
|
13382
13366
|
renderers,
|
|
13383
13367
|
cells,
|
|
13384
|
-
data
|
|
13368
|
+
data,
|
|
13369
|
+
validationTrigger
|
|
13385
13370
|
};
|
|
13386
|
-
|
|
13387
|
-
|
|
13388
|
-
|
|
13389
|
-
|
|
13371
|
+
const currentStep = index + 1 - categories.filter(c => !c.visible && c.id < index).length;
|
|
13372
|
+
const totalSteps = categories.filter(c => c.visible).length;
|
|
13373
|
+
const isActive = index === activeId && !isOnReview;
|
|
13374
|
+
return jsx(Visible, {
|
|
13375
|
+
visible: isActive,
|
|
13376
|
+
children: jsxs("div", {
|
|
13390
13377
|
"data-testid": `step_${index}-content-pages`,
|
|
13391
13378
|
style: {
|
|
13392
13379
|
marginTop: '1.5rem'
|
|
@@ -13443,8 +13430,8 @@ const RenderPages = props => {
|
|
|
13443
13430
|
})]
|
|
13444
13431
|
})
|
|
13445
13432
|
})]
|
|
13446
|
-
}
|
|
13447
|
-
}
|
|
13433
|
+
})
|
|
13434
|
+
}, `page-${category.id}`);
|
|
13448
13435
|
}), isOnReview && jsxs("div", {
|
|
13449
13436
|
"data-testid": "stepper-pages-review-page",
|
|
13450
13437
|
children: [jsx(FormStepperPageReviewer, Object.assign({}, props.categoryProps, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abgov/jsonforms-components",
|
|
3
|
-
"version": "2.46.
|
|
3
|
+
"version": "2.46.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",
|
|
@@ -10,5 +10,6 @@ export interface StepProps {
|
|
|
10
10
|
renderers: JsonFormsRendererRegistryEntry[] | undefined;
|
|
11
11
|
cells: JsonFormsCellRendererRegistryEntry[] | undefined;
|
|
12
12
|
data: Record<string, unknown>;
|
|
13
|
+
validationTrigger?: number;
|
|
13
14
|
}
|
|
14
15
|
export declare const RenderStepElements: (props: StepProps) => JSX.Element;
|