@abgov/jsonforms-components 1.24.1 → 1.24.3
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 +28 -12
- package/package.json +1 -1
package/index.esm.js
CHANGED
|
@@ -3539,16 +3539,18 @@ const invalidDateFormat = (scope, type) => {
|
|
|
3539
3539
|
message: errMalformedDate(scope, type)
|
|
3540
3540
|
});
|
|
3541
3541
|
};
|
|
3542
|
+
// eslint-disable-next-line
|
|
3542
3543
|
const reformatDateProps = props => {
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3544
|
+
const newProps = Object.assign({}, props);
|
|
3545
|
+
if (newProps) {
|
|
3546
|
+
if ((newProps === null || newProps === void 0 ? void 0 : newProps.min) && typeof newProps.min === 'string') {
|
|
3547
|
+
newProps.min = standardizeDate(newProps.min);
|
|
3546
3548
|
}
|
|
3547
|
-
if (
|
|
3548
|
-
|
|
3549
|
+
if ((newProps === null || newProps === void 0 ? void 0 : newProps.max) && typeof newProps.max === 'string') {
|
|
3550
|
+
newProps.max = standardizeDate(newProps.max);
|
|
3549
3551
|
}
|
|
3550
3552
|
}
|
|
3551
|
-
return
|
|
3553
|
+
return newProps;
|
|
3552
3554
|
};
|
|
3553
3555
|
const GoADateInput = props => {
|
|
3554
3556
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
@@ -4065,13 +4067,13 @@ const RadioGroup = props => {
|
|
|
4065
4067
|
}, appliedUiSchemaOptions, {
|
|
4066
4068
|
onChange: (name, value) => handleChange(path, value)
|
|
4067
4069
|
}, (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps, {
|
|
4068
|
-
children: enumData.map(enumValue => {
|
|
4070
|
+
children: enumData.map((enumValue, index) => {
|
|
4069
4071
|
return jsx(GoARadioItem, Object.assign({
|
|
4070
4072
|
name: enumValue,
|
|
4071
4073
|
value: `${enumValue}`
|
|
4072
4074
|
}, appliedUiSchemaOptions, {
|
|
4073
4075
|
label: enumValue
|
|
4074
|
-
}));
|
|
4076
|
+
}), `list-item-${enumValue}-${index}`);
|
|
4075
4077
|
})
|
|
4076
4078
|
}));
|
|
4077
4079
|
};
|
|
@@ -5845,7 +5847,7 @@ const ctxToNonEmptyCellProps = (ctx, ownProps) => {
|
|
|
5845
5847
|
};
|
|
5846
5848
|
};
|
|
5847
5849
|
const NonEmptyCellComponent = /*#__PURE__*/React.memo(function NonEmptyCellComponent(props) {
|
|
5848
|
-
var _a, _b
|
|
5850
|
+
var _a, _b;
|
|
5849
5851
|
const {
|
|
5850
5852
|
schema,
|
|
5851
5853
|
errors,
|
|
@@ -5864,11 +5866,25 @@ const NonEmptyCellComponent = /*#__PURE__*/React.memo(function NonEmptyCellCompo
|
|
|
5864
5866
|
const scopesNotInElements = propScopes.filter(scope => {
|
|
5865
5867
|
return !scopesInElements.includes(scope);
|
|
5866
5868
|
});
|
|
5869
|
+
/**
|
|
5870
|
+
* Get the first layout type in the elements for the object array and used it
|
|
5871
|
+
* as the default type, if none is provided.
|
|
5872
|
+
* @returns layout type
|
|
5873
|
+
*/
|
|
5874
|
+
const getFirstLayoutType = () => {
|
|
5875
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
5876
|
+
let defaultType = 'VerticalLayout';
|
|
5877
|
+
if ((_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.defaultType) return (_b = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _b === void 0 ? void 0 : _b.defaultType;
|
|
5878
|
+
if (((_c = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _c === void 0 ? void 0 : _c.detail) && ((_f = (_e = (_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.detail) === null || _e === void 0 ? void 0 : _e.elements) === null || _f === void 0 ? void 0 : _f.length) > 0) {
|
|
5879
|
+
defaultType = (_h = (_g = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _g === void 0 ? void 0 : _g.detail) === null || _h === void 0 ? void 0 : _h.elements.at(0).type;
|
|
5880
|
+
}
|
|
5881
|
+
return defaultType;
|
|
5882
|
+
};
|
|
5867
5883
|
/* Create default elements for scope not defined in the uischema
|
|
5868
5884
|
* future work: merge the options
|
|
5869
5885
|
*/
|
|
5870
5886
|
const uiSchemaElementsForNotDefined = {
|
|
5871
|
-
type: (
|
|
5887
|
+
type: getFirstLayoutType(),
|
|
5872
5888
|
elements: scopesNotInElements.map(scope => {
|
|
5873
5889
|
return {
|
|
5874
5890
|
type: 'Control',
|
|
@@ -5879,7 +5895,7 @@ const NonEmptyCellComponent = /*#__PURE__*/React.memo(function NonEmptyCellCompo
|
|
|
5879
5895
|
return jsxs(Fragment, {
|
|
5880
5896
|
children: [
|
|
5881
5897
|
// eslint-disable-next-line
|
|
5882
|
-
(
|
|
5898
|
+
(_a = uischema === null || uischema === void 0 ? void 0 : uischema.elements) === null || _a === void 0 ? void 0 : _a.map(element => {
|
|
5883
5899
|
return jsx(JsonFormsDispatch, {
|
|
5884
5900
|
"data-testid": `jsonforms-object-list-defined-elements-dispatch`,
|
|
5885
5901
|
schema: schema,
|
|
@@ -5889,7 +5905,7 @@ const NonEmptyCellComponent = /*#__PURE__*/React.memo(function NonEmptyCellCompo
|
|
|
5889
5905
|
renderers: renderers,
|
|
5890
5906
|
cells: cells
|
|
5891
5907
|
}, rowPath);
|
|
5892
|
-
}), ((
|
|
5908
|
+
}), ((_b = uiSchemaElementsForNotDefined === null || uiSchemaElementsForNotDefined === void 0 ? void 0 : uiSchemaElementsForNotDefined.elements) === null || _b === void 0 ? void 0 : _b.length) > 0 && jsx(JsonFormsDispatch, {
|
|
5893
5909
|
schema: schema,
|
|
5894
5910
|
uischema: uiSchemaElementsForNotDefined,
|
|
5895
5911
|
path: rowPath,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abgov/jsonforms-components",
|
|
3
|
-
"version": "1.24.
|
|
3
|
+
"version": "1.24.3",
|
|
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",
|