@remoteoss/json-schema-form 0.11.11-beta.0 → 0.11.11-dev.20250220164730
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 +0 -6
- package/dist/index.cjs +2 -2
- package/dist/index.js +2 -2
- package/dist/standalone.js +2 -2
- package/package.json +1 -1
- package/src/tests/conditions.test.js +59 -31
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
#### 0.11.11-beta.0 (2025-02-20)
|
|
2
|
-
|
|
3
|
-
##### Bug Fixes
|
|
4
|
-
|
|
5
|
-
* **conditionals:** Add support to `oneOf` ([#136](https://github.com/remoteoss/json-schema-form/pull/136)) ([966cec59](https://github.com/remoteoss/json-schema-form/commit/966cec595ed2a1ff35f9d15e22acaea16cdd5113))
|
|
6
|
-
|
|
7
1
|
#### 0.11.10-beta.0 (2025-01-22)
|
|
8
2
|
|
|
9
3
|
##### Bug Fixes
|
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
/*!
|
|
3
3
|
Copyright (c) 2025 Remote Technology, Inc.
|
|
4
|
-
NPM Package: @remoteoss/json-schema-form@0.11.11-
|
|
5
|
-
Generated: Thu, 20 Feb 2025
|
|
4
|
+
NPM Package: @remoteoss/json-schema-form@0.11.11-dev.20250220164730
|
|
5
|
+
Generated: Thu, 20 Feb 2025 16:47:52 GMT
|
|
6
6
|
|
|
7
7
|
MIT License
|
|
8
8
|
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
/*!
|
|
3
3
|
Copyright (c) 2025 Remote Technology, Inc.
|
|
4
|
-
NPM Package: @remoteoss/json-schema-form@0.11.11-
|
|
5
|
-
Generated: Thu, 20 Feb 2025
|
|
4
|
+
NPM Package: @remoteoss/json-schema-form@0.11.11-dev.20250220164730
|
|
5
|
+
Generated: Thu, 20 Feb 2025 16:47:52 GMT
|
|
6
6
|
|
|
7
7
|
MIT License
|
|
8
8
|
|
package/dist/standalone.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
/*!
|
|
3
3
|
Copyright (c) 2025 Remote Technology, Inc.
|
|
4
|
-
NPM Package: @remoteoss/json-schema-form@0.11.11-
|
|
5
|
-
Generated: Thu, 20 Feb 2025
|
|
4
|
+
NPM Package: @remoteoss/json-schema-form@0.11.11-dev.20250220164730
|
|
5
|
+
Generated: Thu, 20 Feb 2025 16:47:52 GMT
|
|
6
6
|
|
|
7
7
|
MIT License
|
|
8
8
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remoteoss/json-schema-form",
|
|
3
|
-
"version": "0.11.11-
|
|
3
|
+
"version": "0.11.11-dev.20250220164730",
|
|
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",
|
|
@@ -549,49 +549,77 @@ describe('Conditional with literal booleans', () => {
|
|
|
549
549
|
});
|
|
550
550
|
|
|
551
551
|
describe('Conditional with anyOf', () => {
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
type: 'object',
|
|
555
|
-
properties: {
|
|
556
|
-
field_a: { type: 'string' },
|
|
557
|
-
field_b: { type: 'string' },
|
|
558
|
-
field_c: { type: 'string' },
|
|
559
|
-
},
|
|
560
|
-
allOf: [
|
|
552
|
+
it('handles true case', () => {
|
|
553
|
+
const { fields, handleValidation } = createHeadlessForm(
|
|
561
554
|
{
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
then: {
|
|
569
|
-
required: ['field_c'],
|
|
555
|
+
additionalProperties: false,
|
|
556
|
+
type: 'object',
|
|
557
|
+
properties: {
|
|
558
|
+
field_a: { type: 'string' },
|
|
559
|
+
field_b: { type: 'string' },
|
|
560
|
+
field_c: { type: 'string' },
|
|
570
561
|
},
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
562
|
+
allOf: [
|
|
563
|
+
{
|
|
564
|
+
if: {
|
|
565
|
+
anyOf: [
|
|
566
|
+
{ properties: { field_a: { const: '1' } }, required: ['a'] },
|
|
567
|
+
{ properties: { field_b: { const: '2' } }, required: ['b'] },
|
|
568
|
+
],
|
|
569
|
+
},
|
|
570
|
+
then: {
|
|
571
|
+
required: ['field_c'],
|
|
572
|
+
},
|
|
573
|
+
else: {
|
|
574
|
+
properties: {
|
|
575
|
+
field_c: false,
|
|
576
|
+
},
|
|
577
|
+
},
|
|
574
578
|
},
|
|
575
|
-
|
|
579
|
+
],
|
|
576
580
|
},
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
it('handles true case', () => {
|
|
581
|
-
const { fields, handleValidation } = createHeadlessForm(schema, { strictInputType: false });
|
|
581
|
+
{ strictInputType: false }
|
|
582
|
+
);
|
|
582
583
|
|
|
583
|
-
expect(
|
|
584
|
-
expect(handleValidation({ field_a: 'x', field_b: '2' }).formErrors).toEqual({
|
|
584
|
+
expect(handleValidation({ field_a: '4', field_b: '2' }).formErrors).toEqual({
|
|
585
585
|
field_c: 'Required field',
|
|
586
586
|
});
|
|
587
587
|
expect(fields[2].isVisible).toBe(true);
|
|
588
588
|
});
|
|
589
589
|
|
|
590
590
|
it('handles false case', () => {
|
|
591
|
-
const { fields, handleValidation } = createHeadlessForm(
|
|
591
|
+
const { fields, handleValidation } = createHeadlessForm(
|
|
592
|
+
{
|
|
593
|
+
additionalProperties: false,
|
|
594
|
+
type: 'object',
|
|
595
|
+
properties: {
|
|
596
|
+
field_a: { type: 'string' },
|
|
597
|
+
field_b: { type: 'string' },
|
|
598
|
+
field_c: { type: 'string' },
|
|
599
|
+
},
|
|
600
|
+
allOf: [
|
|
601
|
+
{
|
|
602
|
+
if: {
|
|
603
|
+
anyOf: [
|
|
604
|
+
{ properties: { field_a: { const: '1' } }, required: ['a'] },
|
|
605
|
+
{ properties: { field_b: { const: '2' } }, required: ['b'] },
|
|
606
|
+
],
|
|
607
|
+
},
|
|
608
|
+
then: {
|
|
609
|
+
required: ['field_c'],
|
|
610
|
+
},
|
|
611
|
+
else: {
|
|
612
|
+
properties: {
|
|
613
|
+
field_c: false,
|
|
614
|
+
},
|
|
615
|
+
},
|
|
616
|
+
},
|
|
617
|
+
],
|
|
618
|
+
},
|
|
619
|
+
{ strictInputType: false }
|
|
620
|
+
);
|
|
592
621
|
|
|
593
|
-
expect(
|
|
594
|
-
expect(handleValidation({ field_a: 'x', field_b: 'x' }).formErrors).toBeUndefined();
|
|
622
|
+
expect(handleValidation({ field_a: '4', field_b: '4' }).formErrors).toBeUndefined();
|
|
595
623
|
expect(fields[2].isVisible).toBe(false);
|
|
596
624
|
});
|
|
597
625
|
});
|