@onehat/ui 0.2.5 → 0.2.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onehat/ui",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "Base UI for OneHat apps",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -493,26 +493,26 @@ function disableRequiredYupFields(validator) {
493
493
  return null;
494
494
  }
495
495
 
496
- // const nextSchema = validator.clone();
497
- // return nextSchema.withMutation((next) => {
498
- // if (typeof next.fields === 'object' && next.fields != null) {
499
- // for (const key in next.fields) {
500
- // const nestedField = next.fields[key];
496
+ const nextSchema = validator.clone();
497
+ return nextSchema.withMutation((next) => {
498
+ if (typeof next.fields === 'object' && next.fields != null) {
499
+ for (const key in next.fields) {
500
+ const nestedField = next.fields[key];
501
501
 
502
- // let nestedFieldNext = nestedField.notRequired();
502
+ let nestedFieldNext = nestedField.notRequired();
503
503
 
504
- // if (Array.isArray(nestedField.conditions) && nestedField.conditions.length > 0) {
505
- // // Next is done to disable required() inside a condition
506
- // // https://github.com/jquense/yup/issues/1002
507
- // nestedFieldNext = nestedFieldNext.when('whatever', (_: unknown, schema: yup.AnySchema) =>
508
- // schema.notRequired(),
509
- // );
510
- // }
504
+ if (Array.isArray(nestedField.conditions) && nestedField.conditions.length > 0) {
505
+ // Next is done to disable required() inside a condition
506
+ // https://github.com/jquense/yup/issues/1002
507
+ nestedFieldNext = nestedFieldNext.when('whatever', (unused, schema) => {
508
+ return schema.notRequired();
509
+ });
510
+ }
511
511
 
512
- // next.fields[key] = nestedFieldNext;
513
- // }
514
- // }
515
- // });
512
+ next.fields[key] = nestedFieldNext;
513
+ }
514
+ }
515
+ });
516
516
  }
517
517
  function getNullFieldValues(initialValues, Repository) {
518
518
  const ret = {};