@gravity-ui/dynamic-forms 1.7.0 → 1.8.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/CHANGELOG.md +14 -0
- package/build/cjs/lib/kit/components/Inputs/OneOf/OneOf.css +5 -5
- package/build/cjs/lib/kit/components/Inputs/Switch/Switch.css +5 -0
- package/build/cjs/lib/kit/components/Inputs/Switch/Switch.js +14 -0
- package/build/cjs/lib/kit/components/Inputs/Switch/index.js +4 -0
- package/build/cjs/lib/kit/components/Inputs/index.js +1 -0
- package/build/cjs/lib/kit/components/Views/OneOfView/OneOfView.css +1 -1
- package/build/cjs/lib/kit/constants/config.js +4 -0
- package/build/esm/lib/kit/components/Inputs/OneOf/OneOf.css +5 -5
- package/build/esm/lib/kit/components/Inputs/Switch/Switch.css +5 -0
- package/build/esm/lib/kit/components/Inputs/Switch/Switch.d.ts +3 -0
- package/build/esm/lib/kit/components/Inputs/Switch/Switch.js +10 -0
- package/build/esm/lib/kit/components/Inputs/Switch/index.d.ts +1 -0
- package/build/esm/lib/kit/components/Inputs/Switch/index.js +1 -0
- package/build/esm/lib/kit/components/Inputs/index.d.ts +1 -0
- package/build/esm/lib/kit/components/Inputs/index.js +1 -0
- package/build/esm/lib/kit/components/Views/OneOfView/OneOfView.css +1 -1
- package/build/esm/lib/kit/constants/config.js +5 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.8.0](https://github.com/gravity-ui/dynamic-forms/compare/v1.7.1...v1.8.0) (2023-05-25)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **Switch:** added new input switch ([#48](https://github.com/gravity-ui/dynamic-forms/issues/48)) ([47e2f51](https://github.com/gravity-ui/dynamic-forms/commit/47e2f51dcda0579b00f6fadc3008d2e78a2f47e7))
|
|
9
|
+
|
|
10
|
+
## [1.7.1](https://github.com/gravity-ui/dynamic-forms/compare/v1.7.0...v1.7.1) (2023-05-22)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* **OneOf:** fixed styles in inputs and view ([#46](https://github.com/gravity-ui/dynamic-forms/issues/46)) ([e7a824d](https://github.com/gravity-ui/dynamic-forms/commit/e7a824d4fec537ebef10f96049279bfc7a759f3b))
|
|
16
|
+
|
|
3
17
|
## [1.7.0](https://github.com/gravity-ui/dynamic-forms/compare/v1.6.2...v1.7.0) (2023-05-22)
|
|
4
18
|
|
|
5
19
|
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
.df-oneof:last-child > .df-group-indent {
|
|
6
6
|
margin-bottom: 0;
|
|
7
7
|
}
|
|
8
|
-
.df-oneof_base .df-group-indent {
|
|
8
|
+
.df-oneof_base > .df-group-indent {
|
|
9
9
|
all: unset;
|
|
10
10
|
}
|
|
11
|
-
.df-oneof_base .df-group-indent > .df-use-search {
|
|
11
|
+
.df-oneof_base > .df-group-indent > .df-use-search {
|
|
12
12
|
padding-top: 11px;
|
|
13
13
|
padding-left: 20px;
|
|
14
14
|
margin-top: 4px;
|
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
margin-left: 5px;
|
|
17
17
|
border-left: 1px solid var(--yc-color-line-generic-accent);
|
|
18
18
|
}
|
|
19
|
-
.df-oneof_base .df-group-indent > .df-use-search:empty {
|
|
19
|
+
.df-oneof_base > .df-group-indent > .df-use-search:empty {
|
|
20
20
|
display: none;
|
|
21
21
|
}
|
|
22
|
-
.df-oneof_base .df-group-indent > .df-use-search:last-child {
|
|
22
|
+
.df-oneof_base > .df-group-indent > .df-use-search:last-child {
|
|
23
23
|
margin-bottom: 0;
|
|
24
24
|
}
|
|
25
|
-
.df-oneof_base .df-group-indent > .df-use-search > .df-simple-vertical-accordeon_view {
|
|
25
|
+
.df-oneof_base > .df-group-indent > .df-use-search > .df-simple-vertical-accordeon_view {
|
|
26
26
|
margin-top: -10px;
|
|
27
27
|
}
|
|
28
28
|
.df-oneof_flat > .df-group-indent {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Switch = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
const uikit_1 = require("@gravity-ui/uikit");
|
|
7
|
+
const utils_1 = require("../../../utils");
|
|
8
|
+
const b = (0, utils_1.block)('switch');
|
|
9
|
+
const Switch = ({ name, input, spec }) => {
|
|
10
|
+
const { value, onBlur, onChange, onFocus } = input;
|
|
11
|
+
const handleChange = react_1.default.useCallback((e) => onChange(e.target.checked), [onChange]);
|
|
12
|
+
return (react_1.default.createElement(uikit_1.Switch, { checked: value, onChange: handleChange, onBlur: onBlur, onFocus: onFocus, disabled: spec.viewSpec.disabled, className: b(), qa: name }));
|
|
13
|
+
};
|
|
14
|
+
exports.Switch = Switch;
|
|
@@ -12,6 +12,7 @@ tslib_1.__exportStar(require("./OneOf"), exports);
|
|
|
12
12
|
tslib_1.__exportStar(require("./OneOfCard"), exports);
|
|
13
13
|
tslib_1.__exportStar(require("./Secret"), exports);
|
|
14
14
|
tslib_1.__exportStar(require("./Select"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./Switch"), exports);
|
|
15
16
|
tslib_1.__exportStar(require("./TableArrayInput"), exports);
|
|
16
17
|
tslib_1.__exportStar(require("./Text"), exports);
|
|
17
18
|
tslib_1.__exportStar(require("./TextArea"), exports);
|
|
@@ -30,6 +30,7 @@ exports.dynamicConfig = {
|
|
|
30
30
|
boolean: {
|
|
31
31
|
inputs: {
|
|
32
32
|
base: { Component: components_1.Checkbox },
|
|
33
|
+
switch: { Component: components_1.Switch },
|
|
33
34
|
},
|
|
34
35
|
layouts: {
|
|
35
36
|
row: components_1.Row,
|
|
@@ -132,6 +133,7 @@ exports.dynamicCardConfig = {
|
|
|
132
133
|
boolean: {
|
|
133
134
|
inputs: {
|
|
134
135
|
base: { Component: components_1.Checkbox },
|
|
136
|
+
switch: { Component: components_1.Switch },
|
|
135
137
|
},
|
|
136
138
|
layouts: {
|
|
137
139
|
row: components_1.Row2,
|
|
@@ -224,6 +226,7 @@ exports.dynamicViewConfig = {
|
|
|
224
226
|
boolean: {
|
|
225
227
|
views: {
|
|
226
228
|
base: { Component: components_1.BaseView },
|
|
229
|
+
switch: { Component: components_1.BaseView },
|
|
227
230
|
},
|
|
228
231
|
layouts: {
|
|
229
232
|
row: components_1.ViewRow,
|
|
@@ -306,6 +309,7 @@ exports.dynamicViewCardConfig = {
|
|
|
306
309
|
boolean: {
|
|
307
310
|
views: {
|
|
308
311
|
base: { Component: components_1.BaseView },
|
|
312
|
+
switch: { Component: components_1.BaseView },
|
|
309
313
|
},
|
|
310
314
|
layouts: {
|
|
311
315
|
row: components_1.ViewRow2,
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
.df-oneof:last-child > .df-group-indent {
|
|
6
6
|
margin-bottom: 0;
|
|
7
7
|
}
|
|
8
|
-
.df-oneof_base .df-group-indent {
|
|
8
|
+
.df-oneof_base > .df-group-indent {
|
|
9
9
|
all: unset;
|
|
10
10
|
}
|
|
11
|
-
.df-oneof_base .df-group-indent > .df-use-search {
|
|
11
|
+
.df-oneof_base > .df-group-indent > .df-use-search {
|
|
12
12
|
padding-top: 11px;
|
|
13
13
|
padding-left: 20px;
|
|
14
14
|
margin-top: 4px;
|
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
margin-left: 5px;
|
|
17
17
|
border-left: 1px solid var(--yc-color-line-generic-accent);
|
|
18
18
|
}
|
|
19
|
-
.df-oneof_base .df-group-indent > .df-use-search:empty {
|
|
19
|
+
.df-oneof_base > .df-group-indent > .df-use-search:empty {
|
|
20
20
|
display: none;
|
|
21
21
|
}
|
|
22
|
-
.df-oneof_base .df-group-indent > .df-use-search:last-child {
|
|
22
|
+
.df-oneof_base > .df-group-indent > .df-use-search:last-child {
|
|
23
23
|
margin-bottom: 0;
|
|
24
24
|
}
|
|
25
|
-
.df-oneof_base .df-group-indent > .df-use-search > .df-simple-vertical-accordeon_view {
|
|
25
|
+
.df-oneof_base > .df-group-indent > .df-use-search > .df-simple-vertical-accordeon_view {
|
|
26
26
|
margin-top: -10px;
|
|
27
27
|
}
|
|
28
28
|
.df-oneof_flat > .df-group-indent {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Switch as SwitchBase } from '@gravity-ui/uikit';
|
|
3
|
+
import { block } from '../../../utils';
|
|
4
|
+
import './Switch.css';
|
|
5
|
+
const b = block('switch');
|
|
6
|
+
export const Switch = ({ name, input, spec }) => {
|
|
7
|
+
const { value, onBlur, onChange, onFocus } = input;
|
|
8
|
+
const handleChange = React.useCallback((e) => onChange(e.target.checked), [onChange]);
|
|
9
|
+
return (React.createElement(SwitchBase, { checked: value, onChange: handleChange, onBlur: onBlur, onFocus: onFocus, disabled: spec.viewSpec.disabled, className: b(), qa: name }));
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Switch';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Switch';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Accordeon, AccordeonCardLayout, ArrayBase, ArrayBaseView, BaseView, CardAccordeon, CardOneOf, CardOneOfView, CardSection, Checkbox, FileInput, FileInputView, Group, Group2, MonacoInput, MonacoInputCard, MonacoView, MonacoViewCard, MultiSelect, MultiSelectView, NumberWithScale, NumberWithScaleView, ObjectBase, ObjectBaseView, ObjectValueInput, ObjectValueInputView, OneOf, OneOfCard, OneOfCardView, OneOfFlat, OneOfFlatView, OneOfView, Row, Row2, RowVerbose, Secret, Section, Section2, SectionCard, SectionCard2, SectionWithSubtitle, SectionWithSubtitle2, Select, TableArrayInput, TableArrayView, TableCell, Text, TextArea, TextAreaView, TextContent, TextLink, TextLinkView, Transparent, ViewAccordeon, ViewAccordeonCard, ViewCardAccordeon, ViewCardSection, ViewGroup, ViewGroup2, ViewRow, ViewRow2, ViewSection, ViewSection2, ViewSectionCard, ViewSectionCard2, ViewTableCell, ViewTransparent, } from '../components';
|
|
1
|
+
import { Accordeon, AccordeonCardLayout, ArrayBase, ArrayBaseView, BaseView, CardAccordeon, CardOneOf, CardOneOfView, CardSection, Checkbox, FileInput, FileInputView, Group, Group2, MonacoInput, MonacoInputCard, MonacoView, MonacoViewCard, MultiSelect, MultiSelectView, NumberWithScale, NumberWithScaleView, ObjectBase, ObjectBaseView, ObjectValueInput, ObjectValueInputView, OneOf, OneOfCard, OneOfCardView, OneOfFlat, OneOfFlatView, OneOfView, Row, Row2, RowVerbose, Secret, Section, Section2, SectionCard, SectionCard2, SectionWithSubtitle, SectionWithSubtitle2, Select, Switch, TableArrayInput, TableArrayView, TableCell, Text, TextArea, TextAreaView, TextContent, TextLink, TextLinkView, Transparent, ViewAccordeon, ViewAccordeonCard, ViewCardAccordeon, ViewCardSection, ViewGroup, ViewGroup2, ViewRow, ViewRow2, ViewSection, ViewSection2, ViewSectionCard, ViewSectionCard2, ViewTableCell, ViewTransparent, } from '../components';
|
|
2
2
|
import { getArrayValidator, getBooleanValidator, getNumberValidator, getObjectValidator, getStringValidator, } from '../validators';
|
|
3
3
|
export const dynamicConfig = {
|
|
4
4
|
array: {
|
|
@@ -27,6 +27,7 @@ export const dynamicConfig = {
|
|
|
27
27
|
boolean: {
|
|
28
28
|
inputs: {
|
|
29
29
|
base: { Component: Checkbox },
|
|
30
|
+
switch: { Component: Switch },
|
|
30
31
|
},
|
|
31
32
|
layouts: {
|
|
32
33
|
row: Row,
|
|
@@ -129,6 +130,7 @@ export const dynamicCardConfig = {
|
|
|
129
130
|
boolean: {
|
|
130
131
|
inputs: {
|
|
131
132
|
base: { Component: Checkbox },
|
|
133
|
+
switch: { Component: Switch },
|
|
132
134
|
},
|
|
133
135
|
layouts: {
|
|
134
136
|
row: Row2,
|
|
@@ -221,6 +223,7 @@ export const dynamicViewConfig = {
|
|
|
221
223
|
boolean: {
|
|
222
224
|
views: {
|
|
223
225
|
base: { Component: BaseView },
|
|
226
|
+
switch: { Component: BaseView },
|
|
224
227
|
},
|
|
225
228
|
layouts: {
|
|
226
229
|
row: ViewRow,
|
|
@@ -303,6 +306,7 @@ export const dynamicViewCardConfig = {
|
|
|
303
306
|
boolean: {
|
|
304
307
|
views: {
|
|
305
308
|
base: { Component: BaseView },
|
|
309
|
+
switch: { Component: BaseView },
|
|
306
310
|
},
|
|
307
311
|
layouts: {
|
|
308
312
|
row: ViewRow2,
|