@gravity-ui/dynamic-forms 3.7.0 → 4.0.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/core/components/Form/Controller/Controller.js +2 -2
- package/build/cjs/lib/core/components/Form/Controller/utils.js +45 -34
- package/build/cjs/lib/core/components/Form/DynamicField.js +6 -4
- package/build/cjs/lib/core/components/Form/hooks/useCreateContext.js +2 -2
- package/build/cjs/lib/core/components/Form/hooks/useCreateSearchContext.js +2 -2
- package/build/cjs/lib/core/components/Form/hooks/useIntegrationFF.js +6 -4
- package/build/cjs/lib/core/components/Form/hooks/useMutators.js +11 -7
- package/build/cjs/lib/core/components/Form/hooks/useSearchStore.js +4 -3
- package/build/cjs/lib/core/components/Form/hooks/useStore.js +15 -11
- package/build/cjs/lib/core/components/Form/utils/common.js +14 -11
- package/build/cjs/lib/core/components/View/helpers.js +5 -5
- package/build/cjs/lib/core/components/View/hooks/useComponents.js +2 -2
- package/build/cjs/lib/core/components/View/hooks/useCreateContext.js +2 -2
- package/build/cjs/lib/core/components/View/hooks/useRender.js +4 -3
- package/build/cjs/lib/core/helpers.js +5 -4
- package/build/cjs/lib/kit/components/AccordeonCard/AccordeonCard.js +2 -2
- package/build/cjs/lib/kit/components/Card/Card.css +3 -2
- package/build/cjs/lib/kit/components/Card/Card.js +2 -2
- package/build/cjs/lib/kit/components/CopyButton/CopyButton.js +1 -1
- package/build/cjs/lib/kit/components/ErrorWrapper/ErrorWrapper.css +4 -1
- package/build/cjs/lib/kit/components/GenerateRandomValueButton/GenerateRandomValueButton.js +2 -2
- package/build/cjs/lib/kit/components/Inputs/ArrayBase/ArrayBase.js +2 -2
- package/build/cjs/lib/kit/components/Inputs/CardOneOf/CardOneOf.js +2 -2
- package/build/cjs/lib/kit/components/Inputs/MonacoInput/MonacoInputDialog.css +2 -2
- package/build/cjs/lib/kit/components/Inputs/MultiOneOf/MultiOneOf.js +4 -3
- package/build/cjs/lib/kit/components/Inputs/ObjectBase/ObjectBase.js +4 -3
- package/build/cjs/lib/kit/components/Inputs/ObjectValueInput/ObjectValueInput.js +4 -3
- package/build/cjs/lib/kit/components/Inputs/OneOf/OneOf.js +2 -2
- package/build/cjs/lib/kit/components/Inputs/Secret/Secret.js +4 -3
- package/build/cjs/lib/kit/components/Inputs/TableArrayInput/TableArrayInput.css +8 -2
- package/build/cjs/lib/kit/components/Inputs/TableArrayInput/TableArrayInput.js +4 -3
- package/build/cjs/lib/kit/components/Inputs/Text/Text.js +2 -2
- package/build/cjs/lib/kit/components/Inputs/TextContent/TextContent.css +2 -2
- package/build/cjs/lib/kit/components/Inputs/TextContent/TextContent.js +2 -2
- package/build/cjs/lib/kit/components/Inputs/TextLink/TextLink.js +4 -3
- package/build/cjs/lib/kit/components/Layouts/Row/Row.css +2 -2
- package/build/cjs/lib/kit/components/Layouts/Row/Row.js +2 -2
- package/build/cjs/lib/kit/components/Layouts/Section/Section.css +2 -2
- package/build/cjs/lib/kit/components/LazyLoader/LazyLoader.js +2 -2
- package/build/cjs/lib/kit/components/LongValue/LongValue.css +3 -0
- package/build/cjs/lib/kit/components/LongValue/LongValue.js +1 -1
- package/build/cjs/lib/kit/components/SimpleVerticalAccordeon/SimpleVerticalAccordeon.css +2 -2
- package/build/cjs/lib/kit/components/ViewLayouts/ViewAccordeon/ViewAccordeon.js +2 -2
- package/build/cjs/lib/kit/components/ViewLayouts/ViewAccordeonCard/ViewAccordeonCard.js +2 -2
- package/build/cjs/lib/kit/components/ViewLayouts/ViewCardAccordeon.js +2 -2
- package/build/cjs/lib/kit/components/Views/ArrayBaseView/ArrayBaseView.js +2 -2
- package/build/cjs/lib/kit/components/Views/BaseView/BaseView.js +2 -2
- package/build/cjs/lib/kit/components/Views/CardOneOfView.js +2 -2
- package/build/cjs/lib/kit/components/Views/MonacoInputView/MonacoViewDialog.css +1 -1
- package/build/cjs/lib/kit/components/Views/MultiOneOfView/MultiOneOfView.js +2 -2
- package/build/cjs/lib/kit/components/Views/ObjectBaseView/ObjectBaseView.js +2 -2
- package/build/cjs/lib/kit/components/Views/ObjectValueInputView/ObjectValueInputView.js +2 -2
- package/build/cjs/lib/kit/components/Views/OneOfView/OneOfView.js +2 -2
- package/build/cjs/lib/kit/components/Views/TextLinkView/TextLinkView.js +2 -2
- package/build/cjs/lib/kit/hooks/useOneOf/useOneOf.js +5 -4
- package/build/cjs/lib/kit/utils/common.js +30 -25
- package/build/cjs/lib/kit/validators/validators.js +9 -7
- package/build/esm/lib/core/components/Form/Controller/Controller.d.ts +1 -1
- package/build/esm/lib/core/components/Form/Controller/Controller.js +2 -2
- package/build/esm/lib/core/components/Form/Controller/types.d.ts +6 -6
- package/build/esm/lib/core/components/Form/Controller/utils.d.ts +10 -10
- package/build/esm/lib/core/components/Form/Controller/utils.js +45 -34
- package/build/esm/lib/core/components/Form/DynamicField.js +6 -4
- package/build/esm/lib/core/components/Form/hooks/useCreateContext.js +2 -2
- package/build/esm/lib/core/components/Form/hooks/useCreateSearchContext.js +2 -2
- package/build/esm/lib/core/components/Form/hooks/useGenerateRandomValue.d.ts +1 -1
- package/build/esm/lib/core/components/Form/hooks/useIntegrationFF.js +6 -4
- package/build/esm/lib/core/components/Form/hooks/useMutators.js +11 -7
- package/build/esm/lib/core/components/Form/hooks/useSearchStore.js +4 -3
- package/build/esm/lib/core/components/Form/hooks/useStore.js +15 -11
- package/build/esm/lib/core/components/Form/types/array.d.ts +12 -12
- package/build/esm/lib/core/components/Form/types/boolean.d.ts +12 -12
- package/build/esm/lib/core/components/Form/types/config.d.ts +1 -1
- package/build/esm/lib/core/components/Form/types/input.d.ts +13 -13
- package/build/esm/lib/core/components/Form/types/layout.d.ts +5 -5
- package/build/esm/lib/core/components/Form/types/number.d.ts +12 -12
- package/build/esm/lib/core/components/Form/types/object.d.ts +12 -12
- package/build/esm/lib/core/components/Form/types/string.d.ts +12 -12
- package/build/esm/lib/core/components/Form/utils/common.js +14 -11
- package/build/esm/lib/core/components/View/ViewController.d.ts +1 -1
- package/build/esm/lib/core/components/View/helpers.js +5 -5
- package/build/esm/lib/core/components/View/hooks/useComponents.d.ts +1 -1
- package/build/esm/lib/core/components/View/hooks/useComponents.js +2 -2
- package/build/esm/lib/core/components/View/hooks/useCreateContext.js +2 -2
- package/build/esm/lib/core/components/View/hooks/useRender.d.ts +1 -1
- package/build/esm/lib/core/components/View/hooks/useRender.js +4 -3
- package/build/esm/lib/core/helpers.d.ts +5 -5
- package/build/esm/lib/core/helpers.js +5 -4
- package/build/esm/lib/core/types/specs.d.ts +6 -6
- package/build/esm/lib/kit/components/AccordeonCard/AccordeonCard.js +2 -2
- package/build/esm/lib/kit/components/Card/Card.css +3 -2
- package/build/esm/lib/kit/components/Card/Card.js +2 -2
- package/build/esm/lib/kit/components/CopyButton/CopyButton.js +1 -1
- package/build/esm/lib/kit/components/ErrorWrapper/ErrorWrapper.css +4 -1
- package/build/esm/lib/kit/components/GenerateRandomValueButton/GenerateRandomValueButton.js +2 -2
- package/build/esm/lib/kit/components/Inputs/ArrayBase/ArrayBase.js +2 -2
- package/build/esm/lib/kit/components/Inputs/CardOneOf/CardOneOf.js +2 -2
- package/build/esm/lib/kit/components/Inputs/MonacoInput/MonacoInputDialog.css +2 -2
- package/build/esm/lib/kit/components/Inputs/MultiOneOf/MultiOneOf.js +4 -3
- package/build/esm/lib/kit/components/Inputs/ObjectBase/ObjectBase.js +4 -3
- package/build/esm/lib/kit/components/Inputs/ObjectValueInput/ObjectValueInput.js +4 -3
- package/build/esm/lib/kit/components/Inputs/OneOf/OneOf.js +2 -2
- package/build/esm/lib/kit/components/Inputs/Secret/Secret.js +4 -3
- package/build/esm/lib/kit/components/Inputs/TableArrayInput/TableArrayInput.css +8 -2
- package/build/esm/lib/kit/components/Inputs/TableArrayInput/TableArrayInput.js +4 -3
- package/build/esm/lib/kit/components/Inputs/Text/Text.js +2 -2
- package/build/esm/lib/kit/components/Inputs/TextContent/TextContent.css +2 -2
- package/build/esm/lib/kit/components/Inputs/TextContent/TextContent.js +2 -2
- package/build/esm/lib/kit/components/Inputs/TextLink/TextLink.js +4 -3
- package/build/esm/lib/kit/components/Layouts/Accordeon/Accordeon.d.ts +1 -1
- package/build/esm/lib/kit/components/Layouts/AccordeonCard/AccordeonCardForm.d.ts +1 -1
- package/build/esm/lib/kit/components/Layouts/CardAccordeon.d.ts +1 -1
- package/build/esm/lib/kit/components/Layouts/CardSection.d.ts +1 -1
- package/build/esm/lib/kit/components/Layouts/Row/Row.css +2 -2
- package/build/esm/lib/kit/components/Layouts/Row/Row.d.ts +2 -2
- package/build/esm/lib/kit/components/Layouts/Row/Row.js +2 -2
- package/build/esm/lib/kit/components/Layouts/Section/Section.css +2 -2
- package/build/esm/lib/kit/components/Layouts/Section/Section.d.ts +6 -6
- package/build/esm/lib/kit/components/Layouts/TableCell/TableCell.d.ts +1 -1
- package/build/esm/lib/kit/components/Layouts/Transparent/Transparent.d.ts +1 -1
- package/build/esm/lib/kit/components/LazyLoader/LazyLoader.js +2 -2
- package/build/esm/lib/kit/components/LongValue/LongValue.css +3 -0
- package/build/esm/lib/kit/components/LongValue/LongValue.js +1 -1
- package/build/esm/lib/kit/components/SimpleVerticalAccordeon/SimpleVerticalAccordeon.css +2 -2
- package/build/esm/lib/kit/components/ViewLayouts/ViewAccordeon/ViewAccordeon.js +2 -2
- package/build/esm/lib/kit/components/ViewLayouts/ViewAccordeonCard/ViewAccordeonCard.js +2 -2
- package/build/esm/lib/kit/components/ViewLayouts/ViewCardAccordeon.js +2 -2
- package/build/esm/lib/kit/components/ViewLayouts/ViewCardSection.d.ts +1 -1
- package/build/esm/lib/kit/components/ViewLayouts/ViewRow/ViewRow.d.ts +1 -1
- package/build/esm/lib/kit/components/ViewLayouts/ViewSection/ViewSection.d.ts +4 -4
- package/build/esm/lib/kit/components/ViewLayouts/ViewTableCell/ViewTableCell.d.ts +1 -1
- package/build/esm/lib/kit/components/ViewLayouts/ViewTransparent/ViewTransparent.d.ts +1 -1
- package/build/esm/lib/kit/components/Views/ArrayBaseView/ArrayBaseView.js +2 -2
- package/build/esm/lib/kit/components/Views/BaseView/BaseView.js +2 -2
- package/build/esm/lib/kit/components/Views/CardOneOfView.js +2 -2
- package/build/esm/lib/kit/components/Views/MonacoInputView/MonacoViewDialog.css +1 -1
- package/build/esm/lib/kit/components/Views/MultiOneOfView/MultiOneOfView.js +2 -2
- package/build/esm/lib/kit/components/Views/ObjectBaseView/ObjectBaseView.js +2 -2
- package/build/esm/lib/kit/components/Views/ObjectValueInputView/ObjectValueInputView.js +2 -2
- package/build/esm/lib/kit/components/Views/OneOfView/OneOfView.js +2 -2
- package/build/esm/lib/kit/components/Views/TextLinkView/TextLinkView.js +2 -2
- package/build/esm/lib/kit/hooks/useOneOf/useOneOf.d.ts +1 -1
- package/build/esm/lib/kit/hooks/useOneOf/useOneOf.js +5 -4
- package/build/esm/lib/kit/utils/common.d.ts +1 -1
- package/build/esm/lib/kit/utils/common.js +30 -25
- package/build/esm/lib/kit/utils/objectInline.d.ts +1 -1
- package/build/esm/lib/kit/validators/validators.js +9 -7
- package/package.json +11 -11
|
@@ -48,15 +48,16 @@
|
|
|
48
48
|
margin-left: 10px;
|
|
49
49
|
}
|
|
50
50
|
.df-card__title {
|
|
51
|
+
display: flex;
|
|
51
52
|
max-width: 533px;
|
|
52
53
|
}
|
|
53
54
|
.df-card__note {
|
|
54
55
|
margin-left: 5px;
|
|
55
56
|
}
|
|
56
|
-
.df-card__note .
|
|
57
|
+
.df-card__note .gc-help-popover {
|
|
57
58
|
display: flex;
|
|
58
59
|
}
|
|
59
|
-
.df-card__note .
|
|
60
|
+
.df-card__note .gc-help-popover > span {
|
|
60
61
|
display: flex;
|
|
61
62
|
}
|
|
62
63
|
.df-card__toggler-icon_open {
|
|
@@ -6,7 +6,7 @@ const react_1 = tslib_1.__importDefault(require("react"));
|
|
|
6
6
|
const components_1 = require("@gravity-ui/components");
|
|
7
7
|
const icons_1 = require("@gravity-ui/icons");
|
|
8
8
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
9
|
-
const
|
|
9
|
+
const isString_1 = tslib_1.__importDefault(require("lodash/isString"));
|
|
10
10
|
const common_1 = require("../../constants/common");
|
|
11
11
|
const utils_1 = require("../../utils");
|
|
12
12
|
const b = (0, utils_1.block)('card');
|
|
@@ -35,7 +35,7 @@ const Card = ({ name, title: propsTitle, description, actions, open: propsOpen,
|
|
|
35
35
|
const preventEvent = react_1.default.useCallback((e) => e.stopPropagation(), []);
|
|
36
36
|
const titlePopoverDisabled = (((_a = titleRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) || 0) <= common_1.COMMON_TITLE_MAX_WIDTH;
|
|
37
37
|
const title = react_1.default.useMemo(() => {
|
|
38
|
-
if (
|
|
38
|
+
if ((0, isString_1.default)(propsTitle)) {
|
|
39
39
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
40
40
|
react_1.default.createElement(uikit_1.Popover, { content: propsTitle, disabled: titlePopoverDisabled, placement: common_1.COMMON_POPOVER_PLACEMENT },
|
|
41
41
|
react_1.default.createElement(uikit_1.Text, { className: b('title'), ellipsis: true, ref: titleRef, variant: "subheader-2" }, propsTitle)),
|
|
@@ -13,7 +13,7 @@ const b = (0, utils_1.block)('copy-button');
|
|
|
13
13
|
*/
|
|
14
14
|
const CopyButton = ({ spec, value }) => {
|
|
15
15
|
if (((0, core_1.isStringSpec)(spec) || (0, core_1.isNumberSpec)(spec)) && spec.viewSpec.copy) {
|
|
16
|
-
return react_1.default.createElement(uikit_1.ClipboardButton, { className: b(), text: `${value}`, size:
|
|
16
|
+
return react_1.default.createElement(uikit_1.ClipboardButton, { className: b(), text: `${value}`, size: "s" });
|
|
17
17
|
}
|
|
18
18
|
return null;
|
|
19
19
|
};
|
|
@@ -16,7 +16,10 @@
|
|
|
16
16
|
.df-error-wrapper_error .g-text-area__content:hover:not(.df-error-wrapper-ignore),
|
|
17
17
|
.df-error-wrapper_error .yc-text-input_view_normal:not(.df-error-wrapper-ignore) .yc-text-input__control,
|
|
18
18
|
.df-error-wrapper_error .yc-text-input_view_normal:not(.df-error-wrapper-ignore) .yc-text-input__content,
|
|
19
|
-
.df-error-wrapper_error .
|
|
19
|
+
.df-error-wrapper_error .g-text-input_view_normal:not(.df-error-wrapper-ignore) .g-text-input__control,
|
|
20
|
+
.df-error-wrapper_error .g-text-input_view_normal:not(.df-error-wrapper-ignore) .g-text-input__content,
|
|
21
|
+
.df-error-wrapper_error .yc-checkbox__indicator:not(.df-error-wrapper-ignore)::before,
|
|
22
|
+
.df-error-wrapper_error .g-checkbox__indicator:not(.df-error-wrapper-ignore)::before {
|
|
20
23
|
border-color: var(--g-color-text-danger);
|
|
21
24
|
}
|
|
22
25
|
.df-error-wrapper__error-text {
|
|
@@ -4,14 +4,14 @@ exports.GenerateRandomValueButton = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
6
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
7
|
-
const
|
|
7
|
+
const isFunction_1 = tslib_1.__importDefault(require("lodash/isFunction"));
|
|
8
8
|
const hooks_1 = require("../../../core/components/Form/hooks");
|
|
9
9
|
const i18n_1 = tslib_1.__importDefault(require("../../i18n"));
|
|
10
10
|
const utils_1 = require("../../utils");
|
|
11
11
|
const b = (0, utils_1.block)('generate-random-value-button');
|
|
12
12
|
const GenerateRandomValueButton = ({ spec, onChange, }) => {
|
|
13
13
|
const generateRandomValue = (0, hooks_1.useGenerateRandomValue)();
|
|
14
|
-
if (
|
|
14
|
+
if ((0, isFunction_1.default)(generateRandomValue) && spec.viewSpec.generateRandomValueButton) {
|
|
15
15
|
return (react_1.default.createElement(uikit_1.Button, { onClick: () => onChange(generateRandomValue(spec)), className: b() }, (0, i18n_1.default)('button-generate')));
|
|
16
16
|
}
|
|
17
17
|
return null;
|
|
@@ -5,7 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
6
|
const icons_1 = require("@gravity-ui/icons");
|
|
7
7
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
8
|
-
const
|
|
8
|
+
const set_1 = tslib_1.__importDefault(require("lodash/set"));
|
|
9
9
|
const core_1 = require("../../../../core");
|
|
10
10
|
const utils_1 = require("../../../utils");
|
|
11
11
|
const b = (0, utils_1.block)('array-base');
|
|
@@ -28,7 +28,7 @@ const ArrayBase = ({ spec, name, arrayInput, input }) => {
|
|
|
28
28
|
: `${idx + 1}` });
|
|
29
29
|
return itemSpec;
|
|
30
30
|
}, [spec.items, itemSpecCorrect]);
|
|
31
|
-
const parentOnChange = react_1.default.useCallback((childName, childValue, childErrors) => input.onChange((currentValue) =>
|
|
31
|
+
const parentOnChange = react_1.default.useCallback((childName, childValue, childErrors) => input.onChange((currentValue) => (0, set_1.default)(Object.assign({}, currentValue), childName.split(`${input.name}.`).join(''), childValue), childErrors), [input.onChange, input.name]);
|
|
32
32
|
const AddButton = react_1.default.useCallback(() => {
|
|
33
33
|
let onClick = () => arrayInput.onItemAdd(undefined);
|
|
34
34
|
let qa = `${name}-add-item`;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CardOneOf = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
-
const
|
|
6
|
+
const set_1 = tslib_1.__importDefault(require("lodash/set"));
|
|
7
7
|
const __1 = require("../../");
|
|
8
8
|
const core_1 = require("../../../../core");
|
|
9
9
|
const hooks_1 = require("../../../hooks");
|
|
@@ -27,7 +27,7 @@ const CardOneOf = (props) => {
|
|
|
27
27
|
return;
|
|
28
28
|
}, [name, input.onDrop]);
|
|
29
29
|
const parentOnChange = react_1.default.useCallback((childName, childValue, childErrors) => {
|
|
30
|
-
const value =
|
|
30
|
+
const value = (0, set_1.default)({}, childName.split(`${input.name}.`).join(''), childValue);
|
|
31
31
|
input.onChange(value, childErrors);
|
|
32
32
|
}, [input.onChange, input.name]);
|
|
33
33
|
(0, hooks_1.useErrorChecker)({ name, meta, open, setOpen });
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
.df-monaco-input-dialog .
|
|
1
|
+
.df-monaco-input-dialog .g-dialog-footer {
|
|
2
2
|
padding: 10px 32px 32px;
|
|
3
3
|
}
|
|
4
4
|
.df-monaco-input-dialog__container {
|
|
5
5
|
border: 1px solid var(--g-color-line-generic);
|
|
6
6
|
}
|
|
7
|
-
.df-monaco-input-dialog__dialog-header .
|
|
7
|
+
.df-monaco-input-dialog__dialog-header .g-dialog-header__caption {
|
|
8
8
|
min-height: 24px;
|
|
9
9
|
}
|
|
@@ -4,7 +4,8 @@ exports.MultiOneOfFlat = exports.MultiOneOf = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
6
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
7
|
-
const
|
|
7
|
+
const isObjectLike_1 = tslib_1.__importDefault(require("lodash/isObjectLike"));
|
|
8
|
+
const set_1 = tslib_1.__importDefault(require("lodash/set"));
|
|
8
9
|
const core_1 = require("../../../../core");
|
|
9
10
|
const utils_1 = require("../../../utils");
|
|
10
11
|
const GroupIndent_1 = require("../../GroupIndent");
|
|
@@ -22,9 +23,9 @@ const MultiOneOf = (props) => {
|
|
|
22
23
|
}
|
|
23
24
|
}, [onFocus, onBlur]);
|
|
24
25
|
const parentOnChange = react_1.default.useCallback((childName, childValue, childErrors) => {
|
|
25
|
-
onChange((currentValue) =>
|
|
26
|
+
onChange((currentValue) => (0, set_1.default)(Object.assign({}, currentValue), childName.split(`${name}.`).join(''), childValue), childErrors);
|
|
26
27
|
}, [name, onChange]);
|
|
27
|
-
const specProperties = react_1.default.useMemo(() => (
|
|
28
|
+
const specProperties = react_1.default.useMemo(() => ((0, isObjectLike_1.default)(spec.properties) ? spec.properties : {}), [spec.properties]);
|
|
28
29
|
const options = react_1.default.useMemo(() => (spec.viewSpec.order || Object.keys(specProperties)).map((value) => {
|
|
29
30
|
var _a, _b;
|
|
30
31
|
const title = ((_a = spec.description) === null || _a === void 0 ? void 0 : _a[value]) ||
|
|
@@ -5,7 +5,8 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
6
|
const icons_1 = require("@gravity-ui/icons");
|
|
7
7
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
8
|
-
const
|
|
8
|
+
const isObjectLike_1 = tslib_1.__importDefault(require("lodash/isObjectLike"));
|
|
9
|
+
const set_1 = tslib_1.__importDefault(require("lodash/set"));
|
|
9
10
|
const core_1 = require("../../../../core");
|
|
10
11
|
const utils_1 = require("../../../utils");
|
|
11
12
|
const b = (0, utils_1.block)('object-base');
|
|
@@ -17,10 +18,10 @@ const ObjectBase = (_a) => {
|
|
|
17
18
|
react_1.default.createElement(uikit_1.Icon, { data: icons_1.Plus, size: 14 }),
|
|
18
19
|
spec.viewSpec.layoutTitle || null));
|
|
19
20
|
}, [spec.defaultValue, spec.viewSpec.layoutTitle, restProps.input.onChange]);
|
|
20
|
-
const parentOnChange = react_1.default.useCallback((childName, childValue, childErrors) => restProps.input.onChange((currentValue) =>
|
|
21
|
+
const parentOnChange = react_1.default.useCallback((childName, childValue, childErrors) => restProps.input.onChange((currentValue) => (0, set_1.default)(Object.assign({}, currentValue), childName.split(`${restProps.input.name}.`).join(''), childValue), childErrors), [restProps.input.onChange, restProps.input.name]);
|
|
21
22
|
const content = react_1.default.useMemo(() => {
|
|
22
23
|
if (!spec.properties ||
|
|
23
|
-
!
|
|
24
|
+
!(0, isObjectLike_1.default)(spec.properties) ||
|
|
24
25
|
!Object.keys(spec.properties || {}).length) {
|
|
25
26
|
return null;
|
|
26
27
|
}
|
|
@@ -3,17 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ObjectValueInput = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
-
const
|
|
6
|
+
const cloneDeep_1 = tslib_1.__importDefault(require("lodash/cloneDeep"));
|
|
7
|
+
const set_1 = tslib_1.__importDefault(require("lodash/set"));
|
|
7
8
|
const core_1 = require("../../../../core");
|
|
8
9
|
const OBJECT_VALUE_PROPERTY_NAME = 'value';
|
|
9
10
|
const ObjectValueInput = (props) => {
|
|
10
11
|
var _a;
|
|
11
12
|
const { spec, input, name, Layout } = props;
|
|
12
|
-
const parentOnChange = react_1.default.useCallback((childName, childValue, childErrors) => input.onChange((currentValue) =>
|
|
13
|
+
const parentOnChange = react_1.default.useCallback((childName, childValue, childErrors) => input.onChange((currentValue) => (0, set_1.default)(Object.assign({}, currentValue), childName.split(`${name}.`).join(''), childValue), childErrors), [input.onChange, input.name]);
|
|
13
14
|
const childSpec = react_1.default.useMemo(() => {
|
|
14
15
|
var _a;
|
|
15
16
|
if ((_a = spec.properties) === null || _a === void 0 ? void 0 : _a[OBJECT_VALUE_PROPERTY_NAME]) {
|
|
16
|
-
const childSpec =
|
|
17
|
+
const childSpec = (0, cloneDeep_1.default)(spec.properties[OBJECT_VALUE_PROPERTY_NAME]);
|
|
17
18
|
childSpec.viewSpec.layout = 'transparent';
|
|
18
19
|
return childSpec;
|
|
19
20
|
}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.OneOfFlat = exports.OneOf = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
-
const
|
|
6
|
+
const set_1 = tslib_1.__importDefault(require("lodash/set"));
|
|
7
7
|
const __1 = require("../../");
|
|
8
8
|
const core_1 = require("../../../../core");
|
|
9
9
|
const hooks_1 = require("../../../hooks");
|
|
@@ -13,7 +13,7 @@ const OneOfComponent = (props) => {
|
|
|
13
13
|
var _a;
|
|
14
14
|
const { oneOfValue, specProperties, toggler } = (0, hooks_1.useOneOf)({ props });
|
|
15
15
|
const parentOnChange = react_1.default.useCallback((childName, childValue, childErrors) => {
|
|
16
|
-
const value =
|
|
16
|
+
const value = (0, set_1.default)({}, childName.split(`${props.input.name}.`).join(''), childValue);
|
|
17
17
|
props.input.onChange(value, childErrors);
|
|
18
18
|
}, [props.input.onChange, props.input.name]);
|
|
19
19
|
return (react_1.default.createElement("div", { className: b({
|
|
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Secret = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
-
const
|
|
6
|
+
const cloneDeep_1 = tslib_1.__importDefault(require("lodash/cloneDeep"));
|
|
7
|
+
const set_1 = tslib_1.__importDefault(require("lodash/set"));
|
|
7
8
|
const core_1 = require("../../../../core");
|
|
8
9
|
const SECRET_PROPERTY_NAME = 'raw';
|
|
9
10
|
const Secret = (props) => {
|
|
@@ -12,13 +13,13 @@ const Secret = (props) => {
|
|
|
12
13
|
const childSpec = react_1.default.useMemo(() => {
|
|
13
14
|
var _a, _b;
|
|
14
15
|
if ((_a = spec.properties) === null || _a === void 0 ? void 0 : _a[SECRET_PROPERTY_NAME]) {
|
|
15
|
-
const childSpec =
|
|
16
|
+
const childSpec = (0, cloneDeep_1.default)((_b = spec.properties) === null || _b === void 0 ? void 0 : _b[SECRET_PROPERTY_NAME]);
|
|
16
17
|
childSpec.viewSpec.layout = 'transparent';
|
|
17
18
|
return childSpec;
|
|
18
19
|
}
|
|
19
20
|
return undefined;
|
|
20
21
|
}, [spec.properties]);
|
|
21
|
-
const parentOnChange = react_1.default.useCallback((childName, childValue, childErrors) => input.onChange((currentValue) =>
|
|
22
|
+
const parentOnChange = react_1.default.useCallback((childName, childValue, childErrors) => input.onChange((currentValue) => (0, set_1.default)(Object.assign({}, currentValue), childName.split(`${input.name}.`).join(''), childValue), childErrors), [input.onChange, input.name]);
|
|
22
23
|
if (!childSpec) {
|
|
23
24
|
return null;
|
|
24
25
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
.df-table-array__table {
|
|
2
2
|
margin-bottom: 10px;
|
|
3
3
|
}
|
|
4
|
-
.df-table-array__table .
|
|
4
|
+
.df-table-array__table .g-table__cell {
|
|
5
5
|
border-bottom: 0px transparent;
|
|
6
6
|
}
|
|
7
|
-
.df-table-array__row .
|
|
7
|
+
.df-table-array__row .g-table__cell {
|
|
8
8
|
border-bottom: 0px transparent;
|
|
9
9
|
border-top: 1px solid var(--g-color-line-generic);
|
|
10
10
|
}
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
display: none;
|
|
13
13
|
}
|
|
14
14
|
.df-table-array__cell .yc-text-input,
|
|
15
|
+
.df-table-array__cell .g-text-input,
|
|
15
16
|
.df-table-array__cell .yc-select-control,
|
|
17
|
+
.df-table-array__cell .g-select-control,
|
|
16
18
|
.df-table-array__cell .yc-select,
|
|
17
19
|
.df-table-array__cell .g-select {
|
|
18
20
|
max-width: 150px;
|
|
@@ -22,10 +24,14 @@
|
|
|
22
24
|
padding-left: 3px;
|
|
23
25
|
}
|
|
24
26
|
.df-table-array__cell_arr .yc-text-input,
|
|
27
|
+
.df-table-array__cell_arr .g-text-input,
|
|
25
28
|
.df-table-array__cell_arr .yc-select-control:not(.df-multi-select),
|
|
29
|
+
.df-table-array__cell_arr .g-select-control:not(.df-multi-select),
|
|
26
30
|
.df-table-array__cell_arr .yc-select:not(.df-multi-select),
|
|
27
31
|
.df-table-array__cell_arr .g-select:not(.df-multi-select), .df-table-array__cell_obj .yc-text-input,
|
|
32
|
+
.df-table-array__cell_obj .g-text-input,
|
|
28
33
|
.df-table-array__cell_obj .yc-select-control:not(.df-multi-select),
|
|
34
|
+
.df-table-array__cell_obj .g-select-control:not(.df-multi-select),
|
|
29
35
|
.df-table-array__cell_obj .yc-select:not(.df-multi-select),
|
|
30
36
|
.df-table-array__cell_obj .g-select:not(.df-multi-select) {
|
|
31
37
|
max-width: unset;
|
|
@@ -5,7 +5,8 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
6
|
const icons_1 = require("@gravity-ui/icons");
|
|
7
7
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
8
|
-
const
|
|
8
|
+
const noop_1 = tslib_1.__importDefault(require("lodash/noop"));
|
|
9
|
+
const set_1 = tslib_1.__importDefault(require("lodash/set"));
|
|
9
10
|
const core_1 = require("../../../../core");
|
|
10
11
|
const hooks_1 = require("../../../../core/components/Form/hooks");
|
|
11
12
|
const utils_1 = require("../../../utils");
|
|
@@ -25,7 +26,7 @@ const TableArrayInput = ({ spec, name, arrayInput, input }) => {
|
|
|
25
26
|
const onItemRemove = react_1.default.useCallback((key) => {
|
|
26
27
|
arrayInput.onItemRemove(key);
|
|
27
28
|
}, [arrayInput.onItemRemove]);
|
|
28
|
-
const parentOnChange = react_1.default.useCallback((childName, childValue, childErrors) => input.onChange((currentValue) =>
|
|
29
|
+
const parentOnChange = react_1.default.useCallback((childName, childValue, childErrors) => input.onChange((currentValue) => (0, set_1.default)(Object.assign({}, currentValue), childName.split(`${input.name}.`).join(''), childValue), childErrors), [input.onChange, input.name]);
|
|
29
30
|
const columns = react_1.default.useMemo(() => {
|
|
30
31
|
const { items, viewSpec: { table }, } = spec;
|
|
31
32
|
if (!(table === null || table === void 0 ? void 0 : table.length) || !(0, core_1.isObjectSpec)(items)) {
|
|
@@ -59,7 +60,7 @@ const TableArrayInput = ({ spec, name, arrayInput, input }) => {
|
|
|
59
60
|
arr: (0, core_1.isArraySpec)(preparedEntitySpec),
|
|
60
61
|
obj: (0, core_1.isObjectSpec)(preparedEntitySpec),
|
|
61
62
|
}), key: `${name}.<${key}>.${property}` },
|
|
62
|
-
react_1.default.createElement(core_1.Controller, { value: (_c = (_b = input.value) === null || _b === void 0 ? void 0 : _b[`<${key}>`]) === null || _c === void 0 ? void 0 : _c[property], spec: preparedEntitySpec, name: `${name}.<${key}>.${property}`, parentOnChange: parentOnChange, parentOnUnmount:
|
|
63
|
+
react_1.default.createElement(core_1.Controller, { value: (_c = (_b = input.value) === null || _b === void 0 ? void 0 : _b[`<${key}>`]) === null || _c === void 0 ? void 0 : _c[property], spec: preparedEntitySpec, name: `${name}.<${key}>.${property}`, parentOnChange: parentOnChange, parentOnUnmount: noop_1.default })));
|
|
63
64
|
},
|
|
64
65
|
}));
|
|
65
66
|
return [idxColumn, ...columns, removeColumn];
|
|
@@ -5,9 +5,9 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
6
|
const components_1 = require("@gravity-ui/components");
|
|
7
7
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
8
|
-
const
|
|
8
|
+
const isNil_1 = tslib_1.__importDefault(require("lodash/isNil"));
|
|
9
9
|
const Text = ({ name, input: { value, onBlur, onChange, onFocus }, spec, inputProps, }) => {
|
|
10
|
-
const props = Object.assign(Object.assign({ hasClear: true }, inputProps), { value:
|
|
10
|
+
const props = Object.assign(Object.assign({ hasClear: true }, inputProps), { value: (0, isNil_1.default)(value) ? '' : `${value}`, onBlur: onBlur, onFocus: onFocus, onUpdate: onChange, disabled: spec.viewSpec.disabled, placeholder: spec.viewSpec.placeholder, qa: name });
|
|
11
11
|
if (spec.viewSpec.type === 'password') {
|
|
12
12
|
return (react_1.default.createElement(components_1.PasswordInput, Object.assign({}, props, { autoComplete: "new-password", showCopyButton: true, showRevealButton: true })));
|
|
13
13
|
}
|
|
@@ -4,7 +4,7 @@ exports.TextContent = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
6
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
7
|
-
const
|
|
7
|
+
const cloneDeep_1 = tslib_1.__importDefault(require("lodash/cloneDeep"));
|
|
8
8
|
const utils_1 = require("../../../utils");
|
|
9
9
|
const LazyLoader_1 = require("../../LazyLoader");
|
|
10
10
|
const utils_2 = require("./utils");
|
|
@@ -31,7 +31,7 @@ const TextContent = (_a) => {
|
|
|
31
31
|
react_1.default.createElement(uikit_1.Text, { color: "secondary" }, input.value))) : null));
|
|
32
32
|
}
|
|
33
33
|
if (Layout) {
|
|
34
|
-
const _spec =
|
|
34
|
+
const _spec = (0, cloneDeep_1.default)(spec);
|
|
35
35
|
if (!(textContentParams === null || textContentParams === void 0 ? void 0 : textContentParams.text)) {
|
|
36
36
|
_spec.viewSpec.layoutDescription = undefined;
|
|
37
37
|
}
|
|
@@ -3,18 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TextLink = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
-
const
|
|
6
|
+
const cloneDeep_1 = tslib_1.__importDefault(require("lodash/cloneDeep"));
|
|
7
|
+
const set_1 = tslib_1.__importDefault(require("lodash/set"));
|
|
7
8
|
const core_1 = require("../../../../core");
|
|
8
9
|
const TEXT_LINK_PROPERTY_NAME = 'text';
|
|
9
10
|
const TextLink = (props) => {
|
|
10
11
|
var _a;
|
|
11
12
|
const { spec, input, name, Layout } = props;
|
|
12
|
-
const parentOnChange = react_1.default.useCallback((childName, childValue, childErrors) => input.onChange((currentValue) =>
|
|
13
|
+
const parentOnChange = react_1.default.useCallback((childName, childValue, childErrors) => input.onChange((currentValue) => (0, set_1.default)(Object.assign({}, currentValue), childName.split(`${name}.`).join(''), childValue), childErrors), [input.onChange, input.name]);
|
|
13
14
|
const childSpec = react_1.default.useMemo(() => {
|
|
14
15
|
var _a;
|
|
15
16
|
if (((_a = spec.properties) === null || _a === void 0 ? void 0 : _a[TEXT_LINK_PROPERTY_NAME]) &&
|
|
16
17
|
(0, core_1.isStringSpec)(spec.properties[TEXT_LINK_PROPERTY_NAME])) {
|
|
17
|
-
const childSpec =
|
|
18
|
+
const childSpec = (0, cloneDeep_1.default)(spec.properties[TEXT_LINK_PROPERTY_NAME]);
|
|
18
19
|
childSpec.viewSpec.layout = 'transparent';
|
|
19
20
|
return childSpec;
|
|
20
21
|
}
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
position: absolute;
|
|
42
42
|
margin-top: 1px;
|
|
43
43
|
}
|
|
44
|
-
.df-row__note-inner .
|
|
44
|
+
.df-row__note-inner .g-help-popover {
|
|
45
45
|
display: flex;
|
|
46
46
|
}
|
|
47
|
-
.df-row__note-inner .
|
|
47
|
+
.df-row__note-inner .g-help-popover > span {
|
|
48
48
|
display: flex;
|
|
49
49
|
}
|
|
50
50
|
.df-row__right {
|
|
@@ -31,7 +31,7 @@ const RowBase = ({ name, spec, input, meta, verboseDescription, children, }) =>
|
|
|
31
31
|
react_1.default.createElement(uikit_1.Icon, { data: icons_1.TrashBin, size: 16 }))) : null),
|
|
32
32
|
verboseDescription && spec.viewSpec.layoutDescription ? (react_1.default.createElement("div", { className: b('description'), dangerouslySetInnerHTML: { __html: spec.viewSpec.layoutDescription } })) : null)));
|
|
33
33
|
};
|
|
34
|
-
const Row = (props) =>
|
|
34
|
+
const Row = (props) => react_1.default.createElement(RowBase, Object.assign({}, props));
|
|
35
35
|
exports.Row = Row;
|
|
36
|
-
const RowVerbose = (props) =>
|
|
36
|
+
const RowVerbose = (props) => react_1.default.createElement(RowBase, Object.assign({ verboseDescription: true }, props));
|
|
37
37
|
exports.RowVerbose = RowVerbose;
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
.df-section__note {
|
|
29
29
|
margin-left: 5px;
|
|
30
30
|
}
|
|
31
|
-
.df-section__note .
|
|
31
|
+
.df-section__note .g-help-popover {
|
|
32
32
|
display: flex;
|
|
33
33
|
}
|
|
34
|
-
.df-section__note .
|
|
34
|
+
.df-section__note .g-help-popover > span {
|
|
35
35
|
display: flex;
|
|
36
36
|
}
|
|
37
37
|
.df-section__description {
|
|
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.LazyLoader = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
-
const
|
|
6
|
+
const isUndefined_1 = tslib_1.__importDefault(require("lodash/isUndefined"));
|
|
7
7
|
const LazyLoader = ({ component, initialFallback = react_1.default.createElement(react_1.default.Fragment, null), }) => {
|
|
8
8
|
const fallback = react_1.default.useRef(() => initialFallback);
|
|
9
9
|
const Component = component;
|
|
10
10
|
const updateFallback = async () => {
|
|
11
11
|
const result = await component._result;
|
|
12
|
-
if (!
|
|
12
|
+
if (!(0, isUndefined_1.default)(result)) {
|
|
13
13
|
fallback.current = result.default;
|
|
14
14
|
}
|
|
15
15
|
};
|
|
@@ -42,7 +42,7 @@ const LongValue = ({ value, className }) => {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
|
-
return (react_1.default.createElement("div", { ref: ref, onClick: long ? handleClick : undefined },
|
|
45
|
+
return (react_1.default.createElement("div", { className: b('container'), ref: ref, onClick: long ? handleClick : undefined },
|
|
46
46
|
react_1.default.createElement(uikit_1.Text, Object.assign({ className: b({ long }, className), ellipsis: true }, currentTextProperies), value)));
|
|
47
47
|
};
|
|
48
48
|
exports.LongValue = LongValue;
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
.df-simple-vertical-accordeon__tooltip {
|
|
21
21
|
margin: 0px 5px;
|
|
22
22
|
}
|
|
23
|
-
.df-simple-vertical-accordeon__tooltip .
|
|
23
|
+
.df-simple-vertical-accordeon__tooltip .g-help-popover {
|
|
24
24
|
display: flex;
|
|
25
25
|
}
|
|
26
|
-
.df-simple-vertical-accordeon__tooltip .
|
|
26
|
+
.df-simple-vertical-accordeon__tooltip .g-help-popover > span {
|
|
27
27
|
display: flex;
|
|
28
28
|
}
|
|
29
29
|
.df-simple-vertical-accordeon__chevron {
|
|
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ViewAccordeon = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
-
const
|
|
6
|
+
const isBoolean_1 = tslib_1.__importDefault(require("lodash/isBoolean"));
|
|
7
7
|
const utils_1 = require("../../../utils");
|
|
8
8
|
const SimpleVerticalAccordeon_1 = require("../../SimpleVerticalAccordeon");
|
|
9
9
|
const ViewAccordeon = ({ name, value, spec, children, }) => {
|
|
10
|
-
const [open, setOpen] = react_1.default.useState(
|
|
10
|
+
const [open, setOpen] = react_1.default.useState((0, isBoolean_1.default)(spec.viewSpec.layoutOpen) ? spec.viewSpec.layoutOpen : true);
|
|
11
11
|
if (!(0, utils_1.isNotEmptyValue)(value, spec)) {
|
|
12
12
|
return null;
|
|
13
13
|
}
|
|
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ViewAccordeonCard = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
-
const
|
|
6
|
+
const isBoolean_1 = tslib_1.__importDefault(require("lodash/isBoolean"));
|
|
7
7
|
const utils_1 = require("../../../utils");
|
|
8
8
|
const AccordeonCard_1 = require("../../AccordeonCard");
|
|
9
9
|
const ViewAccordeonCard = ({ value, name, spec, children, }) => {
|
|
10
|
-
const [open, setOpen] = react_1.default.useState(
|
|
10
|
+
const [open, setOpen] = react_1.default.useState((0, isBoolean_1.default)(spec.viewSpec.layoutOpen) ? spec.viewSpec.layoutOpen : true);
|
|
11
11
|
if (!(0, utils_1.isNotEmptyValue)(value, spec)) {
|
|
12
12
|
return null;
|
|
13
13
|
}
|
|
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ViewCardAccordeon = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
-
const
|
|
6
|
+
const isBoolean_1 = tslib_1.__importDefault(require("lodash/isBoolean"));
|
|
7
7
|
const __1 = require("../");
|
|
8
8
|
const utils_1 = require("../../utils");
|
|
9
9
|
const ViewCardAccordeon = ({ name, value, spec, children, }) => {
|
|
10
|
-
const [open, setOpen] = react_1.default.useState(
|
|
10
|
+
const [open, setOpen] = react_1.default.useState((0, isBoolean_1.default)(spec.viewSpec.layoutOpen) ? spec.viewSpec.layoutOpen : true);
|
|
11
11
|
const onToggle = react_1.default.useCallback(() => setOpen((f) => !f), [setOpen]);
|
|
12
12
|
if (!(0, utils_1.isNotEmptyValue)(value, spec)) {
|
|
13
13
|
return null;
|
|
@@ -4,7 +4,7 @@ exports.ArrayBaseView = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
6
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
7
|
-
const
|
|
7
|
+
const map_1 = tslib_1.__importDefault(require("lodash/map"));
|
|
8
8
|
const core_1 = require("../../../../core");
|
|
9
9
|
const utils_1 = require("../../../utils");
|
|
10
10
|
const b = (0, utils_1.block)('array-base-view');
|
|
@@ -20,7 +20,7 @@ const ArrayBaseView = ({ spec, name, value = [] }) => {
|
|
|
20
20
|
: `${idx + 1}` });
|
|
21
21
|
return itemSpec;
|
|
22
22
|
}, [spec.items, itemSpecCorrect]);
|
|
23
|
-
const items = react_1.default.useMemo(() =>
|
|
23
|
+
const items = react_1.default.useMemo(() => (0, map_1.default)(value, (__, idx) => {
|
|
24
24
|
const itemSpec = getItemSpec(idx);
|
|
25
25
|
if (!itemSpec) {
|
|
26
26
|
return null;
|
|
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.BaseView = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
-
const
|
|
6
|
+
const isString_1 = tslib_1.__importDefault(require("lodash/isString"));
|
|
7
7
|
const components_1 = require("../../../components");
|
|
8
8
|
const BaseView = ({ value, spec, linkValue, }) => {
|
|
9
9
|
var _a;
|
|
10
|
-
if (
|
|
10
|
+
if ((0, isString_1.default)(value) && linkValue) {
|
|
11
11
|
return react_1.default.createElement(react_1.default.Fragment, null, linkValue);
|
|
12
12
|
}
|
|
13
13
|
return (react_1.default.createElement(components_1.LongValue, { value: ((_a = spec === null || spec === void 0 ? void 0 : spec.description) === null || _a === void 0 ? void 0 : _a[String(value)]) || String(value) }));
|
|
@@ -3,14 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CardOneOfView = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
-
const
|
|
6
|
+
const isObjectLike_1 = tslib_1.__importDefault(require("lodash/isObjectLike"));
|
|
7
7
|
const __1 = require("../");
|
|
8
8
|
const core_1 = require("../../../core");
|
|
9
9
|
const CardOneOfView = (props) => {
|
|
10
10
|
const { value = {}, spec, name } = props;
|
|
11
11
|
const [open, setOpen] = react_1.default.useState(true);
|
|
12
12
|
const onToggle = react_1.default.useCallback(() => setOpen((f) => !f), [setOpen]);
|
|
13
|
-
const specProperties = react_1.default.useMemo(() => (
|
|
13
|
+
const specProperties = react_1.default.useMemo(() => ((0, isObjectLike_1.default)(spec.properties) ? spec.properties : {}), [spec.properties]);
|
|
14
14
|
const valueKey = react_1.default.useMemo(() => Object.keys(value)[0], [value]);
|
|
15
15
|
const valueName = react_1.default.useMemo(() => {
|
|
16
16
|
var _a, _b;
|
|
@@ -4,14 +4,14 @@ exports.MultiOneOfFlatView = exports.MultiOneOfView = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
6
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
7
|
-
const
|
|
7
|
+
const isObjectLike_1 = tslib_1.__importDefault(require("lodash/isObjectLike"));
|
|
8
8
|
const core_1 = require("../../../../core");
|
|
9
9
|
const utils_1 = require("../../../utils");
|
|
10
10
|
const GroupIndent_1 = require("../../GroupIndent");
|
|
11
11
|
const b = (0, utils_1.block)('multi-oneof-view');
|
|
12
12
|
const MultiOneOfView = (props) => {
|
|
13
13
|
const { name, value, Layout, spec, withoutIndent } = props;
|
|
14
|
-
const specProperties = react_1.default.useMemo(() => (
|
|
14
|
+
const specProperties = react_1.default.useMemo(() => ((0, isObjectLike_1.default)(spec.properties) ? spec.properties : {}), [spec.properties]);
|
|
15
15
|
const values = react_1.default.useMemo(() => Object.keys(value || []), [value]);
|
|
16
16
|
const items = react_1.default.useMemo(() => values.map((value) => {
|
|
17
17
|
var _a, _b;
|
|
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ObjectInlineView = exports.ObjectBaseView = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
-
const
|
|
6
|
+
const isObjectLike_1 = tslib_1.__importDefault(require("lodash/isObjectLike"));
|
|
7
7
|
const core_1 = require("../../../../core");
|
|
8
8
|
const utils_1 = require("../../../utils");
|
|
9
9
|
const b = (0, utils_1.block)('object-base-view');
|
|
10
10
|
const ObjectBaseView = (_a) => {
|
|
11
11
|
var { inline, spec, name, Layout } = _a, restProps = tslib_1.__rest(_a, ["inline", "spec", "name", "Layout"]);
|
|
12
|
-
if (!spec.properties || !
|
|
12
|
+
if (!spec.properties || !(0, isObjectLike_1.default)(spec.properties)) {
|
|
13
13
|
return null;
|
|
14
14
|
}
|
|
15
15
|
const specProperties = inline
|