瀏覽代碼

fix: export some interface that has been exported in semi 1.x (#277)

pointhalo 3 年之前
父節點
當前提交
5224e7771f

+ 3 - 3
content/input/form/index-en-US.md

@@ -1516,10 +1516,10 @@ With Field did the following things.
 -   Insert Field's `<Form.Label>`above the field
 -   Insert Field's `<ErrorMessage>` under the field
 
-With Field Options specific configuration can be consulted [withFieldOption](#WithFieldOptions)
+With Field Options specific configuration can be consulted [withFieldOption](#WithFieldOption)
 
 ```jsx
-withField(YourComponent, withFieldOptions);
+withField(YourComponent, withFieldOption);
 ```
 
 ```jsx live=true dir="column"
@@ -1790,7 +1790,7 @@ const { ErrorMessage } = Form;
 | className  | Classname of ErrorMessage wrapper | string                   |         |
 | style      | Inline style                      | object                   |         |
 
-## withFieldOptions
+## withFieldOption
 
 | key               | Description                                                                                                                                                                                                                                                                                                                                                                 | Default    |
 | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |

+ 3 - 3
content/input/form/index.md

@@ -1724,14 +1724,14 @@ withField 主要做了以下事情
 -   负责在表单控件下方插入 Field 的`<ErrorMessage>`
 -   负责在表单控件下方插入 Field 的 extraText
 
-withFieldOptions 具体配置可参考[withField Option](#withFieldOptions)
+withFieldOption 具体配置可参考[withField Option](#withFieldOption)
 
 你的自定义受控组件需要做以下事情:  
 值发生变化时,调用props.onChange并且将最新的值作为入参  
 响应props.value的变化,并更新你的组件UI渲染结果  
 
 ```jsx
-withField(YourComponent, withFieldOptions);
+withField(YourComponent, withFieldOption);
 ```
 
 ```jsx live=true dir="column" hideInDSM
@@ -2053,7 +2053,7 @@ const { ErrorMessage } = Form;
 | showValidateIcon | 自动加上 validateStatus 对应的 icon                       | boolean                  |
 | validateStatus   | 信息所属的校验状态,可选 default/error/warning/success(success一般建议与default样式相同) | boolean                  |
 
-## withFieldOptions
+## withFieldOption
 
 | key               | 描述                                                                                                                                                                                                                                          | 默认值     |
 | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |

+ 1 - 1
packages/semi-foundation/form/interface.ts

@@ -79,7 +79,7 @@ export interface FieldState {
     status?: 'error' | 'success';
 }
 
-export interface withFieldOption {
+export interface WithFieldOption {
     valueKey?: string;
     onKeyChangeFnName?: string;
     valuePath?: string;

+ 2 - 2
packages/semi-foundation/form/utils.ts

@@ -3,7 +3,7 @@
 /* eslint-disable @typescript-eslint/no-unused-vars */
 import AsyncValidator from 'async-validator';
 import { cloneDeep, toPath } from 'lodash-es';
-import { FieldValidateTriggerType, BasicTriggerType, ComponentProps, withFieldOption } from './interface';
+import { FieldValidateTriggerType, BasicTriggerType, ComponentProps, WithFieldOption } from './interface';
 
 export function getDisplayName(WrappedComponent: React.ComponentType | any) {
     const originName = WrappedComponent.displayName || WrappedComponent.name;
@@ -61,7 +61,7 @@ function transformTrigger(trigger: FieldValidateTriggerType): Array<BasicTrigger
     return result;
 }
 
-export function mergeOptions(opts: withFieldOption, props: ComponentProps) {
+export function mergeOptions(opts: WithFieldOption, props: ComponentProps) {
     // Opts: different types of component identification value, value change callback function may be inconsistent, used to adapt 1, input, select 2, radio, checkbox 3, switch
     // valueKey: input, select class component control value props are value, and checkbox, switch is checked
     // eg:checkbox、radio   { valueKey: 'checked', onKeyChangeFnName: 'onChange', valuePath: 'target.value' }

+ 2 - 2
packages/semi-ui/form/hoc/withField.tsx

@@ -13,7 +13,7 @@ import ErrorMessage from '../errorMessage';
 import { isElement } from '../../_base/reactUtils';
 import Label from '../label';
 import { Col } from '../../grid';
-import { CallOpts, withFieldOption } from '@douyinfe/semi-foundation/form/interface';
+import { CallOpts, WithFieldOption } from '@douyinfe/semi-foundation/form/interface';
 import { CommonFieldProps, CommonexcludeType } from '../interface';
 import { Subtract } from 'utility-types';
 
@@ -29,7 +29,7 @@ const prefix = cssClasses.PREFIX;
 function withField<
     C extends React.ComponentType<React.ComponentProps<C>>,
     T extends React.ComponentType<Subtract<React.ComponentProps<C>, CommonexcludeType> & CommonFieldProps>
->(Component: C, opts?: withFieldOption): T {
+>(Component: C, opts?: WithFieldOption): T {
     let SemiField = (props: any, ref: React.MutableRefObject<any>) => {
         let {
             // condition,

+ 2 - 2
packages/semi-ui/form/interface.ts

@@ -5,7 +5,7 @@ import { Subtract } from 'utility-types';
 import type { RuleItem } from 'async-validator';
 import { Options as scrollIntoViewOptions } from 'scroll-into-view-if-needed';
 
-import { BaseFormApi as FormApi, FormState } from '@douyinfe/semi-foundation/form/interface';
+import { BaseFormApi as FormApi, FormState, WithFieldOption } from '@douyinfe/semi-foundation/form/interface';
 import { SelectProps } from '../select/index';
 import Option from '../select/option';
 import OptGroup from '../select/optionGroup';
@@ -15,7 +15,7 @@ import { RadioProps } from '../radio/index';
 import { ErrorMessageProps, ReactFieldError as FieldError } from './errorMessage';
 import { LabelProps } from './label';
 
-export { FormState, FormApi };
+export { FormState, FormApi, WithFieldOption };
 
 export type CommonFieldProps = {
     /** Field is required (except Form. Checkbox within the Group, Form. Radio) */

+ 2 - 1
packages/semi-ui/notification/index.tsx

@@ -26,7 +26,8 @@ export interface NoticeReactProps extends NoticeProps{
 export {
     NoticeState,
     NotificationListProps,
-    NotificationListState
+    NotificationListState,
+    ConfigProps
 };
 
 export type NoticesInPosition = { top: NoticeInstance[];

+ 1 - 0
packages/semi-ui/toast/index.tsx

@@ -25,6 +25,7 @@ export interface ToastReactProps extends ToastProps{
 }
 
 export {
+    ConfigProps,
     ToastListProps,
     ToastListState,
     ToastState

+ 1 - 0
packages/semi-ui/upload/index.tsx

@@ -15,6 +15,7 @@ import '@douyinfe/semi-foundation/upload/upload.scss';
 
 const prefixCls = cssClasses.PREFIX;
 
+export { BeforeUploadObjectResult, AfterUploadResult };
 
 export interface FileItem extends BaseFileItem {
     validateMessage?: ReactNode;