@gravity-ui/dynamic-forms 5.32.0 → 5.33.1
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/unstable/kit/components/ArrayRemoveButton/ArrayRemoveButton.d.ts +2 -0
- package/build/cjs/lib/unstable/kit/components/ArrayRemoveButton/ArrayRemoveButton.js +6 -7
- package/build/cjs/lib/unstable/kit/components/CopyButton/CopyButton.css +1 -0
- package/build/cjs/lib/unstable/kit/components/CopyButton/CopyButton.d.ts +3 -1
- package/build/cjs/lib/unstable/kit/components/CopyButton/CopyButton.js +6 -2
- package/build/cjs/lib/unstable/kit/components/DropButton/DropButton.css +3 -0
- package/build/cjs/lib/unstable/kit/components/DropButton/DropButton.d.ts +10 -0
- package/build/cjs/lib/unstable/kit/components/DropButton/DropButton.js +32 -0
- package/build/cjs/lib/unstable/kit/components/DropButton/index.d.ts +1 -0
- package/build/cjs/lib/unstable/kit/components/DropButton/index.js +5 -0
- package/build/cjs/lib/unstable/kit/components/EntityContainer/EntityContainer.css +1 -0
- package/build/cjs/lib/unstable/kit/components/EntityContainer/EntityContainer.d.ts +1 -0
- package/build/cjs/lib/unstable/kit/components/EntityContainer/EntityContainer.js +2 -2
- package/build/cjs/lib/unstable/kit/components/LayoutButtons/LayoutButtons.d.ts +10 -0
- package/build/cjs/lib/unstable/kit/components/LayoutButtons/LayoutButtons.js +15 -0
- package/build/cjs/lib/unstable/kit/components/LayoutButtons/index.d.ts +1 -0
- package/build/cjs/lib/unstable/kit/components/LayoutButtons/index.js +5 -0
- package/build/cjs/lib/unstable/kit/components/LayoutContainer/LayoutContainer.css +30 -1
- package/build/cjs/lib/unstable/kit/components/index.d.ts +2 -0
- package/build/cjs/lib/unstable/kit/components/index.js +5 -1
- package/build/cjs/lib/unstable/kit/entities/ArrayEntity/ArrayEntity.css +1 -1
- package/build/cjs/lib/unstable/kit/entities/ArrayEntity/ArrayEntity.js +33 -4
- package/build/cjs/lib/unstable/kit/entities/ArrayTable/ArrayTable.css +13 -3
- package/build/cjs/lib/unstable/kit/entities/ArrayTable/ArrayTable.js +47 -15
- package/build/cjs/lib/unstable/kit/entities/ObjectEntity/ObjectEntity.css +3 -0
- package/build/cjs/lib/unstable/kit/entities/ObjectEntity/ObjectEntity.js +33 -1
- package/build/cjs/lib/unstable/kit/form-entities/RadioGroupInput/RadioGroupInput.css +3 -5
- package/build/cjs/lib/unstable/kit/form-entities/RadioGroupInput/RadioGroupInput.js +1 -1
- package/build/cjs/lib/unstable/kit/form-entities/SegmentedRadioGroupInput/SegmentedRadioGroupInput.css +1 -0
- package/build/cjs/lib/unstable/kit/form-layouts/FormColumn/FormColumn.css +3 -3
- package/build/cjs/lib/unstable/kit/form-layouts/FormColumn/FormColumn.js +6 -5
- package/build/cjs/lib/unstable/kit/form-layouts/FormRow/FormRow.js +2 -2
- package/build/cjs/lib/unstable/kit/layouts/Accordeon/Accordeon.css +2 -6
- package/build/cjs/lib/unstable/kit/layouts/Accordeon/Accordeon.js +3 -16
- package/build/cjs/lib/unstable/kit/layouts/Card/Card.css +0 -6
- package/build/cjs/lib/unstable/kit/layouts/Card/Card.js +2 -3
- package/build/cjs/lib/unstable/kit/layouts/Section/Section.css +0 -6
- package/build/cjs/lib/unstable/kit/layouts/Section/Section.js +2 -3
- package/build/cjs/lib/unstable/kit/layouts/Transparent/Transparent.css +0 -6
- package/build/cjs/lib/unstable/kit/layouts/Transparent/Transparent.js +2 -3
- package/build/cjs/lib/unstable/kit/overview-layouts/OverviewColumn/OverviewColumn.js +3 -3
- package/build/cjs/lib/unstable/kit/overview-layouts/OverviewRow/OverviewRow.js +3 -3
- package/build/esm/lib/unstable/kit/components/ArrayRemoveButton/ArrayRemoveButton.d.ts +2 -0
- package/build/esm/lib/unstable/kit/components/ArrayRemoveButton/ArrayRemoveButton.js +7 -8
- package/build/esm/lib/unstable/kit/components/CopyButton/CopyButton.css +1 -0
- package/build/esm/lib/unstable/kit/components/CopyButton/CopyButton.d.ts +3 -1
- package/build/esm/lib/unstable/kit/components/CopyButton/CopyButton.js +6 -2
- package/build/esm/lib/unstable/kit/components/DropButton/DropButton.css +3 -0
- package/build/esm/lib/unstable/kit/components/DropButton/DropButton.d.ts +11 -0
- package/build/esm/lib/unstable/kit/components/DropButton/DropButton.js +28 -0
- package/build/esm/lib/unstable/kit/components/DropButton/index.d.ts +1 -0
- package/build/esm/lib/unstable/kit/components/DropButton/index.js +1 -0
- package/build/esm/lib/unstable/kit/components/EntityContainer/EntityContainer.css +1 -0
- package/build/esm/lib/unstable/kit/components/EntityContainer/EntityContainer.d.ts +1 -0
- package/build/esm/lib/unstable/kit/components/EntityContainer/EntityContainer.js +2 -2
- package/build/esm/lib/unstable/kit/components/LayoutButtons/LayoutButtons.d.ts +10 -0
- package/build/esm/lib/unstable/kit/components/LayoutButtons/LayoutButtons.js +10 -0
- package/build/esm/lib/unstable/kit/components/LayoutButtons/index.d.ts +1 -0
- package/build/esm/lib/unstable/kit/components/LayoutButtons/index.js +1 -0
- package/build/esm/lib/unstable/kit/components/LayoutContainer/LayoutContainer.css +30 -1
- package/build/esm/lib/unstable/kit/components/index.d.ts +2 -0
- package/build/esm/lib/unstable/kit/components/index.js +2 -0
- package/build/esm/lib/unstable/kit/entities/ArrayEntity/ArrayEntity.css +1 -1
- package/build/esm/lib/unstable/kit/entities/ArrayEntity/ArrayEntity.js +33 -4
- package/build/esm/lib/unstable/kit/entities/ArrayTable/ArrayTable.css +13 -3
- package/build/esm/lib/unstable/kit/entities/ArrayTable/ArrayTable.js +48 -16
- package/build/esm/lib/unstable/kit/entities/ObjectEntity/ObjectEntity.css +3 -0
- package/build/esm/lib/unstable/kit/entities/ObjectEntity/ObjectEntity.d.ts +1 -0
- package/build/esm/lib/unstable/kit/entities/ObjectEntity/ObjectEntity.js +35 -2
- package/build/esm/lib/unstable/kit/form-entities/RadioGroupInput/RadioGroupInput.css +3 -5
- package/build/esm/lib/unstable/kit/form-entities/RadioGroupInput/RadioGroupInput.js +1 -1
- package/build/esm/lib/unstable/kit/form-entities/SegmentedRadioGroupInput/SegmentedRadioGroupInput.css +1 -0
- package/build/esm/lib/unstable/kit/form-layouts/FormColumn/FormColumn.css +3 -3
- package/build/esm/lib/unstable/kit/form-layouts/FormColumn/FormColumn.js +7 -6
- package/build/esm/lib/unstable/kit/form-layouts/FormRow/FormRow.js +3 -3
- package/build/esm/lib/unstable/kit/layouts/Accordeon/Accordeon.css +2 -6
- package/build/esm/lib/unstable/kit/layouts/Accordeon/Accordeon.js +4 -17
- package/build/esm/lib/unstable/kit/layouts/Card/Card.css +0 -6
- package/build/esm/lib/unstable/kit/layouts/Card/Card.js +3 -4
- package/build/esm/lib/unstable/kit/layouts/Section/Section.css +0 -6
- package/build/esm/lib/unstable/kit/layouts/Section/Section.js +3 -4
- package/build/esm/lib/unstable/kit/layouts/Transparent/Transparent.css +0 -6
- package/build/esm/lib/unstable/kit/layouts/Transparent/Transparent.js +3 -4
- package/build/esm/lib/unstable/kit/overview-layouts/OverviewColumn/OverviewColumn.js +4 -4
- package/build/esm/lib/unstable/kit/overview-layouts/OverviewRow/OverviewRow.js +4 -4
- package/package.json +1 -1
|
@@ -2,15 +2,44 @@ import React from 'react';
|
|
|
2
2
|
import { Plus } from '@gravity-ui/icons';
|
|
3
3
|
import { Button, HelpMark, Icon, Text } from '@gravity-ui/uikit';
|
|
4
4
|
import { SchemaRendererMode, SchemaRendererNode, } from '../../../core';
|
|
5
|
-
import { ArrayRemoveButton, EmptyEntityValue, EntityContainer, HTMLContent } from '../../components';
|
|
5
|
+
import { ArrayRemoveButton, EmptyEntityValue, EntityContainer, HTMLContent, LayoutContainer, } from '../../components';
|
|
6
6
|
import { block } from '../../utils';
|
|
7
7
|
import './ArrayTable.css';
|
|
8
8
|
const b = block('array-table');
|
|
9
9
|
export const ArrayTable = ({ headName, input, mode, props, schema, schemaPath, }) => {
|
|
10
10
|
var _a;
|
|
11
11
|
const { name, onBlur, onChange, onFocus, value } = input;
|
|
12
|
-
const { disabled } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
12
|
+
const { disabled, required } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
13
13
|
const overviewFlag = mode === SchemaRendererMode.Overview;
|
|
14
|
+
const initButton = React.useMemo(() => {
|
|
15
|
+
if (required || value !== undefined || overviewFlag) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
const itemsSchema = schema.items;
|
|
19
|
+
const initValue = Array.isArray(itemsSchema)
|
|
20
|
+
? itemsSchema.map(() => undefined)
|
|
21
|
+
: [undefined];
|
|
22
|
+
const onClick = () => {
|
|
23
|
+
onFocus();
|
|
24
|
+
onChange(initValue);
|
|
25
|
+
onBlur();
|
|
26
|
+
};
|
|
27
|
+
return (React.createElement(Button, { className: b('init-button'), onClick: onClick, disabled: disabled || schema.readOnly, qa: `${name}-init-button` },
|
|
28
|
+
React.createElement(Icon, { data: Plus, size: 14 }),
|
|
29
|
+
props.addButtonText || null));
|
|
30
|
+
}, [
|
|
31
|
+
props.addButtonText,
|
|
32
|
+
disabled,
|
|
33
|
+
name,
|
|
34
|
+
onBlur,
|
|
35
|
+
onChange,
|
|
36
|
+
onFocus,
|
|
37
|
+
overviewFlag,
|
|
38
|
+
required,
|
|
39
|
+
schema.items,
|
|
40
|
+
schema.readOnly,
|
|
41
|
+
value,
|
|
42
|
+
]);
|
|
14
43
|
const addButton = React.useMemo(() => {
|
|
15
44
|
const itemsSchema = schema.items;
|
|
16
45
|
if (Array.isArray(itemsSchema) || overviewFlag) {
|
|
@@ -18,7 +47,7 @@ export const ArrayTable = ({ headName, input, mode, props, schema, schemaPath, }
|
|
|
18
47
|
}
|
|
19
48
|
const onClick = () => {
|
|
20
49
|
onFocus();
|
|
21
|
-
onChange([...(value || []),
|
|
50
|
+
onChange([...(value || []), undefined]);
|
|
22
51
|
onBlur();
|
|
23
52
|
};
|
|
24
53
|
return (React.createElement(Button, { className: b('add-button'), onClick: onClick, disabled: disabled || schema.readOnly, qa: `${name}-add-button` },
|
|
@@ -80,21 +109,24 @@ export const ArrayTable = ({ headName, input, mode, props, schema, schemaPath, }
|
|
|
80
109
|
wIndex + 1 === array.length && column.schema.description ? (React.createElement(HelpMark, null,
|
|
81
110
|
React.createElement(HTMLContent, { content: column.schema.description, headName: headName }))) : null))))));
|
|
82
111
|
})));
|
|
83
|
-
const rows = new Array(rowsCount).fill(null).map((_, rIndex) => (React.createElement(
|
|
84
|
-
React.createElement("div", { className: b('
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
112
|
+
const rows = new Array(rowsCount).fill(null).map((_, rIndex) => (React.createElement(React.Fragment, { key: rIndex },
|
|
113
|
+
React.createElement("div", { className: b('row-divider') }),
|
|
114
|
+
React.createElement(LayoutContainer, null,
|
|
115
|
+
React.createElement("div", { className: b('row', { 'with-remove-button': withRemoveButton }), style: { '--columns-count': columns.length } },
|
|
116
|
+
React.createElement("div", { className: b('cell') },
|
|
117
|
+
React.createElement(Text, { className: b('index'), variant: "subheader-1" }, rIndex + 1)),
|
|
118
|
+
columns.map((column, cIndex) => (React.createElement("div", { className: b('cell'), key: cIndex },
|
|
119
|
+
React.createElement(SchemaRendererNode, { headName: headName, name: getItemName(rIndex, column.name), schemaPath: getItemSchemaPath(rIndex, column.name) })))),
|
|
120
|
+
withRemoveButton ? (React.createElement("div", { className: b('cell') },
|
|
121
|
+
React.createElement(ArrayRemoveButton, { name: `${name}[${rIndex}]`, headName: headName, mode: mode }))) : null)))));
|
|
90
122
|
return { head, rows };
|
|
91
|
-
}, [columns, headName, name, overviewFlag, schema.items, schemaPath, value === null || value === void 0 ? void 0 : value.length]);
|
|
123
|
+
}, [columns, headName, mode, name, overviewFlag, schema.items, schemaPath, value === null || value === void 0 ? void 0 : value.length]);
|
|
92
124
|
if (overviewFlag && !(value === null || value === void 0 ? void 0 : value.length)) {
|
|
93
125
|
return React.createElement(EmptyEntityValue, null);
|
|
94
126
|
}
|
|
95
|
-
return (React.createElement(EntityContainer, { stretch: "by-child", gap:
|
|
96
|
-
React.createElement("div", null,
|
|
97
|
-
|
|
98
|
-
rows),
|
|
99
|
-
addButton));
|
|
127
|
+
return (React.createElement(EntityContainer, { stretch: "by-child", gap: 4, fill: "by-child", droppable: true }, initButton ? (initButton) : (React.createElement(React.Fragment, null,
|
|
128
|
+
rows.length ? (React.createElement("div", null,
|
|
129
|
+
head,
|
|
130
|
+
rows)) : null,
|
|
131
|
+
addButton))));
|
|
100
132
|
};
|
|
@@ -1,12 +1,45 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { Plus } from '@gravity-ui/icons';
|
|
3
|
+
import { Button, Icon } from '@gravity-ui/uikit';
|
|
4
|
+
import { SchemaRendererMode, SchemaRendererNode, } from '../../../core';
|
|
3
5
|
import { EntityContainer } from '../../components';
|
|
6
|
+
import { block } from '../../utils';
|
|
7
|
+
import './ObjectEntity.css';
|
|
8
|
+
const b = block('object-entity');
|
|
4
9
|
export const ObjectEntity = ({ Layout, headName, input, layoutProps, meta, mode, props, schema, schemaPath, }) => {
|
|
10
|
+
var _a;
|
|
11
|
+
const { onFocus, onChange, onBlur, value } = input;
|
|
12
|
+
const { disabled, required } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
13
|
+
const overviewFlag = mode === SchemaRendererMode.Overview;
|
|
5
14
|
const { name } = input;
|
|
15
|
+
const initButton = React.useMemo(() => {
|
|
16
|
+
if (required || value !== undefined || overviewFlag) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
const onClick = () => {
|
|
20
|
+
onFocus();
|
|
21
|
+
onChange({});
|
|
22
|
+
onBlur();
|
|
23
|
+
};
|
|
24
|
+
return (React.createElement(Button, { className: b('init-button'), onClick: onClick, disabled: disabled || schema.readOnly, qa: `${name}-init-button` },
|
|
25
|
+
React.createElement(Icon, { data: Plus, size: 14 }),
|
|
26
|
+
schema.title || null));
|
|
27
|
+
}, [
|
|
28
|
+
disabled,
|
|
29
|
+
name,
|
|
30
|
+
onBlur,
|
|
31
|
+
onChange,
|
|
32
|
+
onFocus,
|
|
33
|
+
overviewFlag,
|
|
34
|
+
required,
|
|
35
|
+
schema.title,
|
|
36
|
+
schema.readOnly,
|
|
37
|
+
value,
|
|
38
|
+
]);
|
|
6
39
|
if (!Object.keys(schema.properties || {}).length) {
|
|
7
40
|
return null;
|
|
8
41
|
}
|
|
9
|
-
let content = (React.createElement(EntityContainer, { stretch: "by-child", fill: "by-child" }, (props.order || Object.keys(schema.properties || {})).map((property) => (React.createElement(SchemaRendererNode, { headName: headName, name: `${name ? name + '.' : ''}${property}`, schemaPath: `${schemaPath}/properties/${property}`, key: property })))));
|
|
42
|
+
let content = (React.createElement(EntityContainer, { stretch: "by-child", fill: "by-child", droppable: true }, initButton ? (initButton) : (React.createElement(React.Fragment, null, (props.order || Object.keys(schema.properties || {})).map((property) => (React.createElement(SchemaRendererNode, { headName: headName, name: `${name ? name + '.' : ''}${property}`, schemaPath: `${schemaPath}/properties/${property}`, key: property })))))));
|
|
10
43
|
if (Layout) {
|
|
11
44
|
content = (React.createElement(Layout, { headName: headName, input: input, meta: meta, mode: mode, schema: schema, schemaPath: schemaPath, props: layoutProps || {} }, content));
|
|
12
45
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
.sr-radio-group-
|
|
1
|
+
.sr-radio-group-input .g-radio-group .g-control-label.g-radio-group__option {
|
|
2
2
|
min-height: 28px;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
.sr-radio-group-input_direction_vertical {
|
|
6
|
-
padding-top: 7px;
|
|
3
|
+
align-items: center;
|
|
4
|
+
margin-bottom: 0;
|
|
7
5
|
}
|
|
8
6
|
.sr-radio-group-input_error .g-radio-group .g-radio_checked .g-radio__indicator:hover::before {
|
|
9
7
|
border: 1px solid var(--g-color-text-danger);
|
|
@@ -18,6 +18,6 @@ export const RadioGroupInput = ({ input, meta, props, schema, }) => {
|
|
|
18
18
|
disabled: optionsDisabled === null || optionsDisabled === void 0 ? void 0 : optionsDisabled[value],
|
|
19
19
|
}));
|
|
20
20
|
}, [enumDescriptions, optionsDisabled, schema.enum]);
|
|
21
|
-
return (React.createElement(EntityContainer, { stretch: "fit", className: b({ error: getBooleanValidationState(meta)
|
|
21
|
+
return (React.createElement(EntityContainer, { stretch: "fit", className: b({ error: getBooleanValidationState(meta) }), justifyContent: "center" },
|
|
22
22
|
React.createElement(RadioGroup, Object.assign({ options: options, disabled: disabled || schema.readOnly }, restEntityProps, { value: value, onFocus: onFocus, onBlur: onBlur, onUpdate: onChange, direction: direction, qa: name }))));
|
|
23
23
|
};
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
.sr-form-column:last-child {
|
|
5
5
|
margin-bottom: 0;
|
|
6
6
|
}
|
|
7
|
-
.sr-form-
|
|
7
|
+
.sr-form-column__title {
|
|
8
8
|
display: inline;
|
|
9
9
|
}
|
|
10
|
-
.sr-form-column__title {
|
|
10
|
+
.sr-form-column__title-text {
|
|
11
11
|
min-height: 18px;
|
|
12
12
|
margin-right: calc(var(--g-spacing-base) * 1);
|
|
13
13
|
}
|
|
14
|
-
.sr-form-
|
|
14
|
+
.sr-form-column__title-text_required::after {
|
|
15
15
|
content: "*";
|
|
16
16
|
margin-left: calc(var(--g-spacing-base) * 1);
|
|
17
17
|
color: var(--g-color-text-danger);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Flex, HelpMark, Text } from '@gravity-ui/uikit';
|
|
3
|
-
import {
|
|
3
|
+
import { EntityError, HTMLContent, LayoutButtons, LayoutContainer } from '../../components';
|
|
4
4
|
import { block, getValidationState } from '../../utils';
|
|
5
5
|
import './FormColumn.css';
|
|
6
6
|
const b = block('form-column');
|
|
7
|
-
export const FormColumn = ({ children, headName, input, meta, schema, props, }) => {
|
|
7
|
+
export const FormColumn = ({ children, headName, input, meta, mode, schema, props, }) => {
|
|
8
8
|
var _a;
|
|
9
9
|
const { hidden, required } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
10
10
|
const tooltip = React.useMemo(() => {
|
|
@@ -22,10 +22,11 @@ export const FormColumn = ({ children, headName, input, meta, schema, props, })
|
|
|
22
22
|
}, [headName, schema.description, props.descriptionType]);
|
|
23
23
|
return (React.createElement(LayoutContainer, { className: b(), gap: 2, hidden: hidden },
|
|
24
24
|
React.createElement(Flex, { direction: "column", gap: 0.5 },
|
|
25
|
-
React.createElement(
|
|
26
|
-
React.createElement(
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
React.createElement(Flex, { alignItems: "center", gap: 2 },
|
|
26
|
+
React.createElement("div", { className: b('title') },
|
|
27
|
+
React.createElement(Text, { className: b('title-text', { required }), variant: "subheader-1", color: "complementary", wordBreak: "break-word" }, schema.title),
|
|
28
|
+
tooltip),
|
|
29
|
+
React.createElement(LayoutButtons, { mode: mode, name: input.name, headName: headName, schema: schema, value: input.value })),
|
|
29
30
|
bottomDescription),
|
|
30
31
|
React.createElement(Flex, { className: b('bottom'), direction: "column", gap: 0.5 },
|
|
31
32
|
children,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Flex, HelpMark, Text } from '@gravity-ui/uikit';
|
|
3
|
-
import {
|
|
3
|
+
import { EntityError, HTMLContent, LayoutButtons, LayoutContainer } from '../../components';
|
|
4
4
|
import { block, getValidationState } from '../../utils';
|
|
5
5
|
import './FormRow.css';
|
|
6
6
|
const b = block('form-row');
|
|
7
|
-
export const FormRow = ({ children, headName, input, meta, schema, props, }) => {
|
|
7
|
+
export const FormRow = ({ children, headName, input, meta, mode, schema, props, }) => {
|
|
8
8
|
var _a;
|
|
9
9
|
const { hidden, required } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
10
10
|
const tooltip = React.useMemo(() => {
|
|
@@ -27,7 +27,7 @@ export const FormRow = ({ children, headName, input, meta, schema, props, }) =>
|
|
|
27
27
|
React.createElement(Flex, { className: b('right'), direction: "column", gap: 0.5, grow: 1 },
|
|
28
28
|
React.createElement(Flex, { grow: 1, gap: 2 },
|
|
29
29
|
children,
|
|
30
|
-
React.createElement(
|
|
30
|
+
React.createElement(LayoutButtons, { mode: mode, name: input.name, headName: headName, schema: schema, value: input.value })),
|
|
31
31
|
bottomDescription,
|
|
32
32
|
React.createElement(EntityError, { errorMessage: meta.error, validationState: getValidationState(meta) }))));
|
|
33
33
|
};
|
|
@@ -4,9 +4,6 @@
|
|
|
4
4
|
.sr-accordeon:last-child {
|
|
5
5
|
margin-bottom: 0;
|
|
6
6
|
}
|
|
7
|
-
.sr-accordeon:hover .sr-accordeon__copy-button {
|
|
8
|
-
display: block;
|
|
9
|
-
}
|
|
10
7
|
.sr-accordeon .g-disclosure__trigger {
|
|
11
8
|
padding-left: 6.5px;
|
|
12
9
|
}
|
|
@@ -17,6 +14,8 @@
|
|
|
17
14
|
display: none;
|
|
18
15
|
}
|
|
19
16
|
.sr-accordeon__toggler {
|
|
17
|
+
height: auto;
|
|
18
|
+
min-height: 28px;
|
|
20
19
|
padding-left: 6px;
|
|
21
20
|
}
|
|
22
21
|
.sr-accordeon__title_required::after {
|
|
@@ -40,7 +39,4 @@
|
|
|
40
39
|
position: absolute;
|
|
41
40
|
left: calc(var(--g-spacing-base) * 3 + 1.5px);
|
|
42
41
|
bottom: 0;
|
|
43
|
-
}
|
|
44
|
-
.sr-accordeon__copy-button {
|
|
45
|
-
display: none;
|
|
46
42
|
}
|
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { ChevronDown, ChevronUp } from '@gravity-ui/icons';
|
|
4
4
|
import { Button, Disclosure, Flex, HelpMark, Icon, Text, } from '@gravity-ui/uikit';
|
|
5
5
|
import { SchemaRendererMode } from '../../../core';
|
|
6
|
-
import {
|
|
6
|
+
import { EntityError, HTMLContent, LayoutButtons, LayoutContainer } from '../../components';
|
|
7
7
|
import { useExpanded } from '../../hooks';
|
|
8
8
|
import { block, getValidationState } from '../../utils';
|
|
9
9
|
import './Accordeon.css';
|
|
@@ -11,10 +11,10 @@ const b = block('accordeon');
|
|
|
11
11
|
export const Accordeon = ({ children, headName, input, meta, mode, schema, props, }) => {
|
|
12
12
|
var _a;
|
|
13
13
|
const { titleProps, togglerProps, withIndent = false, withDefaultSummary = false } = props, restLayoutProps = __rest(props, ["titleProps", "togglerProps", "withIndent", "withDefaultSummary"]);
|
|
14
|
-
const {
|
|
14
|
+
const { required, hidden, open } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
15
15
|
const { expanded, setExpanded } = useExpanded({ headName, name: input.name, open });
|
|
16
16
|
const overviewFlag = mode === SchemaRendererMode.Overview;
|
|
17
|
-
const summary = React.useMemo(() => (React.createElement(Text, Object.assign({ variant: "subheader-1", color: "complementary" }, titleProps, { className: b('title', { required: required && !overviewFlag }, titleProps === null || titleProps === void 0 ? void 0 : titleProps.className) }), schema.title)), [overviewFlag, required, schema.title, titleProps]);
|
|
17
|
+
const summary = React.useMemo(() => (React.createElement(Text, Object.assign({ variant: "subheader-1", color: "complementary" }, titleProps, { className: b('title', { required: required && !overviewFlag }, titleProps === null || titleProps === void 0 ? void 0 : titleProps.className), whiteSpace: "break-spaces", wordBreak: "break-word" }), schema.title)), [overviewFlag, required, schema.title, titleProps]);
|
|
18
18
|
const helpMark = React.useMemo(() => {
|
|
19
19
|
if (schema.description) {
|
|
20
20
|
return (React.createElement(HelpMark, null,
|
|
@@ -22,18 +22,6 @@ export const Accordeon = ({ children, headName, input, meta, mode, schema, props
|
|
|
22
22
|
}
|
|
23
23
|
return null;
|
|
24
24
|
}, [schema.description, headName]);
|
|
25
|
-
const copyButton = React.useMemo(() => {
|
|
26
|
-
if (overviewFlag) {
|
|
27
|
-
return React.createElement(CopyButton, { className: b('copy-button'), copy: copy, value: input.value });
|
|
28
|
-
}
|
|
29
|
-
return null;
|
|
30
|
-
}, [overviewFlag, copy, input.value]);
|
|
31
|
-
const removeButton = React.useMemo(() => {
|
|
32
|
-
if (overviewFlag) {
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
return React.createElement(ArrayRemoveButton, { name: input.name, headName: headName });
|
|
36
|
-
}, [overviewFlag, input.name, headName]);
|
|
37
25
|
return (React.createElement(LayoutContainer, { className: b({ 'without-default-summary': !withDefaultSummary }), hideEmpty: overviewFlag, hidden: hidden },
|
|
38
26
|
React.createElement(Disclosure, Object.assign({ summary: summary, expanded: expanded, onUpdate: setExpanded }, restLayoutProps),
|
|
39
27
|
React.createElement(Disclosure.Summary, null, ({ expanded, onClick }, defaultSummary) => (React.createElement(Flex, { minHeight: "28px", alignItems: "center", gap: 2 },
|
|
@@ -42,8 +30,7 @@ export const Accordeon = ({ children, headName, input, meta, mode, schema, props
|
|
|
42
30
|
React.createElement(Icon, { data: expanded ? ChevronUp : ChevronDown }),
|
|
43
31
|
summary))),
|
|
44
32
|
helpMark,
|
|
45
|
-
|
|
46
|
-
removeButton))),
|
|
33
|
+
React.createElement(LayoutButtons, { mode: mode, name: input.name, headName: headName, schema: schema, value: input.value })))),
|
|
47
34
|
React.createElement(Flex, { direction: "column", gap: 0.5, grow: 1 },
|
|
48
35
|
React.createElement("div", { className: b('content', { 'with-indent': withIndent }) }, children),
|
|
49
36
|
overviewFlag ? null : (React.createElement(EntityError, { errorMessage: meta.error, validationState: getValidationState(meta) }))))));
|
|
@@ -4,9 +4,6 @@
|
|
|
4
4
|
.sr-card:last-child {
|
|
5
5
|
margin-bottom: 0;
|
|
6
6
|
}
|
|
7
|
-
.sr-card:hover .sr-card__copy-button {
|
|
8
|
-
display: block;
|
|
9
|
-
}
|
|
10
7
|
.sr-card__inner {
|
|
11
8
|
display: flex;
|
|
12
9
|
flex-direction: column;
|
|
@@ -35,7 +32,4 @@
|
|
|
35
32
|
content: "*";
|
|
36
33
|
margin-left: calc(var(--g-spacing-base) * 1);
|
|
37
34
|
color: var(--g-color-text-danger);
|
|
38
|
-
}
|
|
39
|
-
.sr-card__copy-button {
|
|
40
|
-
display: none;
|
|
41
35
|
}
|
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { ChevronDown, ChevronUp } from '@gravity-ui/icons';
|
|
4
4
|
import { Button, Flex, HelpMark, Icon, Text, Card as UIKitCard, } from '@gravity-ui/uikit';
|
|
5
5
|
import { SchemaRendererMode } from '../../../core';
|
|
6
|
-
import {
|
|
6
|
+
import { EntityError, HTMLContent, LayoutButtons, LayoutContainer } from '../../components';
|
|
7
7
|
import { useExpanded } from '../../hooks';
|
|
8
8
|
import { block, getValidationState } from '../../utils';
|
|
9
9
|
import './Card.css';
|
|
@@ -11,7 +11,7 @@ const b = block('card');
|
|
|
11
11
|
export const Card = ({ children, headName, input, meta, mode, schema, props, }) => {
|
|
12
12
|
var _a;
|
|
13
13
|
const { descriptionType = 'tooltip', likeAccordeon = true } = props, restLayoutProps = __rest(props, ["descriptionType", "likeAccordeon"]);
|
|
14
|
-
const {
|
|
14
|
+
const { required, hidden, open = true } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
15
15
|
const overviewFlag = mode === SchemaRendererMode.Overview;
|
|
16
16
|
const { expanded, toggleExpanded } = useExpanded({
|
|
17
17
|
headName,
|
|
@@ -40,8 +40,7 @@ export const Card = ({ children, headName, input, meta, mode, schema, props, })
|
|
|
40
40
|
React.createElement(Text, { variant: "subheader-1", color: "complementary", className: b('title', { required: required && !overviewFlag }) }, schema.title),
|
|
41
41
|
tooltip),
|
|
42
42
|
React.createElement(Flex, { className: b('header-actions'), alignItems: "center", gap: 2 },
|
|
43
|
-
|
|
44
|
-
overviewFlag ? null : (React.createElement(ArrayRemoveButton, { name: input.name, headName: headName })),
|
|
43
|
+
React.createElement(LayoutButtons, { mode: mode, name: input.name, headName: headName, schema: schema, value: input.value }),
|
|
45
44
|
likeAccordeon ? (React.createElement(Flex, { width: "28px", justifyContent: "center" },
|
|
46
45
|
React.createElement(Button, { onClick: toggleExpanded, size: "s", view: "flat-secondary" },
|
|
47
46
|
React.createElement(Icon, { data: expanded ? ChevronUp : ChevronDown, size: 16 })))) : null)),
|
|
@@ -4,9 +4,6 @@
|
|
|
4
4
|
.sr-section:last-child {
|
|
5
5
|
margin-bottom: 0;
|
|
6
6
|
}
|
|
7
|
-
.sr-section:hover .sr-section__copy-button {
|
|
8
|
-
display: block;
|
|
9
|
-
}
|
|
10
7
|
.sr-section__header {
|
|
11
8
|
min-height: 28px;
|
|
12
9
|
}
|
|
@@ -28,7 +25,4 @@
|
|
|
28
25
|
position: absolute;
|
|
29
26
|
left: calc(var(--g-spacing-base) * 3 + 1.5px);
|
|
30
27
|
bottom: 0;
|
|
31
|
-
}
|
|
32
|
-
.sr-section__copy-button {
|
|
33
|
-
display: none;
|
|
34
28
|
}
|
|
@@ -2,14 +2,14 @@ import { __rest } from "tslib";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Flex, HelpMark, Text, spacing } from '@gravity-ui/uikit';
|
|
4
4
|
import { SchemaRendererMode } from '../../../core';
|
|
5
|
-
import {
|
|
5
|
+
import { EntityError, HTMLContent, LayoutButtons, LayoutContainer } from '../../components';
|
|
6
6
|
import { block, getValidationState } from '../../utils';
|
|
7
7
|
import './Section.css';
|
|
8
8
|
const b = block('section');
|
|
9
9
|
export const Section = ({ children, headName, input, meta, mode, schema, props, }) => {
|
|
10
10
|
var _a;
|
|
11
11
|
const { descriptionType = 'tooltip', withIndent = false } = props, restLayoutProps = __rest(props, ["descriptionType", "withIndent"]);
|
|
12
|
-
const {
|
|
12
|
+
const { required, hidden } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
13
13
|
const overviewFlag = mode === SchemaRendererMode.Overview;
|
|
14
14
|
const tooltip = React.useMemo(() => {
|
|
15
15
|
if (!schema.description || descriptionType === 'bottom') {
|
|
@@ -30,8 +30,7 @@ export const Section = ({ children, headName, input, meta, mode, schema, props,
|
|
|
30
30
|
React.createElement(Flex, { className: b('header'), gap: 2, alignItems: "center" },
|
|
31
31
|
React.createElement(Text, Object.assign({ variant: "subheader-1", color: "complementary" }, restLayoutProps, { className: b('title', { required: required && !overviewFlag }, restLayoutProps === null || restLayoutProps === void 0 ? void 0 : restLayoutProps.className) }), schema.title),
|
|
32
32
|
tooltip,
|
|
33
|
-
|
|
34
|
-
overviewFlag ? null : (React.createElement(ArrayRemoveButton, { name: input.name, headName: headName }))),
|
|
33
|
+
React.createElement(LayoutButtons, { mode: mode, name: input.name, headName: headName, schema: schema, value: input.value })),
|
|
35
34
|
bottomDescription),
|
|
36
35
|
React.createElement("div", { className: b('content', { 'with-indent': withIndent }) }, children)),
|
|
37
36
|
overviewFlag ? null : (React.createElement(EntityError, { errorMessage: meta.error, validationState: getValidationState(meta) }))));
|
|
@@ -2,18 +2,17 @@ import React from 'react';
|
|
|
2
2
|
import { Flex } from '@gravity-ui/uikit';
|
|
3
3
|
import isBoolean from 'lodash/isBoolean';
|
|
4
4
|
import { SchemaRendererMode } from '../../../core';
|
|
5
|
-
import {
|
|
5
|
+
import { EntityError, LayoutButtons, LayoutContainer } from '../../components';
|
|
6
6
|
import { block, getValidationState } from '../../utils';
|
|
7
7
|
import './Transparent.css';
|
|
8
8
|
const b = block('transparent');
|
|
9
9
|
export const Transparent = ({ children, headName, input, meta, mode, props, schema, }) => {
|
|
10
10
|
var _a;
|
|
11
|
-
const {
|
|
11
|
+
const { hidden } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
12
12
|
const overviewFlag = mode === SchemaRendererMode.Overview;
|
|
13
13
|
return (React.createElement(LayoutContainer, { className: b(), gap: 0.5, hideEmpty: isBoolean(props.hideEmpty) ? props.hideEmpty : overviewFlag, hidden: hidden },
|
|
14
14
|
React.createElement(Flex, { gap: 2 },
|
|
15
15
|
children,
|
|
16
|
-
|
|
17
|
-
overviewFlag ? (React.createElement(CopyButton, { className: b('copy-button'), copy: copy, value: input.value })) : null),
|
|
16
|
+
React.createElement(LayoutButtons, { mode: mode, name: input.name, headName: headName, schema: schema, value: input.value })),
|
|
18
17
|
overviewFlag ? null : (React.createElement(EntityError, { errorMessage: meta.error, validationState: getValidationState(meta) }))));
|
|
19
18
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Flex, HelpMark, Text } from '@gravity-ui/uikit';
|
|
3
|
-
import {
|
|
3
|
+
import { HTMLContent, LayoutButtons, LayoutContainer } from '../../components';
|
|
4
4
|
import { block } from '../../utils';
|
|
5
5
|
import './OverviewColumn.css';
|
|
6
6
|
const b = block('overview-column');
|
|
7
|
-
export const OverviewColumn = ({ children, headName, input, schema }) => {
|
|
7
|
+
export const OverviewColumn = ({ children, headName, input, mode, schema, }) => {
|
|
8
8
|
var _a;
|
|
9
|
-
const {
|
|
9
|
+
const { hidden } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
10
10
|
const tooltip = React.useMemo(() => {
|
|
11
11
|
if (!schema.description) {
|
|
12
12
|
return null;
|
|
@@ -22,5 +22,5 @@ export const OverviewColumn = ({ children, headName, input, schema }) => {
|
|
|
22
22
|
React.createElement(Flex, { className: b('bottom'), direction: "column", gap: 0.5, grow: 1 },
|
|
23
23
|
React.createElement(Flex, { grow: 1, gap: 2 },
|
|
24
24
|
children,
|
|
25
|
-
React.createElement(
|
|
25
|
+
React.createElement(LayoutButtons, { mode: mode, name: input.name, headName: headName, schema: schema, value: input.value })))));
|
|
26
26
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Flex, HelpMark, Text } from '@gravity-ui/uikit';
|
|
3
|
-
import {
|
|
3
|
+
import { HTMLContent, LayoutButtons, LayoutContainer } from '../../components';
|
|
4
4
|
import { block } from '../../utils';
|
|
5
5
|
import './OverviewRow.css';
|
|
6
6
|
const b = block('overview-row');
|
|
7
|
-
export const OverviewRow = ({ children, headName, input, schema }) => {
|
|
7
|
+
export const OverviewRow = ({ children, headName, input, mode, schema }) => {
|
|
8
8
|
var _a;
|
|
9
|
-
const {
|
|
9
|
+
const { hidden } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
10
10
|
const tooltip = React.useMemo(() => {
|
|
11
11
|
if (!schema.description) {
|
|
12
12
|
return null;
|
|
@@ -22,5 +22,5 @@ export const OverviewRow = ({ children, headName, input, schema }) => {
|
|
|
22
22
|
React.createElement(Flex, { className: b('right'), direction: "column", gap: 0.5, grow: 1 },
|
|
23
23
|
React.createElement(Flex, { grow: 1, gap: 2 },
|
|
24
24
|
children,
|
|
25
|
-
React.createElement(
|
|
25
|
+
React.createElement(LayoutButtons, { mode: mode, name: input.name, headName: headName, schema: schema, value: input.value })))));
|
|
26
26
|
};
|