vendor: amis 6.13.0 base (fork root)

This commit is contained in:
2026-06-16 22:14:57 +08:00
commit 8c8e4247a9
3840 changed files with 2467374 additions and 0 deletions

View File

@@ -0,0 +1,71 @@
import React from 'react';
import {Button, InputTable, Form, Controller, MixedInput} from 'amis-ui';
export default function MixedInputExamples() {
const handleSubmit = React.useCallback((data: any) => {
alert(JSON.stringify(data, null, 2));
}, []);
const methods = React.useMemo(
() => [
{
label: '%',
pipeIn: (value: any) => {
return value ? value.replace('%', '') : '';
},
pipeOut: (value: any) => {
return value ? `${value}%` : '';
},
test: (value: any) => {
return typeof value === 'string' && value.endsWith('%');
},
value: 'percent'
},
{
label: 'px',
type: 'number',
inputSettings: {
precision: 2
},
pipeIn: (value: any) => {
return value ? parseFloat(value.replace('px', '')) || 0 : '';
},
pipeOut: (value: any) => {
return value ? `${value}px` : '';
},
test: (value: any) => {
return typeof value === 'string' && value.endsWith('px');
},
value: 'pixel'
}
],
[]
);
return (
<div className="wrapper">
<Form defaultValue={{}} onSubmit={handleSubmit}>
{({control, onSubmit, getValues}) => {
return (
<>
<Controller
name="a"
control={control}
isRequired
render={({field, fieldState}) => (
<MixedInput
{...field}
hasError={!!fieldState.error}
disabled={false}
methods={methods}
/>
)}
/>
<Button onClick={onSubmit}>Submit</Button>
</>
);
}}
</Form>
</div>
);
}