@remoteoss/json-schema-form 0.11.7-dev.20241120081050 → 0.11.8-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 +8 -3
- package/dist/index.js +8 -3
- package/dist/standalone.js +8 -3
- package/package.json +1 -1
- package/src/tests/createHeadlessForm.test.js +40 -0
- package/src/tests/helpers.custom.js +1 -1
- package/src/tests/helpers.js +26 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
#### 0.11.8-beta.0 (2024-11-20)
|
|
2
|
+
|
|
3
|
+
##### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* **integer:** support integer field type ([#11](https://github.com/remoteoss/json-schema-form/pull/11)) ([14f34971](https://github.com/remoteoss/json-schema-form/commit/14f349714ce7b294ae710801168b017692c659af))
|
|
6
|
+
|
|
7
|
+
#### 0.11.7-beta.0 (2024-11-14)
|
|
8
|
+
|
|
9
|
+
##### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **validation:** validate radio with string-y types; ([#94](https://github.com/remoteoss/json-schema-form/pull/94)) ([606913d8](https://github.com/remoteoss/json-schema-form/commit/606913d8412a02d9a38a43e903add58b8e11a7e4))
|
|
12
|
+
|
|
1
13
|
#### 0.11.6-beta.0 (2024-10-15)
|
|
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.11.
|
|
5
|
-
Generated: Wed, 20 Nov 2024
|
|
4
|
+
NPM Package: @remoteoss/json-schema-form@0.11.8-beta.0
|
|
5
|
+
Generated: Wed, 20 Nov 2024 13:34:29 GMT
|
|
6
6
|
|
|
7
7
|
MIT License
|
|
8
8
|
|
|
@@ -481,7 +481,12 @@ var yupSchemas = {
|
|
|
481
481
|
}).test(
|
|
482
482
|
"matchesOptionOrPattern",
|
|
483
483
|
({ value }) => `The option ${JSON.stringify(value)} is not valid.`,
|
|
484
|
-
(
|
|
484
|
+
(castValue, { originalValue }) => {
|
|
485
|
+
if (castValue !== void 0 && typeof originalValue !== "string") {
|
|
486
|
+
return false;
|
|
487
|
+
}
|
|
488
|
+
return validateRadioOrSelectOptions(castValue, options);
|
|
489
|
+
}
|
|
485
490
|
);
|
|
486
491
|
},
|
|
487
492
|
date: ({ minDate, maxDate }) => {
|
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.11.
|
|
5
|
-
Generated: Wed, 20 Nov 2024
|
|
4
|
+
NPM Package: @remoteoss/json-schema-form@0.11.8-beta.0
|
|
5
|
+
Generated: Wed, 20 Nov 2024 13:34:29 GMT
|
|
6
6
|
|
|
7
7
|
MIT License
|
|
8
8
|
|
|
@@ -444,7 +444,12 @@ var yupSchemas = {
|
|
|
444
444
|
}).test(
|
|
445
445
|
"matchesOptionOrPattern",
|
|
446
446
|
({ value }) => `The option ${JSON.stringify(value)} is not valid.`,
|
|
447
|
-
(
|
|
447
|
+
(castValue, { originalValue }) => {
|
|
448
|
+
if (castValue !== void 0 && typeof originalValue !== "string") {
|
|
449
|
+
return false;
|
|
450
|
+
}
|
|
451
|
+
return validateRadioOrSelectOptions(castValue, options);
|
|
452
|
+
}
|
|
448
453
|
);
|
|
449
454
|
},
|
|
450
455
|
date: ({ minDate, maxDate }) => {
|
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.11.
|
|
5
|
-
Generated: Wed, 20 Nov 2024
|
|
4
|
+
NPM Package: @remoteoss/json-schema-form@0.11.8-beta.0
|
|
5
|
+
Generated: Wed, 20 Nov 2024 13:34:29 GMT
|
|
6
6
|
|
|
7
7
|
MIT License
|
|
8
8
|
|
|
@@ -11960,7 +11960,12 @@ var yupSchemas = {
|
|
|
11960
11960
|
}).test(
|
|
11961
11961
|
"matchesOptionOrPattern",
|
|
11962
11962
|
({ value }) => `The option ${JSON.stringify(value)} is not valid.`,
|
|
11963
|
-
(
|
|
11963
|
+
(castValue, { originalValue }) => {
|
|
11964
|
+
if (castValue !== void 0 && typeof originalValue !== "string") {
|
|
11965
|
+
return false;
|
|
11966
|
+
}
|
|
11967
|
+
return validateRadioOrSelectOptions(castValue, options);
|
|
11968
|
+
}
|
|
11964
11969
|
);
|
|
11965
11970
|
},
|
|
11966
11971
|
date: ({ minDate, maxDate }) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remoteoss/json-schema-form",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.8-beta.0",
|
|
4
4
|
"description": "Headless UI form powered by JSON Schemas",
|
|
5
5
|
"author": "Remote.com <engineering@remote.com> (https://remote.com/)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
schemaInputTypeText,
|
|
10
10
|
schemaInputTypeRadioDeprecated,
|
|
11
11
|
schemaInputTypeRadioString,
|
|
12
|
+
schemaInputTypeRadioStringY,
|
|
12
13
|
schemaInputTypeRadioBoolean,
|
|
13
14
|
schemaInputTypeRadioNumber,
|
|
14
15
|
schemaInputTypeRadioRequiredAndOptional,
|
|
@@ -821,6 +822,45 @@ describe('createHeadlessForm', () => {
|
|
|
821
822
|
});
|
|
822
823
|
});
|
|
823
824
|
|
|
825
|
+
// @BUG COD-1859
|
|
826
|
+
// it should validate when type is string but value is not a boolean
|
|
827
|
+
it('support "radio" field string-y type', () => {
|
|
828
|
+
const { fields, handleValidation } = createHeadlessForm(schemaInputTypeRadioStringY);
|
|
829
|
+
|
|
830
|
+
const validateForm = (vals) => friendlyError(handleValidation(vals));
|
|
831
|
+
|
|
832
|
+
expect(fields).toMatchObject([
|
|
833
|
+
{
|
|
834
|
+
description: 'Do you have any siblings?',
|
|
835
|
+
label: 'Has siblings',
|
|
836
|
+
name: 'has_siblings',
|
|
837
|
+
options: [
|
|
838
|
+
{
|
|
839
|
+
label: 'Yes',
|
|
840
|
+
value: 'true',
|
|
841
|
+
},
|
|
842
|
+
{
|
|
843
|
+
label: 'No',
|
|
844
|
+
value: 'false',
|
|
845
|
+
},
|
|
846
|
+
],
|
|
847
|
+
required: true,
|
|
848
|
+
schema: expect.any(Object),
|
|
849
|
+
type: 'radio',
|
|
850
|
+
},
|
|
851
|
+
]);
|
|
852
|
+
|
|
853
|
+
assertOptionsAllowed({
|
|
854
|
+
handleValidation,
|
|
855
|
+
fieldName: 'has_siblings',
|
|
856
|
+
validOptions: ['true', 'false'],
|
|
857
|
+
});
|
|
858
|
+
|
|
859
|
+
expect(validateForm({ has_siblings: false })).toEqual({
|
|
860
|
+
has_siblings: 'The option "false" is not valid.',
|
|
861
|
+
});
|
|
862
|
+
});
|
|
863
|
+
|
|
824
864
|
it('support "radio" field number type', () => {
|
|
825
865
|
const { fields, handleValidation } = createHeadlessForm(schemaInputTypeRadioNumber);
|
|
826
866
|
|
package/src/tests/helpers.js
CHANGED
|
@@ -163,6 +163,25 @@ export const mockRadioInputBoolean = {
|
|
|
163
163
|
type: 'boolean',
|
|
164
164
|
};
|
|
165
165
|
|
|
166
|
+
export const mockRadioInputStringY = {
|
|
167
|
+
title: 'Has siblings',
|
|
168
|
+
description: 'Do you have any siblings?',
|
|
169
|
+
oneOf: [
|
|
170
|
+
{
|
|
171
|
+
title: 'Yes',
|
|
172
|
+
const: 'true',
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
title: 'No',
|
|
176
|
+
const: 'false',
|
|
177
|
+
},
|
|
178
|
+
],
|
|
179
|
+
'x-jsf-presentation': {
|
|
180
|
+
inputType: 'radio',
|
|
181
|
+
},
|
|
182
|
+
type: 'string',
|
|
183
|
+
};
|
|
184
|
+
|
|
166
185
|
export const mockRadioInputNumber = {
|
|
167
186
|
title: 'Number of siblings',
|
|
168
187
|
description: 'How many siblings do you have?',
|
|
@@ -914,6 +933,13 @@ export const schemaInputTypeRadioString = {
|
|
|
914
933
|
required: ['has_siblings'],
|
|
915
934
|
};
|
|
916
935
|
|
|
936
|
+
export const schemaInputTypeRadioStringY = {
|
|
937
|
+
properties: {
|
|
938
|
+
has_siblings: mockRadioInputStringY,
|
|
939
|
+
},
|
|
940
|
+
required: ['has_siblings'],
|
|
941
|
+
};
|
|
942
|
+
|
|
917
943
|
export const schemaInputTypeRadioBoolean = {
|
|
918
944
|
properties: {
|
|
919
945
|
over_18: mockRadioInputBoolean,
|