Skip to content

Commit

Permalink
Merge branch 'main' into playwright-fix-action-for-forks
Browse files Browse the repository at this point in the history
  • Loading branch information
NasgulNexus authored Feb 13, 2024
2 parents e1cf603 + 7d196eb commit c3d0e2c
Show file tree
Hide file tree
Showing 16 changed files with 339 additions and 94 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [3.6.0](https://github.com/gravity-ui/dynamic-forms/compare/v3.5.0...v3.6.0) (2024-02-02)


### Features

* added accordeon card to config ([#162](https://github.com/gravity-ui/dynamic-forms/issues/162)) ([ab23f6c](https://github.com/gravity-ui/dynamic-forms/commit/ab23f6ca3dd7277fdd2fb59a78c0f958f002bfd4))
* **spec:** add generic for InputProps and LayoutProps into Spec ([#164](https://github.com/gravity-ui/dynamic-forms/issues/164)) ([2b2ae90](https://github.com/gravity-ui/dynamic-forms/commit/2b2ae904388f7cc0b6b78eb8d7a7138ef03a6f8a))

## [3.5.0](https://github.com/gravity-ui/dynamic-forms/compare/v3.4.1...v3.5.0) (2024-01-25)


Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gravity-ui/dynamic-forms",
"version": "3.5.0",
"version": "3.6.0",
"description": "",
"license": "MIT",
"main": "build/cjs/index.js",
Expand Down
18 changes: 15 additions & 3 deletions src/lib/core/components/Form/Controller/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,18 +135,30 @@ export const getRender = <DirtyValue extends FieldValue, SpecType extends Spec>(
const render = (props: FieldRenderProps<DirtyValue>) => {
if (inputEntity && isCorrectSpec(spec) && _.isString(name)) {
if (!spec.viewSpec.hidden) {
const {layoutProps, inputProps} = spec.viewSpec;
if (inputEntity.independent) {
const InputComponent = inputEntity.Component;

return <InputComponent spec={spec} name={name} Layout={Layout} {...props} />;
return (
<InputComponent
spec={spec}
name={name}
Layout={Layout}
inputProps={inputProps}
layoutProps={layoutProps}
{...props}
/>
);
}

const InputComponent = inputEntity.Component;
const input = <InputComponent spec={spec} name={name} {...props} />;
const input = (
<InputComponent spec={spec} name={name} inputProps={inputProps} {...props} />
);

if (Layout) {
return (
<Layout spec={spec} name={name} {...props}>
<Layout spec={spec} name={name} layoutProps={layoutProps} {...props}>
{input}
</Layout>
);
Expand Down
38 changes: 32 additions & 6 deletions src/lib/core/components/Form/types/array.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,39 @@ import {
ValidatorsMap,
} from './';

export type ArrayInputProps = InputProps<FieldArrayValue, ArraySpec>;
export type ArrayIndependentInputProps = IndependentInputProps<FieldArrayValue, ArraySpec>;
export type ArrayLayoutProps = LayoutProps<FieldArrayValue, ArraySpec>;
export type ArrayInputProps<InputComponentProps extends Record<string, any> = {}> = InputProps<
FieldArrayValue,
ArraySpec<undefined, InputComponentProps>
>;
export type ArrayIndependentInputProps<
InputComponentProps extends Record<string, any> = {},
LayoutComponentProps extends Record<string, any> = {},
> = IndependentInputProps<
FieldArrayValue,
ArraySpec<undefined, InputComponentProps, LayoutComponentProps>
>;

export type ArrayLayoutProps<LayoutComponentProps extends Record<string, any> = {}> = LayoutProps<
FieldArrayValue,
ArraySpec<undefined, any, LayoutComponentProps>
>;

export type ArrayInput = InputType<FieldArrayValue, ArraySpec>;
export type ArrayIndependentInput = IndependentInputType<FieldArrayValue, ArraySpec>;
export type ArrayLayout = LayoutType<FieldArrayValue, ArraySpec>;
export type ArrayInput<InputComponentProps extends Record<string, any> = {}> = InputType<
FieldArrayValue,
ArraySpec<undefined, InputComponentProps>
>;
export type ArrayIndependentInput<
InputComponentProps extends Record<string, any> = {},
LayoutComponentProps extends Record<string, any> = {},
> = IndependentInputType<
FieldArrayValue,
ArraySpec<undefined, InputComponentProps, LayoutComponentProps>
>;

export type ArrayLayout<LayoutComponentProps extends Record<string, any> = {}> = LayoutType<
FieldArrayValue,
ArraySpec<undefined, any, LayoutComponentProps>
>;

export type ArrayInputEntity = InputEntity<FieldArrayValue, ArraySpec>;
export type ArrayIndependentInputEntity = IndependentInputEntity<FieldArrayValue, ArraySpec>;
Expand Down
40 changes: 34 additions & 6 deletions src/lib/core/components/Form/types/boolean.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,41 @@ import {
ValidatorsMap,
} from './';

export type BooleanInputProps = InputProps<boolean, BooleanSpec>;
export type BooleanIndependentInputProps = IndependentInputProps<boolean, BooleanSpec>;
export type BooleanLayoutProps = LayoutProps<boolean, BooleanSpec>;
export type BooleanInputProps<InputComponentProps extends Record<string, any> = {}> = InputProps<
boolean,
BooleanSpec<undefined, InputComponentProps>
>;

export type BooleanInput = InputType<boolean, BooleanSpec>;
export type BooleanIndependentInput = IndependentInputType<boolean, BooleanSpec>;
export type BooleanLayout = LayoutType<boolean, BooleanSpec>;
export type BooleanIndependentInputProps<
InputComponentProps extends Record<string, any> = {},
LayoutComponentProps extends Record<string, any> = {},
> = IndependentInputProps<
boolean,
BooleanSpec<undefined, InputComponentProps, LayoutComponentProps>
>;

export type BooleanLayoutProps<LayoutComponentProps extends Record<string, any> = {}> = LayoutProps<
boolean,
BooleanSpec<undefined, any, LayoutComponentProps>
>;

export type BooleanInput<InputComponentProps extends Record<string, any> = {}> = InputType<
boolean,
BooleanSpec<undefined, InputComponentProps>
>;

export type BooleanIndependentInput<
InputComponentProps extends Record<string, any> = {},
LayoutComponentProps extends Record<string, any> = {},
> = IndependentInputType<
boolean,
BooleanSpec<undefined, InputComponentProps, LayoutComponentProps>
>;

export type BooleanLayout<LayoutComponentProps extends Record<string, any> = {}> = LayoutType<
boolean,
BooleanSpec<undefined, any, LayoutComponentProps>
>;

export type BooleanInputEntity = InputEntity<boolean, BooleanSpec>;
export type BooleanIndependentInputEntity = IndependentInputEntity<boolean, BooleanSpec>;
Expand Down
2 changes: 2 additions & 0 deletions src/lib/core/components/Form/types/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ import {FieldRenderProps, FieldValue, LayoutType} from './';
export type InputProps<Value extends FieldValue, SpecType extends Spec> = {
spec: SpecType;
name: string;
inputProps?: SpecType['viewSpec']['inputProps'];
} & FieldRenderProps<Value>;

export type IndependentInputProps<Value extends FieldValue, SpecType extends Spec> = {
Layout: LayoutType<Value, SpecType> | undefined;
layoutProps?: SpecType['viewSpec']['layoutProps'];
} & InputProps<Value, SpecType>;

export type InputType<Value extends FieldValue, SpecType extends Spec> = (
Expand Down
1 change: 1 addition & 0 deletions src/lib/core/components/Form/types/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {FieldValue, InputProps} from './';

export type LayoutProps<Value extends FieldValue, SpecType extends Spec> = {
children: React.ReactElement;
layoutProps?: SpecType['viewSpec']['layoutProps'];
} & InputProps<Value, SpecType>;

export type LayoutType<Value extends FieldValue, SpecType extends Spec> = (
Expand Down
34 changes: 28 additions & 6 deletions src/lib/core/components/Form/types/number.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,35 @@ import {
ValidatorsMap,
} from './';

export type NumberInputProps = InputProps<number, NumberSpec>;
export type NumberIndependentInputProps = IndependentInputProps<number, NumberSpec>;
export type NumberLayoutProps = LayoutProps<number, NumberSpec>;
export type NumberInputProps<InputComponentProps extends Record<string, any> = {}> = InputProps<
number,
NumberSpec<undefined, InputComponentProps>
>;

export type NumberInput = InputType<number, NumberSpec>;
export type NumberIndependentInput = IndependentInputType<number, NumberSpec>;
export type NumberLayout = LayoutType<number, NumberSpec>;
export type NumberIndependentInputProps<
InputComponentProps extends Record<string, any> = {},
LayoutComponentProps extends Record<string, any> = {},
> = IndependentInputProps<number, NumberSpec<undefined, InputComponentProps, LayoutComponentProps>>;

export type NumberLayoutProps<LayoutComponentProps extends Record<string, any> = {}> = LayoutProps<
number,
NumberSpec<undefined, any, LayoutComponentProps>
>;

export type NumberInput<InputComponentProps extends Record<string, any> = {}> = InputType<
number,
NumberSpec<undefined, InputComponentProps>
>;

export type NumberIndependentInput<
InputComponentProps extends Record<string, any> = {},
LayoutComponentProps extends Record<string, any> = {},
> = IndependentInputType<number, NumberSpec<undefined, InputComponentProps, LayoutComponentProps>>;

export type NumberLayout<LayoutComponentProps extends Record<string, any> = {}> = LayoutType<
number,
NumberSpec<undefined, any, LayoutComponentProps>
>;

export type NumberInputEntity = InputEntity<number, NumberSpec>;
export type NumberIndependentInputEntity = IndependentInputEntity<number, NumberSpec>;
Expand Down
39 changes: 33 additions & 6 deletions src/lib/core/components/Form/types/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,40 @@ import {
ValidatorsMap,
} from './';

export type ObjectInputProps = InputProps<FieldObjectValue, ObjectSpec>;
export type ObjectIndependentInputProps = IndependentInputProps<FieldObjectValue, ObjectSpec>;
export type ObjectLayoutProps = LayoutProps<FieldObjectValue, ObjectSpec>;
export type ObjectInputProps<InputComponentProps extends Record<string, any> = {}> = InputProps<
FieldObjectValue,
ObjectSpec<undefined, InputComponentProps>
>;
export type ObjectIndependentInputProps<
InputComponentProps extends Record<string, any> = {},
LayoutComponentProps extends Record<string, any> = {},
> = IndependentInputProps<
FieldObjectValue,
ObjectSpec<undefined, InputComponentProps, LayoutComponentProps>
>;

export type ObjectInput = InputType<FieldObjectValue, ObjectSpec>;
export type ObjectIndependentInput = IndependentInputType<FieldObjectValue, ObjectSpec>;
export type ObjectLayout = LayoutType<FieldObjectValue, ObjectSpec>;
export type ObjectLayoutProps<LayoutComponentProps extends Record<string, any> = {}> = LayoutProps<
FieldObjectValue,
ObjectSpec<undefined, any, LayoutComponentProps>
>;

export type ObjectInput<InputComponentProps extends Record<string, any> = {}> = InputType<
FieldObjectValue,
ObjectSpec<undefined, InputComponentProps>
>;

export type ObjectIndependentInput<
InputComponentProps extends Record<string, any> = {},
LayoutComponentProps extends Record<string, any> = {},
> = IndependentInputType<
FieldObjectValue,
ObjectSpec<undefined, InputComponentProps, LayoutComponentProps>
>;

export type ObjectLayout<LayoutComponentProps extends Record<string, any> = {}> = LayoutType<
FieldObjectValue,
ObjectSpec<undefined, any, LayoutComponentProps>
>;

export type ObjectInputEntity = InputEntity<FieldObjectValue, ObjectSpec>;
export type ObjectIndependentInputEntity = IndependentInputEntity<FieldObjectValue, ObjectSpec>;
Expand Down
34 changes: 28 additions & 6 deletions src/lib/core/components/Form/types/string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,35 @@ import {
ValidatorsMap,
} from './';

export type StringInputProps = InputProps<string, StringSpec>;
export type StringIndependentInputProps = IndependentInputProps<string, StringSpec>;
export type StringLayoutProps = LayoutProps<string, StringSpec>;
export type StringInputProps<InputComponentProps extends Record<string, any> = {}> = InputProps<
string,
StringSpec<undefined, InputComponentProps>
>;

export type StringInput = InputType<string, StringSpec>;
export type StringIndependentInput = IndependentInputType<string, StringSpec>;
export type StringLayout = LayoutType<string, StringSpec>;
export type StringIndependentInputProps<
InputComponentProps extends Record<string, any> = {},
LayoutComponentProps extends Record<string, any> = {},
> = IndependentInputProps<string, StringSpec<undefined, InputComponentProps, LayoutComponentProps>>;

export type StringLayoutProps<LayoutComponentProps extends Record<string, any> = {}> = LayoutProps<
string,
StringSpec<undefined, any, LayoutComponentProps>
>;

export type StringInput<InputComponentProps extends Record<string, any> = {}> = InputType<
string,
StringSpec<undefined, InputComponentProps>
>;

export type StringIndependentInput<
InputComponentProps extends Record<string, any> = {},
LayoutComponentProps extends Record<string, any> = {},
> = IndependentInputType<string, StringSpec<undefined, InputComponentProps, LayoutComponentProps>>;

export type StringLayout<LayoutComponentProps extends Record<string, any> = {}> = LayoutType<
string,
StringSpec<undefined, any, LayoutComponentProps>
>;

export type StringInputEntity = InputEntity<string, StringSpec>;
export type StringIndependentInputEntity = IndependentInputEntity<string, StringSpec>;
Expand Down
Loading

0 comments on commit c3d0e2c

Please sign in to comment.