client: update size setter type

This commit is contained in:
fantasticit 2022-06-05 19:32:36 +08:00
parent 698680455e
commit fbc6673118
1 changed files with 6 additions and 6 deletions

View File

@ -2,12 +2,12 @@ import { Button, Dropdown, Form } from '@douyinfe/semi-ui';
import { FormApi } from '@douyinfe/semi-ui/lib/es/form'; import { FormApi } from '@douyinfe/semi-ui/lib/es/form';
import { useCallback, useRef } from 'react'; import { useCallback, useRef } from 'react';
type ISize = { width: number; height: number }; type ISize = { width: number | string; height: number | string };
interface IProps { interface IProps {
width: number; width: number | string;
maxWidth?: number; maxWidth?: number | string;
height: number; height: number | string;
onOk: (arg: ISize) => void; onOk: (arg: ISize) => void;
} }
@ -29,8 +29,8 @@ export const SizeSetter: React.FC<IProps> = ({ width, maxWidth, height, onOk, ch
render={ render={
<div style={{ padding: '0 12px 12px' }}> <div style={{ padding: '0 12px 12px' }}>
<Form initValues={{ width, height }} getFormApi={(formApi) => ($form.current = formApi)} labelPosition="left"> <Form initValues={{ width, height }} getFormApi={(formApi) => ($form.current = formApi)} labelPosition="left">
<Form.InputNumber autofocus label="宽" field="width" {...(maxWidth ? { max: maxWidth } : {})} /> <Form.Input autofocus label="宽" field="width" {...(maxWidth ? { max: maxWidth } : {})} />
<Form.InputNumber label="高" field="height" /> <Form.Input label="高" field="height" />
</Form> </Form>
<Button size="small" type="primary" theme="solid" htmlType="submit" onClick={handleOk}> <Button size="small" type="primary" theme="solid" htmlType="submit" onClick={handleOk}>