@abgov/jsonforms-components 2.43.2 → 2.43.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 +33 -30
- package/package.json +1 -1
package/index.esm.js
CHANGED
|
@@ -3175,7 +3175,7 @@ const checkFieldValidity = props => {
|
|
|
3175
3175
|
uischema,
|
|
3176
3176
|
schema
|
|
3177
3177
|
} = props;
|
|
3178
|
-
const labelToUpdate =
|
|
3178
|
+
const labelToUpdate = label;
|
|
3179
3179
|
const extraSchema = schema;
|
|
3180
3180
|
if (extraSchema && data && (extraSchema === null || extraSchema === void 0 ? void 0 : extraSchema.title) === sinTitle) {
|
|
3181
3181
|
if (data.length === 11 && !validateSinWithLuhn(data)) {
|
|
@@ -3236,23 +3236,6 @@ const convertToReadableFormat = input => {
|
|
|
3236
3236
|
}
|
|
3237
3237
|
return input.replace(/([a-z])([A-Z])/g, '$1 $2').split(' ').map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(' ');
|
|
3238
3238
|
};
|
|
3239
|
-
/**
|
|
3240
|
-
* Converts a input to sentence case (eg: incomeThresholdExample or IncomeThresholdExample)
|
|
3241
|
-
* to 'Income threshold example' with the first letter in the sentence capitalized.
|
|
3242
|
-
*
|
|
3243
|
-
* @param input - The camelCase or PascalCase string (e.g., "incomeThresholdExample").
|
|
3244
|
-
* @returns A formatted string with spaces and capitalization (e.g., "Income threshold example").
|
|
3245
|
-
*/
|
|
3246
|
-
const convertToSentenceCase = input => {
|
|
3247
|
-
if (!input) {
|
|
3248
|
-
return input;
|
|
3249
|
-
}
|
|
3250
|
-
const convertedInput = convertToReadableFormat(input);
|
|
3251
|
-
if (!convertedInput) return convertedInput;
|
|
3252
|
-
const firstWord = convertedInput.split(' ').splice(0, 1);
|
|
3253
|
-
const newWords = convertedInput.split(' ').splice(1).map(word => word.charAt(0).toLowerCase() + word.slice(1).toLowerCase()).join(' ');
|
|
3254
|
-
return firstWord.concat(newWords).join(' ');
|
|
3255
|
-
};
|
|
3256
3239
|
|
|
3257
3240
|
var $$t = _export;
|
|
3258
3241
|
var call$a = functionCall;
|
|
@@ -6251,7 +6234,7 @@ const GoAInputBaseControl = props => {
|
|
|
6251
6234
|
skipInitialValidation
|
|
6252
6235
|
} = props;
|
|
6253
6236
|
const InnerComponent = input;
|
|
6254
|
-
const labelToUpdate =
|
|
6237
|
+
const labelToUpdate = label || '';
|
|
6255
6238
|
let modifiedErrors = checkFieldValidity(props);
|
|
6256
6239
|
const formStepperCtx = useContext(JsonFormsStepperContext);
|
|
6257
6240
|
const stepperState = (_a = formStepperCtx === null || formStepperCtx === void 0 ? void 0 : formStepperCtx.selectStepperState) === null || _a === void 0 ? void 0 : _a.call(formStepperCtx);
|
|
@@ -7779,11 +7762,17 @@ const GoABaseInputReviewComponent = props => {
|
|
|
7779
7762
|
return null;
|
|
7780
7763
|
};
|
|
7781
7764
|
if (isBoolean) {
|
|
7782
|
-
|
|
7765
|
+
let checkboxLabel = '';
|
|
7766
|
+
if ((_b = (_a = uischema.options) === null || _a === void 0 ? void 0 : _a.text) === null || _b === void 0 ? void 0 : _b.trim()) {
|
|
7767
|
+
checkboxLabel = uischema.options.text.trim();
|
|
7768
|
+
} else if (uischema.scope && uischema.scope.startsWith('#/')) {
|
|
7769
|
+
const fallbackLabel = getLastSegmentFromPointer(uischema.scope);
|
|
7770
|
+
checkboxLabel = fallbackLabel.charAt(0).toUpperCase() + fallbackLabel.slice(1);
|
|
7771
|
+
}
|
|
7783
7772
|
if (((_c = uischema.options) === null || _c === void 0 ? void 0 : _c.radio) === true) {
|
|
7784
7773
|
reviewText = data ? `Yes` : `No`;
|
|
7785
7774
|
} else {
|
|
7786
|
-
reviewText = data ? `Yes (${checkboxLabel
|
|
7775
|
+
reviewText = data ? `Yes (${checkboxLabel})` : `No (${checkboxLabel})`;
|
|
7787
7776
|
}
|
|
7788
7777
|
}
|
|
7789
7778
|
if (isTime) {
|
|
@@ -7796,9 +7785,17 @@ const GoABaseInputReviewComponent = props => {
|
|
|
7796
7785
|
reviewText = jsx("ul", {
|
|
7797
7786
|
children: data.map((checkbox, index) => {
|
|
7798
7787
|
var _a, _b;
|
|
7799
|
-
|
|
7788
|
+
let checkboxLabel = '';
|
|
7789
|
+
// Use explicit text if provided, otherwise fall back to property name from scope
|
|
7790
|
+
if ((_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.text) === null || _b === void 0 ? void 0 : _b.trim()) {
|
|
7791
|
+
checkboxLabel = uischema.options.text.trim();
|
|
7792
|
+
} else if (uischema.scope && uischema.scope.startsWith('#/')) {
|
|
7793
|
+
const fallbackLabel = getLastSegmentFromPointer(uischema.scope);
|
|
7794
|
+
// Capitalize first letter only when falling back to property name from scope
|
|
7795
|
+
checkboxLabel = fallbackLabel.charAt(0).toUpperCase() + fallbackLabel.slice(1);
|
|
7796
|
+
}
|
|
7800
7797
|
return jsx("li", {
|
|
7801
|
-
children: checkbox.trim() || checkboxLabel
|
|
7798
|
+
children: checkbox.trim() || checkboxLabel
|
|
7802
7799
|
}, index);
|
|
7803
7800
|
})
|
|
7804
7801
|
});
|
|
@@ -7832,18 +7829,24 @@ const GoAInputBaseTableReview = props => {
|
|
|
7832
7829
|
enabled,
|
|
7833
7830
|
cells
|
|
7834
7831
|
} = props;
|
|
7835
|
-
const labelToUpdate =
|
|
7832
|
+
const labelToUpdate = label || '';
|
|
7836
7833
|
let reviewText = data;
|
|
7837
7834
|
const isBoolean = typeof data === 'boolean';
|
|
7838
7835
|
if (isBoolean) {
|
|
7839
|
-
|
|
7836
|
+
let checkboxLabel = '';
|
|
7837
|
+
if ((_b = (_a = uischema.options) === null || _a === void 0 ? void 0 : _a.text) === null || _b === void 0 ? void 0 : _b.trim()) {
|
|
7838
|
+
checkboxLabel = uischema.options.text.trim();
|
|
7839
|
+
} else if (uischema.scope && uischema.scope.startsWith('#/')) {
|
|
7840
|
+
const fallbackLabel = getLastSegmentFromPointer(uischema.scope);
|
|
7841
|
+
checkboxLabel = fallbackLabel.charAt(0).toUpperCase() + fallbackLabel.slice(1);
|
|
7842
|
+
}
|
|
7840
7843
|
if (((_c = uischema.options) === null || _c === void 0 ? void 0 : _c.radio) === true) {
|
|
7841
7844
|
reviewText = data ? `Yes` : `No`;
|
|
7842
7845
|
} else {
|
|
7843
7846
|
if (label !== '' || typeof label === 'boolean') {
|
|
7844
7847
|
reviewText = data ? `Yes` : `No`;
|
|
7845
7848
|
} else {
|
|
7846
|
-
reviewText = data ? `Yes (${checkboxLabel
|
|
7849
|
+
reviewText = data ? `Yes (${checkboxLabel})` : `No (${checkboxLabel})`;
|
|
7847
7850
|
}
|
|
7848
7851
|
}
|
|
7849
7852
|
}
|
|
@@ -9818,7 +9821,7 @@ const FileUploader = _ref => {
|
|
|
9818
9821
|
return jsx(Fragment, {});
|
|
9819
9822
|
}
|
|
9820
9823
|
const helpText = (_0 = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _0 === void 0 ? void 0 : _0.help;
|
|
9821
|
-
const sentenceCaseLabel =
|
|
9824
|
+
const sentenceCaseLabel = label;
|
|
9822
9825
|
const DownloadFileWidget = ({
|
|
9823
9826
|
index
|
|
9824
9827
|
}) => {
|
|
@@ -10599,7 +10602,7 @@ const NonEmptyCellComponent$1 = /*#__PURE__*/React.memo(function NonEmptyCellCom
|
|
|
10599
10602
|
if (!isInReview) {
|
|
10600
10603
|
return jsx("th", {
|
|
10601
10604
|
children: jsxs("p", {
|
|
10602
|
-
children: [(currentProperty === null || currentProperty === void 0 ? void 0 : currentProperty.title) ||
|
|
10605
|
+
children: [(currentProperty === null || currentProperty === void 0 ? void 0 : currentProperty.title) || index, (required === null || required === void 0 ? void 0 : required.includes(value)) && jsx(RequiredSpan, {
|
|
10603
10606
|
children: "(required)"
|
|
10604
10607
|
})]
|
|
10605
10608
|
})
|
|
@@ -10607,7 +10610,7 @@ const NonEmptyCellComponent$1 = /*#__PURE__*/React.memo(function NonEmptyCellCom
|
|
|
10607
10610
|
}
|
|
10608
10611
|
return jsx(TableTHHeader, {
|
|
10609
10612
|
children: jsxs("p", {
|
|
10610
|
-
children: [`${(currentProperty === null || currentProperty === void 0 ? void 0 : currentProperty.title) ||
|
|
10613
|
+
children: [`${(currentProperty === null || currentProperty === void 0 ? void 0 : currentProperty.title) || index}`, (required === null || required === void 0 ? void 0 : required.includes(value)) && jsxs(RequiredSpan, {
|
|
10611
10614
|
children: [jsx("br", {}), " (required)"]
|
|
10612
10615
|
})]
|
|
10613
10616
|
})
|
|
@@ -10678,7 +10681,7 @@ const NonEmptyCellComponent$1 = /*#__PURE__*/React.memo(function NonEmptyCellCom
|
|
|
10678
10681
|
error: !!(error === null || error === void 0 ? void 0 : error.message),
|
|
10679
10682
|
children: [!(required === null || required === void 0 ? void 0 : required.includes(schemaName)) && jsx(GoabDropdownItem, {
|
|
10680
10683
|
value: "",
|
|
10681
|
-
label: `-- Select ${
|
|
10684
|
+
label: `-- Select ${schemaName} --`
|
|
10682
10685
|
}), dataObject.enum.map(opt => jsx(GoabDropdownItem, {
|
|
10683
10686
|
value: String(opt),
|
|
10684
10687
|
label: String(opt)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abgov/jsonforms-components",
|
|
3
|
-
"version": "2.43.
|
|
3
|
+
"version": "2.43.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",
|