mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-07-02 11:12:20 +08:00
* fix(filter-form): fix operator not valid in block templates * test: add e2e test * test: clear data templates * chore: fix e2e tests * chore: stash * chore: change import path to fix unit tests * chore: change import path to fix unit tests * chore: fix build
56 lines
1.7 KiB
TypeScript
56 lines
1.7 KiB
TypeScript
/**
|
|
* This file is part of the NocoBase (R) project.
|
|
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
* Authors: NocoBase Team.
|
|
*
|
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
*/
|
|
|
|
import { ISchema, useField, useFieldSchema } from '@formily/react';
|
|
import React from 'react';
|
|
import { useTranslation } from 'react-i18next';
|
|
import { useDesignable } from '../schema-component/hooks/useDesignable';
|
|
import { SchemaSettingsModalItem } from './SchemaSettings';
|
|
|
|
export function SchemaSettingsBlockTitleItem() {
|
|
const field = useField();
|
|
const fieldSchema = useFieldSchema();
|
|
const { dn } = useDesignable();
|
|
const { t } = useTranslation();
|
|
|
|
return (
|
|
<SchemaSettingsModalItem
|
|
title={t('Edit block title')}
|
|
schema={
|
|
{
|
|
type: 'object',
|
|
title: t('Edit block title'),
|
|
properties: {
|
|
title: {
|
|
title: t('Block title'),
|
|
type: 'string',
|
|
default: fieldSchema?.['x-component-props']?.['title'],
|
|
'x-decorator': 'FormItem',
|
|
'x-component': 'Input',
|
|
},
|
|
},
|
|
} as ISchema
|
|
}
|
|
onSubmit={({ title }) => {
|
|
const componentProps = fieldSchema['x-component-props'] || {};
|
|
componentProps.title = title;
|
|
fieldSchema['x-component-props'] = componentProps;
|
|
field.componentProps.title = title;
|
|
dn.emit('patch', {
|
|
schema: {
|
|
['x-uid']: fieldSchema['x-uid'],
|
|
'x-component-props': fieldSchema['x-component-props'],
|
|
},
|
|
});
|
|
dn.refresh();
|
|
}}
|
|
/>
|
|
);
|
|
}
|