@gravity-ui/dynamic-forms 3.5.0 → 3.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 (67) hide show
  1. package/build/cjs/lib/core/components/Form/Controller/utils.js +4 -3
  2. package/build/cjs/lib/kit/components/AccordeonCard/AccordeonCard.css +13 -2
  3. package/build/cjs/lib/kit/components/AccordeonCard/AccordeonCard.js +2 -2
  4. package/build/cjs/lib/kit/components/Inputs/CardOneOf/CardOneOf.js +1 -1
  5. package/build/cjs/lib/kit/components/Inputs/MultiSelect/MultiSelect.js +23 -14
  6. package/build/cjs/lib/kit/components/Inputs/Select/Select.js +23 -14
  7. package/build/cjs/lib/kit/components/Inputs/Text/Text.js +2 -11
  8. package/build/cjs/lib/kit/components/Inputs/TextArea/TextArea.js +2 -2
  9. package/build/cjs/lib/kit/components/Layouts/Accordeon/Accordeon.js +1 -1
  10. package/build/cjs/lib/kit/components/Layouts/AccordeonCard/AccordeonCardForm.css +3 -0
  11. package/build/cjs/lib/kit/components/Layouts/AccordeonCard/AccordeonCardForm.js +29 -0
  12. package/build/cjs/lib/kit/components/Layouts/AccordeonCard/index.js +4 -0
  13. package/build/cjs/lib/kit/components/Layouts/CardAccordeon.js +1 -1
  14. package/build/cjs/lib/kit/components/Layouts/CardSection.js +1 -1
  15. package/build/cjs/lib/kit/components/Layouts/index.js +1 -0
  16. package/build/cjs/lib/kit/components/{Layouts/Accordeon → RemoveButton}/RemoveButton.js +1 -1
  17. package/build/cjs/lib/kit/components/RemoveButton/index.js +4 -0
  18. package/build/cjs/lib/kit/components/ViewLayouts/ViewAccordeonCard/ViewAccordeonCard.js +16 -0
  19. package/build/cjs/lib/kit/components/ViewLayouts/ViewAccordeonCard/index.js +4 -0
  20. package/build/cjs/lib/kit/components/ViewLayouts/index.js +1 -0
  21. package/build/cjs/lib/kit/constants/config.js +4 -0
  22. package/build/esm/lib/core/components/Form/Controller/utils.js +4 -3
  23. package/build/esm/lib/core/components/Form/hooks/useGenerateRandomValue.d.ts +1 -1
  24. package/build/esm/lib/core/components/Form/types/array.d.ts +6 -6
  25. package/build/esm/lib/core/components/Form/types/boolean.d.ts +6 -6
  26. package/build/esm/lib/core/components/Form/types/input.d.ts +2 -0
  27. package/build/esm/lib/core/components/Form/types/layout.d.ts +1 -0
  28. package/build/esm/lib/core/components/Form/types/number.d.ts +6 -6
  29. package/build/esm/lib/core/components/Form/types/object.d.ts +6 -6
  30. package/build/esm/lib/core/components/Form/types/string.d.ts +6 -6
  31. package/build/esm/lib/core/helpers.d.ts +5 -5
  32. package/build/esm/lib/core/types/specs.d.ts +15 -5
  33. package/build/esm/lib/kit/components/AccordeonCard/AccordeonCard.css +13 -2
  34. package/build/esm/lib/kit/components/AccordeonCard/AccordeonCard.d.ts +1 -0
  35. package/build/esm/lib/kit/components/AccordeonCard/AccordeonCard.js +2 -2
  36. package/build/esm/lib/kit/components/Inputs/CardOneOf/CardOneOf.js +1 -1
  37. package/build/esm/lib/kit/components/Inputs/MultiSelect/MultiSelect.d.ts +5 -1
  38. package/build/esm/lib/kit/components/Inputs/MultiSelect/MultiSelect.js +23 -14
  39. package/build/esm/lib/kit/components/Inputs/Select/Select.d.ts +5 -1
  40. package/build/esm/lib/kit/components/Inputs/Select/Select.js +23 -14
  41. package/build/esm/lib/kit/components/Inputs/Text/Text.d.ts +4 -1
  42. package/build/esm/lib/kit/components/Inputs/Text/Text.js +2 -11
  43. package/build/esm/lib/kit/components/Inputs/TextArea/TextArea.d.ts +4 -1
  44. package/build/esm/lib/kit/components/Inputs/TextArea/TextArea.js +2 -2
  45. package/build/esm/lib/kit/components/Layouts/Accordeon/Accordeon.d.ts +1 -1
  46. package/build/esm/lib/kit/components/Layouts/Accordeon/Accordeon.js +1 -1
  47. package/build/esm/lib/kit/components/Layouts/AccordeonCard/AccordeonCardForm.css +3 -0
  48. package/build/esm/lib/kit/components/Layouts/AccordeonCard/AccordeonCardForm.d.ts +3 -0
  49. package/build/esm/lib/kit/components/Layouts/AccordeonCard/AccordeonCardForm.js +25 -0
  50. package/build/esm/lib/kit/components/Layouts/AccordeonCard/index.d.ts +1 -0
  51. package/build/esm/lib/kit/components/Layouts/AccordeonCard/index.js +1 -0
  52. package/build/esm/lib/kit/components/Layouts/CardAccordeon.js +1 -1
  53. package/build/esm/lib/kit/components/Layouts/CardSection.js +1 -1
  54. package/build/esm/lib/kit/components/Layouts/index.d.ts +1 -0
  55. package/build/esm/lib/kit/components/Layouts/index.js +1 -0
  56. package/build/esm/lib/kit/components/{Layouts/Accordeon → RemoveButton}/RemoveButton.js +1 -1
  57. package/build/esm/lib/kit/components/RemoveButton/index.d.ts +1 -0
  58. package/build/esm/lib/kit/components/RemoveButton/index.js +1 -0
  59. package/build/esm/lib/kit/components/ViewLayouts/ViewAccordeonCard/ViewAccordeonCard.d.ts +2 -0
  60. package/build/esm/lib/kit/components/ViewLayouts/ViewAccordeonCard/ViewAccordeonCard.js +11 -0
  61. package/build/esm/lib/kit/components/ViewLayouts/ViewAccordeonCard/index.d.ts +1 -0
  62. package/build/esm/lib/kit/components/ViewLayouts/ViewAccordeonCard/index.js +1 -0
  63. package/build/esm/lib/kit/components/ViewLayouts/index.d.ts +1 -0
  64. package/build/esm/lib/kit/components/ViewLayouts/index.js +1 -0
  65. package/build/esm/lib/kit/constants/config.js +5 -1
  66. package/package.json +1 -1
  67. /package/build/esm/lib/kit/components/{Layouts/Accordeon → RemoveButton}/RemoveButton.d.ts +0 -0
@@ -60,14 +60,15 @@ const getRender = ({ name, spec, inputEntity, Layout, }) => {
60
60
  const render = (props) => {
61
61
  if (inputEntity && (0, helpers_1.isCorrectSpec)(spec) && lodash_1.default.isString(name)) {
62
62
  if (!spec.viewSpec.hidden) {
63
+ const { layoutProps, inputProps } = spec.viewSpec;
63
64
  if (inputEntity.independent) {
64
65
  const InputComponent = inputEntity.Component;
65
- return react_1.default.createElement(InputComponent, Object.assign({ spec: spec, name: name, Layout: Layout }, props));
66
+ return (react_1.default.createElement(InputComponent, Object.assign({ spec: spec, name: name, Layout: Layout, inputProps: inputProps, layoutProps: layoutProps }, props)));
66
67
  }
67
68
  const InputComponent = inputEntity.Component;
68
- const input = react_1.default.createElement(InputComponent, Object.assign({ spec: spec, name: name }, props));
69
+ const input = (react_1.default.createElement(InputComponent, Object.assign({ spec: spec, name: name, inputProps: inputProps }, props)));
69
70
  if (Layout) {
70
- return (react_1.default.createElement(Layout, Object.assign({ spec: spec, name: name }, props), input));
71
+ return (react_1.default.createElement(Layout, Object.assign({ spec: spec, name: name, layoutProps: layoutProps }, props), input));
71
72
  }
72
73
  return input;
73
74
  }
@@ -3,12 +3,24 @@
3
3
  flex-direction: column;
4
4
  justify-content: space-between;
5
5
  box-sizing: border-box;
6
- max-width: 750px;
7
6
  box-shadow: 0 1px 5px var(--g-color-sfx-shadow);
8
7
  border-radius: 5px;
9
8
  color: var(--g-color-text-primary);
10
9
  background-color: var(--g-color-base-float);
11
10
  }
11
+ .df-accordeon-card .df-row {
12
+ width: 100%;
13
+ max-width: unset;
14
+ }
15
+ .df-accordeon-card .df-row .df-select,
16
+ .df-accordeon-card .df-row .df-multi-select,
17
+ .df-accordeon-card .df-row .df-transparent_array-item {
18
+ max-width: unset;
19
+ }
20
+ .df-accordeon-card .df-monaco-input,
21
+ .df-accordeon-card .df-monaco-base-view {
22
+ width: 100%;
23
+ }
12
24
  .df-accordeon-card:hover {
13
25
  box-shadow: 0 3px 10px var(--g-color-sfx-shadow);
14
26
  }
@@ -64,7 +76,6 @@
64
76
  }
65
77
  .df-accordeon-card__body {
66
78
  display: none;
67
- margin-top: -10px 0 8px;
68
79
  padding: 16px;
69
80
  }
70
81
  .df-accordeon-card__body_open {
@@ -8,7 +8,7 @@ const uikit_1 = require("@gravity-ui/uikit");
8
8
  const lodash_1 = tslib_1.__importDefault(require("lodash"));
9
9
  const utils_1 = require("../../utils");
10
10
  const b = (0, utils_1.block)('accordeon-card');
11
- const AccordeonCard = ({ className, name, header, description, open: propsOpen, onToggle, headerActionsTemplate, ignoreHeaderToggle, titleSize = 'm', alwaysOpen, children, }) => {
11
+ const AccordeonCard = ({ className, name, header, description, open: propsOpen, onToggle, headerActionsTemplate, ignoreHeaderToggle, titleSize = 'm', alwaysOpen, children, classNameBody, }) => {
12
12
  const accordeonRef = react_1.default.useRef(null);
13
13
  const bodyRef = react_1.default.useRef(null);
14
14
  const [open, setOpen] = react_1.default.useState(alwaysOpen || propsOpen || false);
@@ -52,6 +52,6 @@ const AccordeonCard = ({ className, name, header, description, open: propsOpen,
52
52
  headerActionsTemplate ? (react_1.default.createElement("div", { className: b('interal-actions') }, headerActionsTemplate)) : null,
53
53
  react_1.default.createElement(uikit_1.Button, { view: "flat", onClick: handleToggle, qa: `${name}-accordeon-toggler` },
54
54
  react_1.default.createElement(uikit_1.Icon, { className: b('toggle-icon', { open }), data: icons_1.ChevronDown, size: 16 })))) : null),
55
- react_1.default.createElement("div", { ref: bodyRef, className: b('body', { open: open && !emptyBody }) }, children)));
55
+ react_1.default.createElement("div", { ref: bodyRef, className: b('body', { open: open && !emptyBody }, classNameBody) }, children)));
56
56
  };
57
57
  exports.AccordeonCard = AccordeonCard;
@@ -8,7 +8,7 @@ const __1 = require("../../");
8
8
  const core_1 = require("../../../../core");
9
9
  const hooks_1 = require("../../../hooks");
10
10
  const Layouts_1 = require("../../Layouts");
11
- const RemoveButton_1 = require("../../Layouts/Accordeon/RemoveButton");
11
+ const RemoveButton_1 = require("../../RemoveButton");
12
12
  const CardOneOf = (props) => {
13
13
  var _a;
14
14
  const { input, meta, spec, name } = props;
@@ -7,25 +7,34 @@ const uikit_1 = require("@gravity-ui/uikit");
7
7
  const core_1 = require("../../../../core");
8
8
  const utils_1 = require("../../../utils");
9
9
  const b = (0, utils_1.block)('multi-select');
10
- const MultiSelect = ({ name, input, spec }) => {
10
+ const MultiSelect = ({ name, input, spec, inputProps }) => {
11
11
  var _a, _b, _c, _d;
12
12
  const { value, onBlur, onChange, onFocus } = input;
13
13
  const filterable = react_1.default.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]);
14
+ const { withCustomOptions, options: externalOptions } = inputProps || {};
14
15
  const options = react_1.default.useMemo(() => {
15
16
  var _a;
16
- return (_a = spec.enum) === null || _a === void 0 ? void 0 : _a.map((id) => {
17
- var _a, _b, _c, _d, _e;
18
- return ({
19
- id,
20
- value: id,
21
- text: ((_a = spec.description) === null || _a === void 0 ? void 0 : _a[id]) || id,
22
- content: ((_c = (_b = spec.viewSpec.selectParams) === null || _b === void 0 ? void 0 : _b.meta) === null || _c === void 0 ? void 0 : _c[id]) ? (react_1.default.createElement("div", { key: id },
23
- react_1.default.createElement(uikit_1.Text, null, ((_d = spec.description) === null || _d === void 0 ? void 0 : _d[id]) || id),
24
- react_1.default.createElement(uikit_1.Text, { color: "secondary", className: b('meta-text') }, spec.viewSpec.selectParams.meta[id]))) : (((_e = spec.description) === null || _e === void 0 ? void 0 : _e[id]) || id),
25
- key: id,
17
+ return withCustomOptions
18
+ ? externalOptions || []
19
+ : (_a = spec.enum) === null || _a === void 0 ? void 0 : _a.map((id) => {
20
+ var _a, _b, _c, _d, _e;
21
+ return ({
22
+ id,
23
+ value: id,
24
+ text: ((_a = spec.description) === null || _a === void 0 ? void 0 : _a[id]) || id,
25
+ content: ((_c = (_b = spec.viewSpec.selectParams) === null || _b === void 0 ? void 0 : _b.meta) === null || _c === void 0 ? void 0 : _c[id]) ? (react_1.default.createElement("div", { key: id },
26
+ react_1.default.createElement(uikit_1.Text, null, ((_d = spec.description) === null || _d === void 0 ? void 0 : _d[id]) || id),
27
+ react_1.default.createElement(uikit_1.Text, { color: "secondary", className: b('meta-text') }, spec.viewSpec.selectParams.meta[id]))) : (((_e = spec.description) === null || _e === void 0 ? void 0 : _e[id]) || id),
28
+ key: id,
29
+ });
26
30
  });
27
- });
28
- }, [spec.enum, spec.description, (_b = spec.viewSpec.selectParams) === null || _b === void 0 ? void 0 : _b.meta]);
31
+ }, [
32
+ spec.enum,
33
+ spec.description,
34
+ (_b = spec.viewSpec.selectParams) === null || _b === void 0 ? void 0 : _b.meta,
35
+ externalOptions,
36
+ withCustomOptions,
37
+ ]);
29
38
  const renderOption = react_1.default.useCallback((option) => {
30
39
  return react_1.default.createElement(react_1.default.Fragment, { key: option.value }, option.content || option.value);
31
40
  }, []);
@@ -46,6 +55,6 @@ const MultiSelect = ({ name, input, spec }) => {
46
55
  }, [onFocus, onBlur]);
47
56
  const _value = react_1.default.useMemo(() => (0, core_1.transformArrOut)(value), [value]);
48
57
  const handleChange = react_1.default.useCallback((value) => onChange((0, core_1.transformArrIn)(value)), [onChange]);
49
- return (react_1.default.createElement(uikit_1.Select, { width: "max", className: b(), value: _value, options: options, onUpdate: handleChange, onOpenChange: handleToggle, disabled: spec.viewSpec.disabled, placeholder: spec.viewSpec.placeholder, filterable: filterable, filterPlaceholder: (_d = spec.viewSpec.selectParams) === null || _d === void 0 ? void 0 : _d.filterPlaceholder, renderOption: renderOption, getOptionHeight: getOptionHeight, multiple: true, qa: name }));
58
+ return (react_1.default.createElement(uikit_1.Select, Object.assign({ width: "max", className: b(), filterable: filterable, renderOption: renderOption, getOptionHeight: getOptionHeight }, inputProps, { value: _value, options: options, onUpdate: handleChange, onOpenChange: handleToggle, disabled: spec.viewSpec.disabled, placeholder: spec.viewSpec.placeholder, filterPlaceholder: (_d = spec.viewSpec.selectParams) === null || _d === void 0 ? void 0 : _d.filterPlaceholder, multiple: true, qa: name })));
50
59
  };
51
60
  exports.MultiSelect = MultiSelect;
@@ -6,25 +6,34 @@ const react_1 = tslib_1.__importDefault(require("react"));
6
6
  const uikit_1 = require("@gravity-ui/uikit");
7
7
  const utils_1 = require("../../../utils");
8
8
  const b = (0, utils_1.block)('select');
9
- const Select = ({ name, input, spec }) => {
9
+ const Select = ({ name, input, spec, inputProps }) => {
10
10
  var _a, _b, _c, _d;
11
11
  const { value, onBlur, onChange, onFocus } = input;
12
12
  const filterable = react_1.default.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]);
13
+ const { withCustomOptions, options: externalOptions } = inputProps || {};
13
14
  const options = react_1.default.useMemo(() => {
14
15
  var _a;
15
- return (_a = spec.enum) === null || _a === void 0 ? void 0 : _a.map((id) => {
16
- var _a, _b, _c, _d, _e;
17
- return ({
18
- id,
19
- value: id,
20
- text: ((_a = spec.description) === null || _a === void 0 ? void 0 : _a[id]) || id,
21
- content: ((_c = (_b = spec.viewSpec.selectParams) === null || _b === void 0 ? void 0 : _b.meta) === null || _c === void 0 ? void 0 : _c[id]) ? (react_1.default.createElement("div", { key: id },
22
- react_1.default.createElement(uikit_1.Text, null, ((_d = spec.description) === null || _d === void 0 ? void 0 : _d[id]) || id),
23
- react_1.default.createElement(uikit_1.Text, { color: "secondary", className: b('meta-text') }, spec.viewSpec.selectParams.meta[id]))) : (((_e = spec.description) === null || _e === void 0 ? void 0 : _e[id]) || id),
24
- key: id,
16
+ return withCustomOptions
17
+ ? externalOptions || []
18
+ : (_a = spec.enum) === null || _a === void 0 ? void 0 : _a.map((id) => {
19
+ var _a, _b, _c, _d, _e;
20
+ return ({
21
+ id,
22
+ value: id,
23
+ text: ((_a = spec.description) === null || _a === void 0 ? void 0 : _a[id]) || id,
24
+ content: ((_c = (_b = spec.viewSpec.selectParams) === null || _b === void 0 ? void 0 : _b.meta) === null || _c === void 0 ? void 0 : _c[id]) ? (react_1.default.createElement("div", { key: id },
25
+ react_1.default.createElement(uikit_1.Text, null, ((_d = spec.description) === null || _d === void 0 ? void 0 : _d[id]) || id),
26
+ react_1.default.createElement(uikit_1.Text, { color: "secondary", className: b('meta-text') }, spec.viewSpec.selectParams.meta[id]))) : (((_e = spec.description) === null || _e === void 0 ? void 0 : _e[id]) || id),
27
+ key: id,
28
+ });
25
29
  });
26
- });
27
- }, [spec.enum, spec.description, (_b = spec.viewSpec.selectParams) === null || _b === void 0 ? void 0 : _b.meta]);
30
+ }, [
31
+ spec.enum,
32
+ spec.description,
33
+ (_b = spec.viewSpec.selectParams) === null || _b === void 0 ? void 0 : _b.meta,
34
+ externalOptions,
35
+ withCustomOptions,
36
+ ]);
28
37
  const renderOption = react_1.default.useCallback((option) => {
29
38
  return react_1.default.createElement(react_1.default.Fragment, { key: option.value }, option.content || option.value);
30
39
  }, []);
@@ -44,6 +53,6 @@ const Select = ({ name, input, spec }) => {
44
53
  onBlur();
45
54
  }
46
55
  }, [onFocus, onBlur]);
47
- return (react_1.default.createElement(uikit_1.Select, { className: b(), width: "max", value: [value], options: options, onUpdate: handleChange, onOpenChange: handleToggle, disabled: spec.viewSpec.disabled, placeholder: spec.viewSpec.placeholder, filterable: filterable, filterPlaceholder: (_d = spec.viewSpec.selectParams) === null || _d === void 0 ? void 0 : _d.filterPlaceholder, getOptionHeight: getOptionHeight, renderOption: renderOption, qa: name }));
56
+ return (react_1.default.createElement(uikit_1.Select, Object.assign({ className: b(), width: "max", filterable: filterable, getOptionHeight: getOptionHeight, renderOption: renderOption }, inputProps, { value: [value], options: options, onUpdate: handleChange, onOpenChange: handleToggle, disabled: spec.viewSpec.disabled, placeholder: spec.viewSpec.placeholder, filterPlaceholder: (_d = spec.viewSpec.selectParams) === null || _d === void 0 ? void 0 : _d.filterPlaceholder, qa: name })));
48
57
  };
49
58
  exports.Select = Select;
@@ -6,17 +6,8 @@ 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
8
  const lodash_1 = tslib_1.__importDefault(require("lodash"));
9
- const Text = ({ name, input: { value, onBlur, onChange, onFocus }, spec, }) => {
10
- const props = {
11
- value: lodash_1.default.isNil(value) ? '' : `${value}`,
12
- hasClear: true,
13
- onBlur: onBlur,
14
- onFocus: onFocus,
15
- onUpdate: onChange,
16
- disabled: spec.viewSpec.disabled,
17
- placeholder: spec.viewSpec.placeholder,
18
- qa: name,
19
- };
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 });
20
11
  if (spec.viewSpec.type === 'password') {
21
12
  return (react_1.default.createElement(components_1.PasswordInput, Object.assign({}, props, { autoComplete: "new-password", showCopyButton: true, showRevealButton: true })));
22
13
  }
@@ -4,8 +4,8 @@ exports.TextArea = 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 TextArea = ({ name, input, spec }) => {
7
+ const TextArea = ({ name, input, spec, inputProps }) => {
8
8
  const { value, onBlur, onChange, onFocus } = input;
9
- return (react_1.default.createElement(uikit_1.TextArea, { value: value || '', onBlur: onBlur, onFocus: onFocus, onUpdate: onChange, maxRows: 20, minRows: 8, hasClear: true, disabled: spec.viewSpec.disabled, placeholder: spec.viewSpec.placeholder, qa: name }));
9
+ return (react_1.default.createElement(uikit_1.TextArea, Object.assign({ maxRows: 20, minRows: 8, hasClear: true }, inputProps, { value: value || '', onBlur: onBlur, onFocus: onFocus, onUpdate: onChange, disabled: spec.viewSpec.disabled, placeholder: spec.viewSpec.placeholder, qa: name })));
10
10
  };
11
11
  exports.TextArea = TextArea;
@@ -5,8 +5,8 @@ const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importDefault(require("react"));
6
6
  const components_1 = require("../../../components");
7
7
  const hooks_1 = require("../../../hooks");
8
+ const RemoveButton_1 = require("../../RemoveButton");
8
9
  const SimpleVerticalAccordeon_1 = require("../../SimpleVerticalAccordeon");
9
- const RemoveButton_1 = require("./RemoveButton");
10
10
  const Accordeon = ({ name, spec, input, meta, children, }) => {
11
11
  var _a;
12
12
  const [open, setOpen] = react_1.default.useState(Boolean((_a = spec.viewSpec) === null || _a === void 0 ? void 0 : _a.layoutOpen));
@@ -0,0 +1,3 @@
1
+ .df-accordeon-card-form__accordeon-card-body {
2
+ padding-right: 32px;
3
+ }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AccordeonCardForm = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const react_1 = tslib_1.__importDefault(require("react"));
6
+ const hooks_1 = require("../../../hooks");
7
+ const utils_1 = require("../../../utils");
8
+ const AccordeonCard_1 = require("../../AccordeonCard");
9
+ const ErrorWrapper_1 = require("../../ErrorWrapper");
10
+ const RemoveButton_1 = require("../../RemoveButton");
11
+ const b = (0, utils_1.block)('accordeon-card-form');
12
+ const AccordeonCardForm = ({ name, spec, input, children, meta, }) => {
13
+ var _a;
14
+ const [open, setOpen] = react_1.default.useState(Boolean((_a = spec.viewSpec) === null || _a === void 0 ? void 0 : _a.layoutOpen));
15
+ const onDrop = react_1.default.useCallback(() => {
16
+ setOpen(false);
17
+ input.onDrop();
18
+ }, [input.onDrop, setOpen]);
19
+ const removeButton = react_1.default.useMemo(() => {
20
+ if (spec.required || !input.value) {
21
+ return null;
22
+ }
23
+ return react_1.default.createElement(RemoveButton_1.RemoveButton, { name: name, onDrop: onDrop });
24
+ }, [spec.required, input.value, onDrop, name]);
25
+ (0, hooks_1.useErrorChecker)({ name, meta, open, setOpen });
26
+ return (react_1.default.createElement(AccordeonCard_1.AccordeonCard, { classNameBody: b('accordeon-card-body'), name: name, header: spec.viewSpec.layoutTitle || '', description: spec.viewSpec.layoutDescription || '', open: open, onToggle: setOpen, headerActionsTemplate: removeButton },
27
+ react_1.default.createElement(ErrorWrapper_1.ErrorWrapper, { name: name, meta: meta, withoutChildErrorStyles: true }, children)));
28
+ };
29
+ exports.AccordeonCardForm = AccordeonCardForm;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./AccordeonCardForm"), exports);
@@ -5,7 +5,7 @@ const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importDefault(require("react"));
6
6
  const components_1 = require("../../components");
7
7
  const hooks_1 = require("../../hooks");
8
- const RemoveButton_1 = require("./Accordeon/RemoveButton");
8
+ const RemoveButton_1 = require("../RemoveButton");
9
9
  const CardAccordeon = ({ name, spec, input, meta, children, }) => {
10
10
  var _a;
11
11
  const [open, setOpen] = react_1.default.useState(Boolean((_a = spec.viewSpec) === null || _a === void 0 ? void 0 : _a.layoutOpen));
@@ -4,7 +4,7 @@ exports.CardSection = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importDefault(require("react"));
6
6
  const components_1 = require("../../components");
7
- const RemoveButton_1 = require("./Accordeon/RemoveButton");
7
+ const RemoveButton_1 = require("../RemoveButton");
8
8
  const CardSection = ({ name, spec, input, meta, children, }) => {
9
9
  const removeButton = react_1.default.useMemo(() => {
10
10
  if (spec.required || !input.value) {
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./Accordeon"), exports);
5
+ tslib_1.__exportStar(require("./AccordeonCard"), exports);
5
6
  tslib_1.__exportStar(require("./CardAccordeon"), exports);
6
7
  tslib_1.__exportStar(require("./CardSection"), exports);
7
8
  tslib_1.__exportStar(require("./Row"), exports);
@@ -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 i18n_1 = tslib_1.__importDefault(require("../../../i18n"));
8
+ const i18n_1 = tslib_1.__importDefault(require("../../i18n"));
9
9
  const RemoveButton = ({ name, onDrop }) => {
10
10
  const items = react_1.default.useMemo(() => [{ text: (0, i18n_1.default)('label_delete'), action: onDrop, theme: 'danger' }], [onDrop]);
11
11
  const switcher = react_1.default.useMemo(() => (react_1.default.createElement(uikit_1.Button, { view: "flat", qa: `${name}-drop-item` },
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./RemoveButton"), exports);
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ViewAccordeonCard = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const react_1 = tslib_1.__importDefault(require("react"));
6
+ const lodash_1 = tslib_1.__importDefault(require("lodash"));
7
+ const utils_1 = require("../../../utils");
8
+ const AccordeonCard_1 = require("../../AccordeonCard");
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);
11
+ if (!(0, utils_1.isNotEmptyValue)(value, spec)) {
12
+ return null;
13
+ }
14
+ return (react_1.default.createElement(AccordeonCard_1.AccordeonCard, { name: name, header: spec.viewSpec.layoutTitle || '', open: open, onToggle: setOpen }, children));
15
+ };
16
+ exports.ViewAccordeonCard = ViewAccordeonCard;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./ViewAccordeonCard"), exports);
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./ViewAccordeon"), exports);
5
5
  tslib_1.__exportStar(require("./ViewCardAccordeon"), exports);
6
+ tslib_1.__exportStar(require("./ViewAccordeonCard"), exports);
6
7
  tslib_1.__exportStar(require("./ViewCardSection"), exports);
7
8
  tslib_1.__exportStar(require("./ViewRow"), exports);
8
9
  tslib_1.__exportStar(require("./ViewSection"), exports);
@@ -22,6 +22,7 @@ exports.dynamicConfig = {
22
22
  transparent: components_1.Transparent,
23
23
  card_accordeon: components_1.CardAccordeon,
24
24
  card_section: components_1.CardSection,
25
+ accordeon_card: components_1.AccordeonCardForm,
25
26
  },
26
27
  validators: {
27
28
  base: (0, validators_1.getArrayValidator)(),
@@ -79,6 +80,7 @@ exports.dynamicConfig = {
79
80
  transparent: components_1.Transparent,
80
81
  card_accordeon: components_1.CardAccordeon,
81
82
  card_section: components_1.CardSection,
83
+ accordeon_card: components_1.AccordeonCardForm,
82
84
  },
83
85
  validators: {
84
86
  base: (0, validators_1.getObjectValidator)(),
@@ -131,6 +133,7 @@ exports.dynamicViewConfig = {
131
133
  transparent: components_1.ViewTransparent,
132
134
  card_accordeon: components_1.ViewCardAccordeon,
133
135
  card_section: components_1.ViewCardSection,
136
+ accordeon_card: components_1.ViewAccordeonCard,
134
137
  },
135
138
  },
136
139
  boolean: {
@@ -179,6 +182,7 @@ exports.dynamicViewConfig = {
179
182
  transparent: components_1.ViewTransparent,
180
183
  card_accordeon: components_1.ViewCardAccordeon,
181
184
  card_section: components_1.ViewCardSection,
185
+ accordeon_card: components_1.ViewAccordeonCard,
182
186
  },
183
187
  },
184
188
  string: {
@@ -52,14 +52,15 @@ export const getRender = ({ name, spec, inputEntity, Layout, }) => {
52
52
  const render = (props) => {
53
53
  if (inputEntity && isCorrectSpec(spec) && _.isString(name)) {
54
54
  if (!spec.viewSpec.hidden) {
55
+ const { layoutProps, inputProps } = spec.viewSpec;
55
56
  if (inputEntity.independent) {
56
57
  const InputComponent = inputEntity.Component;
57
- return React.createElement(InputComponent, Object.assign({ spec: spec, name: name, Layout: Layout }, props));
58
+ return (React.createElement(InputComponent, Object.assign({ spec: spec, name: name, Layout: Layout, inputProps: inputProps, layoutProps: layoutProps }, props)));
58
59
  }
59
60
  const InputComponent = inputEntity.Component;
60
- const input = React.createElement(InputComponent, Object.assign({ spec: spec, name: name }, props));
61
+ const input = (React.createElement(InputComponent, Object.assign({ spec: spec, name: name, inputProps: inputProps }, props)));
61
62
  if (Layout) {
62
- return (React.createElement(Layout, Object.assign({ spec: spec, name: name }, props), input));
63
+ return (React.createElement(Layout, Object.assign({ spec: spec, name: name, layoutProps: layoutProps }, props), input));
63
64
  }
64
65
  return input;
65
66
  }
@@ -1 +1 @@
1
- export declare const useGenerateRandomValue: () => ((spec: import("../../..").StringSpec<any>) => string) | undefined;
1
+ export declare const useGenerateRandomValue: () => ((spec: import("../../..").StringSpec<any, {}, {}>) => string) | undefined;
@@ -1,11 +1,11 @@
1
1
  import { ArraySpec, ArrayValue } from '../../../types';
2
2
  import { FieldArrayValue, IndependentInputEntity, IndependentInputProps, IndependentInputType, InputEntity, InputProps, InputType, InputsMap, LayoutProps, LayoutType, LayoutsMap, TypeConfig, ValidatorsMap } from './';
3
- export type ArrayInputProps = InputProps<FieldArrayValue, ArraySpec>;
4
- export type ArrayIndependentInputProps = IndependentInputProps<FieldArrayValue, ArraySpec>;
5
- export type ArrayLayoutProps = LayoutProps<FieldArrayValue, ArraySpec>;
6
- export type ArrayInput = InputType<FieldArrayValue, ArraySpec>;
7
- export type ArrayIndependentInput = IndependentInputType<FieldArrayValue, ArraySpec>;
8
- export type ArrayLayout = LayoutType<FieldArrayValue, ArraySpec>;
3
+ export type ArrayInputProps<InputComponentProps extends Record<string, any> = {}> = InputProps<FieldArrayValue, ArraySpec<undefined, InputComponentProps>>;
4
+ export type ArrayIndependentInputProps<InputComponentProps extends Record<string, any> = {}, LayoutComponentProps extends Record<string, any> = {}> = IndependentInputProps<FieldArrayValue, ArraySpec<undefined, InputComponentProps, LayoutComponentProps>>;
5
+ export type ArrayLayoutProps<LayoutComponentProps extends Record<string, any> = {}> = LayoutProps<FieldArrayValue, ArraySpec<undefined, any, LayoutComponentProps>>;
6
+ export type ArrayInput<InputComponentProps extends Record<string, any> = {}> = InputType<FieldArrayValue, ArraySpec<undefined, InputComponentProps>>;
7
+ export type ArrayIndependentInput<InputComponentProps extends Record<string, any> = {}, LayoutComponentProps extends Record<string, any> = {}> = IndependentInputType<FieldArrayValue, ArraySpec<undefined, InputComponentProps, LayoutComponentProps>>;
8
+ export type ArrayLayout<LayoutComponentProps extends Record<string, any> = {}> = LayoutType<FieldArrayValue, ArraySpec<undefined, any, LayoutComponentProps>>;
9
9
  export type ArrayInputEntity = InputEntity<FieldArrayValue, ArraySpec>;
10
10
  export type ArrayIndependentInputEntity = IndependentInputEntity<FieldArrayValue, ArraySpec>;
11
11
  export type ArrayInputsMap = InputsMap<FieldArrayValue, ArraySpec>;
@@ -1,11 +1,11 @@
1
1
  import { BooleanSpec } from '../../../types';
2
2
  import { IndependentInputEntity, IndependentInputProps, IndependentInputType, InputEntity, InputProps, InputType, InputsMap, LayoutProps, LayoutType, LayoutsMap, TypeConfig, ValidatorsMap } from './';
3
- export type BooleanInputProps = InputProps<boolean, BooleanSpec>;
4
- export type BooleanIndependentInputProps = IndependentInputProps<boolean, BooleanSpec>;
5
- export type BooleanLayoutProps = LayoutProps<boolean, BooleanSpec>;
6
- export type BooleanInput = InputType<boolean, BooleanSpec>;
7
- export type BooleanIndependentInput = IndependentInputType<boolean, BooleanSpec>;
8
- export type BooleanLayout = LayoutType<boolean, BooleanSpec>;
3
+ export type BooleanInputProps<InputComponentProps extends Record<string, any> = {}> = InputProps<boolean, BooleanSpec<undefined, InputComponentProps>>;
4
+ export type BooleanIndependentInputProps<InputComponentProps extends Record<string, any> = {}, LayoutComponentProps extends Record<string, any> = {}> = IndependentInputProps<boolean, BooleanSpec<undefined, InputComponentProps, LayoutComponentProps>>;
5
+ export type BooleanLayoutProps<LayoutComponentProps extends Record<string, any> = {}> = LayoutProps<boolean, BooleanSpec<undefined, any, LayoutComponentProps>>;
6
+ export type BooleanInput<InputComponentProps extends Record<string, any> = {}> = InputType<boolean, BooleanSpec<undefined, InputComponentProps>>;
7
+ export type BooleanIndependentInput<InputComponentProps extends Record<string, any> = {}, LayoutComponentProps extends Record<string, any> = {}> = IndependentInputType<boolean, BooleanSpec<undefined, InputComponentProps, LayoutComponentProps>>;
8
+ export type BooleanLayout<LayoutComponentProps extends Record<string, any> = {}> = LayoutType<boolean, BooleanSpec<undefined, any, LayoutComponentProps>>;
9
9
  export type BooleanInputEntity = InputEntity<boolean, BooleanSpec>;
10
10
  export type BooleanIndependentInputEntity = IndependentInputEntity<boolean, BooleanSpec>;
11
11
  export type BooleanInputsMap = InputsMap<boolean, BooleanSpec>;
@@ -4,9 +4,11 @@ import { FieldRenderProps, FieldValue, LayoutType } from './';
4
4
  export type InputProps<Value extends FieldValue, SpecType extends Spec> = {
5
5
  spec: SpecType;
6
6
  name: string;
7
+ inputProps?: SpecType['viewSpec']['inputProps'];
7
8
  } & FieldRenderProps<Value>;
8
9
  export type IndependentInputProps<Value extends FieldValue, SpecType extends Spec> = {
9
10
  Layout: LayoutType<Value, SpecType> | undefined;
11
+ layoutProps?: SpecType['viewSpec']['layoutProps'];
10
12
  } & InputProps<Value, SpecType>;
11
13
  export type InputType<Value extends FieldValue, SpecType extends Spec> = (props: InputProps<Value, SpecType>) => React.ReactElement | null;
12
14
  export type IndependentInputType<Value extends FieldValue, SpecType extends Spec> = (props: IndependentInputProps<Value, SpecType>) => React.ReactElement | null;
@@ -3,6 +3,7 @@ import { Spec } from '../../../types';
3
3
  import { FieldValue, InputProps } from './';
4
4
  export type LayoutProps<Value extends FieldValue, SpecType extends Spec> = {
5
5
  children: React.ReactElement;
6
+ layoutProps?: SpecType['viewSpec']['layoutProps'];
6
7
  } & InputProps<Value, SpecType>;
7
8
  export type LayoutType<Value extends FieldValue, SpecType extends Spec> = (props: LayoutProps<Value, SpecType>) => React.ReactElement | null;
8
9
  export type LayoutsMap<Value extends FieldValue, SpecType extends Spec> = Record<string, LayoutType<Value, SpecType> | undefined>;
@@ -1,11 +1,11 @@
1
1
  import { NumberSpec } from '../../../types';
2
2
  import { IndependentInputEntity, IndependentInputProps, IndependentInputType, InputEntity, InputProps, InputType, InputsMap, LayoutProps, LayoutType, LayoutsMap, TypeConfig, ValidatorsMap } from './';
3
- export type NumberInputProps = InputProps<number, NumberSpec>;
4
- export type NumberIndependentInputProps = IndependentInputProps<number, NumberSpec>;
5
- export type NumberLayoutProps = LayoutProps<number, NumberSpec>;
6
- export type NumberInput = InputType<number, NumberSpec>;
7
- export type NumberIndependentInput = IndependentInputType<number, NumberSpec>;
8
- export type NumberLayout = LayoutType<number, NumberSpec>;
3
+ export type NumberInputProps<InputComponentProps extends Record<string, any> = {}> = InputProps<number, NumberSpec<undefined, InputComponentProps>>;
4
+ export type NumberIndependentInputProps<InputComponentProps extends Record<string, any> = {}, LayoutComponentProps extends Record<string, any> = {}> = IndependentInputProps<number, NumberSpec<undefined, InputComponentProps, LayoutComponentProps>>;
5
+ export type NumberLayoutProps<LayoutComponentProps extends Record<string, any> = {}> = LayoutProps<number, NumberSpec<undefined, any, LayoutComponentProps>>;
6
+ export type NumberInput<InputComponentProps extends Record<string, any> = {}> = InputType<number, NumberSpec<undefined, InputComponentProps>>;
7
+ export type NumberIndependentInput<InputComponentProps extends Record<string, any> = {}, LayoutComponentProps extends Record<string, any> = {}> = IndependentInputType<number, NumberSpec<undefined, InputComponentProps, LayoutComponentProps>>;
8
+ export type NumberLayout<LayoutComponentProps extends Record<string, any> = {}> = LayoutType<number, NumberSpec<undefined, any, LayoutComponentProps>>;
9
9
  export type NumberInputEntity = InputEntity<number, NumberSpec>;
10
10
  export type NumberIndependentInputEntity = IndependentInputEntity<number, NumberSpec>;
11
11
  export type NumberInputsMap = InputsMap<number, NumberSpec>;
@@ -1,11 +1,11 @@
1
1
  import { ObjectSpec, ObjectValue } from '../../../types';
2
2
  import { FieldObjectValue, IndependentInputEntity, IndependentInputProps, IndependentInputType, InputEntity, InputProps, InputType, InputsMap, LayoutProps, LayoutType, LayoutsMap, TypeConfig, ValidatorsMap } from './';
3
- export type ObjectInputProps = InputProps<FieldObjectValue, ObjectSpec>;
4
- export type ObjectIndependentInputProps = IndependentInputProps<FieldObjectValue, ObjectSpec>;
5
- export type ObjectLayoutProps = LayoutProps<FieldObjectValue, ObjectSpec>;
6
- export type ObjectInput = InputType<FieldObjectValue, ObjectSpec>;
7
- export type ObjectIndependentInput = IndependentInputType<FieldObjectValue, ObjectSpec>;
8
- export type ObjectLayout = LayoutType<FieldObjectValue, ObjectSpec>;
3
+ export type ObjectInputProps<InputComponentProps extends Record<string, any> = {}> = InputProps<FieldObjectValue, ObjectSpec<undefined, InputComponentProps>>;
4
+ export type ObjectIndependentInputProps<InputComponentProps extends Record<string, any> = {}, LayoutComponentProps extends Record<string, any> = {}> = IndependentInputProps<FieldObjectValue, ObjectSpec<undefined, InputComponentProps, LayoutComponentProps>>;
5
+ export type ObjectLayoutProps<LayoutComponentProps extends Record<string, any> = {}> = LayoutProps<FieldObjectValue, ObjectSpec<undefined, any, LayoutComponentProps>>;
6
+ export type ObjectInput<InputComponentProps extends Record<string, any> = {}> = InputType<FieldObjectValue, ObjectSpec<undefined, InputComponentProps>>;
7
+ export type ObjectIndependentInput<InputComponentProps extends Record<string, any> = {}, LayoutComponentProps extends Record<string, any> = {}> = IndependentInputType<FieldObjectValue, ObjectSpec<undefined, InputComponentProps, LayoutComponentProps>>;
8
+ export type ObjectLayout<LayoutComponentProps extends Record<string, any> = {}> = LayoutType<FieldObjectValue, ObjectSpec<undefined, any, LayoutComponentProps>>;
9
9
  export type ObjectInputEntity = InputEntity<FieldObjectValue, ObjectSpec>;
10
10
  export type ObjectIndependentInputEntity = IndependentInputEntity<FieldObjectValue, ObjectSpec>;
11
11
  export type ObjectInputsMap = InputsMap<FieldObjectValue, ObjectSpec>;
@@ -1,11 +1,11 @@
1
1
  import { StringSpec } from '../../../types';
2
2
  import { IndependentInputEntity, IndependentInputProps, IndependentInputType, InputEntity, InputProps, InputType, InputsMap, LayoutProps, LayoutType, LayoutsMap, TypeConfig, ValidatorsMap } from './';
3
- export type StringInputProps = InputProps<string, StringSpec>;
4
- export type StringIndependentInputProps = IndependentInputProps<string, StringSpec>;
5
- export type StringLayoutProps = LayoutProps<string, StringSpec>;
6
- export type StringInput = InputType<string, StringSpec>;
7
- export type StringIndependentInput = IndependentInputType<string, StringSpec>;
8
- export type StringLayout = LayoutType<string, StringSpec>;
3
+ export type StringInputProps<InputComponentProps extends Record<string, any> = {}> = InputProps<string, StringSpec<undefined, InputComponentProps>>;
4
+ export type StringIndependentInputProps<InputComponentProps extends Record<string, any> = {}, LayoutComponentProps extends Record<string, any> = {}> = IndependentInputProps<string, StringSpec<undefined, InputComponentProps, LayoutComponentProps>>;
5
+ export type StringLayoutProps<LayoutComponentProps extends Record<string, any> = {}> = LayoutProps<string, StringSpec<undefined, any, LayoutComponentProps>>;
6
+ export type StringInput<InputComponentProps extends Record<string, any> = {}> = InputType<string, StringSpec<undefined, InputComponentProps>>;
7
+ export type StringIndependentInput<InputComponentProps extends Record<string, any> = {}, LayoutComponentProps extends Record<string, any> = {}> = IndependentInputType<string, StringSpec<undefined, InputComponentProps, LayoutComponentProps>>;
8
+ export type StringLayout<LayoutComponentProps extends Record<string, any> = {}> = LayoutType<string, StringSpec<undefined, any, LayoutComponentProps>>;
9
9
  export type StringInputEntity = InputEntity<string, StringSpec>;
10
10
  export type StringIndependentInputEntity = IndependentInputEntity<string, StringSpec>;
11
11
  export type StringInputsMap = InputsMap<string, StringSpec>;
@@ -1,7 +1,7 @@
1
1
  import { ArraySpec, BooleanSpec, NumberSpec, ObjectSpec, StringSpec } from './types';
2
2
  export declare const isCorrectSpec: (candidate: any) => boolean;
3
- export declare const isArraySpec: (candidate: any) => candidate is ArraySpec<any>;
4
- export declare const isBooleanSpec: (candidate: any) => candidate is BooleanSpec<any>;
5
- export declare const isNumberSpec: (candidate: any) => candidate is NumberSpec<any>;
6
- export declare const isObjectSpec: (candidate: any) => candidate is ObjectSpec<any>;
7
- export declare const isStringSpec: (candidate: any) => candidate is StringSpec<any>;
3
+ export declare const isArraySpec: (candidate: any) => candidate is ArraySpec<any, {}, {}>;
4
+ export declare const isBooleanSpec: (candidate: any) => candidate is BooleanSpec<any, {}, {}>;
5
+ export declare const isNumberSpec: (candidate: any) => candidate is NumberSpec<any, {}, {}>;
6
+ export declare const isObjectSpec: (candidate: any) => candidate is ObjectSpec<any, {}, {}>;
7
+ export declare const isStringSpec: (candidate: any) => candidate is StringSpec<any, {}, {}>;
@@ -2,7 +2,7 @@ import { LabelProps } from '@gravity-ui/uikit';
2
2
  import { ColorTextBaseProps } from '@gravity-ui/uikit/build/esm/components/Text/colorText/colorText';
3
3
  import { ReadAsMethod, SpecTypes } from '../constants';
4
4
  import { ArrayValue, ObjectValue } from './';
5
- export interface ArraySpec<LinkType = any> {
5
+ export interface ArraySpec<LinkType = any, InputComponentProps extends Record<string, any> = {}, LayoutComponentProps extends Record<string, any> = {}> {
6
6
  defaultValue?: ArrayValue;
7
7
  type: SpecTypes.Array;
8
8
  required?: boolean;
@@ -33,9 +33,11 @@ export interface ArraySpec<LinkType = any> {
33
33
  filterPlaceholder?: string;
34
34
  meta?: Record<string, string>;
35
35
  };
36
+ inputProps?: InputComponentProps;
37
+ layoutProps?: LayoutComponentProps;
36
38
  };
37
39
  }
38
- export interface BooleanSpec<LinkType = any> {
40
+ export interface BooleanSpec<LinkType = any, InputComponentProps extends Record<string, any> = {}, LayoutComponentProps extends Record<string, any> = {}> {
39
41
  defaultValue?: boolean;
40
42
  type: SpecTypes.Boolean;
41
43
  required?: boolean;
@@ -49,9 +51,11 @@ export interface BooleanSpec<LinkType = any> {
49
51
  layoutOpen?: boolean;
50
52
  link?: LinkType;
51
53
  hidden?: boolean;
54
+ inputProps?: InputComponentProps;
55
+ layoutProps?: LayoutComponentProps;
52
56
  };
53
57
  }
54
- export interface NumberSpec<LinkType = any> {
58
+ export interface NumberSpec<LinkType = any, InputComponentProps extends Record<string, any> = {}, LayoutComponentProps extends Record<string, any> = {}> {
55
59
  defaultValue?: number;
56
60
  type: SpecTypes.Number;
57
61
  required?: boolean;
@@ -70,9 +74,11 @@ export interface NumberSpec<LinkType = any> {
70
74
  placeholder?: string;
71
75
  copy?: boolean;
72
76
  hidden?: boolean;
77
+ inputProps?: InputComponentProps;
78
+ layoutProps?: LayoutComponentProps;
73
79
  };
74
80
  }
75
- export interface ObjectSpec<LinkType = any> {
81
+ export interface ObjectSpec<LinkType = any, InputComponentProps extends Record<string, any> = {}, LayoutComponentProps extends Record<string, any> = {}> {
76
82
  defaultValue?: ObjectValue;
77
83
  type: SpecTypes.Object;
78
84
  required?: boolean;
@@ -93,9 +99,11 @@ export interface ObjectSpec<LinkType = any> {
93
99
  };
94
100
  placeholder?: string;
95
101
  hidden?: boolean;
102
+ inputProps?: InputComponentProps;
103
+ layoutProps?: LayoutComponentProps;
96
104
  };
97
105
  }
98
- export interface StringSpec<LinkType = any> {
106
+ export interface StringSpec<LinkType = any, InputComponentProps extends Record<string, any> = {}, LayoutComponentProps extends Record<string, any> = {}> {
99
107
  defaultValue?: string;
100
108
  type: SpecTypes.String;
101
109
  required?: boolean;
@@ -145,6 +153,8 @@ export interface StringSpec<LinkType = any> {
145
153
  filterPlaceholder?: string;
146
154
  meta?: Record<string, string>;
147
155
  };
156
+ inputProps?: InputComponentProps;
157
+ layoutProps?: LayoutComponentProps;
148
158
  generateRandomValueButton?: boolean;
149
159
  };
150
160
  }
@@ -3,12 +3,24 @@
3
3
  flex-direction: column;
4
4
  justify-content: space-between;
5
5
  box-sizing: border-box;
6
- max-width: 750px;
7
6
  box-shadow: 0 1px 5px var(--g-color-sfx-shadow);
8
7
  border-radius: 5px;
9
8
  color: var(--g-color-text-primary);
10
9
  background-color: var(--g-color-base-float);
11
10
  }
11
+ .df-accordeon-card .df-row {
12
+ width: 100%;
13
+ max-width: unset;
14
+ }
15
+ .df-accordeon-card .df-row .df-select,
16
+ .df-accordeon-card .df-row .df-multi-select,
17
+ .df-accordeon-card .df-row .df-transparent_array-item {
18
+ max-width: unset;
19
+ }
20
+ .df-accordeon-card .df-monaco-input,
21
+ .df-accordeon-card .df-monaco-base-view {
22
+ width: 100%;
23
+ }
12
24
  .df-accordeon-card:hover {
13
25
  box-shadow: 0 3px 10px var(--g-color-sfx-shadow);
14
26
  }
@@ -64,7 +76,6 @@
64
76
  }
65
77
  .df-accordeon-card__body {
66
78
  display: none;
67
- margin-top: -10px 0 8px;
68
79
  padding: 16px;
69
80
  }
70
81
  .df-accordeon-card__body_open {
@@ -12,5 +12,6 @@ export interface AccordeonCardProps {
12
12
  ignoreHeaderToggle?: boolean;
13
13
  titleSize?: 's' | 'm';
14
14
  alwaysOpen?: boolean;
15
+ classNameBody?: string;
15
16
  }
16
17
  export declare const AccordeonCard: React.FC<AccordeonCardProps>;
@@ -5,7 +5,7 @@ import _ from 'lodash';
5
5
  import { block } from '../../utils';
6
6
  import './AccordeonCard.css';
7
7
  const b = block('accordeon-card');
8
- export const AccordeonCard = ({ className, name, header, description, open: propsOpen, onToggle, headerActionsTemplate, ignoreHeaderToggle, titleSize = 'm', alwaysOpen, children, }) => {
8
+ export const AccordeonCard = ({ className, name, header, description, open: propsOpen, onToggle, headerActionsTemplate, ignoreHeaderToggle, titleSize = 'm', alwaysOpen, children, classNameBody, }) => {
9
9
  const accordeonRef = React.useRef(null);
10
10
  const bodyRef = React.useRef(null);
11
11
  const [open, setOpen] = React.useState(alwaysOpen || propsOpen || false);
@@ -49,5 +49,5 @@ export const AccordeonCard = ({ className, name, header, description, open: prop
49
49
  headerActionsTemplate ? (React.createElement("div", { className: b('interal-actions') }, headerActionsTemplate)) : null,
50
50
  React.createElement(Button, { view: "flat", onClick: handleToggle, qa: `${name}-accordeon-toggler` },
51
51
  React.createElement(Icon, { className: b('toggle-icon', { open }), data: ChevronDown, size: 16 })))) : null),
52
- React.createElement("div", { ref: bodyRef, className: b('body', { open: open && !emptyBody }) }, children)));
52
+ React.createElement("div", { ref: bodyRef, className: b('body', { open: open && !emptyBody }, classNameBody) }, children)));
53
53
  };
@@ -4,7 +4,7 @@ import { Card } from '../../';
4
4
  import { Controller, isArrayItem, } from '../../../../core';
5
5
  import { useErrorChecker, useOneOf } from '../../../hooks';
6
6
  import { Row } from '../../Layouts';
7
- import { RemoveButton } from '../../Layouts/Accordeon/RemoveButton';
7
+ import { RemoveButton } from '../../RemoveButton';
8
8
  export const CardOneOf = (props) => {
9
9
  var _a;
10
10
  const { input, meta, spec, name } = props;
@@ -1,3 +1,7 @@
1
+ import { SelectProps as SelectBaseProps } from '@gravity-ui/uikit';
1
2
  import { ArrayInput } from '../../../../core';
2
3
  import './MultiSelect.css';
3
- export declare const MultiSelect: ArrayInput;
4
+ export interface MultiSelectProps extends Omit<SelectBaseProps, 'onUpdate' | 'value' | 'onOpenChange' | 'disabled' | 'placeholder' | 'filterPlaceholder' | 'multiple' | 'qa'> {
5
+ withCustomOptions?: boolean;
6
+ }
7
+ export declare const MultiSelect: ArrayInput<MultiSelectProps>;
@@ -4,25 +4,34 @@ import { transformArrIn, transformArrOut } from '../../../../core';
4
4
  import { block } from '../../../utils';
5
5
  import './MultiSelect.css';
6
6
  const b = block('multi-select');
7
- export const MultiSelect = ({ name, input, spec }) => {
7
+ export const MultiSelect = ({ name, input, spec, inputProps }) => {
8
8
  var _a, _b, _c, _d;
9
9
  const { value, onBlur, onChange, onFocus } = input;
10
10
  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]);
11
+ const { withCustomOptions, options: externalOptions } = inputProps || {};
11
12
  const options = React.useMemo(() => {
12
13
  var _a;
13
- return (_a = spec.enum) === null || _a === void 0 ? void 0 : _a.map((id) => {
14
- var _a, _b, _c, _d, _e;
15
- return ({
16
- id,
17
- value: id,
18
- text: ((_a = spec.description) === null || _a === void 0 ? void 0 : _a[id]) || id,
19
- content: ((_c = (_b = spec.viewSpec.selectParams) === null || _b === void 0 ? void 0 : _b.meta) === null || _c === void 0 ? void 0 : _c[id]) ? (React.createElement("div", { key: id },
20
- React.createElement(Text, null, ((_d = spec.description) === null || _d === void 0 ? void 0 : _d[id]) || id),
21
- React.createElement(Text, { color: "secondary", className: b('meta-text') }, spec.viewSpec.selectParams.meta[id]))) : (((_e = spec.description) === null || _e === void 0 ? void 0 : _e[id]) || id),
22
- key: id,
14
+ return withCustomOptions
15
+ ? externalOptions || []
16
+ : (_a = spec.enum) === null || _a === void 0 ? void 0 : _a.map((id) => {
17
+ var _a, _b, _c, _d, _e;
18
+ return ({
19
+ id,
20
+ value: id,
21
+ text: ((_a = spec.description) === null || _a === void 0 ? void 0 : _a[id]) || id,
22
+ content: ((_c = (_b = spec.viewSpec.selectParams) === null || _b === void 0 ? void 0 : _b.meta) === null || _c === void 0 ? void 0 : _c[id]) ? (React.createElement("div", { key: id },
23
+ React.createElement(Text, null, ((_d = spec.description) === null || _d === void 0 ? void 0 : _d[id]) || id),
24
+ React.createElement(Text, { color: "secondary", className: b('meta-text') }, spec.viewSpec.selectParams.meta[id]))) : (((_e = spec.description) === null || _e === void 0 ? void 0 : _e[id]) || id),
25
+ key: id,
26
+ });
23
27
  });
24
- });
25
- }, [spec.enum, spec.description, (_b = spec.viewSpec.selectParams) === null || _b === void 0 ? void 0 : _b.meta]);
28
+ }, [
29
+ spec.enum,
30
+ spec.description,
31
+ (_b = spec.viewSpec.selectParams) === null || _b === void 0 ? void 0 : _b.meta,
32
+ externalOptions,
33
+ withCustomOptions,
34
+ ]);
26
35
  const renderOption = React.useCallback((option) => {
27
36
  return React.createElement(React.Fragment, { key: option.value }, option.content || option.value);
28
37
  }, []);
@@ -43,5 +52,5 @@ export const MultiSelect = ({ name, input, spec }) => {
43
52
  }, [onFocus, onBlur]);
44
53
  const _value = React.useMemo(() => transformArrOut(value), [value]);
45
54
  const handleChange = React.useCallback((value) => onChange(transformArrIn(value)), [onChange]);
46
- return (React.createElement(Select, { width: "max", className: b(), value: _value, options: options, onUpdate: handleChange, onOpenChange: handleToggle, disabled: spec.viewSpec.disabled, placeholder: spec.viewSpec.placeholder, filterable: filterable, filterPlaceholder: (_d = spec.viewSpec.selectParams) === null || _d === void 0 ? void 0 : _d.filterPlaceholder, renderOption: renderOption, getOptionHeight: getOptionHeight, multiple: true, qa: name }));
55
+ return (React.createElement(Select, Object.assign({ width: "max", className: b(), filterable: filterable, renderOption: renderOption, getOptionHeight: getOptionHeight }, inputProps, { value: _value, options: options, onUpdate: handleChange, onOpenChange: handleToggle, disabled: spec.viewSpec.disabled, placeholder: spec.viewSpec.placeholder, filterPlaceholder: (_d = spec.viewSpec.selectParams) === null || _d === void 0 ? void 0 : _d.filterPlaceholder, multiple: true, qa: name })));
47
56
  };
@@ -1,3 +1,7 @@
1
+ import { SelectProps as SelectBaseProps } from '@gravity-ui/uikit';
1
2
  import { StringInput } from '../../../../core';
2
3
  import './Select.css';
3
- export declare const Select: StringInput;
4
+ export interface SelectProps extends Omit<SelectBaseProps, 'onUpdate' | 'value' | 'onOpenChange' | 'disabled' | 'placeholder' | 'filterPlaceholder' | 'multiple' | 'qa'> {
5
+ withCustomOptions?: boolean;
6
+ }
7
+ export declare const Select: StringInput<SelectProps>;
@@ -3,25 +3,34 @@ import { Select as SelectBase, Text } 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 = ({ name, input, spec }) => {
6
+ export const Select = ({ name, input, spec, inputProps }) => {
7
7
  var _a, _b, _c, _d;
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]);
10
+ const { withCustomOptions, options: externalOptions } = inputProps || {};
10
11
  const options = React.useMemo(() => {
11
12
  var _a;
12
- return (_a = spec.enum) === null || _a === void 0 ? void 0 : _a.map((id) => {
13
- var _a, _b, _c, _d, _e;
14
- return ({
15
- id,
16
- value: id,
17
- text: ((_a = spec.description) === null || _a === void 0 ? void 0 : _a[id]) || id,
18
- content: ((_c = (_b = spec.viewSpec.selectParams) === null || _b === void 0 ? void 0 : _b.meta) === null || _c === void 0 ? void 0 : _c[id]) ? (React.createElement("div", { key: id },
19
- React.createElement(Text, null, ((_d = spec.description) === null || _d === void 0 ? void 0 : _d[id]) || id),
20
- React.createElement(Text, { color: "secondary", className: b('meta-text') }, spec.viewSpec.selectParams.meta[id]))) : (((_e = spec.description) === null || _e === void 0 ? void 0 : _e[id]) || id),
21
- key: id,
13
+ return withCustomOptions
14
+ ? externalOptions || []
15
+ : (_a = spec.enum) === null || _a === void 0 ? void 0 : _a.map((id) => {
16
+ var _a, _b, _c, _d, _e;
17
+ return ({
18
+ id,
19
+ value: id,
20
+ text: ((_a = spec.description) === null || _a === void 0 ? void 0 : _a[id]) || id,
21
+ content: ((_c = (_b = spec.viewSpec.selectParams) === null || _b === void 0 ? void 0 : _b.meta) === null || _c === void 0 ? void 0 : _c[id]) ? (React.createElement("div", { key: id },
22
+ React.createElement(Text, null, ((_d = spec.description) === null || _d === void 0 ? void 0 : _d[id]) || id),
23
+ React.createElement(Text, { color: "secondary", className: b('meta-text') }, spec.viewSpec.selectParams.meta[id]))) : (((_e = spec.description) === null || _e === void 0 ? void 0 : _e[id]) || id),
24
+ key: id,
25
+ });
22
26
  });
23
- });
24
- }, [spec.enum, spec.description, (_b = spec.viewSpec.selectParams) === null || _b === void 0 ? void 0 : _b.meta]);
27
+ }, [
28
+ spec.enum,
29
+ spec.description,
30
+ (_b = spec.viewSpec.selectParams) === null || _b === void 0 ? void 0 : _b.meta,
31
+ externalOptions,
32
+ withCustomOptions,
33
+ ]);
25
34
  const renderOption = React.useCallback((option) => {
26
35
  return React.createElement(React.Fragment, { key: option.value }, option.content || option.value);
27
36
  }, []);
@@ -41,5 +50,5 @@ export const Select = ({ name, input, spec }) => {
41
50
  onBlur();
42
51
  }
43
52
  }, [onFocus, onBlur]);
44
- 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, filterPlaceholder: (_d = spec.viewSpec.selectParams) === null || _d === void 0 ? void 0 : _d.filterPlaceholder, getOptionHeight: getOptionHeight, renderOption: renderOption, qa: name }));
53
+ return (React.createElement(SelectBase, Object.assign({ className: b(), width: "max", filterable: filterable, getOptionHeight: getOptionHeight, renderOption: renderOption }, inputProps, { value: [value], options: options, onUpdate: handleChange, onOpenChange: handleToggle, disabled: spec.viewSpec.disabled, placeholder: spec.viewSpec.placeholder, filterPlaceholder: (_d = spec.viewSpec.selectParams) === null || _d === void 0 ? void 0 : _d.filterPlaceholder, qa: name })));
45
54
  };
@@ -1,2 +1,5 @@
1
+ import { TextInputProps as TextInputBaseProps } from '@gravity-ui/uikit';
1
2
  import { NumberInputProps, StringInputProps } from '../../../../core';
2
- export declare const Text: <T extends NumberInputProps | StringInputProps>({ name, input: { value, onBlur, onChange, onFocus }, spec, }: T) => JSX.Element;
3
+ export interface TextProps extends Omit<TextInputBaseProps, 'value' | 'onBlur' | 'onFocus' | 'onUpdate' | 'disabled' | 'placeholder' | 'qa'> {
4
+ }
5
+ export declare const Text: <T extends NumberInputProps<TextProps> | StringInputProps<TextProps>>({ name, input: { value, onBlur, onChange, onFocus }, spec, inputProps, }: T) => JSX.Element;
@@ -2,17 +2,8 @@ import React from 'react';
2
2
  import { PasswordInput } from '@gravity-ui/components';
3
3
  import { TextInput } from '@gravity-ui/uikit';
4
4
  import _ from 'lodash';
5
- export const Text = ({ name, input: { value, onBlur, onChange, onFocus }, spec, }) => {
6
- const props = {
7
- value: _.isNil(value) ? '' : `${value}`,
8
- hasClear: true,
9
- onBlur: onBlur,
10
- onFocus: onFocus,
11
- onUpdate: onChange,
12
- disabled: spec.viewSpec.disabled,
13
- placeholder: spec.viewSpec.placeholder,
14
- qa: name,
15
- };
5
+ export const Text = ({ name, input: { value, onBlur, onChange, onFocus }, spec, inputProps, }) => {
6
+ const props = Object.assign(Object.assign({ hasClear: true }, inputProps), { value: _.isNil(value) ? '' : `${value}`, onBlur: onBlur, onFocus: onFocus, onUpdate: onChange, disabled: spec.viewSpec.disabled, placeholder: spec.viewSpec.placeholder, qa: name });
16
7
  if (spec.viewSpec.type === 'password') {
17
8
  return (React.createElement(PasswordInput, Object.assign({}, props, { autoComplete: "new-password", showCopyButton: true, showRevealButton: true })));
18
9
  }
@@ -1,2 +1,5 @@
1
+ import { TextAreaProps as TextAreaBaseProps } from '@gravity-ui/uikit';
1
2
  import { StringInput } from '../../../../core';
2
- export declare const TextArea: StringInput;
3
+ export interface TextAreaProps extends Omit<TextAreaBaseProps, 'value' | 'onBlur' | 'onFocus' | 'onUpdate' | 'disabled' | 'placeholder' | 'qa'> {
4
+ }
5
+ export declare const TextArea: StringInput<TextAreaProps>;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { TextArea as TextAreaBase } from '@gravity-ui/uikit';
3
- export const TextArea = ({ name, input, spec }) => {
3
+ export const TextArea = ({ name, input, spec, inputProps }) => {
4
4
  const { value, onBlur, onChange, onFocus } = input;
5
- return (React.createElement(TextAreaBase, { value: value || '', onBlur: onBlur, onFocus: onFocus, onUpdate: onChange, maxRows: 20, minRows: 8, hasClear: true, disabled: spec.viewSpec.disabled, placeholder: spec.viewSpec.placeholder, qa: name }));
5
+ return (React.createElement(TextAreaBase, Object.assign({ maxRows: 20, minRows: 8, hasClear: true }, inputProps, { value: value || '', onBlur: onBlur, onFocus: onFocus, onUpdate: onChange, disabled: spec.viewSpec.disabled, placeholder: spec.viewSpec.placeholder, qa: name })));
6
6
  };
@@ -1,2 +1,2 @@
1
1
  import { ArrayLayoutProps, ObjectLayoutProps } from '../../../../core';
2
- export declare const Accordeon: <T extends ArrayLayoutProps | ObjectLayoutProps>({ name, spec, input, meta, children, }: T) => JSX.Element;
2
+ export declare const Accordeon: <T extends ArrayLayoutProps<{}> | ObjectLayoutProps<{}>>({ name, spec, input, meta, children, }: T) => JSX.Element;
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
2
  import { ErrorWrapper } from '../../../components';
3
3
  import { useErrorChecker } from '../../../hooks';
4
+ import { RemoveButton } from '../../RemoveButton';
4
5
  import { SimpleVerticalAccordeon } from '../../SimpleVerticalAccordeon';
5
- import { RemoveButton } from './RemoveButton';
6
6
  export const Accordeon = ({ name, spec, input, meta, children, }) => {
7
7
  var _a;
8
8
  const [open, setOpen] = React.useState(Boolean((_a = spec.viewSpec) === null || _a === void 0 ? void 0 : _a.layoutOpen));
@@ -0,0 +1,3 @@
1
+ .df-accordeon-card-form__accordeon-card-body {
2
+ padding-right: 32px;
3
+ }
@@ -0,0 +1,3 @@
1
+ import { ArrayLayoutProps, ObjectLayoutProps } from '../../../../core';
2
+ import './AccordeonCardForm.css';
3
+ export declare const AccordeonCardForm: <T extends ArrayLayoutProps<{}> | ObjectLayoutProps<{}>>({ name, spec, input, children, meta, }: T) => JSX.Element;
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { useErrorChecker } from '../../../hooks';
3
+ import { block } from '../../../utils';
4
+ import { AccordeonCard } from '../../AccordeonCard';
5
+ import { ErrorWrapper } from '../../ErrorWrapper';
6
+ import { RemoveButton } from '../../RemoveButton';
7
+ import './AccordeonCardForm.css';
8
+ const b = block('accordeon-card-form');
9
+ export const AccordeonCardForm = ({ name, spec, input, children, meta, }) => {
10
+ var _a;
11
+ const [open, setOpen] = React.useState(Boolean((_a = spec.viewSpec) === null || _a === void 0 ? void 0 : _a.layoutOpen));
12
+ const onDrop = React.useCallback(() => {
13
+ setOpen(false);
14
+ input.onDrop();
15
+ }, [input.onDrop, setOpen]);
16
+ const removeButton = React.useMemo(() => {
17
+ if (spec.required || !input.value) {
18
+ return null;
19
+ }
20
+ return React.createElement(RemoveButton, { name: name, onDrop: onDrop });
21
+ }, [spec.required, input.value, onDrop, name]);
22
+ useErrorChecker({ name, meta, open, setOpen });
23
+ return (React.createElement(AccordeonCard, { classNameBody: b('accordeon-card-body'), name: name, header: spec.viewSpec.layoutTitle || '', description: spec.viewSpec.layoutDescription || '', open: open, onToggle: setOpen, headerActionsTemplate: removeButton },
24
+ React.createElement(ErrorWrapper, { name: name, meta: meta, withoutChildErrorStyles: true }, children)));
25
+ };
@@ -0,0 +1 @@
1
+ export * from './AccordeonCardForm';
@@ -0,0 +1 @@
1
+ export * from './AccordeonCardForm';
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { Card, ErrorWrapper } from '../../components';
3
3
  import { useErrorChecker } from '../../hooks';
4
- import { RemoveButton } from './Accordeon/RemoveButton';
4
+ import { RemoveButton } from '../RemoveButton';
5
5
  export const CardAccordeon = ({ name, spec, input, meta, children, }) => {
6
6
  var _a;
7
7
  const [open, setOpen] = React.useState(Boolean((_a = spec.viewSpec) === null || _a === void 0 ? void 0 : _a.layoutOpen));
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { Card, ErrorWrapper } from '../../components';
3
- import { RemoveButton } from './Accordeon/RemoveButton';
3
+ import { RemoveButton } from '../RemoveButton';
4
4
  export const CardSection = ({ name, spec, input, meta, children, }) => {
5
5
  const removeButton = React.useMemo(() => {
6
6
  if (spec.required || !input.value) {
@@ -1,4 +1,5 @@
1
1
  export * from './Accordeon';
2
+ export * from './AccordeonCard';
2
3
  export * from './CardAccordeon';
3
4
  export * from './CardSection';
4
5
  export * from './Row';
@@ -1,4 +1,5 @@
1
1
  export * from './Accordeon';
2
+ export * from './AccordeonCard';
2
3
  export * from './CardAccordeon';
3
4
  export * from './CardSection';
4
5
  export * from './Row';
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { Ellipsis } from '@gravity-ui/icons';
3
3
  import { Button, DropdownMenu, Icon } from '@gravity-ui/uikit';
4
- import i18n from '../../../i18n';
4
+ import i18n from '../../i18n';
5
5
  export const RemoveButton = ({ name, onDrop }) => {
6
6
  const items = React.useMemo(() => [{ text: i18n('label_delete'), action: onDrop, theme: 'danger' }], [onDrop]);
7
7
  const switcher = React.useMemo(() => (React.createElement(Button, { view: "flat", qa: `${name}-drop-item` },
@@ -0,0 +1 @@
1
+ export * from './RemoveButton';
@@ -0,0 +1 @@
1
+ export * from './RemoveButton';
@@ -0,0 +1,2 @@
1
+ import { ArrayViewLayoutProps, ObjectViewLayoutProps } from '../../../../core';
2
+ export declare const ViewAccordeonCard: <T extends ArrayViewLayoutProps | ObjectViewLayoutProps>({ value, name, spec, children, }: T) => JSX.Element | null;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import _ from 'lodash';
3
+ import { isNotEmptyValue } from '../../../utils';
4
+ import { AccordeonCard } from '../../AccordeonCard';
5
+ export const ViewAccordeonCard = ({ value, name, spec, children, }) => {
6
+ const [open, setOpen] = React.useState(_.isBoolean(spec.viewSpec.layoutOpen) ? spec.viewSpec.layoutOpen : true);
7
+ if (!isNotEmptyValue(value, spec)) {
8
+ return null;
9
+ }
10
+ return (React.createElement(AccordeonCard, { name: name, header: spec.viewSpec.layoutTitle || '', open: open, onToggle: setOpen }, children));
11
+ };
@@ -0,0 +1 @@
1
+ export * from './ViewAccordeonCard';
@@ -0,0 +1 @@
1
+ export * from './ViewAccordeonCard';
@@ -1,5 +1,6 @@
1
1
  export * from './ViewAccordeon';
2
2
  export * from './ViewCardAccordeon';
3
+ export * from './ViewAccordeonCard';
3
4
  export * from './ViewCardSection';
4
5
  export * from './ViewRow';
5
6
  export * from './ViewSection';
@@ -1,5 +1,6 @@
1
1
  export * from './ViewAccordeon';
2
2
  export * from './ViewCardAccordeon';
3
+ export * from './ViewAccordeonCard';
3
4
  export * from './ViewCardSection';
4
5
  export * from './ViewRow';
5
6
  export * from './ViewSection';
@@ -1,4 +1,4 @@
1
- import { Accordeon, ArrayBase, ArrayBaseView, BaseView, CardAccordeon, CardOneOf, CardOneOfView, CardSection, Checkbox, FileInput, FileInputView, Group, Group2, MonacoInput, MonacoView, MultiOneOf, MultiOneOfFlat, MultiOneOfFlatView, MultiOneOfView, MultiSelect, MultiSelectView, NumberWithScale, NumberWithScaleView, ObjectBase, ObjectBaseView, ObjectInline, ObjectInlineView, ObjectValueInput, ObjectValueInputView, OneOf, OneOfFlat, OneOfFlatView, OneOfView, Row, RowVerbose, Secret, Section, Section2, Select, Switch, TableArrayInput, TableArrayView, TableCell, Text, TextArea, TextAreaView, TextContent, TextLink, TextLinkView, Transparent, ViewAccordeon, ViewCardAccordeon, ViewCardSection, ViewGroup, ViewGroup2, ViewRow, ViewSection, ViewSection2, ViewTableCell, ViewTransparent, } from '../components';
1
+ import { Accordeon, AccordeonCardForm, ArrayBase, ArrayBaseView, BaseView, CardAccordeon, CardOneOf, CardOneOfView, CardSection, Checkbox, FileInput, FileInputView, Group, Group2, MonacoInput, MonacoView, MultiOneOf, MultiOneOfFlat, MultiOneOfFlatView, MultiOneOfView, MultiSelect, MultiSelectView, NumberWithScale, NumberWithScaleView, ObjectBase, ObjectBaseView, ObjectInline, ObjectInlineView, ObjectValueInput, ObjectValueInputView, OneOf, OneOfFlat, OneOfFlatView, OneOfView, Row, RowVerbose, Secret, Section, Section2, Select, Switch, TableArrayInput, TableArrayView, TableCell, Text, TextArea, TextAreaView, TextContent, TextLink, TextLinkView, Transparent, ViewAccordeon, ViewAccordeonCard, ViewCardAccordeon, ViewCardSection, ViewGroup, ViewGroup2, ViewRow, ViewSection, ViewSection2, ViewTableCell, ViewTransparent, } from '../components';
2
2
  import { getArrayValidator, getBooleanValidator, getNumberValidator, getObjectValidator, getStringValidator, } from '../validators';
3
3
  export const dynamicConfig = {
4
4
  array: {
@@ -19,6 +19,7 @@ export const dynamicConfig = {
19
19
  transparent: Transparent,
20
20
  card_accordeon: CardAccordeon,
21
21
  card_section: CardSection,
22
+ accordeon_card: AccordeonCardForm,
22
23
  },
23
24
  validators: {
24
25
  base: getArrayValidator(),
@@ -76,6 +77,7 @@ export const dynamicConfig = {
76
77
  transparent: Transparent,
77
78
  card_accordeon: CardAccordeon,
78
79
  card_section: CardSection,
80
+ accordeon_card: AccordeonCardForm,
79
81
  },
80
82
  validators: {
81
83
  base: getObjectValidator(),
@@ -128,6 +130,7 @@ export const dynamicViewConfig = {
128
130
  transparent: ViewTransparent,
129
131
  card_accordeon: ViewCardAccordeon,
130
132
  card_section: ViewCardSection,
133
+ accordeon_card: ViewAccordeonCard,
131
134
  },
132
135
  },
133
136
  boolean: {
@@ -176,6 +179,7 @@ export const dynamicViewConfig = {
176
179
  transparent: ViewTransparent,
177
180
  card_accordeon: ViewCardAccordeon,
178
181
  card_section: ViewCardSection,
182
+ accordeon_card: ViewAccordeonCard,
179
183
  },
180
184
  },
181
185
  string: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/dynamic-forms",
3
- "version": "3.5.0",
3
+ "version": "3.6.0",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "main": "build/cjs/index.js",