@abgov/jsonforms-components 2.67.4 → 2.67.6
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
|
@@ -5974,7 +5974,6 @@ const NoneGivenText = styled.span(_t1$2 || (_t1$2 = _$a`
|
|
|
5974
5974
|
`));
|
|
5975
5975
|
const NoneGivenTableText = styled.span(_t10$2 || (_t10$2 = _$a`
|
|
5976
5976
|
padding-top: var(--goa-space-l);
|
|
5977
|
-
padding-left: var(--goa-space-m);
|
|
5978
5977
|
color: var(--goa-color-greyscale-700);
|
|
5979
5978
|
font-style: italic;
|
|
5980
5979
|
`));
|
|
@@ -7363,12 +7362,12 @@ const InnerGoAInputText = props => {
|
|
|
7363
7362
|
setLocalValue(isSinField && typeof data === 'string' ? formatSinForDisplay(data) : data);
|
|
7364
7363
|
}, [data, isSinField]);
|
|
7365
7364
|
useEffect(() => {
|
|
7366
|
-
if (typeof handleChange === 'function' && hasDefault && !manualInput) {
|
|
7365
|
+
if (typeof handleChange === 'function' && hasDefault && data === undefined && !manualInput) {
|
|
7367
7366
|
handleChange(props.path, schema.default);
|
|
7368
7367
|
setLocalValue(schema.default);
|
|
7369
7368
|
}
|
|
7370
7369
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
7371
|
-
}, [schema.default]);
|
|
7370
|
+
}, [schema.default, data]);
|
|
7372
7371
|
/* istanbul ignore next */
|
|
7373
7372
|
useEffect(() => {
|
|
7374
7373
|
const dataForInput = isSinField && typeof data === 'string' ? formatSinForDisplay(data) : data;
|
|
@@ -10037,7 +10036,7 @@ class ListWithDetailControl extends React.Component {
|
|
|
10037
10036
|
children: [listTitle && jsx(MarginTop, {
|
|
10038
10037
|
children: jsxs(ObjectArrayTitle, {
|
|
10039
10038
|
children: [listTitle, " ", jsx("span", {
|
|
10040
|
-
children: additionalProps.required && '(required)'
|
|
10039
|
+
children: additionalProps.required && ' (required)'
|
|
10041
10040
|
}), this.state.maxItemsError && jsx("span", {
|
|
10042
10041
|
style: {
|
|
10043
10042
|
color: 'red',
|
|
@@ -10521,11 +10520,12 @@ const GoAEmailInput = props => {
|
|
|
10521
10520
|
splitErrors[splintIndex] = `${primaryLabel} is required`;
|
|
10522
10521
|
const finalErrors = splitErrors.join('\n');
|
|
10523
10522
|
useEffect(() => {
|
|
10524
|
-
if (typeof handleChange === 'function' && (schema == null ? void 0 : schema.default) !== undefined) {
|
|
10523
|
+
if (typeof handleChange === 'function' && (schema == null ? void 0 : schema.default) !== undefined && data === undefined) {
|
|
10525
10524
|
handleChange(props.path, schema.default);
|
|
10525
|
+
setLocalValue(schema.default);
|
|
10526
10526
|
}
|
|
10527
10527
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
10528
|
-
}, [schema.default]);
|
|
10528
|
+
}, [schema.default, data]);
|
|
10529
10529
|
return jsx(Visible, {
|
|
10530
10530
|
visible: visible,
|
|
10531
10531
|
children: jsx(JsonFormRegisterProvider, {
|
|
@@ -11951,7 +11951,7 @@ const jsonPreviewStyle = {
|
|
|
11951
11951
|
overflowX: 'auto'
|
|
11952
11952
|
};
|
|
11953
11953
|
function prettify(prop) {
|
|
11954
|
-
return prop.replace(/([A-Z])/g, ' $1').replace(/[_-]/g, ' ').replace(/^./, c => c.toUpperCase());
|
|
11954
|
+
return prop.replace(/([A-Z])/g, ' $1').replace(/[_-]/g, ' ').replace(/^./, c => c.toUpperCase()).trim();
|
|
11955
11955
|
}
|
|
11956
11956
|
/**
|
|
11957
11957
|
* Extract Json data schema name attribute and the ui schema label name.
|
|
@@ -12038,13 +12038,12 @@ const renderCellColumn = ({
|
|
|
12038
12038
|
}) => {
|
|
12039
12039
|
const renderWarningCell = error => {
|
|
12040
12040
|
return jsxs(HilightCellWarning, {
|
|
12041
|
-
children: [renderNoneGivenText(data), jsxs(ObjectArrayWarningIconDiv, {
|
|
12041
|
+
children: [renderNoneGivenText(data), error && jsxs(ObjectArrayWarningIconDiv, {
|
|
12042
12042
|
children: [jsx(GoabIcon, {
|
|
12043
12043
|
type: "warning",
|
|
12044
12044
|
title: "warning",
|
|
12045
12045
|
size: "small",
|
|
12046
12046
|
theme: "filled",
|
|
12047
|
-
ml: "2xs",
|
|
12048
12047
|
mt: "2xs"
|
|
12049
12048
|
}), error ? error : '']
|
|
12050
12049
|
})]
|
|
@@ -12053,6 +12052,8 @@ const renderCellColumn = ({
|
|
|
12053
12052
|
if (data === undefined && isRequired || error !== '' && error !== undefined) {
|
|
12054
12053
|
const message = error || (isRequired && data === undefined ? 'Required' : data);
|
|
12055
12054
|
return renderWarningCell(message);
|
|
12055
|
+
} else if (data === undefined && !isRequired) {
|
|
12056
|
+
return renderWarningCell('');
|
|
12056
12057
|
} else if (data !== undefined && isRequired && error) {
|
|
12057
12058
|
return renderWarningCell(error);
|
|
12058
12059
|
}
|
|
@@ -12104,6 +12105,29 @@ const renderCellColumn = ({
|
|
|
12104
12105
|
}
|
|
12105
12106
|
return null;
|
|
12106
12107
|
};
|
|
12108
|
+
const createHumanizeError = (error, schema, uischema) => {
|
|
12109
|
+
let humanMessage;
|
|
12110
|
+
if (error) {
|
|
12111
|
+
try {
|
|
12112
|
+
humanMessage = humanizeAjvError(error, schema, uischema);
|
|
12113
|
+
if (typeof humanMessage === 'string' && (humanMessage.includes('must have required property') || humanMessage.includes(REQUIRED_PROPERTY_ERROR))) {
|
|
12114
|
+
const propertyMatch = humanMessage.match(/'([^']+)'/);
|
|
12115
|
+
if (propertyMatch && propertyMatch[1]) {
|
|
12116
|
+
humanMessage = prettify(propertyMatch[1]) + ' is required';
|
|
12117
|
+
}
|
|
12118
|
+
}
|
|
12119
|
+
} catch (err) {
|
|
12120
|
+
const raw = error.message;
|
|
12121
|
+
const propertyMatch = raw == null ? void 0 : raw.match(/'([^']+)'/);
|
|
12122
|
+
if (propertyMatch && propertyMatch[1]) {
|
|
12123
|
+
humanMessage = prettify(propertyMatch[1]) + ' is required';
|
|
12124
|
+
} else {
|
|
12125
|
+
humanMessage = raw;
|
|
12126
|
+
}
|
|
12127
|
+
}
|
|
12128
|
+
}
|
|
12129
|
+
return humanMessage;
|
|
12130
|
+
};
|
|
12107
12131
|
|
|
12108
12132
|
const _excluded$4 = ["label", "path", "schema", "rootSchema", "uischema", "errors", "visible", "enabled", "cells", "data", "config", "isStepperReview", "handleChange", "removeItems"];
|
|
12109
12133
|
const GenerateRows = (Cell, schema, rowPath, enabled, openDeleteDialog, handleChange, cells, uischema, isInReview, count, data, errors) => {
|
|
@@ -12268,7 +12292,6 @@ const NonEmptyCellComponent = /*#__PURE__*/React.memo(function NonEmptyCellCompo
|
|
|
12268
12292
|
return e.instancePath === fieldPath || e.instancePath === rowPathMatch && msg.includes(key) || e.instancePath === rowPathMatch && requiredProperty === key;
|
|
12269
12293
|
});
|
|
12270
12294
|
const isEmptyValue = value === undefined || value === null || value === '';
|
|
12271
|
-
if (isEmptyValue && !isRequiredField && !fieldError) return null;
|
|
12272
12295
|
let reviewError = '';
|
|
12273
12296
|
if (fieldError) {
|
|
12274
12297
|
const raw = fieldError.message || '';
|
|
@@ -12280,7 +12303,7 @@ const NonEmptyCellComponent = /*#__PURE__*/React.memo(function NonEmptyCellCompo
|
|
|
12280
12303
|
style: {
|
|
12281
12304
|
display: 'flex',
|
|
12282
12305
|
marginBottom: '0.5rem',
|
|
12283
|
-
alignItems: '
|
|
12306
|
+
alignItems: 'flex-start'
|
|
12284
12307
|
},
|
|
12285
12308
|
"data-testid": `#/properties/${key}-input-${i}-row`,
|
|
12286
12309
|
children: [jsxs("strong", {
|
|
@@ -12319,7 +12342,7 @@ const NonEmptyCellComponent = /*#__PURE__*/React.memo(function NonEmptyCellCompo
|
|
|
12319
12342
|
const currentProperty = properties[value];
|
|
12320
12343
|
return jsx("th", {
|
|
12321
12344
|
children: jsxs("p", {
|
|
12322
|
-
children: [(currentProperty == null ? void 0 : currentProperty.title) || index, (required == null ? void 0 : required.includes(value)) && jsx(RequiredSpan, {
|
|
12345
|
+
children: [(currentProperty == null ? void 0 : currentProperty.title) || index, ' ', (required == null ? void 0 : required.includes(value)) && jsx(RequiredSpan, {
|
|
12323
12346
|
children: "(required)"
|
|
12324
12347
|
})]
|
|
12325
12348
|
})
|
|
@@ -12345,30 +12368,8 @@ const NonEmptyCellComponent = /*#__PURE__*/React.memo(function NonEmptyCellCompo
|
|
|
12345
12368
|
var _y$message;
|
|
12346
12369
|
return (y == null || (_y$message = y.message) == null ? void 0 : _y$message.includes(element)) || y.instancePath.includes(element);
|
|
12347
12370
|
});
|
|
12348
|
-
function prettify(prop) {
|
|
12349
|
-
return prop.replace(/([A-Z])/g, ' $1').replace(/[_-]/g, ' ').replace(/^./, c => c.toUpperCase());
|
|
12350
|
-
}
|
|
12351
12371
|
// Create a human-friendly error message for rendering
|
|
12352
|
-
let humanMessage;
|
|
12353
|
-
if (error) {
|
|
12354
|
-
try {
|
|
12355
|
-
humanMessage = humanizeAjvError(error, schema, uischema);
|
|
12356
|
-
if (typeof humanMessage === 'string' && (humanMessage.includes('must have required property') || humanMessage.includes(REQUIRED_PROPERTY_ERROR))) {
|
|
12357
|
-
const propertyMatch = humanMessage.match(/'([^']+)'/);
|
|
12358
|
-
if (propertyMatch && propertyMatch[1]) {
|
|
12359
|
-
humanMessage = prettify(propertyMatch[1]) + ' is required';
|
|
12360
|
-
}
|
|
12361
|
-
}
|
|
12362
|
-
} catch (err) {
|
|
12363
|
-
const raw = error.message;
|
|
12364
|
-
const propertyMatch = raw == null ? void 0 : raw.match(/'([^']+)'/);
|
|
12365
|
-
if (propertyMatch && propertyMatch[1]) {
|
|
12366
|
-
humanMessage = prettify(propertyMatch[1]) + ' is required';
|
|
12367
|
-
} else {
|
|
12368
|
-
humanMessage = raw;
|
|
12369
|
-
}
|
|
12370
|
-
}
|
|
12371
|
-
}
|
|
12372
|
+
let humanMessage = createHumanizeError(error, schema, uischema);
|
|
12372
12373
|
if (error != null && (_error$message = error.message) != null && _error$message.includes('must NOT have fewer') && required.find(r => r === schemaName) && (isEmptyBoolean(schema, currentData) || isEmptyNumber(schema, currentData))) {
|
|
12373
12374
|
humanMessage = `${capitalizeFirstLetter(schemaName)} is required`;
|
|
12374
12375
|
}
|
|
@@ -12715,7 +12716,7 @@ const ObjectArrayControl = props => {
|
|
|
12715
12716
|
alignItems: 'center'
|
|
12716
12717
|
},
|
|
12717
12718
|
children: [jsxs(ReviewLabel, {
|
|
12718
|
-
children: [listTitle,
|
|
12719
|
+
children: [listTitle, jsx("span", {
|
|
12719
12720
|
children: additionalProps.required && '(required)'
|
|
12720
12721
|
}), maxItemsError && jsx("span", {
|
|
12721
12722
|
style: {
|
|
@@ -12755,7 +12756,7 @@ const ObjectArrayControl = props => {
|
|
|
12755
12756
|
"data-testid": "jsonforms-object-list-wrapper",
|
|
12756
12757
|
children: [jsxs(ToolBarHeader, {
|
|
12757
12758
|
children: [listTitle && jsxs(ObjectArrayTitle, {
|
|
12758
|
-
children: [listTitle,
|
|
12759
|
+
children: [listTitle, jsx("span", {
|
|
12759
12760
|
children: additionalProps.required && '(required)'
|
|
12760
12761
|
}), maxItemsError && jsx("span", {
|
|
12761
12762
|
style: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abgov/jsonforms-components",
|
|
3
|
-
"version": "2.67.
|
|
3
|
+
"version": "2.67.6",
|
|
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",
|
package/renderer-catalog.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": "1.0.0",
|
|
3
|
-
"generatedAt": "2026-06-
|
|
4
|
-
"sourceCommit": "
|
|
3
|
+
"generatedAt": "2026-06-23T21:16:03.119Z",
|
|
4
|
+
"sourceCommit": "a83b527a2f034d3e3d4699630165799b4f644517",
|
|
5
5
|
"sourcePath": "libs/jsonforms-components/src/index.ts",
|
|
6
6
|
"rendererCount": 33,
|
|
7
7
|
"renderers": [
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { DataObject, NestedItem, RenderCellColumnProps } from './ObjectListControlTypes';
|
|
2
|
+
import { ErrorObject } from 'ajv';
|
|
3
|
+
import { JsonSchema, UISchemaElement } from '@jsonforms/core';
|
|
2
4
|
export declare const extractNestedFields: (properties: DataObject, propertyKeys: string[]) => Record<string, NestedItem>;
|
|
5
|
+
export declare function prettify(prop: string): string;
|
|
3
6
|
/**
|
|
4
7
|
* Extract Json data schema name attribute and the ui schema label name.
|
|
5
8
|
* @param obj
|
|
@@ -15,3 +18,4 @@ export interface TableProps {
|
|
|
15
18
|
export declare const isObjectArrayEmpty: (currentData: string) => boolean;
|
|
16
19
|
export declare const renderNoneGivenText: (data: string | undefined) => string | import("react/jsx-runtime").JSX.Element;
|
|
17
20
|
export declare const renderCellColumn: ({ data, error, errors, index, rowPath, element, isRequired, }: RenderCellColumnProps) => string | import("react/jsx-runtime").JSX.Element | null;
|
|
21
|
+
export declare const createHumanizeError: (error: ErrorObject, schema: JsonSchema, uischema: UISchemaElement) => string | undefined;
|