@gravity-ui/dynamic-forms 2.8.2 → 3.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.js +1 -5
- package/build/cjs/lib/core/components/Form/hooks/useRender.js +10 -8
- package/build/cjs/lib/core/components/Form/hooks/useSearch/useSearch.js +1 -1
- package/build/cjs/lib/core/components/View/ViewController.js +1 -4
- package/build/cjs/lib/core/components/View/hooks/useRender.js +12 -10
- package/build/cjs/lib/kit/components/Inputs/ArrayBase/ArrayBase.css +3 -0
- package/build/cjs/lib/kit/components/Inputs/MonacoInput/MonacoHeader.css +0 -3
- package/build/cjs/lib/kit/components/Inputs/MonacoInput/MonacoHeader.js +1 -1
- package/build/cjs/lib/kit/components/Inputs/MonacoInput/MonacoInputBase.css +0 -3
- package/build/cjs/lib/kit/components/Inputs/MonacoInput/MonacoInputBase.js +5 -7
- package/build/cjs/lib/kit/components/Inputs/MonacoInput/MonacoInputDialog.js +2 -2
- package/build/cjs/lib/kit/components/Inputs/index.js +0 -1
- package/build/cjs/lib/kit/components/Layouts/Transparent/Transparent.css +3 -1
- package/build/cjs/lib/kit/components/Layouts/index.js +0 -3
- package/build/cjs/lib/kit/components/ViewLayouts/index.js +0 -3
- package/build/cjs/lib/kit/components/Views/MonacoInputView/MonacoBaseView.css +0 -3
- package/build/cjs/lib/kit/components/Views/MonacoInputView/MonacoBaseView.js +5 -7
- package/build/cjs/lib/kit/components/Views/MonacoInputView/MonacoViewDialog.js +2 -2
- package/build/cjs/lib/kit/components/Views/index.js +0 -1
- package/build/cjs/lib/kit/constants/config.js +1 -179
- package/build/esm/lib/core/components/Form/Controller.js +1 -5
- package/build/esm/lib/core/components/Form/hooks/useRender.js +10 -8
- package/build/esm/lib/core/components/Form/hooks/useSearch/useSearch.d.ts +1 -1
- package/build/esm/lib/core/components/Form/hooks/useSearch/useSearch.js +1 -1
- package/build/esm/lib/core/components/View/ViewController.d.ts +1 -1
- package/build/esm/lib/core/components/View/ViewController.js +1 -4
- package/build/esm/lib/core/components/View/hooks/useRender.js +12 -10
- package/build/esm/lib/kit/components/Inputs/ArrayBase/ArrayBase.css +3 -0
- package/build/esm/lib/kit/components/Inputs/MonacoInput/MonacoHeader.css +0 -3
- package/build/esm/lib/kit/components/Inputs/MonacoInput/MonacoHeader.d.ts +0 -1
- package/build/esm/lib/kit/components/Inputs/MonacoInput/MonacoHeader.js +1 -1
- package/build/esm/lib/kit/components/Inputs/MonacoInput/MonacoInputBase.css +0 -3
- package/build/esm/lib/kit/components/Inputs/MonacoInput/MonacoInputBase.d.ts +0 -2
- package/build/esm/lib/kit/components/Inputs/MonacoInput/MonacoInputBase.js +4 -5
- package/build/esm/lib/kit/components/Inputs/MonacoInput/MonacoInputDialog.d.ts +0 -1
- package/build/esm/lib/kit/components/Inputs/MonacoInput/MonacoInputDialog.js +2 -2
- package/build/esm/lib/kit/components/Inputs/index.d.ts +0 -1
- package/build/esm/lib/kit/components/Inputs/index.js +0 -1
- package/build/esm/lib/kit/components/Layouts/Transparent/Transparent.css +3 -1
- package/build/esm/lib/kit/components/Layouts/index.d.ts +0 -3
- package/build/esm/lib/kit/components/Layouts/index.js +0 -3
- package/build/esm/lib/kit/components/ViewLayouts/index.d.ts +0 -3
- package/build/esm/lib/kit/components/ViewLayouts/index.js +0 -3
- package/build/esm/lib/kit/components/Views/MonacoInputView/MonacoBaseView.css +0 -3
- package/build/esm/lib/kit/components/Views/MonacoInputView/MonacoBaseView.d.ts +0 -1
- package/build/esm/lib/kit/components/Views/MonacoInputView/MonacoBaseView.js +4 -5
- package/build/esm/lib/kit/components/Views/MonacoInputView/MonacoViewDialog.d.ts +0 -1
- package/build/esm/lib/kit/components/Views/MonacoInputView/MonacoViewDialog.js +2 -2
- package/build/esm/lib/kit/components/Views/index.d.ts +0 -1
- package/build/esm/lib/kit/components/Views/index.js +0 -1
- package/build/esm/lib/kit/constants/config.d.ts +0 -2
- package/build/esm/lib/kit/constants/config.js +1 -179
- package/package.json +1 -1
- package/build/cjs/lib/kit/components/Inputs/OneOfCard/OneOfCard.css +0 -6
- package/build/cjs/lib/kit/components/Inputs/OneOfCard/OneOfCard.js +0 -43
- package/build/cjs/lib/kit/components/Inputs/OneOfCard/index.js +0 -4
- package/build/cjs/lib/kit/components/Layouts/AccordeonCardLayout/AccordeonCardLayout.css +0 -3
- package/build/cjs/lib/kit/components/Layouts/AccordeonCardLayout/AccordeonCardLayout.js +0 -30
- package/build/cjs/lib/kit/components/Layouts/AccordeonCardLayout/index.js +0 -4
- package/build/cjs/lib/kit/components/Layouts/Row2/Row2.css +0 -51
- package/build/cjs/lib/kit/components/Layouts/Row2/Row2.js +0 -30
- package/build/cjs/lib/kit/components/Layouts/Row2/index.js +0 -4
- package/build/cjs/lib/kit/components/Layouts/SectionCard/SectionCard.css +0 -3
- package/build/cjs/lib/kit/components/Layouts/SectionCard/SectionCard.js +0 -24
- package/build/cjs/lib/kit/components/Layouts/SectionCard/index.js +0 -4
- package/build/cjs/lib/kit/components/ViewLayouts/ViewAccordeonCard/ViewAccordeonCard.js +0 -16
- package/build/cjs/lib/kit/components/ViewLayouts/ViewAccordeonCard/index.js +0 -4
- package/build/cjs/lib/kit/components/ViewLayouts/ViewRow2/ViewRow2.css +0 -42
- package/build/cjs/lib/kit/components/ViewLayouts/ViewRow2/ViewRow2.js +0 -30
- package/build/cjs/lib/kit/components/ViewLayouts/ViewRow2/index.js +0 -4
- package/build/cjs/lib/kit/components/ViewLayouts/ViewSectionCard/ViewSectionCard.js +0 -11
- package/build/cjs/lib/kit/components/ViewLayouts/ViewSectionCard/index.js +0 -4
- package/build/cjs/lib/kit/components/Views/OneOfCardView.js +0 -33
- package/build/esm/lib/kit/components/Inputs/OneOfCard/OneOfCard.css +0 -6
- package/build/esm/lib/kit/components/Inputs/OneOfCard/OneOfCard.d.ts +0 -3
- package/build/esm/lib/kit/components/Inputs/OneOfCard/OneOfCard.js +0 -39
- package/build/esm/lib/kit/components/Inputs/OneOfCard/index.d.ts +0 -1
- package/build/esm/lib/kit/components/Inputs/OneOfCard/index.js +0 -1
- package/build/esm/lib/kit/components/Layouts/AccordeonCardLayout/AccordeonCardLayout.css +0 -3
- package/build/esm/lib/kit/components/Layouts/AccordeonCardLayout/AccordeonCardLayout.d.ts +0 -3
- package/build/esm/lib/kit/components/Layouts/AccordeonCardLayout/AccordeonCardLayout.js +0 -26
- package/build/esm/lib/kit/components/Layouts/AccordeonCardLayout/index.d.ts +0 -1
- package/build/esm/lib/kit/components/Layouts/AccordeonCardLayout/index.js +0 -1
- package/build/esm/lib/kit/components/Layouts/Row2/Row2.css +0 -51
- package/build/esm/lib/kit/components/Layouts/Row2/Row2.d.ts +0 -3
- package/build/esm/lib/kit/components/Layouts/Row2/Row2.js +0 -26
- package/build/esm/lib/kit/components/Layouts/Row2/index.d.ts +0 -1
- package/build/esm/lib/kit/components/Layouts/Row2/index.js +0 -1
- package/build/esm/lib/kit/components/Layouts/SectionCard/SectionCard.css +0 -3
- package/build/esm/lib/kit/components/Layouts/SectionCard/SectionCard.d.ts +0 -8
- package/build/esm/lib/kit/components/Layouts/SectionCard/SectionCard.js +0 -20
- package/build/esm/lib/kit/components/Layouts/SectionCard/index.d.ts +0 -1
- package/build/esm/lib/kit/components/Layouts/SectionCard/index.js +0 -1
- package/build/esm/lib/kit/components/ViewLayouts/ViewAccordeonCard/ViewAccordeonCard.d.ts +0 -2
- package/build/esm/lib/kit/components/ViewLayouts/ViewAccordeonCard/ViewAccordeonCard.js +0 -11
- package/build/esm/lib/kit/components/ViewLayouts/ViewAccordeonCard/index.d.ts +0 -1
- package/build/esm/lib/kit/components/ViewLayouts/ViewAccordeonCard/index.js +0 -1
- package/build/esm/lib/kit/components/ViewLayouts/ViewRow2/ViewRow2.css +0 -42
- package/build/esm/lib/kit/components/ViewLayouts/ViewRow2/ViewRow2.d.ts +0 -3
- package/build/esm/lib/kit/components/ViewLayouts/ViewRow2/ViewRow2.js +0 -26
- package/build/esm/lib/kit/components/ViewLayouts/ViewRow2/index.d.ts +0 -1
- package/build/esm/lib/kit/components/ViewLayouts/ViewRow2/index.js +0 -1
- package/build/esm/lib/kit/components/ViewLayouts/ViewSectionCard/ViewSectionCard.d.ts +0 -3
- package/build/esm/lib/kit/components/ViewLayouts/ViewSectionCard/ViewSectionCard.js +0 -5
- package/build/esm/lib/kit/components/ViewLayouts/ViewSectionCard/index.d.ts +0 -1
- package/build/esm/lib/kit/components/ViewLayouts/ViewSectionCard/index.js +0 -1
- package/build/esm/lib/kit/components/Views/OneOfCardView.d.ts +0 -2
- package/build/esm/lib/kit/components/Views/OneOfCardView.js +0 -28
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Controller = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
6
|
-
const helpers_1 = require("../../helpers");
|
|
7
6
|
const hooks_1 = require("./hooks");
|
|
8
7
|
const Controller = ({ spec, name, value, parentOnChange, parentOnUnmount, }) => {
|
|
9
8
|
const { tools, __mirror } = (0, hooks_1.useDynamicFormsCtx)();
|
|
@@ -28,9 +27,6 @@ const Controller = ({ spec, name, value, parentOnChange, parentOnUnmount, }) =>
|
|
|
28
27
|
useField: renderProps,
|
|
29
28
|
useSearch: withSearch,
|
|
30
29
|
}, __mirror);
|
|
31
|
-
|
|
32
|
-
return withSearch(render(renderProps));
|
|
33
|
-
}
|
|
34
|
-
return null;
|
|
30
|
+
return withSearch(render(renderProps));
|
|
35
31
|
};
|
|
36
32
|
exports.Controller = Controller;
|
|
@@ -8,16 +8,18 @@ const helpers_1 = require("../../../helpers");
|
|
|
8
8
|
const useRender = ({ name, spec, inputEntity, Layout, }) => {
|
|
9
9
|
const render = react_1.default.useCallback((props) => {
|
|
10
10
|
if (inputEntity && (0, helpers_1.isCorrectSpec)(spec) && lodash_1.default.isString(name)) {
|
|
11
|
-
if (
|
|
11
|
+
if (!spec.viewSpec.hidden) {
|
|
12
|
+
if (inputEntity.independent) {
|
|
13
|
+
const InputComponent = inputEntity.Component;
|
|
14
|
+
return (react_1.default.createElement(InputComponent, Object.assign({ spec: spec, name: name, Layout: Layout }, props)));
|
|
15
|
+
}
|
|
12
16
|
const InputComponent = inputEntity.Component;
|
|
13
|
-
|
|
17
|
+
const input = react_1.default.createElement(InputComponent, Object.assign({ spec: spec, name: name }, props));
|
|
18
|
+
if (Layout) {
|
|
19
|
+
return (react_1.default.createElement(Layout, Object.assign({ spec: spec, name: name }, props), input));
|
|
20
|
+
}
|
|
21
|
+
return input;
|
|
14
22
|
}
|
|
15
|
-
const InputComponent = inputEntity.Component;
|
|
16
|
-
const input = react_1.default.createElement(InputComponent, Object.assign({ spec: spec, name: name }, props));
|
|
17
|
-
if (Layout) {
|
|
18
|
-
return (react_1.default.createElement(Layout, Object.assign({ spec: spec, name: name }, props), input));
|
|
19
|
-
}
|
|
20
|
-
return input;
|
|
21
23
|
}
|
|
22
24
|
return null;
|
|
23
25
|
}, [spec, name, inputEntity, Layout]);
|
|
@@ -10,7 +10,7 @@ const useSearch = (spec, value, name) => {
|
|
|
10
10
|
const { setField, removeField, isHiddenField, searchFunction } = (0, useSearchContext_1.useSearchContext)();
|
|
11
11
|
const searchResult = react_1.default.useMemo(() => !searchFunction(spec, value, name), [name, searchFunction, spec, value]);
|
|
12
12
|
const hidden = react_1.default.useMemo(() => isHiddenField(name), [isHiddenField, name]);
|
|
13
|
-
const withSearch = react_1.default.useCallback((children) => react_1.default.createElement("div", { className: b({ hidden: hidden }) }, children), [hidden]);
|
|
13
|
+
const withSearch = react_1.default.useCallback((children) => children ? react_1.default.createElement("div", { className: b({ hidden: hidden }) }, children) : null, [hidden]);
|
|
14
14
|
react_1.default.useEffect(() => {
|
|
15
15
|
setField(name, searchResult);
|
|
16
16
|
}, [searchResult]);
|
|
@@ -8,9 +8,6 @@ const ViewController = ({ spec, name, }) => {
|
|
|
8
8
|
const { config, value, Link } = (0, hooks_1.useDynamicFormsCtx)();
|
|
9
9
|
const { viewEntity, Layout } = (0, hooks_1.useComponents)(spec, config);
|
|
10
10
|
const render = (0, hooks_1.useRender)({ name, value, spec, viewEntity, Layout, Link });
|
|
11
|
-
|
|
12
|
-
return react_1.default.createElement(react_1.default.Fragment, null, render);
|
|
13
|
-
}
|
|
14
|
-
return null;
|
|
11
|
+
return react_1.default.createElement(react_1.default.Fragment, null, render);
|
|
15
12
|
};
|
|
16
13
|
exports.ViewController = ViewController;
|
|
@@ -10,18 +10,20 @@ const useRender = ({ value, name, spec, viewEntity, Layout, Link, }) => {
|
|
|
10
10
|
const render = react_1.default.useMemo(() => {
|
|
11
11
|
var _a;
|
|
12
12
|
if (viewEntity && (0, helpers_1.isCorrectSpec)(spec) && lodash_1.default.isString(name)) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
if (!spec.viewSpec.hidden) {
|
|
14
|
+
const currentValue = name ? lodash_1.default.get(value, name) : value;
|
|
15
|
+
const linkValue = (0, react_is_1.isValidElementType)(Link) && ((_a = spec === null || spec === void 0 ? void 0 : spec.viewSpec) === null || _a === void 0 ? void 0 : _a.link) ? (react_1.default.createElement(Link, { value: currentValue, link: spec.viewSpec.link })) : undefined;
|
|
16
|
+
if (viewEntity.independent) {
|
|
17
|
+
const InputComponent = viewEntity.Component;
|
|
18
|
+
return (react_1.default.createElement(InputComponent, { spec: spec, name: name, Layout: Layout, value: currentValue, linkValue: linkValue }));
|
|
19
|
+
}
|
|
16
20
|
const InputComponent = viewEntity.Component;
|
|
17
|
-
|
|
21
|
+
const input = (react_1.default.createElement(InputComponent, { spec: spec, name: name, value: currentValue, linkValue: linkValue }));
|
|
22
|
+
if (Layout) {
|
|
23
|
+
return (react_1.default.createElement(Layout, { spec: spec, name: name, value: currentValue }, input));
|
|
24
|
+
}
|
|
25
|
+
return input;
|
|
18
26
|
}
|
|
19
|
-
const InputComponent = viewEntity.Component;
|
|
20
|
-
const input = (react_1.default.createElement(InputComponent, { spec: spec, name: name, value: currentValue, linkValue: linkValue }));
|
|
21
|
-
if (Layout) {
|
|
22
|
-
return (react_1.default.createElement(Layout, { spec: spec, name: name, value: currentValue }, input));
|
|
23
|
-
}
|
|
24
|
-
return input;
|
|
25
27
|
}
|
|
26
28
|
return null;
|
|
27
29
|
}, [spec, name, value, viewEntity, Layout, Link]);
|
|
@@ -7,7 +7,7 @@ const icons_1 = require("@gravity-ui/icons");
|
|
|
7
7
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
8
8
|
const utils_1 = require("../../../utils");
|
|
9
9
|
const b = (0, utils_1.block)('monaco-header');
|
|
10
|
-
const MonacoHeader = ({ language, editButton
|
|
10
|
+
const MonacoHeader = ({ language, editButton }) => (react_1.default.createElement("div", { className: b() },
|
|
11
11
|
react_1.default.createElement("div", null,
|
|
12
12
|
react_1.default.createElement(uikit_1.Icon, { data: icons_1.File, size: 18 }),
|
|
13
13
|
react_1.default.createElement("span", { className: b('language') }, language)), editButton !== null && editButton !== void 0 ? editButton : null));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.MonacoInput = exports.MonacoInputBase = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
6
|
const icons_1 = require("@gravity-ui/icons");
|
|
@@ -11,7 +11,7 @@ const MonacoHeader_1 = require("./MonacoHeader");
|
|
|
11
11
|
const MonacoInputDialog_1 = require("./MonacoInputDialog");
|
|
12
12
|
const useMonacoOptions_1 = require("./useMonacoOptions");
|
|
13
13
|
const b = (0, utils_1.block)('monaco-input');
|
|
14
|
-
const MonacoInputBase = ({ name, input, spec,
|
|
14
|
+
const MonacoInputBase = ({ name, input, spec, MonacoComponent, withoutDialog, }) => {
|
|
15
15
|
const { value, onChange } = input;
|
|
16
16
|
const MonacoEditor = (0, hooks_1.useMonaco)() || MonacoComponent;
|
|
17
17
|
const { monacoParams, disabled, layoutTitle } = spec.viewSpec;
|
|
@@ -31,14 +31,12 @@ const MonacoInputBase = ({ name, input, spec, card, MonacoComponent, withoutDial
|
|
|
31
31
|
if (!MonacoEditor) {
|
|
32
32
|
return null;
|
|
33
33
|
}
|
|
34
|
-
return (react_1.default.createElement("div", { className: b(
|
|
34
|
+
return (react_1.default.createElement("div", { className: b() },
|
|
35
35
|
react_1.default.createElement("div", { className: b('container'), "data-qa": name },
|
|
36
|
-
react_1.default.createElement(MonacoHeader_1.MonacoHeader, { language: language,
|
|
36
|
+
react_1.default.createElement(MonacoHeader_1.MonacoHeader, { language: language, editButton: dialogButton }),
|
|
37
37
|
react_1.default.createElement(MonacoEditor, { language: language, value: monacoValue, height: "300", onChange: setMonacoValue, options: options })),
|
|
38
|
-
react_1.default.createElement(MonacoInputDialog_1.MonacoInputDialog, { name: name, title: layoutTitle, fontSize: fontSize, value: monacoValue, visible: monacoEditorDialog, language: language,
|
|
38
|
+
react_1.default.createElement(MonacoInputDialog_1.MonacoInputDialog, { name: name, title: layoutTitle, fontSize: fontSize, value: monacoValue, visible: monacoEditorDialog, language: language, changeMonacoValue: setMonacoValue, onChange: onChange, onClose: handleMonacoEditorDialogClose, MonacoComponent: MonacoComponent })));
|
|
39
39
|
};
|
|
40
40
|
exports.MonacoInputBase = MonacoInputBase;
|
|
41
41
|
const MonacoInput = (props) => (react_1.default.createElement(exports.MonacoInputBase, Object.assign({}, props)));
|
|
42
42
|
exports.MonacoInput = MonacoInput;
|
|
43
|
-
const MonacoInputCard = (props) => (react_1.default.createElement(exports.MonacoInputBase, Object.assign({}, props, { card: true })));
|
|
44
|
-
exports.MonacoInputCard = MonacoInputCard;
|
|
@@ -10,7 +10,7 @@ const utils_1 = require("../../../utils");
|
|
|
10
10
|
const MonacoHeader_1 = require("./MonacoHeader");
|
|
11
11
|
const useMonacoOptions_1 = require("./useMonacoOptions");
|
|
12
12
|
const b = (0, utils_1.block)('monaco-input-dialog');
|
|
13
|
-
const MonacoInputDialog = ({ name, value, title, visible, language,
|
|
13
|
+
const MonacoInputDialog = ({ name, value, title, visible, language, onChange, onClose, changeMonacoValue, fontSize, MonacoComponent, }) => {
|
|
14
14
|
const MonacoEditor = (0, hooks_1.useMonaco)() || MonacoComponent;
|
|
15
15
|
const handleClose = react_1.default.useCallback(() => {
|
|
16
16
|
onChange(value);
|
|
@@ -24,7 +24,7 @@ const MonacoInputDialog = ({ name, value, title, visible, language, card, onChan
|
|
|
24
24
|
react_1.default.createElement(uikit_1.Dialog.Header, { caption: title, className: b('dialog-header') }),
|
|
25
25
|
react_1.default.createElement(uikit_1.Dialog.Body, null,
|
|
26
26
|
react_1.default.createElement("div", { className: b('container'), "data-qa": `${name}-dialog` },
|
|
27
|
-
react_1.default.createElement(MonacoHeader_1.MonacoHeader, { language: language
|
|
27
|
+
react_1.default.createElement(MonacoHeader_1.MonacoHeader, { language: language }),
|
|
28
28
|
react_1.default.createElement(MonacoEditor, { language: language, height: "600", width: "900", value: value, onChange: changeMonacoValue, options: options }))),
|
|
29
29
|
react_1.default.createElement(uikit_1.Dialog.Footer, { textButtonApply: (0, i18n_1.default)('button_cancel'), onClickButtonApply: handleClose })));
|
|
30
30
|
};
|
|
@@ -12,7 +12,6 @@ tslib_1.__exportStar(require("./NumberWithScale"), exports);
|
|
|
12
12
|
tslib_1.__exportStar(require("./ObjectBase"), exports);
|
|
13
13
|
tslib_1.__exportStar(require("./ObjectValueInput"), exports);
|
|
14
14
|
tslib_1.__exportStar(require("./OneOf"), exports);
|
|
15
|
-
tslib_1.__exportStar(require("./OneOfCard"), exports);
|
|
16
15
|
tslib_1.__exportStar(require("./Secret"), exports);
|
|
17
16
|
tslib_1.__exportStar(require("./Select"), exports);
|
|
18
17
|
tslib_1.__exportStar(require("./Switch"), exports);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
.df-transparent {
|
|
2
2
|
display: flex;
|
|
3
3
|
margin-bottom: 15px;
|
|
4
|
-
align-items: flex-end;
|
|
5
4
|
}
|
|
6
5
|
.df-transparent:last-child {
|
|
7
6
|
margin-bottom: 0;
|
|
@@ -12,6 +11,9 @@
|
|
|
12
11
|
.df-transparent_without-max-width {
|
|
13
12
|
max-width: unset;
|
|
14
13
|
}
|
|
14
|
+
.df-transparent_without-max-width > .df-error-wrapper {
|
|
15
|
+
width: auto;
|
|
16
|
+
}
|
|
15
17
|
.df-transparent__remove-button {
|
|
16
18
|
margin-left: 5px;
|
|
17
19
|
}
|
|
@@ -2,12 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./Accordeon"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./AccordeonCardLayout"), exports);
|
|
6
5
|
tslib_1.__exportStar(require("./CardAccordeon"), exports);
|
|
7
6
|
tslib_1.__exportStar(require("./CardSection"), exports);
|
|
8
7
|
tslib_1.__exportStar(require("./Row"), exports);
|
|
9
|
-
tslib_1.__exportStar(require("./Row2"), exports);
|
|
10
8
|
tslib_1.__exportStar(require("./Section"), exports);
|
|
11
|
-
tslib_1.__exportStar(require("./SectionCard"), exports);
|
|
12
9
|
tslib_1.__exportStar(require("./TableCell"), exports);
|
|
13
10
|
tslib_1.__exportStar(require("./Transparent"), exports);
|
|
@@ -2,12 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./ViewAccordeon"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./ViewAccordeonCard"), exports);
|
|
6
5
|
tslib_1.__exportStar(require("./ViewCardAccordeon"), exports);
|
|
7
6
|
tslib_1.__exportStar(require("./ViewCardSection"), exports);
|
|
8
7
|
tslib_1.__exportStar(require("./ViewRow"), exports);
|
|
9
|
-
tslib_1.__exportStar(require("./ViewRow2"), exports);
|
|
10
8
|
tslib_1.__exportStar(require("./ViewSection"), exports);
|
|
11
|
-
tslib_1.__exportStar(require("./ViewSectionCard"), exports);
|
|
12
9
|
tslib_1.__exportStar(require("./ViewTableCell"), exports);
|
|
13
10
|
tslib_1.__exportStar(require("./ViewTransparent"), exports);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.MonacoView = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
6
|
const icons_1 = require("@gravity-ui/icons");
|
|
@@ -11,7 +11,7 @@ const MonacoHeader_1 = require("../../Inputs/MonacoInput/MonacoHeader");
|
|
|
11
11
|
const useMonacoOptions_1 = require("../../Inputs/MonacoInput/useMonacoOptions");
|
|
12
12
|
const MonacoViewDialog_1 = require("./MonacoViewDialog");
|
|
13
13
|
const b = (0, utils_1.block)('monaco-base-view');
|
|
14
|
-
const MonacoBaseView = ({ value, spec
|
|
14
|
+
const MonacoBaseView = ({ value, spec }) => {
|
|
15
15
|
const { monacoParams, layoutTitle } = spec.viewSpec;
|
|
16
16
|
const MonacoEditor = (0, hooks_1.useMonaco)();
|
|
17
17
|
const { language, fontSize } = monacoParams !== null && monacoParams !== void 0 ? monacoParams : { language: 'plaintext', fontSize: 12 };
|
|
@@ -21,13 +21,11 @@ const MonacoBaseView = ({ value, spec, card }) => {
|
|
|
21
21
|
if (!value || !MonacoEditor) {
|
|
22
22
|
return null;
|
|
23
23
|
}
|
|
24
|
-
return (react_1.default.createElement("div", { className: b(
|
|
25
|
-
react_1.default.createElement(MonacoHeader_1.MonacoHeader, { language: language,
|
|
24
|
+
return (react_1.default.createElement("div", { className: b() },
|
|
25
|
+
react_1.default.createElement(MonacoHeader_1.MonacoHeader, { language: language, editButton: react_1.default.createElement(uikit_1.Button, { onClick: () => setMonacoEditorDialog(true) },
|
|
26
26
|
react_1.default.createElement(uikit_1.Icon, { data: icons_1.ChevronsExpandUpRight, size: 16 })) }),
|
|
27
27
|
react_1.default.createElement(MonacoEditor, { language: language, value: value, height: '250', options: options }),
|
|
28
|
-
react_1.default.createElement(MonacoViewDialog_1.MonacoViewDialog, { title: layoutTitle, fontSize: fontSize,
|
|
28
|
+
react_1.default.createElement(MonacoViewDialog_1.MonacoViewDialog, { title: layoutTitle, fontSize: fontSize, value: value, visible: monacoEditorDialog, language: language, onClose: handleMonacoEditorDialogClose })));
|
|
29
29
|
};
|
|
30
30
|
const MonacoView = (props) => react_1.default.createElement(MonacoBaseView, Object.assign({}, props));
|
|
31
31
|
exports.MonacoView = MonacoView;
|
|
32
|
-
const MonacoViewCard = (props) => (react_1.default.createElement(MonacoBaseView, Object.assign({}, props, { card: true })));
|
|
33
|
-
exports.MonacoViewCard = MonacoViewCard;
|
|
@@ -10,7 +10,7 @@ const utils_1 = require("../../../utils");
|
|
|
10
10
|
const MonacoHeader_1 = require("../../Inputs/MonacoInput/MonacoHeader");
|
|
11
11
|
const useMonacoOptions_1 = require("../../Inputs/MonacoInput/useMonacoOptions");
|
|
12
12
|
const b = (0, utils_1.block)('monaco-view-dialog');
|
|
13
|
-
const MonacoViewDialog = ({ value, title, visible, language, onClose, fontSize,
|
|
13
|
+
const MonacoViewDialog = ({ value, title, visible, language, onClose, fontSize, }) => {
|
|
14
14
|
const MonacoEditor = (0, hooks_1.useMonaco)();
|
|
15
15
|
const handleClose = react_1.default.useCallback(() => {
|
|
16
16
|
onClose();
|
|
@@ -23,7 +23,7 @@ const MonacoViewDialog = ({ value, title, visible, language, onClose, fontSize,
|
|
|
23
23
|
react_1.default.createElement(uikit_1.Dialog.Header, { caption: title, className: b('dialog-header') }),
|
|
24
24
|
react_1.default.createElement(uikit_1.Dialog.Body, null,
|
|
25
25
|
react_1.default.createElement("div", { className: b('container') },
|
|
26
|
-
react_1.default.createElement(MonacoHeader_1.MonacoHeader, { language: language
|
|
26
|
+
react_1.default.createElement(MonacoHeader_1.MonacoHeader, { language: language }),
|
|
27
27
|
react_1.default.createElement(MonacoEditor, { language: language, height: "600", width: "900", value: value, options: options }))),
|
|
28
28
|
react_1.default.createElement(uikit_1.Dialog.Footer, { textButtonApply: (0, i18n_1.default)('button_cancel'), onClickButtonApply: handleClose })));
|
|
29
29
|
};
|
|
@@ -11,7 +11,6 @@ tslib_1.__exportStar(require("./MultiSelectView"), exports);
|
|
|
11
11
|
tslib_1.__exportStar(require("./NumberWithScaleView"), exports);
|
|
12
12
|
tslib_1.__exportStar(require("./ObjectBaseView"), exports);
|
|
13
13
|
tslib_1.__exportStar(require("./ObjectValueInputView"), exports);
|
|
14
|
-
tslib_1.__exportStar(require("./OneOfCardView"), exports);
|
|
15
14
|
tslib_1.__exportStar(require("./OneOfView"), exports);
|
|
16
15
|
tslib_1.__exportStar(require("./TableArrayView"), exports);
|
|
17
16
|
tslib_1.__exportStar(require("./TextAreaView"), exports);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.dynamicViewConfig = exports.dynamicConfig = void 0;
|
|
4
4
|
const components_1 = require("../components");
|
|
5
5
|
const validators_1 = require("../validators");
|
|
6
6
|
exports.dynamicConfig = {
|
|
@@ -112,103 +112,6 @@ exports.dynamicConfig = {
|
|
|
112
112
|
},
|
|
113
113
|
},
|
|
114
114
|
};
|
|
115
|
-
exports.dynamicCardConfig = {
|
|
116
|
-
array: {
|
|
117
|
-
inputs: {
|
|
118
|
-
select: { Component: components_1.MultiSelect },
|
|
119
|
-
table: { Component: components_1.TableArrayInput },
|
|
120
|
-
base: { Component: components_1.ArrayBase },
|
|
121
|
-
},
|
|
122
|
-
layouts: {
|
|
123
|
-
row: components_1.Row2,
|
|
124
|
-
accordeon: components_1.AccordeonCardLayout,
|
|
125
|
-
section: components_1.SectionWithSubtitle,
|
|
126
|
-
section2: components_1.SectionWithSubtitle2,
|
|
127
|
-
group: components_1.SectionCard,
|
|
128
|
-
group2: components_1.SectionCard2,
|
|
129
|
-
table_item: components_1.TableCell,
|
|
130
|
-
transparent: components_1.Transparent,
|
|
131
|
-
},
|
|
132
|
-
validators: {
|
|
133
|
-
base: (0, validators_1.getArrayValidator)(),
|
|
134
|
-
},
|
|
135
|
-
},
|
|
136
|
-
boolean: {
|
|
137
|
-
inputs: {
|
|
138
|
-
base: { Component: components_1.Checkbox },
|
|
139
|
-
switch: { Component: components_1.Switch },
|
|
140
|
-
},
|
|
141
|
-
layouts: {
|
|
142
|
-
row: components_1.Row2,
|
|
143
|
-
table_item: components_1.TableCell,
|
|
144
|
-
},
|
|
145
|
-
validators: {
|
|
146
|
-
base: (0, validators_1.getBooleanValidator)(),
|
|
147
|
-
},
|
|
148
|
-
},
|
|
149
|
-
number: {
|
|
150
|
-
inputs: {
|
|
151
|
-
base: { Component: components_1.Text },
|
|
152
|
-
},
|
|
153
|
-
layouts: {
|
|
154
|
-
row: components_1.Row2,
|
|
155
|
-
table_item: components_1.TableCell,
|
|
156
|
-
transparent: components_1.Transparent,
|
|
157
|
-
},
|
|
158
|
-
validators: {
|
|
159
|
-
base: (0, validators_1.getNumberValidator)(),
|
|
160
|
-
},
|
|
161
|
-
},
|
|
162
|
-
object: {
|
|
163
|
-
inputs: {
|
|
164
|
-
oneof: { Component: components_1.OneOfCard, independent: true },
|
|
165
|
-
secret: { Component: components_1.Secret, independent: true },
|
|
166
|
-
base: { Component: components_1.ObjectBase, independent: true },
|
|
167
|
-
text_link: { Component: components_1.TextLink, independent: true },
|
|
168
|
-
object_value: { Component: components_1.ObjectValueInput, independent: true },
|
|
169
|
-
multi_oneof: { Component: components_1.MultiOneOf, independent: true },
|
|
170
|
-
multi_oneof_flat: { Component: components_1.MultiOneOfFlat, independent: true },
|
|
171
|
-
inline: { Component: components_1.ObjectInline, independent: true },
|
|
172
|
-
},
|
|
173
|
-
layouts: {
|
|
174
|
-
row: components_1.Row2,
|
|
175
|
-
accordeon: components_1.AccordeonCardLayout,
|
|
176
|
-
section: components_1.SectionWithSubtitle,
|
|
177
|
-
section2: components_1.SectionWithSubtitle2,
|
|
178
|
-
group: components_1.SectionCard,
|
|
179
|
-
group2: components_1.SectionCard2,
|
|
180
|
-
transparent: components_1.Transparent,
|
|
181
|
-
},
|
|
182
|
-
validators: {
|
|
183
|
-
base: (0, validators_1.getObjectValidator)(),
|
|
184
|
-
},
|
|
185
|
-
},
|
|
186
|
-
string: {
|
|
187
|
-
inputs: {
|
|
188
|
-
password: { Component: components_1.Text },
|
|
189
|
-
textarea: { Component: components_1.TextArea },
|
|
190
|
-
select: { Component: components_1.Select },
|
|
191
|
-
base: { Component: components_1.Text },
|
|
192
|
-
file_input: { Component: components_1.FileInput },
|
|
193
|
-
number_with_scale: { Component: components_1.NumberWithScale },
|
|
194
|
-
monaco_input: { Component: components_1.MonacoInputCard },
|
|
195
|
-
text_content: { Component: components_1.TextContent, independent: true },
|
|
196
|
-
},
|
|
197
|
-
layouts: {
|
|
198
|
-
row: components_1.Row2,
|
|
199
|
-
table_item: components_1.TableCell,
|
|
200
|
-
transparent: components_1.Transparent,
|
|
201
|
-
section: components_1.SectionWithSubtitle,
|
|
202
|
-
section2: components_1.SectionWithSubtitle2,
|
|
203
|
-
group: components_1.SectionCard,
|
|
204
|
-
group2: components_1.SectionCard2,
|
|
205
|
-
},
|
|
206
|
-
validators: {
|
|
207
|
-
base: (0, validators_1.getStringValidator)(),
|
|
208
|
-
number: (0, validators_1.getNumberValidator)(),
|
|
209
|
-
},
|
|
210
|
-
},
|
|
211
|
-
};
|
|
212
115
|
exports.dynamicViewConfig = {
|
|
213
116
|
array: {
|
|
214
117
|
views: {
|
|
@@ -302,84 +205,3 @@ exports.dynamicViewConfig = {
|
|
|
302
205
|
},
|
|
303
206
|
},
|
|
304
207
|
};
|
|
305
|
-
exports.dynamicViewCardConfig = {
|
|
306
|
-
array: {
|
|
307
|
-
views: {
|
|
308
|
-
select: { Component: components_1.MultiSelectView },
|
|
309
|
-
table: { Component: components_1.TableArrayView },
|
|
310
|
-
base: { Component: components_1.ArrayBaseView },
|
|
311
|
-
},
|
|
312
|
-
layouts: {
|
|
313
|
-
row: components_1.ViewRow2,
|
|
314
|
-
accordeon: components_1.ViewAccordeonCard,
|
|
315
|
-
section: components_1.ViewSection,
|
|
316
|
-
section2: components_1.ViewSection2,
|
|
317
|
-
group: components_1.ViewSectionCard,
|
|
318
|
-
group2: components_1.ViewSectionCard2,
|
|
319
|
-
table_item: components_1.ViewTableCell,
|
|
320
|
-
transparent: components_1.ViewTransparent,
|
|
321
|
-
},
|
|
322
|
-
},
|
|
323
|
-
boolean: {
|
|
324
|
-
views: {
|
|
325
|
-
base: { Component: components_1.BaseView },
|
|
326
|
-
switch: { Component: components_1.BaseView },
|
|
327
|
-
},
|
|
328
|
-
layouts: {
|
|
329
|
-
row: components_1.ViewRow2,
|
|
330
|
-
table_item: components_1.ViewTableCell,
|
|
331
|
-
},
|
|
332
|
-
},
|
|
333
|
-
number: {
|
|
334
|
-
views: {
|
|
335
|
-
base: { Component: components_1.BaseView },
|
|
336
|
-
},
|
|
337
|
-
layouts: {
|
|
338
|
-
row: components_1.ViewRow2,
|
|
339
|
-
table_item: components_1.ViewTableCell,
|
|
340
|
-
transparent: components_1.ViewTransparent,
|
|
341
|
-
},
|
|
342
|
-
},
|
|
343
|
-
object: {
|
|
344
|
-
views: {
|
|
345
|
-
oneof: { Component: components_1.OneOfCardView, independent: true },
|
|
346
|
-
secret: undefined,
|
|
347
|
-
base: { Component: components_1.ObjectBaseView, independent: true },
|
|
348
|
-
text_link: { Component: components_1.TextLinkView, independent: true },
|
|
349
|
-
object_value: { Component: components_1.ObjectValueInputView, independent: true },
|
|
350
|
-
multi_oneof: { Component: components_1.MultiOneOfView, independent: true },
|
|
351
|
-
multi_oneof_flat: { Component: components_1.MultiOneOfFlatView, independent: true },
|
|
352
|
-
inline: { Component: components_1.ObjectInlineView, independent: true },
|
|
353
|
-
},
|
|
354
|
-
layouts: {
|
|
355
|
-
row: components_1.ViewRow2,
|
|
356
|
-
accordeon: components_1.ViewAccordeonCard,
|
|
357
|
-
section: components_1.ViewSection,
|
|
358
|
-
section2: components_1.ViewSection2,
|
|
359
|
-
group: components_1.ViewSectionCard,
|
|
360
|
-
group2: components_1.ViewSectionCard2,
|
|
361
|
-
transparent: components_1.ViewTransparent,
|
|
362
|
-
},
|
|
363
|
-
},
|
|
364
|
-
string: {
|
|
365
|
-
views: {
|
|
366
|
-
password: undefined,
|
|
367
|
-
textarea: { Component: components_1.TextAreaView },
|
|
368
|
-
select: { Component: components_1.BaseView },
|
|
369
|
-
base: { Component: components_1.BaseView },
|
|
370
|
-
file_input: { Component: components_1.FileInputView },
|
|
371
|
-
number_with_scale: { Component: components_1.NumberWithScaleView },
|
|
372
|
-
monaco_input: { Component: components_1.MonacoViewCard },
|
|
373
|
-
text_content: undefined,
|
|
374
|
-
},
|
|
375
|
-
layouts: {
|
|
376
|
-
row: components_1.ViewRow2,
|
|
377
|
-
table_item: components_1.ViewTableCell,
|
|
378
|
-
transparent: components_1.ViewTransparent,
|
|
379
|
-
section: components_1.ViewSection,
|
|
380
|
-
section2: components_1.ViewSection2,
|
|
381
|
-
group: components_1.ViewSectionCard,
|
|
382
|
-
group2: components_1.ViewSectionCard2,
|
|
383
|
-
},
|
|
384
|
-
},
|
|
385
|
-
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
|
-
import { isCorrectSpec } from '../../helpers';
|
|
3
2
|
import { useComponents, useControllerMirror, useDynamicFormsCtx, useField, useRender, useSearch, useValidate, } from './hooks';
|
|
4
3
|
export const Controller = ({ spec, name, value, parentOnChange, parentOnUnmount, }) => {
|
|
5
4
|
const { tools, __mirror } = useDynamicFormsCtx();
|
|
@@ -24,8 +23,5 @@ export const Controller = ({ spec, name, value, parentOnChange, parentOnUnmount,
|
|
|
24
23
|
useField: renderProps,
|
|
25
24
|
useSearch: withSearch,
|
|
26
25
|
}, __mirror);
|
|
27
|
-
|
|
28
|
-
return withSearch(render(renderProps));
|
|
29
|
-
}
|
|
30
|
-
return null;
|
|
26
|
+
return withSearch(render(renderProps));
|
|
31
27
|
};
|
|
@@ -4,16 +4,18 @@ import { isCorrectSpec } from '../../../helpers';
|
|
|
4
4
|
export const useRender = ({ name, spec, inputEntity, Layout, }) => {
|
|
5
5
|
const render = React.useCallback((props) => {
|
|
6
6
|
if (inputEntity && isCorrectSpec(spec) && _.isString(name)) {
|
|
7
|
-
if (
|
|
7
|
+
if (!spec.viewSpec.hidden) {
|
|
8
|
+
if (inputEntity.independent) {
|
|
9
|
+
const InputComponent = inputEntity.Component;
|
|
10
|
+
return (React.createElement(InputComponent, Object.assign({ spec: spec, name: name, Layout: Layout }, props)));
|
|
11
|
+
}
|
|
8
12
|
const InputComponent = inputEntity.Component;
|
|
9
|
-
|
|
13
|
+
const input = React.createElement(InputComponent, Object.assign({ spec: spec, name: name }, props));
|
|
14
|
+
if (Layout) {
|
|
15
|
+
return (React.createElement(Layout, Object.assign({ spec: spec, name: name }, props), input));
|
|
16
|
+
}
|
|
17
|
+
return input;
|
|
10
18
|
}
|
|
11
|
-
const InputComponent = inputEntity.Component;
|
|
12
|
-
const input = React.createElement(InputComponent, Object.assign({ spec: spec, name: name }, props));
|
|
13
|
-
if (Layout) {
|
|
14
|
-
return (React.createElement(Layout, Object.assign({ spec: spec, name: name }, props), input));
|
|
15
|
-
}
|
|
16
|
-
return input;
|
|
17
19
|
}
|
|
18
20
|
return null;
|
|
19
21
|
}, [spec, name, inputEntity, Layout]);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Spec } from '../../../../types';
|
|
2
2
|
import { FieldValue } from '../../types';
|
|
3
3
|
import './useSearch.css';
|
|
4
|
-
export declare const useSearch: (spec: Spec, value: FieldValue, name: string) => (children: JSX.Element | null) => JSX.Element;
|
|
4
|
+
export declare const useSearch: (spec: Spec, value: FieldValue, name: string) => (children: JSX.Element | null) => JSX.Element | null;
|
|
@@ -7,7 +7,7 @@ export const useSearch = (spec, value, name) => {
|
|
|
7
7
|
const { setField, removeField, isHiddenField, searchFunction } = useSearchContext();
|
|
8
8
|
const searchResult = React.useMemo(() => !searchFunction(spec, value, name), [name, searchFunction, spec, value]);
|
|
9
9
|
const hidden = React.useMemo(() => isHiddenField(name), [isHiddenField, name]);
|
|
10
|
-
const withSearch = React.useCallback((children) => React.createElement("div", { className: b({ hidden: hidden }) }, children), [hidden]);
|
|
10
|
+
const withSearch = React.useCallback((children) => children ? React.createElement("div", { className: b({ hidden: hidden }) }, children) : null, [hidden]);
|
|
11
11
|
React.useEffect(() => {
|
|
12
12
|
setField(name, searchResult);
|
|
13
13
|
}, [searchResult]);
|
|
@@ -3,4 +3,4 @@ export interface ViewControllerProps<SpecType extends Spec> {
|
|
|
3
3
|
spec: SpecType;
|
|
4
4
|
name: string;
|
|
5
5
|
}
|
|
6
|
-
export declare const ViewController: <SpecType extends Spec>({ spec, name, }: ViewControllerProps<SpecType>) => JSX.Element
|
|
6
|
+
export declare const ViewController: <SpecType extends Spec>({ spec, name, }: ViewControllerProps<SpecType>) => JSX.Element;
|
|
@@ -4,8 +4,5 @@ export const ViewController = ({ spec, name, }) => {
|
|
|
4
4
|
const { config, value, Link } = useDynamicFormsCtx();
|
|
5
5
|
const { viewEntity, Layout } = useComponents(spec, config);
|
|
6
6
|
const render = useRender({ name, value, spec, viewEntity, Layout, Link });
|
|
7
|
-
|
|
8
|
-
return React.createElement(React.Fragment, null, render);
|
|
9
|
-
}
|
|
10
|
-
return null;
|
|
7
|
+
return React.createElement(React.Fragment, null, render);
|
|
11
8
|
};
|
|
@@ -6,18 +6,20 @@ export const useRender = ({ value, name, spec, viewEntity, Layout, Link, }) => {
|
|
|
6
6
|
const render = React.useMemo(() => {
|
|
7
7
|
var _a;
|
|
8
8
|
if (viewEntity && isCorrectSpec(spec) && _.isString(name)) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
if (!spec.viewSpec.hidden) {
|
|
10
|
+
const currentValue = name ? _.get(value, name) : value;
|
|
11
|
+
const linkValue = isValidElementType(Link) && ((_a = spec === null || spec === void 0 ? void 0 : spec.viewSpec) === null || _a === void 0 ? void 0 : _a.link) ? (React.createElement(Link, { value: currentValue, link: spec.viewSpec.link })) : undefined;
|
|
12
|
+
if (viewEntity.independent) {
|
|
13
|
+
const InputComponent = viewEntity.Component;
|
|
14
|
+
return (React.createElement(InputComponent, { spec: spec, name: name, Layout: Layout, value: currentValue, linkValue: linkValue }));
|
|
15
|
+
}
|
|
12
16
|
const InputComponent = viewEntity.Component;
|
|
13
|
-
|
|
17
|
+
const input = (React.createElement(InputComponent, { spec: spec, name: name, value: currentValue, linkValue: linkValue }));
|
|
18
|
+
if (Layout) {
|
|
19
|
+
return (React.createElement(Layout, { spec: spec, name: name, value: currentValue }, input));
|
|
20
|
+
}
|
|
21
|
+
return input;
|
|
14
22
|
}
|
|
15
|
-
const InputComponent = viewEntity.Component;
|
|
16
|
-
const input = (React.createElement(InputComponent, { spec: spec, name: name, value: currentValue, linkValue: linkValue }));
|
|
17
|
-
if (Layout) {
|
|
18
|
-
return (React.createElement(Layout, { spec: spec, name: name, value: currentValue }, input));
|
|
19
|
-
}
|
|
20
|
-
return input;
|
|
21
23
|
}
|
|
22
24
|
return null;
|
|
23
25
|
}, [spec, name, value, viewEntity, Layout, Link]);
|