Skip to content

Commit

Permalink
Merge pull request #5 from Snoopyjoy/fix/steps_props
Browse files Browse the repository at this point in the history
fix: steps props type
  • Loading branch information
prgrmrwy authored Oct 21, 2024
2 parents bb0b3bd + 397f223 commit 372e4be
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
10 changes: 6 additions & 4 deletions packages/components/src/form-step-pro/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,21 @@ import {
import { VoidField } from "@formily/core";
import { Steps, Button, Space } from "@douyinfe/semi-ui";
import { Schema, SchemaKey } from "@formily/json-schema";
import { FormPath } from '@formily/shared';
import { FormPath } from "@formily/shared";
import type { ButtonProps } from "@douyinfe/semi-ui/lib/es/button";
import type { BasicStepsProps } from "@douyinfe/semi-ui/lib/es/steps";
import type { StepsProps } from "@douyinfe/semi-ui/lib/es/steps";
import type { StepProps } from "@douyinfe/semi-ui/lib/es/steps";
import cls from "classnames";
import { usePrefixCls } from "../__builtins__";
import { FormStep, IFormStep } from "../form-step";

export interface IFormStepProProps extends BasicStepsProps {
interface IStepProProps {
formStep?: IFormStep;
onSubmit?: (value?: any) => void;
}

export type IFormStepProProps = IStepProProps & StepsProps;

export interface IFormStepProContext {
props: Pick<IFormStepProProps, "formStep" | "onSubmit">;
field: VoidField;
Expand Down Expand Up @@ -160,7 +162,7 @@ const NextWithSubmit: React.FC<
{...restProps}
onClick={() => {
formStepCtx?.props.formStep?.submit((values) => {
const target = {}
const target = {};
picks.forEach((pickPath) => {
const parser = FormPath.parse(pickPath);
parser.setIn(target, parser.getIn(values));
Expand Down
7 changes: 4 additions & 3 deletions packages/components/src/form-step/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import React, { Fragment } from "react";
import { action, model, markRaw } from "@formily/reactive";
import { Steps } from "@douyinfe/semi-ui";
import cls from "classnames";
import { BasicStepsProps } from "@douyinfe/semi-ui/lib/es/steps";
import { StepProps } from "@douyinfe/semi-ui/lib/es/steps";
import { StepsProps, StepProps } from "@douyinfe/semi-ui/lib/es/steps";
import { Form, VoidField } from "@formily/core";
import {
connect,
Expand All @@ -27,10 +26,12 @@ export interface IFormStep {
back(): void;
}

export interface IFormStepProps extends BasicStepsProps {
interface IFormSteps {
formStep?: IFormStep;
}

export type IFormStepProps = IFormSteps & StepsProps;

type ComposedFormTab = React.FC<IFormStepProps> & {
StepPane?: React.FC<StepProps>;
createFormStep?: (defaultCurrent?: number) => IFormStep;
Expand Down

0 comments on commit 372e4be

Please sign in to comment.