@gravity-ui/dynamic-forms 5.23.0 → 5.24.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/types/specs.d.ts +1 -1
- package/build/cjs/lib/kit/components/Inputs/MultiSelect/MultiSelect.js +24 -13
- package/build/cjs/lib/unstable/core/types/components.d.ts +3 -13
- package/build/cjs/lib/unstable/core/types/schema.d.ts +14 -7
- package/build/cjs/lib/unstable/core/useSchemaRenderer/types/state.d.ts +3 -0
- package/build/cjs/lib/unstable/core/utils/definers.d.ts +27 -13
- package/build/cjs/lib/unstable/kit/components/HTMLContent/HTMLContent.d.ts +2 -1
- package/build/cjs/lib/unstable/kit/components/HTMLContent/HTMLContent.js +12 -2
- package/build/cjs/lib/unstable/kit/components/LayoutContainer/LayoutContainer.css +3 -0
- package/build/cjs/lib/unstable/kit/components/LayoutContainer/LayoutContainer.d.ts +1 -0
- package/build/cjs/lib/unstable/kit/components/LayoutContainer/LayoutContainer.js +2 -2
- package/build/cjs/lib/unstable/kit/entities/Alert/Alert.css +16 -0
- package/build/cjs/lib/unstable/kit/entities/Alert/Alert.js +26 -7
- package/build/cjs/lib/unstable/kit/entities/ArrayEntity/ArrayEntity.d.ts +0 -1
- package/build/cjs/lib/unstable/kit/entities/ArrayEntity/ArrayEntity.js +4 -2
- package/build/cjs/lib/unstable/kit/entities/ArrayTable/ArrayTable.d.ts +0 -1
- package/build/cjs/lib/unstable/kit/entities/ArrayTable/ArrayTable.js +5 -3
- package/build/cjs/lib/unstable/kit/entities/FewOfNested/FewOfNested.css +3 -0
- package/build/cjs/lib/unstable/kit/entities/Label/Label.js +4 -4
- package/build/cjs/lib/unstable/kit/entities/Monaco/Monaco.js +3 -1
- package/build/cjs/lib/unstable/kit/entities/ObjectEntity/ObjectEntity.d.ts +0 -1
- package/build/cjs/lib/unstable/kit/entities/ObjectInline/ObjectInline.d.ts +0 -1
- package/build/cjs/lib/unstable/kit/entities/OneOfNested/OneOfNested.css +3 -0
- package/build/cjs/lib/unstable/kit/entities/TextContent/TextContent.js +4 -4
- package/build/cjs/lib/unstable/kit/form-entities/CheckboxGroupInput/CheckboxGroupInput.d.ts +0 -1
- package/build/cjs/lib/unstable/kit/form-entities/CheckboxGroupInput/CheckboxGroupInput.js +3 -1
- package/build/cjs/lib/unstable/kit/form-entities/CheckboxInput/CheckboxInput.js +3 -1
- package/build/cjs/lib/unstable/kit/form-entities/ColorPickerInput/ColorPickerInput.js +3 -1
- package/build/cjs/lib/unstable/kit/form-entities/DateInput/DateInput.js +3 -2
- package/build/cjs/lib/unstable/kit/form-entities/FileInput/FileInput.js +3 -1
- package/build/cjs/lib/unstable/kit/form-entities/MultiSelectInput/MultiSelectInput.js +4 -2
- package/build/cjs/lib/unstable/kit/form-entities/NumberInput/NumberInput.js +3 -2
- package/build/cjs/lib/unstable/kit/form-entities/NumberWithScaleInput/NumberWithScaleInput.js +3 -2
- package/build/cjs/lib/unstable/kit/form-entities/PasswordInput/PasswordInput.js +3 -2
- package/build/cjs/lib/unstable/kit/form-entities/RadioGroupInput/RadioGroupInput.js +3 -1
- package/build/cjs/lib/unstable/kit/form-entities/RangeSliderInput/RangeSliderInput.js +9 -8
- package/build/cjs/lib/unstable/kit/form-entities/SegmentedRadioGroupInput/SegmentedRadioGroupInput.js +3 -1
- package/build/cjs/lib/unstable/kit/form-entities/SelectInput/SelectInput.js +4 -2
- package/build/cjs/lib/unstable/kit/form-entities/SliderInput/SliderInput.js +3 -1
- package/build/cjs/lib/unstable/kit/form-entities/StringInput/StringInput.js +3 -2
- package/build/cjs/lib/unstable/kit/form-entities/StringNumberWithScaleInput/StringNumberWithScaleInput.js +4 -3
- package/build/cjs/lib/unstable/kit/form-entities/SwitchInput/SwitchInput.js +3 -1
- package/build/cjs/lib/unstable/kit/form-entities/TextAreaInput/TextAreaInput.js +3 -2
- package/build/cjs/lib/unstable/kit/form-layouts/FormColumn/FormColumn.js +8 -6
- package/build/cjs/lib/unstable/kit/form-layouts/FormRow/FormRow.js +8 -6
- package/build/cjs/lib/unstable/kit/index.d.ts +1 -0
- package/build/cjs/lib/unstable/kit/index.js +1 -0
- package/build/cjs/lib/unstable/kit/layouts/Accordeon/Accordeon.js +6 -4
- package/build/cjs/lib/unstable/kit/layouts/Card/Card.js +8 -6
- package/build/cjs/lib/unstable/kit/layouts/Section/Section.js +8 -6
- package/build/cjs/lib/unstable/kit/layouts/Transparent/Transparent.js +5 -3
- package/build/cjs/lib/unstable/kit/overview-layouts/OverviewColumn/OverviewColumn.js +7 -5
- package/build/cjs/lib/unstable/kit/overview-layouts/OverviewRow/OverviewRow.js +7 -5
- package/build/cjs/lib/unstable/kit/utils/index.d.ts +1 -1
- package/build/cjs/lib/unstable/kit/utils/index.js +1 -7
- package/build/cjs/lib/unstable/kit/utils/transformer.d.ts +10 -17
- package/build/cjs/lib/unstable/kit/utils/transformer.js +542 -2778
- package/build/esm/lib/core/types/specs.d.ts +1 -1
- package/build/esm/lib/kit/components/Inputs/MultiSelect/MultiSelect.js +24 -13
- package/build/esm/lib/unstable/core/types/components.d.ts +3 -13
- package/build/esm/lib/unstable/core/types/schema.d.ts +14 -7
- package/build/esm/lib/unstable/core/useSchemaRenderer/types/state.d.ts +3 -0
- package/build/esm/lib/unstable/core/utils/definers.d.ts +27 -13
- package/build/esm/lib/unstable/kit/components/HTMLContent/HTMLContent.d.ts +2 -1
- package/build/esm/lib/unstable/kit/components/HTMLContent/HTMLContent.js +12 -2
- package/build/esm/lib/unstable/kit/components/LayoutContainer/LayoutContainer.css +3 -0
- package/build/esm/lib/unstable/kit/components/LayoutContainer/LayoutContainer.d.ts +1 -0
- package/build/esm/lib/unstable/kit/components/LayoutContainer/LayoutContainer.js +2 -2
- package/build/esm/lib/unstable/kit/entities/Alert/Alert.css +16 -0
- package/build/esm/lib/unstable/kit/entities/Alert/Alert.d.ts +1 -0
- package/build/esm/lib/unstable/kit/entities/Alert/Alert.js +29 -9
- package/build/esm/lib/unstable/kit/entities/ArrayEntity/ArrayEntity.d.ts +0 -1
- package/build/esm/lib/unstable/kit/entities/ArrayEntity/ArrayEntity.js +4 -2
- package/build/esm/lib/unstable/kit/entities/ArrayTable/ArrayTable.d.ts +0 -1
- package/build/esm/lib/unstable/kit/entities/ArrayTable/ArrayTable.js +5 -3
- package/build/esm/lib/unstable/kit/entities/FewOfNested/FewOfNested.css +3 -0
- package/build/esm/lib/unstable/kit/entities/Label/Label.js +5 -5
- package/build/esm/lib/unstable/kit/entities/Monaco/Monaco.js +3 -1
- package/build/esm/lib/unstable/kit/entities/ObjectEntity/ObjectEntity.d.ts +0 -1
- package/build/esm/lib/unstable/kit/entities/ObjectInline/ObjectInline.d.ts +0 -1
- package/build/esm/lib/unstable/kit/entities/OneOfNested/OneOfNested.css +3 -0
- package/build/esm/lib/unstable/kit/entities/TextContent/TextContent.js +5 -5
- package/build/esm/lib/unstable/kit/form-entities/CheckboxGroupInput/CheckboxGroupInput.d.ts +0 -1
- package/build/esm/lib/unstable/kit/form-entities/CheckboxGroupInput/CheckboxGroupInput.js +3 -1
- package/build/esm/lib/unstable/kit/form-entities/CheckboxInput/CheckboxInput.js +3 -1
- package/build/esm/lib/unstable/kit/form-entities/ColorPickerInput/ColorPickerInput.js +3 -1
- package/build/esm/lib/unstable/kit/form-entities/DateInput/DateInput.js +3 -2
- package/build/esm/lib/unstable/kit/form-entities/FileInput/FileInput.js +3 -1
- package/build/esm/lib/unstable/kit/form-entities/MultiSelectInput/MultiSelectInput.js +4 -2
- package/build/esm/lib/unstable/kit/form-entities/NumberInput/NumberInput.js +3 -2
- package/build/esm/lib/unstable/kit/form-entities/NumberWithScaleInput/NumberWithScaleInput.js +3 -2
- package/build/esm/lib/unstable/kit/form-entities/PasswordInput/PasswordInput.js +3 -2
- package/build/esm/lib/unstable/kit/form-entities/RadioGroupInput/RadioGroupInput.js +3 -1
- package/build/esm/lib/unstable/kit/form-entities/RangeSliderInput/RangeSliderInput.js +9 -8
- package/build/esm/lib/unstable/kit/form-entities/SegmentedRadioGroupInput/SegmentedRadioGroupInput.js +3 -1
- package/build/esm/lib/unstable/kit/form-entities/SelectInput/SelectInput.js +4 -2
- package/build/esm/lib/unstable/kit/form-entities/SliderInput/SliderInput.js +3 -1
- package/build/esm/lib/unstable/kit/form-entities/StringInput/StringInput.js +3 -2
- package/build/esm/lib/unstable/kit/form-entities/StringNumberWithScaleInput/StringNumberWithScaleInput.js +4 -3
- package/build/esm/lib/unstable/kit/form-entities/SwitchInput/SwitchInput.js +3 -1
- package/build/esm/lib/unstable/kit/form-entities/TextAreaInput/TextAreaInput.js +3 -2
- package/build/esm/lib/unstable/kit/form-layouts/FormColumn/FormColumn.js +8 -6
- package/build/esm/lib/unstable/kit/form-layouts/FormRow/FormRow.js +8 -6
- package/build/esm/lib/unstable/kit/index.d.ts +1 -0
- package/build/esm/lib/unstable/kit/index.js +1 -0
- package/build/esm/lib/unstable/kit/layouts/Accordeon/Accordeon.js +6 -4
- package/build/esm/lib/unstable/kit/layouts/Card/Card.js +8 -6
- package/build/esm/lib/unstable/kit/layouts/Section/Section.js +8 -6
- package/build/esm/lib/unstable/kit/layouts/Transparent/Transparent.js +5 -3
- package/build/esm/lib/unstable/kit/overview-layouts/OverviewColumn/OverviewColumn.js +7 -5
- package/build/esm/lib/unstable/kit/overview-layouts/OverviewRow/OverviewRow.js +7 -5
- package/build/esm/lib/unstable/kit/utils/index.d.ts +1 -1
- package/build/esm/lib/unstable/kit/utils/index.js +1 -1
- package/build/esm/lib/unstable/kit/utils/transformer.d.ts +10 -17
- package/build/esm/lib/unstable/kit/utils/transformer.js +543 -2778
- package/package.json +1 -1
|
@@ -10,9 +10,10 @@ const constants_1 = require("../../constants");
|
|
|
10
10
|
const utils_1 = require("../../utils");
|
|
11
11
|
const b = (0, utils_1.block)('date-input');
|
|
12
12
|
const DateInput = ({ input, meta, props, schema, }) => {
|
|
13
|
-
var _a;
|
|
13
|
+
var _a, _b;
|
|
14
14
|
const { name, onBlur, onChange, onFocus, value: inputValue } = input;
|
|
15
15
|
const { format = constants_1.DEFAULT_DATE_FORMAT, outputFormat, timeZone: timeZoneProp } = props, restEntityProps = tslib_1.__rest(props, ["format", "outputFormat", "timeZone"]);
|
|
16
|
+
const { disabled } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
16
17
|
const timeZone = timeZoneProp && (0, date_utils_1.isValidTimeZone)(timeZoneProp) ? timeZoneProp : undefined;
|
|
17
18
|
const onUpdate = react_1.default.useCallback((date) => {
|
|
18
19
|
if (!date) {
|
|
@@ -42,6 +43,6 @@ const DateInput = ({ input, meta, props, schema, }) => {
|
|
|
42
43
|
}, [outputFormat, onChange]);
|
|
43
44
|
const value = react_1.default.useMemo(() => (0, utils_1.parseDate)(inputValue, outputFormat, timeZone), [inputValue, outputFormat, timeZone]);
|
|
44
45
|
return (react_1.default.createElement(components_1.EntityContainer, { stretch: "max", className: b({ error: (0, utils_1.getBooleanValidationState)(meta) }) },
|
|
45
|
-
react_1.default.createElement(date_components_1.DatePicker, Object.assign({ format: format, popupPlacement: "bottom-start", placeholder: `${((
|
|
46
|
+
react_1.default.createElement(date_components_1.DatePicker, Object.assign({ format: format, popupPlacement: "bottom-start", placeholder: `${((_b = schema.examples) === null || _b === void 0 ? void 0 : _b[0]) || ''}`, disabled: disabled || schema.readOnly, hasClear: true }, restEntityProps, { value: value, onFocus: onFocus, onBlur: onBlur, onUpdate: onUpdate, timeZone: timeZone, errorMessage: undefined, validationState: undefined, "data-qa": name }))));
|
|
46
47
|
};
|
|
47
48
|
exports.DateInput = DateInput;
|
|
@@ -9,8 +9,10 @@ const unstable_1 = require("@gravity-ui/uikit/unstable");
|
|
|
9
9
|
const components_1 = require("../../components");
|
|
10
10
|
const utils_1 = require("../../utils");
|
|
11
11
|
const FileInput = ({ input, meta, props, schema, }) => {
|
|
12
|
+
var _a;
|
|
12
13
|
const { onBlur, onChange, onFocus } = input;
|
|
13
14
|
const { readAsMethod = 'readAsBinaryString' } = props, restEntityProps = tslib_1.__rest(props, ["readAsMethod"]);
|
|
15
|
+
const { disabled } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
14
16
|
const counterRef = react_1.default.useRef(0);
|
|
15
17
|
const [file, setFile] = react_1.default.useState(null);
|
|
16
18
|
const actions = react_1.default.useMemo(() => [
|
|
@@ -48,6 +50,6 @@ const FileInput = ({ input, meta, props, schema, }) => {
|
|
|
48
50
|
react_1.default.createElement(uikit_1.FilePreview, { file: file, actions: actions })));
|
|
49
51
|
}
|
|
50
52
|
return (react_1.default.createElement(components_1.EntityContainer, { stretch: "max" },
|
|
51
|
-
react_1.default.createElement(unstable_1.unstable_FileDropZone, Object.assign({ disabled: schema.readOnly, accept: [] }, restEntityProps, { onUpdate: onUpdate, errorMessage: undefined, validationState: (0, utils_1.getValidationState)(meta), multiple: false }))));
|
|
53
|
+
react_1.default.createElement(unstable_1.unstable_FileDropZone, Object.assign({ disabled: disabled || schema.readOnly, accept: [] }, restEntityProps, { onUpdate: onUpdate, errorMessage: undefined, validationState: (0, utils_1.getValidationState)(meta), multiple: false }))));
|
|
52
54
|
};
|
|
53
55
|
exports.FileInput = FileInput;
|
|
@@ -6,11 +6,13 @@ const react_1 = tslib_1.__importDefault(require("react"));
|
|
|
6
6
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
7
7
|
const isString_1 = tslib_1.__importDefault(require("lodash/isString"));
|
|
8
8
|
const components_1 = require("../../components");
|
|
9
|
+
const constants_1 = require("../../constants");
|
|
9
10
|
const utils_1 = require("../../utils");
|
|
10
11
|
const MultiSelectInput = ({ input, meta, props, schema, }) => {
|
|
11
|
-
var _a, _b;
|
|
12
|
+
var _a, _b, _c;
|
|
12
13
|
const { name, onBlur, onChange, onFocus, value: inputValue } = input;
|
|
13
14
|
const { enumDescriptions, optionsMeta } = props, restEntityProps = tslib_1.__rest(props, ["enumDescriptions", "optionsMeta"]);
|
|
15
|
+
const { disabled } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
14
16
|
const value = react_1.default.useMemo(() => (Array.isArray(inputValue) && inputValue.every(isString_1.default) ? inputValue : undefined), [inputValue]);
|
|
15
17
|
const enumValues = schema.items && 'enum' in schema.items ? schema.items.enum : undefined;
|
|
16
18
|
const options = react_1.default.useMemo(() => {
|
|
@@ -33,6 +35,6 @@ const MultiSelectInput = ({ input, meta, props, schema, }) => {
|
|
|
33
35
|
const renderOption = react_1.default.useCallback((option) => (react_1.default.createElement(react_1.default.Fragment, { key: option.value }, option.content || option.text || option.value)), []);
|
|
34
36
|
const getOptionHeight = react_1.default.useCallback((option) => { var _a; return (((_a = option.data) === null || _a === void 0 ? void 0 : _a.optionMeta) ? 44 : 28); }, []);
|
|
35
37
|
return (react_1.default.createElement(components_1.EntityContainer, { stretch: "max" },
|
|
36
|
-
react_1.default.createElement(uikit_1.Select, Object.assign({ width: "max", options: options, filterable: ((enumValues === null || enumValues === void 0 ? void 0 : enumValues.length) || 0) > 9, renderOption: renderOption, getOptionHeight: getOptionHeight, placeholder: `${((
|
|
38
|
+
react_1.default.createElement(uikit_1.Select, Object.assign({ width: "max", options: options, filterable: ((enumValues === null || enumValues === void 0 ? void 0 : enumValues.length) || 0) > 9, renderOption: renderOption, getOptionHeight: getOptionHeight, placeholder: `${((_c = (_b = schema.examples) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c[0]) || constants_1.DASH}`, disabled: disabled || schema.readOnly }, restEntityProps, { value: value, onFocus: onFocus, onBlur: onBlur, onUpdate: onChange, errorMessage: undefined, validationState: (0, utils_1.getValidationState)(meta), multiple: true, qa: name }))));
|
|
37
39
|
};
|
|
38
40
|
exports.MultiSelectInput = MultiSelectInput;
|
|
@@ -8,9 +8,10 @@ const components_1 = require("../../components");
|
|
|
8
8
|
const utils_1 = require("../../utils");
|
|
9
9
|
const b = (0, utils_1.block)('number-input');
|
|
10
10
|
const NumberInput = ({ input, meta, props, schema, }) => {
|
|
11
|
-
var _a;
|
|
11
|
+
var _a, _b;
|
|
12
12
|
const { name, onBlur, onChange, onFocus, value } = input;
|
|
13
|
+
const { disabled } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
13
14
|
return (react_1.default.createElement(components_1.EntityContainer, { stretch: "max", className: b({ error: (0, utils_1.getBooleanValidationState)(meta) }) },
|
|
14
|
-
react_1.default.createElement(uikit_1.NumberInput, Object.assign({ min: schema.minimum, max: schema.maximum, step: schema.multipleOf || 1, placeholder: `${((
|
|
15
|
+
react_1.default.createElement(uikit_1.NumberInput, Object.assign({ min: schema.minimum, max: schema.maximum, step: schema.multipleOf || 1, placeholder: `${((_b = schema.examples) === null || _b === void 0 ? void 0 : _b[0]) || ''}`, disabled: disabled || schema.readOnly, allowDecimal: true, hasClear: true }, props, { value: value === undefined ? null : value, defaultValue: schema.default, onBlur: onBlur, onFocus: onFocus, onUpdate: onChange, errorMessage: undefined, validationState: (0, utils_1.getValidationState)(meta), qa: name }))));
|
|
15
16
|
};
|
|
16
17
|
exports.NumberInput = NumberInput;
|
package/build/cjs/lib/unstable/kit/form-entities/NumberWithScaleInput/NumberWithScaleInput.js
CHANGED
|
@@ -9,9 +9,10 @@ const components_1 = require("../../components");
|
|
|
9
9
|
const utils_1 = require("../../utils");
|
|
10
10
|
const b = (0, utils_1.block)('number-with-scale-input');
|
|
11
11
|
const NumberWithScaleInput = ({ input, meta, props, schema, }) => {
|
|
12
|
-
var _a;
|
|
12
|
+
var _a, _b;
|
|
13
13
|
const { name, onBlur, onChange, onFocus, value: inputValue } = input;
|
|
14
14
|
const { defaultType, viewType, scale, max, min, step } = props, restEntityProps = tslib_1.__rest(props, ["defaultType", "viewType", "scale", "max", "min", "step"]);
|
|
15
|
+
const { disabled } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
15
16
|
const scaleKit = react_1.default.useMemo(() => {
|
|
16
17
|
if (scale) {
|
|
17
18
|
const preparedScale = {};
|
|
@@ -69,7 +70,7 @@ const NumberWithScaleInput = ({ input, meta, props, schema, }) => {
|
|
|
69
70
|
}, [max, min, step, inputValue, onChange, scaleKit === null || scaleKit === void 0 ? void 0 : scaleKit.scale, scaleValue, schema]);
|
|
70
71
|
return (react_1.default.createElement(components_1.EntityContainer, { stretch: "max", className: b({ error: (0, utils_1.getBooleanValidationState)(meta) }), direction: "row", gap: 2 },
|
|
71
72
|
react_1.default.createElement("div", { className: b('input') },
|
|
72
|
-
react_1.default.createElement(uikit_1.NumberInput, Object.assign({ placeholder: `${((
|
|
73
|
+
react_1.default.createElement(uikit_1.NumberInput, Object.assign({ placeholder: `${((_b = schema.examples) === null || _b === void 0 ? void 0 : _b[0]) || ''}`, disabled: disabled || schema.readOnly, allowDecimal: true, hasClear: true }, restEntityProps, preparedInputProps, { onBlur: onBlur, onFocus: onFocus, errorMessage: undefined, validationState: (0, utils_1.getValidationState)(meta), qa: name }))),
|
|
73
74
|
scaleOptions.length ? (react_1.default.createElement("div", { style: { width: scaleKit === null || scaleKit === void 0 ? void 0 : scaleKit.minScaleLength } },
|
|
74
75
|
react_1.default.createElement(uikit_1.Select, { width: "max", options: scaleOptions, value: scaleValue, onUpdate: setScaleValue, multiple: false }))) : null));
|
|
75
76
|
};
|
|
@@ -8,9 +8,10 @@ const components_1 = require("../../components");
|
|
|
8
8
|
const utils_1 = require("../../utils");
|
|
9
9
|
const b = (0, utils_1.block)('password-input');
|
|
10
10
|
const PasswordInput = ({ input, meta, props, schema, }) => {
|
|
11
|
-
var _a;
|
|
11
|
+
var _a, _b;
|
|
12
12
|
const { name, onBlur, onChange, onFocus, value } = input;
|
|
13
|
+
const { disabled } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
13
14
|
return (react_1.default.createElement(components_1.EntityContainer, { stretch: "max", className: b({ error: (0, utils_1.getBooleanValidationState)(meta) }) },
|
|
14
|
-
react_1.default.createElement(uikit_1.PasswordInput, Object.assign({ autoComplete: "new-password", placeholder: (
|
|
15
|
+
react_1.default.createElement(uikit_1.PasswordInput, Object.assign({ autoComplete: "new-password", placeholder: (_b = schema.examples) === null || _b === void 0 ? void 0 : _b[0], disabled: disabled || schema.readOnly, hasClear: true }, props, { value: value !== null && value !== void 0 ? value : '', onFocus: onFocus, onBlur: onBlur, onUpdate: onChange, errorMessage: undefined, validationState: (0, utils_1.getValidationState)(meta), qa: name }))));
|
|
15
16
|
};
|
|
16
17
|
exports.PasswordInput = PasswordInput;
|
|
@@ -8,8 +8,10 @@ const components_1 = require("../../components");
|
|
|
8
8
|
const utils_1 = require("../../utils");
|
|
9
9
|
const b = (0, utils_1.block)('radio-group-input');
|
|
10
10
|
const RadioGroupInput = ({ input, meta, props, schema, }) => {
|
|
11
|
+
var _a;
|
|
11
12
|
const { name, onBlur, onChange, onFocus, value } = input;
|
|
12
13
|
const { enumDescriptions, optionsDisabled, direction = 'horizontal' } = props, restEntityProps = tslib_1.__rest(props, ["enumDescriptions", "optionsDisabled", "direction"]);
|
|
14
|
+
const { disabled } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
13
15
|
const options = react_1.default.useMemo(() => {
|
|
14
16
|
var _a;
|
|
15
17
|
return (_a = schema.enum) === null || _a === void 0 ? void 0 : _a.map((value) => ({
|
|
@@ -19,6 +21,6 @@ const RadioGroupInput = ({ input, meta, props, schema, }) => {
|
|
|
19
21
|
}));
|
|
20
22
|
}, [enumDescriptions, optionsDisabled, schema.enum]);
|
|
21
23
|
return (react_1.default.createElement(components_1.EntityContainer, { stretch: "fit", className: b({ error: (0, utils_1.getBooleanValidationState)(meta), direction }), justifyContent: "center" },
|
|
22
|
-
react_1.default.createElement(uikit_1.RadioGroup, Object.assign({ options: options, disabled: schema.readOnly }, restEntityProps, { value: value, onFocus: onFocus, onBlur: onBlur, onUpdate: onChange, direction: direction, qa: name }))));
|
|
24
|
+
react_1.default.createElement(uikit_1.RadioGroup, Object.assign({ options: options, disabled: disabled || schema.readOnly }, restEntityProps, { value: value, onFocus: onFocus, onBlur: onBlur, onUpdate: onChange, direction: direction, qa: name }))));
|
|
23
25
|
};
|
|
24
26
|
exports.RadioGroupInput = RadioGroupInput;
|
|
@@ -7,22 +7,23 @@ const uikit_1 = require("@gravity-ui/uikit");
|
|
|
7
7
|
const components_1 = require("../../components");
|
|
8
8
|
const utils_1 = require("../../utils");
|
|
9
9
|
const RangeSliderInput = ({ input, meta, props, schema, }) => {
|
|
10
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
10
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
11
11
|
const { name, onBlur, onChange, onFocus, value: inputValue } = input;
|
|
12
12
|
const { propertyKeys } = props, restEntityProps = tslib_1.__rest(props, ["propertyKeys"]);
|
|
13
|
+
const { disabled } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
13
14
|
const [fromKey, toKey] = propertyKeys || ['from', 'to'];
|
|
14
|
-
const min = ((
|
|
15
|
-
? (
|
|
15
|
+
const min = ((_b = schema.properties) === null || _b === void 0 ? void 0 : _b[fromKey]) && 'minimum' in schema.properties[fromKey]
|
|
16
|
+
? (_d = (_c = schema.properties) === null || _c === void 0 ? void 0 : _c[fromKey]) === null || _d === void 0 ? void 0 : _d.minimum
|
|
16
17
|
: undefined;
|
|
17
|
-
const max = ((
|
|
18
|
-
? (
|
|
18
|
+
const max = ((_e = schema.properties) === null || _e === void 0 ? void 0 : _e[toKey]) && 'maximum' in schema.properties[toKey]
|
|
19
|
+
? (_g = (_f = schema.properties) === null || _f === void 0 ? void 0 : _f[toKey]) === null || _g === void 0 ? void 0 : _g.maximum
|
|
19
20
|
: undefined;
|
|
20
21
|
const value = isNaN(Number(inputValue === null || inputValue === void 0 ? void 0 : inputValue[fromKey])) || isNaN(Number(inputValue === null || inputValue === void 0 ? void 0 : inputValue[toKey]))
|
|
21
22
|
? undefined
|
|
22
23
|
: [Number(inputValue === null || inputValue === void 0 ? void 0 : inputValue[fromKey]), Number(inputValue === null || inputValue === void 0 ? void 0 : inputValue[toKey])];
|
|
23
|
-
const defaultValue = isNaN(Number((
|
|
24
|
+
const defaultValue = isNaN(Number((_h = schema.default) === null || _h === void 0 ? void 0 : _h[fromKey])) || isNaN(Number((_j = schema.default) === null || _j === void 0 ? void 0 : _j[toKey]))
|
|
24
25
|
? undefined
|
|
25
|
-
: [Number((
|
|
26
|
+
: [Number((_k = schema.default) === null || _k === void 0 ? void 0 : _k[fromKey]), Number((_l = schema.default) === null || _l === void 0 ? void 0 : _l[toKey])];
|
|
26
27
|
const onUpdate = react_1.default.useCallback((next) => {
|
|
27
28
|
if (!Array.isArray(next)) {
|
|
28
29
|
return;
|
|
@@ -30,6 +31,6 @@ const RangeSliderInput = ({ input, meta, props, schema, }) => {
|
|
|
30
31
|
onChange({ [fromKey]: next[0], [toKey]: next[1] });
|
|
31
32
|
}, [fromKey, toKey, onChange]);
|
|
32
33
|
return (react_1.default.createElement(components_1.EntityContainer, { stretch: "max" },
|
|
33
|
-
react_1.default.createElement(uikit_1.Slider, Object.assign({ min: min, max: max, step: 1, marks: 2, disabled: schema.readOnly, tooltipDisplay: "on" }, restEntityProps, { defaultValue: defaultValue, value: value, onFocus: onFocus, onBlur: onBlur, onUpdate: onUpdate, errorMessage: undefined, validationState: (0, utils_1.getValidationState)(meta), qa: name }))));
|
|
34
|
+
react_1.default.createElement(uikit_1.Slider, Object.assign({ min: min, max: max, step: 1, marks: 2, disabled: disabled || schema.readOnly, tooltipDisplay: "on" }, restEntityProps, { defaultValue: defaultValue, value: value, onFocus: onFocus, onBlur: onBlur, onUpdate: onUpdate, errorMessage: undefined, validationState: (0, utils_1.getValidationState)(meta), qa: name }))));
|
|
34
35
|
};
|
|
35
36
|
exports.RangeSliderInput = RangeSliderInput;
|
|
@@ -8,8 +8,10 @@ const components_1 = require("../../components");
|
|
|
8
8
|
const utils_1 = require("../../utils");
|
|
9
9
|
const b = (0, utils_1.block)('segmented-radio-group-input');
|
|
10
10
|
const SegmentedRadioGroupInput = ({ input, meta, props, schema }) => {
|
|
11
|
+
var _a;
|
|
11
12
|
const { name, onBlur, onChange, onFocus, value } = input;
|
|
12
13
|
const { enumDescriptions, optionsDisabled } = props, restEntityProps = tslib_1.__rest(props, ["enumDescriptions", "optionsDisabled"]);
|
|
14
|
+
const { disabled } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
13
15
|
const options = react_1.default.useMemo(() => {
|
|
14
16
|
var _a;
|
|
15
17
|
return (_a = schema.enum) === null || _a === void 0 ? void 0 : _a.map((value) => ({
|
|
@@ -24,6 +26,6 @@ const SegmentedRadioGroupInput = ({ input, meta, props, schema }) => {
|
|
|
24
26
|
onBlur();
|
|
25
27
|
}, [onBlur, onChange, onFocus]);
|
|
26
28
|
return (react_1.default.createElement(components_1.EntityContainer, { stretch: "max", className: b({ error: (0, utils_1.getBooleanValidationState)(meta) }) },
|
|
27
|
-
react_1.default.createElement(uikit_1.SegmentedRadioGroup, Object.assign({ width: "max", disabled: schema.readOnly, options: options }, restEntityProps, { value: value, onFocus: onFocus, onBlur: onBlur, onUpdate: onUpdate, qa: name }))));
|
|
29
|
+
react_1.default.createElement(uikit_1.SegmentedRadioGroup, Object.assign({ width: "max", disabled: disabled || schema.readOnly, options: options }, restEntityProps, { value: value, onFocus: onFocus, onBlur: onBlur, onUpdate: onUpdate, qa: name }))));
|
|
28
30
|
};
|
|
29
31
|
exports.SegmentedRadioGroupInput = SegmentedRadioGroupInput;
|
|
@@ -6,11 +6,13 @@ const react_1 = tslib_1.__importDefault(require("react"));
|
|
|
6
6
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
7
7
|
const isString_1 = tslib_1.__importDefault(require("lodash/isString"));
|
|
8
8
|
const components_1 = require("../../components");
|
|
9
|
+
const constants_1 = require("../../constants");
|
|
9
10
|
const utils_1 = require("../../utils");
|
|
10
11
|
const SelectInput = ({ input, meta, props, schema, }) => {
|
|
11
|
-
var _a, _b;
|
|
12
|
+
var _a, _b, _c;
|
|
12
13
|
const { name, onBlur, onChange, onFocus, value: inputValue } = input;
|
|
13
14
|
const { enumDescriptions, optionsMeta } = props, restEntityProps = tslib_1.__rest(props, ["enumDescriptions", "optionsMeta"]);
|
|
15
|
+
const { disabled } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
14
16
|
const value = react_1.default.useMemo(() => ((0, isString_1.default)(inputValue) ? [inputValue] : undefined), [inputValue]);
|
|
15
17
|
const onUpdate = react_1.default.useCallback((v) => onChange(v[0]), [onChange]);
|
|
16
18
|
const options = react_1.default.useMemo(() => {
|
|
@@ -30,6 +32,6 @@ const SelectInput = ({ input, meta, props, schema, }) => {
|
|
|
30
32
|
const renderOption = react_1.default.useCallback((option) => (react_1.default.createElement(react_1.default.Fragment, { key: option.value }, option.content || option.text || option.value)), []);
|
|
31
33
|
const getOptionHeight = react_1.default.useCallback((option) => { var _a; return (((_a = option.data) === null || _a === void 0 ? void 0 : _a.optionMeta) ? 44 : 28); }, []);
|
|
32
34
|
return (react_1.default.createElement(components_1.EntityContainer, { stretch: "max" },
|
|
33
|
-
react_1.default.createElement(uikit_1.Select, Object.assign({ width: "max", options: options, filterable: (((
|
|
35
|
+
react_1.default.createElement(uikit_1.Select, Object.assign({ width: "max", options: options, filterable: (((_b = schema.enum) === null || _b === void 0 ? void 0 : _b.length) || 0) > 9, renderOption: renderOption, getOptionHeight: getOptionHeight, placeholder: ((_c = schema.examples) === null || _c === void 0 ? void 0 : _c[0]) || constants_1.DASH, disabled: disabled || schema.readOnly }, restEntityProps, { value: value, onFocus: onFocus, onBlur: onBlur, onUpdate: onUpdate, errorMessage: undefined, validationState: (0, utils_1.getValidationState)(meta), qa: name }))));
|
|
34
36
|
};
|
|
35
37
|
exports.SelectInput = SelectInput;
|
|
@@ -7,7 +7,9 @@ const uikit_1 = require("@gravity-ui/uikit");
|
|
|
7
7
|
const components_1 = require("../../components");
|
|
8
8
|
const utils_1 = require("../../utils");
|
|
9
9
|
const SliderInput = ({ input, meta, props, schema, }) => {
|
|
10
|
+
var _a;
|
|
10
11
|
const { name, onBlur, onChange, onFocus, value: inputValue } = input;
|
|
12
|
+
const { disabled } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
11
13
|
const value = isNaN(Number(inputValue)) ? undefined : Number(inputValue);
|
|
12
14
|
const onUpdate = react_1.default.useCallback((next) => {
|
|
13
15
|
if (Array.isArray(next)) {
|
|
@@ -16,6 +18,6 @@ const SliderInput = ({ input, meta, props, schema, }) => {
|
|
|
16
18
|
onChange(next);
|
|
17
19
|
}, [onChange]);
|
|
18
20
|
return (react_1.default.createElement(components_1.EntityContainer, { stretch: "max" },
|
|
19
|
-
react_1.default.createElement(uikit_1.Slider, Object.assign({ min: schema.minimum, max: schema.maximum, step: 1, marks: 2, disabled: schema.readOnly, tooltipDisplay: "on" }, props, { value: value, onFocus: onFocus, onBlur: onBlur, onUpdate: onUpdate, errorMessage: undefined, validationState: (0, utils_1.getValidationState)(meta), qa: name }))));
|
|
21
|
+
react_1.default.createElement(uikit_1.Slider, Object.assign({ min: schema.minimum, max: schema.maximum, step: 1, marks: 2, disabled: disabled || schema.readOnly, tooltipDisplay: "on" }, props, { value: value, onFocus: onFocus, onBlur: onBlur, onUpdate: onUpdate, errorMessage: undefined, validationState: (0, utils_1.getValidationState)(meta), qa: name }))));
|
|
20
22
|
};
|
|
21
23
|
exports.SliderInput = SliderInput;
|
|
@@ -8,8 +8,9 @@ const components_1 = require("../../components");
|
|
|
8
8
|
const utils_1 = require("../../utils");
|
|
9
9
|
const b = (0, utils_1.block)('string-input');
|
|
10
10
|
const StringInput = ({ input, meta, props, schema, }) => {
|
|
11
|
-
var _a, _b;
|
|
11
|
+
var _a, _b, _c;
|
|
12
|
+
const { disabled } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
12
13
|
return (react_1.default.createElement(components_1.EntityContainer, { stretch: "max", className: b({ error: (0, utils_1.getBooleanValidationState)(meta) }) },
|
|
13
|
-
react_1.default.createElement(uikit_1.TextInput, Object.assign({ placeholder: (
|
|
14
|
+
react_1.default.createElement(uikit_1.TextInput, Object.assign({ placeholder: (_b = schema.examples) === null || _b === void 0 ? void 0 : _b[0], disabled: disabled || schema.readOnly, hasClear: true }, props, { value: (_c = input.value) !== null && _c !== void 0 ? _c : '', onFocus: input.onFocus, onBlur: input.onBlur, onUpdate: input.onChange, errorMessage: undefined, validationState: (0, utils_1.getValidationState)(meta), qa: input.name, type: "text" }))));
|
|
14
15
|
};
|
|
15
16
|
exports.StringInput = StringInput;
|
|
@@ -9,9 +9,10 @@ const components_1 = require("../../components");
|
|
|
9
9
|
const utils_1 = require("../../utils");
|
|
10
10
|
const b = (0, utils_1.block)('string-number-with-scale-input');
|
|
11
11
|
const StringNumberWithScaleInput = ({ input, meta, props, schema }) => {
|
|
12
|
-
var _a;
|
|
12
|
+
var _a, _b;
|
|
13
13
|
const { name, onBlur, onChange, onFocus, value: inputValue } = input;
|
|
14
14
|
const { defaultType, viewType, scale } = props, restEntityProps = tslib_1.__rest(props, ["defaultType", "viewType", "scale"]);
|
|
15
|
+
const { disabled } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
15
16
|
const scaleKit = react_1.default.useMemo(() => {
|
|
16
17
|
if (scale) {
|
|
17
18
|
const preparedScale = {};
|
|
@@ -74,8 +75,8 @@ const StringNumberWithScaleInput = ({ input, meta, props, schema }) => {
|
|
|
74
75
|
}, [inputValue, onChange, scaleKit === null || scaleKit === void 0 ? void 0 : scaleKit.scale, scaleValue, schema]);
|
|
75
76
|
return (react_1.default.createElement(components_1.EntityContainer, { stretch: "max", className: b({ error: (0, utils_1.getBooleanValidationState)(meta) }), direction: "row", gap: 2 },
|
|
76
77
|
react_1.default.createElement("div", { className: b('input') },
|
|
77
|
-
react_1.default.createElement(uikit_1.TextInput, Object.assign({ placeholder: `${((
|
|
78
|
+
react_1.default.createElement(uikit_1.TextInput, Object.assign({ placeholder: `${((_b = schema.examples) === null || _b === void 0 ? void 0 : _b[0]) || ''}`, disabled: disabled || schema.readOnly, hasClear: true }, restEntityProps, preparedInputProps, { onBlur: onBlur, onFocus: onFocus, errorMessage: undefined, validationState: (0, utils_1.getValidationState)(meta), qa: name }))),
|
|
78
79
|
scaleOptions.length ? (react_1.default.createElement("div", { style: { width: scaleKit === null || scaleKit === void 0 ? void 0 : scaleKit.minScaleLength } },
|
|
79
|
-
react_1.default.createElement(uikit_1.Select, { width: "max", options: scaleOptions, value: scaleValue, onUpdate: setScaleValue, multiple: false, disabled: schema.readOnly || meta.error, qa: `${name}-scale` }))) : null));
|
|
80
|
+
react_1.default.createElement(uikit_1.Select, { width: "max", options: scaleOptions, value: scaleValue, onUpdate: setScaleValue, multiple: false, disabled: disabled || schema.readOnly || meta.error, qa: `${name}-scale` }))) : null));
|
|
80
81
|
};
|
|
81
82
|
exports.StringNumberWithScaleInput = StringNumberWithScaleInput;
|
|
@@ -8,13 +8,15 @@ const components_1 = require("../../components");
|
|
|
8
8
|
const utils_1 = require("../../utils");
|
|
9
9
|
const b = (0, utils_1.block)('switch-input');
|
|
10
10
|
const SwitchInput = ({ input, meta, props, schema, }) => {
|
|
11
|
+
var _a;
|
|
11
12
|
const { name, onBlur, onChange, onFocus, value } = input;
|
|
13
|
+
const { disabled } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
12
14
|
const onUpdate = react_1.default.useCallback((value) => {
|
|
13
15
|
onFocus();
|
|
14
16
|
onChange(value);
|
|
15
17
|
onBlur();
|
|
16
18
|
}, [onBlur, onChange, onFocus]);
|
|
17
19
|
return (react_1.default.createElement(components_1.EntityContainer, { stretch: "fit", className: b({ error: (0, utils_1.getBooleanValidationState)(meta) }), justifyContent: "center" },
|
|
18
|
-
react_1.default.createElement(uikit_1.Switch, Object.assign({ disabled: schema.readOnly }, props, { checked: value !== null && value !== void 0 ? value : false, onFocus: onFocus, onBlur: onBlur, onUpdate: onUpdate, qa: name }))));
|
|
20
|
+
react_1.default.createElement(uikit_1.Switch, Object.assign({ disabled: disabled || schema.readOnly }, props, { checked: value !== null && value !== void 0 ? value : false, onFocus: onFocus, onBlur: onBlur, onUpdate: onUpdate, qa: name }))));
|
|
19
21
|
};
|
|
20
22
|
exports.SwitchInput = SwitchInput;
|
|
@@ -8,8 +8,9 @@ const components_1 = require("../../components");
|
|
|
8
8
|
const utils_1 = require("../../utils");
|
|
9
9
|
const b = (0, utils_1.block)('text-area-input');
|
|
10
10
|
const TextAreaInput = ({ input, meta, props, schema, }) => {
|
|
11
|
-
var _a, _b;
|
|
11
|
+
var _a, _b, _c;
|
|
12
|
+
const { disabled } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
12
13
|
return (react_1.default.createElement(components_1.EntityContainer, { stretch: "max", className: b({ error: (0, utils_1.getBooleanValidationState)(meta) }) },
|
|
13
|
-
react_1.default.createElement(uikit_1.TextArea, Object.assign({ maxRows: 20, minRows: 0, placeholder: (
|
|
14
|
+
react_1.default.createElement(uikit_1.TextArea, Object.assign({ maxRows: 20, minRows: 0, placeholder: (_b = schema.examples) === null || _b === void 0 ? void 0 : _b[0], disabled: disabled || schema.readOnly, hasClear: true }, props, { value: (_c = input.value) !== null && _c !== void 0 ? _c : '', onFocus: input.onFocus, onBlur: input.onBlur, onUpdate: input.onChange, errorMessage: undefined, validationState: (0, utils_1.getValidationState)(meta), qa: input.name }))));
|
|
14
15
|
};
|
|
15
16
|
exports.TextAreaInput = TextAreaInput;
|
|
@@ -8,23 +8,25 @@ const components_1 = require("../../components");
|
|
|
8
8
|
const utils_1 = require("../../utils");
|
|
9
9
|
const b = (0, utils_1.block)('form-column');
|
|
10
10
|
const FormColumn = ({ children, headName, input, meta, schema, props, }) => {
|
|
11
|
+
var _a;
|
|
12
|
+
const { hidden, required } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
11
13
|
const tooltip = react_1.default.useMemo(() => {
|
|
12
14
|
if (!schema.description || props.descriptionType === 'bottom') {
|
|
13
15
|
return null;
|
|
14
16
|
}
|
|
15
17
|
return (react_1.default.createElement(uikit_1.HelpMark, { className: b('help-mark') },
|
|
16
|
-
react_1.default.createElement(components_1.HTMLContent, {
|
|
17
|
-
}, [schema.description, props.descriptionType]);
|
|
18
|
+
react_1.default.createElement(components_1.HTMLContent, { content: schema.description, headName: headName })));
|
|
19
|
+
}, [headName, schema.description, props.descriptionType]);
|
|
18
20
|
const bottomDescription = react_1.default.useMemo(() => {
|
|
19
21
|
if (!schema.description || props.descriptionType !== 'bottom') {
|
|
20
22
|
return null;
|
|
21
23
|
}
|
|
22
|
-
return react_1.default.createElement(components_1.HTMLContent, {
|
|
23
|
-
}, [schema.description, props.descriptionType]);
|
|
24
|
-
return (react_1.default.createElement(components_1.LayoutContainer, { className: b(), gap: 2 },
|
|
24
|
+
return react_1.default.createElement(components_1.HTMLContent, { content: schema.description, headName: headName, color: "secondary" });
|
|
25
|
+
}, [headName, schema.description, props.descriptionType]);
|
|
26
|
+
return (react_1.default.createElement(components_1.LayoutContainer, { className: b(), gap: 2, hidden: hidden },
|
|
25
27
|
react_1.default.createElement(uikit_1.Flex, { direction: "column", gap: 0.5 },
|
|
26
28
|
react_1.default.createElement("div", { className: b('top') },
|
|
27
|
-
react_1.default.createElement(uikit_1.Text, { className: b('title', { required
|
|
29
|
+
react_1.default.createElement(uikit_1.Text, { className: b('title', { required }), wordBreak: "break-word" }, schema.title),
|
|
28
30
|
tooltip,
|
|
29
31
|
react_1.default.createElement(components_1.ArrayRemoveButton, { name: input.name, headName: headName })),
|
|
30
32
|
bottomDescription),
|
|
@@ -8,22 +8,24 @@ const components_1 = require("../../components");
|
|
|
8
8
|
const utils_1 = require("../../utils");
|
|
9
9
|
const b = (0, utils_1.block)('form-row');
|
|
10
10
|
const FormRow = ({ children, headName, input, meta, schema, props, }) => {
|
|
11
|
+
var _a;
|
|
12
|
+
const { hidden, required } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
11
13
|
const tooltip = react_1.default.useMemo(() => {
|
|
12
14
|
if (!schema.description || props.descriptionType === 'bottom') {
|
|
13
15
|
return null;
|
|
14
16
|
}
|
|
15
17
|
return (react_1.default.createElement(uikit_1.HelpMark, { className: b('help-mark') },
|
|
16
|
-
react_1.default.createElement(components_1.HTMLContent, {
|
|
17
|
-
}, [schema.description, props.descriptionType]);
|
|
18
|
+
react_1.default.createElement(components_1.HTMLContent, { content: schema.description, headName: headName })));
|
|
19
|
+
}, [headName, schema.description, props.descriptionType]);
|
|
18
20
|
const bottomDescription = react_1.default.useMemo(() => {
|
|
19
21
|
if (!schema.description || props.descriptionType !== 'bottom') {
|
|
20
22
|
return null;
|
|
21
23
|
}
|
|
22
|
-
return react_1.default.createElement(components_1.HTMLContent, {
|
|
23
|
-
}, [schema.description, props.descriptionType]);
|
|
24
|
-
return (react_1.default.createElement(components_1.LayoutContainer, { className: b(), direction: "row", alignItems: "flex-start", gap: 2 },
|
|
24
|
+
return react_1.default.createElement(components_1.HTMLContent, { content: schema.description, headName: headName, color: "secondary" });
|
|
25
|
+
}, [headName, schema.description, props.descriptionType]);
|
|
26
|
+
return (react_1.default.createElement(components_1.LayoutContainer, { className: b(), direction: "row", alignItems: "flex-start", gap: 2, hidden: hidden },
|
|
25
27
|
react_1.default.createElement("div", { className: b('left') },
|
|
26
|
-
react_1.default.createElement(uikit_1.Text, { className: b('title', { required
|
|
28
|
+
react_1.default.createElement(uikit_1.Text, { className: b('title', { required }), wordBreak: "break-word" }, schema.title),
|
|
27
29
|
tooltip),
|
|
28
30
|
react_1.default.createElement(uikit_1.Flex, { className: b('right'), direction: "column", gap: 0.5, grow: 1 },
|
|
29
31
|
react_1.default.createElement(uikit_1.Flex, { grow: 1, gap: 2 },
|
|
@@ -6,6 +6,7 @@ tslib_1.__exportStar(require("./constants"), exports);
|
|
|
6
6
|
tslib_1.__exportStar(require("./entities"), exports);
|
|
7
7
|
tslib_1.__exportStar(require("./form-entities"), exports);
|
|
8
8
|
tslib_1.__exportStar(require("./form-layouts"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./layouts"), exports);
|
|
9
10
|
tslib_1.__exportStar(require("./overview-entities"), exports);
|
|
10
11
|
tslib_1.__exportStar(require("./overview-layouts"), exports);
|
|
11
12
|
tslib_1.__exportStar(require("./utils/common"), exports);
|
|
@@ -10,7 +10,9 @@ const components_1 = require("../../components");
|
|
|
10
10
|
const utils_1 = require("../../utils");
|
|
11
11
|
const b = (0, utils_1.block)('accordeon');
|
|
12
12
|
const Accordeon = ({ children, headName, input, meta, mode, schema, props, }) => {
|
|
13
|
-
|
|
13
|
+
var _a;
|
|
14
|
+
const { titleProps, togglerProps, withIndent = false, withDefaultSummary = false } = props, restLayoutProps = tslib_1.__rest(props, ["titleProps", "togglerProps", "withIndent", "withDefaultSummary"]);
|
|
15
|
+
const { copy, required, hidden, open } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
14
16
|
const overviewFlag = mode === core_1.SchemaRendererMode.Overview;
|
|
15
17
|
const summary = react_1.default.useMemo(() => {
|
|
16
18
|
const stopPropagation = (event) => {
|
|
@@ -22,7 +24,7 @@ const Accordeon = ({ children, headName, input, meta, mode, schema, props, }) =>
|
|
|
22
24
|
react_1.default.createElement(uikit_1.Icon, { data: props.expanded ? icons_1.ChevronUp : icons_1.ChevronDown }),
|
|
23
25
|
react_1.default.createElement(uikit_1.Text, Object.assign({}, titleProps, { className: b('title', { required: required && !overviewFlag }, titleProps === null || titleProps === void 0 ? void 0 : titleProps.className) }), schema.title)))))),
|
|
24
26
|
schema.description ? (react_1.default.createElement(uikit_1.HelpMark, { onClick: stopPropagation },
|
|
25
|
-
react_1.default.createElement(components_1.HTMLContent, {
|
|
27
|
+
react_1.default.createElement(components_1.HTMLContent, { content: schema.description, headName: headName }))) : null,
|
|
26
28
|
overviewFlag ? (react_1.default.createElement(components_1.CopyButton, { className: b('copy-button'), copy: copy, value: input.value })) : null,
|
|
27
29
|
overviewFlag ? null : (react_1.default.createElement(components_1.ArrayRemoveButton, { name: input.name, headName: headName, onClick: stopPropagation }))));
|
|
28
30
|
}, [
|
|
@@ -38,8 +40,8 @@ const Accordeon = ({ children, headName, input, meta, mode, schema, props, }) =>
|
|
|
38
40
|
togglerProps,
|
|
39
41
|
withDefaultSummary,
|
|
40
42
|
]);
|
|
41
|
-
return (react_1.default.createElement(components_1.LayoutContainer, { className: b({ 'without-default-summary': !withDefaultSummary }), hideEmpty: overviewFlag },
|
|
42
|
-
react_1.default.createElement(uikit_1.Disclosure, Object.assign({ summary: summary, defaultExpanded:
|
|
43
|
+
return (react_1.default.createElement(components_1.LayoutContainer, { className: b({ 'without-default-summary': !withDefaultSummary }), hideEmpty: overviewFlag, hidden: hidden },
|
|
44
|
+
react_1.default.createElement(uikit_1.Disclosure, Object.assign({ summary: summary, defaultExpanded: open }, restLayoutProps),
|
|
43
45
|
react_1.default.createElement(uikit_1.Flex, { direction: "column", gap: 0.5, grow: 1 },
|
|
44
46
|
react_1.default.createElement("div", { className: b('content', { 'with-indent': withIndent }) }, children),
|
|
45
47
|
overviewFlag ? null : (react_1.default.createElement(components_1.EntityError, { errorMessage: meta.error, validationState: (0, utils_1.getValidationState)(meta) }))))));
|
|
@@ -10,7 +10,9 @@ const components_1 = require("../../components");
|
|
|
10
10
|
const utils_1 = require("../../utils");
|
|
11
11
|
const b = (0, utils_1.block)('card');
|
|
12
12
|
const Card = ({ children, headName, input, meta, mode, schema, props, }) => {
|
|
13
|
-
|
|
13
|
+
var _a;
|
|
14
|
+
const { descriptionType = 'tooltip', likeAccordeon = true } = props, restLayoutProps = tslib_1.__rest(props, ["descriptionType", "likeAccordeon"]);
|
|
15
|
+
const { copy, required, hidden, open = true } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
14
16
|
const overviewFlag = mode === core_1.SchemaRendererMode.Overview;
|
|
15
17
|
const [visible, setVisible] = react_1.default.useState(likeAccordeon ? open : true);
|
|
16
18
|
const toggleVisible = react_1.default.useCallback(() => {
|
|
@@ -21,15 +23,15 @@ const Card = ({ children, headName, input, meta, mode, schema, props, }) => {
|
|
|
21
23
|
return null;
|
|
22
24
|
}
|
|
23
25
|
return (react_1.default.createElement(uikit_1.HelpMark, null,
|
|
24
|
-
react_1.default.createElement(components_1.HTMLContent, {
|
|
25
|
-
}, [schema.description, descriptionType]);
|
|
26
|
+
react_1.default.createElement(components_1.HTMLContent, { content: schema.description, headName: headName })));
|
|
27
|
+
}, [headName, schema.description, descriptionType]);
|
|
26
28
|
const bottomDescription = react_1.default.useMemo(() => {
|
|
27
29
|
if (!schema.description || descriptionType !== 'bottom' || overviewFlag) {
|
|
28
30
|
return null;
|
|
29
31
|
}
|
|
30
|
-
return react_1.default.createElement(components_1.HTMLContent, {
|
|
31
|
-
}, [schema.description, descriptionType, overviewFlag]);
|
|
32
|
-
return (react_1.default.createElement(components_1.LayoutContainer, { className: b(), hideEmpty: overviewFlag },
|
|
32
|
+
return react_1.default.createElement(components_1.HTMLContent, { content: schema.description, headName: headName, color: "secondary" });
|
|
33
|
+
}, [headName, schema.description, descriptionType, overviewFlag]);
|
|
34
|
+
return (react_1.default.createElement(components_1.LayoutContainer, { className: b(), hideEmpty: overviewFlag, hidden: hidden },
|
|
33
35
|
react_1.default.createElement(uikit_1.Card, Object.assign({}, restLayoutProps, { className: b('card') }),
|
|
34
36
|
react_1.default.createElement("div", { className: b('inner', { hidden: !visible }) },
|
|
35
37
|
react_1.default.createElement(uikit_1.Flex, { className: b('header'), direction: "column", justifyContent: "center" },
|
|
@@ -9,22 +9,24 @@ const components_1 = require("../../components");
|
|
|
9
9
|
const utils_1 = require("../../utils");
|
|
10
10
|
const b = (0, utils_1.block)('section');
|
|
11
11
|
const Section = ({ children, headName, input, meta, mode, schema, props, }) => {
|
|
12
|
-
|
|
12
|
+
var _a;
|
|
13
|
+
const { descriptionType = 'tooltip', withIndent = false } = props, restLayoutProps = tslib_1.__rest(props, ["descriptionType", "withIndent"]);
|
|
14
|
+
const { copy, required, hidden } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
13
15
|
const overviewFlag = mode === core_1.SchemaRendererMode.Overview;
|
|
14
16
|
const tooltip = react_1.default.useMemo(() => {
|
|
15
17
|
if (!schema.description || descriptionType === 'bottom') {
|
|
16
18
|
return null;
|
|
17
19
|
}
|
|
18
20
|
return (react_1.default.createElement(uikit_1.HelpMark, null,
|
|
19
|
-
react_1.default.createElement(components_1.HTMLContent, {
|
|
20
|
-
}, [schema.description, descriptionType]);
|
|
21
|
+
react_1.default.createElement(components_1.HTMLContent, { content: schema.description, headName: headName })));
|
|
22
|
+
}, [headName, schema.description, descriptionType]);
|
|
21
23
|
const bottomDescription = react_1.default.useMemo(() => {
|
|
22
24
|
if (!schema.description || descriptionType !== 'bottom' || overviewFlag) {
|
|
23
25
|
return null;
|
|
24
26
|
}
|
|
25
|
-
return (react_1.default.createElement(components_1.HTMLContent, { className: (0, uikit_1.spacing)({ mb: 2 }),
|
|
26
|
-
}, [schema.description, descriptionType, overviewFlag]);
|
|
27
|
-
return (react_1.default.createElement(components_1.LayoutContainer, { className: b(), gap: 0.5, hideEmpty: overviewFlag },
|
|
27
|
+
return (react_1.default.createElement(components_1.HTMLContent, { className: (0, uikit_1.spacing)({ mb: 2 }), content: schema.description, color: "secondary", headName: headName }));
|
|
28
|
+
}, [headName, schema.description, descriptionType, overviewFlag]);
|
|
29
|
+
return (react_1.default.createElement(components_1.LayoutContainer, { className: b(), gap: 0.5, hideEmpty: overviewFlag, hidden: hidden },
|
|
28
30
|
react_1.default.createElement(uikit_1.Flex, { direction: "column", gap: 4 },
|
|
29
31
|
react_1.default.createElement(uikit_1.Flex, { direction: "column" },
|
|
30
32
|
react_1.default.createElement(uikit_1.Flex, { className: b('header'), gap: 2, alignItems: "center" },
|
|
@@ -9,13 +9,15 @@ const core_1 = require("../../../core");
|
|
|
9
9
|
const components_1 = require("../../components");
|
|
10
10
|
const utils_1 = require("../../utils");
|
|
11
11
|
const b = (0, utils_1.block)('transparent');
|
|
12
|
-
const Transparent = ({ children, headName, input, meta, mode, props, }) => {
|
|
12
|
+
const Transparent = ({ children, headName, input, meta, mode, props, schema, }) => {
|
|
13
|
+
var _a;
|
|
14
|
+
const { copy, hidden } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
13
15
|
const overviewFlag = mode === core_1.SchemaRendererMode.Overview;
|
|
14
|
-
return (react_1.default.createElement(components_1.LayoutContainer, { className: b(), gap: 0.5, hideEmpty: (0, isBoolean_1.default)(props.hideEmpty) ? props.hideEmpty : overviewFlag },
|
|
16
|
+
return (react_1.default.createElement(components_1.LayoutContainer, { className: b(), gap: 0.5, hideEmpty: (0, isBoolean_1.default)(props.hideEmpty) ? props.hideEmpty : overviewFlag, hidden: hidden },
|
|
15
17
|
react_1.default.createElement(uikit_1.Flex, { gap: 2 },
|
|
16
18
|
children,
|
|
17
19
|
overviewFlag ? null : react_1.default.createElement(components_1.ArrayRemoveButton, { name: input.name, headName: headName }),
|
|
18
|
-
overviewFlag ? (react_1.default.createElement(components_1.CopyButton, { className: b('copy-button'), copy:
|
|
20
|
+
overviewFlag ? (react_1.default.createElement(components_1.CopyButton, { className: b('copy-button'), copy: copy, value: input.value })) : null),
|
|
19
21
|
overviewFlag ? null : (react_1.default.createElement(components_1.EntityError, { errorMessage: meta.error, validationState: (0, utils_1.getValidationState)(meta) }))));
|
|
20
22
|
};
|
|
21
23
|
exports.Transparent = Transparent;
|
|
@@ -7,15 +7,17 @@ const uikit_1 = require("@gravity-ui/uikit");
|
|
|
7
7
|
const components_1 = require("../../components");
|
|
8
8
|
const utils_1 = require("../../utils");
|
|
9
9
|
const b = (0, utils_1.block)('overview-column');
|
|
10
|
-
const OverviewColumn = ({ children, input, schema
|
|
10
|
+
const OverviewColumn = ({ children, headName, input, schema }) => {
|
|
11
|
+
var _a;
|
|
12
|
+
const { copy, hidden } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
11
13
|
const tooltip = react_1.default.useMemo(() => {
|
|
12
14
|
if (!schema.description) {
|
|
13
15
|
return null;
|
|
14
16
|
}
|
|
15
17
|
return (react_1.default.createElement(uikit_1.HelpMark, { className: b('help-mark') },
|
|
16
|
-
react_1.default.createElement(components_1.HTMLContent, {
|
|
17
|
-
}, [schema.description]);
|
|
18
|
-
return (react_1.default.createElement(components_1.LayoutContainer, { className: b(), gap: 2, hideEmpty: true },
|
|
18
|
+
react_1.default.createElement(components_1.HTMLContent, { content: schema.description, headName: headName })));
|
|
19
|
+
}, [headName, schema.description]);
|
|
20
|
+
return (react_1.default.createElement(components_1.LayoutContainer, { className: b(), gap: 2, hidden: hidden, hideEmpty: true },
|
|
19
21
|
react_1.default.createElement(uikit_1.Flex, { direction: "column", gap: 0.5, grow: 1 },
|
|
20
22
|
react_1.default.createElement("div", { className: b('top') },
|
|
21
23
|
react_1.default.createElement(uikit_1.Text, { className: b('title'), color: "secondary", wordBreak: "break-word" }, schema.title),
|
|
@@ -23,6 +25,6 @@ const OverviewColumn = ({ children, input, schema, props }) => {
|
|
|
23
25
|
react_1.default.createElement(uikit_1.Flex, { className: b('bottom'), direction: "column", gap: 0.5, grow: 1 },
|
|
24
26
|
react_1.default.createElement(uikit_1.Flex, { grow: 1, gap: 2 },
|
|
25
27
|
children,
|
|
26
|
-
react_1.default.createElement(components_1.CopyButton, { className: b('copy-button'), copy:
|
|
28
|
+
react_1.default.createElement(components_1.CopyButton, { className: b('copy-button'), copy: copy, value: input.value })))));
|
|
27
29
|
};
|
|
28
30
|
exports.OverviewColumn = OverviewColumn;
|
|
@@ -7,15 +7,17 @@ const uikit_1 = require("@gravity-ui/uikit");
|
|
|
7
7
|
const components_1 = require("../../components");
|
|
8
8
|
const utils_1 = require("../../utils");
|
|
9
9
|
const b = (0, utils_1.block)('overview-row');
|
|
10
|
-
const OverviewRow = ({ children, input, schema
|
|
10
|
+
const OverviewRow = ({ children, headName, input, schema }) => {
|
|
11
|
+
var _a;
|
|
12
|
+
const { copy, hidden } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
11
13
|
const tooltip = react_1.default.useMemo(() => {
|
|
12
14
|
if (!schema.description) {
|
|
13
15
|
return null;
|
|
14
16
|
}
|
|
15
17
|
return (react_1.default.createElement(uikit_1.HelpMark, { className: b('help-mark') },
|
|
16
|
-
react_1.default.createElement(components_1.HTMLContent, {
|
|
17
|
-
}, [schema.description]);
|
|
18
|
-
return (react_1.default.createElement(components_1.LayoutContainer, { className: b(), direction: "row", alignItems: "flex-start", gap: 2, hideEmpty: true },
|
|
18
|
+
react_1.default.createElement(components_1.HTMLContent, { content: schema.description, headName: headName })));
|
|
19
|
+
}, [headName, schema.description]);
|
|
20
|
+
return (react_1.default.createElement(components_1.LayoutContainer, { className: b(), direction: "row", alignItems: "flex-start", gap: 2, hidden: hidden, hideEmpty: true },
|
|
19
21
|
react_1.default.createElement("div", { className: b('left') },
|
|
20
22
|
react_1.default.createElement(uikit_1.Text, { className: b('title'), color: "secondary", wordBreak: "break-all" }, schema.title),
|
|
21
23
|
tooltip,
|
|
@@ -23,6 +25,6 @@ const OverviewRow = ({ children, input, schema, props }) => {
|
|
|
23
25
|
react_1.default.createElement(uikit_1.Flex, { className: b('right'), direction: "column", gap: 0.5, grow: 1 },
|
|
24
26
|
react_1.default.createElement(uikit_1.Flex, { grow: 1, gap: 2 },
|
|
25
27
|
children,
|
|
26
|
-
react_1.default.createElement(components_1.CopyButton, { className: b('copy-button'), copy:
|
|
28
|
+
react_1.default.createElement(components_1.CopyButton, { className: b('copy-button'), copy: copy, value: input.value })))));
|
|
27
29
|
};
|
|
28
30
|
exports.OverviewRow = OverviewRow;
|