2022-01-11 18:13:15 +08:00

45 lines
956 B
TypeScript

/**
* title: 勾选
*/
import React from 'react';
import { SchemaComponentProvider, SchemaComponent } from '@nocobase/client';
import { Checkbox } from '..';
import { FormItem } from '@formily/antd';
const schema = {
type: 'object',
properties: {
input: {
interface: 'string',
type: 'string',
title: `编辑模式`,
'x-decorator': 'FormItem',
'x-component': 'Checkbox',
'x-reactions': {
target: 'read',
fulfill: {
state: {
value: '{{$self.value}}',
},
},
},
},
read: {
interface: 'string',
type: 'string',
title: `阅读模式`,
'x-read-pretty': true,
'x-decorator': 'FormItem',
'x-component': 'Checkbox',
},
},
};
export default () => {
return (
<SchemaComponentProvider components={{ Checkbox, FormItem }}>
<SchemaComponent schema={schema} />
</SchemaComponentProvider>
);
};