import React from "react"; import { Button, Tooltip } from "antd"; import { DtmplData, LtmplConfig, ShowViewParam } from "../../tmpl/interface"; import { AlignCenterOutlined } from "@ant-design/icons"; import ActionUtils from "../../controls/action/utils"; interface ViewButtonProps { serverKey?: string; showView: (showViewParam: ShowViewParam) => void; data: DtmplData; ltmplConfig: LtmplConfig; buttonType?: "link" | "text" | "primary" | "default" | "dashed"; } const ViewButton: React.FC = (props) => { const { showView, data, ltmplConfig, buttonType = "primary" } = props; const { classViewConfigs, detailBtnTitle, buttonViewAction } = ltmplConfig || {}; let button = undefined; if (classViewConfigs) { classViewConfigs.forEach((classViewConfig) => { if ( !button && ActionUtils.isShow(classViewConfig.preposes, [data], undefined) ) { const btnProps: any = { size: "small", type: buttonType, onClick: () => showView({ code: data.code, dtmplSourceId: classViewConfig.id, }) }; button = ( (!detailBtnTitle || detailBtnTitle?.length < 4) ? : :