mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
723c6bf4eb
* publish beta * feat: 添加 ui ConfirmBox * feat: 补充 confirmBox ui 控件, 并将 pickerContainer 改成 confirmBox 实现 * PickerContainer title 逻辑不变动 * 暴露 InputTableColumnProps * 调整 ts 定义 * 升级 react-hook-form * inputTable 补充数组本身的验证 * Combo 也支持内部数组的验证 * 调整内部验证 * 调整目录
67 lines
1.8 KiB
TypeScript
67 lines
1.8 KiB
TypeScript
import React from 'react';
|
|
import {PickerContainer, Button, Form, Controller, InputBox} from 'amis-ui';
|
|
|
|
export default function () {
|
|
const body = React.createRef<any>();
|
|
const beforeConfirm = React.useCallback(() => {
|
|
return body.current?.submit();
|
|
}, []);
|
|
const handleConfirm = React.useCallback((data: any) => {
|
|
console.log('confirmed', data);
|
|
}, []);
|
|
|
|
return (
|
|
<div className="wrapper">
|
|
<PickerContainer
|
|
beforeConfirm={beforeConfirm}
|
|
onConfirm={handleConfirm}
|
|
bodyRender={() => (
|
|
<Form ref={body}>
|
|
{({control}) => (
|
|
<>
|
|
<Controller
|
|
mode="horizontal"
|
|
label="A"
|
|
name="a"
|
|
control={control}
|
|
rules={{maxLength: 20}}
|
|
isRequired
|
|
render={({field, fieldState}) => (
|
|
<InputBox
|
|
{...field}
|
|
hasError={!!fieldState.error}
|
|
disabled={false}
|
|
/>
|
|
)}
|
|
/>
|
|
|
|
<Controller
|
|
mode="horizontal"
|
|
label="B"
|
|
name="b"
|
|
control={control}
|
|
rules={{maxLength: 20}}
|
|
isRequired
|
|
render={({field, fieldState}) => (
|
|
<InputBox
|
|
{...field}
|
|
hasError={!!fieldState.error}
|
|
disabled={false}
|
|
/>
|
|
)}
|
|
/>
|
|
</>
|
|
)}
|
|
</Form>
|
|
)}
|
|
>
|
|
{({isOpened, onClick}) => (
|
|
<Button active={isOpened} onClick={onClick}>
|
|
Open
|
|
</Button>
|
|
)}
|
|
</PickerContainer>
|
|
</div>
|
|
);
|
|
}
|