Skip to content

Commit

Permalink
🐛 fix(ims-view-pc): types error
Browse files Browse the repository at this point in the history
  • Loading branch information
eternallycyf committed Sep 27, 2024
1 parent e2dfd90 commit fa1ab60
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ import {
} from 'ims-view-pc';
import React, { Fragment, useImperativeHandle, useState } from 'react';

export type Next<Values = AnyObject, Rest = AnyObject, Extra = unknown, FormValues = Values> = (
values: FormValues,
form: Omit<FormInstance<FormValues>, 'scrollToField' | 'getFieldInstance'>,
index?: number,
) => false | React.ReactNode | DeepPartial<ISearchesType<Values, Rest, Extra>>;

export interface IUpdateControlProps<
Values = AnyObject,
Rest = AnyObject,
Expand All @@ -18,11 +24,7 @@ export interface IUpdateControlProps<
itemProps?: {
shouldUpdate?: (prevValues: Values, nextValues: Values) => boolean;
/**@name index使用commonEditable 自动注入 */
next?: (
values: FormValues,
form: Omit<FormInstance<FormValues>, 'scrollToField' | 'getFieldInstance'>,
index?: number,
) => false | React.ReactNode | DeepPartial<ISearchesType<Values, Rest, Extra>>;
next?: Next<Values, Rest, Extra, FormValues>;
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ export { ICascadeControlProps } from './FormItem/cascader';
export { IEditorProps } from './FormItem/editor';
export { IMentionsControlProps } from './FormItem/mentions';
export { ISimpleControlProps } from './FormItem/simple';
export { IUpdateControlProps } from './FormItem/update';
export { IUpdateControlProps, Next } from './FormItem/update';
1 change: 1 addition & 0 deletions packages/ims-view-pc/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export type {
IMentionsControlProps,
ISimpleControlProps,
IUpdateControlProps,
Next,
} from './components/CustomForm/interface';
export { default as CustomModal } from './components/CustomModal';
export type { FormModalProps, ICustomModalFormList } from './components/CustomModal/form';
Expand Down
3 changes: 2 additions & 1 deletion packages/ims-view-pc/src/type/form/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
IMentionsControlProps,
ISimpleControlProps,
IUpdateControlProps,
type Next,
} from 'ims-view-pc';
import { Search } from '.';

Expand Down Expand Up @@ -50,7 +51,7 @@ export const FORM_TYPE_DICT = [
export type FormControlType = (typeof FORM_TYPE_DICT)[number];

export type ItemProps<Values, Rest, Extra> = FormItemProps<Values> & {
next?: IUpdateControlProps<Values, Rest, Extra, Values>['itemProps']['next'];
next?: Next<Values, Rest, Extra, Values>;
};

export interface IFetchConfig<Record = AnyObject> {
Expand Down

0 comments on commit fa1ab60

Please sign in to comment.