@remoteoss/json-schema-form 0.7.6-beta.0 → 0.8.0-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 CHANGED
@@ -1,3 +1,9 @@
1
+ #### 0.8.0-beta.0 (2024-02-01)
2
+
3
+ ##### Bug Fixes
4
+
5
+ * **fieldset:** Support customProperties with sub-fields clashing with reserved words. ([#64](https://github.com/remoteoss/json-schema-form/pull/64)) ([8340cdea](https://github.com/remoteoss/json-schema-form/commit/8340cdea27b711064079055af939a595d1c38031))
6
+
1
7
  #### 0.7.6-beta.0 (2024-01-23)
2
8
 
3
9
  ##### Chores
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.7.6-beta.0
5
- Generated: Tue, 23 Jan 2024 17:00:20 GMT
4
+ NPM Package: @remoteoss/json-schema-form@0.8.0-beta.0
5
+ Generated: Thu, 01 Feb 2024 09:12:18 GMT
6
6
 
7
7
  MIT License
8
8
 
@@ -1667,7 +1667,7 @@ function buildFieldParameters(name, fieldProperties, required = [], config = {},
1667
1667
  fields = getFieldsFromJSONSchema(
1668
1668
  fieldProperties,
1669
1669
  {
1670
- customProperties: (0, import_get3.default)(config, `customProperties.${name}`, {}),
1670
+ customProperties: (0, import_get3.default)(config, `customProperties.${name}.customProperties`, {}),
1671
1671
  parentID: name
1672
1672
  },
1673
1673
  logic
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.7.6-beta.0
5
- Generated: Tue, 23 Jan 2024 17:00:20 GMT
4
+ NPM Package: @remoteoss/json-schema-form@0.8.0-beta.0
5
+ Generated: Thu, 01 Feb 2024 09:12:18 GMT
6
6
 
7
7
  MIT License
8
8
 
@@ -1631,7 +1631,7 @@ function buildFieldParameters(name, fieldProperties, required = [], config = {},
1631
1631
  fields = getFieldsFromJSONSchema(
1632
1632
  fieldProperties,
1633
1633
  {
1634
- customProperties: get3(config, `customProperties.${name}`, {}),
1634
+ customProperties: get3(config, `customProperties.${name}.customProperties`, {}),
1635
1635
  parentID: name
1636
1636
  },
1637
1637
  logic
@@ -1,8 +1,8 @@
1
1
 
2
2
  /*!
3
3
  Copyright (c) 2024 Remote Technology, Inc.
4
- NPM Package: @remoteoss/json-schema-form@0.7.6-beta.0
5
- Generated: Tue, 23 Jan 2024 17:00:20 GMT
4
+ NPM Package: @remoteoss/json-schema-form@0.8.0-beta.0
5
+ Generated: Thu, 01 Feb 2024 09:12:18 GMT
6
6
 
7
7
  MIT License
8
8
 
@@ -12985,7 +12985,7 @@ function buildFieldParameters(name, fieldProperties, required2 = [], config = {}
12985
12985
  fields = getFieldsFromJSONSchema(
12986
12986
  fieldProperties,
12987
12987
  {
12988
- customProperties: (0, import_get4.default)(config, `customProperties.${name}`, {}),
12988
+ customProperties: (0, import_get4.default)(config, `customProperties.${name}.customProperties`, {}),
12989
12989
  parentID: name
12990
12990
  },
12991
12991
  logic
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remoteoss/json-schema-form",
3
- "version": "0.7.6-beta.0",
3
+ "version": "0.8.0-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",
@@ -358,14 +358,18 @@ describe('createHeadlessForm() - custom validations', () => {
358
358
  maximum: 28,
359
359
  },
360
360
  second_gen: {
361
- cub_age: {
362
- minimum: 18,
363
- maximum: 21,
364
- },
365
- third_gen: {
366
- grandcub_age: {
367
- minimum: 10,
368
- maximum: 15,
361
+ customProperties: {
362
+ cub_age: {
363
+ minimum: 18,
364
+ maximum: 21,
365
+ },
366
+ third_gen: {
367
+ customProperties: {
368
+ grandcub_age: {
369
+ minimum: 10,
370
+ maximum: 15,
371
+ },
372
+ },
369
373
  },
370
374
  },
371
375
  },
@@ -3677,11 +3677,17 @@ describe('createHeadlessForm', () => {
3677
3677
  customProperties: {
3678
3678
  id_number: { 'data-field': 'field' },
3679
3679
  fieldset: {
3680
- id_number: { 'data-fieldset': 'fieldset' },
3680
+ customProperties: {
3681
+ id_number: { 'data-fieldset': 'fieldset' },
3682
+ },
3681
3683
  },
3682
3684
  nestedFieldset: {
3683
- innerFieldset: {
3684
- id_number: { 'data-nested-fieldset': 'nested-fieldset' },
3685
+ customProperties: {
3686
+ innerFieldset: {
3687
+ customProperties: {
3688
+ id_number: { 'data-nested-fieldset': 'nested-fieldset' },
3689
+ },
3690
+ },
3685
3691
  },
3686
3692
  },
3687
3693
  },
@@ -3754,6 +3760,58 @@ describe('createHeadlessForm', () => {
3754
3760
  expect(nestedFieldsetResult.fields[0].fields[1]).not.toHaveProperty('data-field');
3755
3761
  expect(nestedFieldsetResult.fields[0].fields[1]).not.toHaveProperty('data-fieldset');
3756
3762
  });
3763
+ it('should handle custom properties when inside fieldsets for fields name clashing with reserved words', () => {
3764
+ const { fields } = createHeadlessForm(
3765
+ {
3766
+ properties: {
3767
+ dog: {
3768
+ title: 'Dog details',
3769
+ description: 'Fieldset description',
3770
+ 'x-jsf-presentation': {
3771
+ inputType: 'fieldset',
3772
+ },
3773
+ properties: {
3774
+ name: {
3775
+ // This fieldName (name) clashs with the field specs "name"
3776
+ title: 'Dogs name',
3777
+ 'x-jsf-presentation': {
3778
+ inputType: 'text',
3779
+ },
3780
+ type: 'string',
3781
+ },
3782
+ type: {
3783
+ // This field name (type) clashs with the field specs "type"
3784
+ title: 'Breed type',
3785
+ 'x-jsf-presentation': {
3786
+ inputType: 'number',
3787
+ },
3788
+ type: 'string',
3789
+ },
3790
+ },
3791
+ required: ['name'],
3792
+ type: 'object',
3793
+ },
3794
+ },
3795
+ required: ['dog'],
3796
+ },
3797
+ {
3798
+ customProperties: {
3799
+ dog: {
3800
+ customProperties: {
3801
+ name: {
3802
+ description: "What's your dogs name",
3803
+ },
3804
+ },
3805
+ },
3806
+ },
3807
+ }
3808
+ );
3809
+
3810
+ expect(fields.length).toBe(1);
3811
+ expect(fields[0].fields.length).toBe(2);
3812
+ expect(fields[0].fields[0].name).toBe('name');
3813
+ expect(fields[0].fields[0].description).toBe("What's your dogs name");
3814
+ });
3757
3815
  });
3758
3816
 
3759
3817
  describe('presentation (deprecated in favor of x-jsf-presentation)', () => {