@gravity-ui/dynamic-forms 4.0.0 → 4.1.0

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 (105) 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.js +2 -2
  18. package/build/cjs/lib/kit/components/GenerateRandomValueButton/GenerateRandomValueButton.js +2 -2
  19. package/build/cjs/lib/kit/components/Inputs/ArrayBase/ArrayBase.js +2 -2
  20. package/build/cjs/lib/kit/components/Inputs/CardOneOf/CardOneOf.js +2 -2
  21. package/build/cjs/lib/kit/components/Inputs/MultiOneOf/MultiOneOf.js +4 -3
  22. package/build/cjs/lib/kit/components/Inputs/ObjectBase/ObjectBase.css +6 -0
  23. package/build/cjs/lib/kit/components/Inputs/ObjectBase/ObjectBase.js +11 -5
  24. package/build/cjs/lib/kit/components/Inputs/ObjectValueInput/ObjectValueInput.js +7 -6
  25. package/build/cjs/lib/kit/components/Inputs/OneOf/OneOf.js +2 -2
  26. package/build/cjs/lib/kit/components/Inputs/Secret/Secret.js +4 -3
  27. package/build/cjs/lib/kit/components/Inputs/TableArrayInput/TableArrayInput.js +4 -3
  28. package/build/cjs/lib/kit/components/Inputs/Text/Text.js +2 -2
  29. package/build/cjs/lib/kit/components/Inputs/TextContent/TextContent.js +2 -2
  30. package/build/cjs/lib/kit/components/Inputs/TextLink/TextLink.js +4 -3
  31. package/build/cjs/lib/kit/components/LazyLoader/LazyLoader.js +2 -2
  32. package/build/cjs/lib/kit/components/ViewLayouts/ViewAccordeon/ViewAccordeon.js +2 -2
  33. package/build/cjs/lib/kit/components/ViewLayouts/ViewAccordeonCard/ViewAccordeonCard.js +2 -2
  34. package/build/cjs/lib/kit/components/ViewLayouts/ViewCardAccordeon.js +2 -2
  35. package/build/cjs/lib/kit/components/Views/ArrayBaseView/ArrayBaseView.js +2 -2
  36. package/build/cjs/lib/kit/components/Views/BaseView/BaseView.js +2 -2
  37. package/build/cjs/lib/kit/components/Views/CardOneOfView.js +2 -2
  38. package/build/cjs/lib/kit/components/Views/MultiOneOfView/MultiOneOfView.js +2 -2
  39. package/build/cjs/lib/kit/components/Views/ObjectBaseView/ObjectBaseView.css +6 -0
  40. package/build/cjs/lib/kit/components/Views/ObjectBaseView/ObjectBaseView.js +16 -9
  41. package/build/cjs/lib/kit/components/Views/ObjectValueInputView/ObjectValueInputView.js +5 -5
  42. package/build/cjs/lib/kit/components/Views/OneOfView/OneOfView.js +17 -6
  43. package/build/cjs/lib/kit/components/Views/TextLinkView/TextLinkView.js +2 -2
  44. package/build/cjs/lib/kit/constants/common.js +2 -1
  45. package/build/cjs/lib/kit/hooks/useOneOf/useOneOf.css +5 -0
  46. package/build/cjs/lib/kit/hooks/useOneOf/useOneOf.js +35 -7
  47. package/build/cjs/lib/kit/utils/common.js +30 -25
  48. package/build/cjs/lib/kit/utils/index.js +1 -0
  49. package/build/cjs/lib/kit/utils/objectKeys.js +7 -0
  50. package/build/cjs/lib/kit/validators/validators.js +9 -7
  51. package/build/esm/lib/core/components/Form/Controller/Controller.js +2 -2
  52. package/build/esm/lib/core/components/Form/Controller/utils.js +45 -34
  53. package/build/esm/lib/core/components/Form/DynamicField.js +6 -4
  54. package/build/esm/lib/core/components/Form/hooks/useCreateContext.js +2 -2
  55. package/build/esm/lib/core/components/Form/hooks/useCreateSearchContext.js +2 -2
  56. package/build/esm/lib/core/components/Form/hooks/useIntegrationFF.js +6 -4
  57. package/build/esm/lib/core/components/Form/hooks/useMutators.js +11 -7
  58. package/build/esm/lib/core/components/Form/hooks/useSearchStore.js +4 -3
  59. package/build/esm/lib/core/components/Form/hooks/useStore.js +15 -11
  60. package/build/esm/lib/core/components/Form/utils/common.js +14 -11
  61. package/build/esm/lib/core/components/View/helpers.js +5 -5
  62. package/build/esm/lib/core/components/View/hooks/useComponents.js +2 -2
  63. package/build/esm/lib/core/components/View/hooks/useCreateContext.js +2 -2
  64. package/build/esm/lib/core/components/View/hooks/useRender.js +4 -3
  65. package/build/esm/lib/core/helpers.js +5 -4
  66. package/build/esm/lib/core/types/specs.d.ts +3 -1
  67. package/build/esm/lib/kit/components/AccordeonCard/AccordeonCard.js +2 -2
  68. package/build/esm/lib/kit/components/Card/Card.js +2 -2
  69. package/build/esm/lib/kit/components/GenerateRandomValueButton/GenerateRandomValueButton.js +2 -2
  70. package/build/esm/lib/kit/components/Inputs/ArrayBase/ArrayBase.js +2 -2
  71. package/build/esm/lib/kit/components/Inputs/CardOneOf/CardOneOf.js +2 -2
  72. package/build/esm/lib/kit/components/Inputs/MultiOneOf/MultiOneOf.js +4 -3
  73. package/build/esm/lib/kit/components/Inputs/ObjectBase/ObjectBase.css +6 -0
  74. package/build/esm/lib/kit/components/Inputs/ObjectBase/ObjectBase.js +12 -6
  75. package/build/esm/lib/kit/components/Inputs/ObjectValueInput/ObjectValueInput.js +5 -4
  76. package/build/esm/lib/kit/components/Inputs/OneOf/OneOf.js +2 -2
  77. package/build/esm/lib/kit/components/Inputs/Secret/Secret.js +4 -3
  78. package/build/esm/lib/kit/components/Inputs/TableArrayInput/TableArrayInput.js +4 -3
  79. package/build/esm/lib/kit/components/Inputs/Text/Text.js +2 -2
  80. package/build/esm/lib/kit/components/Inputs/TextContent/TextContent.js +2 -2
  81. package/build/esm/lib/kit/components/Inputs/TextLink/TextLink.js +4 -3
  82. package/build/esm/lib/kit/components/LazyLoader/LazyLoader.js +2 -2
  83. package/build/esm/lib/kit/components/ViewLayouts/ViewAccordeon/ViewAccordeon.js +2 -2
  84. package/build/esm/lib/kit/components/ViewLayouts/ViewAccordeonCard/ViewAccordeonCard.js +2 -2
  85. package/build/esm/lib/kit/components/ViewLayouts/ViewCardAccordeon.js +2 -2
  86. package/build/esm/lib/kit/components/Views/ArrayBaseView/ArrayBaseView.js +2 -2
  87. package/build/esm/lib/kit/components/Views/BaseView/BaseView.js +2 -2
  88. package/build/esm/lib/kit/components/Views/CardOneOfView.js +2 -2
  89. package/build/esm/lib/kit/components/Views/MultiOneOfView/MultiOneOfView.js +2 -2
  90. package/build/esm/lib/kit/components/Views/ObjectBaseView/ObjectBaseView.css +6 -0
  91. package/build/esm/lib/kit/components/Views/ObjectBaseView/ObjectBaseView.js +16 -9
  92. package/build/esm/lib/kit/components/Views/ObjectValueInputView/ObjectValueInputView.js +3 -3
  93. package/build/esm/lib/kit/components/Views/OneOfView/OneOfView.js +18 -7
  94. package/build/esm/lib/kit/components/Views/TextLinkView/TextLinkView.js +2 -2
  95. package/build/esm/lib/kit/constants/common.d.ts +1 -0
  96. package/build/esm/lib/kit/constants/common.js +1 -0
  97. package/build/esm/lib/kit/hooks/useOneOf/useOneOf.css +5 -0
  98. package/build/esm/lib/kit/hooks/useOneOf/useOneOf.js +37 -9
  99. package/build/esm/lib/kit/utils/common.js +30 -25
  100. package/build/esm/lib/kit/utils/index.d.ts +1 -0
  101. package/build/esm/lib/kit/utils/index.js +1 -0
  102. package/build/esm/lib/kit/utils/objectKeys.d.ts +4 -0
  103. package/build/esm/lib/kit/utils/objectKeys.js +3 -0
  104. package/build/esm/lib/kit/validators/validators.js +9 -7
  105. package/package.json +1 -1
@@ -6,7 +6,7 @@ const react_1 = tslib_1.__importDefault(require("react"));
6
6
  const components_1 = require("@gravity-ui/components");
7
7
  const icons_1 = require("@gravity-ui/icons");
8
8
  const uikit_1 = require("@gravity-ui/uikit");
9
- const lodash_1 = tslib_1.__importDefault(require("lodash"));
9
+ const isString_1 = tslib_1.__importDefault(require("lodash/isString"));
10
10
  const common_1 = require("../../constants/common");
11
11
  const utils_1 = require("../../utils");
12
12
  const b = (0, utils_1.block)('card');
@@ -35,7 +35,7 @@ const Card = ({ name, title: propsTitle, description, actions, open: propsOpen,
35
35
  const preventEvent = react_1.default.useCallback((e) => e.stopPropagation(), []);
36
36
  const titlePopoverDisabled = (((_a = titleRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) || 0) <= common_1.COMMON_TITLE_MAX_WIDTH;
37
37
  const title = react_1.default.useMemo(() => {
38
- if (lodash_1.default.isString(propsTitle)) {
38
+ if ((0, isString_1.default)(propsTitle)) {
39
39
  return (react_1.default.createElement(react_1.default.Fragment, null,
40
40
  react_1.default.createElement(uikit_1.Popover, { content: propsTitle, disabled: titlePopoverDisabled, placement: common_1.COMMON_POPOVER_PLACEMENT },
41
41
  react_1.default.createElement(uikit_1.Text, { className: b('title'), ellipsis: true, ref: titleRef, variant: "subheader-2" }, propsTitle)),
@@ -4,14 +4,14 @@ exports.GenerateRandomValueButton = 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 isFunction_1 = tslib_1.__importDefault(require("lodash/isFunction"));
8
8
  const hooks_1 = require("../../../core/components/Form/hooks");
9
9
  const i18n_1 = tslib_1.__importDefault(require("../../i18n"));
10
10
  const utils_1 = require("../../utils");
11
11
  const b = (0, utils_1.block)('generate-random-value-button');
12
12
  const GenerateRandomValueButton = ({ spec, onChange, }) => {
13
13
  const generateRandomValue = (0, hooks_1.useGenerateRandomValue)();
14
- if (lodash_1.default.isFunction(generateRandomValue) && spec.viewSpec.generateRandomValueButton) {
14
+ if ((0, isFunction_1.default)(generateRandomValue) && spec.viewSpec.generateRandomValueButton) {
15
15
  return (react_1.default.createElement(uikit_1.Button, { onClick: () => onChange(generateRandomValue(spec)), className: b() }, (0, i18n_1.default)('button-generate')));
16
16
  }
17
17
  return null;
@@ -5,7 +5,7 @@ const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importDefault(require("react"));
6
6
  const icons_1 = require("@gravity-ui/icons");
7
7
  const uikit_1 = require("@gravity-ui/uikit");
8
- const lodash_1 = tslib_1.__importDefault(require("lodash"));
8
+ const set_1 = tslib_1.__importDefault(require("lodash/set"));
9
9
  const core_1 = require("../../../../core");
10
10
  const utils_1 = require("../../../utils");
11
11
  const b = (0, utils_1.block)('array-base');
@@ -28,7 +28,7 @@ const ArrayBase = ({ spec, name, arrayInput, input }) => {
28
28
  : `${idx + 1}` });
29
29
  return itemSpec;
30
30
  }, [spec.items, itemSpecCorrect]);
31
- const parentOnChange = react_1.default.useCallback((childName, childValue, childErrors) => input.onChange((currentValue) => lodash_1.default.set(Object.assign({}, currentValue), childName.split(`${input.name}.`).join(''), childValue), childErrors), [input.onChange, input.name]);
31
+ const parentOnChange = react_1.default.useCallback((childName, childValue, childErrors) => input.onChange((currentValue) => (0, set_1.default)(Object.assign({}, currentValue), childName.split(`${input.name}.`).join(''), childValue), childErrors), [input.onChange, input.name]);
32
32
  const AddButton = react_1.default.useCallback(() => {
33
33
  let onClick = () => arrayInput.onItemAdd(undefined);
34
34
  let qa = `${name}-add-item`;
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CardOneOf = 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 set_1 = tslib_1.__importDefault(require("lodash/set"));
7
7
  const __1 = require("../../");
8
8
  const core_1 = require("../../../../core");
9
9
  const hooks_1 = require("../../../hooks");
@@ -27,7 +27,7 @@ const CardOneOf = (props) => {
27
27
  return;
28
28
  }, [name, input.onDrop]);
29
29
  const parentOnChange = react_1.default.useCallback((childName, childValue, childErrors) => {
30
- const value = lodash_1.default.set({}, childName.split(`${input.name}.`).join(''), childValue);
30
+ const value = (0, set_1.default)({}, childName.split(`${input.name}.`).join(''), childValue);
31
31
  input.onChange(value, childErrors);
32
32
  }, [input.onChange, input.name]);
33
33
  (0, hooks_1.useErrorChecker)({ name, meta, open, setOpen });
@@ -4,7 +4,8 @@ exports.MultiOneOfFlat = exports.MultiOneOf = 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 set_1 = tslib_1.__importDefault(require("lodash/set"));
8
9
  const core_1 = require("../../../../core");
9
10
  const utils_1 = require("../../../utils");
10
11
  const GroupIndent_1 = require("../../GroupIndent");
@@ -22,9 +23,9 @@ const MultiOneOf = (props) => {
22
23
  }
23
24
  }, [onFocus, onBlur]);
24
25
  const parentOnChange = react_1.default.useCallback((childName, childValue, childErrors) => {
25
- onChange((currentValue) => lodash_1.default.set(Object.assign({}, currentValue), childName.split(`${name}.`).join(''), childValue), childErrors);
26
+ onChange((currentValue) => (0, set_1.default)(Object.assign({}, currentValue), childName.split(`${name}.`).join(''), childValue), childErrors);
26
27
  }, [name, onChange]);
27
- const specProperties = react_1.default.useMemo(() => (lodash_1.default.isObjectLike(spec.properties) ? spec.properties : {}), [spec.properties]);
28
+ const specProperties = react_1.default.useMemo(() => ((0, isObjectLike_1.default)(spec.properties) ? spec.properties : {}), [spec.properties]);
28
29
  const options = react_1.default.useMemo(() => (spec.viewSpec.order || Object.keys(specProperties)).map((value) => {
29
30
  var _a, _b;
30
31
  const title = ((_a = spec.description) === null || _a === void 0 ? void 0 : _a[value]) ||
@@ -8,4 +8,10 @@
8
8
  }
9
9
  .df-object-base__content_inline > .df-use-search:last-child {
10
10
  margin-right: 0;
11
+ }
12
+ .df-object-base__delimiter {
13
+ display: flex;
14
+ margin-right: 8px;
15
+ align-items: center;
16
+ white-space: nowrap;
11
17
  }
@@ -5,7 +5,8 @@ const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importDefault(require("react"));
6
6
  const icons_1 = require("@gravity-ui/icons");
7
7
  const uikit_1 = require("@gravity-ui/uikit");
8
- const lodash_1 = tslib_1.__importDefault(require("lodash"));
8
+ const isObjectLike_1 = tslib_1.__importDefault(require("lodash/isObjectLike"));
9
+ const set_1 = tslib_1.__importDefault(require("lodash/set"));
9
10
  const core_1 = require("../../../../core");
10
11
  const utils_1 = require("../../../utils");
11
12
  const b = (0, utils_1.block)('object-base');
@@ -17,10 +18,10 @@ const ObjectBase = (_a) => {
17
18
  react_1.default.createElement(uikit_1.Icon, { data: icons_1.Plus, size: 14 }),
18
19
  spec.viewSpec.layoutTitle || null));
19
20
  }, [spec.defaultValue, spec.viewSpec.layoutTitle, restProps.input.onChange]);
20
- const parentOnChange = react_1.default.useCallback((childName, childValue, childErrors) => restProps.input.onChange((currentValue) => lodash_1.default.set(Object.assign({}, currentValue), childName.split(`${restProps.input.name}.`).join(''), childValue), childErrors), [restProps.input.onChange, restProps.input.name]);
21
+ const parentOnChange = react_1.default.useCallback((childName, childValue, childErrors) => restProps.input.onChange((currentValue) => (0, set_1.default)(Object.assign({}, currentValue), childName.split(`${restProps.input.name}.`).join(''), childValue), childErrors), [restProps.input.onChange, restProps.input.name]);
21
22
  const content = react_1.default.useMemo(() => {
22
23
  if (!spec.properties ||
23
- !lodash_1.default.isObjectLike(spec.properties) ||
24
+ !(0, isObjectLike_1.default)(spec.properties) ||
24
25
  !Object.keys(spec.properties || {}).length) {
25
26
  return null;
26
27
  }
@@ -30,12 +31,17 @@ const ObjectBase = (_a) => {
30
31
  const specProperties = inline
31
32
  ? (0, utils_1.filterPropertiesForObjectInline)(spec.properties)
32
33
  : spec.properties;
33
- return (react_1.default.createElement("div", { className: b('content', { inline }) }, (spec.viewSpec.order || Object.keys(specProperties)).map((property) => {
34
+ const delimiter = spec.viewSpec.delimiter;
35
+ const orderProperties = spec.viewSpec.order || Object.keys(specProperties);
36
+ return (react_1.default.createElement("div", { className: b('content', { inline }) }, orderProperties.map((property) => {
34
37
  var _a;
35
- return specProperties[property] ? (react_1.default.createElement(core_1.Controller, { value: (_a = restProps.input.value) === null || _a === void 0 ? void 0 : _a[property], spec: specProperties[property], name: `${name ? name + '.' : ''}${property}`, parentOnChange: parentOnChange, parentOnUnmount: restProps.input.parentOnUnmount, key: `${name ? name + '.' : ''}${property}` })) : null;
38
+ return specProperties[property] ? (react_1.default.createElement(react_1.default.Fragment, { key: `${name ? name + '.' : ''}${property}` },
39
+ react_1.default.createElement(core_1.Controller, { value: (_a = restProps.input.value) === null || _a === void 0 ? void 0 : _a[property], spec: specProperties[property], name: `${name ? name + '.' : ''}${property}`, parentOnChange: parentOnChange, parentOnUnmount: restProps.input.parentOnUnmount }),
40
+ delimiter && delimiter[property] ? (react_1.default.createElement(uikit_1.Text, { className: b('delimiter') }, delimiter[property])) : null)) : null;
36
41
  })));
37
42
  }, [
38
43
  spec.properties,
44
+ spec.viewSpec.delimiter,
39
45
  spec.viewSpec.order,
40
46
  restProps.input.value,
41
47
  restProps.input.parentOnUnmount,
@@ -3,17 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ObjectValueInput = 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
+ const set_1 = tslib_1.__importDefault(require("lodash/set"));
7
8
  const core_1 = require("../../../../core");
8
- const OBJECT_VALUE_PROPERTY_NAME = 'value';
9
+ const common_1 = require("../../../constants/common");
9
10
  const ObjectValueInput = (props) => {
10
11
  var _a;
11
12
  const { spec, input, name, Layout } = props;
12
- const parentOnChange = react_1.default.useCallback((childName, childValue, childErrors) => input.onChange((currentValue) => lodash_1.default.set(Object.assign({}, currentValue), childName.split(`${name}.`).join(''), childValue), childErrors), [input.onChange, input.name]);
13
+ const parentOnChange = react_1.default.useCallback((childName, childValue, childErrors) => input.onChange((currentValue) => (0, set_1.default)(Object.assign({}, currentValue), childName.split(`${name}.`).join(''), childValue), childErrors), [input.onChange, input.name]);
13
14
  const childSpec = react_1.default.useMemo(() => {
14
15
  var _a;
15
- if ((_a = spec.properties) === null || _a === void 0 ? void 0 : _a[OBJECT_VALUE_PROPERTY_NAME]) {
16
- const childSpec = lodash_1.default.cloneDeep(spec.properties[OBJECT_VALUE_PROPERTY_NAME]);
16
+ if ((_a = spec.properties) === null || _a === void 0 ? void 0 : _a[common_1.OBJECT_VALUE_PROPERTY_NAME]) {
17
+ const childSpec = (0, cloneDeep_1.default)(spec.properties[common_1.OBJECT_VALUE_PROPERTY_NAME]);
17
18
  childSpec.viewSpec.layout = 'transparent';
18
19
  return childSpec;
19
20
  }
@@ -22,7 +23,7 @@ const ObjectValueInput = (props) => {
22
23
  if (!childSpec) {
23
24
  return null;
24
25
  }
25
- const content = (react_1.default.createElement(core_1.Controller, { value: (_a = input.value) === null || _a === void 0 ? void 0 : _a[OBJECT_VALUE_PROPERTY_NAME], spec: childSpec, name: `${name}.${OBJECT_VALUE_PROPERTY_NAME}`, key: `${name}.${OBJECT_VALUE_PROPERTY_NAME}`, parentOnChange: parentOnChange, parentOnUnmount: input.parentOnUnmount }));
26
+ const content = (react_1.default.createElement(core_1.Controller, { value: (_a = input.value) === null || _a === void 0 ? void 0 : _a[common_1.OBJECT_VALUE_PROPERTY_NAME], spec: childSpec, name: `${name}.${common_1.OBJECT_VALUE_PROPERTY_NAME}`, key: `${name}.${common_1.OBJECT_VALUE_PROPERTY_NAME}`, parentOnChange: parentOnChange, parentOnUnmount: input.parentOnUnmount }));
26
27
  if (Layout) {
27
28
  return react_1.default.createElement(Layout, Object.assign({}, props), content);
28
29
  }
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.OneOfFlat = exports.OneOf = 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 set_1 = tslib_1.__importDefault(require("lodash/set"));
7
7
  const __1 = require("../../");
8
8
  const core_1 = require("../../../../core");
9
9
  const hooks_1 = require("../../../hooks");
@@ -13,7 +13,7 @@ const OneOfComponent = (props) => {
13
13
  var _a;
14
14
  const { oneOfValue, specProperties, toggler } = (0, hooks_1.useOneOf)({ props });
15
15
  const parentOnChange = react_1.default.useCallback((childName, childValue, childErrors) => {
16
- const value = lodash_1.default.set({}, childName.split(`${props.input.name}.`).join(''), childValue);
16
+ const value = (0, set_1.default)({}, childName.split(`${props.input.name}.`).join(''), childValue);
17
17
  props.input.onChange(value, childErrors);
18
18
  }, [props.input.onChange, props.input.name]);
19
19
  return (react_1.default.createElement("div", { className: b({
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Secret = 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
+ const set_1 = tslib_1.__importDefault(require("lodash/set"));
7
8
  const core_1 = require("../../../../core");
8
9
  const SECRET_PROPERTY_NAME = 'raw';
9
10
  const Secret = (props) => {
@@ -12,13 +13,13 @@ const Secret = (props) => {
12
13
  const childSpec = react_1.default.useMemo(() => {
13
14
  var _a, _b;
14
15
  if ((_a = spec.properties) === null || _a === void 0 ? void 0 : _a[SECRET_PROPERTY_NAME]) {
15
- const childSpec = lodash_1.default.cloneDeep((_b = spec.properties) === null || _b === void 0 ? void 0 : _b[SECRET_PROPERTY_NAME]);
16
+ const childSpec = (0, cloneDeep_1.default)((_b = spec.properties) === null || _b === void 0 ? void 0 : _b[SECRET_PROPERTY_NAME]);
16
17
  childSpec.viewSpec.layout = 'transparent';
17
18
  return childSpec;
18
19
  }
19
20
  return undefined;
20
21
  }, [spec.properties]);
21
- const parentOnChange = react_1.default.useCallback((childName, childValue, childErrors) => input.onChange((currentValue) => lodash_1.default.set(Object.assign({}, currentValue), childName.split(`${input.name}.`).join(''), childValue), childErrors), [input.onChange, input.name]);
22
+ const parentOnChange = react_1.default.useCallback((childName, childValue, childErrors) => input.onChange((currentValue) => (0, set_1.default)(Object.assign({}, currentValue), childName.split(`${input.name}.`).join(''), childValue), childErrors), [input.onChange, input.name]);
22
23
  if (!childSpec) {
23
24
  return null;
24
25
  }
@@ -5,7 +5,8 @@ const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importDefault(require("react"));
6
6
  const icons_1 = require("@gravity-ui/icons");
7
7
  const uikit_1 = require("@gravity-ui/uikit");
8
- const lodash_1 = tslib_1.__importDefault(require("lodash"));
8
+ const noop_1 = tslib_1.__importDefault(require("lodash/noop"));
9
+ const set_1 = tslib_1.__importDefault(require("lodash/set"));
9
10
  const core_1 = require("../../../../core");
10
11
  const hooks_1 = require("../../../../core/components/Form/hooks");
11
12
  const utils_1 = require("../../../utils");
@@ -25,7 +26,7 @@ const TableArrayInput = ({ spec, name, arrayInput, input }) => {
25
26
  const onItemRemove = react_1.default.useCallback((key) => {
26
27
  arrayInput.onItemRemove(key);
27
28
  }, [arrayInput.onItemRemove]);
28
- const parentOnChange = react_1.default.useCallback((childName, childValue, childErrors) => input.onChange((currentValue) => lodash_1.default.set(Object.assign({}, currentValue), childName.split(`${input.name}.`).join(''), childValue), childErrors), [input.onChange, input.name]);
29
+ const parentOnChange = react_1.default.useCallback((childName, childValue, childErrors) => input.onChange((currentValue) => (0, set_1.default)(Object.assign({}, currentValue), childName.split(`${input.name}.`).join(''), childValue), childErrors), [input.onChange, input.name]);
29
30
  const columns = react_1.default.useMemo(() => {
30
31
  const { items, viewSpec: { table }, } = spec;
31
32
  if (!(table === null || table === void 0 ? void 0 : table.length) || !(0, core_1.isObjectSpec)(items)) {
@@ -59,7 +60,7 @@ const TableArrayInput = ({ spec, name, arrayInput, input }) => {
59
60
  arr: (0, core_1.isArraySpec)(preparedEntitySpec),
60
61
  obj: (0, core_1.isObjectSpec)(preparedEntitySpec),
61
62
  }), key: `${name}.<${key}>.${property}` },
62
- react_1.default.createElement(core_1.Controller, { value: (_c = (_b = input.value) === null || _b === void 0 ? void 0 : _b[`<${key}>`]) === null || _c === void 0 ? void 0 : _c[property], spec: preparedEntitySpec, name: `${name}.<${key}>.${property}`, parentOnChange: parentOnChange, parentOnUnmount: lodash_1.default.noop })));
63
+ react_1.default.createElement(core_1.Controller, { value: (_c = (_b = input.value) === null || _b === void 0 ? void 0 : _b[`<${key}>`]) === null || _c === void 0 ? void 0 : _c[property], spec: preparedEntitySpec, name: `${name}.<${key}>.${property}`, parentOnChange: parentOnChange, parentOnUnmount: noop_1.default })));
63
64
  },
64
65
  }));
65
66
  return [idxColumn, ...columns, removeColumn];
@@ -5,9 +5,9 @@ const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importDefault(require("react"));
6
6
  const components_1 = require("@gravity-ui/components");
7
7
  const uikit_1 = require("@gravity-ui/uikit");
8
- const lodash_1 = tslib_1.__importDefault(require("lodash"));
8
+ const isNil_1 = tslib_1.__importDefault(require("lodash/isNil"));
9
9
  const Text = ({ name, input: { value, onBlur, onChange, onFocus }, spec, inputProps, }) => {
10
- const props = Object.assign(Object.assign({ hasClear: true }, inputProps), { value: lodash_1.default.isNil(value) ? '' : `${value}`, onBlur: onBlur, onFocus: onFocus, onUpdate: onChange, disabled: spec.viewSpec.disabled, placeholder: spec.viewSpec.placeholder, qa: name });
10
+ const props = Object.assign(Object.assign({ hasClear: true }, inputProps), { value: (0, isNil_1.default)(value) ? '' : `${value}`, onBlur: onBlur, onFocus: onFocus, onUpdate: onChange, disabled: spec.viewSpec.disabled, placeholder: spec.viewSpec.placeholder, qa: name });
11
11
  if (spec.viewSpec.type === 'password') {
12
12
  return (react_1.default.createElement(components_1.PasswordInput, Object.assign({}, props, { autoComplete: "new-password", showCopyButton: true, showRevealButton: true })));
13
13
  }
@@ -4,7 +4,7 @@ exports.TextContent = 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 cloneDeep_1 = tslib_1.__importDefault(require("lodash/cloneDeep"));
8
8
  const utils_1 = require("../../../utils");
9
9
  const LazyLoader_1 = require("../../LazyLoader");
10
10
  const utils_2 = require("./utils");
@@ -31,7 +31,7 @@ const TextContent = (_a) => {
31
31
  react_1.default.createElement(uikit_1.Text, { color: "secondary" }, input.value))) : null));
32
32
  }
33
33
  if (Layout) {
34
- const _spec = lodash_1.default.cloneDeep(spec);
34
+ const _spec = (0, cloneDeep_1.default)(spec);
35
35
  if (!(textContentParams === null || textContentParams === void 0 ? void 0 : textContentParams.text)) {
36
36
  _spec.viewSpec.layoutDescription = undefined;
37
37
  }
@@ -3,18 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TextLink = 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
+ const set_1 = tslib_1.__importDefault(require("lodash/set"));
7
8
  const core_1 = require("../../../../core");
8
9
  const TEXT_LINK_PROPERTY_NAME = 'text';
9
10
  const TextLink = (props) => {
10
11
  var _a;
11
12
  const { spec, input, name, Layout } = props;
12
- const parentOnChange = react_1.default.useCallback((childName, childValue, childErrors) => input.onChange((currentValue) => lodash_1.default.set(Object.assign({}, currentValue), childName.split(`${name}.`).join(''), childValue), childErrors), [input.onChange, input.name]);
13
+ const parentOnChange = react_1.default.useCallback((childName, childValue, childErrors) => input.onChange((currentValue) => (0, set_1.default)(Object.assign({}, currentValue), childName.split(`${name}.`).join(''), childValue), childErrors), [input.onChange, input.name]);
13
14
  const childSpec = react_1.default.useMemo(() => {
14
15
  var _a;
15
16
  if (((_a = spec.properties) === null || _a === void 0 ? void 0 : _a[TEXT_LINK_PROPERTY_NAME]) &&
16
17
  (0, core_1.isStringSpec)(spec.properties[TEXT_LINK_PROPERTY_NAME])) {
17
- const childSpec = lodash_1.default.cloneDeep(spec.properties[TEXT_LINK_PROPERTY_NAME]);
18
+ const childSpec = (0, cloneDeep_1.default)(spec.properties[TEXT_LINK_PROPERTY_NAME]);
18
19
  childSpec.viewSpec.layout = 'transparent';
19
20
  return childSpec;
20
21
  }
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LazyLoader = 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 isUndefined_1 = tslib_1.__importDefault(require("lodash/isUndefined"));
7
7
  const LazyLoader = ({ component, initialFallback = react_1.default.createElement(react_1.default.Fragment, null), }) => {
8
8
  const fallback = react_1.default.useRef(() => initialFallback);
9
9
  const Component = component;
10
10
  const updateFallback = async () => {
11
11
  const result = await component._result;
12
- if (!lodash_1.default.isUndefined(result)) {
12
+ if (!(0, isUndefined_1.default)(result)) {
13
13
  fallback.current = result.default;
14
14
  }
15
15
  };
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ViewAccordeon = 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 isBoolean_1 = tslib_1.__importDefault(require("lodash/isBoolean"));
7
7
  const utils_1 = require("../../../utils");
8
8
  const SimpleVerticalAccordeon_1 = require("../../SimpleVerticalAccordeon");
9
9
  const ViewAccordeon = ({ name, value, spec, children, }) => {
10
- const [open, setOpen] = react_1.default.useState(lodash_1.default.isBoolean(spec.viewSpec.layoutOpen) ? spec.viewSpec.layoutOpen : true);
10
+ const [open, setOpen] = react_1.default.useState((0, isBoolean_1.default)(spec.viewSpec.layoutOpen) ? spec.viewSpec.layoutOpen : true);
11
11
  if (!(0, utils_1.isNotEmptyValue)(value, spec)) {
12
12
  return null;
13
13
  }
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ViewAccordeonCard = 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 isBoolean_1 = tslib_1.__importDefault(require("lodash/isBoolean"));
7
7
  const utils_1 = require("../../../utils");
8
8
  const AccordeonCard_1 = require("../../AccordeonCard");
9
9
  const ViewAccordeonCard = ({ value, name, spec, children, }) => {
10
- const [open, setOpen] = react_1.default.useState(lodash_1.default.isBoolean(spec.viewSpec.layoutOpen) ? spec.viewSpec.layoutOpen : true);
10
+ const [open, setOpen] = react_1.default.useState((0, isBoolean_1.default)(spec.viewSpec.layoutOpen) ? spec.viewSpec.layoutOpen : true);
11
11
  if (!(0, utils_1.isNotEmptyValue)(value, spec)) {
12
12
  return null;
13
13
  }
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ViewCardAccordeon = 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 isBoolean_1 = tslib_1.__importDefault(require("lodash/isBoolean"));
7
7
  const __1 = require("../");
8
8
  const utils_1 = require("../../utils");
9
9
  const ViewCardAccordeon = ({ name, value, spec, children, }) => {
10
- const [open, setOpen] = react_1.default.useState(lodash_1.default.isBoolean(spec.viewSpec.layoutOpen) ? spec.viewSpec.layoutOpen : true);
10
+ const [open, setOpen] = react_1.default.useState((0, isBoolean_1.default)(spec.viewSpec.layoutOpen) ? spec.viewSpec.layoutOpen : true);
11
11
  const onToggle = react_1.default.useCallback(() => setOpen((f) => !f), [setOpen]);
12
12
  if (!(0, utils_1.isNotEmptyValue)(value, spec)) {
13
13
  return null;
@@ -4,7 +4,7 @@ exports.ArrayBaseView = 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 map_1 = tslib_1.__importDefault(require("lodash/map"));
8
8
  const core_1 = require("../../../../core");
9
9
  const utils_1 = require("../../../utils");
10
10
  const b = (0, utils_1.block)('array-base-view');
@@ -20,7 +20,7 @@ const ArrayBaseView = ({ spec, name, value = [] }) => {
20
20
  : `${idx + 1}` });
21
21
  return itemSpec;
22
22
  }, [spec.items, itemSpecCorrect]);
23
- const items = react_1.default.useMemo(() => lodash_1.default.map(value, (__, idx) => {
23
+ const items = react_1.default.useMemo(() => (0, map_1.default)(value, (__, idx) => {
24
24
  const itemSpec = getItemSpec(idx);
25
25
  if (!itemSpec) {
26
26
  return null;
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BaseView = 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 isString_1 = tslib_1.__importDefault(require("lodash/isString"));
7
7
  const components_1 = require("../../../components");
8
8
  const BaseView = ({ value, spec, linkValue, }) => {
9
9
  var _a;
10
- if (lodash_1.default.isString(value) && linkValue) {
10
+ if ((0, isString_1.default)(value) && linkValue) {
11
11
  return react_1.default.createElement(react_1.default.Fragment, null, linkValue);
12
12
  }
13
13
  return (react_1.default.createElement(components_1.LongValue, { value: ((_a = spec === null || spec === void 0 ? void 0 : spec.description) === null || _a === void 0 ? void 0 : _a[String(value)]) || String(value) }));
@@ -3,14 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CardOneOfView = 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 CardOneOfView = (props) => {
10
10
  const { value = {}, spec, name } = props;
11
11
  const [open, setOpen] = react_1.default.useState(true);
12
12
  const onToggle = react_1.default.useCallback(() => setOpen((f) => !f), [setOpen]);
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;
@@ -4,14 +4,14 @@ exports.MultiOneOfFlatView = exports.MultiOneOfView = 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
8
  const core_1 = require("../../../../core");
9
9
  const utils_1 = require("../../../utils");
10
10
  const GroupIndent_1 = require("../../GroupIndent");
11
11
  const b = (0, utils_1.block)('multi-oneof-view');
12
12
  const MultiOneOfView = (props) => {
13
13
  const { name, value, Layout, spec, withoutIndent } = props;
14
- const specProperties = react_1.default.useMemo(() => (lodash_1.default.isObjectLike(spec.properties) ? spec.properties : {}), [spec.properties]);
14
+ const specProperties = react_1.default.useMemo(() => ((0, isObjectLike_1.default)(spec.properties) ? spec.properties : {}), [spec.properties]);
15
15
  const values = react_1.default.useMemo(() => Object.keys(value || []), [value]);
16
16
  const items = react_1.default.useMemo(() => values.map((value) => {
17
17
  var _a, _b;
@@ -8,4 +8,10 @@
8
8
  }
9
9
  .df-object-base-view__content_inline > div:last-child {
10
10
  margin-right: 0;
11
+ }
12
+ .df-object-base-view__delimiter {
13
+ display: flex;
14
+ margin-right: 8px;
15
+ align-items: center;
16
+ white-space: nowrap;
11
17
  }
@@ -3,20 +3,27 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ObjectInlineView = exports.ObjectBaseView = 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
+ const uikit_1 = require("@gravity-ui/uikit");
7
8
  const core_1 = require("../../../../core");
8
9
  const utils_1 = require("../../../utils");
9
10
  const b = (0, utils_1.block)('object-base-view');
10
11
  const ObjectBaseView = (_a) => {
11
12
  var { inline, spec, name, Layout } = _a, restProps = tslib_1.__rest(_a, ["inline", "spec", "name", "Layout"]);
12
- if (!spec.properties || !lodash_1.default.isObjectLike(spec.properties)) {
13
- return null;
14
- }
15
- const specProperties = inline
16
- ? (0, utils_1.filterPropertiesForObjectInline)(spec.properties)
17
- : spec.properties;
18
- const content = (react_1.default.createElement("div", { className: b('content', { inline }) }, (spec.viewSpec.order || Object.keys(specProperties)).map((property) => specProperties[property] ? (react_1.default.createElement(core_1.ViewController, { spec: specProperties[property], name: `${name ? name + '.' : ''}${property}`, key: `${name ? name + '.' : ''}${property}` })) : null)));
19
- if (!Layout) {
13
+ const content = react_1.default.useMemo(() => {
14
+ if (!spec.properties || !(0, isObjectLike_1.default)(spec.properties)) {
15
+ return null;
16
+ }
17
+ const specProperties = inline
18
+ ? (0, utils_1.filterPropertiesForObjectInline)(spec.properties)
19
+ : spec.properties;
20
+ const delimiter = spec.viewSpec.delimiter;
21
+ const orderProperties = spec.viewSpec.order || Object.keys(specProperties);
22
+ return (react_1.default.createElement("div", { className: b('content', { inline }) }, orderProperties.map((property) => specProperties[property] ? (react_1.default.createElement(react_1.default.Fragment, { key: `${name ? name + '.' : ''}${property}` },
23
+ react_1.default.createElement(core_1.ViewController, { spec: specProperties[property], name: `${name ? name + '.' : ''}${property}` }),
24
+ delimiter && delimiter[property] ? (react_1.default.createElement(uikit_1.Text, { className: b('delimiter') }, delimiter[property])) : null)) : null)));
25
+ }, [inline, name, spec.properties, spec.viewSpec.delimiter, spec.viewSpec.order]);
26
+ if (!Layout || !content) {
20
27
  return content;
21
28
  }
22
29
  return (react_1.default.createElement(Layout, Object.assign({ spec: spec, name: name }, restProps), content));
@@ -3,15 +3,15 @@ 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
- const OBJECT_VALUE_PROPERTY_NAME = 'value';
8
+ const common_1 = require("../../../constants/common");
9
9
  const ObjectValueInputView = (_a) => {
10
10
  var { spec, name, Layout } = _a, restProps = tslib_1.__rest(_a, ["spec", "name", "Layout"]);
11
11
  const childSpec = react_1.default.useMemo(() => {
12
12
  var _a;
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]);
13
+ if ((_a = spec.properties) === null || _a === void 0 ? void 0 : _a[common_1.OBJECT_VALUE_PROPERTY_NAME]) {
14
+ const childSpec = (0, cloneDeep_1.default)(spec.properties[common_1.OBJECT_VALUE_PROPERTY_NAME]);
15
15
  childSpec.viewSpec.layout = '';
16
16
  return childSpec;
17
17
  }
@@ -20,7 +20,7 @@ const ObjectValueInputView = (_a) => {
20
20
  if (!childSpec) {
21
21
  return null;
22
22
  }
23
- const content = (react_1.default.createElement(core_1.ViewController, { spec: childSpec, name: `${name ? name + '.' : ''}${OBJECT_VALUE_PROPERTY_NAME}` }));
23
+ const content = (react_1.default.createElement(core_1.ViewController, { spec: childSpec, name: `${name ? name + '.' : ''}${common_1.OBJECT_VALUE_PROPERTY_NAME}` }));
24
24
  if (Layout) {
25
25
  return (react_1.default.createElement(Layout, Object.assign({ spec: spec, name: name }, restProps), content));
26
26
  }
@@ -3,21 +3,32 @@ 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
+ var _a, _b;
12
13
  const { value = {}, spec, Layout, name } = props;
13
- const specProperties = react_1.default.useMemo(() => (lodash_1.default.isObjectLike(spec.properties) ? spec.properties : {}), [spec.properties]);
14
+ const specProperties = react_1.default.useMemo(() => ((0, isObjectLike_1.default)(spec.properties) ? spec.properties : {}), [spec.properties]);
15
+ const specBooleanMap = react_1.default.useMemo(() => { var _a; return (_a = spec.viewSpec.oneOfParams) === null || _a === void 0 ? void 0 : _a.booleanMap; }, [(_a = spec.viewSpec.oneOfParams) === null || _a === void 0 ? void 0 : _a.booleanMap]);
14
16
  const valueKey = react_1.default.useMemo(() => Object.keys(value)[0], [value]);
15
17
  const valueName = react_1.default.useMemo(() => {
16
- var _a, _b;
17
- return (((_a = spec.description) === null || _a === void 0 ? void 0 : _a[valueKey]) ||
18
- ((_b = specProperties[valueKey]) === null || _b === void 0 ? void 0 : _b.viewSpec.layoutTitle) ||
18
+ var _a, _b, _c;
19
+ if (((_a = spec.viewSpec.oneOfParams) === null || _a === void 0 ? void 0 : _a.toggler) === 'checkbox' && specBooleanMap) {
20
+ return (0, utils_1.objectKeys)(specBooleanMap).find((key) => specBooleanMap[key] === valueKey);
21
+ }
22
+ return (((_b = spec.description) === null || _b === void 0 ? void 0 : _b[valueKey]) ||
23
+ ((_c = specProperties[valueKey]) === null || _c === void 0 ? void 0 : _c.viewSpec.layoutTitle) ||
19
24
  valueKey);
20
- }, [valueKey, spec.description, specProperties]);
25
+ }, [
26
+ valueKey,
27
+ spec.description,
28
+ specProperties,
29
+ (_b = spec.viewSpec.oneOfParams) === null || _b === void 0 ? void 0 : _b.toggler,
30
+ specBooleanMap,
31
+ ]);
21
32
  const wrappedValue = react_1.default.useMemo(() => {
22
33
  if (Layout) {
23
34
  return (react_1.default.createElement(Layout, Object.assign({}, props, { value: valueName }),
@@ -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;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.COMMON_TITLE_MAX_WIDTH = exports.COMMON_POPOVER_PLACEMENT = void 0;
3
+ exports.OBJECT_VALUE_PROPERTY_NAME = exports.COMMON_TITLE_MAX_WIDTH = exports.COMMON_POPOVER_PLACEMENT = void 0;
4
4
  exports.COMMON_POPOVER_PLACEMENT = ['bottom', 'top'];
5
5
  exports.COMMON_TITLE_MAX_WIDTH = 533;
6
+ exports.OBJECT_VALUE_PROPERTY_NAME = 'value';