Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | 66x | import React, { ReactElement, useState } from 'react';
import { CellComponentDisplayPage, RecordProps, TableMetaProps, TableMode } from "@props/RecordProps";
import { FormInstance, Space } from "antd";
import GroupedGrandChildGroupTitle from "./GroupedGrandChildGroupTitle";
import Operations from "../../form/list/Operations";
import { stopPropagationAndPreventDefault } from "@utils/ObjectUtils";
import { CreateAction } from "../../form";
import { SisternodeOutlined } from "@ant-design/icons";
export interface GroupedGrandChildGroupExtraOperationsProps {
ownerId?: number,
ownerClass?: string,
}
export interface GroupedGrandChildGroupExtraCreateChildProps {
columnNameInCurrentDomainClass?: string,
childrenDomainName: string;
}
export interface GroupedGrandChildGroupExtraProps {
domainName: string;
zIndex: number;
page: CellComponentDisplayPage,
tableMode?: TableMode,
record: RecordProps;
reload: () => void;
columns: Array<TableMetaProps>;
displayColumns: Array<TableMetaProps>;
form: FormInstance,
switchTabCallback?: (key: string) => void,
isHighlightField?: boolean,
operationsProps?: GroupedGrandChildGroupExtraOperationsProps,
createChildProps?: GroupedGrandChildGroupExtraCreateChildProps,
showOperations?: boolean,
}
const GroupedGrandChildGroupExtra = (props: GroupedGrandChildGroupExtraProps): ReactElement => {
const {
record, operationsProps, domainName, reload, zIndex, createChildProps,
showOperations
} = props;
const { ownerId, ownerClass } = operationsProps || {};
const { columnNameInCurrentDomainClass, childrenDomainName } = createChildProps || {};
const [showAddChildModal, setShowAddChildModal] = useState<boolean>(false);
return (<Space onClick={stopPropagationAndPreventDefault}>
<GroupedGrandChildGroupTitle {...props} />
{showOperations && <Operations
/* useModal={tableMode === "detail"} */
id={record.id}
ownerId={ownerId}
ownerClass={ownerClass}
domainName={domainName}
deleteCallback={reload}
updateCallback={reload}
zIndex={zIndex + 2}
page={"list"}
showActions={false}
/>}
{(createChildProps && showOperations)
? <a href="/#" onClick={stopPropagationAndPreventDefault}>
<SisternodeOutlined
onClick={(e) => {
stopPropagationAndPreventDefault(e);
setShowAddChildModal(true);
}}
/>
{showAddChildModal && childrenDomainName ? <CreateAction
domainName={childrenDomainName}
ownerId={record.id}
ownerClass={domainName}
columnNameInOwnerClass={columnNameInCurrentDomainClass}
callback={() => {
reload();
setShowAddChildModal(false);
}}
initialCanCreate={true}
initShowCreateModal={true}
zIndex={zIndex + 2}
showIconAndText={false}
onCancelCallback={() => {
setShowAddChildModal(false);
}}
/> : <></>}
</a>
: <></>}
</Space>
);
};
export default GroupedGrandChildGroupExtra;
|