@remoteoss/json-schema-form 0.8.1-dev.20240208092217 → 0.8.2-beta.0
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/CHANGELOG.md +12 -0
- package/dist/index.cjs +4 -4
- package/dist/index.js +4 -4
- package/dist/standalone.js +4 -4
- package/package.json +1 -1
- package/src/tests/createHeadlessForm.test.js +10 -0
- package/src/tests/helpers.js +12 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
#### 0.8.2-beta.0 (2024-02-13)
|
|
2
|
+
|
|
3
|
+
##### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* **helpers:** getFieldOptions - return empty array if oneOf missing in radio ([#67](https://github.com/remoteoss/json-schema-form/pull/67)) ([6511330f](https://github.com/remoteoss/json-schema-form/commit/6511330f55a2accedb1c58a61ff915a3a0186dbb))
|
|
6
|
+
|
|
7
|
+
#### 0.8.1-beta.0 (2024-02-12)
|
|
8
|
+
|
|
9
|
+
##### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **conditionals:** Certain conditions in a JSON schema were failing. This bugfix adds missing field context to the evaluation to prevent the error. ([#65](https://github.com/remoteoss/json-schema-form/pull/65)) ([6755a2fd](https://github.com/remoteoss/json-schema-form/commit/6755a2fd29f3f806a57ba19e29ad7e21daf9e51b))
|
|
12
|
+
|
|
1
13
|
#### 0.8.0-beta.0 (2024-02-01)
|
|
2
14
|
|
|
3
15
|
##### Bug Fixes
|
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
/*!
|
|
3
3
|
Copyright (c) 2024 Remote Technology, Inc.
|
|
4
|
-
NPM Package: @remoteoss/json-schema-form@0.8.
|
|
5
|
-
Generated:
|
|
4
|
+
NPM Package: @remoteoss/json-schema-form@0.8.2-beta.0
|
|
5
|
+
Generated: Tue, 13 Feb 2024 11:25:15 GMT
|
|
6
6
|
|
|
7
7
|
MIT License
|
|
8
8
|
|
|
@@ -1361,8 +1361,8 @@ function getFieldOptions(node, presentation) {
|
|
|
1361
1361
|
if (presentation.options) {
|
|
1362
1362
|
return presentation.options;
|
|
1363
1363
|
}
|
|
1364
|
-
if (node.oneOf) {
|
|
1365
|
-
return convertToOptions(node.oneOf);
|
|
1364
|
+
if (node.oneOf || presentation.inputType === "radio") {
|
|
1365
|
+
return convertToOptions(node.oneOf || []);
|
|
1366
1366
|
}
|
|
1367
1367
|
if (node.items?.anyOf) {
|
|
1368
1368
|
return convertToOptions(node.items.anyOf);
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
/*!
|
|
3
3
|
Copyright (c) 2024 Remote Technology, Inc.
|
|
4
|
-
NPM Package: @remoteoss/json-schema-form@0.8.
|
|
5
|
-
Generated:
|
|
4
|
+
NPM Package: @remoteoss/json-schema-form@0.8.2-beta.0
|
|
5
|
+
Generated: Tue, 13 Feb 2024 11:25:15 GMT
|
|
6
6
|
|
|
7
7
|
MIT License
|
|
8
8
|
|
|
@@ -1325,8 +1325,8 @@ function getFieldOptions(node, presentation) {
|
|
|
1325
1325
|
if (presentation.options) {
|
|
1326
1326
|
return presentation.options;
|
|
1327
1327
|
}
|
|
1328
|
-
if (node.oneOf) {
|
|
1329
|
-
return convertToOptions(node.oneOf);
|
|
1328
|
+
if (node.oneOf || presentation.inputType === "radio") {
|
|
1329
|
+
return convertToOptions(node.oneOf || []);
|
|
1330
1330
|
}
|
|
1331
1331
|
if (node.items?.anyOf) {
|
|
1332
1332
|
return convertToOptions(node.items.anyOf);
|
package/dist/standalone.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
/*!
|
|
3
3
|
Copyright (c) 2024 Remote Technology, Inc.
|
|
4
|
-
NPM Package: @remoteoss/json-schema-form@0.8.
|
|
5
|
-
Generated:
|
|
4
|
+
NPM Package: @remoteoss/json-schema-form@0.8.2-beta.0
|
|
5
|
+
Generated: Tue, 13 Feb 2024 11:25:15 GMT
|
|
6
6
|
|
|
7
7
|
MIT License
|
|
8
8
|
|
|
@@ -12679,8 +12679,8 @@ function getFieldOptions(node, presentation) {
|
|
|
12679
12679
|
if (presentation.options) {
|
|
12680
12680
|
return presentation.options;
|
|
12681
12681
|
}
|
|
12682
|
-
if (node.oneOf) {
|
|
12683
|
-
return convertToOptions(node.oneOf);
|
|
12682
|
+
if (node.oneOf || presentation.inputType === "radio") {
|
|
12683
|
+
return convertToOptions(node.oneOf || []);
|
|
12684
12684
|
}
|
|
12685
12685
|
if (node.items?.anyOf) {
|
|
12686
12686
|
return convertToOptions(node.items.anyOf);
|
package/package.json
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
schemaInputRadioOptionalNull,
|
|
14
14
|
schemaInputRadioOptionalConventional,
|
|
15
15
|
schemaInputTypeRadioOptionsWithDetails,
|
|
16
|
+
schemaInputTypeRadioWithoutOptions,
|
|
16
17
|
schemaInputTypeSelectSoloDeprecated,
|
|
17
18
|
schemaInputTypeSelectSolo,
|
|
18
19
|
schemaInputTypeSelectMultipleDeprecated,
|
|
@@ -902,6 +903,15 @@ describe('createHeadlessForm', () => {
|
|
|
902
903
|
]);
|
|
903
904
|
});
|
|
904
905
|
|
|
906
|
+
it('support "radio" field type without oneOf options', () => {
|
|
907
|
+
const result = createHeadlessForm(schemaInputTypeRadioWithoutOptions);
|
|
908
|
+
|
|
909
|
+
expect(result.fields).toHaveLength(1);
|
|
910
|
+
|
|
911
|
+
const fieldOptions = result.fields[0].options;
|
|
912
|
+
expect(fieldOptions).toEqual([]);
|
|
913
|
+
});
|
|
914
|
+
|
|
905
915
|
it('support "number" field type', () => {
|
|
906
916
|
const result = createHeadlessForm(schemaInputTypeNumber);
|
|
907
917
|
expect(result).toMatchObject({
|
package/src/tests/helpers.js
CHANGED
|
@@ -923,6 +923,18 @@ export const schemaInputTypeRadioOptionsWithDetails = {
|
|
|
923
923
|
},
|
|
924
924
|
};
|
|
925
925
|
|
|
926
|
+
export const schemaInputTypeRadioWithoutOptions = {
|
|
927
|
+
properties: {
|
|
928
|
+
health_perks: {
|
|
929
|
+
title: 'Health perks',
|
|
930
|
+
description:
|
|
931
|
+
'This example contains options with more custom details, under the x-jsf-presentation key',
|
|
932
|
+
'x-jsf-presentation': { inputType: 'radio' },
|
|
933
|
+
type: 'string',
|
|
934
|
+
},
|
|
935
|
+
},
|
|
936
|
+
};
|
|
937
|
+
|
|
926
938
|
/** @deprecated */
|
|
927
939
|
export const schemaInputTypeSelectSoloDeprecated = JSONSchemaBuilder()
|
|
928
940
|
.addInput({
|