mirror of
https://github.com/nocobase/nocobase
synced 2024-11-14 16:23:30 +00:00
feat: plugin-block-workbench add title and height setting (#5492)
Some checks are pending
Build docker image / build-and-push (push) Waiting to run
Build pro image / build-and-push (push) Waiting to run
E2E / Build (push) Waiting to run
E2E / Core and plugins (push) Blocked by required conditions
E2E / plugin-workflow (push) Blocked by required conditions
E2E / plugin-workflow-approval (push) Blocked by required conditions
E2E / plugin-data-source-main (push) Blocked by required conditions
E2E / Comment on PR (push) Blocked by required conditions
NocoBase backend test / sqlite-test (20, false) (push) Waiting to run
NocoBase backend test / sqlite-test (20, true) (push) Waiting to run
NocoBase backend test / postgres-test (public, 20, nocobase, false) (push) Waiting to run
NocoBase backend test / postgres-test (public, 20, nocobase, true) (push) Waiting to run
NocoBase backend test / postgres-test (public, 20, public, false) (push) Waiting to run
NocoBase backend test / postgres-test (public, 20, public, true) (push) Waiting to run
NocoBase backend test / postgres-test (user_schema, 20, nocobase, false) (push) Waiting to run
NocoBase backend test / postgres-test (user_schema, 20, nocobase, true) (push) Waiting to run
NocoBase backend test / postgres-test (user_schema, 20, public, false) (push) Waiting to run
NocoBase backend test / postgres-test (user_schema, 20, public, true) (push) Waiting to run
NocoBase backend test / mysql-test (20, false) (push) Waiting to run
NocoBase backend test / mysql-test (20, true) (push) Waiting to run
NocoBase backend test / mariadb-test (20, false) (push) Waiting to run
NocoBase backend test / mariadb-test (20, true) (push) Waiting to run
NocoBase frontEnd test / frontend-test (18) (push) Waiting to run
Test on Windows / build (push) Waiting to run
Some checks are pending
Build docker image / build-and-push (push) Waiting to run
Build pro image / build-and-push (push) Waiting to run
E2E / Build (push) Waiting to run
E2E / Core and plugins (push) Blocked by required conditions
E2E / plugin-workflow (push) Blocked by required conditions
E2E / plugin-workflow-approval (push) Blocked by required conditions
E2E / plugin-data-source-main (push) Blocked by required conditions
E2E / Comment on PR (push) Blocked by required conditions
NocoBase backend test / sqlite-test (20, false) (push) Waiting to run
NocoBase backend test / sqlite-test (20, true) (push) Waiting to run
NocoBase backend test / postgres-test (public, 20, nocobase, false) (push) Waiting to run
NocoBase backend test / postgres-test (public, 20, nocobase, true) (push) Waiting to run
NocoBase backend test / postgres-test (public, 20, public, false) (push) Waiting to run
NocoBase backend test / postgres-test (public, 20, public, true) (push) Waiting to run
NocoBase backend test / postgres-test (user_schema, 20, nocobase, false) (push) Waiting to run
NocoBase backend test / postgres-test (user_schema, 20, nocobase, true) (push) Waiting to run
NocoBase backend test / postgres-test (user_schema, 20, public, false) (push) Waiting to run
NocoBase backend test / postgres-test (user_schema, 20, public, true) (push) Waiting to run
NocoBase backend test / mysql-test (20, false) (push) Waiting to run
NocoBase backend test / mysql-test (20, true) (push) Waiting to run
NocoBase backend test / mariadb-test (20, false) (push) Waiting to run
NocoBase backend test / mariadb-test (20, true) (push) Waiting to run
NocoBase frontEnd test / frontend-test (18) (push) Waiting to run
Test on Windows / build (push) Waiting to run
This commit is contained in:
parent
7fa5d72102
commit
166681dfad
@ -0,0 +1,56 @@
|
||||
/**
|
||||
* 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, SchemaSettingsModalItem } from '@nocobase/client';
|
||||
|
||||
export function CustomSchemaSettingsBlockTitleItem() {
|
||||
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-decorator-props']?.['title'],
|
||||
'x-decorator': 'FormItem',
|
||||
'x-component': 'Input',
|
||||
},
|
||||
},
|
||||
} as ISchema
|
||||
}
|
||||
onSubmit={({ title }) => {
|
||||
console.log('titleSchemaTest', fieldSchema, field);
|
||||
|
||||
const componentProps = fieldSchema['x-decorator-props'] || {};
|
||||
componentProps.title = title;
|
||||
fieldSchema['x-decorator-props'] = componentProps;
|
||||
field.decoratorProps.title = title;
|
||||
dn.emit('patch', {
|
||||
schema: {
|
||||
['x-uid']: fieldSchema['x-uid'],
|
||||
'x-decorator-props': fieldSchema['x-decorator-props'],
|
||||
},
|
||||
});
|
||||
dn.refresh();
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
@ -12,6 +12,9 @@ import { ISchema } from '@nocobase/client';
|
||||
export const blockSchema: ISchema = {
|
||||
type: 'void',
|
||||
'x-decorator': 'CardItem',
|
||||
'x-decorator-props': {
|
||||
title: '',
|
||||
},
|
||||
'x-settings': 'blockSettings:workbench',
|
||||
'x-schema-toolbar': 'BlockSchemaToolbar',
|
||||
'x-component': 'WorkbenchBlock',
|
||||
|
@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
import { SchemaSettings, SchemaSettingsSelectItem, useDesignable } from '@nocobase/client';
|
||||
import { CustomSchemaSettingsBlockTitleItem } from './SchemaSettingsBlockTitleItem';
|
||||
import React from 'react';
|
||||
import { useField, useFieldSchema } from '@formily/react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
@ -50,6 +51,10 @@ const ActionPanelLayout = () => {
|
||||
export const workbenchBlockSettings = new SchemaSettings({
|
||||
name: 'blockSettings:workbench',
|
||||
items: [
|
||||
{
|
||||
name: 'title',
|
||||
Component: CustomSchemaSettingsBlockTitleItem,
|
||||
},
|
||||
{
|
||||
name: 'layout',
|
||||
Component: ActionPanelLayout,
|
||||
|
Loading…
Reference in New Issue
Block a user