@remoteoss/json-schema-form 0.7.1-dev.20231026204916 → 0.7.2-dev.20231106093837

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.7.1-beta.0 (2023-10-31)
2
+
3
+ ##### Bug Fixes
4
+
5
+ - **select:** support string type ([#54](https://github.com/remoteoss/json-schema-form/pull/54)) ([b00f8776](https://github.com/remoteoss/json-schema-form/commit/b00f8776aa244803375ba64fbdd52c8fff9b9bd8))
6
+
1
7
  #### 0.7.0-beta.0 (2023-10-23)
2
8
 
3
9
  ##### Chores
@@ -27,10 +33,8 @@ BREAKING CHANGES:
27
33
 
28
34
  - json-logic: Add conditional logic checking. ([#41](https://github.com/remoteoss/json-schema-form/pull/41)) ([6292b01e](https://github.com/remoteoss/json-schema-form/commit/6292b01e3f77a9038328d7375080ffc4cb30dbc8))
29
35
 
30
-
31
36
  ###### Full API additions now supported from 0.6.5 onwards.
32
37
 
33
-
34
38
  - New custom JSON Schema keyword `x-jsf-logic` added to support cross-field validations. Built on top of [JsonLogic](https://jsonlogic.com/).
35
39
 
36
40
  - `x-jsf-logic` can contain:
@@ -49,16 +53,11 @@ While docs are underway, you can read examples from all the [tests](https://gith
49
53
 
50
54
  In short: `x-jsf-logic` is added to support complex conditional cross-field validations. Properties like `x-jsf-logic-validations` allow hooking those up to individual fields.
51
55
 
52
-
53
56
  #### 0.6.4-beta.0 (2023-09-15)
54
57
 
55
-
56
-
57
58
  ##### Changes
58
- - json-logic: computedAttrs - handle inline rules ([#40](https://github.com/remoteoss/json-schema-form/pull/40)) ([860ad91b](https://github.com/remoteoss/json-schema-form/commit/860ad91b034ab35d4d4bc51c0c04675f102bf278))
59
-
60
-
61
59
 
60
+ - json-logic: computedAttrs - handle inline rules ([#40](https://github.com/remoteoss/json-schema-form/pull/40)) ([860ad91b](https://github.com/remoteoss/json-schema-form/commit/860ad91b034ab35d4d4bc51c0c04675f102bf278))
62
61
 
63
62
  #### 0.6.1-beta.0 (2023-09-13)
64
63
 
@@ -66,50 +65,43 @@ In short: `x-jsf-logic` is added to support complex conditional cross-field vali
66
65
 
67
66
  - json-logic: Computed string based values ([#37](https://github.com/remoteoss/json-schema-form/pull/37)) ([6e042ea5](https://github.com/remoteoss/json-schema-form/commit/6e042ea579497ea573710c307a6ff7ee2f19b931))
68
67
 
69
-
70
-
71
-
72
68
  #### 0.5.0-beta.0 (2023-09-12)
73
69
 
74
70
  ##### Changes
71
+
75
72
  - json-logic: Computed Attributes ([#36](https://github.com/remoteoss/json-schema-form/pull/36)) ([80c29589](https://github.com/remoteoss/json-schema-form/commit/80c29589ac0972e0f33add70a59df15a46db1b43))
76
73
  - json-logic: Initial skeleton implementation ([#35](https://github.com/remoteoss/json-schema-form/pull/35)) ([63149ae8](https://github.com/remoteoss/json-schema-form/commit/63149ae863cf1b5ad76a3b2a49c7f343e55ce07b))
77
74
 
78
-
79
-
80
-
81
75
  #### 0.4.5-beta.0 (2023-08-31)
76
+
82
77
  ##### Bug fixes
83
78
 
84
79
  - Validate values based on `const` key ([#34](https://github.com/remoteoss/json-schema-form/pull/34)) ([bf07870d](https://github.com/remoteoss/json-schema-form/commit/bf07870d407d9b9b078882a078b9e4c7928df868))
85
80
 
86
-
87
-
88
-
89
81
  #### 0.4.4-beta.0 (2023-08-30)
90
82
 
91
83
  ##### Chores
92
84
 
93
- * **fieldset:** ignore values not matching the field type ([#44](https://github.com/remoteoss/json-schema-form/pull/44)) ([f0af54e5](https://github.com/remoteoss/json-schema-form/commit/f0af54e5d425fb78524ab150bb31629d00369a61))
85
+ - **fieldset:** ignore values not matching the field type ([#44](https://github.com/remoteoss/json-schema-form/pull/44)) ([f0af54e5](https://github.com/remoteoss/json-schema-form/commit/f0af54e5d425fb78524ab150bb31629d00369a61))
94
86
 
95
87
  #### 0.4.3-beta.0 (2023-08-09)
96
88
 
97
89
  ##### Bug fixes
98
90
 
99
- * **conditions:** Validate a deeply nested if (e.g. checking an object with a number property) in an if property now doesn't break the form. ([#33](https://github.com/remoteoss/json-schema-form/pull/33)) ([e34cfcc](https://github.com/remoteoss/json-schema-form/commit/e34cfccaf45f1460b346f3cff0c797b3d11259e3))
91
+ - **conditions:** Validate a deeply nested if (e.g. checking an object with a number property) in an if property now doesn't break the form. ([#33](https://github.com/remoteoss/json-schema-form/pull/33)) ([e34cfcc](https://github.com/remoteoss/json-schema-form/commit/e34cfccaf45f1460b346f3cff0c797b3d11259e3))
100
92
 
101
93
  #### 0.4.2-beta.0 (2023-07-20)
102
94
 
103
95
  ##### Bug Fixes
104
96
 
105
- * **date:** Validate based on minDate and maxDate ([#30](https://github.com/remoteoss/json-schema-form/pull/30)) ([01c0143e](https://github.com/remoteoss/json-schema-form/commit/01c0143ea4a3775f9489ae6cb8fd99a90b3f1394))
97
+ - **date:** Validate based on minDate and maxDate ([#30](https://github.com/remoteoss/json-schema-form/pull/30)) ([01c0143e](https://github.com/remoteoss/json-schema-form/commit/01c0143ea4a3775f9489ae6cb8fd99a90b3f1394))
106
98
 
107
99
  #### 0.4.1-beta.0 (2023-07-03)
108
100
 
109
101
  ##### Bug Fixes
110
102
 
111
- * **fieldset:** support root conditionals for fieldsets ([#23](https://github.com/remoteoss/json-schema-form/pull/23)) ([65d87b3a](https://github.com/remoteoss/json-schema-form/commit/65d87b3a93018f0729aed565000eb2a2ce1f2ce7))
112
- * **select/radio:** Accept just the values in options (plus `''` and `null` for backward-compatibility) ([#18](https://github.com/remoteoss/json-schema-form/pull/18)) ([37501d2d](https://github.com/remoteoss/json-schema-form/commit/37501d2ddafdd5e207b34d2ca3f6b7b7a1006e9d))
103
+ - **fieldset:** support root conditionals for fieldsets ([#23](https://github.com/remoteoss/json-schema-form/pull/23)) ([65d87b3a](https://github.com/remoteoss/json-schema-form/commit/65d87b3a93018f0729aed565000eb2a2ce1f2ce7))
104
+ - **select/radio:** Accept just the values in options (plus `''` and `null` for backward-compatibility) ([#18](https://github.com/remoteoss/json-schema-form/pull/18)) ([37501d2d](https://github.com/remoteoss/json-schema-form/commit/37501d2ddafdd5e207b34d2ca3f6b7b7a1006e9d))
113
105
 
114
106
  #### 0.4.0-beta.0 (2023-06-22)
115
107
 
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.1-dev.20231026204916
5
- Generated: Thu, 26 Oct 2023 20:49:34 GMT
4
+ NPM Package: @remoteoss/json-schema-form@0.7.2-dev.20231106093837
5
+ Generated: Mon, 06 Nov 2023 09:38:54 GMT
6
6
 
7
7
  MIT License
8
8
 
@@ -461,38 +461,22 @@ var validateMaxDate = (value, minDate) => {
461
461
  };
462
462
  var yupSchemas = {
463
463
  text: validateOnlyStrings,
464
- radioOrSelect: (options) => (0, import_yup.string)().nullable().transform((value) => {
465
- if (value === "") {
466
- return void 0;
464
+ radioOrSelect: (options, isString) => {
465
+ if (isString) {
466
+ return (0, import_yup.string)().nullable();
467
467
  }
468
- if (options?.some((option) => option.value === null)) {
469
- return value;
470
- }
471
- return value === null ? void 0 : value;
472
- }).test(
473
- /*
474
- Custom test determines if the value either:
475
- - Matches a specific option by value
476
- - Matches a pattern
477
- If the option is undefined do not test, to allow for optional fields.
478
- */
479
- "matchesOptionOrPattern",
480
- ({ value }) => `The option ${JSON.stringify(value)} is not valid.`,
481
- (value) => {
482
- if (value === void 0) {
483
- return true;
484
- }
485
- const exactMatch = options.some((option) => option.value === value);
486
- if (exactMatch) {
487
- return true;
468
+ return (0, import_yup.string)().nullable().transform((value) => {
469
+ if (value === "") {
470
+ return void 0;
488
471
  }
489
- const patternMatch = options.some((option) => option.pattern?.test(value));
490
- if (patternMatch) {
491
- return true;
472
+ if (options?.includes(null)) {
473
+ return value;
492
474
  }
493
- return false;
494
- }
495
- ),
475
+ return value === null ? void 0 : value;
476
+ }).oneOf(options, ({ value }) => {
477
+ return `The option ${JSON.stringify(value)} is not valid.`;
478
+ });
479
+ },
496
480
  date: ({ minDate, maxDate }) => {
497
481
  let dateString = (0, import_yup.string)().nullable().transform((value) => {
498
482
  if (value === "") {
@@ -550,21 +534,19 @@ function getRequiredErrorMessage(inputType, { inlineError, configError }) {
550
534
  }
551
535
  var getJsonTypeInArray = (jsonType) => Array.isArray(jsonType) ? jsonType.find((val) => val !== "null") : jsonType;
552
536
  var getOptions = (field) => {
553
- const allValues = field.options?.map((option) => ({
554
- value: option.value,
555
- pattern: option.pattern ? new RegExp(option.pattern) : null
556
- }));
537
+ const allValues = field.options?.map((option) => option.value);
557
538
  const isOptionalWithNull = Array.isArray(field.jsonType) && // @TODO should also check the "oneOf" directly looking for "null"
558
539
  // option but we don't have direct access at this point.
559
540
  // Otherwise the JSON Schema validator will fail as explained in PR#18
560
541
  field.jsonType.includes("null");
561
- return isOptionalWithNull ? [...allValues, { option: null }] : allValues;
542
+ return isOptionalWithNull ? [...allValues, null] : allValues;
562
543
  };
563
544
  var getYupSchema = ({ inputType, ...field }) => {
564
545
  const jsonType = getJsonTypeInArray(field.jsonType);
565
546
  if (field.options?.length > 0) {
547
+ const isString = field.options?.findIndex((option) => option.type === "string") > -1;
566
548
  const optionValues = getOptions(field);
567
- return yupSchemas.radioOrSelect(optionValues);
549
+ return yupSchemas.radioOrSelect(optionValues, isString);
568
550
  }
569
551
  if (field.format === "date") {
570
552
  return yupSchemas.date({ minDate: field.minDate, maxDate: field.maxDate });
@@ -1055,6 +1037,33 @@ function processJSONLogicNode({
1055
1037
  }
1056
1038
 
1057
1039
  // src/helpers.js
1040
+ var dynamicInternalJsfAttrs = [
1041
+ "isVisible",
1042
+ // Driven from conditionals state
1043
+ "fields",
1044
+ // driven from group-array
1045
+ "getComputedAttributes",
1046
+ // From json-logic
1047
+ "computedAttributes",
1048
+ // From json-logic
1049
+ "calculateConditionalProperties",
1050
+ // driven from conditionals
1051
+ "calculateCustomValidationProperties",
1052
+ // To be deprecated in favor of json-logic
1053
+ "scopedJsonSchema"
1054
+ // The respective JSON Schema
1055
+ ];
1056
+ var dynamicInternalJsfAttrsObj = Object.fromEntries(
1057
+ dynamicInternalJsfAttrs.map((k) => [k, true])
1058
+ );
1059
+ function removeConditionalStaleAttributes(field, conditionalAttrs, rootAttrs) {
1060
+ Object.keys(field).forEach((key) => {
1061
+ if (conditionalAttrs[key] === void 0 && rootAttrs[key] === void 0 && // Don't remove attrs that were declared in the root field.
1062
+ dynamicInternalJsfAttrsObj[key] === void 0) {
1063
+ field[key] = void 0;
1064
+ }
1065
+ });
1066
+ }
1058
1067
  function hasType(type, typeName) {
1059
1068
  return Array.isArray(type) ? type.includes(typeName) : type === typeName;
1060
1069
  }
@@ -1147,19 +1156,21 @@ function updateField(field, requiredFields, node, formValues, logic, config) {
1147
1156
  if (fieldIsRequired) {
1148
1157
  field.isVisible = true;
1149
1158
  }
1150
- const updateValues = (fieldValues) => Object.entries(fieldValues).forEach(([key, value]) => {
1151
- field[key] = typeof value === "function" ? value() : value;
1152
- if (key === "value") {
1153
- const readOnlyPropertyWasUpdated = typeof fieldValues.readOnly !== "undefined";
1154
- const isReadonlyByDefault = field.readOnly;
1155
- const isReadonly = readOnlyPropertyWasUpdated ? fieldValues.readOnly : isReadonlyByDefault;
1156
- if (!isReadonly && (value === null || field.inputType === "checkbox")) {
1157
- field.value = void 0;
1159
+ const updateAttributes = (fieldAttrs) => {
1160
+ Object.entries(fieldAttrs).forEach(([key, value]) => {
1161
+ field[key] = typeof value === "function" ? value() : value;
1162
+ if (key === "value") {
1163
+ const readOnlyPropertyWasUpdated = typeof fieldAttrs.readOnly !== "undefined";
1164
+ const isReadonlyByDefault = field.readOnly;
1165
+ const isReadonly = readOnlyPropertyWasUpdated ? fieldAttrs.readOnly : isReadonlyByDefault;
1166
+ if (!isReadonly && (value === null || field.inputType === "checkbox")) {
1167
+ field.value = void 0;
1168
+ }
1158
1169
  }
1159
- }
1160
- });
1170
+ });
1171
+ };
1161
1172
  if (field.getComputedAttributes) {
1162
- const computedFieldValues = field.getComputedAttributes({
1173
+ const newAttributes = field.getComputedAttributes({
1163
1174
  field,
1164
1175
  isRequired: fieldIsRequired,
1165
1176
  node,
@@ -1167,23 +1178,24 @@ function updateField(field, requiredFields, node, formValues, logic, config) {
1167
1178
  config,
1168
1179
  logic
1169
1180
  });
1170
- updateValues(computedFieldValues);
1181
+ updateAttributes(newAttributes);
1171
1182
  }
1172
1183
  if (field.calculateConditionalProperties) {
1173
- const newFieldValues = field.calculateConditionalProperties({
1184
+ const { rootFieldAttrs, newAttributes } = field.calculateConditionalProperties({
1174
1185
  isRequired: fieldIsRequired,
1175
1186
  conditionBranch: node,
1176
1187
  formValues
1177
1188
  });
1178
- updateValues(newFieldValues);
1189
+ updateAttributes(newAttributes, rootFieldAttrs);
1190
+ removeConditionalStaleAttributes(field, newAttributes, rootFieldAttrs);
1179
1191
  }
1180
1192
  if (field.calculateCustomValidationProperties) {
1181
- const newFieldValues = field.calculateCustomValidationProperties(
1193
+ const newAttributes = field.calculateCustomValidationProperties(
1182
1194
  fieldIsRequired,
1183
1195
  node,
1184
1196
  formValues
1185
1197
  );
1186
- updateValues(newFieldValues);
1198
+ updateAttributes(newAttributes);
1187
1199
  }
1188
1200
  }
1189
1201
  function processNode({
@@ -1525,17 +1537,23 @@ function calculateConditionalProperties({ fieldParams, customProperties, logic,
1525
1537
  logic
1526
1538
  )
1527
1539
  };
1528
- return (0, import_omit2.default)((0, import_merge2.default)(base, presentation, newFieldParams), ["inputType"]);
1540
+ return {
1541
+ rootFieldAttrs: fieldParams,
1542
+ newAttributes: (0, import_omit2.default)((0, import_merge2.default)(base, presentation, newFieldParams), ["inputType"])
1543
+ };
1529
1544
  }
1530
1545
  const isVisible = isRequired;
1531
1546
  return {
1532
- isVisible,
1533
- required: isRequired,
1534
- schema: buildYupSchema({
1535
- ...fieldParams,
1536
- ...extractParametersFromNode(conditionBranch),
1537
- required: isRequired
1538
- })
1547
+ rootFieldAttrs: fieldParams,
1548
+ newAttributes: {
1549
+ isVisible,
1550
+ required: isRequired,
1551
+ schema: buildYupSchema({
1552
+ ...fieldParams,
1553
+ ...extractParametersFromNode(conditionBranch),
1554
+ required: isRequired
1555
+ })
1556
+ }
1539
1557
  };
1540
1558
  };
1541
1559
  }
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.1-dev.20231026204916
5
- Generated: Thu, 26 Oct 2023 20:49:34 GMT
4
+ NPM Package: @remoteoss/json-schema-form@0.7.2-dev.20231106093837
5
+ Generated: Mon, 06 Nov 2023 09:38:54 GMT
6
6
 
7
7
  MIT License
8
8
 
@@ -425,38 +425,22 @@ var validateMaxDate = (value, minDate) => {
425
425
  };
426
426
  var yupSchemas = {
427
427
  text: validateOnlyStrings,
428
- radioOrSelect: (options) => string().nullable().transform((value) => {
429
- if (value === "") {
430
- return void 0;
428
+ radioOrSelect: (options, isString) => {
429
+ if (isString) {
430
+ return string().nullable();
431
431
  }
432
- if (options?.some((option) => option.value === null)) {
433
- return value;
434
- }
435
- return value === null ? void 0 : value;
436
- }).test(
437
- /*
438
- Custom test determines if the value either:
439
- - Matches a specific option by value
440
- - Matches a pattern
441
- If the option is undefined do not test, to allow for optional fields.
442
- */
443
- "matchesOptionOrPattern",
444
- ({ value }) => `The option ${JSON.stringify(value)} is not valid.`,
445
- (value) => {
446
- if (value === void 0) {
447
- return true;
448
- }
449
- const exactMatch = options.some((option) => option.value === value);
450
- if (exactMatch) {
451
- return true;
432
+ return string().nullable().transform((value) => {
433
+ if (value === "") {
434
+ return void 0;
452
435
  }
453
- const patternMatch = options.some((option) => option.pattern?.test(value));
454
- if (patternMatch) {
455
- return true;
436
+ if (options?.includes(null)) {
437
+ return value;
456
438
  }
457
- return false;
458
- }
459
- ),
439
+ return value === null ? void 0 : value;
440
+ }).oneOf(options, ({ value }) => {
441
+ return `The option ${JSON.stringify(value)} is not valid.`;
442
+ });
443
+ },
460
444
  date: ({ minDate, maxDate }) => {
461
445
  let dateString = string().nullable().transform((value) => {
462
446
  if (value === "") {
@@ -514,21 +498,19 @@ function getRequiredErrorMessage(inputType, { inlineError, configError }) {
514
498
  }
515
499
  var getJsonTypeInArray = (jsonType) => Array.isArray(jsonType) ? jsonType.find((val) => val !== "null") : jsonType;
516
500
  var getOptions = (field) => {
517
- const allValues = field.options?.map((option) => ({
518
- value: option.value,
519
- pattern: option.pattern ? new RegExp(option.pattern) : null
520
- }));
501
+ const allValues = field.options?.map((option) => option.value);
521
502
  const isOptionalWithNull = Array.isArray(field.jsonType) && // @TODO should also check the "oneOf" directly looking for "null"
522
503
  // option but we don't have direct access at this point.
523
504
  // Otherwise the JSON Schema validator will fail as explained in PR#18
524
505
  field.jsonType.includes("null");
525
- return isOptionalWithNull ? [...allValues, { option: null }] : allValues;
506
+ return isOptionalWithNull ? [...allValues, null] : allValues;
526
507
  };
527
508
  var getYupSchema = ({ inputType, ...field }) => {
528
509
  const jsonType = getJsonTypeInArray(field.jsonType);
529
510
  if (field.options?.length > 0) {
511
+ const isString = field.options?.findIndex((option) => option.type === "string") > -1;
530
512
  const optionValues = getOptions(field);
531
- return yupSchemas.radioOrSelect(optionValues);
513
+ return yupSchemas.radioOrSelect(optionValues, isString);
532
514
  }
533
515
  if (field.format === "date") {
534
516
  return yupSchemas.date({ minDate: field.minDate, maxDate: field.maxDate });
@@ -1019,6 +1001,33 @@ function processJSONLogicNode({
1019
1001
  }
1020
1002
 
1021
1003
  // src/helpers.js
1004
+ var dynamicInternalJsfAttrs = [
1005
+ "isVisible",
1006
+ // Driven from conditionals state
1007
+ "fields",
1008
+ // driven from group-array
1009
+ "getComputedAttributes",
1010
+ // From json-logic
1011
+ "computedAttributes",
1012
+ // From json-logic
1013
+ "calculateConditionalProperties",
1014
+ // driven from conditionals
1015
+ "calculateCustomValidationProperties",
1016
+ // To be deprecated in favor of json-logic
1017
+ "scopedJsonSchema"
1018
+ // The respective JSON Schema
1019
+ ];
1020
+ var dynamicInternalJsfAttrsObj = Object.fromEntries(
1021
+ dynamicInternalJsfAttrs.map((k) => [k, true])
1022
+ );
1023
+ function removeConditionalStaleAttributes(field, conditionalAttrs, rootAttrs) {
1024
+ Object.keys(field).forEach((key) => {
1025
+ if (conditionalAttrs[key] === void 0 && rootAttrs[key] === void 0 && // Don't remove attrs that were declared in the root field.
1026
+ dynamicInternalJsfAttrsObj[key] === void 0) {
1027
+ field[key] = void 0;
1028
+ }
1029
+ });
1030
+ }
1022
1031
  function hasType(type, typeName) {
1023
1032
  return Array.isArray(type) ? type.includes(typeName) : type === typeName;
1024
1033
  }
@@ -1111,19 +1120,21 @@ function updateField(field, requiredFields, node, formValues, logic, config) {
1111
1120
  if (fieldIsRequired) {
1112
1121
  field.isVisible = true;
1113
1122
  }
1114
- const updateValues = (fieldValues) => Object.entries(fieldValues).forEach(([key, value]) => {
1115
- field[key] = typeof value === "function" ? value() : value;
1116
- if (key === "value") {
1117
- const readOnlyPropertyWasUpdated = typeof fieldValues.readOnly !== "undefined";
1118
- const isReadonlyByDefault = field.readOnly;
1119
- const isReadonly = readOnlyPropertyWasUpdated ? fieldValues.readOnly : isReadonlyByDefault;
1120
- if (!isReadonly && (value === null || field.inputType === "checkbox")) {
1121
- field.value = void 0;
1123
+ const updateAttributes = (fieldAttrs) => {
1124
+ Object.entries(fieldAttrs).forEach(([key, value]) => {
1125
+ field[key] = typeof value === "function" ? value() : value;
1126
+ if (key === "value") {
1127
+ const readOnlyPropertyWasUpdated = typeof fieldAttrs.readOnly !== "undefined";
1128
+ const isReadonlyByDefault = field.readOnly;
1129
+ const isReadonly = readOnlyPropertyWasUpdated ? fieldAttrs.readOnly : isReadonlyByDefault;
1130
+ if (!isReadonly && (value === null || field.inputType === "checkbox")) {
1131
+ field.value = void 0;
1132
+ }
1122
1133
  }
1123
- }
1124
- });
1134
+ });
1135
+ };
1125
1136
  if (field.getComputedAttributes) {
1126
- const computedFieldValues = field.getComputedAttributes({
1137
+ const newAttributes = field.getComputedAttributes({
1127
1138
  field,
1128
1139
  isRequired: fieldIsRequired,
1129
1140
  node,
@@ -1131,23 +1142,24 @@ function updateField(field, requiredFields, node, formValues, logic, config) {
1131
1142
  config,
1132
1143
  logic
1133
1144
  });
1134
- updateValues(computedFieldValues);
1145
+ updateAttributes(newAttributes);
1135
1146
  }
1136
1147
  if (field.calculateConditionalProperties) {
1137
- const newFieldValues = field.calculateConditionalProperties({
1148
+ const { rootFieldAttrs, newAttributes } = field.calculateConditionalProperties({
1138
1149
  isRequired: fieldIsRequired,
1139
1150
  conditionBranch: node,
1140
1151
  formValues
1141
1152
  });
1142
- updateValues(newFieldValues);
1153
+ updateAttributes(newAttributes, rootFieldAttrs);
1154
+ removeConditionalStaleAttributes(field, newAttributes, rootFieldAttrs);
1143
1155
  }
1144
1156
  if (field.calculateCustomValidationProperties) {
1145
- const newFieldValues = field.calculateCustomValidationProperties(
1157
+ const newAttributes = field.calculateCustomValidationProperties(
1146
1158
  fieldIsRequired,
1147
1159
  node,
1148
1160
  formValues
1149
1161
  );
1150
- updateValues(newFieldValues);
1162
+ updateAttributes(newAttributes);
1151
1163
  }
1152
1164
  }
1153
1165
  function processNode({
@@ -1489,17 +1501,23 @@ function calculateConditionalProperties({ fieldParams, customProperties, logic,
1489
1501
  logic
1490
1502
  )
1491
1503
  };
1492
- return omit2(merge2(base, presentation, newFieldParams), ["inputType"]);
1504
+ return {
1505
+ rootFieldAttrs: fieldParams,
1506
+ newAttributes: omit2(merge2(base, presentation, newFieldParams), ["inputType"])
1507
+ };
1493
1508
  }
1494
1509
  const isVisible = isRequired;
1495
1510
  return {
1496
- isVisible,
1497
- required: isRequired,
1498
- schema: buildYupSchema({
1499
- ...fieldParams,
1500
- ...extractParametersFromNode(conditionBranch),
1501
- required: isRequired
1502
- })
1511
+ rootFieldAttrs: fieldParams,
1512
+ newAttributes: {
1513
+ isVisible,
1514
+ required: isRequired,
1515
+ schema: buildYupSchema({
1516
+ ...fieldParams,
1517
+ ...extractParametersFromNode(conditionBranch),
1518
+ required: isRequired
1519
+ })
1520
+ }
1503
1521
  };
1504
1522
  };
1505
1523
  }