feat(Table): column action support linkage rules (#1638)
This commit is contained in:
parent
c38dbd1675
commit
2d84cc34ea
@ -38,7 +38,7 @@ const MenuGroup = (props) => {
|
||||
};
|
||||
|
||||
export const ActionDesigner = (props) => {
|
||||
const { modalTip, ...restProps } = props;
|
||||
const { modalTip, linkageAction, ...restProps } = props;
|
||||
const field = useField();
|
||||
const fieldSchema = useFieldSchema();
|
||||
const { name } = useCollection();
|
||||
@ -50,6 +50,7 @@ export const ActionDesigner = (props) => {
|
||||
const [initialSchema, setInitialSchema] = useState<ISchema>();
|
||||
const actionType = fieldSchema['x-action'] ?? '';
|
||||
const isLinkageAction =
|
||||
linkageAction ||
|
||||
(Object.keys(useFormBlockContext()).length > 0 && Object.keys(useRecord()).length > 0) ||
|
||||
fieldSchema?.parent?.['x-initializer'] === 'DetailsActionInitializers';
|
||||
const isChildCollectionAction = getChildrenCollections(name).length > 0 && fieldSchema['x-action'] === 'create';
|
||||
|
@ -6,6 +6,7 @@ import { SchemaInitializer, SchemaSettings } from '../..';
|
||||
import { useAPIClient } from '../../api-client';
|
||||
import { useCollection } from '../../collection-manager';
|
||||
import { createDesignable, useDesignable } from '../../schema-component';
|
||||
import _ from 'lodash';
|
||||
|
||||
export const Resizable = (props) => {
|
||||
const { t } = useTranslation();
|
||||
@ -66,6 +67,7 @@ export const TableActionColumnInitializers = (props: any) => {
|
||||
if (!spaceSchema) {
|
||||
return;
|
||||
}
|
||||
_.set(schema, 'x-designer-props.linkageAction', true);
|
||||
const dn = createDesignable({
|
||||
t,
|
||||
api,
|
||||
|
@ -944,7 +944,7 @@ SchemaSettings.LinkageRules = (props) => {
|
||||
const { dn } = useDesignable();
|
||||
const { t } = useTranslation();
|
||||
const { getTemplateById } = useSchemaTemplateManager();
|
||||
const type = fieldSchema['x-component'] === 'Action' ? 'button' : 'field';
|
||||
const type = ['Action', 'Action.Link'].includes(fieldSchema['x-component']) ? 'button' : 'field';
|
||||
const gridSchema = findGridSchema(fieldSchema) || fieldSchema;
|
||||
return (
|
||||
<SchemaSettings.ModalItem
|
||||
|
Loading…
Reference in New Issue
Block a user