@remoteoss/json-schema-form 0.7.3-beta.0 → 0.7.4-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,14 +1,20 @@
1
+ #### 0.7.4-beta.0 (2023-11-07)
2
+
3
+ ##### Chores
4
+
5
+ - Follow-up of #57. Ignore internal attributes from conditional attributes removal ([#58](https://github.com/remoteoss/json-schema-form/pull/58)) ([ee762c2e](https://github.com/remoteoss/json-schema-form/commit/ee762c2e90834a9ec0d7b88af47cefe1e3a03dd1))
6
+
1
7
  #### 0.7.3-beta.0 (2023-11-07)
2
8
 
3
9
  ##### Bug Fixes
4
10
 
5
- * Remove conditional attributes after the condition is unmatched ([#57](https://github.com/remoteoss/json-schema-form/pull/57)) ([8bac7145](https://github.com/remoteoss/json-schema-form/commit/8bac7145dfdd4136c0613044389666a614eb12f7))
11
+ - Remove conditional attributes after the condition is unmatched ([#57](https://github.com/remoteoss/json-schema-form/pull/57)) ([8bac7145](https://github.com/remoteoss/json-schema-form/commit/8bac7145dfdd4136c0613044389666a614eb12f7))
6
12
 
7
13
  #### 0.7.2-beta.0 (2023-11-06)
8
14
 
9
15
  ##### Bug Fixes
10
16
 
11
- * **select/radio:** Support oneOf[].pattern validation ([#47](https://github.com/remoteoss/json-schema-form/pull/47)) ([5a4bb592](https://github.com/remoteoss/json-schema-form/commit/5a4bb59266ff595a9cb65f5b261a4ae2f3ad279f))
17
+ - **select/radio:** Support oneOf[].pattern validation ([#47](https://github.com/remoteoss/json-schema-form/pull/47)) ([5a4bb592](https://github.com/remoteoss/json-schema-form/commit/5a4bb59266ff595a9cb65f5b261a4ae2f3ad279f))
12
18
 
13
19
  #### 0.7.1-beta.0 (2023-10-31)
14
20
 
package/dist/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
 
2
2
  /*!
3
3
  Copyright (c) 2023 Remote Technology, Inc.
4
- NPM Package: @remoteoss/json-schema-form@0.7.3-beta.0
5
- Generated: Tue, 07 Nov 2023 09:29:14 GMT
4
+ NPM Package: @remoteoss/json-schema-form@0.7.4-beta.0
5
+ Generated: Tue, 07 Nov 2023 14:43:48 GMT
6
6
 
7
7
  MIT License
8
8
 
@@ -1074,8 +1074,11 @@ var dynamicInternalJsfAttrs = [
1074
1074
  // driven from conditionals
1075
1075
  "calculateCustomValidationProperties",
1076
1076
  // To be deprecated in favor of json-logic
1077
- "scopedJsonSchema"
1077
+ "scopedJsonSchema",
1078
1078
  // The respective JSON Schema
1079
+ // HOTFIX/TODO Internal customizations, check test conditions.test.js for more info.
1080
+ "Component",
1081
+ "calculateDynamicProperties"
1079
1082
  ];
1080
1083
  var dynamicInternalJsfAttrsObj = Object.fromEntries(
1081
1084
  dynamicInternalJsfAttrs.map((k) => [k, true])
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
 
2
2
  /*!
3
3
  Copyright (c) 2023 Remote Technology, Inc.
4
- NPM Package: @remoteoss/json-schema-form@0.7.3-beta.0
5
- Generated: Tue, 07 Nov 2023 09:29:14 GMT
4
+ NPM Package: @remoteoss/json-schema-form@0.7.4-beta.0
5
+ Generated: Tue, 07 Nov 2023 14:43:48 GMT
6
6
 
7
7
  MIT License
8
8
 
@@ -1038,8 +1038,11 @@ var dynamicInternalJsfAttrs = [
1038
1038
  // driven from conditionals
1039
1039
  "calculateCustomValidationProperties",
1040
1040
  // To be deprecated in favor of json-logic
1041
- "scopedJsonSchema"
1041
+ "scopedJsonSchema",
1042
1042
  // The respective JSON Schema
1043
+ // HOTFIX/TODO Internal customizations, check test conditions.test.js for more info.
1044
+ "Component",
1045
+ "calculateDynamicProperties"
1043
1046
  ];
1044
1047
  var dynamicInternalJsfAttrsObj = Object.fromEntries(
1045
1048
  dynamicInternalJsfAttrs.map((k) => [k, true])
@@ -1,8 +1,8 @@
1
1
 
2
2
  /*!
3
3
  Copyright (c) 2023 Remote Technology, Inc.
4
- NPM Package: @remoteoss/json-schema-form@0.7.3-beta.0
5
- Generated: Tue, 07 Nov 2023 09:29:14 GMT
4
+ NPM Package: @remoteoss/json-schema-form@0.7.4-beta.0
5
+ Generated: Tue, 07 Nov 2023 14:43:48 GMT
6
6
 
7
7
  MIT License
8
8
 
@@ -12392,8 +12392,11 @@ var dynamicInternalJsfAttrs = [
12392
12392
  // driven from conditionals
12393
12393
  "calculateCustomValidationProperties",
12394
12394
  // To be deprecated in favor of json-logic
12395
- "scopedJsonSchema"
12395
+ "scopedJsonSchema",
12396
12396
  // The respective JSON Schema
12397
+ // HOTFIX/TODO Internal customizations, check test conditions.test.js for more info.
12398
+ "Component",
12399
+ "calculateDynamicProperties"
12397
12400
  ];
12398
12401
  var dynamicInternalJsfAttrsObj = Object.fromEntries(
12399
12402
  dynamicInternalJsfAttrs.map((k) => [k, true])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remoteoss/json-schema-form",
3
- "version": "0.7.3-beta.0",
3
+ "version": "0.7.4-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,4 +358,62 @@ describe('Conditional attributes updated', () => {
358
358
  ],
359
359
  });
360
360
  });
361
+
362
+ it('Keeps custom attribute Component (fieldAttrsFromJsf) (hotfix temporary)', () => {
363
+ // This is necessary as hotfix because we (Remote) use it internally.
364
+ // Not cool, we'll need a better solution asap.
365
+ const { fields, handleValidation } = createHeadlessForm(
366
+ {
367
+ properties: {
368
+ is_full_time: { type: 'string', oneOf: [{ const: 'yes' }, { const: 'no' }] },
369
+ salary_period: {
370
+ type: 'string',
371
+ title: 'Salary period',
372
+ oneOf: [
373
+ { title: 'Weekly', const: 'weekly' },
374
+ { title: 'Monthly', const: 'monthly' },
375
+ ],
376
+ },
377
+ },
378
+ allOf: [
379
+ {
380
+ if: {
381
+ properties: { is_full_time: { const: 'yes' } },
382
+ required: ['is_full_time'],
383
+ },
384
+ then: {
385
+ properties: {
386
+ salary_period: {
387
+ description: 'We recommend montlhy.',
388
+ },
389
+ },
390
+ },
391
+ },
392
+ ],
393
+ },
394
+ {
395
+ strictInputType: false,
396
+ customProperties: {
397
+ salary_period: {
398
+ Component: '<A React Component>',
399
+ calculateDynamicProperties: () => true,
400
+ },
401
+ },
402
+ }
403
+ );
404
+
405
+ // It's there by default
406
+ expect(fields[1].Component).toBe('<A React Component>');
407
+ expect(fields[1].calculateDynamicProperties).toEqual(expect.any(Function));
408
+
409
+ // Given "Yes", it stays there too.
410
+ handleValidation({ is_full_time: 'yes' });
411
+ expect(fields[1].Component).toBe('<A React Component>');
412
+ expect(fields[1].calculateDynamicProperties).toEqual(expect.any(Function));
413
+
414
+ // Given "No", it stays there too.
415
+ handleValidation({ is_full_time: 'no' });
416
+ expect(fields[1].Component).toBe('<A React Component>');
417
+ expect(fields[1].calculateDynamicProperties).toEqual(expect.any(Function));
418
+ });
361
419
  });