@abgov/jsonforms-components 2.67.7 → 2.67.9
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 +247 -251
- package/package.json +1 -1
- package/renderer-catalog.json +2 -2
- package/src/lib/Controls/ObjectArray/ListWithDetailControl.d.ts +2 -18
- package/src/lib/Controls/ObjectArray/ListWithDetailTypes.d.ts +92 -0
- package/src/lib/common/Constants.d.ts +10 -0
- package/src/lib/util/style-component.d.ts +4 -4
package/index.esm.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import React, { useContext, useReducer, useMemo, useEffect, createContext, useCallback, useRef, useState, useLayoutEffect } from 'react';
|
|
3
|
-
import { GoabFormItem, GoabDropdown, GoabDropdownItem, GoabInput, GoabTextArea, GoabCallout, GoabRadioGroup, GoabRadioItem, GoabCheckbox, GoabIcon, GoabButton, GoabGrid, GoabIconButton,
|
|
3
|
+
import { GoabFormItem, GoabDropdown, GoabDropdownItem, GoabInput, GoabTextArea, GoabCallout, GoabRadioGroup, GoabRadioItem, GoabCheckbox, GoabIcon, GoabButton, GoabTable, GoabGrid, GoabIconButton, GoabModal, GoabButtonGroup, GoabContainer, GoabDetails, GoabFormStepper, GoabFormStep, GoabPages, GoabBadge, GoabText, GoabFileUploadInput, GoabCircularProgress, GoabSpinner } from '@abgov/react-components';
|
|
4
4
|
import Ajv from 'ajv';
|
|
5
5
|
import styled from 'styled-components';
|
|
6
6
|
import axios from 'axios';
|
|
7
7
|
import get$1 from 'lodash/get';
|
|
8
8
|
import { isVisible, isEnabled, deriveLabelForUISchemaElement, rankWith, isStringControl, and, optionIs, isDateControl, isNumberControl, isIntegerControl, isDateTimeControl, isTimeControl, uiTypeIs, isControl as isControl$1, isEnumControl, or, isOneOfEnumControl, isBooleanControl, createDefaultValue, Paths, Resolve, toDataPath, schemaTypeIs, formatIs, getAjv, schemaMatches, isObjectArrayControl, isPrimitiveArrayControl, composePaths, hasType, isCategorization, isLayout, INIT, UPDATE_CORE } from '@jsonforms/core';
|
|
9
9
|
import * as _$c from 'lodash';
|
|
10
|
-
import ___default, { isObject as isObject$i
|
|
10
|
+
import ___default, { isEmpty, isObject as isObject$i } from 'lodash';
|
|
11
11
|
import { useJsonForms, withJsonFormsControlProps, withJsonFormsEnumProps, withTranslateProps, JsonFormsDispatch, withJsonFormsAllOfProps, withJsonFormsArrayLayoutProps, withJsonFormsLayoutProps, withJsonFormsCellProps } from '@jsonforms/react';
|
|
12
12
|
import dompurify from 'dompurify';
|
|
13
13
|
import * as xss from 'xss';
|
|
14
14
|
import merge from 'lodash/merge';
|
|
15
|
-
import isEmpty from 'lodash/isEmpty';
|
|
15
|
+
import isEmpty$1 from 'lodash/isEmpty';
|
|
16
16
|
import range from 'lodash/range';
|
|
17
17
|
import pluralize from 'pluralize';
|
|
18
18
|
import { compileSync } from '@mdx-js/mdx';
|
|
@@ -4312,7 +4312,7 @@ styled.div(_t$c || (_t$c = _$b`
|
|
|
4312
4312
|
const Visible = styled.div(_t2$6 || (_t2$6 = _$b`
|
|
4313
4313
|
display: ${0};
|
|
4314
4314
|
width: 100%;
|
|
4315
|
-
`), p => p
|
|
4315
|
+
`), p => p.$visible !== false ? 'block' : 'none');
|
|
4316
4316
|
|
|
4317
4317
|
var uncurryThis$i = functionUncurryThis;
|
|
4318
4318
|
|
|
@@ -7129,7 +7129,7 @@ const GoAInputBaseControl = props => {
|
|
|
7129
7129
|
return jsx(JsonFormRegisterProvider, {
|
|
7130
7130
|
defaultRegisters: undefined,
|
|
7131
7131
|
children: jsx(Visible, {
|
|
7132
|
-
visible: visible,
|
|
7132
|
+
"$visible": visible,
|
|
7133
7133
|
children: jsx(FormFieldWrapper$1, {
|
|
7134
7134
|
ref: controlRef,
|
|
7135
7135
|
className: "jsonforms-elements-wrapper",
|
|
@@ -7270,6 +7270,16 @@ const ADDRESS_LOOKUP_LABELS = {
|
|
|
7270
7270
|
subdivisionCode: 'Province',
|
|
7271
7271
|
country: 'Country'
|
|
7272
7272
|
};
|
|
7273
|
+
const VALIDATION_KEYWORDS = {
|
|
7274
|
+
REQUIRED: 'required',
|
|
7275
|
+
MIN_LENGTH: 'minLength',
|
|
7276
|
+
MAX_LENGTH: 'maxLength',
|
|
7277
|
+
FORMAT: 'format',
|
|
7278
|
+
MINIMUM: 'minimum',
|
|
7279
|
+
MAXIMUM: 'maximum',
|
|
7280
|
+
TYPE: 'type',
|
|
7281
|
+
ERROR_MESSAGE: 'errorMessage'
|
|
7282
|
+
};
|
|
7273
7283
|
const getAddressLookupFieldLabel = fieldName => {
|
|
7274
7284
|
return ADDRESS_LOOKUP_LABELS[fieldName] || fieldName;
|
|
7275
7285
|
};
|
|
@@ -8169,7 +8179,7 @@ const GoACalloutController = props => {
|
|
|
8169
8179
|
}
|
|
8170
8180
|
const calloutProps = (uischema == null || (_uischema$options = uischema.options) == null ? void 0 : _uischema$options.componentProps) || {};
|
|
8171
8181
|
return jsx(Visible, {
|
|
8172
|
-
visible: showCallout,
|
|
8182
|
+
"$visible": showCallout,
|
|
8173
8183
|
children: callout(calloutProps)
|
|
8174
8184
|
});
|
|
8175
8185
|
};
|
|
@@ -9109,6 +9119,195 @@ const ObjectArrayToolBar = /*#__PURE__*/React.memo(function TableToolbar({
|
|
|
9109
9119
|
});
|
|
9110
9120
|
});
|
|
9111
9121
|
|
|
9122
|
+
const jsonPreviewStyle = {
|
|
9123
|
+
display: 'block',
|
|
9124
|
+
width: '100%',
|
|
9125
|
+
boxSizing: 'border-box',
|
|
9126
|
+
margin: 0,
|
|
9127
|
+
padding: 0,
|
|
9128
|
+
whiteSpace: 'pre-wrap',
|
|
9129
|
+
textAlign: 'left',
|
|
9130
|
+
overflowX: 'auto'
|
|
9131
|
+
};
|
|
9132
|
+
function prettify(prop) {
|
|
9133
|
+
return prop.replace(/([A-Z])/g, ' $1').replace(/[_-]/g, ' ').replace(/^./, c => c.toUpperCase()).trim();
|
|
9134
|
+
}
|
|
9135
|
+
/**
|
|
9136
|
+
* Extract Json data schema name attribute and the ui schema label name.
|
|
9137
|
+
* @param obj
|
|
9138
|
+
* @param names
|
|
9139
|
+
* @returns A key value of the data attribute name and the uiSchema label value
|
|
9140
|
+
*/
|
|
9141
|
+
const extractNames = (obj, names = {}) => {
|
|
9142
|
+
if (Array.isArray(obj)) {
|
|
9143
|
+
obj.forEach(item => extractNames(item, names));
|
|
9144
|
+
} else if (typeof obj === 'object' && obj !== null) {
|
|
9145
|
+
const typedObj = obj;
|
|
9146
|
+
if (typeof typedObj.scope === 'string') {
|
|
9147
|
+
const parts = typedObj.scope.split('/');
|
|
9148
|
+
const key = parts[parts.length - 1];
|
|
9149
|
+
if (typeof typedObj.label === 'string' && typedObj.label.trim()) {
|
|
9150
|
+
names[key] = typedObj.label;
|
|
9151
|
+
} else if (typeof typedObj.label === 'object' && typedObj.label !== null && 'text' in typedObj.label && typeof typedObj.label.text === 'string' && typedObj.label.text.trim()) {
|
|
9152
|
+
names[key] = typedObj.label.text;
|
|
9153
|
+
} else {
|
|
9154
|
+
names[key] = prettify(key);
|
|
9155
|
+
}
|
|
9156
|
+
}
|
|
9157
|
+
Object.values(typedObj).forEach(value => extractNames(value, names));
|
|
9158
|
+
}
|
|
9159
|
+
return names;
|
|
9160
|
+
};
|
|
9161
|
+
function getHeaderLabel(headName, itemsSchema, columnLabels) {
|
|
9162
|
+
if (columnLabels != null && columnLabels[headName]) {
|
|
9163
|
+
return columnLabels[headName];
|
|
9164
|
+
}
|
|
9165
|
+
const fieldSchema = itemsSchema == null ? void 0 : itemsSchema[headName];
|
|
9166
|
+
if (fieldSchema && typeof fieldSchema.title === 'string' && fieldSchema.title.trim()) {
|
|
9167
|
+
return fieldSchema.title;
|
|
9168
|
+
}
|
|
9169
|
+
return prettify(headName);
|
|
9170
|
+
}
|
|
9171
|
+
const DataTable = ({
|
|
9172
|
+
itemsSchema,
|
|
9173
|
+
data,
|
|
9174
|
+
columnLabels
|
|
9175
|
+
}) => {
|
|
9176
|
+
var _Object$keys;
|
|
9177
|
+
return jsxs(GoabTable, {
|
|
9178
|
+
width: "100%",
|
|
9179
|
+
children: [jsx("thead", {
|
|
9180
|
+
children: jsx("tr", {
|
|
9181
|
+
children: itemsSchema && ((_Object$keys = Object.keys(itemsSchema)) == null ? void 0 : _Object$keys.map((headNames, ix) => {
|
|
9182
|
+
return jsx("th", {
|
|
9183
|
+
children: getHeaderLabel(headNames, itemsSchema, columnLabels)
|
|
9184
|
+
}, ix);
|
|
9185
|
+
}))
|
|
9186
|
+
})
|
|
9187
|
+
}), jsx("tbody", {
|
|
9188
|
+
children: data.map((obj, index) => jsx("tr", {
|
|
9189
|
+
children: itemsSchema && Object.keys(itemsSchema).map((headNames, ix) => {
|
|
9190
|
+
return jsx("td", {
|
|
9191
|
+
children: obj[headNames]
|
|
9192
|
+
}, ix);
|
|
9193
|
+
})
|
|
9194
|
+
}, index))
|
|
9195
|
+
})]
|
|
9196
|
+
});
|
|
9197
|
+
};
|
|
9198
|
+
const isObjectArrayEmpty = currentData => {
|
|
9199
|
+
const result = isEmpty(currentData) || JSON.stringify(currentData) === '[{}]';
|
|
9200
|
+
return result;
|
|
9201
|
+
};
|
|
9202
|
+
const renderNoneGivenText = data => {
|
|
9203
|
+
return !data ? jsxs(Fragment, {
|
|
9204
|
+
children: [jsx(NoneGivenTableText, {
|
|
9205
|
+
children: "(none given)"
|
|
9206
|
+
}), jsx("br", {})]
|
|
9207
|
+
}) : data;
|
|
9208
|
+
};
|
|
9209
|
+
const renderCellColumn = ({
|
|
9210
|
+
data,
|
|
9211
|
+
error,
|
|
9212
|
+
errors,
|
|
9213
|
+
index,
|
|
9214
|
+
rowPath,
|
|
9215
|
+
element,
|
|
9216
|
+
isRequired
|
|
9217
|
+
}) => {
|
|
9218
|
+
const renderWarningCell = error => {
|
|
9219
|
+
return jsxs(HilightCellWarning, {
|
|
9220
|
+
children: [renderNoneGivenText(data), error && jsxs(ObjectArrayWarningIconDiv, {
|
|
9221
|
+
children: [jsx(GoabIcon, {
|
|
9222
|
+
type: "warning",
|
|
9223
|
+
title: "warning",
|
|
9224
|
+
size: "small",
|
|
9225
|
+
theme: "filled",
|
|
9226
|
+
mt: "2xs"
|
|
9227
|
+
}), error ? error : '']
|
|
9228
|
+
})]
|
|
9229
|
+
});
|
|
9230
|
+
};
|
|
9231
|
+
if (data === undefined && isRequired || error !== '' && error !== undefined) {
|
|
9232
|
+
const message = error || (isRequired && data === undefined ? 'Required' : data);
|
|
9233
|
+
return renderWarningCell(message);
|
|
9234
|
+
} else if (data === undefined && !isRequired) {
|
|
9235
|
+
return renderWarningCell('');
|
|
9236
|
+
} else if (data !== undefined && isRequired && error) {
|
|
9237
|
+
return renderWarningCell(error);
|
|
9238
|
+
}
|
|
9239
|
+
const path = `/${rowPath}/${index}/${element}/${index === 0 ? index : index - 1}`;
|
|
9240
|
+
const nestedErrors = errors == null ? void 0 : errors.filter(e => e.instancePath.includes(path));
|
|
9241
|
+
/* istanbul ignore next */
|
|
9242
|
+
if (typeof data === 'boolean') {
|
|
9243
|
+
return data ? 'Yes' : 'No';
|
|
9244
|
+
} else if (typeof data === 'number') {
|
|
9245
|
+
return String(data);
|
|
9246
|
+
} else if (typeof data === 'string') {
|
|
9247
|
+
return data;
|
|
9248
|
+
} else if (typeof data === 'object' || Array.isArray(data)) {
|
|
9249
|
+
const result = Object.keys(data);
|
|
9250
|
+
if (!isRequired && nestedErrors.length === 0) {
|
|
9251
|
+
if ('year' in data && 'month' in data && ('day' in data || 'date' in data)) {
|
|
9252
|
+
const dateObj = data;
|
|
9253
|
+
const dayValue = 'day' in dateObj ? dateObj.day : dateObj.date;
|
|
9254
|
+
return `${dateObj.year}-${dateObj.month}-${dayValue}`;
|
|
9255
|
+
}
|
|
9256
|
+
return jsx("pre", {
|
|
9257
|
+
style: jsonPreviewStyle,
|
|
9258
|
+
children: JSON.stringify(data, null, 2)
|
|
9259
|
+
});
|
|
9260
|
+
} else if (result.length === 0) {
|
|
9261
|
+
return renderWarningCell();
|
|
9262
|
+
} else if (result.length > 0 && (isObjectArrayEmpty(data) || nestedErrors.length > 0)) {
|
|
9263
|
+
return jsx("pre", {
|
|
9264
|
+
style: jsonPreviewStyle,
|
|
9265
|
+
children: renderWarningCell(JSON.stringify(data, null, 2))
|
|
9266
|
+
});
|
|
9267
|
+
} else if (data !== undefined && result.length > 0 && error !== '' && error !== undefined) {
|
|
9268
|
+
const values = Object.values(data);
|
|
9269
|
+
if (values && values.length > 0) {
|
|
9270
|
+
return jsx("pre", {
|
|
9271
|
+
style: jsonPreviewStyle,
|
|
9272
|
+
children: renderWarningCell(JSON.stringify(values.at(0), null, 2))
|
|
9273
|
+
});
|
|
9274
|
+
}
|
|
9275
|
+
} else {
|
|
9276
|
+
const firstRow = Array.isArray(data) ? data[0] : undefined;
|
|
9277
|
+
const columnLabels = extractNames(firstRow);
|
|
9278
|
+
return jsx(DataTable, {
|
|
9279
|
+
itemsSchema: data[0],
|
|
9280
|
+
data: data,
|
|
9281
|
+
columnLabels: columnLabels
|
|
9282
|
+
});
|
|
9283
|
+
}
|
|
9284
|
+
}
|
|
9285
|
+
return null;
|
|
9286
|
+
};
|
|
9287
|
+
const createHumanizeError = (error, schema, uischema) => {
|
|
9288
|
+
let humanMessage;
|
|
9289
|
+
if (error) {
|
|
9290
|
+
try {
|
|
9291
|
+
humanMessage = humanizeAjvError(error, schema, uischema);
|
|
9292
|
+
if (typeof humanMessage === 'string' && (humanMessage.includes('must have required property') || humanMessage.includes(REQUIRED_PROPERTY_ERROR))) {
|
|
9293
|
+
const propertyMatch = humanMessage.match(/'([^']+)'/);
|
|
9294
|
+
if (propertyMatch && propertyMatch[1]) {
|
|
9295
|
+
humanMessage = prettify(propertyMatch[1]) + ' is required';
|
|
9296
|
+
}
|
|
9297
|
+
}
|
|
9298
|
+
} catch (err) {
|
|
9299
|
+
const raw = error.message;
|
|
9300
|
+
const propertyMatch = raw == null ? void 0 : raw.match(/'([^']+)'/);
|
|
9301
|
+
if (propertyMatch && propertyMatch[1]) {
|
|
9302
|
+
humanMessage = prettify(propertyMatch[1]) + ' is required';
|
|
9303
|
+
} else {
|
|
9304
|
+
humanMessage = raw;
|
|
9305
|
+
}
|
|
9306
|
+
}
|
|
9307
|
+
}
|
|
9308
|
+
return humanMessage;
|
|
9309
|
+
};
|
|
9310
|
+
|
|
9112
9311
|
const _excluded$5 = ["label", "path", "schema", "rootSchema", "uischema", "errors", "openDeleteDialog", "visible", "enabled", "cells", "data", "config"];
|
|
9113
9312
|
const getItemsTitle = schema => {
|
|
9114
9313
|
const items = schema == null ? void 0 : schema.items;
|
|
@@ -9244,12 +9443,10 @@ const NonEmptyCellComponent$1 = /*#__PURE__*/React.memo(function NonEmptyCellCom
|
|
|
9244
9443
|
var _uischema$elements3, _uischema$options0, _uiSchemaElementsForN;
|
|
9245
9444
|
const {
|
|
9246
9445
|
schema,
|
|
9247
|
-
errors,
|
|
9248
9446
|
enabled,
|
|
9249
9447
|
renderers,
|
|
9250
9448
|
cells,
|
|
9251
9449
|
rowPath,
|
|
9252
|
-
isValid,
|
|
9253
9450
|
uischema
|
|
9254
9451
|
} = props;
|
|
9255
9452
|
const propNames = getValidColumnProps$1(schema);
|
|
@@ -9328,7 +9525,7 @@ const NonEmptyCellComponent$1 = /*#__PURE__*/React.memo(function NonEmptyCellCom
|
|
|
9328
9525
|
const NonEmptyCell$1 = ownProps => {
|
|
9329
9526
|
const ctx = useJsonForms();
|
|
9330
9527
|
const emptyCellProps = ctxToNonEmptyCellProps$1(ctx, ownProps);
|
|
9331
|
-
const isValid = isEmpty(emptyCellProps.errors);
|
|
9528
|
+
const isValid = isEmpty$1(emptyCellProps.errors);
|
|
9332
9529
|
return jsx(NonEmptyCellComponent$1, Object.assign({}, emptyCellProps, {
|
|
9333
9530
|
isValid: isValid
|
|
9334
9531
|
}));
|
|
@@ -9377,12 +9574,9 @@ function getValue(obj, path) {
|
|
|
9377
9574
|
return undefined;
|
|
9378
9575
|
}, obj);
|
|
9379
9576
|
}
|
|
9380
|
-
function prettify$1(prop) {
|
|
9381
|
-
return prop.replace(/([A-Z])/g, ' $1').replace(/[_-]/g, ' ').replace(/^./, c => c.toUpperCase());
|
|
9382
|
-
}
|
|
9383
9577
|
function findLabelForPath(path, uiSchema, schema) {
|
|
9384
9578
|
const propertyKey = path.split('.').pop() || path;
|
|
9385
|
-
const fallbackLabel = prettify
|
|
9579
|
+
const fallbackLabel = prettify(propertyKey);
|
|
9386
9580
|
if (!uiSchema) {
|
|
9387
9581
|
return fallbackLabel;
|
|
9388
9582
|
}
|
|
@@ -9573,7 +9767,7 @@ function resolveLabel(instancePath, schema, uischema) {
|
|
|
9573
9767
|
if (resolvedSchema != null && resolvedSchema.title) {
|
|
9574
9768
|
return resolvedSchema.title;
|
|
9575
9769
|
}
|
|
9576
|
-
return prettify
|
|
9770
|
+
return prettify(prop || 'Unknown field');
|
|
9577
9771
|
}
|
|
9578
9772
|
function ajvPathToSchemaPath(instancePath) {
|
|
9579
9773
|
const parts = instancePath.split('/').filter(Boolean);
|
|
@@ -9604,15 +9798,6 @@ function findControlLabel(uischema, scope) {
|
|
|
9604
9798
|
}
|
|
9605
9799
|
return;
|
|
9606
9800
|
}
|
|
9607
|
-
const VALIDATION_KEYWORDS = {
|
|
9608
|
-
REQUIRED: 'required',
|
|
9609
|
-
MIN_LENGTH: 'minLength',
|
|
9610
|
-
MAX_LENGTH: 'maxLength',
|
|
9611
|
-
FORMAT: 'format',
|
|
9612
|
-
MINIMUM: 'minimum',
|
|
9613
|
-
MAXIMUM: 'maximum',
|
|
9614
|
-
TYPE: 'type'
|
|
9615
|
-
};
|
|
9616
9801
|
function humanizeAjvError(error, schema, uischema) {
|
|
9617
9802
|
var _error$message;
|
|
9618
9803
|
const path = getEffectiveInstancePath(error);
|
|
@@ -9729,9 +9914,9 @@ const MainTab = ({
|
|
|
9729
9914
|
const rowData = getDataAtPath(core == null ? void 0 : core.data, childPath);
|
|
9730
9915
|
function resolveField(e) {
|
|
9731
9916
|
var _e$params;
|
|
9732
|
-
if (e.keyword ===
|
|
9917
|
+
if (e.keyword === VALIDATION_KEYWORDS.REQUIRED) {
|
|
9733
9918
|
return e.params.missingProperty;
|
|
9734
|
-
} else if (e.keyword ===
|
|
9919
|
+
} else if (e.keyword === VALIDATION_KEYWORDS.ERROR_MESSAGE && (_e$params = e.params) != null && _e$params.errors[0].params.missingProperty) {
|
|
9735
9920
|
return e.params.errors[0].params.missingProperty;
|
|
9736
9921
|
}
|
|
9737
9922
|
const path = e.instancePath.split('/');
|
|
@@ -9741,22 +9926,22 @@ const MainTab = ({
|
|
|
9741
9926
|
const fieldErrors = core == null || (_core$errors = core.errors) == null ? void 0 : _core$errors.filter(e => e.instancePath === rowBase || e.instancePath.startsWith(rowBase + '/')).reduce((acc, e) => {
|
|
9742
9927
|
var _e$params2;
|
|
9743
9928
|
const field = resolveField(e);
|
|
9744
|
-
if (e.keyword ===
|
|
9929
|
+
if (e.keyword === VALIDATION_KEYWORDS.ERROR_MESSAGE && (_e$params2 = e.params) != null && _e$params2.errors) {
|
|
9745
9930
|
const nestedErrors = e.params.errors;
|
|
9746
9931
|
if (field) {
|
|
9747
9932
|
try {
|
|
9748
|
-
acc.fields[field] = nestedErrors.map(ne => humanizeAjvError(ne, core.schema, core.uischema)).join(', ');
|
|
9933
|
+
acc.fields[field] = e.message ? e.message : nestedErrors.map(ne => humanizeAjvError(ne, core.schema, core.uischema)).join(', ');
|
|
9749
9934
|
} catch (err) {
|
|
9750
9935
|
var _nestedErrors$;
|
|
9751
9936
|
// Fallback: if nestedErrors contain a missingProperty, use it
|
|
9752
9937
|
const missingFromNested = nestedErrors == null || (_nestedErrors$ = nestedErrors[0]) == null || (_nestedErrors$ = _nestedErrors$.params) == null ? void 0 : _nestedErrors$.missingProperty;
|
|
9753
9938
|
if (missingFromNested) {
|
|
9754
|
-
acc.fields[field] = prettify
|
|
9939
|
+
acc.fields[field] = prettify(missingFromNested) + ' is required';
|
|
9755
9940
|
} else {
|
|
9756
9941
|
const raw = e.message;
|
|
9757
9942
|
if (raw && (raw.includes('must have required property') || raw.includes(REQUIRED_PROPERTY_ERROR))) {
|
|
9758
9943
|
const m = raw.match(/'([^']+)'/);
|
|
9759
|
-
if (m && m[1]) acc.fields[field] = prettify
|
|
9944
|
+
if (m && m[1]) acc.fields[field] = prettify(m[1]) + ' is required';else acc.fields[field] = raw;
|
|
9760
9945
|
} else {
|
|
9761
9946
|
acc.fields[field] = raw || 'Unknown error';
|
|
9762
9947
|
}
|
|
@@ -9769,12 +9954,12 @@ const MainTab = ({
|
|
|
9769
9954
|
var _nestedErrors$2;
|
|
9770
9955
|
const missingFromNested = nestedErrors == null || (_nestedErrors$2 = nestedErrors[0]) == null || (_nestedErrors$2 = _nestedErrors$2.params) == null ? void 0 : _nestedErrors$2.missingProperty;
|
|
9771
9956
|
if (missingFromNested) {
|
|
9772
|
-
acc.row = prettify
|
|
9957
|
+
acc.row = prettify(missingFromNested) + ' is required';
|
|
9773
9958
|
} else {
|
|
9774
9959
|
const raw = e == null ? void 0 : e.message;
|
|
9775
9960
|
if (raw && (raw.includes('must have required property') || raw.includes(REQUIRED_PROPERTY_ERROR))) {
|
|
9776
9961
|
const m = raw.match(/'([^']+)'/);
|
|
9777
|
-
if (m && m[1]) acc.row = prettify
|
|
9962
|
+
if (m && m[1]) acc.row = prettify(m[1]) + ' is required';else acc.row = raw;
|
|
9778
9963
|
} else {
|
|
9779
9964
|
acc.row = raw || 'Unknown error';
|
|
9780
9965
|
}
|
|
@@ -9788,7 +9973,7 @@ const MainTab = ({
|
|
|
9788
9973
|
if (typeof msg === 'string' && (msg.includes('must have required property') || msg.includes(REQUIRED_PROPERTY_ERROR))) {
|
|
9789
9974
|
const propertyMatch = msg.match(/'([^']+)'/);
|
|
9790
9975
|
if (propertyMatch && propertyMatch[1]) {
|
|
9791
|
-
msg = prettify
|
|
9976
|
+
msg = prettify(propertyMatch[1]) + ' is required';
|
|
9792
9977
|
}
|
|
9793
9978
|
}
|
|
9794
9979
|
acc.fields[field] = msg;
|
|
@@ -10031,7 +10216,7 @@ class ListWithDetailControl extends React.Component {
|
|
|
10031
10216
|
this.state.currentListPage === 0 && data === 0;
|
|
10032
10217
|
const editMode = this.state.currentListPage !== 0 && !withLeftTab;
|
|
10033
10218
|
return jsxs(Visible, {
|
|
10034
|
-
visible: visible,
|
|
10219
|
+
"$visible": visible,
|
|
10035
10220
|
"data-testid": "jsonforms-object-list-wrapper",
|
|
10036
10221
|
children: [jsxs(ToolBarHeader, {
|
|
10037
10222
|
children: [listTitle && jsx(MarginTop, {
|
|
@@ -10528,7 +10713,7 @@ const GoAEmailInput = props => {
|
|
|
10528
10713
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
10529
10714
|
}, [schema.default, data]);
|
|
10530
10715
|
return jsx(Visible, {
|
|
10531
|
-
visible: visible,
|
|
10716
|
+
"$visible": visible,
|
|
10532
10717
|
children: jsx(JsonFormRegisterProvider, {
|
|
10533
10718
|
defaultRegisters: undefined,
|
|
10534
10719
|
children: jsx(FormFieldWrapper$1, {
|
|
@@ -10604,12 +10789,12 @@ const LayoutRenderer = ({
|
|
|
10604
10789
|
visible,
|
|
10605
10790
|
width
|
|
10606
10791
|
}) => {
|
|
10607
|
-
if (isEmpty(elements)) {
|
|
10792
|
+
if (isEmpty$1(elements)) {
|
|
10608
10793
|
return null;
|
|
10609
10794
|
} else {
|
|
10610
10795
|
if (direction === 'row') {
|
|
10611
10796
|
return jsx(Visible, {
|
|
10612
|
-
visible: visible,
|
|
10797
|
+
"$visible": visible,
|
|
10613
10798
|
children: jsx(GoabGrid, {
|
|
10614
10799
|
minChildWidth: width || '10ch',
|
|
10615
10800
|
children: renderLayoutElements(elements, schema, path, enabled, renderers, cells)
|
|
@@ -10617,7 +10802,7 @@ const LayoutRenderer = ({
|
|
|
10617
10802
|
});
|
|
10618
10803
|
} else {
|
|
10619
10804
|
return jsx(Visible, {
|
|
10620
|
-
visible: visible,
|
|
10805
|
+
"$visible": visible,
|
|
10621
10806
|
children: renderLayoutElements(elements, schema, path, enabled, renderers, cells)
|
|
10622
10807
|
});
|
|
10623
10808
|
}
|
|
@@ -10634,19 +10819,19 @@ const ReviewLayoutRenderer = ({
|
|
|
10634
10819
|
visible,
|
|
10635
10820
|
width
|
|
10636
10821
|
}) => {
|
|
10637
|
-
if (isEmpty(elements)) {
|
|
10822
|
+
if (isEmpty$1(elements)) {
|
|
10638
10823
|
return null;
|
|
10639
10824
|
} else {
|
|
10640
10825
|
if (direction === 'row') {
|
|
10641
10826
|
return jsx(Visible, {
|
|
10642
|
-
visible: visible,
|
|
10827
|
+
"$visible": visible,
|
|
10643
10828
|
children: jsx(ReviewGrid, {
|
|
10644
10829
|
children: renderLayoutElements(elements, schema, path, enabled, renderers, cells)
|
|
10645
10830
|
})
|
|
10646
10831
|
});
|
|
10647
10832
|
} else {
|
|
10648
10833
|
return jsx(Visible, {
|
|
10649
|
-
visible: visible,
|
|
10834
|
+
"$visible": visible,
|
|
10650
10835
|
children: renderLayoutElements(elements, schema, path, enabled, renderers, cells)
|
|
10651
10836
|
});
|
|
10652
10837
|
}
|
|
@@ -11035,7 +11220,7 @@ const RenderStepElements = props => {
|
|
|
11035
11220
|
var _props$category;
|
|
11036
11221
|
const memoizedSchema = useMemo(() => Object.assign({}, props.schema), [props.schema]);
|
|
11037
11222
|
return jsx(Visible, {
|
|
11038
|
-
visible: props.visible,
|
|
11223
|
+
"$visible": props.visible,
|
|
11039
11224
|
"data-testid": `${(props == null ? void 0 : props.path) || ((_props$category = props.category) == null ? void 0 : _props$category.label)}-categories-${props.categoryIndex}`,
|
|
11040
11225
|
children: props.category.elements.map((uiSchema, index) => {
|
|
11041
11226
|
var _props$category2;
|
|
@@ -11238,7 +11423,7 @@ const PhoneNumberWithTypeControl = props => {
|
|
|
11238
11423
|
handleChange(path, updated);
|
|
11239
11424
|
};
|
|
11240
11425
|
return jsx(Visible, {
|
|
11241
|
-
visible: visible,
|
|
11426
|
+
"$visible": visible,
|
|
11242
11427
|
children: jsxs(PhoneGrid, {
|
|
11243
11428
|
children: [jsx(GoabFormItem, {
|
|
11244
11429
|
label: "Phone type",
|
|
@@ -11296,7 +11481,7 @@ const PhoneNumberControl = props => {
|
|
|
11296
11481
|
handleChange(path, value);
|
|
11297
11482
|
};
|
|
11298
11483
|
return jsx(Visible, {
|
|
11299
|
-
visible: visible,
|
|
11484
|
+
"$visible": visible,
|
|
11300
11485
|
children: jsx(GoabFormItem, {
|
|
11301
11486
|
label: (schema == null ? void 0 : schema.title) || 'Phone number',
|
|
11302
11487
|
requirement: required ? 'required' : undefined,
|
|
@@ -11941,195 +12126,6 @@ const DeleteDialog = /*#__PURE__*/React.memo(function DeleteDialog({
|
|
|
11941
12126
|
}, 1);
|
|
11942
12127
|
});
|
|
11943
12128
|
|
|
11944
|
-
const jsonPreviewStyle = {
|
|
11945
|
-
display: 'block',
|
|
11946
|
-
width: '100%',
|
|
11947
|
-
boxSizing: 'border-box',
|
|
11948
|
-
margin: 0,
|
|
11949
|
-
padding: 0,
|
|
11950
|
-
whiteSpace: 'pre-wrap',
|
|
11951
|
-
textAlign: 'left',
|
|
11952
|
-
overflowX: 'auto'
|
|
11953
|
-
};
|
|
11954
|
-
function prettify(prop) {
|
|
11955
|
-
return prop.replace(/([A-Z])/g, ' $1').replace(/[_-]/g, ' ').replace(/^./, c => c.toUpperCase()).trim();
|
|
11956
|
-
}
|
|
11957
|
-
/**
|
|
11958
|
-
* Extract Json data schema name attribute and the ui schema label name.
|
|
11959
|
-
* @param obj
|
|
11960
|
-
* @param names
|
|
11961
|
-
* @returns A key value of the data attribute name and the uiSchema label value
|
|
11962
|
-
*/
|
|
11963
|
-
const extractNames = (obj, names = {}) => {
|
|
11964
|
-
if (Array.isArray(obj)) {
|
|
11965
|
-
obj.forEach(item => extractNames(item, names));
|
|
11966
|
-
} else if (typeof obj === 'object' && obj !== null) {
|
|
11967
|
-
const typedObj = obj;
|
|
11968
|
-
if (typeof typedObj.scope === 'string') {
|
|
11969
|
-
const parts = typedObj.scope.split('/');
|
|
11970
|
-
const key = parts[parts.length - 1];
|
|
11971
|
-
if (typeof typedObj.label === 'string' && typedObj.label.trim()) {
|
|
11972
|
-
names[key] = typedObj.label;
|
|
11973
|
-
} else if (typeof typedObj.label === 'object' && typedObj.label !== null && 'text' in typedObj.label && typeof typedObj.label.text === 'string' && typedObj.label.text.trim()) {
|
|
11974
|
-
names[key] = typedObj.label.text;
|
|
11975
|
-
} else {
|
|
11976
|
-
names[key] = prettify(key);
|
|
11977
|
-
}
|
|
11978
|
-
}
|
|
11979
|
-
Object.values(typedObj).forEach(value => extractNames(value, names));
|
|
11980
|
-
}
|
|
11981
|
-
return names;
|
|
11982
|
-
};
|
|
11983
|
-
function getHeaderLabel(headName, itemsSchema, columnLabels) {
|
|
11984
|
-
if (columnLabels != null && columnLabels[headName]) {
|
|
11985
|
-
return columnLabels[headName];
|
|
11986
|
-
}
|
|
11987
|
-
const fieldSchema = itemsSchema == null ? void 0 : itemsSchema[headName];
|
|
11988
|
-
if (fieldSchema && typeof fieldSchema.title === 'string' && fieldSchema.title.trim()) {
|
|
11989
|
-
return fieldSchema.title;
|
|
11990
|
-
}
|
|
11991
|
-
return prettify(headName);
|
|
11992
|
-
}
|
|
11993
|
-
const DataTable = ({
|
|
11994
|
-
itemsSchema,
|
|
11995
|
-
data,
|
|
11996
|
-
columnLabels
|
|
11997
|
-
}) => {
|
|
11998
|
-
var _Object$keys;
|
|
11999
|
-
return jsxs(GoabTable, {
|
|
12000
|
-
width: "100%",
|
|
12001
|
-
children: [jsx("thead", {
|
|
12002
|
-
children: jsx("tr", {
|
|
12003
|
-
children: itemsSchema && ((_Object$keys = Object.keys(itemsSchema)) == null ? void 0 : _Object$keys.map((headNames, ix) => {
|
|
12004
|
-
return jsx("th", {
|
|
12005
|
-
children: getHeaderLabel(headNames, itemsSchema, columnLabels)
|
|
12006
|
-
}, ix);
|
|
12007
|
-
}))
|
|
12008
|
-
})
|
|
12009
|
-
}), jsx("tbody", {
|
|
12010
|
-
children: data.map((obj, index) => jsx("tr", {
|
|
12011
|
-
children: itemsSchema && Object.keys(itemsSchema).map((headNames, ix) => {
|
|
12012
|
-
return jsx("td", {
|
|
12013
|
-
children: obj[headNames]
|
|
12014
|
-
}, ix);
|
|
12015
|
-
})
|
|
12016
|
-
}, index))
|
|
12017
|
-
})]
|
|
12018
|
-
});
|
|
12019
|
-
};
|
|
12020
|
-
const isObjectArrayEmpty = currentData => {
|
|
12021
|
-
const result = isEmpty$1(currentData) || JSON.stringify(currentData) === '[{}]';
|
|
12022
|
-
return result;
|
|
12023
|
-
};
|
|
12024
|
-
const renderNoneGivenText = data => {
|
|
12025
|
-
return !data ? jsxs(Fragment, {
|
|
12026
|
-
children: [jsx(NoneGivenTableText, {
|
|
12027
|
-
children: "(none given)"
|
|
12028
|
-
}), jsx("br", {})]
|
|
12029
|
-
}) : data;
|
|
12030
|
-
};
|
|
12031
|
-
const renderCellColumn = ({
|
|
12032
|
-
data,
|
|
12033
|
-
error,
|
|
12034
|
-
errors,
|
|
12035
|
-
index,
|
|
12036
|
-
rowPath,
|
|
12037
|
-
element,
|
|
12038
|
-
isRequired
|
|
12039
|
-
}) => {
|
|
12040
|
-
const renderWarningCell = error => {
|
|
12041
|
-
return jsxs(HilightCellWarning, {
|
|
12042
|
-
children: [renderNoneGivenText(data), error && jsxs(ObjectArrayWarningIconDiv, {
|
|
12043
|
-
children: [jsx(GoabIcon, {
|
|
12044
|
-
type: "warning",
|
|
12045
|
-
title: "warning",
|
|
12046
|
-
size: "small",
|
|
12047
|
-
theme: "filled",
|
|
12048
|
-
mt: "2xs"
|
|
12049
|
-
}), error ? error : '']
|
|
12050
|
-
})]
|
|
12051
|
-
});
|
|
12052
|
-
};
|
|
12053
|
-
if (data === undefined && isRequired || error !== '' && error !== undefined) {
|
|
12054
|
-
const message = error || (isRequired && data === undefined ? 'Required' : data);
|
|
12055
|
-
return renderWarningCell(message);
|
|
12056
|
-
} else if (data === undefined && !isRequired) {
|
|
12057
|
-
return renderWarningCell('');
|
|
12058
|
-
} else if (data !== undefined && isRequired && error) {
|
|
12059
|
-
return renderWarningCell(error);
|
|
12060
|
-
}
|
|
12061
|
-
const path = `/${rowPath}/${index}/${element}/${index === 0 ? index : index - 1}`;
|
|
12062
|
-
const nestedErrors = errors == null ? void 0 : errors.filter(e => e.instancePath.includes(path));
|
|
12063
|
-
/* istanbul ignore next */
|
|
12064
|
-
if (typeof data === 'boolean') {
|
|
12065
|
-
return data ? 'Yes' : 'No';
|
|
12066
|
-
} else if (typeof data === 'number') {
|
|
12067
|
-
return String(data);
|
|
12068
|
-
} else if (typeof data === 'string') {
|
|
12069
|
-
return data;
|
|
12070
|
-
} else if (typeof data === 'object' || Array.isArray(data)) {
|
|
12071
|
-
const result = Object.keys(data);
|
|
12072
|
-
if (!isRequired && nestedErrors.length === 0) {
|
|
12073
|
-
if ('year' in data && 'month' in data && ('day' in data || 'date' in data)) {
|
|
12074
|
-
const dateObj = data;
|
|
12075
|
-
const dayValue = 'day' in dateObj ? dateObj.day : dateObj.date;
|
|
12076
|
-
return `${dateObj.year}-${dateObj.month}-${dayValue}`;
|
|
12077
|
-
}
|
|
12078
|
-
return jsx("pre", {
|
|
12079
|
-
style: jsonPreviewStyle,
|
|
12080
|
-
children: JSON.stringify(data, null, 2)
|
|
12081
|
-
});
|
|
12082
|
-
} else if (result.length === 0) {
|
|
12083
|
-
return renderWarningCell();
|
|
12084
|
-
} else if (result.length > 0 && (isObjectArrayEmpty(data) || nestedErrors.length > 0)) {
|
|
12085
|
-
return jsx("pre", {
|
|
12086
|
-
style: jsonPreviewStyle,
|
|
12087
|
-
children: renderWarningCell(JSON.stringify(data, null, 2))
|
|
12088
|
-
});
|
|
12089
|
-
} else if (data !== undefined && result.length > 0 && error !== '' && error !== undefined) {
|
|
12090
|
-
const values = Object.values(data);
|
|
12091
|
-
if (values && values.length > 0) {
|
|
12092
|
-
return jsx("pre", {
|
|
12093
|
-
style: jsonPreviewStyle,
|
|
12094
|
-
children: renderWarningCell(JSON.stringify(values.at(0), null, 2))
|
|
12095
|
-
});
|
|
12096
|
-
}
|
|
12097
|
-
} else {
|
|
12098
|
-
const firstRow = Array.isArray(data) ? data[0] : undefined;
|
|
12099
|
-
const columnLabels = extractNames(firstRow);
|
|
12100
|
-
return jsx(DataTable, {
|
|
12101
|
-
itemsSchema: data[0],
|
|
12102
|
-
data: data,
|
|
12103
|
-
columnLabels: columnLabels
|
|
12104
|
-
});
|
|
12105
|
-
}
|
|
12106
|
-
}
|
|
12107
|
-
return null;
|
|
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
|
-
};
|
|
12132
|
-
|
|
12133
12129
|
const _excluded$4 = ["label", "path", "schema", "rootSchema", "uischema", "errors", "visible", "enabled", "cells", "data", "config", "isStepperReview", "handleChange", "removeItems"];
|
|
12134
12130
|
const GenerateRows = (Cell, schema, rowPath, enabled, openDeleteDialog, handleChange, cells, uischema, isInReview, count, data, errors) => {
|
|
12135
12131
|
if ((schema == null ? void 0 : schema.type) === 'object') {
|
|
@@ -12459,7 +12455,7 @@ const NonEmptyCell = ownProps => {
|
|
|
12459
12455
|
const emptyCellProps = ctxToNonEmptyCellProps(ctx, Object.assign({}, ownProps, {
|
|
12460
12456
|
data
|
|
12461
12457
|
}));
|
|
12462
|
-
const isValid = isEmpty(emptyCellProps.errors);
|
|
12458
|
+
const isValid = isEmpty$1(emptyCellProps.errors);
|
|
12463
12459
|
return jsx(NonEmptyCellComponent, Object.assign({}, emptyCellProps, {
|
|
12464
12460
|
handleChange: ownProps == null ? void 0 : ownProps.handleChange,
|
|
12465
12461
|
isInReview: ownProps == null ? void 0 : ownProps.isInReview,
|
|
@@ -12753,7 +12749,7 @@ const ObjectArrayControl = props => {
|
|
|
12753
12749
|
});
|
|
12754
12750
|
}
|
|
12755
12751
|
const content = jsxs(Visible, {
|
|
12756
|
-
visible: visible,
|
|
12752
|
+
"$visible": visible,
|
|
12757
12753
|
"data-testid": "jsonforms-object-list-wrapper",
|
|
12758
12754
|
children: [jsxs(ToolBarHeader, {
|
|
12759
12755
|
children: [listTitle && jsxs(ObjectArrayTitle, {
|
|
@@ -12809,7 +12805,7 @@ const ArrayControl = props => {
|
|
|
12809
12805
|
handleChange
|
|
12810
12806
|
} = props;
|
|
12811
12807
|
return jsx(Visible, {
|
|
12812
|
-
visible: visible,
|
|
12808
|
+
"$visible": visible,
|
|
12813
12809
|
children: jsx(ObjectArrayControl, Object.assign({}, props, {
|
|
12814
12810
|
handleChange: handleChange
|
|
12815
12811
|
}))
|
|
@@ -12822,7 +12818,7 @@ const ArrayControlBase = props => {
|
|
|
12822
12818
|
visible
|
|
12823
12819
|
} = props;
|
|
12824
12820
|
return jsx(Visible, {
|
|
12825
|
-
visible: visible,
|
|
12821
|
+
"$visible": visible,
|
|
12826
12822
|
children: jsx(ArrayControl, Object.assign({
|
|
12827
12823
|
arraySchema: {}
|
|
12828
12824
|
}, props, {
|
|
@@ -12912,7 +12908,7 @@ const PrimitiveArrayControl = props => {
|
|
|
12912
12908
|
if (options.format === 'checkboxes') {
|
|
12913
12909
|
const checkboxOptions = getPrimitiveArrayOptions(schema);
|
|
12914
12910
|
return jsxs(Visible, {
|
|
12915
|
-
visible: visible,
|
|
12911
|
+
"$visible": visible,
|
|
12916
12912
|
children: [jsx("h4", {
|
|
12917
12913
|
children: prettyLabel
|
|
12918
12914
|
}), jsx("div", {
|
|
@@ -12946,7 +12942,7 @@ const PrimitiveArrayControl = props => {
|
|
|
12946
12942
|
});
|
|
12947
12943
|
}
|
|
12948
12944
|
return jsxs(Visible, {
|
|
12949
|
-
visible: visible,
|
|
12945
|
+
"$visible": visible,
|
|
12950
12946
|
children: [jsx("div", {
|
|
12951
12947
|
style: {
|
|
12952
12948
|
marginBottom: '8px'
|
|
@@ -13089,7 +13085,7 @@ const ListWithDetailsControl = props => {
|
|
|
13089
13085
|
// eslint-disable-next-line
|
|
13090
13086
|
}, [core == null ? void 0 : core.data, deleteTrigger, fileList, handleChange, path, props.data, props.schema, removeItems, rowData]);
|
|
13091
13087
|
return jsxs(Visible, {
|
|
13092
|
-
visible: visible,
|
|
13088
|
+
"$visible": visible,
|
|
13093
13089
|
children: [jsx(ListWithDetailControl, Object.assign({}, props, {
|
|
13094
13090
|
openDeleteDialog: openDeleteDialog,
|
|
13095
13091
|
enabled: props.enabled,
|
|
@@ -13513,7 +13509,7 @@ const GoAGroupControlComponent = props => {
|
|
|
13513
13509
|
const componentProps = (_group$options = group.options) == null ? void 0 : _group$options.componentProps;
|
|
13514
13510
|
const accent = componentProps == null ? void 0 : componentProps.accent;
|
|
13515
13511
|
return jsxs(Visible, {
|
|
13516
|
-
visible: visible,
|
|
13512
|
+
"$visible": visible,
|
|
13517
13513
|
children: [accent === 'thick' && jsx(GoabContainer, Object.assign({
|
|
13518
13514
|
heading: group.label
|
|
13519
13515
|
}, componentProps, {
|
|
@@ -13850,7 +13846,7 @@ const HelpContentComponent = _ref2 => {
|
|
|
13850
13846
|
if (markdown && ((_uischema$options7 = uischema.options) == null ? void 0 : _uischema$options7.variant) === 'details') {
|
|
13851
13847
|
var _uischema$options8, _uischema$options9, _uischema$elements;
|
|
13852
13848
|
return jsx(Visible, {
|
|
13853
|
-
visible: visible,
|
|
13849
|
+
"$visible": visible,
|
|
13854
13850
|
children: jsx(HelpContentDiv, {
|
|
13855
13851
|
"aria-label": (_uischema$options8 = uischema.options) == null ? void 0 : _uischema$options8.ariaLabel,
|
|
13856
13852
|
children: jsx("div", {
|
|
@@ -13875,7 +13871,7 @@ const HelpContentComponent = _ref2 => {
|
|
|
13875
13871
|
if (markdown) {
|
|
13876
13872
|
var _uischema$options0;
|
|
13877
13873
|
return jsx(Visible, {
|
|
13878
|
-
visible: visible,
|
|
13874
|
+
"$visible": visible,
|
|
13879
13875
|
children: jsx("div", {
|
|
13880
13876
|
className: "help-content-markdown",
|
|
13881
13877
|
children: MarkdownComponent({
|
|
@@ -13885,7 +13881,7 @@ const HelpContentComponent = _ref2 => {
|
|
|
13885
13881
|
});
|
|
13886
13882
|
}
|
|
13887
13883
|
return jsx(Visible, {
|
|
13888
|
-
visible: visible,
|
|
13884
|
+
"$visible": visible,
|
|
13889
13885
|
children: jsx(HelpContentDiv, {
|
|
13890
13886
|
"aria-label": (_uischema$options1 = uischema.options) == null ? void 0 : _uischema$options1.ariaLabel,
|
|
13891
13887
|
children: jsxs("div", {
|
|
@@ -14309,7 +14305,7 @@ const FormStepperView = props => {
|
|
|
14309
14305
|
return jsxs("div", {
|
|
14310
14306
|
"data-testid": "form-stepper-test-wrapper",
|
|
14311
14307
|
children: [jsx(Visible, {
|
|
14312
|
-
visible: visible,
|
|
14308
|
+
"$visible": visible,
|
|
14313
14309
|
children: jsxs("div", {
|
|
14314
14310
|
id: `${path || `goa`}-form-stepper`,
|
|
14315
14311
|
className: "formStepper",
|
|
@@ -14875,7 +14871,7 @@ const RenderPages = props => {
|
|
|
14875
14871
|
"data-testid": "form-stepper-test-wrapper",
|
|
14876
14872
|
ref: topElementRef,
|
|
14877
14873
|
children: [jsx(Visible, {
|
|
14878
|
-
visible: visible,
|
|
14874
|
+
"$visible": visible,
|
|
14879
14875
|
children: jsx("div", {
|
|
14880
14876
|
id: `${path || `goa`}-form-pages`,
|
|
14881
14877
|
children: jsxs(PageBorder, {
|
|
@@ -14888,7 +14884,7 @@ const RenderPages = props => {
|
|
|
14888
14884
|
},
|
|
14889
14885
|
testId: "back-to-tasks"
|
|
14890
14886
|
}), !isOnReview && jsx(Visible, {
|
|
14891
|
-
visible: true,
|
|
14887
|
+
"$visible": true,
|
|
14892
14888
|
children: jsxs("div", {
|
|
14893
14889
|
"data-testid": `step_${activeId}-content-pages`,
|
|
14894
14890
|
style: {
|
|
@@ -15302,7 +15298,7 @@ const FileUploader = _ref => {
|
|
|
15302
15298
|
});
|
|
15303
15299
|
};
|
|
15304
15300
|
return jsx(Visible, {
|
|
15305
|
-
visible: visible,
|
|
15301
|
+
"$visible": visible,
|
|
15306
15302
|
children: jsxs(FileUploaderStyle, {
|
|
15307
15303
|
className: "FileUploader",
|
|
15308
15304
|
children: [jsx(GoabFormItem, {
|
|
@@ -17806,7 +17802,7 @@ const AddressLookUpControl = props => {
|
|
|
17806
17802
|
}, [formStepperCtx, uischema == null ? void 0 : uischema.scope]);
|
|
17807
17803
|
const readOnly = (_uischema$options$com = uischema == null || (_uischema$options2 = uischema.options) == null || (_uischema$options2 = _uischema$options2.componentProps) == null ? void 0 : _uischema$options2.readOnly) != null ? _uischema$options$com : false;
|
|
17808
17804
|
return jsx(Visible, {
|
|
17809
|
-
visible: visible,
|
|
17805
|
+
"$visible": visible,
|
|
17810
17806
|
children: jsxs("div", {
|
|
17811
17807
|
ref: addressContainerRef,
|
|
17812
17808
|
children: [renderHelp(), jsx("h3", {
|
|
@@ -18127,7 +18123,7 @@ const FullNameControl = props => {
|
|
|
18127
18123
|
}
|
|
18128
18124
|
}, [stepperState == null ? void 0 : stepperState.targetScope, uischema.scope]);
|
|
18129
18125
|
return jsx(Visible, {
|
|
18130
|
-
visible: visible,
|
|
18126
|
+
"$visible": visible,
|
|
18131
18127
|
children: jsx("div", {
|
|
18132
18128
|
ref: controlRef,
|
|
18133
18129
|
children: jsx(NameInputs, {
|
|
@@ -18276,7 +18272,7 @@ const FullNameDobControl = props => {
|
|
|
18276
18272
|
}
|
|
18277
18273
|
}, [stepperState == null ? void 0 : stepperState.targetScope, uischema.scope]);
|
|
18278
18274
|
return jsx(Visible, {
|
|
18279
|
-
visible: visible,
|
|
18275
|
+
"$visible": visible,
|
|
18280
18276
|
children: jsxs("div", {
|
|
18281
18277
|
ref: controlRef,
|
|
18282
18278
|
children: [jsx(NameInputs, {
|
|
@@ -18559,7 +18555,7 @@ const GoACalculation = props => {
|
|
|
18559
18555
|
const isConfigError = !!error && (error.toLowerCase().includes('invalid scope') || error.toLowerCase().includes('expression syntax'));
|
|
18560
18556
|
const showError = !!error && (isConfigError || hasInteracted);
|
|
18561
18557
|
return jsx(Visible, {
|
|
18562
|
-
visible: visible,
|
|
18558
|
+
"$visible": visible,
|
|
18563
18559
|
children: jsx(GoabFormItem, {
|
|
18564
18560
|
label: label,
|
|
18565
18561
|
error: showError ? error : '',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abgov/jsonforms-components",
|
|
3
|
-
"version": "2.67.
|
|
3
|
+
"version": "2.67.9",
|
|
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-29T16:46:14.758Z",
|
|
4
|
+
"sourceCommit": "93bf60904fe3b0d817567ca58221da220d84e60f",
|
|
5
5
|
"sourcePath": "libs/jsonforms-components/src/index.ts",
|
|
6
6
|
"rendererCount": 33,
|
|
7
7
|
"renderers": [
|
|
@@ -1,26 +1,10 @@
|
|
|
1
|
+
import { ArrayLayoutProps, ControlElement, JsonSchema, JsonFormsCellRendererRegistryEntry, ArrayTranslations, UISchemaElement } from '@jsonforms/core';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import type { ErrorObject } from 'ajv';
|
|
3
|
-
import { ArrayLayoutProps, ControlElement, JsonSchema, JsonFormsRendererRegistryEntry, JsonFormsCellRendererRegistryEntry, ArrayTranslations, UISchemaElement, Layout } from '@jsonforms/core';
|
|
4
4
|
import { WithDeleteDialogSupport } from './DeleteDialog';
|
|
5
|
+
import { NonEmptyRowComponentProps } from './ListWithDetailTypes';
|
|
5
6
|
export type ObjectArrayControlProps = ArrayLayoutProps & WithDeleteDialogSupport;
|
|
6
7
|
export declare const extractScopesFromUISchema: (uischema: any) => string[];
|
|
7
|
-
export interface EmptyListProps {
|
|
8
|
-
numColumns: number;
|
|
9
|
-
noDataMessage: string;
|
|
10
|
-
translations: ArrayTranslations;
|
|
11
|
-
}
|
|
12
|
-
interface NonEmptyRowComponentProps {
|
|
13
|
-
propName?: string;
|
|
14
|
-
schema: JsonSchema;
|
|
15
|
-
rootSchema?: JsonSchema;
|
|
16
|
-
rowPath: string;
|
|
17
|
-
errors: string;
|
|
18
|
-
enabled: boolean;
|
|
19
|
-
renderers?: JsonFormsRendererRegistryEntry[];
|
|
20
|
-
cells?: JsonFormsCellRendererRegistryEntry[];
|
|
21
|
-
isValid: boolean;
|
|
22
|
-
uischema?: ControlElement | Layout;
|
|
23
|
-
}
|
|
24
8
|
export declare const NonEmptyCellComponent: React.NamedExoticComponent<NonEmptyRowComponentProps>;
|
|
25
9
|
interface NonEmptyRowProps {
|
|
26
10
|
childPath: string;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { ArrayLayoutProps, ArrayTranslations, ControlElement, JsonFormsCellRendererRegistryEntry, JsonFormsRendererRegistryEntry, JsonSchema, Layout, UISchemaElement } from '@jsonforms/core';
|
|
2
|
+
import { WithDeleteDialogSupport } from './DeleteDialog';
|
|
3
|
+
export type ListWithDetailArrayControlProps = ArrayLayoutProps & WithDeleteDialogSupport;
|
|
4
|
+
export interface EmptyListProps {
|
|
5
|
+
numColumns: number;
|
|
6
|
+
noDataMessage: string;
|
|
7
|
+
translations: ArrayTranslations;
|
|
8
|
+
}
|
|
9
|
+
export interface NonEmptyCellProps extends OwnPropsOfNonEmptyCell {
|
|
10
|
+
rootSchema?: JsonSchema;
|
|
11
|
+
errors: string;
|
|
12
|
+
enabled: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface OwnPropsOfNonEmptyCell {
|
|
15
|
+
rowPath: string;
|
|
16
|
+
propName?: string;
|
|
17
|
+
schema: JsonSchema;
|
|
18
|
+
enabled: boolean;
|
|
19
|
+
renderers?: JsonFormsRendererRegistryEntry[];
|
|
20
|
+
cells?: JsonFormsCellRendererRegistryEntry[];
|
|
21
|
+
uischema?: ControlElement;
|
|
22
|
+
}
|
|
23
|
+
export interface NonEmptyRowComponentProps {
|
|
24
|
+
propName?: string;
|
|
25
|
+
schema: JsonSchema;
|
|
26
|
+
rootSchema?: JsonSchema;
|
|
27
|
+
rowPath: string;
|
|
28
|
+
errors: string;
|
|
29
|
+
enabled: boolean;
|
|
30
|
+
renderers?: JsonFormsRendererRegistryEntry[];
|
|
31
|
+
cells?: JsonFormsCellRendererRegistryEntry[];
|
|
32
|
+
isValid: boolean;
|
|
33
|
+
uischema?: ControlElement | Layout;
|
|
34
|
+
}
|
|
35
|
+
export interface NonEmptyRowProps {
|
|
36
|
+
childPath: string;
|
|
37
|
+
schema: JsonSchema;
|
|
38
|
+
rowIndex: number;
|
|
39
|
+
showSortButtons: boolean;
|
|
40
|
+
enabled: boolean;
|
|
41
|
+
cells?: JsonFormsCellRendererRegistryEntry[];
|
|
42
|
+
path: string;
|
|
43
|
+
translations: ArrayTranslations;
|
|
44
|
+
uischema: ControlElement;
|
|
45
|
+
listTitle?: string;
|
|
46
|
+
}
|
|
47
|
+
export interface MainRowProps {
|
|
48
|
+
childPath: string;
|
|
49
|
+
rowIndex: number;
|
|
50
|
+
enabled: boolean;
|
|
51
|
+
currentTab: number;
|
|
52
|
+
current: HTMLElement | null;
|
|
53
|
+
selectCurrentTab: (index: number) => void;
|
|
54
|
+
setCurrentListPage: (index: number) => void;
|
|
55
|
+
rowData?: Record<string, any>;
|
|
56
|
+
uischema?: ControlElement;
|
|
57
|
+
schema?: JsonSchema;
|
|
58
|
+
}
|
|
59
|
+
export interface LeftRowProps {
|
|
60
|
+
childPath: string;
|
|
61
|
+
rowIndex: number;
|
|
62
|
+
enabled: boolean;
|
|
63
|
+
currentTab: number;
|
|
64
|
+
current: HTMLElement | null;
|
|
65
|
+
selectCurrentTab: (index: number) => void;
|
|
66
|
+
rowData?: Record<string, any>;
|
|
67
|
+
uischema?: ControlElement;
|
|
68
|
+
schema?: JsonSchema;
|
|
69
|
+
name: string;
|
|
70
|
+
translations: ArrayTranslations;
|
|
71
|
+
}
|
|
72
|
+
export interface TableRowsProp {
|
|
73
|
+
data: number;
|
|
74
|
+
path: string;
|
|
75
|
+
schema: JsonSchema;
|
|
76
|
+
uischema: ControlElement;
|
|
77
|
+
config?: any;
|
|
78
|
+
enabled: boolean;
|
|
79
|
+
cells?: JsonFormsCellRendererRegistryEntry[];
|
|
80
|
+
translations: ArrayTranslations;
|
|
81
|
+
currentIndex: number;
|
|
82
|
+
setCurrentIndex: (index: number) => void;
|
|
83
|
+
setCurrentListPage: (index: number) => void;
|
|
84
|
+
currentListPage: number;
|
|
85
|
+
listTitle?: string;
|
|
86
|
+
errors: string;
|
|
87
|
+
}
|
|
88
|
+
export interface SummaryDisplayProps {
|
|
89
|
+
rowData: Record<string, unknown> | undefined;
|
|
90
|
+
uischema?: UISchemaElement;
|
|
91
|
+
schema?: JsonSchema;
|
|
92
|
+
}
|
|
@@ -10,4 +10,14 @@ export declare const ADDRESS_LOOKUP_LABELS: {
|
|
|
10
10
|
readonly subdivisionCode: "Province";
|
|
11
11
|
readonly country: "Country";
|
|
12
12
|
};
|
|
13
|
+
export declare const VALIDATION_KEYWORDS: {
|
|
14
|
+
REQUIRED: string;
|
|
15
|
+
MIN_LENGTH: string;
|
|
16
|
+
MAX_LENGTH: string;
|
|
17
|
+
FORMAT: string;
|
|
18
|
+
MINIMUM: string;
|
|
19
|
+
MAXIMUM: string;
|
|
20
|
+
TYPE: string;
|
|
21
|
+
ERROR_MESSAGE: string;
|
|
22
|
+
};
|
|
13
23
|
export declare const getAddressLookupFieldLabel: (fieldName: string) => string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const VerticalLayout: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
2
|
-
export declare const Visible: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "visible"> & {
|
|
3
|
-
visible
|
|
4
|
-
}, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "visible"> & {
|
|
5
|
-
visible
|
|
2
|
+
export declare const Visible: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$visible"> & {
|
|
3
|
+
$visible?: boolean;
|
|
4
|
+
}, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$visible"> & {
|
|
5
|
+
$visible?: boolean;
|
|
6
6
|
}, never>>> & string;
|