@digigov/form 0.10.14 → 0.10.15

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,6 +1,13 @@
1
1
  # Change Log - @digigov/form
2
2
 
3
- This log was last generated on Wed, 22 Feb 2023 15:41:06 GMT and should not be manually modified.
3
+ This log was last generated on Mon, 13 Mar 2023 10:21:39 GMT and should not be manually modified.
4
+
5
+ ## 0.10.15
6
+ Mon, 13 Mar 2023 10:21:39 GMT
7
+
8
+ ### Patches
9
+
10
+ - Add yup nullable to string validator
4
11
 
5
12
  ## 0.10.13
6
13
  Wed, 22 Feb 2023 15:41:06 GMT
@@ -19,6 +19,10 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
19
19
 
20
20
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
21
 
22
+ var initialValues = {
23
+ 'business-title': null
24
+ };
25
+
22
26
  var _ref = /*#__PURE__*/_react["default"].createElement(_core.Button, {
23
27
  type: "submit"
24
28
  }, "\u03A3\u03C5\u03BD\u03AD\u03C7\u03B5\u03B9\u03B1");
@@ -28,7 +32,8 @@ var Default = function Default() {
28
32
  onSubmit: function onSubmit(data) {
29
33
  debugger;
30
34
  console.log(data);
31
- }
35
+ },
36
+ initial: initialValues
32
37
  }, /*#__PURE__*/_react["default"].createElement(_form.Field, {
33
38
  key: "business-title",
34
39
  name: "business-title",
@@ -1,6 +1,9 @@
1
1
  import React from 'react';
2
2
  import FormBuilder, { Field } from '@digigov/form';
3
3
  import { Button } from '@digigov/ui/core';
4
+ var initialValues = {
5
+ 'business-title': null
6
+ };
4
7
 
5
8
  var _ref = /*#__PURE__*/React.createElement(Button, {
6
9
  type: "submit"
@@ -11,7 +14,8 @@ export var Default = function Default() {
11
14
  onSubmit: function onSubmit(data) {
12
15
  debugger;
13
16
  console.log(data);
14
- }
17
+ },
18
+ initial: initialValues
15
19
  }, /*#__PURE__*/React.createElement(Field, {
16
20
  key: "business-title",
17
21
  name: "business-title",
@@ -49,7 +49,7 @@ export function computeShape(fields, yupTypeMap, validatorRegistry) {
49
49
  }
50
50
  }
51
51
  } else if (field.required) {
52
- yupField = yupField.required('form.error.required');
52
+ yupField = yupField.nullable().required('form.error.required');
53
53
  }
54
54
 
55
55
  if (validatorRegistry && field.type && validatorRegistry[field.type]) {
@@ -1,6 +1,9 @@
1
1
  import React from 'react';
2
2
  import FormBuilder, { Field } from '@digigov/form';
3
3
  import { Button } from '@digigov/ui/core';
4
+ var initialValues = {
5
+ 'business-title': null
6
+ };
4
7
 
5
8
  var _ref = /*#__PURE__*/React.createElement(Button, {
6
9
  type: "submit"
@@ -11,7 +14,8 @@ export var Default = function Default() {
11
14
  onSubmit: function onSubmit(data) {
12
15
  debugger;
13
16
  console.log(data);
14
- }
17
+ },
18
+ initial: initialValues
15
19
  }, /*#__PURE__*/React.createElement(Field, {
16
20
  key: "business-title",
17
21
  name: "business-title",
package/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Digigov v0.10.14
1
+ /** @license Digigov v0.10.15
2
2
  *
3
3
  * This source code is licensed under the BSD-2-Clause license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -49,7 +49,7 @@ export function computeShape(fields, yupTypeMap, validatorRegistry) {
49
49
  }
50
50
  }
51
51
  } else if (field.required) {
52
- yupField = yupField.required('form.error.required');
52
+ yupField = yupField.nullable().required('form.error.required');
53
53
  }
54
54
 
55
55
  if (validatorRegistry && field.type && validatorRegistry[field.type]) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digigov/form",
3
- "version": "0.10.14",
3
+ "version": "0.10.15",
4
4
  "description": "@digigov form builder",
5
5
  "author": "GRNET Developers <devs@lists.grnet.gr>",
6
6
  "license": "BSD-2-Clause",
@@ -19,9 +19,9 @@
19
19
  "publint": "0.1.8"
20
20
  },
21
21
  "peerDependencies": {
22
- "@digigov/ui": "0.30.2",
23
- "@digigov/react-core": "0.21.0",
24
- "@digigov/react-extensions": "0.20.6",
22
+ "@digigov/ui": "0.30.3",
23
+ "@digigov/react-core": "0.21.1",
24
+ "@digigov/react-extensions": "0.20.7",
25
25
  "clsx": "1.1.1",
26
26
  "react": "^16.8.0 || ^17.0.0",
27
27
  "react-dom": "^16.8.0 || ^17.0.0"
@@ -2,12 +2,17 @@ import React from 'react';
2
2
  import FormBuilder, { Field } from '@digigov/form';
3
3
  import { Button } from '@digigov/ui/core';
4
4
 
5
+ const initialValues = {
6
+ 'business-title': null,
7
+ };
8
+
5
9
  export const Default = () => (
6
10
  <FormBuilder
7
11
  onSubmit={(data) => {
8
12
  debugger;
9
13
  console.log(data);
10
14
  }}
15
+ initial={initialValues}
11
16
  >
12
17
  <Field
13
18
  key="business-title"
@@ -48,7 +48,7 @@ export function computeShape(
48
48
  }
49
49
  }
50
50
  } else if (field.required) {
51
- yupField = yupField.required('form.error.required');
51
+ yupField = yupField.nullable().required('form.error.required');
52
52
  }
53
53
  if (validatorRegistry && field.type && validatorRegistry[field.type]) {
54
54
  validatorRegistry[field.type].forEach((validator: any) => {
@@ -149,7 +149,7 @@ function computeShape(fields, yupTypeMap, validatorRegistry) {
149
149
  }
150
150
  }
151
151
  } else if (field.required) {
152
- yupField = yupField.required('form.error.required');
152
+ yupField = yupField.nullable().required('form.error.required');
153
153
  }
154
154
 
155
155
  if (validatorRegistry && field.type && validatorRegistry[field.type]) {