@gravity-ui/dynamic-forms 1.11.1 → 1.11.3

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.
@@ -49,8 +49,8 @@ const useField = ({ name, spec, initialValue, value: externalValue, validate: pr
49
49
  const _value = lodash_1.default.isFunction(valOrSetter) ? valOrSetter(state.value) : valOrSetter;
50
50
  const error = validate === null || validate === void 0 ? void 0 : validate(_value);
51
51
  let value = (0, utils_1.transformArrIn)(_value);
52
- if ((0, helpers_1.isNumberSpec)(spec) && value && !error) {
53
- value = Number(value);
52
+ if ((0, helpers_1.isNumberSpec)(spec) && !error) {
53
+ value = (value ? Number(value) : undefined);
54
54
  }
55
55
  let newChildErrors = Object.assign({}, state.childErrors);
56
56
  if (childErrors) {
@@ -60,7 +60,7 @@ const useField = ({ name, spec, initialValue, value: externalValue, validate: pr
60
60
  newChildErrors = Object.assign(Object.assign({}, lodash_1.default.omit(newChildErrors, existingСhildNames)), childErrors);
61
61
  }
62
62
  }
63
- return Object.assign(Object.assign({}, state), { dirty: !lodash_1.default.isEqual(value, initialValue), error, invalid: Boolean(error), modified: true, pristine: value === initialValue, touched: true, valid: !error, value, visited: true, childErrors: newChildErrors });
63
+ return Object.assign(Object.assign({}, state), { dirty: !lodash_1.default.isEqual(value, initialValue), error, invalid: Boolean(error), modified: true, pristine: value === initialValue, touched: true, valid: !error, value: value, visited: true, childErrors: newChildErrors });
64
64
  });
65
65
  };
66
66
  const onDrop = () => {
@@ -2,12 +2,7 @@
2
2
  display: flex;
3
3
  }
4
4
  .df-file-input__input {
5
- opacity: 0;
6
- position: absolute;
7
- clip: rect(0 0 0 0);
8
- width: 1px;
9
- height: 1px;
10
- margin: -1px;
5
+ display: none;
11
6
  }
12
7
  .df-file-input__file-name {
13
8
  display: block;
@@ -45,8 +45,8 @@ export const useField = ({ name, spec, initialValue, value: externalValue, valid
45
45
  const _value = _.isFunction(valOrSetter) ? valOrSetter(state.value) : valOrSetter;
46
46
  const error = validate === null || validate === void 0 ? void 0 : validate(_value);
47
47
  let value = transformArrIn(_value);
48
- if (isNumberSpec(spec) && value && !error) {
49
- value = Number(value);
48
+ if (isNumberSpec(spec) && !error) {
49
+ value = (value ? Number(value) : undefined);
50
50
  }
51
51
  let newChildErrors = Object.assign({}, state.childErrors);
52
52
  if (childErrors) {
@@ -56,7 +56,7 @@ export const useField = ({ name, spec, initialValue, value: externalValue, valid
56
56
  newChildErrors = Object.assign(Object.assign({}, _.omit(newChildErrors, existingСhildNames)), childErrors);
57
57
  }
58
58
  }
59
- return Object.assign(Object.assign({}, state), { dirty: !_.isEqual(value, initialValue), error, invalid: Boolean(error), modified: true, pristine: value === initialValue, touched: true, valid: !error, value, visited: true, childErrors: newChildErrors });
59
+ return Object.assign(Object.assign({}, state), { dirty: !_.isEqual(value, initialValue), error, invalid: Boolean(error), modified: true, pristine: value === initialValue, touched: true, valid: !error, value: value, visited: true, childErrors: newChildErrors });
60
60
  });
61
61
  };
62
62
  const onDrop = () => {
@@ -2,12 +2,7 @@
2
2
  display: flex;
3
3
  }
4
4
  .df-file-input__input {
5
- opacity: 0;
6
- position: absolute;
7
- clip: rect(0 0 0 0);
8
- width: 1px;
9
- height: 1px;
10
- margin: -1px;
5
+ display: none;
11
6
  }
12
7
  .df-file-input__file-name {
13
8
  display: block;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/dynamic-forms",
3
- "version": "1.11.1",
3
+ "version": "1.11.3",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "main": "build/cjs/index.js",