From 970fd3e882693f076a3b5b6b33eac8825f78cd9a Mon Sep 17 00:00:00 2001 From: sealday Date: Tue, 6 Aug 2024 21:52:25 +0800 Subject: [PATCH] feat: view form values (#1443) Co-authored-by: sealday Reviewed-on: https://git.daoyoucloud.com/daoyoucloud/tachybase/pulls/1443 --- .../SchemaSettingsDefaults.tsx | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/packages/core/client/src/application/schema-settings/SchemaSettingsDefaults.tsx b/packages/core/client/src/application/schema-settings/SchemaSettingsDefaults.tsx index 2672a0ad6..7662acf5e 100644 --- a/packages/core/client/src/application/schema-settings/SchemaSettingsDefaults.tsx +++ b/packages/core/client/src/application/schema-settings/SchemaSettingsDefaults.tsx @@ -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',