@abgov/jsonforms-components 1.8.1 → 1.9.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
|
@@ -1,7 +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 {
|
|
4
|
-
import { Hidden, Typography, FormHelperText } from '@mui/material';
|
|
3
|
+
import { GoACallout, GoAInputDate, GoAFormItem, GoAInput, GoATextArea, GoAInputDateTime, GoAInputTime, GoADropdown, GoADropdownItem, GoARadioGroup, GoARadioItem, GoACheckbox, GoAFormStepper, GoAFormStep, GoAPages, GoAGrid, GoAButton, GoAModal, GoAButtonGroup, GoAIconButton, GoAFileUploadInput, GoACircularProgress, GoAContainer, GoADetails } from '@abgov/react-components';
|
|
5
4
|
import styled from 'styled-components';
|
|
6
5
|
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';
|
|
7
6
|
import { withJsonFormsRendererProps, withJsonFormsControlProps, withJsonFormsEnumProps, withTranslateProps, withJsonFormsLayoutProps, JsonFormsDispatch, useJsonForms, withJsonFormsArrayLayoutProps, withJsonFormsCellProps } from '@jsonforms/react';
|
|
@@ -1740,9 +1739,9 @@ $$3({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }
|
|
|
1740
1739
|
assign: assign
|
|
1741
1740
|
});
|
|
1742
1741
|
|
|
1743
|
-
let _$
|
|
1744
|
-
_t$
|
|
1745
|
-
const FormFieldWrapper = styled.div(_t$
|
|
1742
|
+
let _$7 = t => t,
|
|
1743
|
+
_t$7;
|
|
1744
|
+
const FormFieldWrapper = styled.div(_t$7 || (_t$7 = _$7`
|
|
1746
1745
|
margin-bottom: var(--goa-space-l);
|
|
1747
1746
|
`));
|
|
1748
1747
|
|
|
@@ -2373,41 +2372,6 @@ const isValidDate = function isValidDate(date) {
|
|
|
2373
2372
|
}
|
|
2374
2373
|
};
|
|
2375
2374
|
|
|
2376
|
-
const GoAInputBaseControl = props => {
|
|
2377
|
-
var _a, _b, _c;
|
|
2378
|
-
// eslint-disable-next-line
|
|
2379
|
-
const {
|
|
2380
|
-
id,
|
|
2381
|
-
description,
|
|
2382
|
-
errors,
|
|
2383
|
-
uischema,
|
|
2384
|
-
visible,
|
|
2385
|
-
config,
|
|
2386
|
-
label,
|
|
2387
|
-
input,
|
|
2388
|
-
required
|
|
2389
|
-
} = props;
|
|
2390
|
-
errors.length === 0;
|
|
2391
|
-
const InnerComponent = input;
|
|
2392
|
-
const labelToUpdate = getLabelText(uischema.scope, label || '');
|
|
2393
|
-
let modifiedErrors = checkFieldValidity(props);
|
|
2394
|
-
if (modifiedErrors === 'should be equal to one of the allowed values' && ((_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.enumContext)) {
|
|
2395
|
-
modifiedErrors = '';
|
|
2396
|
-
}
|
|
2397
|
-
return jsx(Hidden, {
|
|
2398
|
-
xsUp: !visible,
|
|
2399
|
-
children: jsx(FormFieldWrapper, {
|
|
2400
|
-
children: jsx(GoAFormItem, {
|
|
2401
|
-
requirement: required ? 'required' : undefined,
|
|
2402
|
-
error: modifiedErrors,
|
|
2403
|
-
label: (props === null || props === void 0 ? void 0 : props.noLabel) === true ? '' : labelToUpdate,
|
|
2404
|
-
helpText: typeof ((_b = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _b === void 0 ? void 0 : _b.help) === 'string' ? (_c = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _c === void 0 ? void 0 : _c.help : '',
|
|
2405
|
-
children: jsx(InnerComponent, Object.assign({}, props))
|
|
2406
|
-
})
|
|
2407
|
-
})
|
|
2408
|
-
});
|
|
2409
|
-
};
|
|
2410
|
-
|
|
2411
2375
|
// Used locally for callout presentation
|
|
2412
2376
|
const callout = props => {
|
|
2413
2377
|
const componentProps = Object.assign({
|
|
@@ -2771,6 +2735,54 @@ const onChangeForNumericControl = props => {
|
|
|
2771
2735
|
}
|
|
2772
2736
|
};
|
|
2773
2737
|
|
|
2738
|
+
let _$6 = t => t,
|
|
2739
|
+
_t$6,
|
|
2740
|
+
_t2$4;
|
|
2741
|
+
styled.div(_t$6 || (_t$6 = _$6`
|
|
2742
|
+
height: 70vh;
|
|
2743
|
+
overflow-y: auto;
|
|
2744
|
+
padding-left: var(--goa-space-2xs);
|
|
2745
|
+
padding-right: var(--goa-space-2xs);
|
|
2746
|
+
`));
|
|
2747
|
+
const Visible = styled.div(_t2$4 || (_t2$4 = _$6`
|
|
2748
|
+
display: ${0};
|
|
2749
|
+
`), p => p.visible ? 'initial' : 'none');
|
|
2750
|
+
|
|
2751
|
+
const GoAInputBaseControl = props => {
|
|
2752
|
+
var _a, _b, _c;
|
|
2753
|
+
// eslint-disable-next-line
|
|
2754
|
+
const {
|
|
2755
|
+
id,
|
|
2756
|
+
description,
|
|
2757
|
+
errors,
|
|
2758
|
+
uischema,
|
|
2759
|
+
visible,
|
|
2760
|
+
config,
|
|
2761
|
+
label,
|
|
2762
|
+
input,
|
|
2763
|
+
required
|
|
2764
|
+
} = props;
|
|
2765
|
+
errors.length === 0;
|
|
2766
|
+
const InnerComponent = input;
|
|
2767
|
+
const labelToUpdate = getLabelText(uischema.scope, label || '');
|
|
2768
|
+
let modifiedErrors = checkFieldValidity(props);
|
|
2769
|
+
if (modifiedErrors === 'should be equal to one of the allowed values' && ((_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.enumContext)) {
|
|
2770
|
+
modifiedErrors = '';
|
|
2771
|
+
}
|
|
2772
|
+
return jsx(Visible, {
|
|
2773
|
+
visible: visible,
|
|
2774
|
+
children: jsx(FormFieldWrapper, {
|
|
2775
|
+
children: jsx(GoAFormItem, {
|
|
2776
|
+
requirement: required ? 'required' : undefined,
|
|
2777
|
+
error: modifiedErrors,
|
|
2778
|
+
label: (props === null || props === void 0 ? void 0 : props.noLabel) === true ? '' : labelToUpdate,
|
|
2779
|
+
helpText: typeof ((_b = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _b === void 0 ? void 0 : _b.help) === 'string' ? (_c = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _c === void 0 ? void 0 : _c.help : '',
|
|
2780
|
+
children: jsx(InnerComponent, Object.assign({}, props))
|
|
2781
|
+
})
|
|
2782
|
+
})
|
|
2783
|
+
});
|
|
2784
|
+
};
|
|
2785
|
+
|
|
2774
2786
|
const GoAInputText = props => {
|
|
2775
2787
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
2776
2788
|
const {
|
|
@@ -3575,8 +3587,8 @@ const BooleanRadioComponent = ({
|
|
|
3575
3587
|
required,
|
|
3576
3588
|
errors
|
|
3577
3589
|
});
|
|
3578
|
-
return jsx(
|
|
3579
|
-
|
|
3590
|
+
return jsx(Visible, {
|
|
3591
|
+
visible: visible,
|
|
3580
3592
|
children: jsxs(GoARadioGroup, Object.assign({
|
|
3581
3593
|
error: errorsFormInput.length > 0,
|
|
3582
3594
|
name: `${label}`,
|
|
@@ -3959,8 +3971,8 @@ const FormStepper = ({
|
|
|
3959
3971
|
/*
|
|
3960
3972
|
[Mar-04-2024][Paul Li] the GoAPages internal state cannot handle the hidden/display well. We need extra hide/display control to it appropriately.
|
|
3961
3973
|
*/
|
|
3962
|
-
jsx(
|
|
3963
|
-
|
|
3974
|
+
jsx(Visible, {
|
|
3975
|
+
visible: indexOfCategory === step - 1,
|
|
3964
3976
|
children: category.elements.map((elementUiSchema, index) => {
|
|
3965
3977
|
return jsx(JsonFormsDispatch, {
|
|
3966
3978
|
schema: schema,
|
|
@@ -3978,8 +3990,8 @@ const FormStepper = ({
|
|
|
3978
3990
|
const handleEdit = index => {
|
|
3979
3991
|
setPage(index + 1);
|
|
3980
3992
|
};
|
|
3981
|
-
return jsx(
|
|
3982
|
-
|
|
3993
|
+
return jsx(Visible, {
|
|
3994
|
+
visible: visible,
|
|
3983
3995
|
children: jsxs("div", {
|
|
3984
3996
|
id: `${path || `goa`}-form-stepper`,
|
|
3985
3997
|
className: "formStepper",
|
|
@@ -4187,6 +4199,8 @@ const DeleteFileModal = ({
|
|
|
4187
4199
|
let _$2 = t => t,
|
|
4188
4200
|
_t$2,
|
|
4189
4201
|
_t2$1;
|
|
4202
|
+
const DELAY_UPLOAD_TIMEOUT_MS = 200;
|
|
4203
|
+
const DELAY_DELETE_TIMEOUT_MS = 80;
|
|
4190
4204
|
const FileUploader = _a => {
|
|
4191
4205
|
var _b;
|
|
4192
4206
|
var {
|
|
@@ -4221,7 +4235,7 @@ const FileUploader = _a => {
|
|
|
4221
4235
|
const value = ['Loading', Array.isArray(data) ? data[1] : file === null || file === void 0 ? void 0 : file.name];
|
|
4222
4236
|
handleChange(propertyId, value);
|
|
4223
4237
|
};
|
|
4224
|
-
setTimeout(handleFunction,
|
|
4238
|
+
setTimeout(handleFunction, DELAY_UPLOAD_TIMEOUT_MS);
|
|
4225
4239
|
}
|
|
4226
4240
|
}
|
|
4227
4241
|
function downloadFile(file) {
|
|
@@ -4304,7 +4318,10 @@ const FileUploader = _a => {
|
|
|
4304
4318
|
onDelete: () => {
|
|
4305
4319
|
setShowFileDeleteConfirmation(false);
|
|
4306
4320
|
deleteFile(getFile());
|
|
4307
|
-
|
|
4321
|
+
const handleFunction = () => {
|
|
4322
|
+
handleChange(propertyId, '');
|
|
4323
|
+
};
|
|
4324
|
+
setTimeout(handleFunction, DELAY_DELETE_TIMEOUT_MS);
|
|
4308
4325
|
}
|
|
4309
4326
|
})]
|
|
4310
4327
|
})
|
|
@@ -4385,9 +4402,9 @@ const ToolBarHeader = styled.div(_t2 || (_t2 = _$1`
|
|
|
4385
4402
|
const ObjectArrayTitle = styled.h2(_t3 || (_t3 = _$1`
|
|
4386
4403
|
margin-bottom: var(--goa-space-l);
|
|
4387
4404
|
`));
|
|
4388
|
-
const
|
|
4389
|
-
|
|
4390
|
-
`)
|
|
4405
|
+
const TextCenter = styled.div(_t4 || (_t4 = _$1`
|
|
4406
|
+
text-align: center;
|
|
4407
|
+
`));
|
|
4391
4408
|
|
|
4392
4409
|
// eslint-disable-next-line
|
|
4393
4410
|
const extractScopesFromUISchema = uischema => {
|
|
@@ -4445,8 +4462,7 @@ const EmptyList = ({
|
|
|
4445
4462
|
translations
|
|
4446
4463
|
}) => jsx(GoAGrid, {
|
|
4447
4464
|
minChildWidth: "30ch",
|
|
4448
|
-
children: jsx(
|
|
4449
|
-
align: "center",
|
|
4465
|
+
children: jsx(TextCenter, {
|
|
4450
4466
|
children: jsx("b", {
|
|
4451
4467
|
children: translations.noDataMessage
|
|
4452
4468
|
})
|
|
@@ -4519,9 +4535,6 @@ const NonEmptyCellComponent = /*#__PURE__*/React.memo(function NonEmptyCellCompo
|
|
|
4519
4535
|
enabled: enabled,
|
|
4520
4536
|
renderers: renderers,
|
|
4521
4537
|
cells: cells
|
|
4522
|
-
}), jsx(FormHelperText, {
|
|
4523
|
-
error: !isValid,
|
|
4524
|
-
children: !isValid && errors
|
|
4525
4538
|
})]
|
|
4526
4539
|
});
|
|
4527
4540
|
});
|
|
@@ -4624,7 +4637,7 @@ class ObjectArrayControl extends React.Component {
|
|
|
4624
4637
|
const controlElement = uischema;
|
|
4625
4638
|
// eslint-disable-next-line
|
|
4626
4639
|
const listTitle = label || ((_a = uischema.options) === null || _a === void 0 ? void 0 : _a.title);
|
|
4627
|
-
return jsxs(
|
|
4640
|
+
return jsxs(Visible, {
|
|
4628
4641
|
visible: visible,
|
|
4629
4642
|
"data-testid": "jsonforms-object-list-wrapper",
|
|
4630
4643
|
children: [jsxs(ToolBarHeader, {
|
|
@@ -4717,8 +4730,8 @@ const ArrayControl = props => {
|
|
|
4717
4730
|
setOpen(false);
|
|
4718
4731
|
// eslint-disable-next-line
|
|
4719
4732
|
}, [setOpen, path, rowData]);
|
|
4720
|
-
return jsxs(
|
|
4721
|
-
|
|
4733
|
+
return jsxs(Visible, {
|
|
4734
|
+
visible: visible,
|
|
4722
4735
|
children: [jsx(ObjectArrayControl, Object.assign({}, props, {
|
|
4723
4736
|
openDeleteDialog: openDeleteDialog
|
|
4724
4737
|
})), jsx(DeleteDialog, {
|
|
@@ -4797,16 +4810,16 @@ const LayoutRenderer = ({
|
|
|
4797
4810
|
return null;
|
|
4798
4811
|
} else {
|
|
4799
4812
|
if (direction === 'row') {
|
|
4800
|
-
return jsx(
|
|
4801
|
-
|
|
4813
|
+
return jsx(Visible, {
|
|
4814
|
+
visible: visible,
|
|
4802
4815
|
children: jsx(GoAGrid, {
|
|
4803
4816
|
minChildWidth: "10ch",
|
|
4804
4817
|
children: renderLayoutElements(elements, schema, path, enabled, renderers, cells)
|
|
4805
4818
|
})
|
|
4806
4819
|
});
|
|
4807
4820
|
} else {
|
|
4808
|
-
return jsx(
|
|
4809
|
-
|
|
4821
|
+
return jsx(Visible, {
|
|
4822
|
+
visible: visible,
|
|
4810
4823
|
children: renderLayoutElements(elements, schema, path, enabled, renderers, cells)
|
|
4811
4824
|
});
|
|
4812
4825
|
}
|
|
@@ -4877,8 +4890,8 @@ const GoAGroupControlComponent = props => {
|
|
|
4877
4890
|
visible
|
|
4878
4891
|
} = props;
|
|
4879
4892
|
const group = uischema;
|
|
4880
|
-
return jsxs(
|
|
4881
|
-
|
|
4893
|
+
return jsxs(Visible, {
|
|
4894
|
+
visible: visible,
|
|
4882
4895
|
children: [((_b = (_a = group.options) === null || _a === void 0 ? void 0 : _a.componentProps) === null || _b === void 0 ? void 0 : _b.accent) === 'thick' && jsx(GoAContainer, Object.assign({
|
|
4883
4896
|
heading: group.label
|
|
4884
4897
|
}, (_c = group.options) === null || _c === void 0 ? void 0 : _c.componentProps, {
|
|
@@ -4960,8 +4973,8 @@ const HelpContentComponent = _a => {
|
|
|
4960
4973
|
children: (_c = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _c === void 0 ? void 0 : _c.help
|
|
4961
4974
|
});
|
|
4962
4975
|
};
|
|
4963
|
-
return jsx(
|
|
4964
|
-
|
|
4976
|
+
return jsx(Visible, {
|
|
4977
|
+
visible: visible,
|
|
4965
4978
|
children: jsx(HelpContentDiv, {
|
|
4966
4979
|
"aria-label": (_b = uischema.options) === null || _b === void 0 ? void 0 : _b.ariaLabel,
|
|
4967
4980
|
children: jsxs("div", {
|
|
@@ -5181,7 +5194,8 @@ const ajv = new Ajv({
|
|
|
5181
5194
|
allErrors: true,
|
|
5182
5195
|
verbose: true
|
|
5183
5196
|
});
|
|
5184
|
-
|
|
5197
|
+
//Example format: urn:ads:platform:file-service:v1:/files/f6de737e-c5fc-42fe-963b-28bfe14597c4
|
|
5198
|
+
ajv.addFormat('file-urn', /^urn:ads:platform:file-service:v[0-9]:\/files\/[a-zA-Z0-9.-]*$/);
|
|
5185
5199
|
|
|
5186
5200
|
const countries = ['Argentina', 'Brazil', 'Canada', 'Denmark', 'Egypt', 'France', 'Greece', 'India', 'Japan', 'Kenya'];
|
|
5187
5201
|
addData('countries', countries);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abgov/jsonforms-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.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,6 +1,4 @@
|
|
|
1
1
|
export declare const DeleteDialogContent: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
2
|
export declare const ToolBarHeader: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
3
|
export declare const ObjectArrayTitle: import("styled-components").StyledComponent<"h2", any, {}, never>;
|
|
4
|
-
export declare const
|
|
5
|
-
visible: boolean;
|
|
6
|
-
}, never>;
|
|
4
|
+
export declare const TextCenter: import("styled-components").StyledComponent<"div", any, {}, never>;
|