@gravity-ui/dynamic-forms 3.7.0 → 4.0.1

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.
Files changed (148) hide show
  1. package/build/cjs/lib/core/components/Form/Controller/Controller.js +2 -2
  2. package/build/cjs/lib/core/components/Form/Controller/utils.js +45 -34
  3. package/build/cjs/lib/core/components/Form/DynamicField.js +6 -4
  4. package/build/cjs/lib/core/components/Form/hooks/useCreateContext.js +2 -2
  5. package/build/cjs/lib/core/components/Form/hooks/useCreateSearchContext.js +2 -2
  6. package/build/cjs/lib/core/components/Form/hooks/useIntegrationFF.js +6 -4
  7. package/build/cjs/lib/core/components/Form/hooks/useMutators.js +11 -7
  8. package/build/cjs/lib/core/components/Form/hooks/useSearchStore.js +4 -3
  9. package/build/cjs/lib/core/components/Form/hooks/useStore.js +15 -11
  10. package/build/cjs/lib/core/components/Form/utils/common.js +14 -11
  11. package/build/cjs/lib/core/components/View/helpers.js +5 -5
  12. package/build/cjs/lib/core/components/View/hooks/useComponents.js +2 -2
  13. package/build/cjs/lib/core/components/View/hooks/useCreateContext.js +2 -2
  14. package/build/cjs/lib/core/components/View/hooks/useRender.js +4 -3
  15. package/build/cjs/lib/core/helpers.js +5 -4
  16. package/build/cjs/lib/kit/components/AccordeonCard/AccordeonCard.js +2 -2
  17. package/build/cjs/lib/kit/components/Card/Card.css +3 -2
  18. package/build/cjs/lib/kit/components/Card/Card.js +2 -2
  19. package/build/cjs/lib/kit/components/CopyButton/CopyButton.js +1 -1
  20. package/build/cjs/lib/kit/components/ErrorWrapper/ErrorWrapper.css +4 -1
  21. package/build/cjs/lib/kit/components/GenerateRandomValueButton/GenerateRandomValueButton.js +2 -2
  22. package/build/cjs/lib/kit/components/Inputs/ArrayBase/ArrayBase.js +2 -2
  23. package/build/cjs/lib/kit/components/Inputs/CardOneOf/CardOneOf.js +2 -2
  24. package/build/cjs/lib/kit/components/Inputs/MonacoInput/MonacoInputDialog.css +2 -2
  25. package/build/cjs/lib/kit/components/Inputs/MultiOneOf/MultiOneOf.js +4 -3
  26. package/build/cjs/lib/kit/components/Inputs/ObjectBase/ObjectBase.js +4 -3
  27. package/build/cjs/lib/kit/components/Inputs/ObjectValueInput/ObjectValueInput.js +4 -3
  28. package/build/cjs/lib/kit/components/Inputs/OneOf/OneOf.js +2 -2
  29. package/build/cjs/lib/kit/components/Inputs/Secret/Secret.js +4 -3
  30. package/build/cjs/lib/kit/components/Inputs/TableArrayInput/TableArrayInput.css +8 -2
  31. package/build/cjs/lib/kit/components/Inputs/TableArrayInput/TableArrayInput.js +4 -3
  32. package/build/cjs/lib/kit/components/Inputs/Text/Text.js +2 -2
  33. package/build/cjs/lib/kit/components/Inputs/TextContent/TextContent.css +2 -2
  34. package/build/cjs/lib/kit/components/Inputs/TextContent/TextContent.js +2 -2
  35. package/build/cjs/lib/kit/components/Inputs/TextLink/TextLink.js +4 -3
  36. package/build/cjs/lib/kit/components/Layouts/Row/Row.css +2 -2
  37. package/build/cjs/lib/kit/components/Layouts/Row/Row.js +2 -2
  38. package/build/cjs/lib/kit/components/Layouts/Section/Section.css +2 -2
  39. package/build/cjs/lib/kit/components/LazyLoader/LazyLoader.js +2 -2
  40. package/build/cjs/lib/kit/components/LongValue/LongValue.css +3 -0
  41. package/build/cjs/lib/kit/components/LongValue/LongValue.js +1 -1
  42. package/build/cjs/lib/kit/components/SimpleVerticalAccordeon/SimpleVerticalAccordeon.css +2 -2
  43. package/build/cjs/lib/kit/components/ViewLayouts/ViewAccordeon/ViewAccordeon.js +2 -2
  44. package/build/cjs/lib/kit/components/ViewLayouts/ViewAccordeonCard/ViewAccordeonCard.js +2 -2
  45. package/build/cjs/lib/kit/components/ViewLayouts/ViewCardAccordeon.js +2 -2
  46. package/build/cjs/lib/kit/components/Views/ArrayBaseView/ArrayBaseView.js +2 -2
  47. package/build/cjs/lib/kit/components/Views/BaseView/BaseView.js +2 -2
  48. package/build/cjs/lib/kit/components/Views/CardOneOfView.js +2 -2
  49. package/build/cjs/lib/kit/components/Views/MonacoInputView/MonacoViewDialog.css +1 -1
  50. package/build/cjs/lib/kit/components/Views/MultiOneOfView/MultiOneOfView.js +2 -2
  51. package/build/cjs/lib/kit/components/Views/ObjectBaseView/ObjectBaseView.js +2 -2
  52. package/build/cjs/lib/kit/components/Views/ObjectValueInputView/ObjectValueInputView.js +2 -2
  53. package/build/cjs/lib/kit/components/Views/OneOfView/OneOfView.js +2 -2
  54. package/build/cjs/lib/kit/components/Views/TextLinkView/TextLinkView.js +2 -2
  55. package/build/cjs/lib/kit/hooks/useOneOf/useOneOf.js +5 -4
  56. package/build/cjs/lib/kit/utils/common.js +30 -25
  57. package/build/cjs/lib/kit/validators/validators.js +9 -7
  58. package/build/esm/lib/core/components/Form/Controller/Controller.d.ts +1 -1
  59. package/build/esm/lib/core/components/Form/Controller/Controller.js +2 -2
  60. package/build/esm/lib/core/components/Form/Controller/types.d.ts +6 -6
  61. package/build/esm/lib/core/components/Form/Controller/utils.d.ts +10 -10
  62. package/build/esm/lib/core/components/Form/Controller/utils.js +45 -34
  63. package/build/esm/lib/core/components/Form/DynamicField.js +6 -4
  64. package/build/esm/lib/core/components/Form/hooks/useCreateContext.js +2 -2
  65. package/build/esm/lib/core/components/Form/hooks/useCreateSearchContext.js +2 -2
  66. package/build/esm/lib/core/components/Form/hooks/useGenerateRandomValue.d.ts +1 -1
  67. package/build/esm/lib/core/components/Form/hooks/useIntegrationFF.js +6 -4
  68. package/build/esm/lib/core/components/Form/hooks/useMutators.js +11 -7
  69. package/build/esm/lib/core/components/Form/hooks/useSearchStore.js +4 -3
  70. package/build/esm/lib/core/components/Form/hooks/useStore.js +15 -11
  71. package/build/esm/lib/core/components/Form/types/array.d.ts +12 -12
  72. package/build/esm/lib/core/components/Form/types/boolean.d.ts +12 -12
  73. package/build/esm/lib/core/components/Form/types/config.d.ts +1 -1
  74. package/build/esm/lib/core/components/Form/types/input.d.ts +13 -13
  75. package/build/esm/lib/core/components/Form/types/layout.d.ts +5 -5
  76. package/build/esm/lib/core/components/Form/types/number.d.ts +12 -12
  77. package/build/esm/lib/core/components/Form/types/object.d.ts +12 -12
  78. package/build/esm/lib/core/components/Form/types/string.d.ts +12 -12
  79. package/build/esm/lib/core/components/Form/utils/common.js +14 -11
  80. package/build/esm/lib/core/components/View/ViewController.d.ts +1 -1
  81. package/build/esm/lib/core/components/View/helpers.js +5 -5
  82. package/build/esm/lib/core/components/View/hooks/useComponents.d.ts +1 -1
  83. package/build/esm/lib/core/components/View/hooks/useComponents.js +2 -2
  84. package/build/esm/lib/core/components/View/hooks/useCreateContext.js +2 -2
  85. package/build/esm/lib/core/components/View/hooks/useRender.d.ts +1 -1
  86. package/build/esm/lib/core/components/View/hooks/useRender.js +4 -3
  87. package/build/esm/lib/core/helpers.d.ts +5 -5
  88. package/build/esm/lib/core/helpers.js +5 -4
  89. package/build/esm/lib/core/types/specs.d.ts +6 -6
  90. package/build/esm/lib/kit/components/AccordeonCard/AccordeonCard.js +2 -2
  91. package/build/esm/lib/kit/components/Card/Card.css +3 -2
  92. package/build/esm/lib/kit/components/Card/Card.js +2 -2
  93. package/build/esm/lib/kit/components/CopyButton/CopyButton.js +1 -1
  94. package/build/esm/lib/kit/components/ErrorWrapper/ErrorWrapper.css +4 -1
  95. package/build/esm/lib/kit/components/GenerateRandomValueButton/GenerateRandomValueButton.js +2 -2
  96. package/build/esm/lib/kit/components/Inputs/ArrayBase/ArrayBase.js +2 -2
  97. package/build/esm/lib/kit/components/Inputs/CardOneOf/CardOneOf.js +2 -2
  98. package/build/esm/lib/kit/components/Inputs/MonacoInput/MonacoInputDialog.css +2 -2
  99. package/build/esm/lib/kit/components/Inputs/MultiOneOf/MultiOneOf.js +4 -3
  100. package/build/esm/lib/kit/components/Inputs/ObjectBase/ObjectBase.js +4 -3
  101. package/build/esm/lib/kit/components/Inputs/ObjectValueInput/ObjectValueInput.js +4 -3
  102. package/build/esm/lib/kit/components/Inputs/OneOf/OneOf.js +2 -2
  103. package/build/esm/lib/kit/components/Inputs/Secret/Secret.js +4 -3
  104. package/build/esm/lib/kit/components/Inputs/TableArrayInput/TableArrayInput.css +8 -2
  105. package/build/esm/lib/kit/components/Inputs/TableArrayInput/TableArrayInput.js +4 -3
  106. package/build/esm/lib/kit/components/Inputs/Text/Text.js +2 -2
  107. package/build/esm/lib/kit/components/Inputs/TextContent/TextContent.css +2 -2
  108. package/build/esm/lib/kit/components/Inputs/TextContent/TextContent.js +2 -2
  109. package/build/esm/lib/kit/components/Inputs/TextLink/TextLink.js +4 -3
  110. package/build/esm/lib/kit/components/Layouts/Accordeon/Accordeon.d.ts +1 -1
  111. package/build/esm/lib/kit/components/Layouts/AccordeonCard/AccordeonCardForm.d.ts +1 -1
  112. package/build/esm/lib/kit/components/Layouts/CardAccordeon.d.ts +1 -1
  113. package/build/esm/lib/kit/components/Layouts/CardSection.d.ts +1 -1
  114. package/build/esm/lib/kit/components/Layouts/Row/Row.css +2 -2
  115. package/build/esm/lib/kit/components/Layouts/Row/Row.d.ts +2 -2
  116. package/build/esm/lib/kit/components/Layouts/Row/Row.js +2 -2
  117. package/build/esm/lib/kit/components/Layouts/Section/Section.css +2 -2
  118. package/build/esm/lib/kit/components/Layouts/Section/Section.d.ts +6 -6
  119. package/build/esm/lib/kit/components/Layouts/TableCell/TableCell.d.ts +1 -1
  120. package/build/esm/lib/kit/components/Layouts/Transparent/Transparent.d.ts +1 -1
  121. package/build/esm/lib/kit/components/LazyLoader/LazyLoader.js +2 -2
  122. package/build/esm/lib/kit/components/LongValue/LongValue.css +3 -0
  123. package/build/esm/lib/kit/components/LongValue/LongValue.js +1 -1
  124. package/build/esm/lib/kit/components/SimpleVerticalAccordeon/SimpleVerticalAccordeon.css +2 -2
  125. package/build/esm/lib/kit/components/ViewLayouts/ViewAccordeon/ViewAccordeon.js +2 -2
  126. package/build/esm/lib/kit/components/ViewLayouts/ViewAccordeonCard/ViewAccordeonCard.js +2 -2
  127. package/build/esm/lib/kit/components/ViewLayouts/ViewCardAccordeon.js +2 -2
  128. package/build/esm/lib/kit/components/ViewLayouts/ViewCardSection.d.ts +1 -1
  129. package/build/esm/lib/kit/components/ViewLayouts/ViewRow/ViewRow.d.ts +1 -1
  130. package/build/esm/lib/kit/components/ViewLayouts/ViewSection/ViewSection.d.ts +4 -4
  131. package/build/esm/lib/kit/components/ViewLayouts/ViewTableCell/ViewTableCell.d.ts +1 -1
  132. package/build/esm/lib/kit/components/ViewLayouts/ViewTransparent/ViewTransparent.d.ts +1 -1
  133. package/build/esm/lib/kit/components/Views/ArrayBaseView/ArrayBaseView.js +2 -2
  134. package/build/esm/lib/kit/components/Views/BaseView/BaseView.js +2 -2
  135. package/build/esm/lib/kit/components/Views/CardOneOfView.js +2 -2
  136. package/build/esm/lib/kit/components/Views/MonacoInputView/MonacoViewDialog.css +1 -1
  137. package/build/esm/lib/kit/components/Views/MultiOneOfView/MultiOneOfView.js +2 -2
  138. package/build/esm/lib/kit/components/Views/ObjectBaseView/ObjectBaseView.js +2 -2
  139. package/build/esm/lib/kit/components/Views/ObjectValueInputView/ObjectValueInputView.js +2 -2
  140. package/build/esm/lib/kit/components/Views/OneOfView/OneOfView.js +2 -2
  141. package/build/esm/lib/kit/components/Views/TextLinkView/TextLinkView.js +2 -2
  142. package/build/esm/lib/kit/hooks/useOneOf/useOneOf.d.ts +1 -1
  143. package/build/esm/lib/kit/hooks/useOneOf/useOneOf.js +5 -4
  144. package/build/esm/lib/kit/utils/common.d.ts +1 -1
  145. package/build/esm/lib/kit/utils/common.js +30 -25
  146. package/build/esm/lib/kit/utils/objectInline.d.ts +1 -1
  147. package/build/esm/lib/kit/validators/validators.js +9 -7
  148. package/package.json +11 -11
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ObjectValueInputView = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importDefault(require("react"));
6
- const lodash_1 = tslib_1.__importDefault(require("lodash"));
6
+ const cloneDeep_1 = tslib_1.__importDefault(require("lodash/cloneDeep"));
7
7
  const core_1 = require("../../../../core");
8
8
  const OBJECT_VALUE_PROPERTY_NAME = 'value';
9
9
  const ObjectValueInputView = (_a) => {
@@ -11,7 +11,7 @@ const ObjectValueInputView = (_a) => {
11
11
  const childSpec = react_1.default.useMemo(() => {
12
12
  var _a;
13
13
  if ((_a = spec.properties) === null || _a === void 0 ? void 0 : _a[OBJECT_VALUE_PROPERTY_NAME]) {
14
- const childSpec = lodash_1.default.cloneDeep(spec.properties[OBJECT_VALUE_PROPERTY_NAME]);
14
+ const childSpec = (0, cloneDeep_1.default)(spec.properties[OBJECT_VALUE_PROPERTY_NAME]);
15
15
  childSpec.viewSpec.layout = '';
16
16
  return childSpec;
17
17
  }
@@ -3,14 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.OneOfFlatView = exports.OneOfView = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importDefault(require("react"));
6
- const lodash_1 = tslib_1.__importDefault(require("lodash"));
6
+ const isObjectLike_1 = tslib_1.__importDefault(require("lodash/isObjectLike"));
7
7
  const __1 = require("../../");
8
8
  const core_1 = require("../../../../core");
9
9
  const utils_1 = require("../../../utils");
10
10
  const b = (0, utils_1.block)('oneof-view');
11
11
  const OneOfViewComponent = (props) => {
12
12
  const { value = {}, spec, Layout, name } = props;
13
- const specProperties = react_1.default.useMemo(() => (lodash_1.default.isObjectLike(spec.properties) ? spec.properties : {}), [spec.properties]);
13
+ const specProperties = react_1.default.useMemo(() => ((0, isObjectLike_1.default)(spec.properties) ? spec.properties : {}), [spec.properties]);
14
14
  const valueKey = react_1.default.useMemo(() => Object.keys(value)[0], [value]);
15
15
  const valueName = react_1.default.useMemo(() => {
16
16
  var _a, _b;
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TextLinkView = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importDefault(require("react"));
6
- const lodash_1 = tslib_1.__importDefault(require("lodash"));
6
+ const cloneDeep_1 = tslib_1.__importDefault(require("lodash/cloneDeep"));
7
7
  const core_1 = require("../../../../core");
8
8
  const TEXT_LINK_PROPERTY_NAME = 'text';
9
9
  const TextLinkView = (_a) => {
@@ -12,7 +12,7 @@ const TextLinkView = (_a) => {
12
12
  var _a;
13
13
  if (((_a = spec.properties) === null || _a === void 0 ? void 0 : _a[TEXT_LINK_PROPERTY_NAME]) &&
14
14
  (0, core_1.isStringSpec)(spec.properties[TEXT_LINK_PROPERTY_NAME])) {
15
- const childSpec = lodash_1.default.cloneDeep(spec.properties[TEXT_LINK_PROPERTY_NAME]);
15
+ const childSpec = (0, cloneDeep_1.default)(spec.properties[TEXT_LINK_PROPERTY_NAME]);
16
16
  childSpec.viewSpec.layout = '';
17
17
  childSpec.viewSpec.link = value === null || value === void 0 ? void 0 : value.link;
18
18
  return childSpec;
@@ -4,7 +4,8 @@ exports.useOneOf = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importDefault(require("react"));
6
6
  const uikit_1 = require("@gravity-ui/uikit");
7
- const lodash_1 = tslib_1.__importDefault(require("lodash"));
7
+ const isObjectLike_1 = tslib_1.__importDefault(require("lodash/isObjectLike"));
8
+ const some_1 = tslib_1.__importDefault(require("lodash/some"));
8
9
  const components_1 = require("../../components");
9
10
  const utils_1 = require("../../utils");
10
11
  const b = (0, utils_1.block)('use-oneof');
@@ -12,10 +13,10 @@ const MAX_TAB_TITLE_LENGTH = 20;
12
13
  const useOneOf = ({ props, onTogglerChange }) => {
13
14
  var _a;
14
15
  const { name, input, spec, Layout } = props;
15
- const specProperties = react_1.default.useMemo(() => (lodash_1.default.isObjectLike(spec.properties) ? spec.properties : {}), [spec.properties]);
16
+ const specProperties = react_1.default.useMemo(() => ((0, isObjectLike_1.default)(spec.properties) ? spec.properties : {}), [spec.properties]);
16
17
  const [oneOfValue, setOneOfValue] = react_1.default.useState(() => {
17
18
  let valueKeys;
18
- if (lodash_1.default.isObjectLike(input.value)) {
19
+ if ((0, isObjectLike_1.default)(input.value)) {
19
20
  const keys = Object.keys(input.value);
20
21
  if (keys.length) {
21
22
  valueKeys = keys;
@@ -50,7 +51,7 @@ const useOneOf = ({ props, onTogglerChange }) => {
50
51
  if (((_b = spec.viewSpec.oneOfParams) === null || _b === void 0 ? void 0 : _b.toggler) !== 'radio' &&
51
52
  (((_c = spec.viewSpec.oneOfParams) === null || _c === void 0 ? void 0 : _c.toggler) === 'select' ||
52
53
  options.length > 3 ||
53
- lodash_1.default.some(options, ({ title }) => title.length > MAX_TAB_TITLE_LENGTH))) {
54
+ (0, some_1.default)(options, ({ title }) => title.length > MAX_TAB_TITLE_LENGTH))) {
54
55
  return 'select';
55
56
  }
56
57
  return 'radio';
@@ -2,16 +2,21 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isCorrectSizeParams = exports.prepareSpec = exports.isNotEmptyValue = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const lodash_1 = tslib_1.__importDefault(require("lodash"));
5
+ const cloneDeep_1 = tslib_1.__importDefault(require("lodash/cloneDeep"));
6
+ const isArray_1 = tslib_1.__importDefault(require("lodash/isArray"));
7
+ const isNil_1 = tslib_1.__importDefault(require("lodash/isNil"));
8
+ const isObject_1 = tslib_1.__importDefault(require("lodash/isObject"));
9
+ const isObjectLike_1 = tslib_1.__importDefault(require("lodash/isObjectLike"));
10
+ const isString_1 = tslib_1.__importDefault(require("lodash/isString"));
6
11
  const core_1 = require("../../core");
7
12
  const helpers_1 = require("../validators/helpers");
8
13
  const bigIntMath_1 = require("./bigIntMath");
9
14
  const isNotEmptyValue = (value, spec) => {
10
15
  var _a;
11
- if (lodash_1.default.isNil(value)) {
16
+ if ((0, isNil_1.default)(value)) {
12
17
  return false;
13
18
  }
14
- if (lodash_1.default.isString(value)) {
19
+ if ((0, isString_1.default)(value)) {
15
20
  if (!value) {
16
21
  return false;
17
22
  }
@@ -19,7 +24,7 @@ const isNotEmptyValue = (value, spec) => {
19
24
  return false;
20
25
  }
21
26
  }
22
- if (lodash_1.default.isObject(value) && (0, core_1.isObjectSpec)(spec)) {
27
+ if ((0, isObject_1.default)(value) && (0, core_1.isObjectSpec)(spec)) {
23
28
  const keys = Object.keys(value);
24
29
  // the only case when an empty object is considered a non-empty value is when it is a stub for oneof
25
30
  if (!keys.filter((key) => { var _a; return (0, exports.isNotEmptyValue)(value[key], (_a = spec.properties) === null || _a === void 0 ? void 0 : _a[key]); }).length &&
@@ -27,7 +32,7 @@ const isNotEmptyValue = (value, spec) => {
27
32
  return false;
28
33
  }
29
34
  }
30
- if (lodash_1.default.isArray(value) &&
35
+ if ((0, isArray_1.default)(value) &&
31
36
  (0, core_1.isArraySpec)(spec) &&
32
37
  !value.filter((item) => (0, exports.isNotEmptyValue)(item, spec.items)).length) {
33
38
  return false;
@@ -37,12 +42,12 @@ const isNotEmptyValue = (value, spec) => {
37
42
  exports.isNotEmptyValue = isNotEmptyValue;
38
43
  const prepareSpec = (spec, parseJsonDefaultValue) => {
39
44
  var _a, _b, _c, _d, _e, _f, _g, _h;
40
- if (lodash_1.default.isObjectLike(spec)) {
41
- const result = lodash_1.default.cloneDeep(spec);
42
- if (lodash_1.default.isString(result.type)) {
45
+ if ((0, isObjectLike_1.default)(spec)) {
46
+ const result = (0, cloneDeep_1.default)(spec);
47
+ if ((0, isString_1.default)(result.type)) {
43
48
  result.type = result.type.toLowerCase();
44
49
  }
45
- if (!lodash_1.default.isNil(result.defaultValue)) {
50
+ if (!(0, isNil_1.default)(result.defaultValue)) {
46
51
  let _defaultValue = result.defaultValue;
47
52
  if (parseJsonDefaultValue) {
48
53
  try {
@@ -53,33 +58,33 @@ const prepareSpec = (spec, parseJsonDefaultValue) => {
53
58
  }
54
59
  }
55
60
  if (typeof _defaultValue === result.type ||
56
- (lodash_1.default.isArray(_defaultValue) && result.type === core_1.SpecTypes.Array)) {
61
+ ((0, isArray_1.default)(_defaultValue) && result.type === core_1.SpecTypes.Array)) {
57
62
  result.defaultValue = _defaultValue;
58
63
  }
59
64
  else {
60
65
  result.defaultValue = undefined;
61
66
  }
62
67
  }
63
- if (lodash_1.default.isString((_a = result.viewSpec) === null || _a === void 0 ? void 0 : _a.type)) {
68
+ if ((0, isString_1.default)((_a = result.viewSpec) === null || _a === void 0 ? void 0 : _a.type)) {
64
69
  result.viewSpec.type = result.viewSpec.type.toLowerCase();
65
70
  }
66
- if (lodash_1.default.isString((_b = result.viewSpec) === null || _b === void 0 ? void 0 : _b.layout)) {
71
+ if ((0, isString_1.default)((_b = result.viewSpec) === null || _b === void 0 ? void 0 : _b.layout)) {
67
72
  result.viewSpec.layout = result.viewSpec.layout.toLowerCase();
68
73
  }
69
- if (lodash_1.default.isString((_c = result.viewSpec) === null || _c === void 0 ? void 0 : _c.addButtonPosition)) {
74
+ if ((0, isString_1.default)((_c = result.viewSpec) === null || _c === void 0 ? void 0 : _c.addButtonPosition)) {
70
75
  result.viewSpec.addButtonPosition = result.viewSpec.addButtonPosition.toLowerCase();
71
76
  }
72
- if (lodash_1.default.isString((_d = result.viewSpec) === null || _d === void 0 ? void 0 : _d.themeLabel)) {
77
+ if ((0, isString_1.default)((_d = result.viewSpec) === null || _d === void 0 ? void 0 : _d.themeLabel)) {
73
78
  result.viewSpec.textContentParams = Object.assign(Object.assign({}, result.viewSpec.textContentParams), { themeLabel: result.viewSpec.themeLabel.toLowerCase() });
74
79
  }
75
- if (lodash_1.default.isString((_f = (_e = result.viewSpec) === null || _e === void 0 ? void 0 : _e.oneOfParams) === null || _f === void 0 ? void 0 : _f.toggler)) {
80
+ if ((0, isString_1.default)((_f = (_e = result.viewSpec) === null || _e === void 0 ? void 0 : _e.oneOfParams) === null || _f === void 0 ? void 0 : _f.toggler)) {
76
81
  result.viewSpec.oneOfParams.toggler = result.viewSpec.oneOfParams.toggler.toLowerCase();
77
82
  }
78
- if (lodash_1.default.isString((_h = (_g = result.viewSpec) === null || _g === void 0 ? void 0 : _g.textContentParams) === null || _h === void 0 ? void 0 : _h.themeLabel)) {
83
+ if ((0, isString_1.default)((_h = (_g = result.viewSpec) === null || _g === void 0 ? void 0 : _g.textContentParams) === null || _h === void 0 ? void 0 : _h.themeLabel)) {
79
84
  result.viewSpec.textContentParams.themeLabel =
80
85
  result.viewSpec.textContentParams.themeLabel.toLowerCase();
81
86
  }
82
- if (lodash_1.default.isString(result.validator)) {
87
+ if ((0, isString_1.default)(result.validator)) {
83
88
  result.validator = result.validator.toLowerCase();
84
89
  }
85
90
  if (result.maxLength === '0' &&
@@ -88,10 +93,10 @@ const prepareSpec = (spec, parseJsonDefaultValue) => {
88
93
  result.minLength = undefined;
89
94
  }
90
95
  else {
91
- if (!lodash_1.default.isNil(result.maxLength) && (0, helpers_1.isFloat)(`${result.maxLength}`)) {
96
+ if (!(0, isNil_1.default)(result.maxLength) && (0, helpers_1.isFloat)(`${result.maxLength}`)) {
92
97
  result.maxLength = BigInt(result.maxLength);
93
98
  }
94
- if (!lodash_1.default.isNil(result.minLength) && (0, helpers_1.isFloat)(`${result.minLength}`)) {
99
+ if (!(0, isNil_1.default)(result.minLength) && (0, helpers_1.isFloat)(`${result.minLength}`)) {
95
100
  result.minLength = BigInt(result.minLength);
96
101
  }
97
102
  }
@@ -103,17 +108,17 @@ const prepareSpec = (spec, parseJsonDefaultValue) => {
103
108
  result.minimum = undefined;
104
109
  }
105
110
  else {
106
- if (!lodash_1.default.isNil(result.maximum) && (0, helpers_1.isFloat)(`${result.maximum}`)) {
111
+ if (!(0, isNil_1.default)(result.maximum) && (0, helpers_1.isFloat)(`${result.maximum}`)) {
107
112
  result.maximum = Number(result.maximum);
108
113
  }
109
- if (!lodash_1.default.isNil(result.minimum) && (0, helpers_1.isFloat)(`${result.minimum}`)) {
114
+ if (!(0, isNil_1.default)(result.minimum) && (0, helpers_1.isFloat)(`${result.minimum}`)) {
110
115
  result.minimum = Number(result.minimum);
111
116
  }
112
117
  }
113
- if (lodash_1.default.isString(result.format)) {
118
+ if ((0, isString_1.default)(result.format)) {
114
119
  result.format = result.format.toLowerCase();
115
120
  }
116
- if (lodash_1.default.isObjectLike(result.properties)) {
121
+ if ((0, isObjectLike_1.default)(result.properties)) {
117
122
  Object.keys(result.properties).forEach((key) => {
118
123
  result.properties[key] = (0, exports.prepareSpec)(result.properties[key], parseJsonDefaultValue);
119
124
  });
@@ -126,8 +131,8 @@ exports.prepareSpec = prepareSpec;
126
131
  const isCorrectSizeParams = (spec) => {
127
132
  const { sizeParams } = spec.viewSpec;
128
133
  if (!sizeParams ||
129
- !lodash_1.default.isString(sizeParams.defaultType) ||
130
- !lodash_1.default.isObject(sizeParams.scale) ||
134
+ !(0, isString_1.default)(sizeParams.defaultType) ||
135
+ !(0, isObject_1.default)(sizeParams.scale) ||
131
136
  !sizeParams.scale[sizeParams.defaultType] ||
132
137
  Object.values(sizeParams.scale).some(({ factor }) => !(0, bigIntMath_1.divide)(factor, factor))) {
133
138
  return false;
@@ -2,7 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getStringValidator = exports.getObjectValidator = exports.getNumberValidator = exports.getBooleanValidator = exports.getArrayValidator = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const lodash_1 = tslib_1.__importDefault(require("lodash"));
5
+ const isArray_1 = tslib_1.__importDefault(require("lodash/isArray"));
6
+ const isNumber_1 = tslib_1.__importDefault(require("lodash/isNumber"));
7
+ const isString_1 = tslib_1.__importDefault(require("lodash/isString"));
6
8
  const validators_1 = require("../validators");
7
9
  const helpers_1 = require("./helpers");
8
10
  const getArrayValidator = (params = {}) => {
@@ -10,7 +12,7 @@ const getArrayValidator = (params = {}) => {
10
12
  return (spec, value) => {
11
13
  const errorMessages = Object.assign(Object.assign({}, validators_1.ErrorMessages), customErrorMessages);
12
14
  const valueLength = (value === null || value === void 0 ? void 0 : value.length) || 0;
13
- if (!ignoreRequiredCheck && spec.required && !lodash_1.default.isArray(value)) {
15
+ if (!ignoreRequiredCheck && spec.required && !(0, isArray_1.default)(value)) {
14
16
  return errorMessages.REQUIRED;
15
17
  }
16
18
  if (!ignoreMaxLengthCheck &&
@@ -69,18 +71,18 @@ const getNumberValidator = (params = {}) => {
69
71
  }
70
72
  }
71
73
  if (!ignoreMaximumCheck &&
72
- lodash_1.default.isNumber(spec.maximum) &&
74
+ (0, isNumber_1.default)(spec.maximum) &&
73
75
  stringValue.length &&
74
76
  Number(stringValue) > spec.maximum) {
75
77
  return errorMessages.maxNumber(spec.maximum);
76
78
  }
77
79
  if (!ignoreMinimumCheck &&
78
- lodash_1.default.isNumber(spec.minimum) &&
80
+ (0, isNumber_1.default)(spec.minimum) &&
79
81
  stringValue.length &&
80
82
  spec.minimum > Number(stringValue)) {
81
83
  return errorMessages.minNumber(spec.minimum);
82
84
  }
83
- if (lodash_1.default.isString(spec.format) && stringValue.length) {
85
+ if ((0, isString_1.default)(spec.format) && stringValue.length) {
84
86
  if (!ignoreIntCheck && spec.format === 'int64' && !(0, helpers_1.isInt)(stringValue)) {
85
87
  return errorMessages.INT;
86
88
  }
@@ -127,10 +129,10 @@ const getStringValidator = (params = {}) => {
127
129
  valueLength < spec.minLength) {
128
130
  return errorMessages.minLength(spec.minLength);
129
131
  }
130
- if (lodash_1.default.isString(spec.pattern) && spec.pattern.length) {
132
+ if ((0, isString_1.default)(spec.pattern) && spec.pattern.length) {
131
133
  const regex = new RegExp(spec.pattern);
132
134
  if (!ignoreRegExpCheck && !regex.test(value)) {
133
- return lodash_1.default.isString(spec.patternError) && spec.patternError.length
135
+ return (0, isString_1.default)(spec.patternError) && spec.patternError.length
134
136
  ? spec.patternError
135
137
  : errorMessages.INVALID;
136
138
  }
@@ -7,4 +7,4 @@ export interface ControllerProps<DirtyValue extends FieldValue, SpecType extends
7
7
  parentOnChange: ((childName: string, childValue: FieldValue, childErrors: Record<string, ValidateError>) => void) | null;
8
8
  parentOnUnmount: ((childName: string) => void) | null;
9
9
  }
10
- export declare const Controller: <DirtyValue extends FieldValue, Value extends FormValue, SpecType extends Spec>({ spec: _spec, name, value: valueFromParent, parentOnChange, parentOnUnmount, }: ControllerProps<DirtyValue, SpecType>) => JSX.Element | null;
10
+ export declare const Controller: <DirtyValue extends FieldValue, Value extends FormValue, SpecType extends Spec<any, undefined, undefined>>({ spec: _spec, name, value: valueFromParent, parentOnChange, parentOnUnmount, }: ControllerProps<DirtyValue, SpecType>) => JSX.Element | null;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import _ from 'lodash';
2
+ import omit from 'lodash/omit';
3
3
  import { useControllerMirror, useDynamicFormsCtx, useSearch } from '../hooks';
4
4
  import { callUnmout, getFieldMethods, initializeStore, updateStore } from './utils';
5
5
  export const Controller = ({ spec: _spec, name, value: valueFromParent, parentOnChange, parentOnUnmount, }) => {
@@ -68,7 +68,7 @@ export const Controller = ({ spec: _spec, name, value: valueFromParent, parentOn
68
68
  onItemRemove: methods.onItemRemove,
69
69
  onDrop: methods.onDrop,
70
70
  },
71
- meta: Object.assign(Object.assign({}, _.omit(store.state, 'value')), { submitFailed: store.tools.submitFailed }),
71
+ meta: Object.assign(Object.assign({}, omit(store.state, 'value')), { submitFailed: store.tools.submitFailed }),
72
72
  }), [methods, store.name, store.state, store.tools.submitFailed]);
73
73
  const withSearch = useSearch(store.spec, store.state.value, store.name);
74
74
  useControllerMirror(store.name, {
@@ -10,15 +10,15 @@ export interface GetComponentsParams<SpecType extends Spec> {
10
10
  spec: SpecType;
11
11
  config: DynamicFormConfig;
12
12
  }
13
- export interface GetComponentsReturn<DirtyValue extends FieldValue, SpecType extends Spec> {
14
- inputEntity?: InputEntity<DirtyValue, SpecType> | IndependentInputEntity<DirtyValue, SpecType>;
15
- Layout?: LayoutType<DirtyValue, SpecType>;
13
+ export interface GetComponentsReturn<DirtyValue extends FieldValue, SpecType extends Spec<undefined, undefined, undefined>> {
14
+ inputEntity?: InputEntity<DirtyValue, undefined, undefined, SpecType> | IndependentInputEntity<DirtyValue, undefined, undefined, SpecType>;
15
+ Layout?: LayoutType<DirtyValue, undefined, undefined, SpecType>;
16
16
  }
17
- export interface GetRenderParams<DirtyValue extends FieldValue, SpecType extends Spec> {
17
+ export interface GetRenderParams<DirtyValue extends FieldValue, SpecType extends Spec<undefined, undefined, undefined>> {
18
18
  name: string;
19
19
  spec: SpecType;
20
- inputEntity?: InputEntity<DirtyValue, SpecType> | IndependentInputEntity<DirtyValue, SpecType>;
21
- Layout?: LayoutType<DirtyValue, SpecType>;
20
+ inputEntity?: InputEntity<DirtyValue, undefined, undefined, SpecType> | IndependentInputEntity<DirtyValue, undefined, undefined, SpecType>;
21
+ Layout?: LayoutType<DirtyValue, undefined, undefined, SpecType>;
22
22
  }
23
23
  export interface GetValidateParams<SpecType extends Spec> {
24
24
  spec: SpecType;
@@ -1,13 +1,13 @@
1
1
  import { FormValue, Spec } from '../../../types';
2
2
  import { BaseValidateError, FieldRenderProps, FieldValue, ValidateError } from '../types';
3
3
  import { ControllerStore, GetComponentsParams, GetComponentsReturn, GetFieldInitialsParams, GetFieldMethodsReturn, GetRenderParams, GetSpecParams, GetValidateParams, InitializeStoreParams, UpdateStoreParams } from './types';
4
- export declare const updateParentStore: <DirtyValue extends FieldValue, Value extends FormValue, SpecType extends Spec>(store: ControllerStore<DirtyValue, Value, SpecType>) => void;
5
- export declare const callUnmout: <DirtyValue extends FieldValue, Value extends FormValue, SpecType extends Spec>(store: ControllerStore<DirtyValue, Value, SpecType>) => void;
6
- export declare const getSpec: <SpecType extends Spec>({ name, spec, mutatorsStore, }: GetSpecParams<SpecType>) => SpecType;
7
- export declare const getComponents: <DirtyValue extends FieldValue, Value extends FormValue, SpecType extends Spec>({ spec, config, }: GetComponentsParams<SpecType>) => GetComponentsReturn<DirtyValue, SpecType>;
8
- export declare const getRender: <DirtyValue extends FieldValue, SpecType extends Spec>({ name, spec, inputEntity, Layout, }: GetRenderParams<DirtyValue, SpecType>) => (props: FieldRenderProps<DirtyValue>) => JSX.Element | null;
9
- export declare const getValidate: <DirtyValue extends FieldValue, Value extends FormValue, SpecType extends Spec>({ spec, config, }: GetValidateParams<SpecType>) => (value?: Value | undefined) => ValidateError;
10
- export declare const getFieldInitials: <DirtyValue extends FieldValue, Value extends FormValue, SpecType extends Spec>({ name, spec, valueFromParent, initialValue, validate, mutatorsStore, }: GetFieldInitialsParams<DirtyValue, Value, SpecType>) => {
4
+ export declare const updateParentStore: <DirtyValue extends FieldValue, Value extends FormValue, SpecType extends Spec<any, undefined, undefined>>(store: ControllerStore<DirtyValue, Value, SpecType>) => void;
5
+ export declare const callUnmout: <DirtyValue extends FieldValue, Value extends FormValue, SpecType extends Spec<any, undefined, undefined>>(store: ControllerStore<DirtyValue, Value, SpecType>) => void;
6
+ export declare const getSpec: <SpecType extends Spec<any, undefined, undefined>>({ name, spec, mutatorsStore, }: GetSpecParams<SpecType>) => SpecType;
7
+ export declare const getComponents: <DirtyValue extends FieldValue, Value extends FormValue, SpecType extends Spec<any, undefined, undefined>>({ spec, config, }: GetComponentsParams<SpecType>) => GetComponentsReturn<DirtyValue, SpecType>;
8
+ export declare const getRender: <DirtyValue extends FieldValue, SpecType extends Spec<any, undefined, undefined>>({ name, spec, inputEntity, Layout, }: GetRenderParams<DirtyValue, SpecType>) => (props: FieldRenderProps<DirtyValue>) => JSX.Element | null;
9
+ export declare const getValidate: <DirtyValue extends FieldValue, Value extends FormValue, SpecType extends Spec<any, undefined, undefined>>({ spec, config, }: GetValidateParams<SpecType>) => (value?: Value | undefined) => ValidateError;
10
+ export declare const getFieldInitials: <DirtyValue extends FieldValue, Value extends FormValue, SpecType extends Spec<any, undefined, undefined>>({ name, spec, valueFromParent, initialValue, validate, mutatorsStore, }: GetFieldInitialsParams<DirtyValue, Value, SpecType>) => {
11
11
  initialValue: DirtyValue;
12
12
  active: boolean;
13
13
  dirty: boolean;
@@ -21,6 +21,6 @@ export declare const getFieldInitials: <DirtyValue extends FieldValue, Value ext
21
21
  visited: boolean;
22
22
  childErrors: {};
23
23
  };
24
- export declare const getFieldMethods: <DirtyValue extends FieldValue, Value extends FormValue, SpecType extends Spec>() => GetFieldMethodsReturn<DirtyValue, Value, SpecType>;
25
- export declare const initializeStore: <DirtyValue extends FieldValue, Value extends FormValue, SpecType extends Spec>({ name, spec: _spec, mutatorsStore, config, valueFromParent, tools, parentOnChange, parentOnUnmount, }: InitializeStoreParams<DirtyValue, SpecType>) => ControllerStore<DirtyValue, Value, SpecType>;
26
- export declare const updateStore: <DirtyValue extends FieldValue, Value extends FormValue, SpecType extends Spec>({ store, setStore, spec: _spec, name, parentOnChange, parentOnUnmount, mutatorsStore, valueFromParent, config, tools, methodOnChange, }: UpdateStoreParams<DirtyValue, Value, SpecType>) => void;
24
+ export declare const getFieldMethods: <DirtyValue extends FieldValue, Value extends FormValue, SpecType extends Spec<any, undefined, undefined>>() => GetFieldMethodsReturn<DirtyValue, Value, SpecType>;
25
+ export declare const initializeStore: <DirtyValue extends FieldValue, Value extends FormValue, SpecType extends Spec<any, undefined, undefined>>({ name, spec: _spec, mutatorsStore, config, valueFromParent, tools, parentOnChange, parentOnUnmount, }: InitializeStoreParams<DirtyValue, SpecType>) => ControllerStore<DirtyValue, Value, SpecType>;
26
+ export declare const updateStore: <DirtyValue extends FieldValue, Value extends FormValue, SpecType extends Spec<any, undefined, undefined>>({ store, setStore, spec: _spec, name, parentOnChange, parentOnUnmount, mutatorsStore, valueFromParent, config, tools, methodOnChange, }: UpdateStoreParams<DirtyValue, Value, SpecType>) => void;
@@ -1,17 +1,28 @@
1
1
  import React from 'react';
2
- import _ from 'lodash';
2
+ import cloneDeep from 'lodash/cloneDeep';
3
+ import get from 'lodash/get';
4
+ import isArray from 'lodash/isArray';
5
+ import isBoolean from 'lodash/isBoolean';
6
+ import isEqual from 'lodash/isEqual';
7
+ import isFunction from 'lodash/isFunction';
8
+ import isNil from 'lodash/isNil';
9
+ import isString from 'lodash/isString';
10
+ import isUndefined from 'lodash/isUndefined';
11
+ import keys from 'lodash/keys';
12
+ import merge from 'lodash/merge';
13
+ import omit from 'lodash/omit';
3
14
  import { isValidElementType } from 'react-is';
4
15
  import { SpecTypes } from '../../../constants';
5
16
  import { isArraySpec, isCorrectSpec, isNumberSpec, isObjectSpec } from '../../../helpers';
6
17
  import { EMPTY_MUTATOR, OBJECT_ARRAY_CNT, OBJECT_ARRAY_FLAG } from '../constants';
7
18
  import { isArrayItem, isCorrectConfig, transformArrIn, transformArrOut } from '../utils';
8
19
  const isErrorMutatorCorrect = (errorMutator) => errorMutator !== EMPTY_MUTATOR &&
9
- (_.isString(errorMutator.value) ||
10
- _.isBoolean(errorMutator.value) ||
11
- _.isUndefined(errorMutator.value));
20
+ (isString(errorMutator.value) ||
21
+ isBoolean(errorMutator.value) ||
22
+ isUndefined(errorMutator.value));
12
23
  const isValueMutatorCorrect = (valueMutator, spec) => valueMutator !== EMPTY_MUTATOR &&
13
24
  (typeof valueMutator.value === spec.type ||
14
- (_.isArray(valueMutator.value) && spec.type === SpecTypes.Array) ||
25
+ (isArray(valueMutator.value) && spec.type === SpecTypes.Array) ||
15
26
  valueMutator.value === undefined);
16
27
  export const updateParentStore = (store) => {
17
28
  (store.parentOnChange ? store.parentOnChange : store.tools.onChange)(store.name, store.state.value, Object.assign(Object.assign({}, store.state.childErrors), { [store.name]: store.state.error }));
@@ -20,9 +31,9 @@ export const callUnmout = (store) => {
20
31
  (store.parentOnUnmount ? store.parentOnUnmount : store.tools.onUnmount)(store.name);
21
32
  };
22
33
  export const getSpec = ({ name, spec, mutatorsStore, }) => {
23
- const mutator = _.get(mutatorsStore.spec, name, EMPTY_MUTATOR);
34
+ const mutator = get(mutatorsStore.spec, name, EMPTY_MUTATOR);
24
35
  if (mutator !== EMPTY_MUTATOR) {
25
- const mutatedSpec = _.merge(_.cloneDeep(spec), mutator.value);
36
+ const mutatedSpec = merge(cloneDeep(spec), mutator.value);
26
37
  if (isCorrectSpec(mutatedSpec)) {
27
38
  return mutatedSpec;
28
39
  }
@@ -39,7 +50,7 @@ export const getComponents = ({ spec, config, }) => {
39
50
  result.inputEntity = entity;
40
51
  }
41
52
  }
42
- if (layouts && _.isString(spec.viewSpec.layout)) {
53
+ if (layouts && isString(spec.viewSpec.layout)) {
43
54
  const Component = layouts[spec.viewSpec.layout];
44
55
  if (isValidElementType(Component)) {
45
56
  result.Layout = Component;
@@ -50,7 +61,7 @@ export const getComponents = ({ spec, config, }) => {
50
61
  };
51
62
  export const getRender = ({ name, spec, inputEntity, Layout, }) => {
52
63
  const render = (props) => {
53
- if (inputEntity && isCorrectSpec(spec) && _.isString(name)) {
64
+ if (inputEntity && isCorrectSpec(spec) && isString(name)) {
54
65
  if (!spec.viewSpec.hidden) {
55
66
  const { layoutProps, inputProps } = spec.viewSpec;
56
67
  if (inputEntity.independent) {
@@ -71,14 +82,14 @@ export const getRender = ({ name, spec, inputEntity, Layout, }) => {
71
82
  };
72
83
  export const getValidate = ({ spec, config, }) => {
73
84
  let validate = () => undefined;
74
- if (isCorrectConfig(config) && isCorrectSpec(spec)) {
85
+ if (isCorrectConfig(config) && isCorrectSpec(spec) && !spec.viewSpec.hidden) {
75
86
  const { validators } = config[spec.type];
76
87
  if (validators) {
77
- if ((!_.isString(spec.validator) || !spec.validator.length) &&
78
- _.isFunction(validators.base)) {
88
+ if ((!isString(spec.validator) || !spec.validator.length) &&
89
+ isFunction(validators.base)) {
79
90
  validate = (value) => validators.base(spec, value);
80
91
  }
81
- if (_.isString(spec.validator) && _.isFunction(validators[spec.validator])) {
92
+ if (isString(spec.validator) && isFunction(validators[spec.validator])) {
82
93
  validate = (value) => validators[spec.validator](spec, value);
83
94
  }
84
95
  }
@@ -86,12 +97,12 @@ export const getValidate = ({ spec, config, }) => {
86
97
  return validate;
87
98
  };
88
99
  export const getFieldInitials = ({ name, spec, valueFromParent, initialValue, validate, mutatorsStore, }) => {
89
- const valueMutator = transformArrIn(_.get(mutatorsStore.values, name, EMPTY_MUTATOR));
90
- let value = _.cloneDeep(valueFromParent);
100
+ const valueMutator = transformArrIn(get(mutatorsStore.values, name, EMPTY_MUTATOR));
101
+ let value = cloneDeep(valueFromParent);
91
102
  if (isValueMutatorCorrect(valueMutator, spec)) {
92
103
  value = valueMutator.value;
93
104
  }
94
- if (_.isNil(value)) {
105
+ if (isNil(value)) {
95
106
  if (spec.defaultValue) {
96
107
  value = transformArrIn(spec.defaultValue);
97
108
  }
@@ -106,12 +117,12 @@ export const getFieldInitials = ({ name, spec, valueFromParent, initialValue, va
106
117
  }
107
118
  }
108
119
  }
109
- let errorMutator = _.get(mutatorsStore.errors, name, EMPTY_MUTATOR);
120
+ let errorMutator = get(mutatorsStore.errors, name, EMPTY_MUTATOR);
110
121
  if (!isErrorMutatorCorrect(errorMutator)) {
111
122
  errorMutator = { value: undefined };
112
123
  }
113
124
  const error = (validate === null || validate === void 0 ? void 0 : validate(transformArrOut(value))) || (errorMutator === null || errorMutator === void 0 ? void 0 : errorMutator.value);
114
- const dirty = !_.isEqual(value, initialValue);
125
+ const dirty = !isEqual(value, initialValue);
115
126
  return {
116
127
  initialValue,
117
128
  active: false,
@@ -130,7 +141,7 @@ export const getFieldInitials = ({ name, spec, valueFromParent, initialValue, va
130
141
  export const getFieldMethods = () => {
131
142
  const onChange = (store, { valOrSetter, childErrors, errorMutator }) => {
132
143
  const { state, validate, spec } = store;
133
- const _value = _.isFunction(valOrSetter) ? valOrSetter(state.value) : valOrSetter;
144
+ const _value = isFunction(valOrSetter) ? valOrSetter(state.value) : valOrSetter;
134
145
  const error = (validate === null || validate === void 0 ? void 0 : validate(transformArrOut(_value))) || errorMutator;
135
146
  let value = transformArrIn(_value);
136
147
  if (isNumberSpec(spec) && !error) {
@@ -138,13 +149,13 @@ export const getFieldMethods = () => {
138
149
  }
139
150
  let newChildErrors = Object.assign({}, state.childErrors);
140
151
  if (childErrors) {
141
- const nearestChildName = _.keys(childErrors).sort((a, b) => a.length - b.length)[0];
152
+ const nearestChildName = keys(childErrors).sort((a, b) => a.length - b.length)[0];
142
153
  if (nearestChildName) {
143
- const existingСhildNames = _.keys(newChildErrors).filter((childName) => childName.startsWith(nearestChildName));
144
- newChildErrors = Object.assign(Object.assign({}, _.omit(newChildErrors, existingСhildNames)), childErrors);
154
+ const existingСhildNames = keys(newChildErrors).filter((childName) => childName.startsWith(nearestChildName));
155
+ newChildErrors = Object.assign(Object.assign({}, omit(newChildErrors, existingСhildNames)), childErrors);
145
156
  }
146
157
  }
147
- const nextStore = Object.assign(Object.assign({}, store), { state: Object.assign(Object.assign({}, store.state), { dirty: !_.isEqual(value, state.initialValue), error, invalid: Boolean(error), modified: true, pristine: value === state.initialValue, touched: true, valid: !error, value, visited: true, childErrors: newChildErrors }) });
158
+ const nextStore = Object.assign(Object.assign({}, store), { state: Object.assign(Object.assign({}, store.state), { dirty: !isEqual(value, state.initialValue), error, invalid: Boolean(error), modified: true, pristine: value === state.initialValue, touched: true, valid: !error, value, visited: true, childErrors: newChildErrors }) });
148
159
  nextStore.afterStoreUpdateCB = () => updateParentStore(nextStore);
149
160
  return nextStore;
150
161
  };
@@ -170,7 +181,7 @@ export const getFieldMethods = () => {
170
181
  if (isArraySpec(spec) || isObjectSpec(spec)) {
171
182
  return onChange(store, {
172
183
  valOrSetter: (currentValue) => currentValue
173
- ? _.omit(currentValue, childName.split(`${name}.`)[1])
184
+ ? omit(currentValue, childName.split(`${name}.`)[1])
174
185
  : currentValue,
175
186
  childErrors: { [childName]: false },
176
187
  });
@@ -185,7 +196,7 @@ export const getFieldMethods = () => {
185
196
  });
186
197
  const value = Object.assign(Object.assign({}, stateValue), { [`<${stateValue[OBJECT_ARRAY_CNT]}>`]: transformArrIn(_value), [OBJECT_ARRAY_CNT]: stateValue[OBJECT_ARRAY_CNT] + 1 });
187
198
  const error = validate === null || validate === void 0 ? void 0 : validate(transformArrOut(value));
188
- const nextStore = Object.assign(Object.assign({}, store), { state: Object.assign(Object.assign({}, store.state), { dirty: !_.isEqual(value, store.state.initialValue), error, invalid: Boolean(error), modified: true, pristine: value === store.state.initialValue, touched: true, valid: !error, value, visited: true }) });
199
+ const nextStore = Object.assign(Object.assign({}, store), { state: Object.assign(Object.assign({}, store.state), { dirty: !isEqual(value, store.state.initialValue), error, invalid: Boolean(error), modified: true, pristine: value === store.state.initialValue, touched: true, valid: !error, value, visited: true }) });
189
200
  nextStore.afterStoreUpdateCB = () => updateParentStore(nextStore);
190
201
  return nextStore;
191
202
  };
@@ -213,7 +224,7 @@ export const initializeStore = ({ name, spec: _spec, mutatorsStore, config, valu
213
224
  valueFromParent,
214
225
  validate,
215
226
  mutatorsStore,
216
- initialValue: _.get(tools.initialValue, name),
227
+ initialValue: get(tools.initialValue, name),
217
228
  });
218
229
  const initialsStore = {
219
230
  name,
@@ -228,18 +239,18 @@ export const initializeStore = ({ name, spec: _spec, mutatorsStore, config, valu
228
239
  parentOnUnmount,
229
240
  state,
230
241
  };
231
- if (!_.isEqual(valueFromParent, state.value) || state.error) {
242
+ if (!isEqual(valueFromParent, state.value) || state.error) {
232
243
  initialsStore.afterStoreUpdateCB = () => updateParentStore(initialsStore);
233
244
  }
234
245
  return initialsStore;
235
246
  };
236
247
  export const updateStore = ({ store, setStore, spec: _spec, name, parentOnChange, parentOnUnmount, mutatorsStore, valueFromParent, config, tools, methodOnChange, }) => {
237
- const storeSpecMutator = _.get(store.mutatorsStore.spec, store.name, EMPTY_MUTATOR);
238
- const storeValueMutator = _.get(store.mutatorsStore.values, store.name, EMPTY_MUTATOR);
239
- const storeErrorMutator = _.get(store.mutatorsStore.errors, store.name, EMPTY_MUTATOR);
240
- const specMutator = _.get(mutatorsStore.spec, name, EMPTY_MUTATOR);
241
- const valueMutator = _.get(mutatorsStore.values, name, EMPTY_MUTATOR);
242
- const errorMutator = _.get(mutatorsStore.errors, name, EMPTY_MUTATOR);
248
+ const storeSpecMutator = get(store.mutatorsStore.spec, store.name, EMPTY_MUTATOR);
249
+ const storeValueMutator = get(store.mutatorsStore.values, store.name, EMPTY_MUTATOR);
250
+ const storeErrorMutator = get(store.mutatorsStore.errors, store.name, EMPTY_MUTATOR);
251
+ const specMutator = get(mutatorsStore.spec, name, EMPTY_MUTATOR);
252
+ const valueMutator = get(mutatorsStore.values, name, EMPTY_MUTATOR);
253
+ const errorMutator = get(mutatorsStore.errors, name, EMPTY_MUTATOR);
243
254
  const valueMutatorUpdated = isValueMutatorCorrect(valueMutator, getSpec({ name, spec: _spec, mutatorsStore })) &&
244
255
  valueMutator !== storeValueMutator;
245
256
  const errorMutatorUpdated = isErrorMutatorCorrect(errorMutator) && errorMutator !== storeErrorMutator;
@@ -248,7 +259,7 @@ export const updateStore = ({ store, setStore, spec: _spec, name, parentOnChange
248
259
  parentOnUnmount !== store.parentOnUnmount ||
249
260
  tools.onChange !== store.tools.onChange ||
250
261
  tools.onUnmount !== store.tools.onUnmount;
251
- const updateAllStore = !_.isEqual(_spec, store.initialSpec) ||
262
+ const updateAllStore = !isEqual(_spec, store.initialSpec) ||
252
263
  config !== store.config ||
253
264
  (specMutator !== EMPTY_MUTATOR && specMutator !== storeSpecMutator);
254
265
  const updateAllStoreAndClearParentValues = name !== store.name;
@@ -1,5 +1,7 @@
1
1
  import React from 'react';
2
- import _ from 'lodash';
2
+ import isFunction from 'lodash/isFunction';
3
+ import isString from 'lodash/isString';
4
+ import get from 'lodash/get';
3
5
  import { isValidElementType } from 'react-is';
4
6
  import { isCorrectSpec } from '../../helpers';
5
7
  import { Controller } from './Controller';
@@ -25,9 +27,9 @@ export const DynamicField = ({ name, spec, config, Monaco, generateRandomValue,
25
27
  setField,
26
28
  removeField,
27
29
  isHiddenField,
28
- searchFunction: _.isFunction(search) ? search : getDefaultSearchFunction(search),
30
+ searchFunction: isFunction(search) ? search : getDefaultSearchFunction(search),
29
31
  }), [isHiddenField, removeField, search, setField]);
30
- const correctParams = React.useMemo(() => _.isString(name) && isCorrectSpec(spec) && isCorrectConfig(config), [name, spec, config]);
32
+ const correctParams = React.useMemo(() => isString(name) && isCorrectSpec(spec) && isCorrectConfig(config), [name, spec, config]);
31
33
  useDynamicFieldMirror({
32
34
  useStore: { tools, store },
33
35
  useIntegrationFF: watcher,
@@ -36,7 +38,7 @@ export const DynamicField = ({ name, spec, config, Monaco, generateRandomValue,
36
38
  if (correctParams) {
37
39
  return (React.createElement(DynamicFormsCtx.Provider, { value: context },
38
40
  React.createElement(SearchContext.Provider, { value: searchContext },
39
- React.createElement(Controller, { spec: spec, name: name, parentOnChange: null, parentOnUnmount: null, value: _.get(store.values, name) }),
41
+ React.createElement(Controller, { spec: spec, name: name, parentOnChange: null, parentOnUnmount: null, value: get(store.values, name) }),
40
42
  watcher)));
41
43
  }
42
44
  return null;
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import _ from 'lodash';
3
- const createContext = _.once(() => React.createContext({}));
2
+ import once from 'lodash/once';
3
+ const createContext = once(() => React.createContext({}));
4
4
  export const useCreateContext = () => createContext();
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import _ from 'lodash';
3
- const createContext = _.once(() => React.createContext({}));
2
+ import once from 'lodash/once';
3
+ const createContext = once(() => React.createContext({}));
4
4
  export const useCreateSearchContext = () => createContext();
@@ -1 +1 @@
1
- export declare const useGenerateRandomValue: () => ((spec: import("../../..").StringSpec<any, {}, {}>) => string) | undefined;
1
+ export declare const useGenerateRandomValue: () => ((spec: import("../../..").StringSpec<any, undefined, undefined>) => string) | undefined;