@abgov/jsonforms-components 1.53.5 → 1.53.7
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
|
@@ -2835,28 +2835,6 @@ const onKeyPressForTextControl = props => {
|
|
|
2835
2835
|
handleChange(path, value);
|
|
2836
2836
|
}
|
|
2837
2837
|
};
|
|
2838
|
-
/**
|
|
2839
|
-
* Helper functions to process onKeyPress events for Numeric controls.
|
|
2840
|
-
* @param props - EventKeyPressControlProps
|
|
2841
|
-
*/
|
|
2842
|
-
const onKeyPressNumericControl = props => {
|
|
2843
|
-
const {
|
|
2844
|
-
value,
|
|
2845
|
-
key,
|
|
2846
|
-
controlProps
|
|
2847
|
-
} = props;
|
|
2848
|
-
const {
|
|
2849
|
-
handleChange,
|
|
2850
|
-
path
|
|
2851
|
-
} = controlProps;
|
|
2852
|
-
if (isNotKeyPressTabOrShift(key)) {
|
|
2853
|
-
let newValue = '';
|
|
2854
|
-
if (value !== '') {
|
|
2855
|
-
newValue = +value;
|
|
2856
|
-
}
|
|
2857
|
-
handleChange(path, newValue);
|
|
2858
|
-
}
|
|
2859
|
-
};
|
|
2860
2838
|
/**
|
|
2861
2839
|
* Helper function to process onKeyPress events for Time controls
|
|
2862
2840
|
* @param props - EventKeyPressControlProps
|
|
@@ -3013,9 +2991,7 @@ const onChangeForInputControl = props => {
|
|
|
3013
2991
|
handleChange,
|
|
3014
2992
|
path
|
|
3015
2993
|
} = controlProps;
|
|
3016
|
-
|
|
3017
|
-
handleChange(path, value);
|
|
3018
|
-
}
|
|
2994
|
+
handleChange(path, value);
|
|
3019
2995
|
};
|
|
3020
2996
|
/**
|
|
3021
2997
|
* Helper function to process onChange event for Date controls.
|
|
@@ -4508,14 +4484,7 @@ const GoAInputText = props => {
|
|
|
4508
4484
|
controlProps: props
|
|
4509
4485
|
});
|
|
4510
4486
|
},
|
|
4511
|
-
onKeyPress: (name, value, key) => {
|
|
4512
|
-
onKeyPressForTextControl({
|
|
4513
|
-
name,
|
|
4514
|
-
value: autoCapitalize ? value.toUpperCase() : value,
|
|
4515
|
-
key,
|
|
4516
|
-
controlProps: props
|
|
4517
|
-
});
|
|
4518
|
-
},
|
|
4487
|
+
onKeyPress: (name, value, key) => {},
|
|
4519
4488
|
onBlur: (name, value) => {
|
|
4520
4489
|
onBlurForTextControl({
|
|
4521
4490
|
name,
|
|
@@ -4741,14 +4710,7 @@ const GoANumberInput = props => {
|
|
|
4741
4710
|
width: width,
|
|
4742
4711
|
name: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.name) || `${id || label}-input`,
|
|
4743
4712
|
testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
|
|
4744
|
-
onKeyPress: (name, value, key) => {
|
|
4745
|
-
onKeyPressNumericControl({
|
|
4746
|
-
name,
|
|
4747
|
-
value,
|
|
4748
|
-
key,
|
|
4749
|
-
controlProps: props
|
|
4750
|
-
});
|
|
4751
|
-
},
|
|
4713
|
+
onKeyPress: (name, value, key) => {},
|
|
4752
4714
|
onBlur: (name, value) => {
|
|
4753
4715
|
onBlurForNumericControl({
|
|
4754
4716
|
name,
|
|
@@ -4809,14 +4771,7 @@ const GoAInputInteger = props => {
|
|
|
4809
4771
|
placeholder: placeholder,
|
|
4810
4772
|
name: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.name) || `${id || label}-input`,
|
|
4811
4773
|
testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
|
|
4812
|
-
onKeyPress: (name, value, key) => {
|
|
4813
|
-
onKeyPressNumericControl({
|
|
4814
|
-
name,
|
|
4815
|
-
value,
|
|
4816
|
-
key,
|
|
4817
|
-
controlProps: props
|
|
4818
|
-
});
|
|
4819
|
-
},
|
|
4774
|
+
onKeyPress: (name, value, key) => {},
|
|
4820
4775
|
onBlur: (name, value) => {
|
|
4821
4776
|
onBlurForNumericControl({
|
|
4822
4777
|
name,
|
|
@@ -5808,16 +5763,24 @@ const getProperty = (obj, propName) => {
|
|
|
5808
5763
|
}
|
|
5809
5764
|
};
|
|
5810
5765
|
// eslint-disable-next-line
|
|
5811
|
-
const pickPropertyValues = (obj, property) => {
|
|
5766
|
+
const pickPropertyValues = (obj, property, endWithType) => {
|
|
5812
5767
|
let values = [];
|
|
5813
5768
|
Object.keys(obj).forEach(function (key) {
|
|
5769
|
+
var _a;
|
|
5814
5770
|
if (key === property) {
|
|
5815
5771
|
values.push(obj[key]);
|
|
5816
5772
|
} else if (_$b.isObject(obj[key])) {
|
|
5817
|
-
|
|
5773
|
+
// if the object type is equal to end type, we are not going to continue the recursive approach
|
|
5774
|
+
if (endWithType && ((_a = obj[key]) === null || _a === void 0 ? void 0 : _a.type) === endWithType) {
|
|
5775
|
+
if (property in obj[key]) {
|
|
5776
|
+
values.push(obj[key][property]);
|
|
5777
|
+
}
|
|
5778
|
+
} else {
|
|
5779
|
+
values = [...values, ...pickPropertyValues(obj[key], property, endWithType)];
|
|
5780
|
+
}
|
|
5818
5781
|
} else if (_$b.isArray(obj[key])) {
|
|
5819
5782
|
const nextValues = obj[key].map(function (arrayObj) {
|
|
5820
|
-
return pickPropertyValues(arrayObj, property);
|
|
5783
|
+
return pickPropertyValues(arrayObj, property, endWithType);
|
|
5821
5784
|
});
|
|
5822
5785
|
values = [...values, ...nextValues];
|
|
5823
5786
|
}
|
|
@@ -5937,8 +5900,14 @@ const subErrorInParent = (error, paths) => {
|
|
|
5937
5900
|
For example: error with instance path /roadmap/0/when belongs to /roadmap
|
|
5938
5901
|
*/
|
|
5939
5902
|
const errorPaths = error.instancePath.split('/');
|
|
5940
|
-
if (errorPaths.length <
|
|
5941
|
-
|
|
5903
|
+
if (errorPaths.length < 2) return false;
|
|
5904
|
+
// For case /roadmap/0
|
|
5905
|
+
if (errorPaths.length > 1 && isNumber(errorPaths[errorPaths.length - 1])) {
|
|
5906
|
+
const parentPath = errorPaths.slice(0, errorPaths.length - 1).join('/');
|
|
5907
|
+
return paths.includes(parentPath);
|
|
5908
|
+
}
|
|
5909
|
+
// For case /roadmap/0/when
|
|
5910
|
+
if (errorPaths.length > 2 && isNumber(errorPaths[errorPaths.length - 2])) {
|
|
5942
5911
|
const parentPath = errorPaths.slice(0, errorPaths.length - 2).join('/');
|
|
5943
5912
|
return paths.includes(parentPath);
|
|
5944
5913
|
}
|
|
@@ -6051,8 +6020,9 @@ const createStepperContextInitData = props => {
|
|
|
6051
6020
|
const categorization = uischema;
|
|
6052
6021
|
const valid = ajv.validate(schema, data || {});
|
|
6053
6022
|
const categories = (_a = categorization.elements) === null || _a === void 0 ? void 0 : _a.map((c, id) => {
|
|
6054
|
-
const scopes = pickPropertyValues(c, 'scope');
|
|
6055
|
-
|
|
6023
|
+
const scopes = pickPropertyValues(c, 'scope', 'ListWithDetail');
|
|
6024
|
+
// ListWithDetail path might have conflicts with others. The errors in ListWithDetail will still be caught in the ctx.core.errors
|
|
6025
|
+
const incompletePaths = getIncompletePaths(ajv, scopes);
|
|
6056
6026
|
return {
|
|
6057
6027
|
id,
|
|
6058
6028
|
label: deriveLabelForUISchemaElement(c, t),
|
|
@@ -6828,6 +6798,11 @@ const ToolBarHeader = styled.div(_t3$1 || (_t3$1 = _$2`
|
|
|
6828
6798
|
`));
|
|
6829
6799
|
const ObjectArrayTitle = styled.h3(_t4$1 || (_t4$1 = _$2`
|
|
6830
6800
|
margin-bottom: var(--goa-space-l);
|
|
6801
|
+
|
|
6802
|
+
span {
|
|
6803
|
+
color: #666666;
|
|
6804
|
+
font-size: var(--goa-font-size-2);
|
|
6805
|
+
}
|
|
6831
6806
|
`));
|
|
6832
6807
|
const TextCenter = styled.div(_t5$1 || (_t5$1 = _$2`
|
|
6833
6808
|
text-align: center;
|
|
@@ -7178,7 +7153,7 @@ const NonEmptyCellComponent$1 = /*#__PURE__*/React.memo(function NonEmptyCellCom
|
|
|
7178
7153
|
}) : jsx(GoAFormItem, {
|
|
7179
7154
|
error: (_a = error === null || error === void 0 ? void 0 : error.message) !== null && _a !== void 0 ? _a : '',
|
|
7180
7155
|
mb: errorRow && !error && '2xl' || 'xs',
|
|
7181
|
-
children: jsx(GoAInput, {
|
|
7156
|
+
children: dataObject.type === 'number' || dataObject.type === 'string' && !dataObject.enum ? jsx(GoAInput, {
|
|
7182
7157
|
type: dataObject.type === 'number' ? 'number' : 'text',
|
|
7183
7158
|
id: schemaName,
|
|
7184
7159
|
name: schemaName,
|
|
@@ -7193,6 +7168,12 @@ const NonEmptyCellComponent$1 = /*#__PURE__*/React.memo(function NonEmptyCellCom
|
|
|
7193
7168
|
},
|
|
7194
7169
|
"aria-label": schemaName,
|
|
7195
7170
|
width: "100%"
|
|
7171
|
+
}) : jsx(GoACallout, {
|
|
7172
|
+
type: "important",
|
|
7173
|
+
size: "medium",
|
|
7174
|
+
testId: "form-support-callout",
|
|
7175
|
+
heading: "Not supported",
|
|
7176
|
+
children: "Only string and number are supported inside arrays"
|
|
7196
7177
|
})
|
|
7197
7178
|
})
|
|
7198
7179
|
}, ix);
|
|
@@ -7349,9 +7330,12 @@ const ObjectArrayControl = props => {
|
|
|
7349
7330
|
currentCategory.data = newCategoryData;
|
|
7350
7331
|
}
|
|
7351
7332
|
if ((currentCategory === null || currentCategory === void 0 ? void 0 : currentCategory.count) > 0) currentCategory.count--;
|
|
7352
|
-
|
|
7333
|
+
let handleChangeData = Object.keys(newCategoryData).map(key => {
|
|
7353
7334
|
return newCategoryData[key];
|
|
7354
7335
|
});
|
|
7336
|
+
if (handleChangeData.length === 0) {
|
|
7337
|
+
handleChangeData = null;
|
|
7338
|
+
}
|
|
7355
7339
|
props.handleChange(path, handleChangeData);
|
|
7356
7340
|
dispatch({
|
|
7357
7341
|
type: DELETE_ACTION,
|
|
@@ -7419,8 +7403,10 @@ const ObjectArrayControl = props => {
|
|
|
7419
7403
|
children: [jsxs(ToolBarHeader, {
|
|
7420
7404
|
children: [isInReview && listTitle && jsx("b", {
|
|
7421
7405
|
children: listTitle
|
|
7422
|
-
}), !isInReview && listTitle &&
|
|
7423
|
-
children: listTitle
|
|
7406
|
+
}), !isInReview && listTitle && jsxs(ObjectArrayTitle, {
|
|
7407
|
+
children: [listTitle, " ", jsx("span", {
|
|
7408
|
+
children: additionalProps.required && '(required)'
|
|
7409
|
+
})]
|
|
7424
7410
|
}), !isInReview && jsx(ObjectArrayToolBar, {
|
|
7425
7411
|
errors: errors,
|
|
7426
7412
|
label: label,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abgov/jsonforms-components",
|
|
3
|
-
"version": "1.53.
|
|
3
|
+
"version": "1.53.7",
|
|
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,2 +1,2 @@
|
|
|
1
1
|
export declare const getProperty: any;
|
|
2
|
-
export declare const pickPropertyValues: (obj: any, property: string) => string[];
|
|
2
|
+
export declare const pickPropertyValues: (obj: any, property: string, endWithType?: string) => string[];
|