All files / src/form/list OperationColumnMeta.tsx

66.66% Statements 4/6
0% Branches 0/2
66.66% Functions 2/3
66.66% Lines 4/6

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                66x                 2x 2x                             6x                                                
import { OperationProps, RecordProps, TableMetaProps } from "@props/RecordProps";
import React, { ReactNode } from "react";
import { Tooltip } from "antd";
import { EditOutlined } from '@ant-design/icons';
import { ActionColumnKey } from '@config/base';
import i18n from "@config/i18n";
import Operations from "../list/Operations";
 
const operationColumn = (props: OperationProps): TableMetaProps => {
  const {
    ownerClass,
    ownerId,
    domainName,
    fetchDataCallback,
    deleteCallback,
    zIndex,
    updateFormName
  } = props;
  return {
    title: (<Tooltip title={i18n.t("ActionColumnTooltipTitle")}><EditOutlined /></Tooltip>),
    fieldType: "TRANSIENT_FIELD",
    key: ActionColumnKey,
    align: "center",
    updatable: false,
    width: 80,
    fixed: "left",
    className: "fix-column",
    type: ActionColumnKey,
    render: (
      // eslint-disable-next-line @typescript-eslint/no-unused-vars
      text: string | Array<string | number>, record: RecordProps, index: number
    ): ReactNode => {
 
      return (
        <Operations
          /* useModal={tableMode === "detail"} */
          id={record.id}
          ownerId={ownerId}
          ownerClass={ownerClass}
          domainName={domainName}
          deleteCallback={(node?: RecordProps): void => {
            if (node != null) {
              deleteCallback(node.id);
            }
          }}
          updateCallback={fetchDataCallback}
          zIndex={zIndex + 2}
          page={"list"}
          showActions={true}
          updateFormName={updateFormName}
        />
      );
    },
  };
};
 
export default operationColumn;