@gravity-ui/dynamic-forms 5.0.0-beta.0 → 5.1.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/hooks/useSearch/useSearch.css +1 -1
- package/build/cjs/lib/kit/components/AccordeonCard/AccordeonCard.css +1 -1
- package/build/cjs/lib/kit/components/Card/Card.css +2 -2
- package/build/cjs/lib/kit/components/CopyButton/CopyButton.css +1 -1
- package/build/cjs/lib/kit/components/GroupIndent/GroupIndent.css +3 -3
- package/build/cjs/lib/kit/components/Inputs/ArrayBase/ArrayBase.css +2 -2
- package/build/cjs/lib/kit/components/Inputs/CardOneOf/CardOneOf.js +8 -2
- package/build/cjs/lib/kit/components/Inputs/CheckboxGroup/CheckboxGroup.css +3 -3
- package/build/cjs/lib/kit/components/Inputs/FileInput/FileInput.css +1 -1
- package/build/cjs/lib/kit/components/Inputs/MonacoInput/MonacoHeader.css +1 -1
- package/build/cjs/lib/kit/components/Inputs/MonacoInput/MonacoInputDialog.css +1 -1
- package/build/cjs/lib/kit/components/Inputs/MultiOneOf/MultiOneOf.css +1 -1
- package/build/cjs/lib/kit/components/Inputs/NumberWithScale/NumberWithScale.css +1 -1
- package/build/cjs/lib/kit/components/Inputs/OneOf/OneOf.css +4 -4
- package/build/cjs/lib/kit/components/Inputs/TableArrayInput/TableArrayInput.css +2 -2
- package/build/cjs/lib/kit/components/Inputs/TextContent/TextContent.js +1 -1
- package/build/cjs/lib/kit/components/Layouts/Accordeon/Accordeon.js +2 -1
- package/build/cjs/lib/kit/components/Layouts/Column/Column.css +4 -4
- package/build/cjs/lib/kit/components/Layouts/Row/Row.css +6 -6
- package/build/cjs/lib/kit/components/Layouts/Section/Section.css +2 -2
- package/build/cjs/lib/kit/components/Layouts/Section/Section.js +21 -2
- package/build/cjs/lib/kit/components/Layouts/Transparent/Transparent.css +2 -2
- package/build/cjs/lib/kit/components/SimpleVerticalAccordeon/SimpleVerticalAccordeon.css +4 -4
- package/build/cjs/lib/kit/components/SimpleVerticalAccordeon/SimpleVerticalAccordeon.js +2 -2
- package/build/cjs/lib/kit/components/TogglerCard/TogglerCard.css +2 -2
- package/build/cjs/lib/kit/components/ViewLayouts/ViewAccordeon/ViewAccordeon.js +2 -1
- package/build/cjs/lib/kit/components/ViewLayouts/ViewColumn/ViewColumn.css +1 -1
- package/build/cjs/lib/kit/components/ViewLayouts/ViewRow/ViewRow.css +1 -1
- package/build/cjs/lib/kit/components/ViewLayouts/ViewTableCell/ViewTableCell.css +1 -1
- package/build/cjs/lib/kit/components/Views/ArrayBaseView/ArrayBaseView.css +1 -1
- package/build/cjs/lib/kit/components/Views/CardOneOfView.js +13 -3
- package/build/cjs/lib/kit/components/Views/CheckboxGroupView/CheckboxGroupView.css +2 -2
- package/build/cjs/lib/kit/components/Views/MonacoInputView/MonacoViewDialog.css +1 -1
- package/build/cjs/lib/kit/components/Views/TableArrayView/TableArrayView.css +1 -1
- package/build/cjs/lib/kit/components/Views/TextAreaView/TextAreaView.css +1 -1
- package/build/cjs/lib/kit/hooks/useOneOf/useOneOf.css +1 -1
- package/build/cjs/lib/kit/utils/common.js +9 -8
- package/build/esm/lib/core/components/Form/hooks/useSearch/useSearch.css +1 -1
- package/build/esm/lib/core/components/View/types/layout.d.ts +1 -1
- package/build/esm/lib/core/components/View/types/views.d.ts +1 -1
- package/build/esm/lib/core/types/specs.d.ts +2 -1
- package/build/esm/lib/kit/components/AccordeonCard/AccordeonCard.css +1 -1
- package/build/esm/lib/kit/components/Card/Card.css +2 -2
- package/build/esm/lib/kit/components/CopyButton/CopyButton.css +1 -1
- package/build/esm/lib/kit/components/GroupIndent/GroupIndent.css +3 -3
- package/build/esm/lib/kit/components/Inputs/ArrayBase/ArrayBase.css +2 -2
- package/build/esm/lib/kit/components/Inputs/CardOneOf/CardOneOf.js +8 -2
- package/build/esm/lib/kit/components/Inputs/CheckboxGroup/CheckboxGroup.css +3 -3
- package/build/esm/lib/kit/components/Inputs/FileInput/FileInput.css +1 -1
- package/build/esm/lib/kit/components/Inputs/MonacoInput/MonacoHeader.css +1 -1
- package/build/esm/lib/kit/components/Inputs/MonacoInput/MonacoInputDialog.css +1 -1
- package/build/esm/lib/kit/components/Inputs/MultiOneOf/MultiOneOf.css +1 -1
- package/build/esm/lib/kit/components/Inputs/NumberWithScale/NumberWithScale.css +1 -1
- package/build/esm/lib/kit/components/Inputs/OneOf/OneOf.css +4 -4
- package/build/esm/lib/kit/components/Inputs/TableArrayInput/TableArrayInput.css +2 -2
- package/build/esm/lib/kit/components/Inputs/TextContent/TextContent.js +1 -1
- package/build/esm/lib/kit/components/Layouts/Accordeon/Accordeon.d.ts +6 -1
- package/build/esm/lib/kit/components/Layouts/Accordeon/Accordeon.js +2 -1
- package/build/esm/lib/kit/components/Layouts/Column/Column.css +4 -4
- package/build/esm/lib/kit/components/Layouts/Row/Row.css +6 -6
- package/build/esm/lib/kit/components/Layouts/Section/Section.css +2 -2
- package/build/esm/lib/kit/components/Layouts/Section/Section.js +21 -2
- package/build/esm/lib/kit/components/Layouts/Transparent/Transparent.css +2 -2
- package/build/esm/lib/kit/components/SimpleVerticalAccordeon/SimpleVerticalAccordeon.css +4 -4
- package/build/esm/lib/kit/components/SimpleVerticalAccordeon/SimpleVerticalAccordeon.d.ts +2 -0
- package/build/esm/lib/kit/components/SimpleVerticalAccordeon/SimpleVerticalAccordeon.js +2 -2
- package/build/esm/lib/kit/components/TogglerCard/TogglerCard.css +2 -2
- package/build/esm/lib/kit/components/ViewLayouts/ViewAccordeon/ViewAccordeon.d.ts +7 -2
- package/build/esm/lib/kit/components/ViewLayouts/ViewAccordeon/ViewAccordeon.js +2 -1
- package/build/esm/lib/kit/components/ViewLayouts/ViewColumn/ViewColumn.css +1 -1
- package/build/esm/lib/kit/components/ViewLayouts/ViewRow/ViewRow.css +1 -1
- package/build/esm/lib/kit/components/ViewLayouts/ViewTableCell/ViewTableCell.css +1 -1
- package/build/esm/lib/kit/components/Views/ArrayBaseView/ArrayBaseView.css +1 -1
- package/build/esm/lib/kit/components/Views/CardOneOfView.js +13 -3
- package/build/esm/lib/kit/components/Views/CheckboxGroupView/CheckboxGroupView.css +2 -2
- package/build/esm/lib/kit/components/Views/MonacoInputView/MonacoViewDialog.css +1 -1
- package/build/esm/lib/kit/components/Views/TableArrayView/TableArrayView.css +1 -1
- package/build/esm/lib/kit/components/Views/TextAreaView/TextAreaView.css +1 -1
- package/build/esm/lib/kit/hooks/useOneOf/useOneOf.css +1 -1
- package/build/esm/lib/kit/utils/common.js +9 -8
- package/package.json +4 -4
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
text-overflow: ellipsis;
|
|
69
69
|
}
|
|
70
70
|
.df-view-row__right > .df-view-transparent {
|
|
71
|
-
margin-bottom: var(--df-view-row-right-child-view-transparent-margin-bottom,
|
|
71
|
+
margin-bottom: var(--df-view-row-right-child-view-transparent-margin-bottom, var(--g-spacing-2));
|
|
72
72
|
}
|
|
73
73
|
.df-view-row__right > .df-view-transparent:last-child {
|
|
74
74
|
margin-bottom: var(--df-spacing-last-child, var(--g-spacing-0));
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
margin-bottom: var(--df-spacing-last-child, var(--g-spacing-0));
|
|
50
50
|
}
|
|
51
51
|
.df-view-table-cell__inner > .df-view-transparent {
|
|
52
|
-
margin-bottom: var(--df-view-table-cell-inner-child-view-transparent-margin-bottom,
|
|
52
|
+
margin-bottom: var(--df-view-table-cell-inner-child-view-transparent-margin-bottom, var(--g-spacing-2));
|
|
53
53
|
}
|
|
54
54
|
.df-view-table-cell__inner > .df-view-transparent:last-child {
|
|
55
55
|
margin-bottom: var(--df-spacing-last-child, var(--g-spacing-0));
|
|
@@ -3,7 +3,7 @@ import isObjectLike from 'lodash/isObjectLike';
|
|
|
3
3
|
import { Card, ViewRow } from '../';
|
|
4
4
|
import { ViewController } from '../../../core';
|
|
5
5
|
export const CardOneOfView = (props) => {
|
|
6
|
-
const { value = {}, spec, name } = props;
|
|
6
|
+
const { value = {}, spec, name, Layout } = props;
|
|
7
7
|
const [open, setOpen] = React.useState(true);
|
|
8
8
|
const onToggle = React.useCallback(() => setOpen((f) => !f), [setOpen]);
|
|
9
9
|
const specProperties = React.useMemo(() => (isObjectLike(spec.properties) ? spec.properties : {}), [spec.properties]);
|
|
@@ -14,8 +14,18 @@ export const CardOneOfView = (props) => {
|
|
|
14
14
|
((_b = specProperties[valueKey]) === null || _b === void 0 ? void 0 : _b.viewSpec.layoutTitle) ||
|
|
15
15
|
valueKey);
|
|
16
16
|
}, [valueKey, spec.description, specProperties]);
|
|
17
|
-
const title = React.useMemo(() =>
|
|
18
|
-
|
|
17
|
+
const title = React.useMemo(() => {
|
|
18
|
+
const titleProps = {
|
|
19
|
+
spec: spec,
|
|
20
|
+
value: valueName,
|
|
21
|
+
name: name,
|
|
22
|
+
children: React.createElement(React.Fragment, null, valueName),
|
|
23
|
+
};
|
|
24
|
+
if (Layout) {
|
|
25
|
+
return React.createElement(Layout, Object.assign({}, titleProps));
|
|
26
|
+
}
|
|
27
|
+
return React.createElement(ViewRow, Object.assign({}, titleProps));
|
|
28
|
+
}, [spec, name, valueName, Layout]);
|
|
19
29
|
if (!value || !Object.keys(value).length) {
|
|
20
30
|
return null;
|
|
21
31
|
}
|
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
display: flex;
|
|
22
22
|
}
|
|
23
23
|
.df-checkbox-group-view > *:not(:last-child) {
|
|
24
|
-
margin-right: var(--df-checkbox-group-view-child-margin-right,
|
|
24
|
+
margin-right: var(--df-checkbox-group-view-child-margin-right, var(--g-spacing-3));
|
|
25
25
|
}
|
|
26
26
|
.df-checkbox-group-view_vertical {
|
|
27
27
|
flex-direction: column;
|
|
28
28
|
align-items: flex-start;
|
|
29
29
|
}
|
|
30
30
|
.df-checkbox-group-view_vertical > *:not(:last-child) {
|
|
31
|
-
margin: var(--df-checkbox-group-view-vertical-child-margin, var(--g-spacing-0) var(--g-spacing-0)
|
|
31
|
+
margin: var(--df-checkbox-group-view-vertical-child-margin, var(--g-spacing-0) var(--g-spacing-0) var(--g-spacing-2));
|
|
32
32
|
}
|
|
33
33
|
.df-checkbox-group-view__popover {
|
|
34
34
|
padding: var(--g-spacing-2);
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
*/
|
|
19
19
|
/* Border-radius */
|
|
20
20
|
.df-monaco-view-dialog .g-dialog-footer {
|
|
21
|
-
padding: var(--df-monaco-view-dialog-footer-padding,
|
|
21
|
+
padding: var(--df-monaco-view-dialog-footer-padding, var(--g-spacing-4));
|
|
22
22
|
}
|
|
23
23
|
.df-monaco-view-dialog__container {
|
|
24
24
|
border: 1px solid var(--g-color-line-generic);
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
*/
|
|
19
19
|
/* Border-radius */
|
|
20
20
|
.df-table-array-view__table {
|
|
21
|
-
margin-bottom: var(--df-table-array-view-table-margin-bottom,
|
|
21
|
+
margin-bottom: var(--df-table-array-view-table-margin-bottom, var(--g-spacing-3));
|
|
22
22
|
}
|
|
23
23
|
.df-table-array-view__cell {
|
|
24
24
|
max-width: var(--df-table-array-view-cell-min-width, 150px);
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
cursor: pointer;
|
|
25
25
|
}
|
|
26
26
|
.df-text-area-view__chevron {
|
|
27
|
-
margin: var(--df-text-area-view-chevron-margin,
|
|
27
|
+
margin: var(--df-text-area-view-chevron-margin, var(--g-spacing-half));
|
|
28
28
|
}
|
|
29
29
|
.df-text-area-view__chevron_open {
|
|
30
30
|
transform: rotate(180deg);
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
}
|
|
24
24
|
.df-use-oneof__toggler_card + .df-group-indent > .df-use-search:not(.df-group-indent) {
|
|
25
25
|
padding-top: var(--df-use-oneof-card-child-padding, var(--g-spacing-0));
|
|
26
|
-
margin-top: var(--df-spacing-inputs,
|
|
26
|
+
margin-top: var(--df-spacing-inputs, var(--g-spacing-4));
|
|
27
27
|
}
|
|
28
28
|
.df-use-oneof__card {
|
|
29
29
|
display: flex;
|
|
@@ -37,7 +37,7 @@ export const isNotEmptyValue = (value, spec) => {
|
|
|
37
37
|
return true;
|
|
38
38
|
};
|
|
39
39
|
export const prepareSpec = (spec, parseJsonDefaultValue, overridePatternError) => {
|
|
40
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
40
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
41
41
|
if (isObjectLike(spec)) {
|
|
42
42
|
const result = cloneDeep(spec);
|
|
43
43
|
if (isString(result.type)) {
|
|
@@ -49,7 +49,7 @@ export const prepareSpec = (spec, parseJsonDefaultValue, overridePatternError) =
|
|
|
49
49
|
try {
|
|
50
50
|
_defaultValue = JSON.parse(result.defaultValue);
|
|
51
51
|
}
|
|
52
|
-
catch (
|
|
52
|
+
catch (_m) {
|
|
53
53
|
_defaultValue = undefined;
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -70,20 +70,21 @@ export const prepareSpec = (spec, parseJsonDefaultValue, overridePatternError) =
|
|
|
70
70
|
if (isString((_c = result.viewSpec) === null || _c === void 0 ? void 0 : _c.addButtonPosition)) {
|
|
71
71
|
result.viewSpec.addButtonPosition = result.viewSpec.addButtonPosition.toLowerCase();
|
|
72
72
|
}
|
|
73
|
-
if (isString((_d = result.viewSpec) === null || _d === void 0 ? void 0 : _d.
|
|
74
|
-
result.viewSpec.textContentParams = Object.assign(Object.assign({}, result.viewSpec.textContentParams), { themeLabel: result.viewSpec.themeLabel.toLowerCase() });
|
|
75
|
-
}
|
|
76
|
-
if (isString((_f = (_e = result.viewSpec) === null || _e === void 0 ? void 0 : _e.oneOfParams) === null || _f === void 0 ? void 0 : _f.toggler)) {
|
|
73
|
+
if (isString((_e = (_d = result.viewSpec) === null || _d === void 0 ? void 0 : _d.oneOfParams) === null || _e === void 0 ? void 0 : _e.toggler)) {
|
|
77
74
|
result.viewSpec.oneOfParams.toggler = result.viewSpec.oneOfParams.toggler.toLowerCase();
|
|
78
75
|
}
|
|
79
|
-
if (isString((
|
|
76
|
+
if (isString((_g = (_f = result.viewSpec) === null || _f === void 0 ? void 0 : _f.textContentParams) === null || _g === void 0 ? void 0 : _g.themeLabel)) {
|
|
80
77
|
result.viewSpec.textContentParams.themeLabel =
|
|
81
78
|
result.viewSpec.textContentParams.themeLabel.toLowerCase();
|
|
82
79
|
}
|
|
83
|
-
if (isString((
|
|
80
|
+
if (isString((_j = (_h = result.viewSpec) === null || _h === void 0 ? void 0 : _h.textContentParams) === null || _j === void 0 ? void 0 : _j.themeAlert)) {
|
|
84
81
|
result.viewSpec.textContentParams.themeAlert =
|
|
85
82
|
result.viewSpec.textContentParams.themeAlert.toLowerCase();
|
|
86
83
|
}
|
|
84
|
+
if (isString((_l = (_k = result.viewSpec) === null || _k === void 0 ? void 0 : _k.textContentParams) === null || _l === void 0 ? void 0 : _l.viewAlert)) {
|
|
85
|
+
result.viewSpec.textContentParams.viewAlert =
|
|
86
|
+
result.viewSpec.textContentParams.viewAlert.toLowerCase();
|
|
87
|
+
}
|
|
87
88
|
if (isString(result.validator)) {
|
|
88
89
|
result.validator = result.validator.toLowerCase();
|
|
89
90
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-ui/dynamic-forms",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "build/cjs/index.js",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@bem-react/classname": "^1.6.0",
|
|
48
|
-
"@gravity-ui/date-components": "^3.0.0
|
|
48
|
+
"@gravity-ui/date-components": "^3.0.0",
|
|
49
49
|
"@gravity-ui/date-utils": "^2.5.5",
|
|
50
50
|
"@gravity-ui/i18n": "^1.2.0",
|
|
51
51
|
"@gravity-ui/icons": "^2.12.0",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"@gravity-ui/prettier-config": "^1.1.0",
|
|
61
61
|
"@gravity-ui/stylelint-config": "^4.0.1",
|
|
62
62
|
"@gravity-ui/tsconfig": "^1.0.0",
|
|
63
|
-
"@gravity-ui/uikit": "^7.
|
|
63
|
+
"@gravity-ui/uikit": "^7.1.0",
|
|
64
64
|
"@playwright/experimental-ct-react": "^1.40.0",
|
|
65
65
|
"@playwright/test": "^1.40.0",
|
|
66
66
|
"@storybook/addon-essentials": "^7.0.27",
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
"uuid": "^9.0.1"
|
|
115
115
|
},
|
|
116
116
|
"peerDependencies": {
|
|
117
|
-
"@gravity-ui/uikit": "^7.0.0
|
|
117
|
+
"@gravity-ui/uikit": "^7.0.0",
|
|
118
118
|
"final-form": "^4.20.2",
|
|
119
119
|
"react": "^16.0.0 || ^17.0.0 || ^18.0.0",
|
|
120
120
|
"react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0",
|