fix: add child action should omit children data (#2969)
* refactor: expand action locale * fix: add child action should omit children data
This commit is contained in:
parent
2c58d515da
commit
b109a5751b
@ -164,7 +164,7 @@ export const useCreateActionProps = () => {
|
||||
// const values = omitBy(formValues, (value) => isEqual(JSON.stringify(value), '[{}]'));
|
||||
if (addChild) {
|
||||
const treeParentField = getTreeParentField();
|
||||
values[treeParentField?.name ?? 'parent'] = currentRecord?.__parent;
|
||||
values[treeParentField?.name ?? 'parent'] = omit(currentRecord?.__parent, ['children']);
|
||||
values[treeParentField?.foreignKey ?? 'parentId'] = currentRecord?.__parent?.id;
|
||||
}
|
||||
actionField.data = field.data || {};
|
||||
@ -182,10 +182,10 @@ export const useCreateActionProps = () => {
|
||||
? triggerWorkflows.map((row) => [row.workflowKey, row.context].filter(Boolean).join('!')).join(',')
|
||||
: undefined,
|
||||
});
|
||||
setVisible?.(false);
|
||||
actionField.data.loading = false;
|
||||
actionField.data.data = data;
|
||||
__parent?.service?.refresh?.();
|
||||
setVisible?.(false);
|
||||
if (!onSuccess?.successMessage) {
|
||||
message.success(t('Saved successfully'));
|
||||
await form.reset();
|
||||
|
@ -2,6 +2,7 @@ import { css } from '@emotion/css';
|
||||
import { useFieldSchema } from '@formily/react';
|
||||
import { Button } from 'antd';
|
||||
import React from 'react';
|
||||
import { useCompile } from '../../hooks';
|
||||
import { useTableBlockContext, useTableSelectorContext } from '../../../block-provider';
|
||||
import { Icon } from '../../../icon';
|
||||
|
||||
@ -52,6 +53,7 @@ export const ExpandAction = (props) => {
|
||||
const isTableSelector = schema.parent?.parent?.['x-decorator'] === 'TableSelectorProvider';
|
||||
const ctx = isTableSelector ? ctxSelector : ctxBlock;
|
||||
const { titleExpand, titleCollapse, iconExpand, iconCollapse } = schema['x-component-props'] || {};
|
||||
const compile = useCompile();
|
||||
return (
|
||||
<div className={actionDesignerCss}>
|
||||
{ctx?.params['tree'] && (
|
||||
@ -62,8 +64,8 @@ export const ExpandAction = (props) => {
|
||||
icon={<Icon type={ctx?.expandFlag ? iconCollapse : iconExpand} />}
|
||||
type={props.type}
|
||||
>
|
||||
{props.children[1]}
|
||||
<span style={{ marginLeft: 10 }}>{ctx?.expandFlag ? titleCollapse : titleExpand}</span>
|
||||
{props.children?.[1]}
|
||||
<span style={{ marginLeft: 10 }}>{ctx?.expandFlag ? compile(titleCollapse) : compile(titleExpand)}</span>
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
|
@ -1,16 +1,14 @@
|
||||
import React from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { ActionInitializer } from './ActionInitializer';
|
||||
|
||||
export const ExpandActionInitializer = (props) => {
|
||||
const { t } = useTranslation();
|
||||
const schema = {
|
||||
'x-action': 'expandAll',
|
||||
'x-component': 'Action',
|
||||
'x-designer': 'Expand.Action.Design',
|
||||
'x-component-props': {
|
||||
titleExpand: t('Expand all'),
|
||||
titleCollapse: t('Collapse all'),
|
||||
titleExpand: "{{t('Expand all')}}",
|
||||
titleCollapse: "{{t('Collapse all')}}",
|
||||
iconExpand: 'nodeexpandoutlined',
|
||||
iconCollapse: 'nodecollapseoutlined',
|
||||
component: 'Expand.Action',
|
||||
|
Loading…
Reference in New Issue
Block a user