@gravity-ui/dynamic-forms 4.14.2 → 4.15.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/kit/components/Layouts/Accordeon/Accordeon.js +2 -1
- package/build/cjs/lib/kit/components/Layouts/AccordeonCard/AccordeonCardForm.js +2 -1
- package/build/cjs/lib/kit/components/Layouts/CardAccordeon.js +2 -1
- package/build/cjs/lib/kit/components/Layouts/CardSection.js +2 -1
- package/build/cjs/lib/kit/components/Layouts/Column/Column.css +62 -0
- package/build/cjs/lib/kit/components/Layouts/Column/Column.js +34 -0
- package/build/cjs/lib/kit/components/Layouts/Column/index.js +4 -0
- package/build/cjs/lib/kit/components/Layouts/Section/Section.css +15 -11
- package/build/cjs/lib/kit/components/Layouts/Section/Section.js +13 -3
- package/build/cjs/lib/kit/components/Layouts/index.js +1 -0
- package/build/cjs/lib/kit/components/RemoveButton/RemoveButton.js +3 -3
- package/build/cjs/lib/kit/components/SimpleVerticalAccordeon/SimpleVerticalAccordeon.css +3 -6
- package/build/cjs/lib/kit/components/ViewLayouts/ViewColumn/ViewColumn.css +22 -0
- package/build/cjs/lib/kit/components/ViewLayouts/ViewColumn/ViewColumn.js +24 -0
- package/build/cjs/lib/kit/components/ViewLayouts/ViewColumn/index.js +4 -0
- package/build/cjs/lib/kit/components/ViewLayouts/index.js +1 -0
- package/build/cjs/lib/kit/constants/config.js +10 -0
- package/build/esm/lib/core/components/Form/types/field.d.ts +1 -0
- package/build/esm/lib/kit/components/Layouts/Accordeon/Accordeon.js +2 -1
- package/build/esm/lib/kit/components/Layouts/AccordeonCard/AccordeonCardForm.js +2 -1
- package/build/esm/lib/kit/components/Layouts/CardAccordeon.js +2 -1
- package/build/esm/lib/kit/components/Layouts/CardSection.js +2 -1
- package/build/esm/lib/kit/components/Layouts/Column/Column.css +62 -0
- package/build/esm/lib/kit/components/Layouts/Column/Column.d.ts +3 -0
- package/build/esm/lib/kit/components/Layouts/Column/Column.js +30 -0
- package/build/esm/lib/kit/components/Layouts/Column/index.d.ts +1 -0
- package/build/esm/lib/kit/components/Layouts/Column/index.js +1 -0
- package/build/esm/lib/kit/components/Layouts/Section/Section.css +15 -11
- package/build/esm/lib/kit/components/Layouts/Section/Section.js +14 -4
- 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/RemoveButton/RemoveButton.d.ts +1 -0
- package/build/esm/lib/kit/components/RemoveButton/RemoveButton.js +3 -3
- package/build/esm/lib/kit/components/SimpleVerticalAccordeon/SimpleVerticalAccordeon.css +3 -6
- package/build/esm/lib/kit/components/ViewLayouts/ViewColumn/ViewColumn.css +22 -0
- package/build/esm/lib/kit/components/ViewLayouts/ViewColumn/ViewColumn.d.ts +3 -0
- package/build/esm/lib/kit/components/ViewLayouts/ViewColumn/ViewColumn.js +20 -0
- package/build/esm/lib/kit/components/ViewLayouts/ViewColumn/index.d.ts +1 -0
- package/build/esm/lib/kit/components/ViewLayouts/ViewColumn/index.js +1 -0
- 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/constants/config.js +11 -1
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Accordeon = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
const core_1 = require("../../../../core");
|
|
6
7
|
const components_1 = require("../../../components");
|
|
7
8
|
const hooks_1 = require("../../../hooks");
|
|
8
9
|
const RemoveButton_1 = require("../../RemoveButton");
|
|
@@ -15,7 +16,7 @@ const Accordeon = ({ name, spec, input, meta, children, }) => {
|
|
|
15
16
|
input.onDrop();
|
|
16
17
|
}, [input.onDrop, setOpen]);
|
|
17
18
|
const removeButton = react_1.default.useMemo(() => {
|
|
18
|
-
if (spec.required || !input.value) {
|
|
19
|
+
if (!(0, core_1.isArrayItem)(name) && (spec.required || !input.value)) {
|
|
19
20
|
return null;
|
|
20
21
|
}
|
|
21
22
|
return react_1.default.createElement(RemoveButton_1.RemoveButton, { name: name, onDrop: onDrop });
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.AccordeonCardForm = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
const core_1 = require("../../../../core");
|
|
6
7
|
const hooks_1 = require("../../../hooks");
|
|
7
8
|
const utils_1 = require("../../../utils");
|
|
8
9
|
const AccordeonCard_1 = require("../../AccordeonCard");
|
|
@@ -17,7 +18,7 @@ const AccordeonCardForm = ({ name, spec, input, children, meta, }) => {
|
|
|
17
18
|
input.onDrop();
|
|
18
19
|
}, [input.onDrop, setOpen]);
|
|
19
20
|
const removeButton = react_1.default.useMemo(() => {
|
|
20
|
-
if (spec.required || !input.value) {
|
|
21
|
+
if (!(0, core_1.isArrayItem)(name) && (spec.required || !input.value)) {
|
|
21
22
|
return null;
|
|
22
23
|
}
|
|
23
24
|
return react_1.default.createElement(RemoveButton_1.RemoveButton, { name: name, onDrop: onDrop });
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CardAccordeon = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
const core_1 = require("../../../core");
|
|
6
7
|
const components_1 = require("../../components");
|
|
7
8
|
const hooks_1 = require("../../hooks");
|
|
8
9
|
const RemoveButton_1 = require("../RemoveButton");
|
|
@@ -15,7 +16,7 @@ const CardAccordeon = ({ name, spec, input, meta, children, }) => {
|
|
|
15
16
|
input.onDrop();
|
|
16
17
|
}, [input.onDrop, setOpen]);
|
|
17
18
|
const removeButton = react_1.default.useMemo(() => {
|
|
18
|
-
if (spec.required || !input.value) {
|
|
19
|
+
if (!(0, core_1.isArrayItem)(name) && (spec.required || !input.value)) {
|
|
19
20
|
return null;
|
|
20
21
|
}
|
|
21
22
|
return react_1.default.createElement(RemoveButton_1.RemoveButton, { onDrop: onDrop, name: name });
|
|
@@ -3,11 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CardSection = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
const core_1 = require("../../../core");
|
|
6
7
|
const components_1 = require("../../components");
|
|
7
8
|
const RemoveButton_1 = require("../RemoveButton");
|
|
8
9
|
const CardSection = ({ name, spec, input, meta, children, }) => {
|
|
9
10
|
const removeButton = react_1.default.useMemo(() => {
|
|
10
|
-
if (spec.required || !input.value) {
|
|
11
|
+
if (!(0, core_1.isArrayItem)(name) && (spec.required || !input.value)) {
|
|
11
12
|
return null;
|
|
12
13
|
}
|
|
13
14
|
return react_1.default.createElement(RemoveButton_1.RemoveButton, { onDrop: input.onDrop, name: name });
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
.df-column {
|
|
2
|
+
margin-bottom: 15px;
|
|
3
|
+
}
|
|
4
|
+
.df-column:last-child {
|
|
5
|
+
margin-bottom: 0;
|
|
6
|
+
}
|
|
7
|
+
.df-column__first-row {
|
|
8
|
+
min-height: 28px;
|
|
9
|
+
display: flex;
|
|
10
|
+
margin-bottom: auto;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
flex-shrink: 0;
|
|
13
|
+
}
|
|
14
|
+
.df-column__first-row-inner {
|
|
15
|
+
display: inline;
|
|
16
|
+
margin-top: auto;
|
|
17
|
+
margin-bottom: auto;
|
|
18
|
+
}
|
|
19
|
+
.df-column__first-row::after {
|
|
20
|
+
content: "";
|
|
21
|
+
width: 100%;
|
|
22
|
+
flex-shrink: 1;
|
|
23
|
+
}
|
|
24
|
+
.df-column__title {
|
|
25
|
+
word-break: break-word;
|
|
26
|
+
margin-right: 3px;
|
|
27
|
+
}
|
|
28
|
+
.df-column__title_required::after {
|
|
29
|
+
content: "*";
|
|
30
|
+
color: var(--g-color-text-danger);
|
|
31
|
+
}
|
|
32
|
+
.df-column__note {
|
|
33
|
+
position: relative;
|
|
34
|
+
}
|
|
35
|
+
.df-column__note-inner {
|
|
36
|
+
position: absolute;
|
|
37
|
+
margin-top: 1px;
|
|
38
|
+
}
|
|
39
|
+
.df-column__note-inner .g-help-popover {
|
|
40
|
+
display: flex;
|
|
41
|
+
}
|
|
42
|
+
.df-column__note-inner .g-help-popover > span {
|
|
43
|
+
display: flex;
|
|
44
|
+
}
|
|
45
|
+
.df-column__second-row {
|
|
46
|
+
display: flex;
|
|
47
|
+
flex-direction: column;
|
|
48
|
+
flex-grow: 1;
|
|
49
|
+
}
|
|
50
|
+
.df-column__second-row-inner {
|
|
51
|
+
display: flex;
|
|
52
|
+
justify-content: space-around;
|
|
53
|
+
}
|
|
54
|
+
.df-column__remove-button {
|
|
55
|
+
margin-left: 5px;
|
|
56
|
+
}
|
|
57
|
+
.df-column__required-mark {
|
|
58
|
+
color: var(--g-color-text-danger);
|
|
59
|
+
}
|
|
60
|
+
.df-column__error-wrapper {
|
|
61
|
+
min-width: 100%;
|
|
62
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Column = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
const components_1 = require("@gravity-ui/components");
|
|
7
|
+
const icons_1 = require("@gravity-ui/icons");
|
|
8
|
+
const uikit_1 = require("@gravity-ui/uikit");
|
|
9
|
+
const core_1 = require("../../../../core");
|
|
10
|
+
const components_2 = require("../../../components");
|
|
11
|
+
const utils_1 = require("../../../utils");
|
|
12
|
+
const b = (0, utils_1.block)('column');
|
|
13
|
+
const ColumnBase = ({ name, spec, input, meta, children, }) => {
|
|
14
|
+
const arrayItem = react_1.default.useMemo(() => (0, core_1.isArrayItem)(name), [name]);
|
|
15
|
+
const generateButton = react_1.default.useMemo(() => (0, core_1.withGenerateButton)(spec), [spec]);
|
|
16
|
+
return (react_1.default.createElement("div", { className: b() },
|
|
17
|
+
react_1.default.createElement("div", { className: b('first-row') },
|
|
18
|
+
react_1.default.createElement("div", { className: b('first-row-inner') },
|
|
19
|
+
react_1.default.createElement(uikit_1.Text, { className: b('title', { required: spec.required }) }, spec.viewSpec.layoutTitle),
|
|
20
|
+
spec.viewSpec.layoutDescription ? (react_1.default.createElement("span", { className: b('note') },
|
|
21
|
+
react_1.default.createElement(uikit_1.Text, { className: b('note-inner') },
|
|
22
|
+
react_1.default.createElement(components_1.HelpPopover, { htmlContent: spec.viewSpec.layoutDescription, placement: ['bottom', 'top'] })))) : null)),
|
|
23
|
+
react_1.default.createElement("div", { className: b('second-row') },
|
|
24
|
+
react_1.default.createElement("div", { className: b('second-row-inner') },
|
|
25
|
+
react_1.default.createElement(components_2.ErrorWrapper, { name: name, meta: meta, withoutChildErrorStyles:
|
|
26
|
+
// TODO: remove condition spec.viewSpec.type !== 'select'
|
|
27
|
+
((0, core_1.isArraySpec)(spec) && spec.viewSpec.type !== 'select') ||
|
|
28
|
+
(0, core_1.isObjectSpec)(spec), className: b('error-wrapper') }, children),
|
|
29
|
+
generateButton ? (react_1.default.createElement(components_2.GenerateRandomValueButton, { spec: spec, onChange: input.onChange })) : null,
|
|
30
|
+
arrayItem ? (react_1.default.createElement(uikit_1.Button, { view: "flat-secondary", className: b('remove-button'), onClick: input.onDrop, qa: `${name}-remove-item` },
|
|
31
|
+
react_1.default.createElement(uikit_1.Icon, { data: icons_1.TrashBin, size: 16 }))) : null))));
|
|
32
|
+
};
|
|
33
|
+
const Column = (props) => react_1.default.createElement(ColumnBase, Object.assign({}, props));
|
|
34
|
+
exports.Column = Column;
|
|
@@ -5,24 +5,25 @@
|
|
|
5
5
|
margin-bottom: 0;
|
|
6
6
|
}
|
|
7
7
|
.df-section__header {
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: center;
|
|
8
10
|
margin-bottom: 20px;
|
|
9
11
|
}
|
|
10
|
-
.df-
|
|
11
|
-
|
|
12
|
+
.df-section__header_size_s {
|
|
13
|
+
height: 18px;
|
|
14
|
+
}
|
|
15
|
+
.df-section__header_size_m {
|
|
16
|
+
height: 20px;
|
|
12
17
|
}
|
|
13
18
|
.df-section__title {
|
|
14
19
|
max-width: 533px;
|
|
15
|
-
font-weight: 500;
|
|
16
|
-
margin: 0;
|
|
17
|
-
white-space: nowrap;
|
|
18
|
-
overflow: hidden;
|
|
19
|
-
text-overflow: ellipsis;
|
|
20
20
|
}
|
|
21
|
-
.df-
|
|
22
|
-
|
|
21
|
+
.df-section__title-popover {
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: center;
|
|
23
24
|
}
|
|
24
|
-
.df-
|
|
25
|
-
|
|
25
|
+
.df-section__title-popover .g-popover__handler {
|
|
26
|
+
display: flex;
|
|
26
27
|
}
|
|
27
28
|
.df-section__note {
|
|
28
29
|
margin-left: 5px;
|
|
@@ -35,4 +36,7 @@
|
|
|
35
36
|
}
|
|
36
37
|
.df-section__description {
|
|
37
38
|
margin-top: 4px;
|
|
39
|
+
}
|
|
40
|
+
.df-section__remove-button {
|
|
41
|
+
margin-left: 5px;
|
|
38
42
|
}
|
|
@@ -6,6 +6,7 @@ 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 __1 = require("../../");
|
|
9
|
+
const RemoveButton_1 = require("../../RemoveButton");
|
|
9
10
|
const __2 = require("../../../");
|
|
10
11
|
const core_1 = require("../../../../core");
|
|
11
12
|
const utils_1 = require("../../../utils");
|
|
@@ -13,10 +14,17 @@ const b = (0, utils_1.block)('section');
|
|
|
13
14
|
const SectionBase = (_a) => {
|
|
14
15
|
var _b;
|
|
15
16
|
var { name, spec, titleSize, withIndent, ignoreDescription, descriptionAsSubtitle, children } = _a, restProps = tslib_1.__rest(_a, ["name", "spec", "titleSize", "withIndent", "ignoreDescription", "descriptionAsSubtitle", "children"]);
|
|
17
|
+
const input = restProps.input;
|
|
16
18
|
const meta = restProps.meta;
|
|
17
19
|
const arrOrObjFlag = (0, core_1.isArraySpec)(spec) || (0, core_1.isObjectSpec)(spec);
|
|
18
20
|
const titleRef = react_1.default.useRef(null);
|
|
19
21
|
let content = children;
|
|
22
|
+
const removeButton = react_1.default.useMemo(() => {
|
|
23
|
+
if ((input === null || input === void 0 ? void 0 : input.value) && (input === null || input === void 0 ? void 0 : input.onDrop) && (0, core_1.isArrayItem)(name)) {
|
|
24
|
+
return (react_1.default.createElement(RemoveButton_1.RemoveButton, { name: name, onDrop: input.onDrop, switcherClassName: b('remove-button') }));
|
|
25
|
+
}
|
|
26
|
+
return null;
|
|
27
|
+
}, [input === null || input === void 0 ? void 0 : input.value, input === null || input === void 0 ? void 0 : input.onDrop, name]);
|
|
20
28
|
if (meta) {
|
|
21
29
|
content = (react_1.default.createElement(__2.ErrorWrapper, { name: name, meta: meta, withoutChildErrorStyles: arrOrObjFlag }, content));
|
|
22
30
|
}
|
|
@@ -40,10 +48,12 @@ const SectionBase = (_a) => {
|
|
|
40
48
|
return (react_1.default.createElement("section", { className: b() },
|
|
41
49
|
layoutTitle ? (react_1.default.createElement("div", { className: b('header', {
|
|
42
50
|
'with-popover': !descriptionAsSubtitle,
|
|
51
|
+
size: titleSize,
|
|
43
52
|
}) },
|
|
44
|
-
react_1.default.createElement(uikit_1.Popover, { content: layoutTitle, placement: __2.COMMON_POPOVER_PLACEMENT, disabled: layoutTitlePopoverDisabled },
|
|
45
|
-
react_1.default.createElement(
|
|
46
|
-
description
|
|
53
|
+
react_1.default.createElement(uikit_1.Popover, { className: b('title-popover'), content: layoutTitle, placement: __2.COMMON_POPOVER_PLACEMENT, disabled: layoutTitlePopoverDisabled },
|
|
54
|
+
react_1.default.createElement(uikit_1.Text, { className: b('title'), variant: titleSize === 'm' ? 'body-2' : 'body-1', ref: titleRef, ellipsis: true }, layoutTitle)),
|
|
55
|
+
description,
|
|
56
|
+
removeButton)) : null,
|
|
47
57
|
react_1.default.createElement("div", { className: b('content') }, content)));
|
|
48
58
|
};
|
|
49
59
|
const Section = (props) => react_1.default.createElement(SectionBase, Object.assign({ titleSize: "m" }, props));
|
|
@@ -6,6 +6,7 @@ tslib_1.__exportStar(require("./AccordeonCard"), exports);
|
|
|
6
6
|
tslib_1.__exportStar(require("./CardAccordeon"), exports);
|
|
7
7
|
tslib_1.__exportStar(require("./CardSection"), exports);
|
|
8
8
|
tslib_1.__exportStar(require("./Row"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./Column"), exports);
|
|
9
10
|
tslib_1.__exportStar(require("./Section"), exports);
|
|
10
11
|
tslib_1.__exportStar(require("./TableCell"), exports);
|
|
11
12
|
tslib_1.__exportStar(require("./Transparent"), exports);
|
|
@@ -6,10 +6,10 @@ 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
8
|
const i18n_1 = tslib_1.__importDefault(require("../../i18n"));
|
|
9
|
-
const RemoveButton = ({ name, onDrop }) => {
|
|
9
|
+
const RemoveButton = ({ name, onDrop, switcherClassName }) => {
|
|
10
10
|
const items = react_1.default.useMemo(() => [{ text: (0, i18n_1.default)('label_delete'), action: onDrop, theme: 'danger' }], [onDrop]);
|
|
11
|
-
const switcher = react_1.default.useMemo(() => (react_1.default.createElement(uikit_1.Button, { view: "flat", qa: `${name}-drop-item` },
|
|
12
|
-
react_1.default.createElement(uikit_1.Icon, { data: icons_1.Ellipsis, size: 16 }))), []);
|
|
11
|
+
const switcher = react_1.default.useMemo(() => (react_1.default.createElement(uikit_1.Button, { className: switcherClassName, view: "flat", qa: `${name}-drop-item` },
|
|
12
|
+
react_1.default.createElement(uikit_1.Icon, { data: icons_1.Ellipsis, size: 16 }))), [switcherClassName]);
|
|
13
13
|
return react_1.default.createElement(uikit_1.DropdownMenu, { switcher: switcher, items: items });
|
|
14
14
|
};
|
|
15
15
|
exports.RemoveButton = RemoveButton;
|
|
@@ -17,14 +17,11 @@
|
|
|
17
17
|
margin-left: -13px;
|
|
18
18
|
max-width: 533px;
|
|
19
19
|
}
|
|
20
|
-
.df-simple-vertical-
|
|
21
|
-
margin: 0px 5px;
|
|
22
|
-
}
|
|
23
|
-
.df-simple-vertical-accordeon__tooltip .g-help-popover {
|
|
20
|
+
.df-simple-vertical-accordeon__header .g-popover__handler {
|
|
24
21
|
display: flex;
|
|
25
22
|
}
|
|
26
|
-
.df-simple-vertical-accordeon__tooltip
|
|
27
|
-
|
|
23
|
+
.df-simple-vertical-accordeon__tooltip {
|
|
24
|
+
margin: 0px 5px;
|
|
28
25
|
}
|
|
29
26
|
.df-simple-vertical-accordeon__chevron {
|
|
30
27
|
transform: rotate(-90deg);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
.df-view-column {
|
|
2
|
+
margin-bottom: 20px;
|
|
3
|
+
}
|
|
4
|
+
.df-view-column:last-child {
|
|
5
|
+
margin-bottom: 0;
|
|
6
|
+
}
|
|
7
|
+
.df-view-column__first-row {
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: baseline;
|
|
10
|
+
}
|
|
11
|
+
.df-view-column__note {
|
|
12
|
+
margin-inline-start: var(--g-spacing-half);
|
|
13
|
+
}
|
|
14
|
+
.df-view-column__second-row > .df-view-transparent {
|
|
15
|
+
margin-bottom: 6px;
|
|
16
|
+
}
|
|
17
|
+
.df-view-column__second-row > .df-view-transparent:last-child {
|
|
18
|
+
margin-bottom: 0;
|
|
19
|
+
}
|
|
20
|
+
.df-view-column:hover > .df-copy-button {
|
|
21
|
+
display: block;
|
|
22
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ViewColumn = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
const uikit_1 = require("@gravity-ui/uikit");
|
|
7
|
+
const components_1 = require("@gravity-ui/components");
|
|
8
|
+
const core_1 = require("../../../../core");
|
|
9
|
+
const kit_1 = require("../../../../kit");
|
|
10
|
+
const utils_1 = require("../../../utils");
|
|
11
|
+
const b = (0, utils_1.block)('view-column');
|
|
12
|
+
const ViewColumn = ({ value, spec, children, }) => {
|
|
13
|
+
const { showLayoutDescription } = (0, core_1.useDynamicFormsCtx)();
|
|
14
|
+
if (!(0, utils_1.isNotEmptyValue)(value, spec)) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
return (react_1.default.createElement("div", { className: b() },
|
|
18
|
+
react_1.default.createElement("div", { className: b('first-row') },
|
|
19
|
+
react_1.default.createElement(uikit_1.Text, { color: "secondary", ellipsis: true }, spec.viewSpec.layoutTitle),
|
|
20
|
+
showLayoutDescription && spec.viewSpec.layoutDescription ? (react_1.default.createElement(components_1.HelpPopover, { className: b('note'), htmlContent: spec.viewSpec.layoutDescription, placement: ['bottom', 'top'] })) : null),
|
|
21
|
+
react_1.default.createElement("div", { className: b('second-row') }, children),
|
|
22
|
+
react_1.default.createElement(kit_1.CopyButton, { spec: spec, value: value })));
|
|
23
|
+
};
|
|
24
|
+
exports.ViewColumn = ViewColumn;
|
|
@@ -6,6 +6,7 @@ tslib_1.__exportStar(require("./ViewCardAccordeon"), exports);
|
|
|
6
6
|
tslib_1.__exportStar(require("./ViewAccordeonCard"), exports);
|
|
7
7
|
tslib_1.__exportStar(require("./ViewCardSection"), exports);
|
|
8
8
|
tslib_1.__exportStar(require("./ViewRow"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./ViewColumn"), exports);
|
|
9
10
|
tslib_1.__exportStar(require("./ViewSection"), exports);
|
|
10
11
|
tslib_1.__exportStar(require("./ViewTableCell"), exports);
|
|
11
12
|
tslib_1.__exportStar(require("./ViewTransparent"), exports);
|
|
@@ -14,6 +14,7 @@ exports.dynamicConfig = {
|
|
|
14
14
|
layouts: {
|
|
15
15
|
row: components_1.Row,
|
|
16
16
|
row_verbose: components_1.RowVerbose,
|
|
17
|
+
column: components_1.Column,
|
|
17
18
|
accordeon: components_1.Accordeon,
|
|
18
19
|
section: components_1.Section,
|
|
19
20
|
section2: components_1.Section2,
|
|
@@ -37,6 +38,7 @@ exports.dynamicConfig = {
|
|
|
37
38
|
layouts: {
|
|
38
39
|
row: components_1.Row,
|
|
39
40
|
row_verbose: components_1.RowVerbose,
|
|
41
|
+
column: components_1.Column,
|
|
40
42
|
table_item: components_1.TableCell,
|
|
41
43
|
transparent: components_1.Transparent,
|
|
42
44
|
},
|
|
@@ -51,6 +53,7 @@ exports.dynamicConfig = {
|
|
|
51
53
|
layouts: {
|
|
52
54
|
row: components_1.Row,
|
|
53
55
|
row_verbose: components_1.RowVerbose,
|
|
56
|
+
column: components_1.Column,
|
|
54
57
|
table_item: components_1.TableCell,
|
|
55
58
|
transparent: components_1.Transparent,
|
|
56
59
|
},
|
|
@@ -75,6 +78,7 @@ exports.dynamicConfig = {
|
|
|
75
78
|
layouts: {
|
|
76
79
|
row: components_1.Row,
|
|
77
80
|
row_verbose: components_1.RowVerbose,
|
|
81
|
+
column: components_1.Column,
|
|
78
82
|
accordeon: components_1.Accordeon,
|
|
79
83
|
section: components_1.Section,
|
|
80
84
|
section2: components_1.Section2,
|
|
@@ -104,6 +108,7 @@ exports.dynamicConfig = {
|
|
|
104
108
|
layouts: {
|
|
105
109
|
row: components_1.Row,
|
|
106
110
|
row_verbose: components_1.RowVerbose,
|
|
111
|
+
column: components_1.Column,
|
|
107
112
|
table_item: components_1.TableCell,
|
|
108
113
|
transparent: components_1.Transparent,
|
|
109
114
|
section: components_1.Section,
|
|
@@ -129,6 +134,7 @@ exports.dynamicViewConfig = {
|
|
|
129
134
|
layouts: {
|
|
130
135
|
row: components_1.ViewRow,
|
|
131
136
|
row_verbose: components_1.ViewRow,
|
|
137
|
+
column: components_1.ViewColumn,
|
|
132
138
|
accordeon: components_1.ViewAccordeon,
|
|
133
139
|
section: components_1.ViewSection,
|
|
134
140
|
section2: components_1.ViewSection2,
|
|
@@ -149,6 +155,7 @@ exports.dynamicViewConfig = {
|
|
|
149
155
|
layouts: {
|
|
150
156
|
row: components_1.ViewRow,
|
|
151
157
|
row_verbose: components_1.ViewRow,
|
|
158
|
+
column: components_1.ViewColumn,
|
|
152
159
|
table_item: components_1.ViewTableCell,
|
|
153
160
|
transparent: components_1.ViewTransparent,
|
|
154
161
|
},
|
|
@@ -160,6 +167,7 @@ exports.dynamicViewConfig = {
|
|
|
160
167
|
layouts: {
|
|
161
168
|
row: components_1.ViewRow,
|
|
162
169
|
row_verbose: components_1.ViewRow,
|
|
170
|
+
column: components_1.ViewColumn,
|
|
163
171
|
table_item: components_1.ViewTableCell,
|
|
164
172
|
transparent: components_1.ViewTransparent,
|
|
165
173
|
},
|
|
@@ -181,6 +189,7 @@ exports.dynamicViewConfig = {
|
|
|
181
189
|
layouts: {
|
|
182
190
|
row: components_1.ViewRow,
|
|
183
191
|
row_verbose: components_1.ViewRow,
|
|
192
|
+
column: components_1.ViewColumn,
|
|
184
193
|
accordeon: components_1.ViewAccordeon,
|
|
185
194
|
section: components_1.ViewSection,
|
|
186
195
|
section2: components_1.ViewSection2,
|
|
@@ -207,6 +216,7 @@ exports.dynamicViewConfig = {
|
|
|
207
216
|
layouts: {
|
|
208
217
|
row: components_1.ViewRow,
|
|
209
218
|
row_verbose: components_1.ViewRow,
|
|
219
|
+
column: components_1.ViewColumn,
|
|
210
220
|
table_item: components_1.ViewTableCell,
|
|
211
221
|
transparent: components_1.ViewTransparent,
|
|
212
222
|
section: components_1.ViewSection,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { isArrayItem } from '../../../../core';
|
|
2
3
|
import { ErrorWrapper } from '../../../components';
|
|
3
4
|
import { useErrorChecker } from '../../../hooks';
|
|
4
5
|
import { RemoveButton } from '../../RemoveButton';
|
|
@@ -11,7 +12,7 @@ export const Accordeon = ({ name, spec, input, meta, children, }) => {
|
|
|
11
12
|
input.onDrop();
|
|
12
13
|
}, [input.onDrop, setOpen]);
|
|
13
14
|
const removeButton = React.useMemo(() => {
|
|
14
|
-
if (spec.required || !input.value) {
|
|
15
|
+
if (!isArrayItem(name) && (spec.required || !input.value)) {
|
|
15
16
|
return null;
|
|
16
17
|
}
|
|
17
18
|
return React.createElement(RemoveButton, { name: name, onDrop: onDrop });
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { isArrayItem } from '../../../../core';
|
|
2
3
|
import { useErrorChecker } from '../../../hooks';
|
|
3
4
|
import { block } from '../../../utils';
|
|
4
5
|
import { AccordeonCard } from '../../AccordeonCard';
|
|
@@ -14,7 +15,7 @@ export const AccordeonCardForm = ({ name, spec, input, children, meta, }) => {
|
|
|
14
15
|
input.onDrop();
|
|
15
16
|
}, [input.onDrop, setOpen]);
|
|
16
17
|
const removeButton = React.useMemo(() => {
|
|
17
|
-
if (spec.required || !input.value) {
|
|
18
|
+
if (!isArrayItem(name) && (spec.required || !input.value)) {
|
|
18
19
|
return null;
|
|
19
20
|
}
|
|
20
21
|
return React.createElement(RemoveButton, { name: name, onDrop: onDrop });
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { isArrayItem } from '../../../core';
|
|
2
3
|
import { Card, ErrorWrapper } from '../../components';
|
|
3
4
|
import { useErrorChecker } from '../../hooks';
|
|
4
5
|
import { RemoveButton } from '../RemoveButton';
|
|
@@ -11,7 +12,7 @@ export const CardAccordeon = ({ name, spec, input, meta, children, }) => {
|
|
|
11
12
|
input.onDrop();
|
|
12
13
|
}, [input.onDrop, setOpen]);
|
|
13
14
|
const removeButton = React.useMemo(() => {
|
|
14
|
-
if (spec.required || !input.value) {
|
|
15
|
+
if (!isArrayItem(name) && (spec.required || !input.value)) {
|
|
15
16
|
return null;
|
|
16
17
|
}
|
|
17
18
|
return React.createElement(RemoveButton, { onDrop: onDrop, name: name });
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { isArrayItem } from '../../../core';
|
|
2
3
|
import { Card, ErrorWrapper } from '../../components';
|
|
3
4
|
import { RemoveButton } from '../RemoveButton';
|
|
4
5
|
export const CardSection = ({ name, spec, input, meta, children, }) => {
|
|
5
6
|
const removeButton = React.useMemo(() => {
|
|
6
|
-
if (spec.required || !input.value) {
|
|
7
|
+
if (!isArrayItem(name) && (spec.required || !input.value)) {
|
|
7
8
|
return null;
|
|
8
9
|
}
|
|
9
10
|
return React.createElement(RemoveButton, { onDrop: input.onDrop, name: name });
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
.df-column {
|
|
2
|
+
margin-bottom: 15px;
|
|
3
|
+
}
|
|
4
|
+
.df-column:last-child {
|
|
5
|
+
margin-bottom: 0;
|
|
6
|
+
}
|
|
7
|
+
.df-column__first-row {
|
|
8
|
+
min-height: 28px;
|
|
9
|
+
display: flex;
|
|
10
|
+
margin-bottom: auto;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
flex-shrink: 0;
|
|
13
|
+
}
|
|
14
|
+
.df-column__first-row-inner {
|
|
15
|
+
display: inline;
|
|
16
|
+
margin-top: auto;
|
|
17
|
+
margin-bottom: auto;
|
|
18
|
+
}
|
|
19
|
+
.df-column__first-row::after {
|
|
20
|
+
content: "";
|
|
21
|
+
width: 100%;
|
|
22
|
+
flex-shrink: 1;
|
|
23
|
+
}
|
|
24
|
+
.df-column__title {
|
|
25
|
+
word-break: break-word;
|
|
26
|
+
margin-right: 3px;
|
|
27
|
+
}
|
|
28
|
+
.df-column__title_required::after {
|
|
29
|
+
content: "*";
|
|
30
|
+
color: var(--g-color-text-danger);
|
|
31
|
+
}
|
|
32
|
+
.df-column__note {
|
|
33
|
+
position: relative;
|
|
34
|
+
}
|
|
35
|
+
.df-column__note-inner {
|
|
36
|
+
position: absolute;
|
|
37
|
+
margin-top: 1px;
|
|
38
|
+
}
|
|
39
|
+
.df-column__note-inner .g-help-popover {
|
|
40
|
+
display: flex;
|
|
41
|
+
}
|
|
42
|
+
.df-column__note-inner .g-help-popover > span {
|
|
43
|
+
display: flex;
|
|
44
|
+
}
|
|
45
|
+
.df-column__second-row {
|
|
46
|
+
display: flex;
|
|
47
|
+
flex-direction: column;
|
|
48
|
+
flex-grow: 1;
|
|
49
|
+
}
|
|
50
|
+
.df-column__second-row-inner {
|
|
51
|
+
display: flex;
|
|
52
|
+
justify-content: space-around;
|
|
53
|
+
}
|
|
54
|
+
.df-column__remove-button {
|
|
55
|
+
margin-left: 5px;
|
|
56
|
+
}
|
|
57
|
+
.df-column__required-mark {
|
|
58
|
+
color: var(--g-color-text-danger);
|
|
59
|
+
}
|
|
60
|
+
.df-column__error-wrapper {
|
|
61
|
+
min-width: 100%;
|
|
62
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { HelpPopover } from '@gravity-ui/components';
|
|
3
|
+
import { TrashBin } from '@gravity-ui/icons';
|
|
4
|
+
import { Button, Icon, Text } from '@gravity-ui/uikit';
|
|
5
|
+
import { isArrayItem, isArraySpec, isObjectSpec, withGenerateButton, } from '../../../../core';
|
|
6
|
+
import { ErrorWrapper, GenerateRandomValueButton } from '../../../components';
|
|
7
|
+
import { block } from '../../../utils';
|
|
8
|
+
import './Column.css';
|
|
9
|
+
const b = block('column');
|
|
10
|
+
const ColumnBase = ({ name, spec, input, meta, children, }) => {
|
|
11
|
+
const arrayItem = React.useMemo(() => isArrayItem(name), [name]);
|
|
12
|
+
const generateButton = React.useMemo(() => withGenerateButton(spec), [spec]);
|
|
13
|
+
return (React.createElement("div", { className: b() },
|
|
14
|
+
React.createElement("div", { className: b('first-row') },
|
|
15
|
+
React.createElement("div", { className: b('first-row-inner') },
|
|
16
|
+
React.createElement(Text, { className: b('title', { required: spec.required }) }, spec.viewSpec.layoutTitle),
|
|
17
|
+
spec.viewSpec.layoutDescription ? (React.createElement("span", { className: b('note') },
|
|
18
|
+
React.createElement(Text, { className: b('note-inner') },
|
|
19
|
+
React.createElement(HelpPopover, { htmlContent: spec.viewSpec.layoutDescription, placement: ['bottom', 'top'] })))) : null)),
|
|
20
|
+
React.createElement("div", { className: b('second-row') },
|
|
21
|
+
React.createElement("div", { className: b('second-row-inner') },
|
|
22
|
+
React.createElement(ErrorWrapper, { name: name, meta: meta, withoutChildErrorStyles:
|
|
23
|
+
// TODO: remove condition spec.viewSpec.type !== 'select'
|
|
24
|
+
(isArraySpec(spec) && spec.viewSpec.type !== 'select') ||
|
|
25
|
+
isObjectSpec(spec), className: b('error-wrapper') }, children),
|
|
26
|
+
generateButton ? (React.createElement(GenerateRandomValueButton, { spec: spec, onChange: input.onChange })) : null,
|
|
27
|
+
arrayItem ? (React.createElement(Button, { view: "flat-secondary", className: b('remove-button'), onClick: input.onDrop, qa: `${name}-remove-item` },
|
|
28
|
+
React.createElement(Icon, { data: TrashBin, size: 16 }))) : null))));
|
|
29
|
+
};
|
|
30
|
+
export const Column = (props) => React.createElement(ColumnBase, Object.assign({}, props));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Column';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Column';
|
|
@@ -5,24 +5,25 @@
|
|
|
5
5
|
margin-bottom: 0;
|
|
6
6
|
}
|
|
7
7
|
.df-section__header {
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: center;
|
|
8
10
|
margin-bottom: 20px;
|
|
9
11
|
}
|
|
10
|
-
.df-
|
|
11
|
-
|
|
12
|
+
.df-section__header_size_s {
|
|
13
|
+
height: 18px;
|
|
14
|
+
}
|
|
15
|
+
.df-section__header_size_m {
|
|
16
|
+
height: 20px;
|
|
12
17
|
}
|
|
13
18
|
.df-section__title {
|
|
14
19
|
max-width: 533px;
|
|
15
|
-
font-weight: 500;
|
|
16
|
-
margin: 0;
|
|
17
|
-
white-space: nowrap;
|
|
18
|
-
overflow: hidden;
|
|
19
|
-
text-overflow: ellipsis;
|
|
20
20
|
}
|
|
21
|
-
.df-
|
|
22
|
-
|
|
21
|
+
.df-section__title-popover {
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: center;
|
|
23
24
|
}
|
|
24
|
-
.df-
|
|
25
|
-
|
|
25
|
+
.df-section__title-popover .g-popover__handler {
|
|
26
|
+
display: flex;
|
|
26
27
|
}
|
|
27
28
|
.df-section__note {
|
|
28
29
|
margin-left: 5px;
|
|
@@ -35,4 +36,7 @@
|
|
|
35
36
|
}
|
|
36
37
|
.df-section__description {
|
|
37
38
|
margin-top: 4px;
|
|
39
|
+
}
|
|
40
|
+
.df-section__remove-button {
|
|
41
|
+
margin-left: 5px;
|
|
38
42
|
}
|
|
@@ -3,18 +3,26 @@ import React from 'react';
|
|
|
3
3
|
import { HelpPopover } from '@gravity-ui/components';
|
|
4
4
|
import { Popover, Text } from '@gravity-ui/uikit';
|
|
5
5
|
import { GroupIndent } from '../../';
|
|
6
|
+
import { RemoveButton } from '../../RemoveButton';
|
|
6
7
|
import { COMMON_POPOVER_PLACEMENT, COMMON_TITLE_MAX_WIDTH, ErrorWrapper } from '../../../';
|
|
7
|
-
import { isArraySpec, isObjectSpec, } from '../../../../core';
|
|
8
|
+
import { isArrayItem, isArraySpec, isObjectSpec, } from '../../../../core';
|
|
8
9
|
import { block } from '../../../utils';
|
|
9
10
|
import './Section.css';
|
|
10
11
|
const b = block('section');
|
|
11
12
|
const SectionBase = (_a) => {
|
|
12
13
|
var _b;
|
|
13
14
|
var { name, spec, titleSize, withIndent, ignoreDescription, descriptionAsSubtitle, children } = _a, restProps = __rest(_a, ["name", "spec", "titleSize", "withIndent", "ignoreDescription", "descriptionAsSubtitle", "children"]);
|
|
15
|
+
const input = restProps.input;
|
|
14
16
|
const meta = restProps.meta;
|
|
15
17
|
const arrOrObjFlag = isArraySpec(spec) || isObjectSpec(spec);
|
|
16
18
|
const titleRef = React.useRef(null);
|
|
17
19
|
let content = children;
|
|
20
|
+
const removeButton = React.useMemo(() => {
|
|
21
|
+
if ((input === null || input === void 0 ? void 0 : input.value) && (input === null || input === void 0 ? void 0 : input.onDrop) && isArrayItem(name)) {
|
|
22
|
+
return (React.createElement(RemoveButton, { name: name, onDrop: input.onDrop, switcherClassName: b('remove-button') }));
|
|
23
|
+
}
|
|
24
|
+
return null;
|
|
25
|
+
}, [input === null || input === void 0 ? void 0 : input.value, input === null || input === void 0 ? void 0 : input.onDrop, name]);
|
|
18
26
|
if (meta) {
|
|
19
27
|
content = (React.createElement(ErrorWrapper, { name: name, meta: meta, withoutChildErrorStyles: arrOrObjFlag }, content));
|
|
20
28
|
}
|
|
@@ -38,10 +46,12 @@ const SectionBase = (_a) => {
|
|
|
38
46
|
return (React.createElement("section", { className: b() },
|
|
39
47
|
layoutTitle ? (React.createElement("div", { className: b('header', {
|
|
40
48
|
'with-popover': !descriptionAsSubtitle,
|
|
49
|
+
size: titleSize,
|
|
41
50
|
}) },
|
|
42
|
-
React.createElement(Popover, { content: layoutTitle, placement: COMMON_POPOVER_PLACEMENT, disabled: layoutTitlePopoverDisabled },
|
|
43
|
-
React.createElement(
|
|
44
|
-
description
|
|
51
|
+
React.createElement(Popover, { className: b('title-popover'), content: layoutTitle, placement: COMMON_POPOVER_PLACEMENT, disabled: layoutTitlePopoverDisabled },
|
|
52
|
+
React.createElement(Text, { className: b('title'), variant: titleSize === 'm' ? 'body-2' : 'body-1', ref: titleRef, ellipsis: true }, layoutTitle)),
|
|
53
|
+
description,
|
|
54
|
+
removeButton)) : null,
|
|
45
55
|
React.createElement("div", { className: b('content') }, content)));
|
|
46
56
|
};
|
|
47
57
|
export const Section = (props) => React.createElement(SectionBase, Object.assign({ titleSize: "m" }, props));
|
|
@@ -2,9 +2,9 @@ import React from 'react';
|
|
|
2
2
|
import { Ellipsis } from '@gravity-ui/icons';
|
|
3
3
|
import { Button, DropdownMenu, Icon } from '@gravity-ui/uikit';
|
|
4
4
|
import i18n from '../../i18n';
|
|
5
|
-
export const RemoveButton = ({ name, onDrop }) => {
|
|
5
|
+
export const RemoveButton = ({ name, onDrop, switcherClassName }) => {
|
|
6
6
|
const items = React.useMemo(() => [{ text: i18n('label_delete'), action: onDrop, theme: 'danger' }], [onDrop]);
|
|
7
|
-
const switcher = React.useMemo(() => (React.createElement(Button, { view: "flat", qa: `${name}-drop-item` },
|
|
8
|
-
React.createElement(Icon, { data: Ellipsis, size: 16 }))), []);
|
|
7
|
+
const switcher = React.useMemo(() => (React.createElement(Button, { className: switcherClassName, view: "flat", qa: `${name}-drop-item` },
|
|
8
|
+
React.createElement(Icon, { data: Ellipsis, size: 16 }))), [switcherClassName]);
|
|
9
9
|
return React.createElement(DropdownMenu, { switcher: switcher, items: items });
|
|
10
10
|
};
|
|
@@ -17,14 +17,11 @@
|
|
|
17
17
|
margin-left: -13px;
|
|
18
18
|
max-width: 533px;
|
|
19
19
|
}
|
|
20
|
-
.df-simple-vertical-
|
|
21
|
-
margin: 0px 5px;
|
|
22
|
-
}
|
|
23
|
-
.df-simple-vertical-accordeon__tooltip .g-help-popover {
|
|
20
|
+
.df-simple-vertical-accordeon__header .g-popover__handler {
|
|
24
21
|
display: flex;
|
|
25
22
|
}
|
|
26
|
-
.df-simple-vertical-accordeon__tooltip
|
|
27
|
-
|
|
23
|
+
.df-simple-vertical-accordeon__tooltip {
|
|
24
|
+
margin: 0px 5px;
|
|
28
25
|
}
|
|
29
26
|
.df-simple-vertical-accordeon__chevron {
|
|
30
27
|
transform: rotate(-90deg);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
.df-view-column {
|
|
2
|
+
margin-bottom: 20px;
|
|
3
|
+
}
|
|
4
|
+
.df-view-column:last-child {
|
|
5
|
+
margin-bottom: 0;
|
|
6
|
+
}
|
|
7
|
+
.df-view-column__first-row {
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: baseline;
|
|
10
|
+
}
|
|
11
|
+
.df-view-column__note {
|
|
12
|
+
margin-inline-start: var(--g-spacing-half);
|
|
13
|
+
}
|
|
14
|
+
.df-view-column__second-row > .df-view-transparent {
|
|
15
|
+
margin-bottom: 6px;
|
|
16
|
+
}
|
|
17
|
+
.df-view-column__second-row > .df-view-transparent:last-child {
|
|
18
|
+
margin-bottom: 0;
|
|
19
|
+
}
|
|
20
|
+
.df-view-column:hover > .df-copy-button {
|
|
21
|
+
display: block;
|
|
22
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Text } from '@gravity-ui/uikit';
|
|
3
|
+
import { HelpPopover } from '@gravity-ui/components';
|
|
4
|
+
import { useDynamicFormsCtx } from '../../../../core';
|
|
5
|
+
import { CopyButton } from '../../../../kit';
|
|
6
|
+
import { block, isNotEmptyValue } from '../../../utils';
|
|
7
|
+
import './ViewColumn.css';
|
|
8
|
+
const b = block('view-column');
|
|
9
|
+
export const ViewColumn = ({ value, spec, children, }) => {
|
|
10
|
+
const { showLayoutDescription } = useDynamicFormsCtx();
|
|
11
|
+
if (!isNotEmptyValue(value, spec)) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
return (React.createElement("div", { className: b() },
|
|
15
|
+
React.createElement("div", { className: b('first-row') },
|
|
16
|
+
React.createElement(Text, { color: "secondary", ellipsis: true }, spec.viewSpec.layoutTitle),
|
|
17
|
+
showLayoutDescription && spec.viewSpec.layoutDescription ? (React.createElement(HelpPopover, { className: b('note'), htmlContent: spec.viewSpec.layoutDescription, placement: ['bottom', 'top'] })) : null),
|
|
18
|
+
React.createElement("div", { className: b('second-row') }, children),
|
|
19
|
+
React.createElement(CopyButton, { spec: spec, value: value })));
|
|
20
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ViewColumn';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ViewColumn';
|
|
@@ -3,6 +3,7 @@ export * from './ViewCardAccordeon';
|
|
|
3
3
|
export * from './ViewAccordeonCard';
|
|
4
4
|
export * from './ViewCardSection';
|
|
5
5
|
export * from './ViewRow';
|
|
6
|
+
export * from './ViewColumn';
|
|
6
7
|
export * from './ViewSection';
|
|
7
8
|
export * from './ViewTableCell';
|
|
8
9
|
export * from './ViewTransparent';
|
|
@@ -3,6 +3,7 @@ export * from './ViewCardAccordeon';
|
|
|
3
3
|
export * from './ViewAccordeonCard';
|
|
4
4
|
export * from './ViewCardSection';
|
|
5
5
|
export * from './ViewRow';
|
|
6
|
+
export * from './ViewColumn';
|
|
6
7
|
export * from './ViewSection';
|
|
7
8
|
export * from './ViewTableCell';
|
|
8
9
|
export * from './ViewTransparent';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Accordeon, AccordeonCardForm, ArrayBase, ArrayBaseView, BaseView, CardAccordeon, CardOneOf, CardOneOfView, CardSection, Checkbox, CheckboxGroup, CheckboxGroupView, DateInput, DateView, 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, TextContentView, TextLink, TextLinkView, TimeRangeSelector, TimeRangeSelectorView, Transparent, ViewAccordeon, ViewAccordeonCard, ViewCardAccordeon, ViewCardSection, ViewGroup, ViewGroup2, ViewRow, ViewSection, ViewSection2, ViewTableCell, ViewTransparent, } from '../components';
|
|
1
|
+
import { Accordeon, AccordeonCardForm, ArrayBase, ArrayBaseView, BaseView, CardAccordeon, CardOneOf, CardOneOfView, CardSection, Checkbox, CheckboxGroup, CheckboxGroupView, Column, DateInput, DateView, 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, TextContentView, TextLink, TextLinkView, TimeRangeSelector, TimeRangeSelectorView, Transparent, ViewAccordeon, ViewAccordeonCard, ViewCardAccordeon, ViewCardSection, ViewColumn, 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: {
|
|
@@ -11,6 +11,7 @@ export const dynamicConfig = {
|
|
|
11
11
|
layouts: {
|
|
12
12
|
row: Row,
|
|
13
13
|
row_verbose: RowVerbose,
|
|
14
|
+
column: Column,
|
|
14
15
|
accordeon: Accordeon,
|
|
15
16
|
section: Section,
|
|
16
17
|
section2: Section2,
|
|
@@ -34,6 +35,7 @@ export const dynamicConfig = {
|
|
|
34
35
|
layouts: {
|
|
35
36
|
row: Row,
|
|
36
37
|
row_verbose: RowVerbose,
|
|
38
|
+
column: Column,
|
|
37
39
|
table_item: TableCell,
|
|
38
40
|
transparent: Transparent,
|
|
39
41
|
},
|
|
@@ -48,6 +50,7 @@ export const dynamicConfig = {
|
|
|
48
50
|
layouts: {
|
|
49
51
|
row: Row,
|
|
50
52
|
row_verbose: RowVerbose,
|
|
53
|
+
column: Column,
|
|
51
54
|
table_item: TableCell,
|
|
52
55
|
transparent: Transparent,
|
|
53
56
|
},
|
|
@@ -72,6 +75,7 @@ export const dynamicConfig = {
|
|
|
72
75
|
layouts: {
|
|
73
76
|
row: Row,
|
|
74
77
|
row_verbose: RowVerbose,
|
|
78
|
+
column: Column,
|
|
75
79
|
accordeon: Accordeon,
|
|
76
80
|
section: Section,
|
|
77
81
|
section2: Section2,
|
|
@@ -101,6 +105,7 @@ export const dynamicConfig = {
|
|
|
101
105
|
layouts: {
|
|
102
106
|
row: Row,
|
|
103
107
|
row_verbose: RowVerbose,
|
|
108
|
+
column: Column,
|
|
104
109
|
table_item: TableCell,
|
|
105
110
|
transparent: Transparent,
|
|
106
111
|
section: Section,
|
|
@@ -126,6 +131,7 @@ export const dynamicViewConfig = {
|
|
|
126
131
|
layouts: {
|
|
127
132
|
row: ViewRow,
|
|
128
133
|
row_verbose: ViewRow,
|
|
134
|
+
column: ViewColumn,
|
|
129
135
|
accordeon: ViewAccordeon,
|
|
130
136
|
section: ViewSection,
|
|
131
137
|
section2: ViewSection2,
|
|
@@ -146,6 +152,7 @@ export const dynamicViewConfig = {
|
|
|
146
152
|
layouts: {
|
|
147
153
|
row: ViewRow,
|
|
148
154
|
row_verbose: ViewRow,
|
|
155
|
+
column: ViewColumn,
|
|
149
156
|
table_item: ViewTableCell,
|
|
150
157
|
transparent: ViewTransparent,
|
|
151
158
|
},
|
|
@@ -157,6 +164,7 @@ export const dynamicViewConfig = {
|
|
|
157
164
|
layouts: {
|
|
158
165
|
row: ViewRow,
|
|
159
166
|
row_verbose: ViewRow,
|
|
167
|
+
column: ViewColumn,
|
|
160
168
|
table_item: ViewTableCell,
|
|
161
169
|
transparent: ViewTransparent,
|
|
162
170
|
},
|
|
@@ -178,6 +186,7 @@ export const dynamicViewConfig = {
|
|
|
178
186
|
layouts: {
|
|
179
187
|
row: ViewRow,
|
|
180
188
|
row_verbose: ViewRow,
|
|
189
|
+
column: ViewColumn,
|
|
181
190
|
accordeon: ViewAccordeon,
|
|
182
191
|
section: ViewSection,
|
|
183
192
|
section2: ViewSection2,
|
|
@@ -204,6 +213,7 @@ export const dynamicViewConfig = {
|
|
|
204
213
|
layouts: {
|
|
205
214
|
row: ViewRow,
|
|
206
215
|
row_verbose: ViewRow,
|
|
216
|
+
column: ViewColumn,
|
|
207
217
|
table_item: ViewTableCell,
|
|
208
218
|
transparent: ViewTransparent,
|
|
209
219
|
section: ViewSection,
|