@gravity-ui/dynamic-forms 2.6.0 → 2.7.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.
@@ -28,7 +28,7 @@ const Controller = ({ spec, name, value, parentOnChange, parentOnUnmount, }) =>
28
28
  useField: renderProps,
29
29
  useSearch: withSearch,
30
30
  }, __mirror);
31
- if (lodash_1.default.isString(name) && (0, helpers_1.isCorrectSpec)(spec) && !spec.viewSpec.hideInput) {
31
+ if (lodash_1.default.isString(name) && (0, helpers_1.isCorrectSpec)(spec) && !spec.viewSpec.hidden) {
32
32
  return withSearch(render(renderProps));
33
33
  }
34
34
  return null;
@@ -8,6 +8,9 @@ const ViewController = ({ spec, name, }) => {
8
8
  const { config, value, Link } = (0, hooks_1.useDynamicFormsCtx)();
9
9
  const { viewEntity, Layout } = (0, hooks_1.useComponents)(spec, config);
10
10
  const render = (0, hooks_1.useRender)({ name, value, spec, viewEntity, Layout, Link });
11
- return react_1.default.createElement(react_1.default.Fragment, null, render);
11
+ if (!spec.viewSpec.hidden) {
12
+ return react_1.default.createElement(react_1.default.Fragment, null, render);
13
+ }
14
+ return null;
12
15
  };
13
16
  exports.ViewController = ViewController;
@@ -1,6 +1,7 @@
1
1
  .df-transparent {
2
2
  display: flex;
3
3
  margin-bottom: 15px;
4
+ align-items: flex-end;
4
5
  }
5
6
  .df-transparent:last-child {
6
7
  margin-bottom: 0;
@@ -24,7 +24,7 @@ export const Controller = ({ spec, name, value, parentOnChange, parentOnUnmount,
24
24
  useField: renderProps,
25
25
  useSearch: withSearch,
26
26
  }, __mirror);
27
- if (_.isString(name) && isCorrectSpec(spec) && !spec.viewSpec.hideInput) {
27
+ if (_.isString(name) && isCorrectSpec(spec) && !spec.viewSpec.hidden) {
28
28
  return withSearch(render(renderProps));
29
29
  }
30
30
  return null;
@@ -3,4 +3,4 @@ export interface ViewControllerProps<SpecType extends Spec> {
3
3
  spec: SpecType;
4
4
  name: string;
5
5
  }
6
- export declare const ViewController: <SpecType extends Spec>({ spec, name, }: ViewControllerProps<SpecType>) => JSX.Element;
6
+ export declare const ViewController: <SpecType extends Spec>({ spec, name, }: ViewControllerProps<SpecType>) => JSX.Element | null;
@@ -4,5 +4,8 @@ export const ViewController = ({ spec, name, }) => {
4
4
  const { config, value, Link } = useDynamicFormsCtx();
5
5
  const { viewEntity, Layout } = useComponents(spec, config);
6
6
  const render = useRender({ name, value, spec, viewEntity, Layout, Link });
7
- return React.createElement(React.Fragment, null, render);
7
+ if (!spec.viewSpec.hidden) {
8
+ return React.createElement(React.Fragment, null, render);
9
+ }
10
+ return null;
8
11
  };
@@ -28,7 +28,7 @@ export interface ArraySpec<LinkType = any> {
28
28
  link?: LinkType;
29
29
  placeholder?: string;
30
30
  addButtonPosition?: 'down' | 'right';
31
- hideInput?: boolean;
31
+ hidden?: boolean;
32
32
  selectParams?: {
33
33
  filterPlaceholder?: string;
34
34
  meta?: Record<string, string>;
@@ -48,7 +48,7 @@ export interface BooleanSpec<LinkType = any> {
48
48
  layoutDescription?: string;
49
49
  layoutOpen?: boolean;
50
50
  link?: LinkType;
51
- hideInput?: boolean;
51
+ hidden?: boolean;
52
52
  };
53
53
  }
54
54
  export interface NumberSpec<LinkType = any> {
@@ -69,7 +69,7 @@ export interface NumberSpec<LinkType = any> {
69
69
  link?: LinkType;
70
70
  placeholder?: string;
71
71
  copy?: boolean;
72
- hideInput?: boolean;
72
+ hidden?: boolean;
73
73
  };
74
74
  }
75
75
  export interface ObjectSpec<LinkType = any> {
@@ -92,7 +92,7 @@ export interface ObjectSpec<LinkType = any> {
92
92
  toggler?: 'select' | 'radio' | 'card';
93
93
  };
94
94
  placeholder?: string;
95
- hideInput?: boolean;
95
+ hidden?: boolean;
96
96
  };
97
97
  }
98
98
  export interface StringSpec<LinkType = any> {
@@ -128,7 +128,7 @@ export interface StringSpec<LinkType = any> {
128
128
  };
129
129
  hideValues?: string[];
130
130
  placeholder?: string;
131
- hideInput?: boolean;
131
+ hidden?: boolean;
132
132
  textContentParams?: {
133
133
  themeLabel?: LabelProps['theme'];
134
134
  text: string;
@@ -1,6 +1,7 @@
1
1
  .df-transparent {
2
2
  display: flex;
3
3
  margin-bottom: 15px;
4
+ align-items: flex-end;
4
5
  }
5
6
  .df-transparent:last-child {
6
7
  margin-bottom: 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/dynamic-forms",
3
- "version": "2.6.0",
3
+ "version": "2.7.0",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "main": "build/cjs/index.js",