@gravity-ui/dynamic-forms 3.4.1 → 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.
- package/build/cjs/lib/core/components/Form/Controller/utils.js +7 -8
- package/build/cjs/lib/kit/components/AccordeonCard/AccordeonCard.css +13 -11
- package/build/cjs/lib/kit/components/AccordeonCard/AccordeonCard.js +12 -5
- package/build/cjs/lib/kit/components/Card/Card.css +0 -6
- package/build/cjs/lib/kit/components/Card/Card.js +1 -1
- package/build/cjs/lib/kit/components/Inputs/CardOneOf/CardOneOf.js +1 -1
- package/build/cjs/lib/kit/components/Inputs/FileInput/FileInput.css +0 -4
- package/build/cjs/lib/kit/components/Inputs/FileInput/FileInput.js +1 -1
- package/build/cjs/lib/kit/components/Inputs/MonacoInput/MonacoHeader.css +0 -5
- package/build/cjs/lib/kit/components/Inputs/MonacoInput/MonacoHeader.js +1 -1
- package/build/cjs/lib/kit/components/Inputs/MultiSelect/MultiSelect.js +23 -14
- package/build/cjs/lib/kit/components/Inputs/Select/Select.js +23 -14
- package/build/cjs/lib/kit/components/Inputs/Text/Text.js +2 -11
- package/build/cjs/lib/kit/components/Inputs/TextArea/TextArea.js +2 -2
- package/build/cjs/lib/kit/components/Inputs/TextContent/TextContent.js +1 -1
- package/build/cjs/lib/kit/components/Layouts/Accordeon/Accordeon.js +1 -1
- package/build/cjs/lib/kit/components/Layouts/AccordeonCard/AccordeonCardForm.css +3 -0
- package/build/cjs/lib/kit/components/Layouts/AccordeonCard/AccordeonCardForm.js +29 -0
- package/build/cjs/lib/kit/components/Layouts/AccordeonCard/index.js +4 -0
- package/build/cjs/lib/kit/components/Layouts/CardAccordeon.js +1 -1
- package/build/cjs/lib/kit/components/Layouts/CardSection.js +1 -1
- package/build/cjs/lib/kit/components/Layouts/Row/Row.js +2 -2
- package/build/cjs/lib/kit/components/Layouts/Section/Section.js +1 -1
- package/build/cjs/lib/kit/components/Layouts/index.js +1 -0
- package/build/cjs/lib/kit/components/LongValue/LongValue.css +0 -6
- package/build/cjs/lib/kit/components/LongValue/LongValue.js +12 -1
- package/build/cjs/lib/kit/components/{Layouts/Accordeon → RemoveButton}/RemoveButton.js +1 -1
- package/build/cjs/lib/kit/components/RemoveButton/index.js +4 -0
- package/build/cjs/lib/kit/components/SimpleVerticalAccordeon/SimpleVerticalAccordeon.css +0 -15
- package/build/cjs/lib/kit/components/SimpleVerticalAccordeon/SimpleVerticalAccordeon.js +14 -3
- package/build/cjs/lib/kit/components/ViewLayouts/ViewAccordeonCard/ViewAccordeonCard.js +16 -0
- package/build/cjs/lib/kit/components/ViewLayouts/ViewAccordeonCard/index.js +4 -0
- package/build/cjs/lib/kit/components/ViewLayouts/ViewRow/ViewRow.css +0 -6
- package/build/cjs/lib/kit/components/ViewLayouts/ViewRow/ViewRow.js +2 -1
- package/build/cjs/lib/kit/components/ViewLayouts/index.js +1 -0
- package/build/cjs/lib/kit/components/Views/NumberWithScaleView/NumberWithScaleView.js +1 -3
- package/build/cjs/lib/kit/components/Views/TextAreaView/TextAreaView.css +0 -8
- package/build/cjs/lib/kit/components/Views/TextAreaView/TextAreaView.js +1 -1
- package/build/cjs/lib/kit/constants/config.js +4 -0
- package/build/esm/lib/core/components/Form/Controller/utils.js +7 -8
- package/build/esm/lib/core/components/Form/hooks/useGenerateRandomValue.d.ts +1 -1
- package/build/esm/lib/core/components/Form/types/array.d.ts +6 -6
- package/build/esm/lib/core/components/Form/types/boolean.d.ts +6 -6
- package/build/esm/lib/core/components/Form/types/input.d.ts +2 -0
- package/build/esm/lib/core/components/Form/types/layout.d.ts +1 -0
- package/build/esm/lib/core/components/Form/types/number.d.ts +6 -6
- package/build/esm/lib/core/components/Form/types/object.d.ts +6 -6
- package/build/esm/lib/core/components/Form/types/string.d.ts +6 -6
- package/build/esm/lib/core/helpers.d.ts +5 -5
- package/build/esm/lib/core/types/specs.d.ts +15 -5
- package/build/esm/lib/kit/components/AccordeonCard/AccordeonCard.css +13 -11
- package/build/esm/lib/kit/components/AccordeonCard/AccordeonCard.d.ts +1 -0
- package/build/esm/lib/kit/components/AccordeonCard/AccordeonCard.js +13 -6
- package/build/esm/lib/kit/components/Card/Card.css +0 -6
- package/build/esm/lib/kit/components/Card/Card.js +2 -2
- package/build/esm/lib/kit/components/Inputs/CardOneOf/CardOneOf.js +1 -1
- package/build/esm/lib/kit/components/Inputs/FileInput/FileInput.css +0 -4
- package/build/esm/lib/kit/components/Inputs/FileInput/FileInput.js +2 -2
- package/build/esm/lib/kit/components/Inputs/MonacoInput/MonacoHeader.css +0 -5
- package/build/esm/lib/kit/components/Inputs/MonacoInput/MonacoHeader.js +2 -2
- package/build/esm/lib/kit/components/Inputs/MultiSelect/MultiSelect.d.ts +5 -1
- package/build/esm/lib/kit/components/Inputs/MultiSelect/MultiSelect.js +23 -14
- package/build/esm/lib/kit/components/Inputs/Select/Select.d.ts +5 -1
- package/build/esm/lib/kit/components/Inputs/Select/Select.js +23 -14
- package/build/esm/lib/kit/components/Inputs/Text/Text.d.ts +4 -1
- package/build/esm/lib/kit/components/Inputs/Text/Text.js +2 -11
- package/build/esm/lib/kit/components/Inputs/TextArea/TextArea.d.ts +4 -1
- package/build/esm/lib/kit/components/Inputs/TextArea/TextArea.js +2 -2
- package/build/esm/lib/kit/components/Inputs/TextContent/TextContent.js +1 -1
- package/build/esm/lib/kit/components/Layouts/Accordeon/Accordeon.d.ts +1 -1
- package/build/esm/lib/kit/components/Layouts/Accordeon/Accordeon.js +1 -1
- package/build/esm/lib/kit/components/Layouts/AccordeonCard/AccordeonCardForm.css +3 -0
- package/build/esm/lib/kit/components/Layouts/AccordeonCard/AccordeonCardForm.d.ts +3 -0
- package/build/esm/lib/kit/components/Layouts/AccordeonCard/AccordeonCardForm.js +25 -0
- package/build/esm/lib/kit/components/Layouts/AccordeonCard/index.d.ts +1 -0
- package/build/esm/lib/kit/components/Layouts/AccordeonCard/index.js +1 -0
- package/build/esm/lib/kit/components/Layouts/CardAccordeon.js +1 -1
- package/build/esm/lib/kit/components/Layouts/CardSection.js +1 -1
- package/build/esm/lib/kit/components/Layouts/Row/Row.js +3 -3
- package/build/esm/lib/kit/components/Layouts/Section/Section.js +2 -2
- package/build/esm/lib/kit/components/Layouts/index.d.ts +1 -0
- package/build/esm/lib/kit/components/Layouts/index.js +1 -0
- package/build/esm/lib/kit/components/LongValue/LongValue.css +0 -6
- package/build/esm/lib/kit/components/LongValue/LongValue.js +12 -1
- package/build/esm/lib/kit/components/{Layouts/Accordeon → RemoveButton}/RemoveButton.js +1 -1
- package/build/esm/lib/kit/components/RemoveButton/index.d.ts +1 -0
- package/build/esm/lib/kit/components/RemoveButton/index.js +1 -0
- package/build/esm/lib/kit/components/SimpleVerticalAccordeon/SimpleVerticalAccordeon.css +0 -15
- package/build/esm/lib/kit/components/SimpleVerticalAccordeon/SimpleVerticalAccordeon.d.ts +1 -0
- package/build/esm/lib/kit/components/SimpleVerticalAccordeon/SimpleVerticalAccordeon.js +15 -4
- package/build/esm/lib/kit/components/ViewLayouts/ViewAccordeonCard/ViewAccordeonCard.d.ts +2 -0
- package/build/esm/lib/kit/components/ViewLayouts/ViewAccordeonCard/ViewAccordeonCard.js +11 -0
- package/build/esm/lib/kit/components/ViewLayouts/ViewAccordeonCard/index.d.ts +1 -0
- package/build/esm/lib/kit/components/ViewLayouts/ViewAccordeonCard/index.js +1 -0
- package/build/esm/lib/kit/components/ViewLayouts/ViewRow/ViewRow.css +0 -6
- package/build/esm/lib/kit/components/ViewLayouts/ViewRow/ViewRow.js +2 -1
- package/build/esm/lib/kit/components/ViewLayouts/index.d.ts +1 -0
- package/build/esm/lib/kit/components/ViewLayouts/index.js +1 -0
- package/build/esm/lib/kit/components/Views/NumberWithScaleView/NumberWithScaleView.js +2 -4
- package/build/esm/lib/kit/components/Views/TextAreaView/TextAreaView.css +0 -8
- package/build/esm/lib/kit/components/Views/TextAreaView/TextAreaView.js +2 -2
- package/build/esm/lib/kit/constants/config.js +5 -1
- package/package.json +1 -1
- /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
|
}
|
|
@@ -288,11 +289,9 @@ const updateStore = ({ store, setStore, spec: _spec, name, parentOnChange, paren
|
|
|
288
289
|
parentOnChange,
|
|
289
290
|
parentOnUnmount,
|
|
290
291
|
})), { state: store.state });
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
: {})));
|
|
295
|
-
}
|
|
292
|
+
nextStore = methodOnChange(nextStore, Object.assign({ valOrSetter: (value) => valueMutatorUpdated ? valueMutator.value : value }, (errorMutatorUpdated
|
|
293
|
+
? { errorMutator: errorMutator.value }
|
|
294
|
+
: {})));
|
|
296
295
|
setStore(nextStore);
|
|
297
296
|
}
|
|
298
297
|
else if (updateNonCritical) {
|
|
@@ -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
|
}
|
|
@@ -47,15 +59,6 @@
|
|
|
47
59
|
justify-content: center;
|
|
48
60
|
order: -1;
|
|
49
61
|
}
|
|
50
|
-
.df-accordeon-card__header-content-title {
|
|
51
|
-
font-weight: 700;
|
|
52
|
-
}
|
|
53
|
-
.df-accordeon-card__header-content-title_size_s {
|
|
54
|
-
font-size: 13px;
|
|
55
|
-
}
|
|
56
|
-
.df-accordeon-card__header-content-title_size_m {
|
|
57
|
-
font-size: 16px;
|
|
58
|
-
}
|
|
59
62
|
.df-accordeon-card__header-content-description {
|
|
60
63
|
margin-top: 12px;
|
|
61
64
|
color: var(--g-color-text-complementary);
|
|
@@ -73,7 +76,6 @@
|
|
|
73
76
|
}
|
|
74
77
|
.df-accordeon-card__body {
|
|
75
78
|
display: none;
|
|
76
|
-
margin-top: -10px 0 8px;
|
|
77
79
|
padding: 16px;
|
|
78
80
|
}
|
|
79
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);
|
|
@@ -31,20 +31,27 @@ const AccordeonCard = ({ className, name, header, description, open: propsOpen,
|
|
|
31
31
|
accordeonRef.current.classList.add('df-accordeon-card_empty');
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
|
+
const currentHeaderVariant = react_1.default.useMemo(() => {
|
|
35
|
+
if (!lodash_1.default.isString(header)) {
|
|
36
|
+
return 'body-1';
|
|
37
|
+
}
|
|
38
|
+
if (titleSize === 'm') {
|
|
39
|
+
return 'subheader-2';
|
|
40
|
+
}
|
|
41
|
+
return 'subheader-1';
|
|
42
|
+
}, [titleSize]);
|
|
34
43
|
return (react_1.default.createElement("div", { ref: accordeonRef, className: b({ empty: Boolean(emptyBody) }, className) },
|
|
35
44
|
react_1.default.createElement("div", { className: b('header', {
|
|
36
45
|
open: open && !emptyBody,
|
|
37
46
|
'without-action': ignoreHeaderToggle || alwaysOpen,
|
|
38
47
|
}), onClick: !ignoreHeaderToggle && !alwaysOpen ? handleToggle : undefined },
|
|
39
48
|
react_1.default.createElement("div", { className: b('header-content') },
|
|
40
|
-
react_1.default.createElement(
|
|
41
|
-
? b('header-content-title', { size: titleSize })
|
|
42
|
-
: undefined }, header),
|
|
49
|
+
react_1.default.createElement(uikit_1.Text, { variant: currentHeaderVariant }, header),
|
|
43
50
|
description ? (react_1.default.createElement("span", { className: b('header-content-description'), dangerouslySetInnerHTML: { __html: description } })) : null),
|
|
44
51
|
!emptyBody && !alwaysOpen ? (react_1.default.createElement("div", { className: b('header-toggle-btn'), onClick: preventEvent },
|
|
45
52
|
headerActionsTemplate ? (react_1.default.createElement("div", { className: b('interal-actions') }, headerActionsTemplate)) : null,
|
|
46
53
|
react_1.default.createElement(uikit_1.Button, { view: "flat", onClick: handleToggle, qa: `${name}-accordeon-toggler` },
|
|
47
54
|
react_1.default.createElement(uikit_1.Icon, { className: b('toggle-icon', { open }), data: icons_1.ChevronDown, size: 16 })))) : null),
|
|
48
|
-
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)));
|
|
49
56
|
};
|
|
50
57
|
exports.AccordeonCard = AccordeonCard;
|
|
@@ -48,12 +48,6 @@
|
|
|
48
48
|
margin-left: 10px;
|
|
49
49
|
}
|
|
50
50
|
.df-card__title {
|
|
51
|
-
font-size: var(--g-text-subheader-2-font-size);
|
|
52
|
-
font-weight: var(--g-text-subheader-font-weight);
|
|
53
|
-
line-height: var(--g-text-subheader-2-line-height);
|
|
54
|
-
white-space: nowrap;
|
|
55
|
-
overflow: hidden;
|
|
56
|
-
text-overflow: ellipsis;
|
|
57
51
|
max-width: 533px;
|
|
58
52
|
}
|
|
59
53
|
.df-card__note {
|
|
@@ -38,7 +38,7 @@ const Card = ({ name, title: propsTitle, description, actions, open: propsOpen,
|
|
|
38
38
|
if (lodash_1.default.isString(propsTitle)) {
|
|
39
39
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
40
40
|
react_1.default.createElement(uikit_1.Popover, { content: propsTitle, disabled: titlePopoverDisabled, placement: common_1.COMMON_POPOVER_PLACEMENT },
|
|
41
|
-
react_1.default.createElement(
|
|
41
|
+
react_1.default.createElement(uikit_1.Text, { className: b('title'), ellipsis: true, ref: titleRef, variant: "subheader-2" }, propsTitle)),
|
|
42
42
|
description ? (react_1.default.createElement("div", { className: b('note') },
|
|
43
43
|
react_1.default.createElement(components_1.HelpPopover, { htmlContent: description, placement: common_1.COMMON_POPOVER_PLACEMENT }))) : null));
|
|
44
44
|
}
|
|
@@ -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("../../
|
|
11
|
+
const RemoveButton_1 = require("../../RemoveButton");
|
|
12
12
|
const CardOneOf = (props) => {
|
|
13
13
|
var _a;
|
|
14
14
|
const { input, meta, spec, name } = props;
|
|
@@ -43,7 +43,7 @@ const FileInput = ({ name, input, spec }) => {
|
|
|
43
43
|
return (react_1.default.createElement("div", { className: b() },
|
|
44
44
|
react_1.default.createElement(uikit_1.Button, { disabled: spec.viewSpec.disabled, onClick: handleClick, qa: `${name}-file-upload` }, (0, i18n_1.default)('button-upload_file')),
|
|
45
45
|
react_1.default.createElement("input", { type: "file", ref: inputRef, autoComplete: "off", disabled: spec.viewSpec.disabled, onChange: handleInputChange, className: b('input'), tabIndex: -1, accept: (_b = spec.viewSpec.fileInput) === null || _b === void 0 ? void 0 : _b.accept }),
|
|
46
|
-
react_1.default.createElement(
|
|
46
|
+
react_1.default.createElement(uikit_1.Text, { className: b('file-name'), ellipsis: true, color: "secondary" }, fileNameContent),
|
|
47
47
|
value ? (react_1.default.createElement(uikit_1.Button, { view: "flat", onClick: handleReset, disabled: spec.viewSpec.disabled, qa: `${name}-file-remove` },
|
|
48
48
|
react_1.default.createElement(uikit_1.Icon, { data: icons_1.Xmark, size: 16 }))) : null));
|
|
49
49
|
};
|
|
@@ -10,5 +10,5 @@ const b = (0, utils_1.block)('monaco-header');
|
|
|
10
10
|
const MonacoHeader = ({ language, editButton }) => (react_1.default.createElement("div", { className: b() },
|
|
11
11
|
react_1.default.createElement("div", null,
|
|
12
12
|
react_1.default.createElement(uikit_1.Icon, { data: icons_1.File, size: 18 }),
|
|
13
|
-
react_1.default.createElement(
|
|
13
|
+
react_1.default.createElement(uikit_1.Text, { variant: "body-3" }, language)), editButton !== null && editButton !== void 0 ? editButton : null));
|
|
14
14
|
exports.MonacoHeader = MonacoHeader;
|
|
@@ -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
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
|
|
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,
|
|
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
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
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,
|
|
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,
|
|
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;
|
|
@@ -27,7 +27,7 @@ const TextContent = (_a) => {
|
|
|
27
27
|
iconLib ? (react_1.default.createElement(uikit_1.Text, { color: (_b = spec.viewSpec.textContentParams) === null || _b === void 0 ? void 0 : _b.iconColor, className: b('icon') }, iconLib)) : null,
|
|
28
28
|
content,
|
|
29
29
|
input.value ? (react_1.default.createElement(react_1.default.Fragment, null,
|
|
30
|
-
react_1.default.createElement(
|
|
30
|
+
react_1.default.createElement(uikit_1.Text, { className: b('separator') }, ":"),
|
|
31
31
|
react_1.default.createElement(uikit_1.Text, { color: "secondary" }, input.value))) : null));
|
|
32
32
|
}
|
|
33
33
|
if (Layout) {
|
|
@@ -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,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;
|
|
@@ -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("
|
|
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("
|
|
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) {
|
|
@@ -16,9 +16,9 @@ const RowBase = ({ name, spec, input, meta, verboseDescription, children, }) =>
|
|
|
16
16
|
return (react_1.default.createElement("div", { className: b() },
|
|
17
17
|
react_1.default.createElement("div", { className: b('left') },
|
|
18
18
|
react_1.default.createElement("div", { className: b('left-inner') },
|
|
19
|
-
react_1.default.createElement(
|
|
19
|
+
react_1.default.createElement(uikit_1.Text, { className: b('title', { required: spec.required }) }, spec.viewSpec.layoutTitle),
|
|
20
20
|
!verboseDescription && spec.viewSpec.layoutDescription ? (react_1.default.createElement("span", { className: b('note') },
|
|
21
|
-
react_1.default.createElement(
|
|
21
|
+
react_1.default.createElement(uikit_1.Text, { className: b('note-inner') },
|
|
22
22
|
react_1.default.createElement(components_1.HelpPopover, { htmlContent: spec.viewSpec.layoutDescription, placement: ['bottom', 'top'] })))) : null)),
|
|
23
23
|
react_1.default.createElement("div", { className: b('right') },
|
|
24
24
|
react_1.default.createElement("div", { className: b('right-inner') },
|
|
@@ -31,7 +31,7 @@ const SectionBase = (_a) => {
|
|
|
31
31
|
} }));
|
|
32
32
|
}
|
|
33
33
|
else {
|
|
34
|
-
description = (react_1.default.createElement(
|
|
34
|
+
description = (react_1.default.createElement(uikit_1.Text, { className: b('note') },
|
|
35
35
|
react_1.default.createElement(components_1.HelpPopover, { htmlContent: spec.viewSpec.layoutDescription, placement: ['bottom', 'top'] })));
|
|
36
36
|
}
|
|
37
37
|
}
|
|
@@ -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);
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.LongValue = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
const uikit_1 = require("@gravity-ui/uikit");
|
|
6
7
|
const utils_1 = require("../../utils");
|
|
7
8
|
const b = (0, utils_1.block)('long-value');
|
|
8
9
|
const LongValue = ({ value, className }) => {
|
|
@@ -11,6 +12,15 @@ const LongValue = ({ value, className }) => {
|
|
|
11
12
|
const [open, setOpen] = react_1.default.useState(false);
|
|
12
13
|
const [long, setLong] = react_1.default.useState(false);
|
|
13
14
|
const handleClick = react_1.default.useCallback(() => setOpen((f) => !f), [setOpen]);
|
|
15
|
+
const currentTextProperies = react_1.default.useMemo(() => {
|
|
16
|
+
let wordBreak;
|
|
17
|
+
let whiteSpace;
|
|
18
|
+
if (open) {
|
|
19
|
+
wordBreak = 'break-all';
|
|
20
|
+
whiteSpace = 'break-spaces';
|
|
21
|
+
}
|
|
22
|
+
return { wordBreak, whiteSpace };
|
|
23
|
+
}, [open]);
|
|
14
24
|
react_1.default.useEffect(() => {
|
|
15
25
|
if (ref.current) {
|
|
16
26
|
if (value !== prevValue.current) {
|
|
@@ -32,6 +42,7 @@ const LongValue = ({ value, className }) => {
|
|
|
32
42
|
}
|
|
33
43
|
}
|
|
34
44
|
});
|
|
35
|
-
return (react_1.default.createElement("div", { ref: ref,
|
|
45
|
+
return (react_1.default.createElement("div", { ref: ref, onClick: long ? handleClick : undefined },
|
|
46
|
+
react_1.default.createElement(uikit_1.Text, Object.assign({ className: b({ long }, className), ellipsis: true }, currentTextProperies), value)));
|
|
36
47
|
};
|
|
37
48
|
exports.LongValue = LongValue;
|
|
@@ -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("
|
|
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` },
|
|
@@ -17,21 +17,6 @@
|
|
|
17
17
|
margin-left: -13px;
|
|
18
18
|
max-width: 533px;
|
|
19
19
|
}
|
|
20
|
-
.df-simple-vertical-accordeon__title {
|
|
21
|
-
font-weight: 500;
|
|
22
|
-
}
|
|
23
|
-
.df-simple-vertical-accordeon__title_size_s {
|
|
24
|
-
margin-bottom: 0;
|
|
25
|
-
font-size: var(--g-text-body-1-font-size);
|
|
26
|
-
}
|
|
27
|
-
.df-simple-vertical-accordeon__title_size_m {
|
|
28
|
-
margin-bottom: 1px;
|
|
29
|
-
font-size: var(--g-text-body2-font-size);
|
|
30
|
-
}
|
|
31
|
-
.df-simple-vertical-accordeon__title_size_l {
|
|
32
|
-
margin-bottom: 2px;
|
|
33
|
-
font-size: var(--g-text-body3-font-size);
|
|
34
|
-
}
|
|
35
20
|
.df-simple-vertical-accordeon__tooltip {
|
|
36
21
|
margin: 0px 5px;
|
|
37
22
|
}
|
|
@@ -52,7 +52,7 @@ class SimpleVerticalAccordeon extends react_1.default.Component {
|
|
|
52
52
|
}
|
|
53
53
|
render() {
|
|
54
54
|
var _a;
|
|
55
|
-
const {
|
|
55
|
+
const { children, headerActionsTemplate, className, contentClassName, buttonClassName, hideInsteadOfDestroy, withBranchView, viewLayout, name, } = this.props;
|
|
56
56
|
const { open, hidden, isFirstRender } = this.state;
|
|
57
57
|
const content = hideInsteadOfDestroy ? (react_1.default.createElement("div", { ref: this.componentRef, className: b('body', { hidden: !open }) }, children)) : (open && (react_1.default.createElement("div", { ref: this.componentRef, className: b('body', contentClassName) }, children)));
|
|
58
58
|
if (viewLayout && !isFirstRender && hidden) {
|
|
@@ -60,11 +60,12 @@ class SimpleVerticalAccordeon extends react_1.default.Component {
|
|
|
60
60
|
}
|
|
61
61
|
const title = this.getTitle();
|
|
62
62
|
const titlePopoverDisabled = (((_a = this.titleRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) || 0) <= TITLE_TEXT_MAX_WIDTH;
|
|
63
|
+
const currentTitleVariant = this.getCurrentTitleVariant();
|
|
63
64
|
return (Boolean(react_1.default.Children.count(children)) && (react_1.default.createElement("div", { className: b({ branch: withBranchView, view: viewLayout }, className) },
|
|
64
65
|
react_1.default.createElement("div", { className: b('header') },
|
|
65
66
|
react_1.default.createElement(uikit_1.Popover, { content: title, disabled: titlePopoverDisabled, placement: common_1.COMMON_POPOVER_PLACEMENT },
|
|
66
67
|
react_1.default.createElement(uikit_1.Button, { view: "flat", className: b('header-inner', buttonClassName), onClick: this.handleClick, qa: `${name}-accordeon-toggler`, width: "auto" },
|
|
67
|
-
react_1.default.createElement(
|
|
68
|
+
react_1.default.createElement(uikit_1.Text, { variant: currentTitleVariant }, title),
|
|
68
69
|
react_1.default.createElement(uikit_1.Icon, { data: icons_1.ChevronDown, className: b('chevron', { open }), size: 16 }))),
|
|
69
70
|
this.getTooltip(),
|
|
70
71
|
headerActionsTemplate ? headerActionsTemplate : null),
|
|
@@ -77,9 +78,19 @@ class SimpleVerticalAccordeon extends react_1.default.Component {
|
|
|
77
78
|
}
|
|
78
79
|
return this.state.open ? openTitle : title;
|
|
79
80
|
}
|
|
81
|
+
getCurrentTitleVariant() {
|
|
82
|
+
const { titleSize } = this.props;
|
|
83
|
+
if (titleSize === 'm') {
|
|
84
|
+
return 'body-2';
|
|
85
|
+
}
|
|
86
|
+
if (titleSize === 'l') {
|
|
87
|
+
return 'body-3';
|
|
88
|
+
}
|
|
89
|
+
return 'body-1';
|
|
90
|
+
}
|
|
80
91
|
getTooltip() {
|
|
81
92
|
const { note } = this.props;
|
|
82
|
-
return note ? (react_1.default.createElement(
|
|
93
|
+
return note ? (react_1.default.createElement(uikit_1.Text, { className: b('tooltip') },
|
|
83
94
|
react_1.default.createElement(components_1.HelpPopover, { htmlContent: note, placement: ['bottom', 'top'] }))) : null;
|
|
84
95
|
}
|
|
85
96
|
}
|
|
@@ -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;
|