@gravity-ui/dynamic-forms 2.8.1 → 3.0.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/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/ErrorWrapper/ErrorWrapper.css +1 -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/Row/Row.js +4 -1
- package/build/cjs/lib/kit/components/Layouts/Transparent/Transparent.js +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/ErrorWrapper/ErrorWrapper.css +1 -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/Row/Row.js +4 -1
- package/build/esm/lib/kit/components/Layouts/Transparent/Transparent.js +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 -27
- 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 -23
- 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
|
@@ -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]);
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
.df-error-wrapper_error .g-select:focus:not(.df-error-wrapper-ignore),
|
|
12
12
|
.df-error-wrapper_error .g-select:not(.df-error-wrapper-ignore) .g-select-control::before,
|
|
13
13
|
.df-error-wrapper_error .g-select:hover:not(.df-error-wrapper-ignore) .g-select-control_open::before,
|
|
14
|
+
.df-error-wrapper_error .g-select:not(.df-error-wrapper-ignore) .g-select-control__button::before,
|
|
14
15
|
.df-error-wrapper_error .g-text-area__content:not(.df-error-wrapper-ignore),
|
|
15
16
|
.df-error-wrapper_error .g-text-area__content:hover:not(.df-error-wrapper-ignore),
|
|
16
17
|
.df-error-wrapper_error .yc-text-input_view_normal:not(.df-error-wrapper-ignore) .yc-text-input__control,
|
|
@@ -4,7 +4,7 @@ import { Icon } from '@gravity-ui/uikit';
|
|
|
4
4
|
import { block } from '../../../utils';
|
|
5
5
|
import './MonacoHeader.css';
|
|
6
6
|
const b = block('monaco-header');
|
|
7
|
-
export const MonacoHeader = ({ language, editButton
|
|
7
|
+
export const MonacoHeader = ({ language, editButton }) => (React.createElement("div", { className: b() },
|
|
8
8
|
React.createElement("div", null,
|
|
9
9
|
React.createElement(Icon, { data: File, size: 18 }),
|
|
10
10
|
React.createElement("span", { className: b('language') }, language)), editButton !== null && editButton !== void 0 ? editButton : null));
|
|
@@ -3,10 +3,8 @@ import type { MonacoEditorProps } from 'react-monaco-editor/lib/types';
|
|
|
3
3
|
import { StringInputProps } from '../../../../core/';
|
|
4
4
|
import './MonacoInputBase.css';
|
|
5
5
|
export interface MonacoInputBaseProps extends StringInputProps {
|
|
6
|
-
card?: boolean;
|
|
7
6
|
MonacoComponent?: React.ComponentType<MonacoEditorProps>;
|
|
8
7
|
withoutDialog?: boolean;
|
|
9
8
|
}
|
|
10
9
|
export declare const MonacoInputBase: React.FC<MonacoInputBaseProps>;
|
|
11
10
|
export declare const MonacoInput: React.FC<MonacoInputBaseProps>;
|
|
12
|
-
export declare const MonacoInputCard: React.FC<MonacoInputBaseProps>;
|
|
@@ -8,7 +8,7 @@ import { MonacoInputDialog } from './MonacoInputDialog';
|
|
|
8
8
|
import { useMonacoOptions } from './useMonacoOptions';
|
|
9
9
|
import './MonacoInputBase.css';
|
|
10
10
|
const b = block('monaco-input');
|
|
11
|
-
export const MonacoInputBase = ({ name, input, spec,
|
|
11
|
+
export const MonacoInputBase = ({ name, input, spec, MonacoComponent, withoutDialog, }) => {
|
|
12
12
|
const { value, onChange } = input;
|
|
13
13
|
const MonacoEditor = useMonaco() || MonacoComponent;
|
|
14
14
|
const { monacoParams, disabled, layoutTitle } = spec.viewSpec;
|
|
@@ -28,11 +28,10 @@ export const MonacoInputBase = ({ name, input, spec, card, MonacoComponent, with
|
|
|
28
28
|
if (!MonacoEditor) {
|
|
29
29
|
return null;
|
|
30
30
|
}
|
|
31
|
-
return (React.createElement("div", { className: b(
|
|
31
|
+
return (React.createElement("div", { className: b() },
|
|
32
32
|
React.createElement("div", { className: b('container'), "data-qa": name },
|
|
33
|
-
React.createElement(MonacoHeader, { language: language,
|
|
33
|
+
React.createElement(MonacoHeader, { language: language, editButton: dialogButton }),
|
|
34
34
|
React.createElement(MonacoEditor, { language: language, value: monacoValue, height: "300", onChange: setMonacoValue, options: options })),
|
|
35
|
-
React.createElement(MonacoInputDialog, { name: name, title: layoutTitle, fontSize: fontSize, value: monacoValue, visible: monacoEditorDialog, language: language,
|
|
35
|
+
React.createElement(MonacoInputDialog, { name: name, title: layoutTitle, fontSize: fontSize, value: monacoValue, visible: monacoEditorDialog, language: language, changeMonacoValue: setMonacoValue, onChange: onChange, onClose: handleMonacoEditorDialogClose, MonacoComponent: MonacoComponent })));
|
|
36
36
|
};
|
|
37
37
|
export const MonacoInput = (props) => (React.createElement(MonacoInputBase, Object.assign({}, props)));
|
|
38
|
-
export const MonacoInputCard = (props) => (React.createElement(MonacoInputBase, Object.assign({}, props, { card: true })));
|
|
@@ -7,7 +7,7 @@ import { MonacoHeader } from './MonacoHeader';
|
|
|
7
7
|
import { useMonacoOptions } from './useMonacoOptions';
|
|
8
8
|
import './MonacoInputDialog.css';
|
|
9
9
|
const b = block('monaco-input-dialog');
|
|
10
|
-
export const MonacoInputDialog = ({ name, value, title, visible, language,
|
|
10
|
+
export const MonacoInputDialog = ({ name, value, title, visible, language, onChange, onClose, changeMonacoValue, fontSize, MonacoComponent, }) => {
|
|
11
11
|
const MonacoEditor = useMonaco() || MonacoComponent;
|
|
12
12
|
const handleClose = React.useCallback(() => {
|
|
13
13
|
onChange(value);
|
|
@@ -21,7 +21,7 @@ export const MonacoInputDialog = ({ name, value, title, visible, language, card,
|
|
|
21
21
|
React.createElement(Dialog.Header, { caption: title, className: b('dialog-header') }),
|
|
22
22
|
React.createElement(Dialog.Body, null,
|
|
23
23
|
React.createElement("div", { className: b('container'), "data-qa": `${name}-dialog` },
|
|
24
|
-
React.createElement(MonacoHeader, { language: language
|
|
24
|
+
React.createElement(MonacoHeader, { language: language }),
|
|
25
25
|
React.createElement(MonacoEditor, { language: language, height: "600", width: "900", value: value, onChange: changeMonacoValue, options: options }))),
|
|
26
26
|
React.createElement(Dialog.Footer, { textButtonApply: i18n('button_cancel'), onClickButtonApply: handleClose })));
|
|
27
27
|
};
|
|
@@ -19,7 +19,10 @@ const RowBase = ({ name, spec, input, meta, verboseDescription, children, }) =>
|
|
|
19
19
|
React.createElement(HelpPopover, { htmlContent: spec.viewSpec.layoutDescription, placement: ['bottom', 'top'] })))) : null)),
|
|
20
20
|
React.createElement("div", { className: b('right') },
|
|
21
21
|
React.createElement("div", { className: b('right-inner') },
|
|
22
|
-
React.createElement(ErrorWrapper, { name: name, meta: meta, withoutChildErrorStyles:
|
|
22
|
+
React.createElement(ErrorWrapper, { name: name, meta: meta, withoutChildErrorStyles:
|
|
23
|
+
// TODO: remove condition spec.viewSpec.type !== 'select'
|
|
24
|
+
(isArraySpec(spec) && spec.viewSpec.type !== 'select') ||
|
|
25
|
+
isObjectSpec(spec), className: b('error-wrapper') }, children),
|
|
23
26
|
generateButton ? (React.createElement(GenerateRandomValueButton, { spec: spec, onChange: input.onChange })) : null,
|
|
24
27
|
arrayItem ? (React.createElement(Button, { view: "flat-secondary", className: b('remove-button'), onClick: input.onDrop, qa: `${name}-remove-item` },
|
|
25
28
|
React.createElement(Icon, { data: TrashBin, size: 16 }))) : null),
|
|
@@ -21,7 +21,9 @@ export const Transparent = ({ name, spec, input, meta, children, }) => {
|
|
|
21
21
|
'array-item': arrayItem && !arrOrObjFlag,
|
|
22
22
|
'without-max-width': arrOrObjFlag,
|
|
23
23
|
}) },
|
|
24
|
-
React.createElement(ErrorWrapper, { name: name, meta: meta, withoutChildErrorStyles:
|
|
24
|
+
React.createElement(ErrorWrapper, { name: name, meta: meta, withoutChildErrorStyles:
|
|
25
|
+
// TODO: remove condition spec.viewSpec.type !== 'select'
|
|
26
|
+
(isArraySpec(spec) && spec.viewSpec.type !== 'select') || isObjectSpec(spec) }, children),
|
|
25
27
|
generateButton ? (React.createElement(GenerateRandomValueButton, { spec: spec, onChange: input.onChange })) : null,
|
|
26
28
|
removeButton));
|
|
27
29
|
};
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
export * from './Accordeon';
|
|
2
|
-
export * from './AccordeonCardLayout';
|
|
3
2
|
export * from './CardAccordeon';
|
|
4
3
|
export * from './CardSection';
|
|
5
4
|
export * from './Row';
|
|
6
|
-
export * from './Row2';
|
|
7
5
|
export * from './Section';
|
|
8
|
-
export * from './SectionCard';
|
|
9
6
|
export * from './TableCell';
|
|
10
7
|
export * from './Transparent';
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
export * from './Accordeon';
|
|
2
|
-
export * from './AccordeonCardLayout';
|
|
3
2
|
export * from './CardAccordeon';
|
|
4
3
|
export * from './CardSection';
|
|
5
4
|
export * from './Row';
|
|
6
|
-
export * from './Row2';
|
|
7
5
|
export * from './Section';
|
|
8
|
-
export * from './SectionCard';
|
|
9
6
|
export * from './TableCell';
|
|
10
7
|
export * from './Transparent';
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
export * from './ViewAccordeon';
|
|
2
|
-
export * from './ViewAccordeonCard';
|
|
3
2
|
export * from './ViewCardAccordeon';
|
|
4
3
|
export * from './ViewCardSection';
|
|
5
4
|
export * from './ViewRow';
|
|
6
|
-
export * from './ViewRow2';
|
|
7
5
|
export * from './ViewSection';
|
|
8
|
-
export * from './ViewSectionCard';
|
|
9
6
|
export * from './ViewTableCell';
|
|
10
7
|
export * from './ViewTransparent';
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
export * from './ViewAccordeon';
|
|
2
|
-
export * from './ViewAccordeonCard';
|
|
3
2
|
export * from './ViewCardAccordeon';
|
|
4
3
|
export * from './ViewCardSection';
|
|
5
4
|
export * from './ViewRow';
|
|
6
|
-
export * from './ViewRow2';
|
|
7
5
|
export * from './ViewSection';
|
|
8
|
-
export * from './ViewSectionCard';
|
|
9
6
|
export * from './ViewTableCell';
|
|
10
7
|
export * from './ViewTransparent';
|
|
@@ -8,7 +8,7 @@ import { useMonacoOptions } from '../../Inputs/MonacoInput/useMonacoOptions';
|
|
|
8
8
|
import { MonacoViewDialog } from './MonacoViewDialog';
|
|
9
9
|
import './MonacoBaseView.css';
|
|
10
10
|
const b = block('monaco-base-view');
|
|
11
|
-
const MonacoBaseView = ({ value, spec
|
|
11
|
+
const MonacoBaseView = ({ value, spec }) => {
|
|
12
12
|
const { monacoParams, layoutTitle } = spec.viewSpec;
|
|
13
13
|
const MonacoEditor = useMonaco();
|
|
14
14
|
const { language, fontSize } = monacoParams !== null && monacoParams !== void 0 ? monacoParams : { language: 'plaintext', fontSize: 12 };
|
|
@@ -18,11 +18,10 @@ const MonacoBaseView = ({ value, spec, card }) => {
|
|
|
18
18
|
if (!value || !MonacoEditor) {
|
|
19
19
|
return null;
|
|
20
20
|
}
|
|
21
|
-
return (React.createElement("div", { className: b(
|
|
22
|
-
React.createElement(MonacoHeader, { language: language,
|
|
21
|
+
return (React.createElement("div", { className: b() },
|
|
22
|
+
React.createElement(MonacoHeader, { language: language, editButton: React.createElement(Button, { onClick: () => setMonacoEditorDialog(true) },
|
|
23
23
|
React.createElement(Icon, { data: ChevronsExpandUpRight, size: 16 })) }),
|
|
24
24
|
React.createElement(MonacoEditor, { language: language, value: value, height: '250', options: options }),
|
|
25
|
-
React.createElement(MonacoViewDialog, { title: layoutTitle, fontSize: fontSize,
|
|
25
|
+
React.createElement(MonacoViewDialog, { title: layoutTitle, fontSize: fontSize, value: value, visible: monacoEditorDialog, language: language, onClose: handleMonacoEditorDialogClose })));
|
|
26
26
|
};
|
|
27
27
|
export const MonacoView = (props) => React.createElement(MonacoBaseView, Object.assign({}, props));
|
|
28
|
-
export const MonacoViewCard = (props) => (React.createElement(MonacoBaseView, Object.assign({}, props, { card: true })));
|
|
@@ -7,7 +7,7 @@ import { MonacoHeader } from '../../Inputs/MonacoInput/MonacoHeader';
|
|
|
7
7
|
import { useMonacoOptions } from '../../Inputs/MonacoInput/useMonacoOptions';
|
|
8
8
|
import './MonacoViewDialog.css';
|
|
9
9
|
const b = block('monaco-view-dialog');
|
|
10
|
-
export const MonacoViewDialog = ({ value, title, visible, language, onClose, fontSize,
|
|
10
|
+
export const MonacoViewDialog = ({ value, title, visible, language, onClose, fontSize, }) => {
|
|
11
11
|
const MonacoEditor = useMonaco();
|
|
12
12
|
const handleClose = React.useCallback(() => {
|
|
13
13
|
onClose();
|
|
@@ -20,7 +20,7 @@ export const MonacoViewDialog = ({ value, title, visible, language, onClose, fon
|
|
|
20
20
|
React.createElement(Dialog.Header, { caption: title, className: b('dialog-header') }),
|
|
21
21
|
React.createElement(Dialog.Body, null,
|
|
22
22
|
React.createElement("div", { className: b('container') },
|
|
23
|
-
React.createElement(MonacoHeader, { language: language
|
|
23
|
+
React.createElement(MonacoHeader, { language: language }),
|
|
24
24
|
React.createElement(MonacoEditor, { language: language, height: "600", width: "900", value: value, options: options }))),
|
|
25
25
|
React.createElement(Dialog.Footer, { textButtonApply: i18n('button_cancel'), onClickButtonApply: handleClose })));
|
|
26
26
|
};
|
|
@@ -8,7 +8,6 @@ export * from './MultiSelectView';
|
|
|
8
8
|
export * from './NumberWithScaleView';
|
|
9
9
|
export * from './ObjectBaseView';
|
|
10
10
|
export * from './ObjectValueInputView';
|
|
11
|
-
export * from './OneOfCardView';
|
|
12
11
|
export * from './OneOfView';
|
|
13
12
|
export * from './TableArrayView';
|
|
14
13
|
export * from './TextAreaView';
|
|
@@ -8,7 +8,6 @@ export * from './MultiSelectView';
|
|
|
8
8
|
export * from './NumberWithScaleView';
|
|
9
9
|
export * from './ObjectBaseView';
|
|
10
10
|
export * from './ObjectValueInputView';
|
|
11
|
-
export * from './OneOfCardView';
|
|
12
11
|
export * from './OneOfView';
|
|
13
12
|
export * from './TableArrayView';
|
|
14
13
|
export * from './TextAreaView';
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import { DynamicFormConfig, DynamicViewConfig } from '../../core';
|
|
2
2
|
export declare const dynamicConfig: DynamicFormConfig;
|
|
3
|
-
export declare const dynamicCardConfig: DynamicFormConfig;
|
|
4
3
|
export declare const dynamicViewConfig: DynamicViewConfig;
|
|
5
|
-
export declare const dynamicViewCardConfig: DynamicViewConfig;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Accordeon,
|
|
1
|
+
import { Accordeon, ArrayBase, ArrayBaseView, BaseView, CardAccordeon, CardOneOf, CardOneOfView, CardSection, Checkbox, FileInput, FileInputView, Group, Group2, MonacoInput, MonacoView, MultiOneOf, MultiOneOfFlat, MultiOneOfFlatView, MultiOneOfView, MultiSelect, MultiSelectView, NumberWithScale, NumberWithScaleView, ObjectBase, ObjectBaseView, ObjectInline, ObjectInlineView, ObjectValueInput, ObjectValueInputView, OneOf, OneOfFlat, OneOfFlatView, OneOfView, Row, RowVerbose, Secret, Section, Section2, Select, Switch, TableArrayInput, TableArrayView, TableCell, Text, TextArea, TextAreaView, TextContent, TextLink, TextLinkView, Transparent, ViewAccordeon, ViewCardAccordeon, ViewCardSection, ViewGroup, ViewGroup2, ViewRow, ViewSection, ViewSection2, ViewTableCell, ViewTransparent, } from '../components';
|
|
2
2
|
import { getArrayValidator, getBooleanValidator, getNumberValidator, getObjectValidator, getStringValidator, } from '../validators';
|
|
3
3
|
export const dynamicConfig = {
|
|
4
4
|
array: {
|
|
@@ -109,103 +109,6 @@ export const dynamicConfig = {
|
|
|
109
109
|
},
|
|
110
110
|
},
|
|
111
111
|
};
|
|
112
|
-
export const dynamicCardConfig = {
|
|
113
|
-
array: {
|
|
114
|
-
inputs: {
|
|
115
|
-
select: { Component: MultiSelect },
|
|
116
|
-
table: { Component: TableArrayInput },
|
|
117
|
-
base: { Component: ArrayBase },
|
|
118
|
-
},
|
|
119
|
-
layouts: {
|
|
120
|
-
row: Row2,
|
|
121
|
-
accordeon: AccordeonCardLayout,
|
|
122
|
-
section: SectionWithSubtitle,
|
|
123
|
-
section2: SectionWithSubtitle2,
|
|
124
|
-
group: SectionCard,
|
|
125
|
-
group2: SectionCard2,
|
|
126
|
-
table_item: TableCell,
|
|
127
|
-
transparent: Transparent,
|
|
128
|
-
},
|
|
129
|
-
validators: {
|
|
130
|
-
base: getArrayValidator(),
|
|
131
|
-
},
|
|
132
|
-
},
|
|
133
|
-
boolean: {
|
|
134
|
-
inputs: {
|
|
135
|
-
base: { Component: Checkbox },
|
|
136
|
-
switch: { Component: Switch },
|
|
137
|
-
},
|
|
138
|
-
layouts: {
|
|
139
|
-
row: Row2,
|
|
140
|
-
table_item: TableCell,
|
|
141
|
-
},
|
|
142
|
-
validators: {
|
|
143
|
-
base: getBooleanValidator(),
|
|
144
|
-
},
|
|
145
|
-
},
|
|
146
|
-
number: {
|
|
147
|
-
inputs: {
|
|
148
|
-
base: { Component: Text },
|
|
149
|
-
},
|
|
150
|
-
layouts: {
|
|
151
|
-
row: Row2,
|
|
152
|
-
table_item: TableCell,
|
|
153
|
-
transparent: Transparent,
|
|
154
|
-
},
|
|
155
|
-
validators: {
|
|
156
|
-
base: getNumberValidator(),
|
|
157
|
-
},
|
|
158
|
-
},
|
|
159
|
-
object: {
|
|
160
|
-
inputs: {
|
|
161
|
-
oneof: { Component: OneOfCard, independent: true },
|
|
162
|
-
secret: { Component: Secret, independent: true },
|
|
163
|
-
base: { Component: ObjectBase, independent: true },
|
|
164
|
-
text_link: { Component: TextLink, independent: true },
|
|
165
|
-
object_value: { Component: ObjectValueInput, independent: true },
|
|
166
|
-
multi_oneof: { Component: MultiOneOf, independent: true },
|
|
167
|
-
multi_oneof_flat: { Component: MultiOneOfFlat, independent: true },
|
|
168
|
-
inline: { Component: ObjectInline, independent: true },
|
|
169
|
-
},
|
|
170
|
-
layouts: {
|
|
171
|
-
row: Row2,
|
|
172
|
-
accordeon: AccordeonCardLayout,
|
|
173
|
-
section: SectionWithSubtitle,
|
|
174
|
-
section2: SectionWithSubtitle2,
|
|
175
|
-
group: SectionCard,
|
|
176
|
-
group2: SectionCard2,
|
|
177
|
-
transparent: Transparent,
|
|
178
|
-
},
|
|
179
|
-
validators: {
|
|
180
|
-
base: getObjectValidator(),
|
|
181
|
-
},
|
|
182
|
-
},
|
|
183
|
-
string: {
|
|
184
|
-
inputs: {
|
|
185
|
-
password: { Component: Text },
|
|
186
|
-
textarea: { Component: TextArea },
|
|
187
|
-
select: { Component: Select },
|
|
188
|
-
base: { Component: Text },
|
|
189
|
-
file_input: { Component: FileInput },
|
|
190
|
-
number_with_scale: { Component: NumberWithScale },
|
|
191
|
-
monaco_input: { Component: MonacoInputCard },
|
|
192
|
-
text_content: { Component: TextContent, independent: true },
|
|
193
|
-
},
|
|
194
|
-
layouts: {
|
|
195
|
-
row: Row2,
|
|
196
|
-
table_item: TableCell,
|
|
197
|
-
transparent: Transparent,
|
|
198
|
-
section: SectionWithSubtitle,
|
|
199
|
-
section2: SectionWithSubtitle2,
|
|
200
|
-
group: SectionCard,
|
|
201
|
-
group2: SectionCard2,
|
|
202
|
-
},
|
|
203
|
-
validators: {
|
|
204
|
-
base: getStringValidator(),
|
|
205
|
-
number: getNumberValidator(),
|
|
206
|
-
},
|
|
207
|
-
},
|
|
208
|
-
};
|
|
209
112
|
export const dynamicViewConfig = {
|
|
210
113
|
array: {
|
|
211
114
|
views: {
|
|
@@ -299,84 +202,3 @@ export const dynamicViewConfig = {
|
|
|
299
202
|
},
|
|
300
203
|
},
|
|
301
204
|
};
|
|
302
|
-
export const dynamicViewCardConfig = {
|
|
303
|
-
array: {
|
|
304
|
-
views: {
|
|
305
|
-
select: { Component: MultiSelectView },
|
|
306
|
-
table: { Component: TableArrayView },
|
|
307
|
-
base: { Component: ArrayBaseView },
|
|
308
|
-
},
|
|
309
|
-
layouts: {
|
|
310
|
-
row: ViewRow2,
|
|
311
|
-
accordeon: ViewAccordeonCard,
|
|
312
|
-
section: ViewSection,
|
|
313
|
-
section2: ViewSection2,
|
|
314
|
-
group: ViewSectionCard,
|
|
315
|
-
group2: ViewSectionCard2,
|
|
316
|
-
table_item: ViewTableCell,
|
|
317
|
-
transparent: ViewTransparent,
|
|
318
|
-
},
|
|
319
|
-
},
|
|
320
|
-
boolean: {
|
|
321
|
-
views: {
|
|
322
|
-
base: { Component: BaseView },
|
|
323
|
-
switch: { Component: BaseView },
|
|
324
|
-
},
|
|
325
|
-
layouts: {
|
|
326
|
-
row: ViewRow2,
|
|
327
|
-
table_item: ViewTableCell,
|
|
328
|
-
},
|
|
329
|
-
},
|
|
330
|
-
number: {
|
|
331
|
-
views: {
|
|
332
|
-
base: { Component: BaseView },
|
|
333
|
-
},
|
|
334
|
-
layouts: {
|
|
335
|
-
row: ViewRow2,
|
|
336
|
-
table_item: ViewTableCell,
|
|
337
|
-
transparent: ViewTransparent,
|
|
338
|
-
},
|
|
339
|
-
},
|
|
340
|
-
object: {
|
|
341
|
-
views: {
|
|
342
|
-
oneof: { Component: OneOfCardView, independent: true },
|
|
343
|
-
secret: undefined,
|
|
344
|
-
base: { Component: ObjectBaseView, independent: true },
|
|
345
|
-
text_link: { Component: TextLinkView, independent: true },
|
|
346
|
-
object_value: { Component: ObjectValueInputView, independent: true },
|
|
347
|
-
multi_oneof: { Component: MultiOneOfView, independent: true },
|
|
348
|
-
multi_oneof_flat: { Component: MultiOneOfFlatView, independent: true },
|
|
349
|
-
inline: { Component: ObjectInlineView, independent: true },
|
|
350
|
-
},
|
|
351
|
-
layouts: {
|
|
352
|
-
row: ViewRow2,
|
|
353
|
-
accordeon: ViewAccordeonCard,
|
|
354
|
-
section: ViewSection,
|
|
355
|
-
section2: ViewSection2,
|
|
356
|
-
group: ViewSectionCard,
|
|
357
|
-
group2: ViewSectionCard2,
|
|
358
|
-
transparent: ViewTransparent,
|
|
359
|
-
},
|
|
360
|
-
},
|
|
361
|
-
string: {
|
|
362
|
-
views: {
|
|
363
|
-
password: undefined,
|
|
364
|
-
textarea: { Component: TextAreaView },
|
|
365
|
-
select: { Component: BaseView },
|
|
366
|
-
base: { Component: BaseView },
|
|
367
|
-
file_input: { Component: FileInputView },
|
|
368
|
-
number_with_scale: { Component: NumberWithScaleView },
|
|
369
|
-
monaco_input: { Component: MonacoViewCard },
|
|
370
|
-
text_content: undefined,
|
|
371
|
-
},
|
|
372
|
-
layouts: {
|
|
373
|
-
row: ViewRow2,
|
|
374
|
-
table_item: ViewTableCell,
|
|
375
|
-
transparent: ViewTransparent,
|
|
376
|
-
section: ViewSection,
|
|
377
|
-
section2: ViewSection2,
|
|
378
|
-
group: ViewSectionCard,
|
|
379
|
-
group2: ViewSectionCard2,
|
|
380
|
-
},
|
|
381
|
-
},
|
|
382
|
-
};
|
package/package.json
CHANGED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OneOfCard = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
-
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
7
|
-
const __1 = require("../../");
|
|
8
|
-
const core_1 = require("../../../../core");
|
|
9
|
-
const hooks_1 = require("../../../hooks");
|
|
10
|
-
const utils_1 = require("../../../utils");
|
|
11
|
-
const Layouts_1 = require("../../Layouts");
|
|
12
|
-
const RemoveButton_1 = require("../../Layouts/Accordeon/RemoveButton");
|
|
13
|
-
const b = (0, utils_1.block)('oneof-card');
|
|
14
|
-
const OneOfCard = (props) => {
|
|
15
|
-
var _a;
|
|
16
|
-
const { input, meta, spec, name } = props;
|
|
17
|
-
const [open, setOpen] = react_1.default.useState(true);
|
|
18
|
-
const onToggle = react_1.default.useCallback(() => setOpen((f) => !f), [setOpen]);
|
|
19
|
-
const onOpen = react_1.default.useCallback(() => setOpen(true), [setOpen]);
|
|
20
|
-
const { oneOfValue, specProperties, togglerInput } = (0, hooks_1.useOneOf)({
|
|
21
|
-
props,
|
|
22
|
-
onTogglerChange: onOpen,
|
|
23
|
-
});
|
|
24
|
-
const arrayItem = react_1.default.useMemo(() => (0, core_1.isArrayItem)(name), [name]);
|
|
25
|
-
const toggler = react_1.default.useMemo(() => {
|
|
26
|
-
const specWithoutDescription = Object.assign(Object.assign({}, props.spec), { viewSpec: Object.assign(Object.assign({}, props.spec.viewSpec), { layoutDescription: '' }) });
|
|
27
|
-
const name = arrayItem ? '' : props.name;
|
|
28
|
-
return (react_1.default.createElement(Layouts_1.Row2, Object.assign({}, props, { spec: specWithoutDescription, name: name }), togglerInput));
|
|
29
|
-
}, [togglerInput, props, arrayItem]);
|
|
30
|
-
const headerActionsTemplate = react_1.default.useMemo(() => {
|
|
31
|
-
if (arrayItem) {
|
|
32
|
-
return react_1.default.createElement(RemoveButton_1.RemoveButton, { onDrop: input.onDrop, name: name });
|
|
33
|
-
}
|
|
34
|
-
return null;
|
|
35
|
-
}, [arrayItem, input.onDrop, name]);
|
|
36
|
-
const parentOnChange = react_1.default.useCallback((childName, childValue, childErrors) => {
|
|
37
|
-
const value = lodash_1.default.set({}, childName.split(`${input.name}.`).join(''), childValue);
|
|
38
|
-
input.onChange(value, childErrors);
|
|
39
|
-
}, [input.onChange, input.name]);
|
|
40
|
-
(0, hooks_1.useErrorChecker)({ name, meta, open, setOpen });
|
|
41
|
-
return (react_1.default.createElement(__1.AccordeonCard, { className: b(), name: name, header: toggler, description: spec.viewSpec.layoutDescription || '', open: open, onToggle: onToggle, ignoreHeaderToggle: true, headerActionsTemplate: headerActionsTemplate }, specProperties[oneOfValue] ? (react_1.default.createElement(core_1.Controller, { value: (_a = props.input.value) === null || _a === void 0 ? void 0 : _a[oneOfValue], spec: specProperties[oneOfValue], name: `${name}.${oneOfValue}`, parentOnChange: parentOnChange, parentOnUnmount: input.parentOnUnmount, key: `${name}.${oneOfValue}` })) : null));
|
|
42
|
-
};
|
|
43
|
-
exports.OneOfCard = OneOfCard;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AccordeonCardLayout = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
-
const __1 = require("../../");
|
|
7
|
-
const components_1 = require("../../../components");
|
|
8
|
-
const hooks_1 = require("../../../hooks");
|
|
9
|
-
const utils_1 = require("../../../utils");
|
|
10
|
-
const RemoveButton_1 = require("../Accordeon/RemoveButton");
|
|
11
|
-
const b = (0, utils_1.block)('accordeon-card-layout');
|
|
12
|
-
const AccordeonCardLayout = ({ name, spec, input, meta, children, }) => {
|
|
13
|
-
var _a;
|
|
14
|
-
const [open, setOpen] = react_1.default.useState(Boolean((_a = spec.viewSpec) === null || _a === void 0 ? void 0 : _a.layoutOpen));
|
|
15
|
-
const onToggle = react_1.default.useCallback(() => setOpen((f) => !f), [setOpen]);
|
|
16
|
-
const onDrop = react_1.default.useCallback(() => {
|
|
17
|
-
setOpen(false);
|
|
18
|
-
input.onDrop();
|
|
19
|
-
}, [input.onDrop, setOpen]);
|
|
20
|
-
const removeButton = react_1.default.useMemo(() => {
|
|
21
|
-
if (spec.required || !input.value) {
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
return react_1.default.createElement(RemoveButton_1.RemoveButton, { onDrop: onDrop, name: name });
|
|
25
|
-
}, [spec.required, input.value, onDrop, name]);
|
|
26
|
-
(0, hooks_1.useErrorChecker)({ name, meta, open, setOpen });
|
|
27
|
-
return (react_1.default.createElement(__1.AccordeonCard, { name: name, header: spec.viewSpec.layoutTitle || '', description: spec.viewSpec.layoutDescription || '', open: open, onToggle: onToggle, headerActionsTemplate: removeButton, className: b() },
|
|
28
|
-
react_1.default.createElement(components_1.ErrorWrapper, { name: name, meta: meta, withoutChildErrorStyles: true }, children)));
|
|
29
|
-
};
|
|
30
|
-
exports.AccordeonCardLayout = AccordeonCardLayout;
|