@gravity-ui/dynamic-forms 3.6.1 → 4.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/kit/components/Card/Card.css +3 -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/Inputs/MonacoInput/MonacoInputDialog.css +2 -2
- package/build/cjs/lib/kit/components/Inputs/TableArrayInput/TableArrayInput.css +8 -2
- package/build/cjs/lib/kit/components/Inputs/TextContent/TextContent.css +2 -2
- 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/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/Views/MonacoInputView/MonacoViewDialog.css +1 -1
- package/build/cjs/lib/kit/constants/config.js +2 -0
- package/build/cjs/lib/kit/utils/objectInline.js +1 -1
- package/build/cjs/lib/kit/validators/validators.js +5 -5
- package/build/esm/lib/core/components/Form/Controller/Controller.d.ts +1 -1
- 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/hooks/useGenerateRandomValue.d.ts +1 -1
- 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/View/ViewController.d.ts +1 -1
- package/build/esm/lib/core/components/View/hooks/useComponents.d.ts +1 -1
- package/build/esm/lib/core/components/View/hooks/useRender.d.ts +1 -1
- package/build/esm/lib/core/helpers.d.ts +5 -5
- package/build/esm/lib/core/types/specs.d.ts +6 -6
- package/build/esm/lib/kit/components/Card/Card.css +3 -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/Inputs/MonacoInput/MonacoInputDialog.css +2 -2
- package/build/esm/lib/kit/components/Inputs/TableArrayInput/TableArrayInput.css +8 -2
- package/build/esm/lib/kit/components/Inputs/TextContent/TextContent.css +2 -2
- 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/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/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/MonacoInputView/MonacoViewDialog.css +1 -1
- package/build/esm/lib/kit/constants/config.js +2 -0
- package/build/esm/lib/kit/hooks/useOneOf/useOneOf.d.ts +1 -1
- package/build/esm/lib/kit/utils/common.d.ts +1 -1
- package/build/esm/lib/kit/utils/objectInline.d.ts +1 -1
- package/build/esm/lib/kit/utils/objectInline.js +2 -2
- package/build/esm/lib/kit/validators/validators.js +5 -5
- package/package.json +11 -11
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ArraySpec, BooleanSpec, NumberSpec, ObjectSpec, StringSpec } from './types';
|
|
2
2
|
export declare const isCorrectSpec: (candidate: any) => boolean;
|
|
3
|
-
export declare const isArraySpec: (candidate: any) => candidate is ArraySpec<any,
|
|
4
|
-
export declare const isBooleanSpec: (candidate: any) => candidate is BooleanSpec<any,
|
|
5
|
-
export declare const isNumberSpec: (candidate: any) => candidate is NumberSpec<any,
|
|
6
|
-
export declare const isObjectSpec: (candidate: any) => candidate is ObjectSpec<any,
|
|
7
|
-
export declare const isStringSpec: (candidate: any) => candidate is StringSpec<any,
|
|
3
|
+
export declare const isArraySpec: (candidate: any) => candidate is ArraySpec<any, undefined, undefined>;
|
|
4
|
+
export declare const isBooleanSpec: (candidate: any) => candidate is BooleanSpec<any, undefined, undefined>;
|
|
5
|
+
export declare const isNumberSpec: (candidate: any) => candidate is NumberSpec<any, undefined, undefined>;
|
|
6
|
+
export declare const isObjectSpec: (candidate: any) => candidate is ObjectSpec<any, undefined, undefined>;
|
|
7
|
+
export declare const isStringSpec: (candidate: any) => candidate is StringSpec<any, undefined, undefined>;
|
|
@@ -2,7 +2,7 @@ import { LabelProps } from '@gravity-ui/uikit';
|
|
|
2
2
|
import { ColorTextBaseProps } from '@gravity-ui/uikit/build/esm/components/Text/colorText/colorText';
|
|
3
3
|
import { ReadAsMethod, SpecTypes } from '../constants';
|
|
4
4
|
import { ArrayValue, ObjectValue } from './';
|
|
5
|
-
export interface ArraySpec<LinkType = any, InputComponentProps extends Record<string, any> =
|
|
5
|
+
export interface ArraySpec<LinkType = any, InputComponentProps extends Record<string, any> | undefined = undefined, LayoutComponentProps extends Record<string, any> | undefined = undefined> {
|
|
6
6
|
defaultValue?: ArrayValue;
|
|
7
7
|
type: SpecTypes.Array;
|
|
8
8
|
required?: boolean;
|
|
@@ -37,7 +37,7 @@ export interface ArraySpec<LinkType = any, InputComponentProps extends Record<st
|
|
|
37
37
|
layoutProps?: LayoutComponentProps;
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
|
-
export interface BooleanSpec<LinkType = any, InputComponentProps extends Record<string, any> =
|
|
40
|
+
export interface BooleanSpec<LinkType = any, InputComponentProps extends Record<string, any> | undefined = undefined, LayoutComponentProps extends Record<string, any> | undefined = undefined> {
|
|
41
41
|
defaultValue?: boolean;
|
|
42
42
|
type: SpecTypes.Boolean;
|
|
43
43
|
required?: boolean;
|
|
@@ -55,7 +55,7 @@ export interface BooleanSpec<LinkType = any, InputComponentProps extends Record<
|
|
|
55
55
|
layoutProps?: LayoutComponentProps;
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
|
-
export interface NumberSpec<LinkType = any, InputComponentProps extends Record<string, any> =
|
|
58
|
+
export interface NumberSpec<LinkType = any, InputComponentProps extends Record<string, any> | undefined = undefined, LayoutComponentProps extends Record<string, any> | undefined = undefined> {
|
|
59
59
|
defaultValue?: number;
|
|
60
60
|
type: SpecTypes.Number;
|
|
61
61
|
required?: boolean;
|
|
@@ -78,7 +78,7 @@ export interface NumberSpec<LinkType = any, InputComponentProps extends Record<s
|
|
|
78
78
|
layoutProps?: LayoutComponentProps;
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
|
-
export interface ObjectSpec<LinkType = any, InputComponentProps extends Record<string, any> =
|
|
81
|
+
export interface ObjectSpec<LinkType = any, InputComponentProps extends Record<string, any> | undefined = undefined, LayoutComponentProps extends Record<string, any> | undefined = undefined> {
|
|
82
82
|
defaultValue?: ObjectValue;
|
|
83
83
|
type: SpecTypes.Object;
|
|
84
84
|
required?: boolean;
|
|
@@ -103,7 +103,7 @@ export interface ObjectSpec<LinkType = any, InputComponentProps extends Record<s
|
|
|
103
103
|
layoutProps?: LayoutComponentProps;
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
|
-
export interface StringSpec<LinkType = any, InputComponentProps extends Record<string, any> =
|
|
106
|
+
export interface StringSpec<LinkType = any, InputComponentProps extends Record<string, any> | undefined = undefined, LayoutComponentProps extends Record<string, any> | undefined = undefined> {
|
|
107
107
|
defaultValue?: string;
|
|
108
108
|
type: SpecTypes.String;
|
|
109
109
|
required?: boolean;
|
|
@@ -158,4 +158,4 @@ export interface StringSpec<LinkType = any, InputComponentProps extends Record<s
|
|
|
158
158
|
generateRandomValueButton?: boolean;
|
|
159
159
|
};
|
|
160
160
|
}
|
|
161
|
-
export type Spec = ArraySpec | BooleanSpec | NumberSpec | ObjectSpec | StringSpec
|
|
161
|
+
export type Spec<LinkType = any, InputComponentProps extends Record<string, any> | undefined = undefined, LayoutComponentProps extends Record<string, any> | undefined = undefined> = ArraySpec<LinkType, InputComponentProps, LayoutComponentProps> | BooleanSpec<LinkType, InputComponentProps, LayoutComponentProps> | NumberSpec<LinkType, InputComponentProps, LayoutComponentProps> | ObjectSpec<LinkType, InputComponentProps, LayoutComponentProps> | StringSpec<LinkType, InputComponentProps, LayoutComponentProps>;
|
|
@@ -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 {
|
|
@@ -10,7 +10,7 @@ const b = block('copy-button');
|
|
|
10
10
|
*/
|
|
11
11
|
export const CopyButton = ({ spec, value }) => {
|
|
12
12
|
if ((isStringSpec(spec) || isNumberSpec(spec)) && spec.viewSpec.copy) {
|
|
13
|
-
return React.createElement(ClipboardButton, { className: b(), text: `${value}`, size:
|
|
13
|
+
return React.createElement(ClipboardButton, { className: b(), text: `${value}`, size: "s" });
|
|
14
14
|
}
|
|
15
15
|
return null;
|
|
16
16
|
};
|
|
@@ -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 {
|
|
@@ -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
|
}
|
|
@@ -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;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ArrayLayoutProps, ObjectLayoutProps } from '../../../../core';
|
|
2
|
-
export declare const Accordeon: <T extends ArrayLayoutProps<
|
|
2
|
+
export declare const Accordeon: <T extends ArrayLayoutProps<undefined, undefined> | ObjectLayoutProps<undefined, undefined>>({ name, spec, input, meta, children, }: T) => JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ArrayLayoutProps, ObjectLayoutProps } from '../../../../core';
|
|
2
2
|
import './AccordeonCardForm.css';
|
|
3
|
-
export declare const AccordeonCardForm: <T extends ArrayLayoutProps<
|
|
3
|
+
export declare const AccordeonCardForm: <T extends ArrayLayoutProps<undefined, undefined> | ObjectLayoutProps<undefined, undefined>>({ name, spec, input, children, meta, }: T) => JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { FieldValue, LayoutProps, Spec } from '../../../core';
|
|
2
|
-
export declare const CardAccordeon: <T extends FieldValue, S extends Spec
|
|
2
|
+
export declare const CardAccordeon: <T extends FieldValue, S extends Spec<any, undefined, undefined>>({ name, spec, input, meta, children, }: LayoutProps<T, undefined, undefined, S>) => JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { FieldValue, LayoutProps, Spec } from '../../../core';
|
|
2
|
-
export declare const CardSection: <T extends FieldValue, S extends Spec
|
|
2
|
+
export declare const CardSection: <T extends FieldValue, S extends Spec<any, undefined, undefined>>({ name, spec, input, meta, children, }: LayoutProps<T, undefined, undefined, S>) => JSX.Element;
|
|
@@ -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 {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { FieldValue, LayoutProps, Spec } from '../../../../core';
|
|
2
2
|
import './Row.css';
|
|
3
|
-
export declare const Row: <T extends FieldValue, S extends Spec
|
|
4
|
-
export declare const RowVerbose: <T extends FieldValue, S extends Spec
|
|
3
|
+
export declare const Row: <T extends FieldValue, S extends Spec<any, undefined, undefined>>(props: LayoutProps<T, undefined, undefined, S>) => JSX.Element;
|
|
4
|
+
export declare const RowVerbose: <T extends FieldValue, S extends Spec<any, undefined, undefined>>(props: LayoutProps<T, undefined, undefined, S>) => JSX.Element;
|
|
@@ -28,5 +28,5 @@ const RowBase = ({ name, spec, input, meta, verboseDescription, children, }) =>
|
|
|
28
28
|
React.createElement(Icon, { data: TrashBin, size: 16 }))) : null),
|
|
29
29
|
verboseDescription && spec.viewSpec.layoutDescription ? (React.createElement("div", { className: b('description'), dangerouslySetInnerHTML: { __html: spec.viewSpec.layoutDescription } })) : null)));
|
|
30
30
|
};
|
|
31
|
-
export const Row = (props) =>
|
|
32
|
-
export const RowVerbose = (props) =>
|
|
31
|
+
export const Row = (props) => React.createElement(RowBase, Object.assign({}, props));
|
|
32
|
+
export const RowVerbose = (props) => React.createElement(RowBase, Object.assign({ verboseDescription: true }, props));
|
|
@@ -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 {
|
|
@@ -6,10 +6,10 @@ interface SectionProps {
|
|
|
6
6
|
ignoreDescription?: boolean;
|
|
7
7
|
descriptionAsSubtitle?: boolean;
|
|
8
8
|
}
|
|
9
|
-
export declare const Section: <D extends FieldValue, T extends FormValue, S extends Spec
|
|
10
|
-
export declare const Section2: <D extends FieldValue, T extends FormValue, S extends Spec
|
|
11
|
-
export declare const SectionWithSubtitle: <D extends FieldValue, T extends FormValue, S extends Spec
|
|
12
|
-
export declare const SectionWithSubtitle2: <D extends FieldValue, T extends FormValue, S extends Spec
|
|
13
|
-
export declare const Group: <D extends FieldValue, T extends FormValue, S extends Spec
|
|
14
|
-
export declare const Group2: <D extends FieldValue, T extends FormValue, S extends Spec
|
|
9
|
+
export declare const Section: <D extends FieldValue, T extends FormValue, S extends Spec<any, undefined, undefined>>(props: (LayoutProps<D, undefined, undefined, S> | ViewLayoutProps<T, S>) & Pick<SectionProps, "ignoreDescription">) => JSX.Element;
|
|
10
|
+
export declare const Section2: <D extends FieldValue, T extends FormValue, S extends Spec<any, undefined, undefined>>(props: (LayoutProps<D, undefined, undefined, S> | ViewLayoutProps<T, S>) & Pick<SectionProps, "ignoreDescription">) => JSX.Element;
|
|
11
|
+
export declare const SectionWithSubtitle: <D extends FieldValue, T extends FormValue, S extends Spec<any, undefined, undefined>>(props: (LayoutProps<D, undefined, undefined, S> | ViewLayoutProps<T, S>) & Pick<SectionProps, "ignoreDescription">) => JSX.Element;
|
|
12
|
+
export declare const SectionWithSubtitle2: <D extends FieldValue, T extends FormValue, S extends Spec<any, undefined, undefined>>(props: (LayoutProps<D, undefined, undefined, S> | ViewLayoutProps<T, S>) & Pick<SectionProps, "ignoreDescription">) => JSX.Element;
|
|
13
|
+
export declare const Group: <D extends FieldValue, T extends FormValue, S extends Spec<any, undefined, undefined>>(props: (LayoutProps<D, undefined, undefined, S> | ViewLayoutProps<T, S>) & Pick<SectionProps, "ignoreDescription">) => JSX.Element;
|
|
14
|
+
export declare const Group2: <D extends FieldValue, T extends FormValue, S extends Spec<any, undefined, undefined>>(props: (LayoutProps<D, undefined, undefined, S> | ViewLayoutProps<T, S>) & Pick<SectionProps, "ignoreDescription">) => JSX.Element;
|
|
15
15
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { FieldValue, LayoutProps, Spec } from '../../../../core';
|
|
2
|
-
export declare const TableCell: <T extends FieldValue, S extends Spec
|
|
2
|
+
export declare const TableCell: <T extends FieldValue, S extends Spec<any, undefined, undefined>>({ name, meta, children, }: LayoutProps<T, undefined, undefined, S>) => JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { FieldValue, LayoutProps, Spec } from '../../../../core';
|
|
2
2
|
import './Transparent.css';
|
|
3
|
-
export declare const Transparent: <T extends FieldValue, S extends Spec
|
|
3
|
+
export declare const Transparent: <T extends FieldValue, S extends Spec<any, undefined, undefined>>({ name, spec, input, meta, children, }: LayoutProps<T, undefined, undefined, S>) => JSX.Element;
|
|
@@ -39,6 +39,6 @@ export const LongValue = ({ value, className }) => {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
|
-
return (React.createElement("div", { ref: ref, onClick: long ? handleClick : undefined },
|
|
42
|
+
return (React.createElement("div", { className: b('container'), ref: ref, onClick: long ? handleClick : undefined },
|
|
43
43
|
React.createElement(Text, Object.assign({ className: b({ long }, className), ellipsis: true }, currentTextProperies), value)));
|
|
44
44
|
};
|
|
@@ -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 {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { FormValue, Spec, ViewLayoutProps } from '../../../core';
|
|
2
|
-
export declare const ViewCardSection: <T extends FormValue, S extends Spec
|
|
2
|
+
export declare const ViewCardSection: <T extends FormValue, S extends Spec<any, undefined, undefined>>({ name, value, spec, children, }: ViewLayoutProps<T, S>) => JSX.Element | null;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { FormValue, Spec, ViewLayoutProps } from '../../../../core';
|
|
2
2
|
import './ViewRow.css';
|
|
3
|
-
export declare const ViewRow: <T extends FormValue, S extends Spec
|
|
3
|
+
export declare const ViewRow: <T extends FormValue, S extends Spec<any, undefined, undefined>>({ value, spec, children, }: ViewLayoutProps<T, S>) => JSX.Element | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FormValue, Spec, ViewLayoutProps } from '../../../../core';
|
|
2
|
-
export declare const ViewSection: <T extends FormValue, S extends Spec
|
|
3
|
-
export declare const ViewSection2: <T extends FormValue, S extends Spec
|
|
4
|
-
export declare const ViewGroup: <T extends FormValue, S extends Spec
|
|
5
|
-
export declare const ViewGroup2: <T extends FormValue, S extends Spec
|
|
2
|
+
export declare const ViewSection: <T extends FormValue, S extends Spec<any, undefined, undefined>>(props: ViewLayoutProps<T, S>) => JSX.Element | null;
|
|
3
|
+
export declare const ViewSection2: <T extends FormValue, S extends Spec<any, undefined, undefined>>(props: ViewLayoutProps<T, S>) => JSX.Element | null;
|
|
4
|
+
export declare const ViewGroup: <T extends FormValue, S extends Spec<any, undefined, undefined>>(props: ViewLayoutProps<T, S>) => JSX.Element | null;
|
|
5
|
+
export declare const ViewGroup2: <T extends FormValue, S extends Spec<any, undefined, undefined>>(props: ViewLayoutProps<T, S>) => JSX.Element | null;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { FormValue, Spec, ViewLayoutProps } from '../../../../core';
|
|
2
2
|
import './ViewTableCell.css';
|
|
3
|
-
export declare const ViewTableCell: <T extends FormValue, S extends Spec
|
|
3
|
+
export declare const ViewTableCell: <T extends FormValue, S extends Spec<any, undefined, undefined>>({ value, spec, children, }: ViewLayoutProps<T, S>) => JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { FormValue, Spec, ViewLayoutProps } from '../../../../core';
|
|
2
2
|
import './ViewTransparent.css';
|
|
3
|
-
export declare const ViewTransparent: <T extends FormValue, S extends Spec
|
|
3
|
+
export declare const ViewTransparent: <T extends FormValue, S extends Spec<any, undefined, undefined>>({ value, spec, children, }: ViewLayoutProps<T, S>) => JSX.Element | null;
|
|
@@ -34,6 +34,7 @@ export const dynamicConfig = {
|
|
|
34
34
|
row: Row,
|
|
35
35
|
row_verbose: RowVerbose,
|
|
36
36
|
table_item: TableCell,
|
|
37
|
+
transparent: Transparent,
|
|
37
38
|
},
|
|
38
39
|
validators: {
|
|
39
40
|
base: getBooleanValidator(),
|
|
@@ -142,6 +143,7 @@ export const dynamicViewConfig = {
|
|
|
142
143
|
row: ViewRow,
|
|
143
144
|
row_verbose: ViewRow,
|
|
144
145
|
table_item: ViewTableCell,
|
|
146
|
+
transparent: ViewTransparent,
|
|
145
147
|
},
|
|
146
148
|
},
|
|
147
149
|
number: {
|
|
@@ -6,7 +6,7 @@ export interface UseOneOfParams {
|
|
|
6
6
|
}
|
|
7
7
|
export declare const useOneOf: ({ props, onTogglerChange }: UseOneOfParams) => {
|
|
8
8
|
oneOfValue: string;
|
|
9
|
-
specProperties: Record<string, import("../../../core").Spec
|
|
9
|
+
specProperties: Record<string, import("../../../core").Spec<any, undefined, undefined>>;
|
|
10
10
|
toggler: JSX.Element;
|
|
11
11
|
togglerInput: JSX.Element;
|
|
12
12
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { FormValue, Spec, StringSpec } from '../../core';
|
|
2
2
|
export declare const isNotEmptyValue: (value: FormValue | undefined, spec: Spec | undefined) => boolean;
|
|
3
|
-
export declare const prepareSpec: <Type extends Spec
|
|
3
|
+
export declare const prepareSpec: <Type extends Spec<any, undefined, undefined>>(spec: Type, parseJsonDefaultValue?: boolean) => Type;
|
|
4
4
|
export declare const isCorrectSizeParams: (spec: StringSpec) => boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isNumberSpec, isStringSpec } from '../../core';
|
|
1
|
+
import { isBooleanSpec, isNumberSpec, isStringSpec } from '../../core';
|
|
2
2
|
export const filterPropertiesForObjectInline = (properties) => {
|
|
3
|
-
return Object.fromEntries(Object.entries(properties).filter(([, propSpec]) => isStringSpec(propSpec) || isNumberSpec(propSpec)));
|
|
3
|
+
return Object.fromEntries(Object.entries(properties).filter(([, propSpec]) => isStringSpec(propSpec) || isNumberSpec(propSpec) || isBooleanSpec(propSpec)));
|
|
4
4
|
};
|
|
@@ -3,8 +3,8 @@ import { ErrorMessages } from '../validators';
|
|
|
3
3
|
import { isFloat, isInt } from './helpers';
|
|
4
4
|
export const getArrayValidator = (params = {}) => {
|
|
5
5
|
const { ignoreRequiredCheck, ignoreMaxLengthCheck, ignoreMinLengthCheck, customErrorMessages } = params;
|
|
6
|
-
const errorMessages = Object.assign(Object.assign({}, ErrorMessages), customErrorMessages);
|
|
7
6
|
return (spec, value) => {
|
|
7
|
+
const errorMessages = Object.assign(Object.assign({}, ErrorMessages), customErrorMessages);
|
|
8
8
|
const valueLength = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
9
9
|
if (!ignoreRequiredCheck && spec.required && !_.isArray(value)) {
|
|
10
10
|
return errorMessages.REQUIRED;
|
|
@@ -24,8 +24,8 @@ export const getArrayValidator = (params = {}) => {
|
|
|
24
24
|
};
|
|
25
25
|
export const getBooleanValidator = (params = {}) => {
|
|
26
26
|
const { ignoreRequiredCheck, customErrorMessages } = params;
|
|
27
|
-
const errorMessages = Object.assign(Object.assign({}, ErrorMessages), customErrorMessages);
|
|
28
27
|
return (spec, value) => {
|
|
28
|
+
const errorMessages = Object.assign(Object.assign({}, ErrorMessages), customErrorMessages);
|
|
29
29
|
if (!ignoreRequiredCheck && spec.required && !value) {
|
|
30
30
|
return errorMessages.REQUIRED;
|
|
31
31
|
}
|
|
@@ -34,9 +34,9 @@ export const getBooleanValidator = (params = {}) => {
|
|
|
34
34
|
};
|
|
35
35
|
export const getNumberValidator = (params = {}) => {
|
|
36
36
|
const { ignoreRequiredCheck, ignoreSpaceStartCheck, ignoreSpaceEndCheck, ignoreNumberCheck, ignoreMaximumCheck, ignoreMinimumCheck, ignoreIntCheck, ignoreDotEnd, ignoreZeroStart, customErrorMessages, } = params;
|
|
37
|
-
const errorMessages = Object.assign(Object.assign({}, ErrorMessages), customErrorMessages);
|
|
38
37
|
// eslint-disable-next-line complexity
|
|
39
38
|
return (spec, value = '') => {
|
|
39
|
+
const errorMessages = Object.assign(Object.assign({}, ErrorMessages), customErrorMessages);
|
|
40
40
|
const stringValue = String(value);
|
|
41
41
|
if (!ignoreRequiredCheck && spec.required && !stringValue.length) {
|
|
42
42
|
return errorMessages.REQUIRED;
|
|
@@ -84,8 +84,8 @@ export const getNumberValidator = (params = {}) => {
|
|
|
84
84
|
};
|
|
85
85
|
export const getObjectValidator = (params = {}) => {
|
|
86
86
|
const { ignoreRequiredCheck, customErrorMessages } = params;
|
|
87
|
-
const errorMessages = Object.assign(Object.assign({}, ErrorMessages), customErrorMessages);
|
|
88
87
|
return (spec, value) => {
|
|
88
|
+
const errorMessages = Object.assign(Object.assign({}, ErrorMessages), customErrorMessages);
|
|
89
89
|
if (!ignoreRequiredCheck && spec.required && !value) {
|
|
90
90
|
return errorMessages.REQUIRED;
|
|
91
91
|
}
|
|
@@ -94,9 +94,9 @@ export const getObjectValidator = (params = {}) => {
|
|
|
94
94
|
};
|
|
95
95
|
export const getStringValidator = (params = {}) => {
|
|
96
96
|
const { ignoreRequiredCheck, ignoreSpaceStartCheck, ignoreSpaceEndCheck, ignoreMaxLengthCheck, ignoreMinLengthCheck, ignoreRegExpCheck, customErrorMessages, } = params;
|
|
97
|
-
const errorMessages = Object.assign(Object.assign({}, ErrorMessages), customErrorMessages);
|
|
98
97
|
// eslint-disable-next-line complexity
|
|
99
98
|
return (spec, value = '') => {
|
|
99
|
+
const errorMessages = Object.assign(Object.assign({}, ErrorMessages), customErrorMessages);
|
|
100
100
|
const valueLength = value === null || value === void 0 ? void 0 : value.length;
|
|
101
101
|
if (!ignoreRequiredCheck && spec.required && !valueLength) {
|
|
102
102
|
return errorMessages.REQUIRED;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-ui/dynamic-forms",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "build/cjs/index.js",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@bem-react/classname": "^1.6.0",
|
|
47
|
-
"@gravity-ui/components": "^
|
|
48
|
-
"@gravity-ui/i18n": "^1.
|
|
47
|
+
"@gravity-ui/components": "^3.0.0",
|
|
48
|
+
"@gravity-ui/i18n": "^1.2.0",
|
|
49
49
|
"@gravity-ui/icons": "^2.8.1",
|
|
50
50
|
"lodash": "^4.17.20"
|
|
51
51
|
},
|
|
@@ -54,11 +54,11 @@
|
|
|
54
54
|
"@babel/preset-typescript": "^7.18.6",
|
|
55
55
|
"@commitlint/cli": "^17.0.0",
|
|
56
56
|
"@commitlint/config-conventional": "^17.0.0",
|
|
57
|
-
"@gravity-ui/eslint-config": "^
|
|
57
|
+
"@gravity-ui/eslint-config": "^3.1.1",
|
|
58
58
|
"@gravity-ui/prettier-config": "^1.1.0",
|
|
59
|
-
"@gravity-ui/stylelint-config": "^
|
|
59
|
+
"@gravity-ui/stylelint-config": "^4.0.1",
|
|
60
60
|
"@gravity-ui/tsconfig": "^1.0.0",
|
|
61
|
-
"@gravity-ui/uikit": "^
|
|
61
|
+
"@gravity-ui/uikit": "^6.0.0",
|
|
62
62
|
"@playwright/experimental-ct-react": "^1.40.0",
|
|
63
63
|
"@playwright/test": "^1.40.0",
|
|
64
64
|
"@storybook/addon-essentials": "^7.0.27",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"@types/uuid": "^9.0.4",
|
|
77
77
|
"@vitejs/plugin-react": "^4.2.0",
|
|
78
78
|
"css-loader": "^5.2.6",
|
|
79
|
-
"eslint": "^8.
|
|
79
|
+
"eslint": "^8.49.0",
|
|
80
80
|
"final-form": "^4.20.2",
|
|
81
81
|
"gulp": "^4.0.2",
|
|
82
82
|
"gulp-cli": "^2.3.0",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"monaco-editor-webpack-plugin": "^6.0.0",
|
|
92
92
|
"npm-run-all": "^4.1.5",
|
|
93
93
|
"postcss": "^8.4.19",
|
|
94
|
-
"prettier": "^
|
|
94
|
+
"prettier": "^3.0.3",
|
|
95
95
|
"randexp": "^0.5.3",
|
|
96
96
|
"react": "^18.2.0",
|
|
97
97
|
"react-dom": "^18.2.0",
|
|
@@ -103,14 +103,14 @@
|
|
|
103
103
|
"sass-loader": "^10.1.1",
|
|
104
104
|
"storybook": "^7.0.27",
|
|
105
105
|
"style-loader": "^2.0.0",
|
|
106
|
-
"stylelint": "^
|
|
107
|
-
"stylelint-scss": "^
|
|
106
|
+
"stylelint": "^15.10.3",
|
|
107
|
+
"stylelint-scss": "^5.1.0",
|
|
108
108
|
"ts-jest": "^29.0.5",
|
|
109
109
|
"typescript": "^4.9.5",
|
|
110
110
|
"uuid": "^9.0.1"
|
|
111
111
|
},
|
|
112
112
|
"peerDependencies": {
|
|
113
|
-
"@gravity-ui/uikit": "^
|
|
113
|
+
"@gravity-ui/uikit": "^6.0.0",
|
|
114
114
|
"final-form": "^4.20.2",
|
|
115
115
|
"react": "^16.0.0 || ^17.0.0 || ^18.0.0",
|
|
116
116
|
"react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0",
|