@gravity-ui/dynamic-forms 5.23.1 → 5.24.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/unstable/core/types/components.d.ts +3 -13
- package/build/cjs/lib/unstable/core/types/schema.d.ts +14 -7
- package/build/cjs/lib/unstable/core/useSchemaRenderer/types/state.d.ts +3 -0
- package/build/cjs/lib/unstable/core/utils/definers.d.ts +27 -13
- package/build/cjs/lib/unstable/kit/components/HTMLContent/HTMLContent.d.ts +2 -1
- package/build/cjs/lib/unstable/kit/components/HTMLContent/HTMLContent.js +12 -2
- package/build/cjs/lib/unstable/kit/components/LayoutContainer/LayoutContainer.css +3 -0
- package/build/cjs/lib/unstable/kit/components/LayoutContainer/LayoutContainer.d.ts +1 -0
- package/build/cjs/lib/unstable/kit/components/LayoutContainer/LayoutContainer.js +2 -2
- package/build/cjs/lib/unstable/kit/entities/Alert/Alert.css +16 -0
- package/build/cjs/lib/unstable/kit/entities/Alert/Alert.js +26 -7
- package/build/cjs/lib/unstable/kit/entities/ArrayEntity/ArrayEntity.d.ts +0 -1
- package/build/cjs/lib/unstable/kit/entities/ArrayEntity/ArrayEntity.js +4 -2
- package/build/cjs/lib/unstable/kit/entities/ArrayTable/ArrayTable.d.ts +0 -1
- package/build/cjs/lib/unstable/kit/entities/ArrayTable/ArrayTable.js +5 -3
- package/build/cjs/lib/unstable/kit/entities/FewOfNested/FewOfNested.css +3 -0
- package/build/cjs/lib/unstable/kit/entities/Label/Label.js +4 -4
- package/build/cjs/lib/unstable/kit/entities/Monaco/Monaco.js +3 -1
- package/build/cjs/lib/unstable/kit/entities/ObjectEntity/ObjectEntity.d.ts +0 -1
- package/build/cjs/lib/unstable/kit/entities/ObjectInline/ObjectInline.d.ts +0 -1
- package/build/cjs/lib/unstable/kit/entities/OneOfNested/OneOfNested.css +3 -0
- package/build/cjs/lib/unstable/kit/entities/TextContent/TextContent.js +4 -4
- package/build/cjs/lib/unstable/kit/form-entities/CheckboxGroupInput/CheckboxGroupInput.d.ts +0 -1
- package/build/cjs/lib/unstable/kit/form-entities/CheckboxGroupInput/CheckboxGroupInput.js +3 -1
- package/build/cjs/lib/unstable/kit/form-entities/CheckboxInput/CheckboxInput.js +3 -1
- package/build/cjs/lib/unstable/kit/form-entities/ColorPickerInput/ColorPickerInput.js +3 -1
- package/build/cjs/lib/unstable/kit/form-entities/DateInput/DateInput.js +3 -2
- package/build/cjs/lib/unstable/kit/form-entities/FileInput/FileInput.js +3 -1
- package/build/cjs/lib/unstable/kit/form-entities/MultiSelectInput/MultiSelectInput.js +4 -2
- package/build/cjs/lib/unstable/kit/form-entities/NumberInput/NumberInput.js +3 -2
- package/build/cjs/lib/unstable/kit/form-entities/NumberWithScaleInput/NumberWithScaleInput.js +3 -2
- package/build/cjs/lib/unstable/kit/form-entities/PasswordInput/PasswordInput.js +3 -2
- package/build/cjs/lib/unstable/kit/form-entities/RadioGroupInput/RadioGroupInput.js +3 -1
- package/build/cjs/lib/unstable/kit/form-entities/RangeSliderInput/RangeSliderInput.js +9 -8
- package/build/cjs/lib/unstable/kit/form-entities/SegmentedRadioGroupInput/SegmentedRadioGroupInput.js +3 -1
- package/build/cjs/lib/unstable/kit/form-entities/SelectInput/SelectInput.js +4 -2
- package/build/cjs/lib/unstable/kit/form-entities/SliderInput/SliderInput.js +3 -1
- package/build/cjs/lib/unstable/kit/form-entities/StringInput/StringInput.js +3 -2
- package/build/cjs/lib/unstable/kit/form-entities/StringNumberWithScaleInput/StringNumberWithScaleInput.js +4 -3
- package/build/cjs/lib/unstable/kit/form-entities/SwitchInput/SwitchInput.js +3 -1
- package/build/cjs/lib/unstable/kit/form-entities/TextAreaInput/TextAreaInput.js +3 -2
- package/build/cjs/lib/unstable/kit/form-layouts/FormColumn/FormColumn.js +8 -6
- package/build/cjs/lib/unstable/kit/form-layouts/FormRow/FormRow.js +8 -6
- package/build/cjs/lib/unstable/kit/index.d.ts +1 -0
- package/build/cjs/lib/unstable/kit/index.js +1 -0
- package/build/cjs/lib/unstable/kit/layouts/Accordeon/Accordeon.js +6 -4
- package/build/cjs/lib/unstable/kit/layouts/Card/Card.js +8 -6
- package/build/cjs/lib/unstable/kit/layouts/Section/Section.js +8 -6
- package/build/cjs/lib/unstable/kit/layouts/Transparent/Transparent.js +5 -3
- package/build/cjs/lib/unstable/kit/overview-layouts/OverviewColumn/OverviewColumn.js +7 -5
- package/build/cjs/lib/unstable/kit/overview-layouts/OverviewRow/OverviewRow.js +7 -5
- package/build/cjs/lib/unstable/kit/utils/index.d.ts +1 -1
- package/build/cjs/lib/unstable/kit/utils/index.js +1 -7
- package/build/cjs/lib/unstable/kit/utils/transformer.d.ts +10 -17
- package/build/cjs/lib/unstable/kit/utils/transformer.js +542 -2778
- package/build/esm/lib/unstable/core/types/components.d.ts +3 -13
- package/build/esm/lib/unstable/core/types/schema.d.ts +14 -7
- package/build/esm/lib/unstable/core/useSchemaRenderer/types/state.d.ts +3 -0
- package/build/esm/lib/unstable/core/utils/definers.d.ts +27 -13
- package/build/esm/lib/unstable/kit/components/HTMLContent/HTMLContent.d.ts +2 -1
- package/build/esm/lib/unstable/kit/components/HTMLContent/HTMLContent.js +12 -2
- package/build/esm/lib/unstable/kit/components/LayoutContainer/LayoutContainer.css +3 -0
- package/build/esm/lib/unstable/kit/components/LayoutContainer/LayoutContainer.d.ts +1 -0
- package/build/esm/lib/unstable/kit/components/LayoutContainer/LayoutContainer.js +2 -2
- package/build/esm/lib/unstable/kit/entities/Alert/Alert.css +16 -0
- package/build/esm/lib/unstable/kit/entities/Alert/Alert.d.ts +1 -0
- package/build/esm/lib/unstable/kit/entities/Alert/Alert.js +29 -9
- package/build/esm/lib/unstable/kit/entities/ArrayEntity/ArrayEntity.d.ts +0 -1
- package/build/esm/lib/unstable/kit/entities/ArrayEntity/ArrayEntity.js +4 -2
- package/build/esm/lib/unstable/kit/entities/ArrayTable/ArrayTable.d.ts +0 -1
- package/build/esm/lib/unstable/kit/entities/ArrayTable/ArrayTable.js +5 -3
- package/build/esm/lib/unstable/kit/entities/FewOfNested/FewOfNested.css +3 -0
- package/build/esm/lib/unstable/kit/entities/Label/Label.js +5 -5
- package/build/esm/lib/unstable/kit/entities/Monaco/Monaco.js +3 -1
- package/build/esm/lib/unstable/kit/entities/ObjectEntity/ObjectEntity.d.ts +0 -1
- package/build/esm/lib/unstable/kit/entities/ObjectInline/ObjectInline.d.ts +0 -1
- package/build/esm/lib/unstable/kit/entities/OneOfNested/OneOfNested.css +3 -0
- package/build/esm/lib/unstable/kit/entities/TextContent/TextContent.js +5 -5
- package/build/esm/lib/unstable/kit/form-entities/CheckboxGroupInput/CheckboxGroupInput.d.ts +0 -1
- package/build/esm/lib/unstable/kit/form-entities/CheckboxGroupInput/CheckboxGroupInput.js +3 -1
- package/build/esm/lib/unstable/kit/form-entities/CheckboxInput/CheckboxInput.js +3 -1
- package/build/esm/lib/unstable/kit/form-entities/ColorPickerInput/ColorPickerInput.js +3 -1
- package/build/esm/lib/unstable/kit/form-entities/DateInput/DateInput.js +3 -2
- package/build/esm/lib/unstable/kit/form-entities/FileInput/FileInput.js +3 -1
- package/build/esm/lib/unstable/kit/form-entities/MultiSelectInput/MultiSelectInput.js +4 -2
- package/build/esm/lib/unstable/kit/form-entities/NumberInput/NumberInput.js +3 -2
- package/build/esm/lib/unstable/kit/form-entities/NumberWithScaleInput/NumberWithScaleInput.js +3 -2
- package/build/esm/lib/unstable/kit/form-entities/PasswordInput/PasswordInput.js +3 -2
- package/build/esm/lib/unstable/kit/form-entities/RadioGroupInput/RadioGroupInput.js +3 -1
- package/build/esm/lib/unstable/kit/form-entities/RangeSliderInput/RangeSliderInput.js +9 -8
- package/build/esm/lib/unstable/kit/form-entities/SegmentedRadioGroupInput/SegmentedRadioGroupInput.js +3 -1
- package/build/esm/lib/unstable/kit/form-entities/SelectInput/SelectInput.js +4 -2
- package/build/esm/lib/unstable/kit/form-entities/SliderInput/SliderInput.js +3 -1
- package/build/esm/lib/unstable/kit/form-entities/StringInput/StringInput.js +3 -2
- package/build/esm/lib/unstable/kit/form-entities/StringNumberWithScaleInput/StringNumberWithScaleInput.js +4 -3
- package/build/esm/lib/unstable/kit/form-entities/SwitchInput/SwitchInput.js +3 -1
- package/build/esm/lib/unstable/kit/form-entities/TextAreaInput/TextAreaInput.js +3 -2
- package/build/esm/lib/unstable/kit/form-layouts/FormColumn/FormColumn.js +8 -6
- package/build/esm/lib/unstable/kit/form-layouts/FormRow/FormRow.js +8 -6
- package/build/esm/lib/unstable/kit/index.d.ts +1 -0
- package/build/esm/lib/unstable/kit/index.js +1 -0
- package/build/esm/lib/unstable/kit/layouts/Accordeon/Accordeon.js +6 -4
- package/build/esm/lib/unstable/kit/layouts/Card/Card.js +8 -6
- package/build/esm/lib/unstable/kit/layouts/Section/Section.js +8 -6
- package/build/esm/lib/unstable/kit/layouts/Transparent/Transparent.js +5 -3
- package/build/esm/lib/unstable/kit/overview-layouts/OverviewColumn/OverviewColumn.js +7 -5
- package/build/esm/lib/unstable/kit/overview-layouts/OverviewRow/OverviewRow.js +7 -5
- package/build/esm/lib/unstable/kit/utils/index.d.ts +1 -1
- package/build/esm/lib/unstable/kit/utils/index.js +1 -1
- package/build/esm/lib/unstable/kit/utils/transformer.d.ts +10 -17
- package/build/esm/lib/unstable/kit/utils/transformer.js +543 -2778
- package/package.json +1 -1
|
@@ -3,31 +3,21 @@ import type { FieldRenderProps } from 'react-final-form';
|
|
|
3
3
|
import type { SchemaRendererMode } from '../constants';
|
|
4
4
|
import type { SchemaToValueType } from './helpers';
|
|
5
5
|
import type { JsonSchema } from './schema';
|
|
6
|
-
export interface DefaultNodeLayoutProps {
|
|
7
|
-
copy?: boolean;
|
|
8
|
-
hidden?: boolean;
|
|
9
|
-
open?: boolean;
|
|
10
|
-
required?: boolean;
|
|
11
|
-
}
|
|
12
6
|
export interface NodeLayoutProps<Schema extends JsonSchema, Props extends Record<string, any> = {}, Value extends SchemaToValueType<Schema> = SchemaToValueType<Schema>> extends FieldRenderProps<Value | null | undefined> {
|
|
13
7
|
children: React.ReactNode;
|
|
14
8
|
headName: string;
|
|
15
9
|
mode: SchemaRendererMode;
|
|
16
|
-
props:
|
|
10
|
+
props: Partial<Props>;
|
|
17
11
|
schema: Schema;
|
|
18
12
|
schemaPath: string;
|
|
19
13
|
}
|
|
20
14
|
export type NodeLayout<Schema extends JsonSchema, Props extends Record<string, any> = {}, Value extends SchemaToValueType<Schema> = SchemaToValueType<Schema>> = React.FC<NodeLayoutProps<Schema, Props, Value>>;
|
|
21
|
-
export interface DefaultNodeEntityProps {
|
|
22
|
-
disabled?: boolean;
|
|
23
|
-
required?: boolean;
|
|
24
|
-
}
|
|
25
15
|
export interface NodeEntityProps<Schema extends JsonSchema, Props extends Record<string, any> = {}, LayoutProps extends Record<string, any> = {}, Value extends SchemaToValueType<Schema> = SchemaToValueType<Schema>> extends FieldRenderProps<Value | null | undefined> {
|
|
26
16
|
Layout?: NodeLayout<Schema, LayoutProps>;
|
|
27
17
|
headName: string;
|
|
28
|
-
layoutProps?:
|
|
18
|
+
layoutProps?: Partial<LayoutProps>;
|
|
29
19
|
mode: SchemaRendererMode;
|
|
30
|
-
props:
|
|
20
|
+
props: Partial<Props>;
|
|
31
21
|
schema: Schema;
|
|
32
22
|
schemaPath: string;
|
|
33
23
|
}
|
|
@@ -1,25 +1,32 @@
|
|
|
1
1
|
import type { JsonSchemaType, NodeType } from '../constants';
|
|
2
|
-
import type {
|
|
2
|
+
import type { NodeEntity, NodeLayout } from './components';
|
|
3
3
|
import type { ErrorMessages, Validator } from './validation';
|
|
4
4
|
import type { ArrayValue, FieldValue, ObjectValue } from './values';
|
|
5
5
|
interface NodeParameters<Type extends NodeType, Schema extends JsonSchema> {
|
|
6
6
|
nodeParameters?: {
|
|
7
7
|
entity?: string | NodeEntity<Schema>;
|
|
8
|
-
entityProps?:
|
|
8
|
+
entityProps?: Record<string, any>;
|
|
9
9
|
errorMessages?: Omit<ErrorMessages, 'dependencies' | 'required'> & {
|
|
10
10
|
dependencies?: ErrorMessages['dependencies'] | Record<string, ErrorMessages['dependencies']>;
|
|
11
11
|
required?: ErrorMessages['required'] | Record<string, ErrorMessages['required']>;
|
|
12
12
|
};
|
|
13
|
+
flags?: {
|
|
14
|
+
copy?: boolean;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
hidden?: boolean;
|
|
17
|
+
open?: boolean;
|
|
18
|
+
required?: boolean;
|
|
19
|
+
};
|
|
13
20
|
formEntity?: string | NodeEntity<Schema>;
|
|
14
|
-
formEntityProps?:
|
|
21
|
+
formEntityProps?: Record<string, any>;
|
|
15
22
|
formLayout?: string | NodeLayout<Schema>;
|
|
16
|
-
formLayoutProps?:
|
|
23
|
+
formLayoutProps?: Record<string, any>;
|
|
17
24
|
layout?: string | NodeLayout<Schema>;
|
|
18
|
-
layoutProps?:
|
|
25
|
+
layoutProps?: Record<string, any>;
|
|
19
26
|
overviewEntity?: string | NodeEntity<Schema>;
|
|
20
|
-
overviewEntityProps?:
|
|
27
|
+
overviewEntityProps?: Record<string, any>;
|
|
21
28
|
overviewLayout?: string | NodeLayout<Schema>;
|
|
22
|
-
overviewLayoutProps?:
|
|
29
|
+
overviewLayoutProps?: Record<string, any>;
|
|
23
30
|
type?: Type;
|
|
24
31
|
validator?: string | Validator<Schema>;
|
|
25
32
|
};
|
|
@@ -29,6 +29,9 @@ export interface SchemaRendererState<UserContext extends Record<string, unknown>
|
|
|
29
29
|
unsubscribe: (id: string) => void;
|
|
30
30
|
userContext: {
|
|
31
31
|
MonacoEditor?: React.ComponentType<MonacoEditorProps>;
|
|
32
|
+
RenderHTMLOrMD?: React.ComponentType<{
|
|
33
|
+
content: string;
|
|
34
|
+
}>;
|
|
32
35
|
} & UserContext;
|
|
33
36
|
waiters: Record<string, ValidationWaiter | undefined>;
|
|
34
37
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { NodeType } from '../constants';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ErrorMessages, NodeEntity, NodeLayout, NodesConfig, Validator } from '../types';
|
|
3
3
|
import type { EntityKind, ExtractNodeEntityProps, ExtractNodeLayoutProps, LayoutKind, NodeComponentProps, NodeTypeConfigKey, SchemaOfNodeType } from '../types/helpers';
|
|
4
4
|
export declare const defineNodeEntityConfig: <Component extends NodeEntity<any>>(nodeEntityConfig: {
|
|
5
5
|
Component: Component;
|
|
@@ -20,39 +20,53 @@ export declare const defineNodeLayoutConfig: <Component extends NodeLayout<any>>
|
|
|
20
20
|
export declare const createNodeParametersDefiner: <Config extends NodesConfig>(_config: Config) => <Type extends NodeType, const Entity extends NodeTypeConfigKey<Config, Type, "formEntities"> | NodeTypeConfigKey<Config, Type, "overviewEntities"> | NodeEntity<SchemaOfNodeType<Type>> | undefined = undefined, const FormEntity extends NodeTypeConfigKey<Config, Type, "formEntities"> | NodeEntity<SchemaOfNodeType<Type>> | undefined = undefined, const OverviewEntity extends NodeTypeConfigKey<Config, Type, "overviewEntities"> | NodeEntity<SchemaOfNodeType<Type>> | undefined = undefined, const Layout extends NodeTypeConfigKey<Config, Type, "formLayouts"> | NodeTypeConfigKey<Config, Type, "overviewLayouts"> | NodeLayout<SchemaOfNodeType<Type>> | undefined = undefined, const FormLayout extends NodeTypeConfigKey<Config, Type, "formLayouts"> | NodeLayout<SchemaOfNodeType<Type>> | undefined = undefined, const OverviewLayout extends NodeTypeConfigKey<Config, Type, "overviewLayouts"> | NodeLayout<SchemaOfNodeType<Type>> | undefined = undefined, const ValidatorRef extends NodeTypeConfigKey<Config, Type, "validators"> | Validator<SchemaOfNodeType<Type>> | undefined = undefined>(nodeParameters: {
|
|
21
21
|
type: Type;
|
|
22
22
|
entity?: NoInfer<NodeTypeConfigKey<Config, Type, "formEntities">> | NoInfer<NodeTypeConfigKey<Config, Type, "overviewEntities">> | NodeEntity<SchemaOfNodeType<Type>> | Entity;
|
|
23
|
-
entityProps?:
|
|
23
|
+
entityProps?: NodeComponentProps<Config, Type, EntityKind, Entity>;
|
|
24
24
|
formEntity?: NoInfer<NodeTypeConfigKey<Config, Type, "formEntities">> | NodeEntity<SchemaOfNodeType<Type>> | FormEntity;
|
|
25
|
-
formEntityProps?:
|
|
25
|
+
formEntityProps?: NodeComponentProps<Config, Type, "formEntities", FormEntity>;
|
|
26
26
|
overviewEntity?: NoInfer<NodeTypeConfigKey<Config, Type, "overviewEntities">> | NodeEntity<SchemaOfNodeType<Type>> | OverviewEntity;
|
|
27
|
-
overviewEntityProps?:
|
|
27
|
+
overviewEntityProps?: NodeComponentProps<Config, Type, "overviewEntities", OverviewEntity>;
|
|
28
28
|
layout?: NoInfer<NodeTypeConfigKey<Config, Type, "formLayouts">> | NoInfer<NodeTypeConfigKey<Config, Type, "overviewLayouts">> | NodeLayout<SchemaOfNodeType<Type>> | Layout;
|
|
29
|
-
layoutProps?:
|
|
29
|
+
layoutProps?: NodeComponentProps<Config, Type, LayoutKind, Layout>;
|
|
30
30
|
formLayout?: NoInfer<NodeTypeConfigKey<Config, Type, "formLayouts">> | NodeLayout<SchemaOfNodeType<Type>> | FormLayout;
|
|
31
|
-
formLayoutProps?:
|
|
31
|
+
formLayoutProps?: NodeComponentProps<Config, Type, "formLayouts", FormLayout>;
|
|
32
32
|
overviewLayout?: NoInfer<NodeTypeConfigKey<Config, Type, "overviewLayouts">> | NodeLayout<SchemaOfNodeType<Type>> | OverviewLayout;
|
|
33
|
-
overviewLayoutProps?:
|
|
33
|
+
overviewLayoutProps?: NodeComponentProps<Config, Type, "overviewLayouts", OverviewLayout>;
|
|
34
34
|
errorMessages?: Omit<ErrorMessages, "dependencies" | "required"> & {
|
|
35
35
|
dependencies?: ErrorMessages["dependencies"] | Record<string, ErrorMessages["dependencies"]>;
|
|
36
36
|
required?: ErrorMessages["required"] | Record<string, ErrorMessages["required"]>;
|
|
37
37
|
};
|
|
38
38
|
validator?: NoInfer<NodeTypeConfigKey<Config, Type, "validators">> | Validator<SchemaOfNodeType<Type>> | ValidatorRef;
|
|
39
|
+
flags?: {
|
|
40
|
+
disabled?: boolean;
|
|
41
|
+
copy?: boolean;
|
|
42
|
+
hidden?: boolean;
|
|
43
|
+
open?: boolean;
|
|
44
|
+
required?: boolean;
|
|
45
|
+
};
|
|
39
46
|
}) => {
|
|
40
47
|
type: Type;
|
|
41
48
|
entity?: NoInfer<NodeTypeConfigKey<Config, Type, "formEntities">> | NoInfer<NodeTypeConfigKey<Config, Type, "overviewEntities">> | NodeEntity<SchemaOfNodeType<Type>> | Entity;
|
|
42
|
-
entityProps?:
|
|
49
|
+
entityProps?: NodeComponentProps<Config, Type, EntityKind, Entity>;
|
|
43
50
|
formEntity?: NoInfer<NodeTypeConfigKey<Config, Type, "formEntities">> | NodeEntity<SchemaOfNodeType<Type>> | FormEntity;
|
|
44
|
-
formEntityProps?:
|
|
51
|
+
formEntityProps?: NodeComponentProps<Config, Type, "formEntities", FormEntity>;
|
|
45
52
|
overviewEntity?: NoInfer<NodeTypeConfigKey<Config, Type, "overviewEntities">> | NodeEntity<SchemaOfNodeType<Type>> | OverviewEntity;
|
|
46
|
-
overviewEntityProps?:
|
|
53
|
+
overviewEntityProps?: NodeComponentProps<Config, Type, "overviewEntities", OverviewEntity>;
|
|
47
54
|
layout?: NoInfer<NodeTypeConfigKey<Config, Type, "formLayouts">> | NoInfer<NodeTypeConfigKey<Config, Type, "overviewLayouts">> | NodeLayout<SchemaOfNodeType<Type>> | Layout;
|
|
48
|
-
layoutProps?:
|
|
55
|
+
layoutProps?: NodeComponentProps<Config, Type, LayoutKind, Layout>;
|
|
49
56
|
formLayout?: NoInfer<NodeTypeConfigKey<Config, Type, "formLayouts">> | NodeLayout<SchemaOfNodeType<Type>> | FormLayout;
|
|
50
|
-
formLayoutProps?:
|
|
57
|
+
formLayoutProps?: NodeComponentProps<Config, Type, "formLayouts", FormLayout>;
|
|
51
58
|
overviewLayout?: NoInfer<NodeTypeConfigKey<Config, Type, "overviewLayouts">> | NodeLayout<SchemaOfNodeType<Type>> | OverviewLayout;
|
|
52
|
-
overviewLayoutProps?:
|
|
59
|
+
overviewLayoutProps?: NodeComponentProps<Config, Type, "overviewLayouts", OverviewLayout>;
|
|
53
60
|
errorMessages?: Omit<ErrorMessages, "dependencies" | "required"> & {
|
|
54
61
|
dependencies?: ErrorMessages["dependencies"] | Record<string, ErrorMessages["dependencies"]>;
|
|
55
62
|
required?: ErrorMessages["required"] | Record<string, ErrorMessages["required"]>;
|
|
56
63
|
};
|
|
57
64
|
validator?: NoInfer<NodeTypeConfigKey<Config, Type, "validators">> | Validator<SchemaOfNodeType<Type>> | ValidatorRef;
|
|
65
|
+
flags?: {
|
|
66
|
+
disabled?: boolean;
|
|
67
|
+
copy?: boolean;
|
|
68
|
+
hidden?: boolean;
|
|
69
|
+
open?: boolean;
|
|
70
|
+
required?: boolean;
|
|
71
|
+
};
|
|
58
72
|
};
|
|
@@ -4,8 +4,18 @@ exports.HTMLContent = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
6
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
7
|
+
const core_1 = require("../../../core");
|
|
7
8
|
const HTMLContent = (_a) => {
|
|
8
|
-
var
|
|
9
|
-
|
|
9
|
+
var _b;
|
|
10
|
+
var { content, headName = '___stub-name' } = _a, restProps = tslib_1.__rest(_a, ["content", "headName"]);
|
|
11
|
+
const state = (0, core_1.useSchemaRendererState)({
|
|
12
|
+
headName,
|
|
13
|
+
subscriptions: [core_1.SchemaRendererEventType.UserContext],
|
|
14
|
+
});
|
|
15
|
+
const RenderHTMLOrMD = (_b = state === null || state === void 0 ? void 0 : state.userContext) === null || _b === void 0 ? void 0 : _b.RenderHTMLOrMD;
|
|
16
|
+
if (RenderHTMLOrMD) {
|
|
17
|
+
return react_1.default.createElement(RenderHTMLOrMD, { content: content });
|
|
18
|
+
}
|
|
19
|
+
return react_1.default.createElement(uikit_1.Text, Object.assign({}, restProps, { dangerouslySetInnerHTML: { __html: content } }));
|
|
10
20
|
};
|
|
11
21
|
exports.HTMLContent = HTMLContent;
|
|
@@ -7,7 +7,7 @@ const uikit_1 = require("@gravity-ui/uikit");
|
|
|
7
7
|
const utils_1 = require("../../utils");
|
|
8
8
|
const b = (0, utils_1.block)('layout-container');
|
|
9
9
|
const LayoutContainer = (_a) => {
|
|
10
|
-
var { className, children, hideEmpty = false } = _a, restProps = tslib_1.__rest(_a, ["className", "children", "hideEmpty"]);
|
|
11
|
-
return (react_1.default.createElement(uikit_1.Flex, Object.assign({ className: b({ 'hide-empty': hideEmpty }, className), direction: "column" }, restProps), children));
|
|
10
|
+
var { className, children, hideEmpty = false, hidden = false } = _a, restProps = tslib_1.__rest(_a, ["className", "children", "hideEmpty", "hidden"]);
|
|
11
|
+
return (react_1.default.createElement(uikit_1.Flex, Object.assign({ className: b({ 'hide-empty': hideEmpty, hidden }, className), direction: "column" }, restProps), children));
|
|
12
12
|
};
|
|
13
13
|
exports.LayoutContainer = LayoutContainer;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
.sr-alert .g-alert__text-content > div {
|
|
2
|
+
gap: 0 !important;
|
|
3
|
+
}
|
|
4
|
+
.sr-alert_expanded .g-alert__text-content > div {
|
|
5
|
+
gap: calc(var(--g-spacing-base) * 2) !important;
|
|
6
|
+
}
|
|
7
|
+
.sr-alert__title {
|
|
8
|
+
cursor: pointer;
|
|
9
|
+
}
|
|
10
|
+
.sr-alert__message {
|
|
11
|
+
height: 0;
|
|
12
|
+
overflow: hidden;
|
|
13
|
+
}
|
|
14
|
+
.sr-alert__message_expanded {
|
|
15
|
+
height: unset;
|
|
16
|
+
}
|
|
@@ -6,22 +6,41 @@ const react_1 = tslib_1.__importDefault(require("react"));
|
|
|
6
6
|
const icons = tslib_1.__importStar(require("@gravity-ui/icons"));
|
|
7
7
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
8
8
|
const components_1 = require("../../components");
|
|
9
|
-
const
|
|
10
|
-
|
|
9
|
+
const utils_1 = require("../../utils");
|
|
10
|
+
const b = (0, utils_1.block)('alert');
|
|
11
|
+
const Alert = ({ headName, props, schema }) => {
|
|
12
|
+
var _a;
|
|
13
|
+
const { iconName, iconProps, message, title: titleProp } = props, entityRestProps = tslib_1.__rest(props, ["iconName", "iconProps", "message", "title"]);
|
|
14
|
+
const { open = true } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
15
|
+
const [expanded, setExpanded] = react_1.default.useState(open);
|
|
11
16
|
const icon = react_1.default.useMemo(() => iconName && icons[iconName] ? (react_1.default.createElement(uikit_1.Icon, Object.assign({ data: icons[iconName] }, iconProps))) : undefined, [iconName, iconProps]);
|
|
17
|
+
const title = react_1.default.useMemo(() => {
|
|
18
|
+
if (titleProp && typeof titleProp !== 'string') {
|
|
19
|
+
return titleProp;
|
|
20
|
+
}
|
|
21
|
+
const title = typeof titleProp === 'string' ? titleProp : schema.title;
|
|
22
|
+
if (title) {
|
|
23
|
+
return (react_1.default.createElement(uikit_1.Flex, { className: b('title'), alignItems: "center", gap: "2", onClick: () => setExpanded(!expanded) },
|
|
24
|
+
react_1.default.createElement(components_1.HTMLContent, { content: title, headName: headName, variant: "subheader-2" }),
|
|
25
|
+
react_1.default.createElement(uikit_1.Icon, { data: expanded ? icons.ChevronUp : icons.ChevronDown, size: 16 })));
|
|
26
|
+
}
|
|
27
|
+
return null;
|
|
28
|
+
}, [headName, schema.title, titleProp, expanded]);
|
|
12
29
|
const msg = react_1.default.useMemo(() => {
|
|
13
30
|
if (message) {
|
|
14
31
|
if (typeof message === 'string') {
|
|
15
|
-
return react_1.default.createElement("
|
|
32
|
+
return (react_1.default.createElement("div", { className: b('message', { expanded }) },
|
|
33
|
+
react_1.default.createElement(components_1.HTMLContent, { content: message, headName: headName })));
|
|
16
34
|
}
|
|
17
35
|
return message;
|
|
18
36
|
}
|
|
19
37
|
if (schema.description) {
|
|
20
|
-
return react_1.default.createElement("
|
|
38
|
+
return (react_1.default.createElement("div", { className: b('message', { expanded }) },
|
|
39
|
+
react_1.default.createElement(components_1.HTMLContent, { content: schema.description, headName: headName })));
|
|
21
40
|
}
|
|
22
41
|
return undefined;
|
|
23
|
-
}, [message, schema.description]);
|
|
24
|
-
return (react_1.default.createElement(components_1.EntityContainer, { stretch: "fit", fill: "populated" },
|
|
25
|
-
react_1.default.createElement(uikit_1.Alert, Object.assign({ icon: icon, message: msg }, entityRestProps))));
|
|
42
|
+
}, [expanded, headName, message, schema.description]);
|
|
43
|
+
return (react_1.default.createElement(components_1.EntityContainer, { className: b({ expanded }), stretch: "fit", fill: "populated" },
|
|
44
|
+
react_1.default.createElement(uikit_1.Alert, Object.assign({ icon: icon, message: msg, title: title }, entityRestProps))));
|
|
26
45
|
};
|
|
27
46
|
exports.Alert = Alert;
|
|
@@ -10,7 +10,9 @@ const components_1 = require("../../components");
|
|
|
10
10
|
const utils_1 = require("../../utils");
|
|
11
11
|
const b = (0, utils_1.block)('array-entity');
|
|
12
12
|
const ArrayEntity = ({ headName, input, mode, props, schema, schemaPath, }) => {
|
|
13
|
+
var _a;
|
|
13
14
|
const { name, onBlur, onChange, onFocus, value } = input;
|
|
15
|
+
const { disabled } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
14
16
|
const overviewFlag = mode === core_1.SchemaRendererMode.Overview;
|
|
15
17
|
const addButton = react_1.default.useMemo(() => {
|
|
16
18
|
const itemsSchema = schema.items;
|
|
@@ -22,12 +24,12 @@ const ArrayEntity = ({ headName, input, mode, props, schema, schemaPath, }) => {
|
|
|
22
24
|
onChange([...(value || []), itemsSchema === null || itemsSchema === void 0 ? void 0 : itemsSchema.default]);
|
|
23
25
|
onBlur();
|
|
24
26
|
};
|
|
25
|
-
return (react_1.default.createElement(uikit_1.Button, { className: b('add-button'), onClick: onClick, disabled:
|
|
27
|
+
return (react_1.default.createElement(uikit_1.Button, { className: b('add-button'), onClick: onClick, disabled: disabled || schema.readOnly, qa: `${name}-add-button` },
|
|
26
28
|
react_1.default.createElement(uikit_1.Icon, { data: icons_1.Plus, size: 14 }),
|
|
27
29
|
props.addButtonText || null));
|
|
28
30
|
}, [
|
|
29
31
|
props.addButtonText,
|
|
30
|
-
|
|
32
|
+
disabled,
|
|
31
33
|
name,
|
|
32
34
|
onBlur,
|
|
33
35
|
onChange,
|
|
@@ -10,7 +10,9 @@ const components_1 = require("../../components");
|
|
|
10
10
|
const utils_1 = require("../../utils");
|
|
11
11
|
const b = (0, utils_1.block)('array-table');
|
|
12
12
|
const ArrayTable = ({ headName, input, mode, props, schema, schemaPath, }) => {
|
|
13
|
+
var _a;
|
|
13
14
|
const { name, onBlur, onChange, onFocus, value } = input;
|
|
15
|
+
const { disabled } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
14
16
|
const overviewFlag = mode === core_1.SchemaRendererMode.Overview;
|
|
15
17
|
const addButton = react_1.default.useMemo(() => {
|
|
16
18
|
const itemsSchema = schema.items;
|
|
@@ -22,12 +24,12 @@ const ArrayTable = ({ headName, input, mode, props, schema, schemaPath, }) => {
|
|
|
22
24
|
onChange([...(value || []), itemsSchema === null || itemsSchema === void 0 ? void 0 : itemsSchema.default]);
|
|
23
25
|
onBlur();
|
|
24
26
|
};
|
|
25
|
-
return (react_1.default.createElement(uikit_1.Button, { className: b('add-button'), onClick: onClick, disabled:
|
|
27
|
+
return (react_1.default.createElement(uikit_1.Button, { className: b('add-button'), onClick: onClick, disabled: disabled || schema.readOnly, qa: `${name}-add-button` },
|
|
26
28
|
react_1.default.createElement(uikit_1.Icon, { data: icons_1.Plus, size: 14 }),
|
|
27
29
|
props.addButtonText || null));
|
|
28
30
|
}, [
|
|
29
31
|
props.addButtonText,
|
|
30
|
-
|
|
32
|
+
disabled,
|
|
31
33
|
name,
|
|
32
34
|
onBlur,
|
|
33
35
|
onChange,
|
|
@@ -79,7 +81,7 @@ const ArrayTable = ({ headName, input, mode, props, schema, schemaPath, }) => {
|
|
|
79
81
|
react_1.default.createElement("div", { className: b('column-title') }, (_a = column.schema.title) === null || _a === void 0 ? void 0 : _a.split(' ').map((word, wIndex, array) => (react_1.default.createElement("div", { className: b('column-title-word'), key: word },
|
|
80
82
|
react_1.default.createElement(uikit_1.Text, { variant: "subheader-1" }, word),
|
|
81
83
|
wIndex + 1 === array.length && column.schema.description ? (react_1.default.createElement(uikit_1.HelpMark, null,
|
|
82
|
-
react_1.default.createElement(components_1.HTMLContent, {
|
|
84
|
+
react_1.default.createElement(components_1.HTMLContent, { content: column.schema.description, headName: headName }))) : null))))));
|
|
83
85
|
})));
|
|
84
86
|
const rows = new Array(rowsCount).fill(null).map((_, rIndex) => (react_1.default.createElement("div", { className: b('row', { 'with-remove-button': withRemoveButton }), style: { '--columns-count': columns.length }, key: rIndex },
|
|
85
87
|
react_1.default.createElement("div", { className: b('cell') },
|
|
@@ -7,7 +7,7 @@ const icons = tslib_1.__importStar(require("@gravity-ui/icons"));
|
|
|
7
7
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
8
8
|
const core_1 = require("../../../core");
|
|
9
9
|
const components_1 = require("../../components");
|
|
10
|
-
const Label = ({ input, mode, props, schema }) => {
|
|
10
|
+
const Label = ({ headName, input, mode, props, schema, }) => {
|
|
11
11
|
const { value } = input;
|
|
12
12
|
const { iconName, iconProps, title } = props, restEntityProps = tslib_1.__rest(props, ["iconName", "iconProps", "title"]);
|
|
13
13
|
const overviewFlag = mode === core_1.SchemaRendererMode.Overview;
|
|
@@ -15,15 +15,15 @@ const Label = ({ input, mode, props, schema }) => {
|
|
|
15
15
|
const content = react_1.default.useMemo(() => {
|
|
16
16
|
if (title) {
|
|
17
17
|
if (typeof title === 'string') {
|
|
18
|
-
return react_1.default.createElement(
|
|
18
|
+
return react_1.default.createElement(components_1.HTMLContent, { content: title, headName: headName });
|
|
19
19
|
}
|
|
20
20
|
return title;
|
|
21
21
|
}
|
|
22
22
|
if (schema.description) {
|
|
23
|
-
return react_1.default.createElement(
|
|
23
|
+
return react_1.default.createElement(components_1.HTMLContent, { content: schema.description, headName: headName });
|
|
24
24
|
}
|
|
25
25
|
return undefined;
|
|
26
|
-
}, [title, schema.description]);
|
|
26
|
+
}, [headName, title, schema.description]);
|
|
27
27
|
return (react_1.default.createElement(components_1.EntityContainer, { stretch: "fit", fill: "populated" },
|
|
28
28
|
react_1.default.createElement(uikit_1.Label, Object.assign({ size: overviewFlag ? 'xs' : 'm', value: value, icon: icon }, restEntityProps), content)));
|
|
29
29
|
};
|
|
@@ -9,7 +9,9 @@ const components_1 = require("../../components");
|
|
|
9
9
|
const utils_1 = require("../../utils");
|
|
10
10
|
const b = (0, utils_1.block)('monaco');
|
|
11
11
|
const Monaco = ({ headName, input, meta, mode, props, schema, }) => {
|
|
12
|
+
var _a;
|
|
12
13
|
const { name, onBlur, onChange, onFocus, value } = input;
|
|
14
|
+
const { disabled } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
13
15
|
const overviewFlag = mode === core_1.SchemaRendererMode.Overview;
|
|
14
16
|
const { language = 'plaintext', options: optionsProps, withDialog = true, ignoreMonacoErrors = false, width = '100%', height = 350 } = props, restEntityProps = tslib_1.__rest(props, ["language", "options", "withDialog", "ignoreMonacoErrors", "width", "height"]);
|
|
15
17
|
const srState = (0, core_1.useSchemaRendererState)({
|
|
@@ -22,7 +24,7 @@ const Monaco = ({ headName, input, meta, mode, props, schema, }) => {
|
|
|
22
24
|
const innerErrorRef = react_1.default.useRef(null);
|
|
23
25
|
const [dialogOpen, setDialogOpen] = react_1.default.useState(false);
|
|
24
26
|
const toggleDialogOpen = react_1.default.useCallback(() => setDialogOpen((f) => !f), []);
|
|
25
|
-
const options = react_1.default.useMemo(() => (Object.assign({ fontSize: 12, readOnly: overviewFlag || schema.readOnly, formatOnPaste: true, formatOnType: true, contextmenu: false, minimap: { enabled: false }, autoClosingBrackets: 'languageDefined', automaticLayout: true }, optionsProps)), [optionsProps, overviewFlag, schema.readOnly]);
|
|
27
|
+
const options = react_1.default.useMemo(() => (Object.assign({ fontSize: 12, readOnly: overviewFlag || disabled || schema.readOnly, formatOnPaste: true, formatOnType: true, contextmenu: false, minimap: { enabled: false }, autoClosingBrackets: 'languageDefined', automaticLayout: true }, optionsProps)), [disabled, optionsProps, overviewFlag, schema.readOnly]);
|
|
26
28
|
const onUpdate = react_1.default.useCallback((value) => {
|
|
27
29
|
onFocus();
|
|
28
30
|
onChange(value);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type JsonSchemaObject, type NodeEntity } from '../../../core';
|
|
2
2
|
export interface ObjectInlineProps {
|
|
3
3
|
delimiter?: string | Record<string, string>;
|
|
4
|
-
disabled?: boolean;
|
|
5
4
|
order?: string[];
|
|
6
5
|
}
|
|
7
6
|
export declare const ObjectInline: NodeEntity<JsonSchemaObject, ObjectInlineProps>;
|
|
@@ -9,22 +9,22 @@ const core_1 = require("../../../core");
|
|
|
9
9
|
const components_1 = require("../../components");
|
|
10
10
|
const utils_1 = require("../../utils");
|
|
11
11
|
const b = (0, utils_1.block)('text-content');
|
|
12
|
-
const TextContent = ({ input, mode, props, schema, }) => {
|
|
12
|
+
const TextContent = ({ headName, input, mode, props, schema, }) => {
|
|
13
13
|
const { className, iconName, iconProps, title: titleProp } = props, restEntityProps = tslib_1.__rest(props, ["className", "iconName", "iconProps", "title"]);
|
|
14
14
|
const overviewFlag = mode === core_1.SchemaRendererMode.Overview;
|
|
15
15
|
const icon = react_1.default.useMemo(() => iconName && icons[iconName] ? (react_1.default.createElement(uikit_1.Icon, Object.assign({ data: icons[iconName] }, iconProps))) : undefined, [iconName, iconProps]);
|
|
16
16
|
const content = react_1.default.useMemo(() => {
|
|
17
17
|
if (titleProp) {
|
|
18
18
|
if (typeof titleProp === 'string') {
|
|
19
|
-
return react_1.default.createElement(
|
|
19
|
+
return react_1.default.createElement(components_1.HTMLContent, { content: titleProp, headName: headName });
|
|
20
20
|
}
|
|
21
21
|
return titleProp;
|
|
22
22
|
}
|
|
23
23
|
if (schema.description) {
|
|
24
|
-
return react_1.default.createElement(
|
|
24
|
+
return react_1.default.createElement(components_1.HTMLContent, { content: schema.description, headName: headName });
|
|
25
25
|
}
|
|
26
26
|
return undefined;
|
|
27
|
-
}, [titleProp, schema.description]);
|
|
27
|
+
}, [headName, titleProp, schema.description]);
|
|
28
28
|
return (react_1.default.createElement(components_1.EntityContainer, { stretch: "fit", fill: "populated" },
|
|
29
29
|
react_1.default.createElement(uikit_1.Label, Object.assign({ size: overviewFlag ? 'xs' : 'm', value: input.value, icon: icon, className: b(null, className) }, restEntityProps, { theme: "clear" }), content)));
|
|
30
30
|
};
|
|
@@ -3,6 +3,5 @@ export interface CheckboxGroupInputProps {
|
|
|
3
3
|
enumDescriptions?: Record<string, string>;
|
|
4
4
|
optionsDisabled?: Record<string, boolean>;
|
|
5
5
|
direction?: 'row' | 'column';
|
|
6
|
-
disabled?: boolean;
|
|
7
6
|
}
|
|
8
7
|
export declare const CheckboxGroupInput: NodeEntity<JsonSchemaArray, CheckboxGroupInputProps>;
|
|
@@ -8,8 +8,10 @@ const components_1 = require("../../components");
|
|
|
8
8
|
const utils_1 = require("../../utils");
|
|
9
9
|
const b = (0, utils_1.block)('checkbox-group-input');
|
|
10
10
|
const CheckboxGroupInput = ({ input, props, meta, schema, }) => {
|
|
11
|
+
var _a;
|
|
11
12
|
const { name, onBlur, onChange, onFocus, value: inputValue } = input;
|
|
12
|
-
const { enumDescriptions, direction = 'row',
|
|
13
|
+
const { enumDescriptions, direction = 'row', optionsDisabled } = props;
|
|
14
|
+
const { disabled } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
13
15
|
const value = react_1.default.useMemo(() => (Array.isArray(inputValue) ? inputValue : []), [inputValue]);
|
|
14
16
|
const options = react_1.default.useMemo(() => {
|
|
15
17
|
var _a, _b;
|
|
@@ -8,13 +8,15 @@ const components_1 = require("../../components");
|
|
|
8
8
|
const utils_1 = require("../../utils");
|
|
9
9
|
const b = (0, utils_1.block)('checkbox-input');
|
|
10
10
|
const CheckboxInput = ({ input, props, meta, schema, }) => {
|
|
11
|
+
var _a;
|
|
11
12
|
const { name, onBlur, onChange, onFocus, value } = input;
|
|
13
|
+
const { disabled } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
12
14
|
const onUpdate = react_1.default.useCallback((value) => {
|
|
13
15
|
onFocus();
|
|
14
16
|
onChange(value);
|
|
15
17
|
onBlur();
|
|
16
18
|
}, [onBlur, onChange, onFocus]);
|
|
17
19
|
return (react_1.default.createElement(components_1.EntityContainer, { stretch: "fit", className: b({ error: (0, utils_1.getBooleanValidationState)(meta) }) },
|
|
18
|
-
react_1.default.createElement(uikit_1.Checkbox, Object.assign({ disabled: schema.readOnly }, props, { checked: value !== null && value !== void 0 ? value : false, onFocus: onFocus, onBlur: onBlur, onUpdate: onUpdate, qa: name }))));
|
|
20
|
+
react_1.default.createElement(uikit_1.Checkbox, Object.assign({ disabled: disabled || schema.readOnly }, props, { checked: value !== null && value !== void 0 ? value : false, onFocus: onFocus, onBlur: onBlur, onUpdate: onUpdate, qa: name }))));
|
|
19
21
|
};
|
|
20
22
|
exports.CheckboxInput = CheckboxInput;
|
|
@@ -8,8 +8,10 @@ const components_1 = require("../../components");
|
|
|
8
8
|
const utils_1 = require("../../utils");
|
|
9
9
|
const b = (0, utils_1.block)('color-picker-input');
|
|
10
10
|
const ColorPickerInput = ({ input, props, meta, schema, }) => {
|
|
11
|
+
var _a;
|
|
11
12
|
const { name, onBlur, onChange, onFocus, value } = input;
|
|
12
13
|
const { onOpenChange: onOpenChangeProps } = props, restEntityProps = tslib_1.__rest(props, ["onOpenChange"]);
|
|
14
|
+
const { disabled } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
13
15
|
const onOpenChange = react_1.default.useCallback((open) => {
|
|
14
16
|
onOpenChangeProps === null || onOpenChangeProps === void 0 ? void 0 : onOpenChangeProps(open);
|
|
15
17
|
if (open) {
|
|
@@ -20,6 +22,6 @@ const ColorPickerInput = ({ input, props, meta, schema, }) => {
|
|
|
20
22
|
}
|
|
21
23
|
}, [onBlur, onFocus, onOpenChangeProps]);
|
|
22
24
|
return (react_1.default.createElement(components_1.EntityContainer, { stretch: "max", className: b({ error: (0, utils_1.getBooleanValidationState)(meta) }) },
|
|
23
|
-
react_1.default.createElement(unstable_1.unstable_ColorPicker, Object.assign({ disabled: schema.readOnly }, restEntityProps, { value: value !== null && value !== void 0 ? value : '', onUpdate: onChange, onOpenChange: onOpenChange, "data-qa": name }))));
|
|
25
|
+
react_1.default.createElement(unstable_1.unstable_ColorPicker, Object.assign({ disabled: disabled || schema.readOnly }, restEntityProps, { value: value !== null && value !== void 0 ? value : '', onUpdate: onChange, onOpenChange: onOpenChange, "data-qa": name }))));
|
|
24
26
|
};
|
|
25
27
|
exports.ColorPickerInput = ColorPickerInput;
|
|
@@ -10,9 +10,10 @@ const constants_1 = require("../../constants");
|
|
|
10
10
|
const utils_1 = require("../../utils");
|
|
11
11
|
const b = (0, utils_1.block)('date-input');
|
|
12
12
|
const DateInput = ({ input, meta, props, schema, }) => {
|
|
13
|
-
var _a;
|
|
13
|
+
var _a, _b;
|
|
14
14
|
const { name, onBlur, onChange, onFocus, value: inputValue } = input;
|
|
15
15
|
const { format = constants_1.DEFAULT_DATE_FORMAT, outputFormat, timeZone: timeZoneProp } = props, restEntityProps = tslib_1.__rest(props, ["format", "outputFormat", "timeZone"]);
|
|
16
|
+
const { disabled } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
16
17
|
const timeZone = timeZoneProp && (0, date_utils_1.isValidTimeZone)(timeZoneProp) ? timeZoneProp : undefined;
|
|
17
18
|
const onUpdate = react_1.default.useCallback((date) => {
|
|
18
19
|
if (!date) {
|
|
@@ -42,6 +43,6 @@ const DateInput = ({ input, meta, props, schema, }) => {
|
|
|
42
43
|
}, [outputFormat, onChange]);
|
|
43
44
|
const value = react_1.default.useMemo(() => (0, utils_1.parseDate)(inputValue, outputFormat, timeZone), [inputValue, outputFormat, timeZone]);
|
|
44
45
|
return (react_1.default.createElement(components_1.EntityContainer, { stretch: "max", className: b({ error: (0, utils_1.getBooleanValidationState)(meta) }) },
|
|
45
|
-
react_1.default.createElement(date_components_1.DatePicker, Object.assign({ format: format, popupPlacement: "bottom-start", placeholder: `${((
|
|
46
|
+
react_1.default.createElement(date_components_1.DatePicker, Object.assign({ format: format, popupPlacement: "bottom-start", placeholder: `${((_b = schema.examples) === null || _b === void 0 ? void 0 : _b[0]) || ''}`, disabled: disabled || schema.readOnly, hasClear: true }, restEntityProps, { value: value, onFocus: onFocus, onBlur: onBlur, onUpdate: onUpdate, timeZone: timeZone, errorMessage: undefined, validationState: undefined, "data-qa": name }))));
|
|
46
47
|
};
|
|
47
48
|
exports.DateInput = DateInput;
|
|
@@ -9,8 +9,10 @@ const unstable_1 = require("@gravity-ui/uikit/unstable");
|
|
|
9
9
|
const components_1 = require("../../components");
|
|
10
10
|
const utils_1 = require("../../utils");
|
|
11
11
|
const FileInput = ({ input, meta, props, schema, }) => {
|
|
12
|
+
var _a;
|
|
12
13
|
const { onBlur, onChange, onFocus } = input;
|
|
13
14
|
const { readAsMethod = 'readAsBinaryString' } = props, restEntityProps = tslib_1.__rest(props, ["readAsMethod"]);
|
|
15
|
+
const { disabled } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
14
16
|
const counterRef = react_1.default.useRef(0);
|
|
15
17
|
const [file, setFile] = react_1.default.useState(null);
|
|
16
18
|
const actions = react_1.default.useMemo(() => [
|
|
@@ -48,6 +50,6 @@ const FileInput = ({ input, meta, props, schema, }) => {
|
|
|
48
50
|
react_1.default.createElement(uikit_1.FilePreview, { file: file, actions: actions })));
|
|
49
51
|
}
|
|
50
52
|
return (react_1.default.createElement(components_1.EntityContainer, { stretch: "max" },
|
|
51
|
-
react_1.default.createElement(unstable_1.unstable_FileDropZone, Object.assign({ disabled: schema.readOnly, accept: [] }, restEntityProps, { onUpdate: onUpdate, errorMessage: undefined, validationState: (0, utils_1.getValidationState)(meta), multiple: false }))));
|
|
53
|
+
react_1.default.createElement(unstable_1.unstable_FileDropZone, Object.assign({ disabled: disabled || schema.readOnly, accept: [] }, restEntityProps, { onUpdate: onUpdate, errorMessage: undefined, validationState: (0, utils_1.getValidationState)(meta), multiple: false }))));
|
|
52
54
|
};
|
|
53
55
|
exports.FileInput = FileInput;
|