@gravity-ui/dynamic-forms 1.4.1 → 1.6.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 (118) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/build/cjs/lib/core/components/Form/hooks/useField.js +3 -0
  3. package/build/cjs/lib/core/components/Form/hooks/useStore.js +6 -0
  4. package/build/cjs/lib/core/helpers.js +4 -1
  5. package/build/cjs/lib/kit/components/AccordeonCard/AccordeonCard.js +2 -2
  6. package/build/cjs/lib/kit/components/Card/Card.js +2 -2
  7. package/build/cjs/lib/kit/components/Inputs/ArrayBase/ArrayBase.js +2 -2
  8. package/build/cjs/lib/kit/components/Inputs/CardOneOf/CardOneOf.js +2 -2
  9. package/build/cjs/lib/kit/components/Inputs/Checkbox/Checkbox.js +2 -2
  10. package/build/cjs/lib/kit/components/Inputs/FileInput/FileInput.js +3 -3
  11. package/build/cjs/lib/kit/components/Inputs/MonacoInput/MonacoInputBase.js +5 -5
  12. package/build/cjs/lib/kit/components/Inputs/MonacoInput/MonacoInputDialog.js +2 -2
  13. package/build/cjs/lib/kit/components/Inputs/MultiSelect/MultiSelect.js +2 -2
  14. package/build/cjs/lib/kit/components/Inputs/NumberWithScale/NumberWithScale.js +3 -3
  15. package/build/cjs/lib/kit/components/Inputs/ObjectBase/ObjectBase.js +2 -2
  16. package/build/cjs/lib/kit/components/Inputs/ObjectValueInput/ObjectValueInput.js +32 -0
  17. package/build/cjs/lib/kit/components/Inputs/ObjectValueInput/index.js +4 -0
  18. package/build/cjs/lib/kit/components/Inputs/OneOf/OneOf.css +8 -8
  19. package/build/cjs/lib/kit/components/Inputs/OneOf/OneOf.js +2 -2
  20. package/build/cjs/lib/kit/components/Inputs/OneOfCard/OneOfCard.js +3 -3
  21. package/build/cjs/lib/kit/components/Inputs/Secret/Secret.js +16 -6
  22. package/build/cjs/lib/kit/components/Inputs/Select/Select.js +2 -2
  23. package/build/cjs/lib/kit/components/Inputs/TableArrayInput/TableArrayInput.js +3 -3
  24. package/build/cjs/lib/kit/components/Inputs/Text/Text.js +2 -2
  25. package/build/cjs/lib/kit/components/Inputs/TextArea/TextArea.js +2 -2
  26. package/build/cjs/lib/kit/components/Inputs/TextLink/TextLink.js +18 -5
  27. package/build/cjs/lib/kit/components/Inputs/index.js +1 -0
  28. package/build/cjs/lib/kit/components/Layouts/Accordeon/Accordeon.js +3 -3
  29. package/build/cjs/lib/kit/components/Layouts/Accordeon/RemoveButton.js +2 -2
  30. package/build/cjs/lib/kit/components/Layouts/AccordeonCardLayout/AccordeonCardLayout.js +3 -3
  31. package/build/cjs/lib/kit/components/Layouts/CardAccordeon.js +3 -3
  32. package/build/cjs/lib/kit/components/Layouts/CardSection.js +3 -3
  33. package/build/cjs/lib/kit/components/Layouts/Row/Row.js +1 -1
  34. package/build/cjs/lib/kit/components/Layouts/Row2/Row2.js +1 -1
  35. package/build/cjs/lib/kit/components/Layouts/SectionCard/SectionCard.js +1 -1
  36. package/build/cjs/lib/kit/components/Layouts/Transparent/Transparent.js +2 -2
  37. package/build/cjs/lib/kit/components/SimpleVerticalAccordeon/SimpleVerticalAccordeon.css +1 -1
  38. package/build/cjs/lib/kit/components/SimpleVerticalAccordeon/SimpleVerticalAccordeon.js +2 -2
  39. package/build/cjs/lib/kit/components/ViewLayouts/ViewAccordeon/ViewAccordeon.js +2 -2
  40. package/build/cjs/lib/kit/components/ViewLayouts/ViewAccordeonCard/ViewAccordeonCard.js +2 -2
  41. package/build/cjs/lib/kit/components/ViewLayouts/ViewCardAccordeon.js +2 -2
  42. package/build/cjs/lib/kit/components/ViewLayouts/ViewCardSection.js +2 -2
  43. package/build/cjs/lib/kit/components/Views/CardOneOfView.js +1 -1
  44. package/build/cjs/lib/kit/components/Views/ObjectValueInputView/ObjectValueInputView.js +29 -0
  45. package/build/cjs/lib/kit/components/Views/ObjectValueInputView/index.js +4 -0
  46. package/build/cjs/lib/kit/components/Views/OneOfCardView.js +1 -1
  47. package/build/cjs/lib/kit/components/Views/TextLinkView/TextLinkView.js +21 -7
  48. package/build/cjs/lib/kit/components/Views/index.js +1 -0
  49. package/build/cjs/lib/kit/constants/config.js +4 -0
  50. package/build/cjs/lib/kit/hooks/useOneOf.js +4 -4
  51. package/build/esm/lib/core/components/Form/hooks/useField.js +4 -1
  52. package/build/esm/lib/core/components/Form/hooks/useStore.js +6 -0
  53. package/build/esm/lib/core/helpers.d.ts +1 -0
  54. package/build/esm/lib/core/helpers.js +2 -0
  55. package/build/esm/lib/core/types/specs.d.ts +0 -1
  56. package/build/esm/lib/kit/components/AccordeonCard/AccordeonCard.d.ts +1 -0
  57. package/build/esm/lib/kit/components/AccordeonCard/AccordeonCard.js +2 -2
  58. package/build/esm/lib/kit/components/Card/Card.d.ts +1 -0
  59. package/build/esm/lib/kit/components/Card/Card.js +2 -2
  60. package/build/esm/lib/kit/components/Inputs/ArrayBase/ArrayBase.js +2 -2
  61. package/build/esm/lib/kit/components/Inputs/CardOneOf/CardOneOf.js +2 -2
  62. package/build/esm/lib/kit/components/Inputs/Checkbox/Checkbox.js +2 -2
  63. package/build/esm/lib/kit/components/Inputs/FileInput/FileInput.js +3 -3
  64. package/build/esm/lib/kit/components/Inputs/MonacoInput/MonacoInputBase.js +5 -5
  65. package/build/esm/lib/kit/components/Inputs/MonacoInput/MonacoInputDialog.d.ts +1 -0
  66. package/build/esm/lib/kit/components/Inputs/MonacoInput/MonacoInputDialog.js +2 -2
  67. package/build/esm/lib/kit/components/Inputs/MultiSelect/MultiSelect.js +2 -2
  68. package/build/esm/lib/kit/components/Inputs/NumberWithScale/NumberWithScale.js +3 -3
  69. package/build/esm/lib/kit/components/Inputs/ObjectBase/ObjectBase.js +2 -2
  70. package/build/esm/lib/kit/components/Inputs/ObjectValueInput/ObjectValueInput.d.ts +2 -0
  71. package/build/esm/lib/kit/components/Inputs/ObjectValueInput/ObjectValueInput.js +27 -0
  72. package/build/esm/lib/kit/components/Inputs/ObjectValueInput/index.d.ts +1 -0
  73. package/build/esm/lib/kit/components/Inputs/ObjectValueInput/index.js +1 -0
  74. package/build/esm/lib/kit/components/Inputs/OneOf/OneOf.css +8 -8
  75. package/build/esm/lib/kit/components/Inputs/OneOf/OneOf.js +2 -2
  76. package/build/esm/lib/kit/components/Inputs/OneOfCard/OneOfCard.js +3 -3
  77. package/build/esm/lib/kit/components/Inputs/Secret/Secret.js +17 -7
  78. package/build/esm/lib/kit/components/Inputs/Select/Select.js +2 -2
  79. package/build/esm/lib/kit/components/Inputs/TableArrayInput/TableArrayInput.js +3 -3
  80. package/build/esm/lib/kit/components/Inputs/Text/Text.d.ts +1 -1
  81. package/build/esm/lib/kit/components/Inputs/Text/Text.js +2 -2
  82. package/build/esm/lib/kit/components/Inputs/TextArea/TextArea.js +2 -2
  83. package/build/esm/lib/kit/components/Inputs/TextLink/TextLink.js +18 -5
  84. package/build/esm/lib/kit/components/Inputs/index.d.ts +1 -0
  85. package/build/esm/lib/kit/components/Inputs/index.js +1 -0
  86. package/build/esm/lib/kit/components/Layouts/Accordeon/Accordeon.js +3 -3
  87. package/build/esm/lib/kit/components/Layouts/Accordeon/RemoveButton.d.ts +1 -0
  88. package/build/esm/lib/kit/components/Layouts/Accordeon/RemoveButton.js +2 -2
  89. package/build/esm/lib/kit/components/Layouts/AccordeonCardLayout/AccordeonCardLayout.js +3 -3
  90. package/build/esm/lib/kit/components/Layouts/CardAccordeon.js +3 -3
  91. package/build/esm/lib/kit/components/Layouts/CardSection.js +3 -3
  92. package/build/esm/lib/kit/components/Layouts/Row/Row.js +1 -1
  93. package/build/esm/lib/kit/components/Layouts/Row2/Row2.js +1 -1
  94. package/build/esm/lib/kit/components/Layouts/SectionCard/SectionCard.js +1 -1
  95. package/build/esm/lib/kit/components/Layouts/Transparent/Transparent.js +2 -2
  96. package/build/esm/lib/kit/components/SimpleVerticalAccordeon/SimpleVerticalAccordeon.css +1 -1
  97. package/build/esm/lib/kit/components/SimpleVerticalAccordeon/SimpleVerticalAccordeon.d.ts +1 -0
  98. package/build/esm/lib/kit/components/SimpleVerticalAccordeon/SimpleVerticalAccordeon.js +2 -2
  99. package/build/esm/lib/kit/components/ViewLayouts/ViewAccordeon/ViewAccordeon.d.ts +1 -1
  100. package/build/esm/lib/kit/components/ViewLayouts/ViewAccordeon/ViewAccordeon.js +2 -2
  101. package/build/esm/lib/kit/components/ViewLayouts/ViewAccordeonCard/ViewAccordeonCard.d.ts +1 -1
  102. package/build/esm/lib/kit/components/ViewLayouts/ViewAccordeonCard/ViewAccordeonCard.js +2 -2
  103. package/build/esm/lib/kit/components/ViewLayouts/ViewCardAccordeon.d.ts +1 -1
  104. package/build/esm/lib/kit/components/ViewLayouts/ViewCardAccordeon.js +2 -2
  105. package/build/esm/lib/kit/components/ViewLayouts/ViewCardSection.d.ts +1 -1
  106. package/build/esm/lib/kit/components/ViewLayouts/ViewCardSection.js +2 -2
  107. package/build/esm/lib/kit/components/Views/CardOneOfView.js +1 -1
  108. package/build/esm/lib/kit/components/Views/ObjectValueInputView/ObjectValueInputView.d.ts +2 -0
  109. package/build/esm/lib/kit/components/Views/ObjectValueInputView/ObjectValueInputView.js +25 -0
  110. package/build/esm/lib/kit/components/Views/ObjectValueInputView/index.d.ts +1 -0
  111. package/build/esm/lib/kit/components/Views/ObjectValueInputView/index.js +1 -0
  112. package/build/esm/lib/kit/components/Views/OneOfCardView.js +1 -1
  113. package/build/esm/lib/kit/components/Views/TextLinkView/TextLinkView.js +23 -8
  114. package/build/esm/lib/kit/components/Views/index.d.ts +1 -0
  115. package/build/esm/lib/kit/components/Views/index.js +1 -0
  116. package/build/esm/lib/kit/constants/config.js +5 -1
  117. package/build/esm/lib/kit/hooks/useOneOf.js +4 -4
  118. package/package.json +4 -4
@@ -4,7 +4,7 @@ import { block, divide, isCorrectSizeParams, multiply } from '../../../utils';
4
4
  import { useInitial } from './useInitial';
5
5
  import './NumberWithScale.css';
6
6
  const b = block('number-with-scale');
7
- const NumberWithScaleBase = ({ input, spec }) => {
7
+ const NumberWithScaleBase = ({ name, input, spec }) => {
8
8
  const { value = '', onBlur, onFocus, onChange } = input;
9
9
  const { sizeParams, disabled, placeholder } = spec.viewSpec;
10
10
  const { defaultType, scale } = sizeParams;
@@ -61,7 +61,7 @@ const NumberWithScaleBase = ({ input, spec }) => {
61
61
  }
62
62
  }, [setPreparedValue, setScaleValue, incorrectStringNumber, value, scale, defaultType]);
63
63
  return (React.createElement("div", { className: b('wrapper') },
64
- React.createElement(TextInput, { value: preparedValue, onBlur: onBlur, onFocus: onFocus, onUpdate: handleChange, placeholder: placeholder, disabled: disabled }),
65
- React.createElement(Select, { width: "max", className: b('select', 'df-error-wrapper-ignore'), value: [scaleValue], options: scaleOptions, onUpdate: handleScaleChange, disabled: disabled || incorrectStringNumber })));
64
+ React.createElement(TextInput, { value: preparedValue, onBlur: onBlur, onFocus: onFocus, onUpdate: handleChange, placeholder: placeholder, disabled: disabled, qa: name }),
65
+ React.createElement(Select, { width: "max", className: b('select', 'df-error-wrapper-ignore'), value: [scaleValue], options: scaleOptions, onUpdate: handleScaleChange, disabled: disabled || incorrectStringNumber, qa: `${name}-scale` })));
66
66
  };
67
67
  export const NumberWithScale = (props) => isCorrectSizeParams(props.spec) ? React.createElement(NumberWithScaleBase, Object.assign({}, props)) : null;
@@ -8,7 +8,7 @@ export const ObjectBase = (_a) => {
8
8
  var { spec, name, Layout } = _a, restProps = __rest(_a, ["spec", "name", "Layout"]);
9
9
  const addBtn = React.useMemo(() => {
10
10
  var _a;
11
- return (React.createElement(Button, { onClick: () => restProps.input.onChange(transformArrIn(spec.defaultValue) || {}), disabled: (_a = spec.viewSpec) === null || _a === void 0 ? void 0 : _a.disabled },
11
+ return (React.createElement(Button, { onClick: () => restProps.input.onChange(transformArrIn(spec.defaultValue) || {}), disabled: (_a = spec.viewSpec) === null || _a === void 0 ? void 0 : _a.disabled, qa: `${name}-init-obj` },
12
12
  React.createElement(Icon, { data: Plus, size: 14 }),
13
13
  spec.viewSpec.layoutTitle || null));
14
14
  }, [spec.defaultValue, spec.viewSpec.layoutTitle, restProps.input.onChange]);
@@ -18,7 +18,7 @@ export const ObjectBase = (_a) => {
18
18
  if (!_.isObjectLike(spec.properties) || !Object.keys(spec.properties || {}).length) {
19
19
  return null;
20
20
  }
21
- if (!restProps.input.value && !spec.viewSpec.showOptional) {
21
+ if (!restProps.input.value) {
22
22
  return addBtn;
23
23
  }
24
24
  const specProperties = Object.assign({}, spec.properties);
@@ -0,0 +1,2 @@
1
+ import { ObjectIndependentInput } from '../../../../core';
2
+ export declare const ObjectValueInput: ObjectIndependentInput;
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import _ from 'lodash';
3
+ import { Controller } from '../../../../core';
4
+ const OBJECT_VALUE_PROPERTY_NAME = 'value';
5
+ export const ObjectValueInput = (props) => {
6
+ var _a;
7
+ const { spec, input, name, Layout } = props;
8
+ const parentOnChange = React.useCallback((childName, childValue, childErrors) => input.onChange((currentValue) => _.set(Object.assign({}, currentValue), childName.split(`${name}.`).join(''), childValue), childErrors), [input.onChange, input.name]);
9
+ const parentOnUnmount = React.useCallback((childName) => input.onChange((currentValue) => currentValue, { [childName]: false }), [input.onChange]);
10
+ const childSpec = React.useMemo(() => {
11
+ var _a;
12
+ if ((_a = spec.properties) === null || _a === void 0 ? void 0 : _a[OBJECT_VALUE_PROPERTY_NAME]) {
13
+ const childSpec = _.cloneDeep(spec.properties[OBJECT_VALUE_PROPERTY_NAME]);
14
+ childSpec.viewSpec.layout = '';
15
+ return childSpec;
16
+ }
17
+ return undefined;
18
+ }, [spec.properties]);
19
+ if (!childSpec) {
20
+ return null;
21
+ }
22
+ const content = (React.createElement(Controller, { initialValue: (_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: parentOnUnmount }));
23
+ if (Layout) {
24
+ return React.createElement(Layout, Object.assign({}, props), content);
25
+ }
26
+ return React.createElement(React.Fragment, null, content);
27
+ };
@@ -0,0 +1 @@
1
+ export * from './ObjectValueInput';
@@ -0,0 +1 @@
1
+ export * from './ObjectValueInput';
@@ -1,27 +1,27 @@
1
1
  .df-oneof {
2
2
  display: flex;
3
- flex-direction: column-reverse;
3
+ flex-direction: column;
4
4
  }
5
5
  .df-oneof:last-child > .df-group-indent {
6
6
  margin-bottom: 0;
7
7
  }
8
- .df-oneof:last-child > .df-group-indent:empty + .df-oneof__toggler {
9
- margin-bottom: 0;
10
- }
11
- .df-oneof__toggler {
12
- margin-bottom: 15px;
13
- }
14
8
  .df-oneof .df-group-indent {
15
9
  all: unset;
16
10
  }
17
11
  .df-oneof .df-group-indent > .df-use-search {
18
12
  padding-top: 11px;
19
13
  padding-left: 20px;
20
- margin-top: -11px;
14
+ margin-top: 4px;
21
15
  margin-bottom: 20px;
22
16
  margin-left: 5px;
23
17
  border-left: 1px solid var(--yc-color-line-generic-accent);
24
18
  }
25
19
  .df-oneof .df-group-indent > .df-use-search:empty {
26
20
  display: none;
21
+ }
22
+ .df-oneof .df-group-indent > .df-use-search:last-child {
23
+ margin-bottom: 0;
24
+ }
25
+ .df-oneof .df-group-indent > .df-use-search > .df-simple-vertical-accordeon_view {
26
+ margin-top: -10px;
27
27
  }
@@ -15,7 +15,7 @@ export const OneOf = (props) => {
15
15
  }, [props.input.onChange, props.input.name]);
16
16
  const parentOnUnmount = React.useCallback((childName) => props.input.onChange((currentValue) => currentValue, { [childName]: false }), [props.input.onChange]);
17
17
  return (React.createElement("div", { className: b() },
18
+ React.createElement("div", null, toggler),
18
19
  specProperties[oneOfValue] ? (React.createElement(GroupIndent, null,
19
- React.createElement(Controller, { initialValue: (_a = props.input.value) === null || _a === void 0 ? void 0 : _a[oneOfValue], spec: specProperties[oneOfValue], name: `${props.name}.${oneOfValue}`, parentOnChange: parentOnChange, parentOnUnmount: parentOnUnmount, key: `${props.name}.${oneOfValue}` }))) : null,
20
- React.createElement("div", { className: b('toggler') }, toggler)));
20
+ React.createElement(Controller, { initialValue: (_a = props.input.value) === null || _a === void 0 ? void 0 : _a[oneOfValue], spec: specProperties[oneOfValue], name: `${props.name}.${oneOfValue}`, parentOnChange: parentOnChange, parentOnUnmount: parentOnUnmount, key: `${props.name}.${oneOfValue}` }))) : null));
21
21
  };
@@ -26,15 +26,15 @@ export const OneOfCard = (props) => {
26
26
  }, [togglerInput, props, arrayItem]);
27
27
  const headerActionsTemplate = React.useMemo(() => {
28
28
  if (arrayItem) {
29
- return React.createElement(RemoveButton, { onDrop: input.onDrop });
29
+ return React.createElement(RemoveButton, { onDrop: input.onDrop, name: name });
30
30
  }
31
31
  return null;
32
- }, [arrayItem, input.onDrop]);
32
+ }, [arrayItem, input.onDrop, name]);
33
33
  const parentOnChange = React.useCallback((childName, childValue, childErrors) => {
34
34
  const value = _.set({}, childName.split(`${input.name}.`).join(''), childValue);
35
35
  input.onChange(value, childErrors);
36
36
  }, [input.onChange, input.name]);
37
37
  const parentOnUnmount = React.useCallback((childName) => input.onChange((currentValue) => currentValue, { [childName]: false }), [input.onChange]);
38
38
  useErrorChecker({ name, meta, open, setOpen });
39
- return (React.createElement(AccordeonCard, { className: b(), header: toggler, description: spec.viewSpec.layoutDescription || '', open: open, onToggle: onToggle, ignoreHeaderToggle: true, headerActionsTemplate: headerActionsTemplate }, specProperties[oneOfValue] ? (React.createElement(Controller, { initialValue: (_a = props.input.value) === null || _a === void 0 ? void 0 : _a[oneOfValue], spec: specProperties[oneOfValue], name: `${name}.${oneOfValue}`, parentOnChange: parentOnChange, parentOnUnmount: parentOnUnmount, key: `${name}.${oneOfValue}` })) : null));
39
+ return (React.createElement(AccordeonCard, { className: b(), name: name, header: toggler, description: spec.viewSpec.layoutDescription || '', open: open, onToggle: onToggle, ignoreHeaderToggle: true, headerActionsTemplate: headerActionsTemplate }, specProperties[oneOfValue] ? (React.createElement(Controller, { initialValue: (_a = props.input.value) === null || _a === void 0 ? void 0 : _a[oneOfValue], spec: specProperties[oneOfValue], name: `${name}.${oneOfValue}`, parentOnChange: parentOnChange, parentOnUnmount: parentOnUnmount, key: `${name}.${oneOfValue}` })) : null));
40
40
  };
@@ -1,17 +1,27 @@
1
1
  import React from 'react';
2
2
  import _ from 'lodash';
3
- import { Controller, } from '../../../../core';
3
+ import { Controller } from '../../../../core';
4
4
  const SECRET_PROPERTY_NAME = 'raw';
5
- export const Secret = ({ spec, name, input }) => {
5
+ export const Secret = (props) => {
6
6
  var _a;
7
+ const { spec, name, input, Layout } = props;
8
+ const childSpec = React.useMemo(() => {
9
+ var _a, _b;
10
+ if ((_a = spec.properties) === null || _a === void 0 ? void 0 : _a[SECRET_PROPERTY_NAME]) {
11
+ const childSpec = _.cloneDeep((_b = spec.properties) === null || _b === void 0 ? void 0 : _b[SECRET_PROPERTY_NAME]);
12
+ childSpec.viewSpec.layout = '';
13
+ return childSpec;
14
+ }
15
+ return undefined;
16
+ }, [spec.properties]);
7
17
  const parentOnChange = React.useCallback((childName, childValue, childErrors) => input.onChange((currentValue) => _.set(Object.assign({}, currentValue), childName.split(`${input.name}.`).join(''), childValue), childErrors), [input.onChange, input.name]);
8
18
  const parentOnUnmount = React.useCallback((childName) => input.onChange((currentValue) => currentValue, { [childName]: false }), [input.onChange]);
9
- if (!_.isObjectLike(spec.properties)) {
19
+ if (!childSpec) {
10
20
  return null;
11
21
  }
12
- const specProperties = Object.assign({}, spec.properties);
13
- if (!specProperties[SECRET_PROPERTY_NAME]) {
14
- return null;
22
+ const content = (React.createElement(Controller, { initialValue: (_a = input.value) === null || _a === void 0 ? void 0 : _a[SECRET_PROPERTY_NAME], spec: childSpec, name: `${name}.${SECRET_PROPERTY_NAME}`, parentOnChange: parentOnChange, parentOnUnmount: parentOnUnmount, key: `${name}.${SECRET_PROPERTY_NAME}` }));
23
+ if (Layout) {
24
+ return React.createElement(Layout, Object.assign({}, props), content);
15
25
  }
16
- return (React.createElement(Controller, { initialValue: (_a = input.value) === null || _a === void 0 ? void 0 : _a[SECRET_PROPERTY_NAME], spec: specProperties[SECRET_PROPERTY_NAME], name: `${name}.${SECRET_PROPERTY_NAME}`, parentOnChange: parentOnChange, parentOnUnmount: parentOnUnmount, key: `${name}.${SECRET_PROPERTY_NAME}` }));
26
+ return React.createElement(React.Fragment, null, content);
17
27
  };
@@ -3,7 +3,7 @@ import { Select as SelectBase } from '@gravity-ui/uikit';
3
3
  import { block } from '../../../utils';
4
4
  import './Select.css';
5
5
  const b = block('select');
6
- export const Select = ({ input, spec }) => {
6
+ export const Select = ({ name, input, spec }) => {
7
7
  var _a;
8
8
  const { value, onBlur, onChange, onFocus } = input;
9
9
  const filterable = React.useMemo(() => { var _a; return (((_a = spec.enum) === null || _a === void 0 ? void 0 : _a.length) || 0) > 9; }, [(_a = spec.enum) === null || _a === void 0 ? void 0 : _a.length]);
@@ -28,5 +28,5 @@ export const Select = ({ input, spec }) => {
28
28
  onBlur();
29
29
  }
30
30
  }, [onFocus, onBlur]);
31
- return (React.createElement(SelectBase, { className: b(), width: "max", value: [value], options: options, onUpdate: handleChange, onOpenChange: handleToggle, disabled: spec.viewSpec.disabled, placeholder: spec.viewSpec.placeholder, filterable: filterable }));
31
+ return (React.createElement(SelectBase, { className: b(), width: "max", value: [value], options: options, onUpdate: handleChange, onOpenChange: handleToggle, disabled: spec.viewSpec.disabled, placeholder: spec.viewSpec.placeholder, filterable: filterable, qa: name }));
32
32
  };
@@ -41,7 +41,7 @@ export const TableArrayInput = ({ spec, name, arrayInput, input }) => {
41
41
  id: 'remove',
42
42
  name: '',
43
43
  sticky: 'right',
44
- template: ({ key }) => (React.createElement(Button, { view: "flat", onClick: () => onItemRemove(key), key: `remove-${key}` },
44
+ template: ({ key }) => (React.createElement(Button, { view: "flat", onClick: () => onItemRemove(key), key: `remove-${key}`, qa: `${name}-item-remove-${key}` },
45
45
  React.createElement(Icon, { data: Xmark, size: 16 }))),
46
46
  };
47
47
  const columns = table.map(({ property, label }) => ({
@@ -74,9 +74,9 @@ export const TableArrayInput = ({ spec, name, arrayInput, input }) => {
74
74
  }
75
75
  return (React.createElement("div", { className: b() },
76
76
  keys.length ? (React.createElement(Table, { className: b('table'), data: keys, columns: columns, getRowId: (_, idx) => `${name}-${idx}`, verticalAlign: "top", getRowClassNames: getRowClassNames })) : null,
77
- !arrayInput.value && spec.defaultValue ? (React.createElement(Button, { onClick: () => input.onChange(transformArrIn(spec.defaultValue)), disabled: spec.viewSpec.disabled },
77
+ !arrayInput.value && spec.defaultValue ? (React.createElement(Button, { onClick: () => input.onChange(transformArrIn(spec.defaultValue)), disabled: spec.viewSpec.disabled, qa: `${name}-init-arr` },
78
78
  React.createElement(Icon, { data: Plus, size: 14 }),
79
- spec.viewSpec.layoutTitle || null)) : (React.createElement(Button, { onClick: onItemAdd, disabled: spec.viewSpec.disabled },
79
+ spec.viewSpec.layoutTitle || null)) : (React.createElement(Button, { onClick: onItemAdd, disabled: spec.viewSpec.disabled, qa: `${name}-add-item` },
80
80
  React.createElement(Icon, { data: Plus, size: 14 }),
81
81
  spec.viewSpec.itemLabel || null))));
82
82
  };
@@ -1,2 +1,2 @@
1
1
  import { NumberInputProps, StringInputProps } from '../../../../core';
2
- export declare const Text: <T extends NumberInputProps | StringInputProps>({ input, spec }: T) => JSX.Element;
2
+ export declare const Text: <T extends NumberInputProps | StringInputProps>({ name, input, spec }: T) => JSX.Element;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { TextInput } from '@gravity-ui/uikit';
3
3
  import _ from 'lodash';
4
- export const Text = ({ input, spec }) => {
4
+ export const Text = ({ name, input, spec }) => {
5
5
  const { value, onBlur, onChange, onFocus } = input;
6
6
  const handleChange = React.useCallback((value) => {
7
7
  onChange(value);
@@ -12,5 +12,5 @@ export const Text = ({ input, spec }) => {
12
12
  }
13
13
  return 'text';
14
14
  }, [spec.viewSpec.type]);
15
- return (React.createElement(TextInput, { type: type, value: _.isNil(value) ? '' : `${value}`, hasClear: true, onBlur: onBlur, onFocus: onFocus, onUpdate: handleChange, disabled: spec.viewSpec.disabled, placeholder: spec.viewSpec.placeholder, autoComplete: type === 'password' ? 'new-password' : undefined }));
15
+ return (React.createElement(TextInput, { type: type, value: _.isNil(value) ? '' : `${value}`, hasClear: true, onBlur: onBlur, onFocus: onFocus, onUpdate: handleChange, disabled: spec.viewSpec.disabled, placeholder: spec.viewSpec.placeholder, autoComplete: type === 'password' ? 'new-password' : undefined, qa: name }));
16
16
  };
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { TextInput as TextInputBase } from '@gravity-ui/uikit';
3
- export const TextArea = ({ input, spec }) => {
3
+ export const TextArea = ({ name, input, spec }) => {
4
4
  const { value, onBlur, onChange, onFocus } = input;
5
- return (React.createElement(TextInputBase, { value: value, onBlur: onBlur, onFocus: onFocus, onUpdate: onChange, maxRows: 20, minRows: 8, hasClear: true, disabled: spec.viewSpec.disabled, multiline: true, placeholder: spec.viewSpec.placeholder }));
5
+ return (React.createElement(TextInputBase, { value: value, onBlur: onBlur, onFocus: onFocus, onUpdate: onChange, maxRows: 20, minRows: 8, hasClear: true, disabled: spec.viewSpec.disabled, multiline: true, placeholder: spec.viewSpec.placeholder, qa: name }));
6
6
  };
@@ -2,14 +2,27 @@ import React from 'react';
2
2
  import _ from 'lodash';
3
3
  import { Controller, isStringSpec, } from '../../../../core';
4
4
  const TEXT_LINK_PROPERTY_NAME = 'text';
5
- export const TextLink = ({ spec, input, name }) => {
5
+ export const TextLink = (props) => {
6
6
  var _a;
7
+ const { spec, input, name, Layout } = props;
7
8
  const parentOnChange = React.useCallback((childName, childValue, childErrors) => input.onChange((currentValue) => _.set(Object.assign({}, currentValue), childName.split(`${name}.`).join(''), childValue), childErrors), [input.onChange, input.name]);
8
9
  const parentOnUnmount = React.useCallback((childName) => input.onChange((currentValue) => currentValue, { [childName]: false }), [input.onChange]);
9
- const specProperties = Object.assign({}, spec.properties);
10
- if (!specProperties[TEXT_LINK_PROPERTY_NAME] ||
11
- !isStringSpec(specProperties[TEXT_LINK_PROPERTY_NAME])) {
10
+ const childSpec = React.useMemo(() => {
11
+ var _a;
12
+ if (((_a = spec.properties) === null || _a === void 0 ? void 0 : _a[TEXT_LINK_PROPERTY_NAME]) &&
13
+ isStringSpec(spec.properties[TEXT_LINK_PROPERTY_NAME])) {
14
+ const childSpec = _.cloneDeep(spec.properties[TEXT_LINK_PROPERTY_NAME]);
15
+ childSpec.viewSpec.layout = '';
16
+ return childSpec;
17
+ }
18
+ return undefined;
19
+ }, [spec.properties]);
20
+ if (!childSpec) {
12
21
  return null;
13
22
  }
14
- return (React.createElement(Controller, { initialValue: (_a = input.value) === null || _a === void 0 ? void 0 : _a[TEXT_LINK_PROPERTY_NAME], spec: specProperties[TEXT_LINK_PROPERTY_NAME], name: `${name}.${TEXT_LINK_PROPERTY_NAME}`, key: `${name}.${TEXT_LINK_PROPERTY_NAME}`, parentOnChange: parentOnChange, parentOnUnmount: parentOnUnmount }));
23
+ const content = (React.createElement(Controller, { initialValue: (_a = input.value) === null || _a === void 0 ? void 0 : _a[TEXT_LINK_PROPERTY_NAME], spec: childSpec, name: `${name}.${TEXT_LINK_PROPERTY_NAME}`, key: `${name}.${TEXT_LINK_PROPERTY_NAME}`, parentOnChange: parentOnChange, parentOnUnmount: parentOnUnmount }));
24
+ if (Layout) {
25
+ return React.createElement(Layout, Object.assign({}, props), content);
26
+ }
27
+ return React.createElement(React.Fragment, null, content);
15
28
  };
@@ -4,6 +4,7 @@ export * from './Checkbox';
4
4
  export * from './FileInput';
5
5
  export * from './MultiSelect';
6
6
  export * from './ObjectBase';
7
+ export * from './ObjectValueInput';
7
8
  export * from './OneOf';
8
9
  export * from './OneOfCard';
9
10
  export * from './Secret';
@@ -4,6 +4,7 @@ export * from './Checkbox';
4
4
  export * from './FileInput';
5
5
  export * from './MultiSelect';
6
6
  export * from './ObjectBase';
7
+ export * from './ObjectValueInput';
7
8
  export * from './OneOf';
8
9
  export * from './OneOfCard';
9
10
  export * from './Secret';
@@ -14,9 +14,9 @@ export const Accordeon = ({ name, spec, input, meta, children, }) => {
14
14
  if (spec.required || !input.value) {
15
15
  return null;
16
16
  }
17
- return React.createElement(RemoveButton, { onDrop: onDrop });
18
- }, [spec.required, input.value, onDrop]);
17
+ return React.createElement(RemoveButton, { name: name, onDrop: onDrop });
18
+ }, [spec.required, input.value, onDrop, name]);
19
19
  useErrorChecker({ name, meta, open, setOpen });
20
- return (React.createElement(SimpleVerticalAccordeon, { title: spec.viewSpec.layoutTitle || '', note: spec.viewSpec.layoutDescription || '', open: open, onOpenChange: setOpen, headerActionsTemplate: removeButton, hideInsteadOfDestroy: true, withBranchView: true },
20
+ return (React.createElement(SimpleVerticalAccordeon, { name: name, title: spec.viewSpec.layoutTitle || '', note: spec.viewSpec.layoutDescription || '', open: open, onOpenChange: setOpen, headerActionsTemplate: removeButton, hideInsteadOfDestroy: true, withBranchView: true },
21
21
  React.createElement(ErrorWrapper, { name: name, meta: meta, withoutChildErrorStyles: true }, children)));
22
22
  };
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  export interface RemoveButtonProps {
3
+ name: string;
3
4
  onDrop: () => void;
4
5
  }
5
6
  export declare const RemoveButton: React.FC<RemoveButtonProps>;
@@ -2,9 +2,9 @@ import React from 'react';
2
2
  import { Ellipsis } from '@gravity-ui/icons';
3
3
  import { Button, DropdownMenu, Icon } from '@gravity-ui/uikit';
4
4
  import i18n from '../../../i18n';
5
- export const RemoveButton = ({ onDrop }) => {
5
+ export const RemoveButton = ({ name, onDrop }) => {
6
6
  const items = React.useMemo(() => [{ text: i18n('label_delete'), action: onDrop, theme: 'danger' }], [onDrop]);
7
- const switcher = React.useMemo(() => (React.createElement(Button, { view: "flat" },
7
+ const switcher = React.useMemo(() => (React.createElement(Button, { view: "flat", qa: `${name}-drop-item` },
8
8
  React.createElement(Icon, { data: Ellipsis, size: 16 }))), []);
9
9
  return React.createElement(DropdownMenu, { switcher: switcher, items: items });
10
10
  };
@@ -18,9 +18,9 @@ export const AccordeonCardLayout = ({ name, spec, input, meta, children, }) => {
18
18
  if (spec.required || !input.value) {
19
19
  return null;
20
20
  }
21
- return React.createElement(RemoveButton, { onDrop: onDrop });
22
- }, [spec.required, input.value, onDrop]);
21
+ return React.createElement(RemoveButton, { onDrop: onDrop, name: name });
22
+ }, [spec.required, input.value, onDrop, name]);
23
23
  useErrorChecker({ name, meta, open, setOpen });
24
- return (React.createElement(AccordeonCard, { header: spec.viewSpec.layoutTitle || '', description: spec.viewSpec.layoutDescription || '', open: open, onToggle: onToggle, headerActionsTemplate: removeButton, className: b() },
24
+ return (React.createElement(AccordeonCard, { name: name, header: spec.viewSpec.layoutTitle || '', description: spec.viewSpec.layoutDescription || '', open: open, onToggle: onToggle, headerActionsTemplate: removeButton, className: b() },
25
25
  React.createElement(ErrorWrapper, { name: name, meta: meta, withoutChildErrorStyles: true }, children)));
26
26
  };
@@ -14,9 +14,9 @@ export const CardAccordeon = ({ name, spec, input, meta, children, }) => {
14
14
  if (spec.required || !input.value) {
15
15
  return null;
16
16
  }
17
- return React.createElement(RemoveButton, { onDrop: onDrop });
18
- }, [spec.required, input.value, onDrop]);
17
+ return React.createElement(RemoveButton, { onDrop: onDrop, name: name });
18
+ }, [spec.required, input.value, onDrop, name]);
19
19
  useErrorChecker({ name, meta, open, setOpen });
20
- return (React.createElement(Card, { title: spec.viewSpec.layoutTitle, description: spec.viewSpec.layoutDescription, actions: removeButton, open: open, onToggle: onToggle },
20
+ return (React.createElement(Card, { name: name, title: spec.viewSpec.layoutTitle, description: spec.viewSpec.layoutDescription, actions: removeButton, open: open, onToggle: onToggle },
21
21
  React.createElement(ErrorWrapper, { name: name, meta: meta, withoutChildErrorStyles: true }, children)));
22
22
  };
@@ -6,8 +6,8 @@ export const CardSection = ({ name, spec, input, meta, children, }) => {
6
6
  if (spec.required || !input.value) {
7
7
  return null;
8
8
  }
9
- return React.createElement(RemoveButton, { onDrop: input.onDrop });
10
- }, [spec.required, input.value, input.onDrop]);
11
- return (React.createElement(Card, { title: spec.viewSpec.layoutTitle, description: spec.viewSpec.layoutDescription, actions: removeButton, alwaysOpen: true },
9
+ return React.createElement(RemoveButton, { onDrop: input.onDrop, name: name });
10
+ }, [spec.required, input.value, input.onDrop, name]);
11
+ return (React.createElement(Card, { name: name, title: spec.viewSpec.layoutTitle, description: spec.viewSpec.layoutDescription, actions: removeButton, alwaysOpen: true },
12
12
  React.createElement(ErrorWrapper, { name: name, meta: meta, withoutChildErrorStyles: true }, children)));
13
13
  };
@@ -18,7 +18,7 @@ const RowBase = ({ name, spec, input, meta, verboseDescription, children, }) =>
18
18
  React.createElement("div", { className: b('right') },
19
19
  React.createElement("div", { className: b('right-inner') },
20
20
  React.createElement(ErrorWrapper, { name: name, meta: meta, withoutChildErrorStyles: isArraySpec(spec) || isObjectSpec(spec) }, children),
21
- arrayItem ? (React.createElement(Button, { view: "flat", className: b('remove-button'), onClick: input.onDrop },
21
+ arrayItem ? (React.createElement(Button, { view: "flat", className: b('remove-button'), onClick: input.onDrop, qa: `${name}-remove-item` },
22
22
  React.createElement(Icon, { data: Xmark, size: 16 }))) : null),
23
23
  verboseDescription && spec.viewSpec.layoutDescription ? (React.createElement("div", { className: b('description'), dangerouslySetInnerHTML: { __html: spec.viewSpec.layoutDescription } })) : null)));
24
24
  };
@@ -15,7 +15,7 @@ export const Row2 = ({ name, spec, input, meta, children, }) => {
15
15
  React.createElement("div", { className: b('right') },
16
16
  React.createElement("div", { className: b('right-inner') },
17
17
  React.createElement(ErrorWrapper, { name: name, meta: meta, withoutChildErrorStyles: isArraySpec(spec) || isObjectSpec(spec) }, children),
18
- isArrayItem(name) ? (React.createElement(Button, { view: "flat", className: b('remove-button'), onClick: input.onDrop },
18
+ isArrayItem(name) ? (React.createElement(Button, { view: "flat", className: b('remove-button'), onClick: input.onDrop, qa: `${name}-remove-item` },
19
19
  React.createElement(Icon, { data: Xmark, size: 16 }))) : null),
20
20
  spec.viewSpec.layoutDescription ? (React.createElement("div", { className: b('description'), dangerouslySetInnerHTML: { __html: spec.viewSpec.layoutDescription } })) : null)));
21
21
  };
@@ -14,7 +14,7 @@ const SectionCardBase = (_a) => {
14
14
  if (meta) {
15
15
  content = (React.createElement(ErrorWrapper, { name: name, meta: meta, withoutChildErrorStyles: arrOrObjFlag }, content));
16
16
  }
17
- return (React.createElement(AccordeonCard, { className: b(), header: spec.viewSpec.layoutTitle, description: ignoreDescription ? undefined : spec.viewSpec.layoutDescription, titleSize: titleSize, alwaysOpen: true }, content));
17
+ return (React.createElement(AccordeonCard, { className: b(), name: name, header: spec.viewSpec.layoutTitle, description: ignoreDescription ? undefined : spec.viewSpec.layoutDescription, titleSize: titleSize, alwaysOpen: true }, content));
18
18
  };
19
19
  export const SectionCard = (props) => React.createElement(SectionCardBase, Object.assign({}, props, { titleSize: "m" }));
20
20
  export const SectionCard2 = (props) => React.createElement(SectionCardBase, Object.assign({}, props, { titleSize: "s" }));
@@ -11,11 +11,11 @@ export const Transparent = ({ name, spec, input, meta, children, }) => {
11
11
  const arrOrObjFlag = React.useMemo(() => isArraySpec(spec) || isObjectSpec(spec), [spec]);
12
12
  const removeButton = React.useMemo(() => {
13
13
  if (arrayItem) {
14
- return (React.createElement(Button, { view: "flat", className: b('remove-button'), onClick: input.onDrop },
14
+ return (React.createElement(Button, { view: "flat", className: b('remove-button'), onClick: input.onDrop, qa: `${name}-remove-item` },
15
15
  React.createElement(Icon, { data: Xmark, size: 16 })));
16
16
  }
17
17
  return null;
18
- }, [input.onDrop, arrayItem]);
18
+ }, [input.onDrop, arrayItem, name]);
19
19
  return (React.createElement("div", { className: b({
20
20
  'array-item': arrayItem && !arrOrObjFlag,
21
21
  'without-max-width': arrOrObjFlag,
@@ -32,7 +32,7 @@
32
32
  font-size: var(--yc-text-body3-font-size);
33
33
  }
34
34
  .df-simple-vertical-accordeon__tooltip {
35
- margin-right: 8px;
35
+ margin: 0px 5px;
36
36
  }
37
37
  .df-simple-vertical-accordeon__tooltip .yc-help-popover {
38
38
  display: flex;
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import './SimpleVerticalAccordeon.css';
3
3
  interface SimpleVerticalAccordeonProps {
4
4
  children: React.ReactNode;
5
+ name: string;
5
6
  title: string;
6
7
  titleSize?: 's' | 'm' | 'l';
7
8
  note?: string;
@@ -44,7 +44,7 @@ export class SimpleVerticalAccordeon extends React.Component {
44
44
  this.checkVisibility();
45
45
  }
46
46
  render() {
47
- const { titleSize, children, headerActionsTemplate, className, contentClassName, buttonClassName, hideInsteadOfDestroy, withBranchView, viewLayout, } = this.props;
47
+ const { titleSize, children, headerActionsTemplate, className, contentClassName, buttonClassName, hideInsteadOfDestroy, withBranchView, viewLayout, name, } = this.props;
48
48
  const { open, hidden, isFirstRender } = this.state;
49
49
  const content = hideInsteadOfDestroy ? (React.createElement("div", { ref: this.componentRef, className: b('body', { hidden: !open }) }, children)) : (open && (React.createElement("div", { ref: this.componentRef, className: b('body', contentClassName) }, children)));
50
50
  if (viewLayout && !isFirstRender && hidden) {
@@ -52,7 +52,7 @@ export class SimpleVerticalAccordeon extends React.Component {
52
52
  }
53
53
  return (Boolean(React.Children.count(children)) && (React.createElement("div", { className: b({ branch: withBranchView, view: viewLayout }, className) },
54
54
  React.createElement("div", { className: b('header') },
55
- React.createElement(Button, { view: "flat", className: b('header-inner', buttonClassName), onClick: this.handleClick },
55
+ React.createElement(Button, { view: "flat", className: b('header-inner', buttonClassName), onClick: this.handleClick, qa: `${name}-accordeon-toggler` },
56
56
  React.createElement("b", { className: b('title', { size: titleSize }) }, this.getTitle()),
57
57
  React.createElement(Icon, { data: ChevronDown, className: b('chevron', { open }), size: 16 })),
58
58
  this.getTooltip(),
@@ -1,2 +1,2 @@
1
1
  import { ArrayViewLayoutProps, ObjectViewLayoutProps } from '../../../../core';
2
- export declare const ViewAccordeon: <T extends ArrayViewLayoutProps | ObjectViewLayoutProps>({ value, spec, children, }: T) => JSX.Element | null;
2
+ export declare const ViewAccordeon: <T extends ArrayViewLayoutProps | ObjectViewLayoutProps>({ name, value, spec, children, }: T) => JSX.Element | null;
@@ -1,10 +1,10 @@
1
1
  import React from 'react';
2
2
  import { isNotEmptyValue } from '../../../utils';
3
3
  import { SimpleVerticalAccordeon } from '../../SimpleVerticalAccordeon';
4
- export const ViewAccordeon = ({ value, spec, children, }) => {
4
+ export const ViewAccordeon = ({ name, value, spec, children, }) => {
5
5
  const [open, setOpen] = React.useState(true);
6
6
  if (!isNotEmptyValue(value, spec)) {
7
7
  return null;
8
8
  }
9
- return (React.createElement(SimpleVerticalAccordeon, { title: spec.viewSpec.layoutTitle || '', open: open, onOpenChange: setOpen, hideInsteadOfDestroy: true, withBranchView: true, viewLayout: true }, children));
9
+ return (React.createElement(SimpleVerticalAccordeon, { name: name, title: spec.viewSpec.layoutTitle || '', open: open, onOpenChange: setOpen, hideInsteadOfDestroy: true, withBranchView: true, viewLayout: true }, children));
10
10
  };
@@ -1,2 +1,2 @@
1
1
  import { ArrayViewLayoutProps, ObjectViewLayoutProps } from '../../../../core';
2
- export declare const ViewAccordeonCard: <T extends ArrayViewLayoutProps | ObjectViewLayoutProps>({ value, spec, children, }: T) => JSX.Element | null;
2
+ export declare const ViewAccordeonCard: <T extends ArrayViewLayoutProps | ObjectViewLayoutProps>({ name, value, spec, children, }: T) => JSX.Element | null;
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
2
  import { AccordeonCard } from '../../';
3
3
  import { isNotEmptyValue } from '../../../utils';
4
- export const ViewAccordeonCard = ({ value, spec, children, }) => {
4
+ export const ViewAccordeonCard = ({ name, value, spec, children, }) => {
5
5
  const [open, setOpen] = React.useState(true);
6
6
  const onToggle = React.useCallback(() => setOpen((f) => !f), [setOpen]);
7
7
  if (!isNotEmptyValue(value, spec)) {
8
8
  return null;
9
9
  }
10
- return (React.createElement(AccordeonCard, { header: spec.viewSpec.layoutTitle || '', open: open, onToggle: onToggle, className: "df-accordeon-card-layout" }, children));
10
+ return (React.createElement(AccordeonCard, { name: name, header: spec.viewSpec.layoutTitle || '', open: open, onToggle: onToggle, className: "df-accordeon-card-layout" }, children));
11
11
  };
@@ -1,2 +1,2 @@
1
1
  import { ArrayViewLayoutProps, ObjectViewLayoutProps } from '../../../core';
2
- export declare const ViewCardAccordeon: <T extends ArrayViewLayoutProps | ObjectViewLayoutProps>({ value, spec, children, }: T) => JSX.Element | null;
2
+ export declare const ViewCardAccordeon: <T extends ArrayViewLayoutProps | ObjectViewLayoutProps>({ name, value, spec, children, }: T) => JSX.Element | null;
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
2
  import { Card } from '../';
3
3
  import { isNotEmptyValue } from '../../utils';
4
- export const ViewCardAccordeon = ({ value, spec, children, }) => {
4
+ export const ViewCardAccordeon = ({ name, value, spec, children, }) => {
5
5
  const [open, setOpen] = React.useState(true);
6
6
  const onToggle = React.useCallback(() => setOpen((f) => !f), [setOpen]);
7
7
  if (!isNotEmptyValue(value, spec)) {
8
8
  return null;
9
9
  }
10
- return (React.createElement(Card, { title: spec.viewSpec.layoutTitle, open: open, onToggle: onToggle, checkEmptyBody: true }, children));
10
+ return (React.createElement(Card, { name: name, title: spec.viewSpec.layoutTitle, open: open, onToggle: onToggle, checkEmptyBody: true }, children));
11
11
  };
@@ -1,2 +1,2 @@
1
1
  import { FormValue, Spec, ViewLayoutProps } from '../../../core';
2
- export declare const ViewCardSection: <T extends FormValue, S extends Spec>({ value, spec, children, }: ViewLayoutProps<T, S>) => JSX.Element | null;
2
+ export declare const ViewCardSection: <T extends FormValue, S extends Spec>({ name, value, spec, children, }: ViewLayoutProps<T, S>) => JSX.Element | null;
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  import { Card } from '../../components';
3
3
  import { isNotEmptyValue } from '../../utils';
4
- export const ViewCardSection = ({ value, spec, children, }) => {
4
+ export const ViewCardSection = ({ name, value, spec, children, }) => {
5
5
  if (!isNotEmptyValue(value, spec)) {
6
6
  return null;
7
7
  }
8
- return (React.createElement(Card, { title: spec.viewSpec.layoutTitle, alwaysOpen: true, checkEmptyBody: true }, children));
8
+ return (React.createElement(Card, { name: name, title: spec.viewSpec.layoutTitle, alwaysOpen: true, checkEmptyBody: true }, children));
9
9
  };
@@ -19,5 +19,5 @@ export const CardOneOfView = (props) => {
19
19
  if (!value || !Object.keys(value).length) {
20
20
  return null;
21
21
  }
22
- return (React.createElement(Card, { title: title, open: open, onToggle: onToggle, disableHeaderToggle: true, checkEmptyBody: true }, specProperties[valueKey] ? (React.createElement(ViewController, { spec: specProperties[valueKey], name: `${name}.${valueKey}`, key: `${name}.${valueKey}` })) : null));
22
+ return (React.createElement(Card, { name: name, title: title, open: open, onToggle: onToggle, disableHeaderToggle: true, checkEmptyBody: true }, specProperties[valueKey] ? (React.createElement(ViewController, { spec: specProperties[valueKey], name: `${name}.${valueKey}`, key: `${name}.${valueKey}` })) : null));
23
23
  };
@@ -0,0 +1,2 @@
1
+ import { ObjectIndependentView } from '../../../../core';
2
+ export declare const ObjectValueInputView: ObjectIndependentView;
@@ -0,0 +1,25 @@
1
+ import { __rest } from "tslib";
2
+ import React from 'react';
3
+ import _ from 'lodash';
4
+ import { ViewController } from '../../../../core';
5
+ const OBJECT_VALUE_PROPERTY_NAME = 'value';
6
+ export const ObjectValueInputView = (_a) => {
7
+ var { spec, name, Layout } = _a, restProps = __rest(_a, ["spec", "name", "Layout"]);
8
+ const childSpec = React.useMemo(() => {
9
+ var _a;
10
+ if ((_a = spec.properties) === null || _a === void 0 ? void 0 : _a[OBJECT_VALUE_PROPERTY_NAME]) {
11
+ const childSpec = _.cloneDeep(spec.properties[OBJECT_VALUE_PROPERTY_NAME]);
12
+ childSpec.viewSpec.layout = '';
13
+ return childSpec;
14
+ }
15
+ return undefined;
16
+ }, [spec.properties]);
17
+ if (!childSpec) {
18
+ return null;
19
+ }
20
+ const content = (React.createElement(ViewController, { spec: childSpec, name: `${name}.${OBJECT_VALUE_PROPERTY_NAME}` }));
21
+ if (Layout) {
22
+ return (React.createElement(Layout, Object.assign({ spec: spec, name: name }, restProps), content));
23
+ }
24
+ return React.createElement(React.Fragment, null, content);
25
+ };
@@ -0,0 +1 @@
1
+ export * from './ObjectValueInputView';
@@ -0,0 +1 @@
1
+ export * from './ObjectValueInputView';