@abgov/jsonforms-components 2.67.3 → 2.67.5
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,7 @@ 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-
|
|
5977
|
+
padding-left: var(--goa-space-xs);
|
|
5978
5978
|
color: var(--goa-color-greyscale-700);
|
|
5979
5979
|
font-style: italic;
|
|
5980
5980
|
`));
|
|
@@ -10037,7 +10037,7 @@ class ListWithDetailControl extends React.Component {
|
|
|
10037
10037
|
children: [listTitle && jsx(MarginTop, {
|
|
10038
10038
|
children: jsxs(ObjectArrayTitle, {
|
|
10039
10039
|
children: [listTitle, " ", jsx("span", {
|
|
10040
|
-
children: additionalProps.required && '(required)'
|
|
10040
|
+
children: additionalProps.required && ' (required)'
|
|
10041
10041
|
}), this.state.maxItemsError && jsx("span", {
|
|
10042
10042
|
style: {
|
|
10043
10043
|
color: 'red',
|
|
@@ -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,7 +12038,7 @@ 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",
|
|
@@ -12053,6 +12053,8 @@ const renderCellColumn = ({
|
|
|
12053
12053
|
if (data === undefined && isRequired || error !== '' && error !== undefined) {
|
|
12054
12054
|
const message = error || (isRequired && data === undefined ? 'Required' : data);
|
|
12055
12055
|
return renderWarningCell(message);
|
|
12056
|
+
} else if (data === undefined && !isRequired) {
|
|
12057
|
+
return renderWarningCell('');
|
|
12056
12058
|
} else if (data !== undefined && isRequired && error) {
|
|
12057
12059
|
return renderWarningCell(error);
|
|
12058
12060
|
}
|
|
@@ -12104,6 +12106,29 @@ const renderCellColumn = ({
|
|
|
12104
12106
|
}
|
|
12105
12107
|
return null;
|
|
12106
12108
|
};
|
|
12109
|
+
const createHumanizeError = (error, schema, uischema) => {
|
|
12110
|
+
let humanMessage;
|
|
12111
|
+
if (error) {
|
|
12112
|
+
try {
|
|
12113
|
+
humanMessage = humanizeAjvError(error, schema, uischema);
|
|
12114
|
+
if (typeof humanMessage === 'string' && (humanMessage.includes('must have required property') || humanMessage.includes(REQUIRED_PROPERTY_ERROR))) {
|
|
12115
|
+
const propertyMatch = humanMessage.match(/'([^']+)'/);
|
|
12116
|
+
if (propertyMatch && propertyMatch[1]) {
|
|
12117
|
+
humanMessage = prettify(propertyMatch[1]) + ' is required';
|
|
12118
|
+
}
|
|
12119
|
+
}
|
|
12120
|
+
} catch (err) {
|
|
12121
|
+
const raw = error.message;
|
|
12122
|
+
const propertyMatch = raw == null ? void 0 : raw.match(/'([^']+)'/);
|
|
12123
|
+
if (propertyMatch && propertyMatch[1]) {
|
|
12124
|
+
humanMessage = prettify(propertyMatch[1]) + ' is required';
|
|
12125
|
+
} else {
|
|
12126
|
+
humanMessage = raw;
|
|
12127
|
+
}
|
|
12128
|
+
}
|
|
12129
|
+
}
|
|
12130
|
+
return humanMessage;
|
|
12131
|
+
};
|
|
12107
12132
|
|
|
12108
12133
|
const _excluded$4 = ["label", "path", "schema", "rootSchema", "uischema", "errors", "visible", "enabled", "cells", "data", "config", "isStepperReview", "handleChange", "removeItems"];
|
|
12109
12134
|
const GenerateRows = (Cell, schema, rowPath, enabled, openDeleteDialog, handleChange, cells, uischema, isInReview, count, data, errors) => {
|
|
@@ -12268,7 +12293,6 @@ const NonEmptyCellComponent = /*#__PURE__*/React.memo(function NonEmptyCellCompo
|
|
|
12268
12293
|
return e.instancePath === fieldPath || e.instancePath === rowPathMatch && msg.includes(key) || e.instancePath === rowPathMatch && requiredProperty === key;
|
|
12269
12294
|
});
|
|
12270
12295
|
const isEmptyValue = value === undefined || value === null || value === '';
|
|
12271
|
-
if (isEmptyValue && !isRequiredField && !fieldError) return null;
|
|
12272
12296
|
let reviewError = '';
|
|
12273
12297
|
if (fieldError) {
|
|
12274
12298
|
const raw = fieldError.message || '';
|
|
@@ -12319,7 +12343,7 @@ const NonEmptyCellComponent = /*#__PURE__*/React.memo(function NonEmptyCellCompo
|
|
|
12319
12343
|
const currentProperty = properties[value];
|
|
12320
12344
|
return jsx("th", {
|
|
12321
12345
|
children: jsxs("p", {
|
|
12322
|
-
children: [(currentProperty == null ? void 0 : currentProperty.title) || index, (required == null ? void 0 : required.includes(value)) && jsx(RequiredSpan, {
|
|
12346
|
+
children: [(currentProperty == null ? void 0 : currentProperty.title) || index, ' ', (required == null ? void 0 : required.includes(value)) && jsx(RequiredSpan, {
|
|
12323
12347
|
children: "(required)"
|
|
12324
12348
|
})]
|
|
12325
12349
|
})
|
|
@@ -12345,30 +12369,8 @@ const NonEmptyCellComponent = /*#__PURE__*/React.memo(function NonEmptyCellCompo
|
|
|
12345
12369
|
var _y$message;
|
|
12346
12370
|
return (y == null || (_y$message = y.message) == null ? void 0 : _y$message.includes(element)) || y.instancePath.includes(element);
|
|
12347
12371
|
});
|
|
12348
|
-
function prettify(prop) {
|
|
12349
|
-
return prop.replace(/([A-Z])/g, ' $1').replace(/[_-]/g, ' ').replace(/^./, c => c.toUpperCase());
|
|
12350
|
-
}
|
|
12351
12372
|
// 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
|
-
}
|
|
12373
|
+
let humanMessage = createHumanizeError(error, schema, uischema);
|
|
12372
12374
|
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
12375
|
humanMessage = `${capitalizeFirstLetter(schemaName)} is required`;
|
|
12374
12376
|
}
|
|
@@ -12715,7 +12717,7 @@ const ObjectArrayControl = props => {
|
|
|
12715
12717
|
alignItems: 'center'
|
|
12716
12718
|
},
|
|
12717
12719
|
children: [jsxs(ReviewLabel, {
|
|
12718
|
-
children: [listTitle,
|
|
12720
|
+
children: [listTitle, jsx("span", {
|
|
12719
12721
|
children: additionalProps.required && '(required)'
|
|
12720
12722
|
}), maxItemsError && jsx("span", {
|
|
12721
12723
|
style: {
|
|
@@ -12755,7 +12757,7 @@ const ObjectArrayControl = props => {
|
|
|
12755
12757
|
"data-testid": "jsonforms-object-list-wrapper",
|
|
12756
12758
|
children: [jsxs(ToolBarHeader, {
|
|
12757
12759
|
children: [listTitle && jsxs(ObjectArrayTitle, {
|
|
12758
|
-
children: [listTitle,
|
|
12760
|
+
children: [listTitle, jsx("span", {
|
|
12759
12761
|
children: additionalProps.required && '(required)'
|
|
12760
12762
|
}), maxItemsError && jsx("span", {
|
|
12761
12763
|
style: {
|
|
@@ -15134,7 +15136,6 @@ let _2 = t => t,
|
|
|
15134
15136
|
_t3,
|
|
15135
15137
|
_t4;
|
|
15136
15138
|
const _excluded$1 = ["data", "path", "handleChange", "uischema"];
|
|
15137
|
-
const DELAY_DELETE_TIMEOUT_MS = 5;
|
|
15138
15139
|
const FileUploaderReview = props => {
|
|
15139
15140
|
return FileUploader(Object.assign({}, props, {
|
|
15140
15141
|
isStepperReview: true
|
|
@@ -15176,6 +15177,7 @@ const FileUploader = _ref => {
|
|
|
15176
15177
|
const noDownloadButtonInReview = uischema == null || (_uischema$options3 = uischema.options) == null || (_uischema$options3 = _uischema$options3.format) == null || (_uischema$options3 = _uischema$options3.review) == null ? void 0 : _uischema$options3.noDownloadButton;
|
|
15177
15178
|
const noDeleteButton = uischema == null || (_uischema$options4 = uischema.options) == null || (_uischema$options4 = _uischema$options4.format) == null || (_uischema$options4 = _uischema$options4.review) == null ? void 0 : _uischema$options4.noDeleteButton;
|
|
15178
15179
|
const [deleteHide, setDeleteHide] = useState(false);
|
|
15180
|
+
const [deleteConfirmIndex, setDeleteConfirmIndex] = useState(null);
|
|
15179
15181
|
const fileListLength = fileList && ((_fileList$path = fileList[path]) == null ? void 0 : _fileList$path.length) || 0;
|
|
15180
15182
|
const maxFiles = (_uischema$options$com = uischema == null || (_uischema$options5 = uischema.options) == null || (_uischema$options5 = _uischema$options5.componentProps) == null ? void 0 : _uischema$options5.maximum) != null ? _uischema$options$com : 1;
|
|
15181
15183
|
const isMultiFile = maxFiles > 1;
|
|
@@ -15242,11 +15244,9 @@ const FileUploader = _ref => {
|
|
|
15242
15244
|
}
|
|
15243
15245
|
const helpText = uischema == null || (_uischema$options9 = uischema.options) == null ? void 0 : _uischema$options9.help;
|
|
15244
15246
|
const sentenceCaseLabel = label;
|
|
15245
|
-
const
|
|
15246
|
-
index
|
|
15247
|
-
}) => {
|
|
15247
|
+
const renderFileItem = index => {
|
|
15248
15248
|
var _getFile2;
|
|
15249
|
-
const
|
|
15249
|
+
const showFileDeleteConfirmation = deleteConfirmIndex === index;
|
|
15250
15250
|
return jsx("div", {
|
|
15251
15251
|
children: readOnly ? jsxs(AttachmentBorderDisabled, {
|
|
15252
15252
|
children: [getFileName(index), noDownloadButtonInReview !== true && jsx(GoAContextMenuIcon, {
|
|
@@ -15269,22 +15269,20 @@ const FileUploader = _ref => {
|
|
|
15269
15269
|
title: "Delete",
|
|
15270
15270
|
type: "trash",
|
|
15271
15271
|
onClick: () => {
|
|
15272
|
-
|
|
15272
|
+
setDeleteConfirmIndex(index);
|
|
15273
15273
|
}
|
|
15274
15274
|
})]
|
|
15275
15275
|
}), jsx(DeleteFileModal, {
|
|
15276
15276
|
isOpen: showFileDeleteConfirmation,
|
|
15277
15277
|
title: "Delete file",
|
|
15278
15278
|
content: `Delete file ${(_getFile2 = getFile(index)) == null ? void 0 : _getFile2.filename} ?`,
|
|
15279
|
-
onCancel: () =>
|
|
15279
|
+
onCancel: () => setDeleteConfirmIndex(null),
|
|
15280
15280
|
onDelete: () => {
|
|
15281
|
-
|
|
15281
|
+
setDeleteConfirmIndex(null);
|
|
15282
15282
|
deleteFile(getFile(index));
|
|
15283
|
-
|
|
15284
|
-
|
|
15285
|
-
|
|
15286
|
-
};
|
|
15287
|
-
setTimeout(handleFunction, DELAY_DELETE_TIMEOUT_MS);
|
|
15283
|
+
if (!isMultiFile) {
|
|
15284
|
+
setDeleteHide(true);
|
|
15285
|
+
}
|
|
15288
15286
|
setUploadError(undefined);
|
|
15289
15287
|
}
|
|
15290
15288
|
})]
|
|
@@ -15324,11 +15322,9 @@ const FileUploader = _ref => {
|
|
|
15324
15322
|
})
|
|
15325
15323
|
})
|
|
15326
15324
|
}) : jsx("div", {
|
|
15327
|
-
children: fileList && isMultiFile ? (fileList[path] || []).map((_,
|
|
15328
|
-
|
|
15329
|
-
}, index))
|
|
15330
|
-
index: fileListLength - 1
|
|
15331
|
-
})
|
|
15325
|
+
children: (fileList && isMultiFile ? (fileList[path] || []).map((_, i) => i) : !deleteHide && getFile(fileListLength - 1) && fileListLength >= 0 ? [fileListLength - 1] : []).map(index => jsx(React.Fragment, {
|
|
15326
|
+
children: renderFileItem(index)
|
|
15327
|
+
}, index))
|
|
15332
15328
|
})
|
|
15333
15329
|
})]
|
|
15334
15330
|
})
|
|
@@ -18779,7 +18775,8 @@ const createDefaultAjv = (...schemas) => {
|
|
|
18779
18775
|
verbose: true,
|
|
18780
18776
|
strict: 'log',
|
|
18781
18777
|
strictRequired: false,
|
|
18782
|
-
useDefaults: true
|
|
18778
|
+
useDefaults: true,
|
|
18779
|
+
multipleOfPrecision: 10
|
|
18783
18780
|
});
|
|
18784
18781
|
ajv.addSchema(schemas);
|
|
18785
18782
|
addErrors(ajv);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abgov/jsonforms-components",
|
|
3
|
-
"version": "2.67.
|
|
3
|
+
"version": "2.67.5",
|
|
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-19T15:48:15.845Z",
|
|
4
|
+
"sourceCommit": "a7f4a980305903c0abae4128f5d5e5e6bd9c6360",
|
|
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;
|