@abgov/jsonforms-components 2.38.2 → 2.38.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
CHANGED
|
@@ -6450,8 +6450,8 @@ const RadioGroup = props => {
|
|
|
6450
6450
|
const appliedUiSchemaOptions = merge({}, config, props.uischema.options, options);
|
|
6451
6451
|
return jsx(GoARadioGroup, Object.assign({
|
|
6452
6452
|
error: isVisited && errors.length > 0,
|
|
6453
|
-
name: `${
|
|
6454
|
-
testId: `${
|
|
6453
|
+
name: `${path || appliedUiSchemaOptions.label}`,
|
|
6454
|
+
testId: `${path || id || label}-radio-group`,
|
|
6455
6455
|
value: data,
|
|
6456
6456
|
disabled: !enabled
|
|
6457
6457
|
}, appliedUiSchemaOptions, {
|
|
@@ -7089,7 +7089,7 @@ let _$6 = t => t,
|
|
|
7089
7089
|
_t20$1,
|
|
7090
7090
|
_t21$1,
|
|
7091
7091
|
_t22$1,
|
|
7092
|
-
_t23,
|
|
7092
|
+
_t23$1,
|
|
7093
7093
|
_t24,
|
|
7094
7094
|
_t25,
|
|
7095
7095
|
_t26,
|
|
@@ -7248,7 +7248,7 @@ const TableReviewCategoryLabel = styled.h3(_t22$1 || (_t22$1 = _$6`
|
|
|
7248
7248
|
color: var(--goa-color-text-secondary) !important;
|
|
7249
7249
|
margin-bottom: var(--goa-space-l);
|
|
7250
7250
|
`));
|
|
7251
|
-
const CategoryStatus = styled.td(_t23 || (_t23 = _$6`
|
|
7251
|
+
const CategoryStatus = styled.td(_t23$1 || (_t23$1 = _$6`
|
|
7252
7252
|
width: var(--goa-space-xl);
|
|
7253
7253
|
padding-right: var(--goa-space-xl);
|
|
7254
7254
|
align-content: center;
|
|
@@ -9930,7 +9930,8 @@ let _$3 = t => t,
|
|
|
9930
9930
|
_t19,
|
|
9931
9931
|
_t20,
|
|
9932
9932
|
_t21,
|
|
9933
|
-
_t22
|
|
9933
|
+
_t22,
|
|
9934
|
+
_t23;
|
|
9934
9935
|
const DeleteDialogContent = styled.div(_t$3 || (_t$3 = _$3`
|
|
9935
9936
|
margin-bottom: var(--goa-space-m);
|
|
9936
9937
|
`));
|
|
@@ -10047,6 +10048,15 @@ styled.div(_t21 || (_t21 = _$3`
|
|
|
10047
10048
|
const HilightCellWarning = styled.div(_t22 || (_t22 = _$3`
|
|
10048
10049
|
background-color: var(--goa-color-warning-default);
|
|
10049
10050
|
`));
|
|
10051
|
+
const FixTableHeaderAlignment = styled.div(_t23 || (_t23 = _$3`
|
|
10052
|
+
table thead th:nth-child(3) {
|
|
10053
|
+
text-align: center;
|
|
10054
|
+
}
|
|
10055
|
+
|
|
10056
|
+
table tbody td:nth-child(3) {
|
|
10057
|
+
text-align: center;
|
|
10058
|
+
}
|
|
10059
|
+
`));
|
|
10050
10060
|
|
|
10051
10061
|
const DeleteDialog = /*#__PURE__*/React.memo(function DeleteDialog({
|
|
10052
10062
|
open,
|
|
@@ -10375,140 +10385,145 @@ const NonEmptyCellComponent$1 = /*#__PURE__*/React.memo(function NonEmptyCellCom
|
|
|
10375
10385
|
cells: cells
|
|
10376
10386
|
}, rowPath);
|
|
10377
10387
|
}), properties && Object.keys(properties).length > 0 && jsxs(Fragment, {
|
|
10378
|
-
children: [
|
|
10379
|
-
|
|
10380
|
-
|
|
10381
|
-
children:
|
|
10382
|
-
children:
|
|
10383
|
-
|
|
10384
|
-
|
|
10385
|
-
|
|
10388
|
+
children: [jsx(FixTableHeaderAlignment, {
|
|
10389
|
+
children: jsxs(GoATable, {
|
|
10390
|
+
width: "100%",
|
|
10391
|
+
children: [jsx("thead", {
|
|
10392
|
+
children: jsxs("tr", {
|
|
10393
|
+
children: [Object.entries(tableKeys).map(([value, index]) => {
|
|
10394
|
+
const currentProperty = properties[value];
|
|
10395
|
+
if (!isInReview) {
|
|
10396
|
+
return jsx("th", {
|
|
10397
|
+
children: jsxs("p", {
|
|
10398
|
+
children: [(currentProperty === null || currentProperty === void 0 ? void 0 : currentProperty.title) || convertToSentenceCase(index), (required === null || required === void 0 ? void 0 : required.includes(value)) && jsx(RequiredSpan, {
|
|
10399
|
+
children: "(required)"
|
|
10400
|
+
})]
|
|
10401
|
+
})
|
|
10402
|
+
}, index);
|
|
10403
|
+
}
|
|
10404
|
+
return jsx(TableTHHeader, {
|
|
10386
10405
|
children: jsxs("p", {
|
|
10387
|
-
children: [(currentProperty === null || currentProperty === void 0 ? void 0 : currentProperty.title) || convertToSentenceCase(index)
|
|
10388
|
-
children: "(required)"
|
|
10406
|
+
children: [`${(currentProperty === null || currentProperty === void 0 ? void 0 : currentProperty.title) || convertToSentenceCase(index)}`, (required === null || required === void 0 ? void 0 : required.includes(value)) && jsxs(RequiredSpan, {
|
|
10407
|
+
children: [jsx("br", {}), " (required)"]
|
|
10389
10408
|
})]
|
|
10390
10409
|
})
|
|
10391
10410
|
}, index);
|
|
10392
|
-
}
|
|
10393
|
-
|
|
10394
|
-
|
|
10395
|
-
children: [`${(currentProperty === null || currentProperty === void 0 ? void 0 : currentProperty.title) || convertToSentenceCase(index)}`, (required === null || required === void 0 ? void 0 : required.includes(value)) && jsxs(RequiredSpan, {
|
|
10396
|
-
children: [jsx("br", {}), " (required)"]
|
|
10397
|
-
})]
|
|
10411
|
+
}), isInReview !== true && jsx("th", {
|
|
10412
|
+
children: jsx("p", {
|
|
10413
|
+
children: "Actions"
|
|
10398
10414
|
})
|
|
10399
|
-
}
|
|
10400
|
-
}
|
|
10401
|
-
|
|
10402
|
-
|
|
10403
|
-
})
|
|
10404
|
-
|
|
10405
|
-
|
|
10406
|
-
|
|
10407
|
-
|
|
10408
|
-
|
|
10409
|
-
|
|
10410
|
-
|
|
10411
|
-
|
|
10412
|
-
|
|
10413
|
-
|
|
10414
|
-
|
|
10415
|
-
|
|
10416
|
-
|
|
10417
|
-
|
|
10418
|
-
|
|
10419
|
-
|
|
10420
|
-
|
|
10421
|
-
|
|
10422
|
-
|
|
10423
|
-
|
|
10424
|
-
|
|
10415
|
+
})]
|
|
10416
|
+
}, 0)
|
|
10417
|
+
}), jsx("tbody", {
|
|
10418
|
+
children: range(count || 0).map((num, i) => {
|
|
10419
|
+
const errorRow = errors === null || errors === void 0 ? void 0 : errors.find(error => error.instancePath.includes(`/${props.rowPath.replace(/\./g, '/')}/${i}`));
|
|
10420
|
+
return jsxs("tr", {
|
|
10421
|
+
children: [Object.keys(properties).map((element, ix) => {
|
|
10422
|
+
var _a, _b;
|
|
10423
|
+
const dataObject = properties[element];
|
|
10424
|
+
const schemaName = element;
|
|
10425
|
+
const currentData = data && data[num] ? data[num][element] : '';
|
|
10426
|
+
//Get out of the loop to not render extra blank columns at the end of the table
|
|
10427
|
+
if (ix > 1 && Object.keys(tableKeys).length === ix) return null;
|
|
10428
|
+
const error = (errors === null || errors === void 0 ? void 0 : errors.filter(e => e.instancePath === `/${props.rowPath.replace(/\./g, '/')}/${i}/${element}` || e.instancePath === `/${props.rowPath.replace(/\./g, '/')}/${i}`)).find(y => {
|
|
10429
|
+
var _a;
|
|
10430
|
+
return ((_a = y === null || y === void 0 ? void 0 : y.message) === null || _a === void 0 ? void 0 : _a.includes(element)) || y.instancePath.includes(element);
|
|
10431
|
+
});
|
|
10432
|
+
if ((error === null || error === void 0 ? void 0 : error.message.includes('must NOT have fewer')) && required.find(r => r === schemaName) && (isEmptyBoolean(schema, currentData) || isEmptyNumber(schema, currentData))) {
|
|
10433
|
+
error.message = `${capitalizeFirstLetter(schemaName)} is required`;
|
|
10434
|
+
}
|
|
10435
|
+
if (isInReview === true) {
|
|
10436
|
+
return jsx("td", {
|
|
10437
|
+
children: jsx("div", {
|
|
10438
|
+
"data-testid": `#/properties/${schemaName}-input-${i}-review`,
|
|
10439
|
+
style: {
|
|
10440
|
+
display: 'block'
|
|
10441
|
+
},
|
|
10442
|
+
children: renderCellColumn({
|
|
10443
|
+
data: currentData ? String(currentData) : undefined,
|
|
10444
|
+
error: error === null || error === void 0 ? void 0 : error.message,
|
|
10445
|
+
isRequired: (_a = required === null || required === void 0 ? void 0 : required.includes(tableKeys[element])) !== null && _a !== void 0 ? _a : false,
|
|
10446
|
+
errors: errors !== undefined ? errors : [],
|
|
10447
|
+
element,
|
|
10448
|
+
rowPath,
|
|
10449
|
+
index: i
|
|
10450
|
+
})
|
|
10451
|
+
})
|
|
10452
|
+
}, ix);
|
|
10453
|
+
}
|
|
10425
10454
|
return jsx("td", {
|
|
10426
|
-
children: jsx(
|
|
10427
|
-
|
|
10428
|
-
|
|
10429
|
-
|
|
10430
|
-
|
|
10431
|
-
|
|
10432
|
-
|
|
10433
|
-
|
|
10434
|
-
|
|
10435
|
-
|
|
10455
|
+
children: jsx(GoAFormItem, {
|
|
10456
|
+
error: (_b = error === null || error === void 0 ? void 0 : error.message) !== null && _b !== void 0 ? _b : '',
|
|
10457
|
+
mb: errorRow && !error && '2xl' || 'xs',
|
|
10458
|
+
children: dataObject.enum ? jsxs(GoADropdown, {
|
|
10459
|
+
id: schemaName,
|
|
10460
|
+
name: schemaName,
|
|
10461
|
+
value: currentData != null ? String(currentData) : '',
|
|
10462
|
+
testId: `#/properties/${schemaName}-select-${i}`,
|
|
10463
|
+
onChange: (name, value) => {
|
|
10464
|
+
const selectedValue = Array.isArray(value) ? value[0] : value;
|
|
10465
|
+
const coerced = dataObject.type === 'number' && selectedValue !== '' ? Number(selectedValue) : selectedValue;
|
|
10466
|
+
handleChange(rowPath, {
|
|
10467
|
+
[num]: {
|
|
10468
|
+
[schemaName]: coerced
|
|
10469
|
+
}
|
|
10470
|
+
});
|
|
10471
|
+
},
|
|
10472
|
+
width: "100%",
|
|
10473
|
+
ariaLabel: schemaName,
|
|
10474
|
+
error: !!(error === null || error === void 0 ? void 0 : error.message),
|
|
10475
|
+
children: [!(required === null || required === void 0 ? void 0 : required.includes(schemaName)) && jsx(GoADropdownItem, {
|
|
10476
|
+
value: "",
|
|
10477
|
+
label: `-- Select ${convertToSentenceCase(schemaName)} --`
|
|
10478
|
+
}), dataObject.enum.map(opt => jsx(GoADropdownItem, {
|
|
10479
|
+
value: String(opt),
|
|
10480
|
+
label: String(opt)
|
|
10481
|
+
}, String(opt)))]
|
|
10482
|
+
}) : dataObject.type === 'number' || dataObject.type === 'string' && !dataObject.enum ? jsx(GoAInput, {
|
|
10483
|
+
error: (error === null || error === void 0 ? void 0 : error.message.length) > 0,
|
|
10484
|
+
type: dataObject.type === 'number' ? 'number' : 'text',
|
|
10485
|
+
id: schemaName,
|
|
10486
|
+
name: schemaName,
|
|
10487
|
+
value: currentData,
|
|
10488
|
+
testId: `#/properties/${schemaName}-input-${i}`,
|
|
10489
|
+
onChange: (name, value) => {
|
|
10490
|
+
handleChange(rowPath, {
|
|
10491
|
+
[num]: {
|
|
10492
|
+
[name]: dataObject.type === 'number' ? parseInt(value) : value
|
|
10493
|
+
}
|
|
10494
|
+
});
|
|
10495
|
+
},
|
|
10496
|
+
ariaLabel: schemaName,
|
|
10497
|
+
width: "100%"
|
|
10498
|
+
}) : jsx(GoACallout, {
|
|
10499
|
+
type: "important",
|
|
10500
|
+
size: "medium",
|
|
10501
|
+
testId: "form-support-callout",
|
|
10502
|
+
heading: "Not supported",
|
|
10503
|
+
children: "Only string, number, and enum are supported inside arrays"
|
|
10436
10504
|
})
|
|
10437
10505
|
})
|
|
10438
10506
|
}, ix);
|
|
10439
|
-
}
|
|
10440
|
-
|
|
10441
|
-
|
|
10442
|
-
|
|
10443
|
-
|
|
10444
|
-
|
|
10445
|
-
|
|
10446
|
-
|
|
10447
|
-
|
|
10448
|
-
|
|
10449
|
-
|
|
10450
|
-
|
|
10451
|
-
|
|
10452
|
-
handleChange(rowPath, {
|
|
10453
|
-
[num]: {
|
|
10454
|
-
[schemaName]: coerced
|
|
10455
|
-
}
|
|
10456
|
-
});
|
|
10457
|
-
},
|
|
10458
|
-
width: "100%",
|
|
10459
|
-
ariaLabel: schemaName,
|
|
10460
|
-
error: !!(error === null || error === void 0 ? void 0 : error.message),
|
|
10461
|
-
children: [!(required === null || required === void 0 ? void 0 : required.includes(schemaName)) && jsx(GoADropdownItem, {
|
|
10462
|
-
value: "",
|
|
10463
|
-
label: `-- Select ${convertToSentenceCase(schemaName)} --`
|
|
10464
|
-
}), dataObject.enum.map(opt => jsx(GoADropdownItem, {
|
|
10465
|
-
value: String(opt),
|
|
10466
|
-
label: String(opt)
|
|
10467
|
-
}, String(opt)))]
|
|
10468
|
-
}) : dataObject.type === 'number' || dataObject.type === 'string' && !dataObject.enum ? jsx(GoAInput, {
|
|
10469
|
-
error: (error === null || error === void 0 ? void 0 : error.message.length) > 0,
|
|
10470
|
-
type: dataObject.type === 'number' ? 'number' : 'text',
|
|
10471
|
-
id: schemaName,
|
|
10472
|
-
name: schemaName,
|
|
10473
|
-
value: currentData,
|
|
10474
|
-
testId: `#/properties/${schemaName}-input-${i}`,
|
|
10475
|
-
onChange: (name, value) => {
|
|
10476
|
-
handleChange(rowPath, {
|
|
10477
|
-
[num]: {
|
|
10478
|
-
[name]: dataObject.type === 'number' ? parseInt(value) : value
|
|
10479
|
-
}
|
|
10480
|
-
});
|
|
10481
|
-
},
|
|
10482
|
-
ariaLabel: schemaName,
|
|
10483
|
-
width: "100%"
|
|
10484
|
-
}) : jsx(GoACallout, {
|
|
10485
|
-
type: "important",
|
|
10486
|
-
size: "medium",
|
|
10487
|
-
testId: "form-support-callout",
|
|
10488
|
-
heading: "Not supported",
|
|
10489
|
-
children: "Only string, number, and enum are supported inside arrays"
|
|
10507
|
+
}), !isInReview && jsx("td", {
|
|
10508
|
+
style: {
|
|
10509
|
+
alignContent: 'baseLine',
|
|
10510
|
+
paddingTop: '18px'
|
|
10511
|
+
},
|
|
10512
|
+
children: jsx("div", {
|
|
10513
|
+
"aria-hidden": "true",
|
|
10514
|
+
children: jsx(GoAIconButton, {
|
|
10515
|
+
icon: "trash",
|
|
10516
|
+
title: "trash button",
|
|
10517
|
+
testId: "trash-icon-button",
|
|
10518
|
+
"aria-label": `remove-element-${num}`,
|
|
10519
|
+
onClick: () => openDeleteDialog(num)
|
|
10490
10520
|
})
|
|
10491
10521
|
})
|
|
10492
|
-
}
|
|
10493
|
-
}
|
|
10494
|
-
|
|
10495
|
-
|
|
10496
|
-
|
|
10497
|
-
},
|
|
10498
|
-
children: jsx("div", {
|
|
10499
|
-
"aria-hidden": "true",
|
|
10500
|
-
children: jsx(GoAIconButton, {
|
|
10501
|
-
icon: "trash",
|
|
10502
|
-
title: "trash button",
|
|
10503
|
-
testId: "trash-icon-button",
|
|
10504
|
-
"aria-label": `remove-element-${num}`,
|
|
10505
|
-
onClick: () => openDeleteDialog(num)
|
|
10506
|
-
})
|
|
10507
|
-
})
|
|
10508
|
-
})]
|
|
10509
|
-
}, `${rowPath}-${i}-${num}`);
|
|
10510
|
-
})
|
|
10511
|
-
})]
|
|
10522
|
+
})]
|
|
10523
|
+
}, `${rowPath}-${i}-${num}`);
|
|
10524
|
+
})
|
|
10525
|
+
})]
|
|
10526
|
+
})
|
|
10512
10527
|
}), hasAnyErrors && isInReview && jsx(GoAFormItem, {
|
|
10513
10528
|
error: `There are validation errors for '${capitalizeFirstLetter(rowPath)}'`
|
|
10514
10529
|
})]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abgov/jsonforms-components",
|
|
3
|
-
"version": "2.38.
|
|
3
|
+
"version": "2.38.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",
|
|
@@ -22,3 +22,4 @@ export declare const ListWithDetailWarningIconDiv: import("styled-components/dis
|
|
|
22
22
|
export declare const ObjectArrayRequiredTextLabel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, never>> & string;
|
|
23
23
|
export declare const HasErrorLabel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
24
24
|
export declare const HilightCellWarning: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
25
|
+
export declare const FixTableHeaderAlignment: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|