feat: view form values (#1443)

Co-authored-by: sealday <sealday@gmail.com>
Reviewed-on: daoyoucloud/tachybase#1443
This commit is contained in:
sealday 2024-08-06 21:52:25 +08:00
parent 59322447dc
commit 970fd3e882

View File

@ -1,5 +1,5 @@
import { useMemo } from 'react';
import { ISchema, useFieldSchema } from '@tachybase/schema';
import { ISchema, useFieldSchema, useForm } from '@tachybase/schema';
import { saveAs } from 'file-saver';
import { useTranslation } from 'react-i18next';
@ -153,6 +153,38 @@ export const defaultSettingItems = [
};
},
},
{
name: 'values',
type: 'modal',
useComponentProps() {
const form = useForm();
const { t } = useTranslation();
return {
width: '800px',
schema: () => {
return {
type: 'object',
title: t('Values'),
properties: {
values: {
type: 'string',
title: '{{ t("Schema") }}',
default: JSON.stringify(form.values, null, 2),
'x-decorator': 'FormItem',
'x-component': 'CodeMirror',
'x-component-props': {
defaultLanguage: 'JSON',
height: '500px',
},
},
} as ISchema,
};
},
title: t('Values'),
onSubmit: () => {},
};
},
},
{
name: 'divider',
type: 'divider',