mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 10:01:26 +00:00
feat: table action add reload button (#630)
* feat: table action add reload button * feat: reload => refresh * feat: reload icon
This commit is contained in:
parent
c9dfc2682c
commit
205c23b656
@ -415,6 +415,15 @@ export const useBulkDestroyActionProps = () => {
|
||||
};
|
||||
};
|
||||
|
||||
export const useRefreshActionProps = () => {
|
||||
const { service } = useBlockRequestContext();
|
||||
return {
|
||||
async onClick() {
|
||||
service?.refresh?.();
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export const useDetailsPaginationProps = () => {
|
||||
const ctx = useDetailsBlockContext();
|
||||
const count = ctx.service?.data?.meta?.count || 0;
|
||||
|
@ -98,6 +98,7 @@ export default {
|
||||
"Update": "Update",
|
||||
"View": "View",
|
||||
"View record": "View record",
|
||||
"Refresh": "Refresh",
|
||||
"Data changes": "Data changes",
|
||||
"Field name": "Field name",
|
||||
"Before change": "Before change",
|
||||
|
@ -99,6 +99,7 @@ export default {
|
||||
"Update": "更新",
|
||||
"View": "查看",
|
||||
"View record": "查看数据",
|
||||
"Refresh": "刷新",
|
||||
|
||||
"Data changes": "数据变更",
|
||||
"Field name": "字段标识",
|
||||
|
@ -42,6 +42,18 @@ export const TableActionInitializers = {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'item',
|
||||
title: "{{t('Refresh')}}",
|
||||
component: 'RefreshActionInitializer',
|
||||
schema: {
|
||||
'x-align': 'right',
|
||||
'x-decorator': 'ACLActionProvider',
|
||||
'x-acl-action-props': {
|
||||
skipScopeCheck: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
@ -538,6 +538,20 @@ export const BulkDestroyActionInitializer = (props) => {
|
||||
return <ActionInitializer {...props} schema={schema} />;
|
||||
};
|
||||
|
||||
export const RefreshActionInitializer = (props) => {
|
||||
const schema = {
|
||||
title: '{{ t("Refresh") }}',
|
||||
'x-action': 'refresh',
|
||||
'x-component': 'Action',
|
||||
'x-designer': 'Action.Designer',
|
||||
'x-component-props': {
|
||||
icon: 'ReloadOutlined',
|
||||
useProps: '{{ useRefreshActionProps }}',
|
||||
},
|
||||
};
|
||||
return <ActionInitializer {...props} schema={schema} />;
|
||||
};
|
||||
|
||||
export const SubmitActionInitializer = (props) => {
|
||||
const schema = {
|
||||
title: '{{ t("Submit") }}',
|
||||
@ -728,7 +742,7 @@ export const RecordAssociationFormBlockInitializer = (props) => {
|
||||
icon={<FormOutlined />}
|
||||
{...others}
|
||||
onClick={async ({ item }) => {
|
||||
|
||||
|
||||
const action = ['hasOne', 'belongsTo'].includes(field.type) ? 'get' : null;
|
||||
const actionInitializers = ['hasOne', 'belongsTo'].includes(field.type) ? 'UpdateFormActionInitializers' : 'CreateFormActionInitializers';
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user