import React from 'react';
import moment from 'moment';
import { Modal, message, notification, Tooltip, Spin, Popover, Popconfirm } from 'antd';

import { giveFilePostDataInfoForTrue } from '@/webPublic/one_stop_public/Base16';
import {
	getSpanJson,
	getColumns,
	getColumnsDataRealize,
	getColumnsSqlKeyRealize,
	getWord,
  renderContentAll,
  renderContentRow,
} from './globalFunction';

export function giveSmartFormGlobalProps({
	fromStart = false,
	hasSingle = false,
	isHandle = false,
	onlyRead = false, // 是否此表单所有组件只读
	taskCells = [],
	data = {},
	nextUsers = {}, //
	calculateFlowData = [], // 移动端使用 用于分块块  禅道 23933 移动端全表单后审核步骤的显示问题优化
}) {
	window.smartFormGlobalProps = {
		fromStart,
		hasSingle,
		isHandle,
		taskCells,
		data,
		nextUsers,
		calculateFlowData,
		onlyRead,
		apiList: {
			giveFilePostDataInfoForTrue,
			getSpanJson,
			getColumns,
			getColumnsDataRealize,
			getColumnsSqlKeyRealize,
			getWord,
      renderContentAll,
      renderContentRow,
			remark: {
        "giveFilePostDataInfoForTrue(params, url) ":`将接口参数 二进制文件化 并返回新的接口地址与参数';`,
        "getSpanJson(mergeKey, data, eliminateStr)":`列表获取纵向合并数据 ;参数-> mergeKey : 需要合并的表头key data : 列表数据 eliminateStr : 需要忽略合并的数据`,
        "getColumns(columns)":`获取ant表头的属性 ;参数->columns : ant的表头`,
        "getColumnsDataRealize({data, mergeKey, columns, styles, defect, fileName, ext , eliminateStr})":`下载列表合并的数据;参数-> 前三个必填data, mergeKey, columns`,
        "getColumnsSqlKeyRealize({sqlKey, columns, styles, fileName, ext})":`下载列表表头合并的数据;参数->前两个个必填sqlKey, columns`,
        "getWord({templatePath,params, title, allValues, listConfig, ext})":`下载文档地址 ;参数->前五个必填 templatePath,params, title, allValues, listConfig`,
        "renderContentAll(value, row, index, key, spanData, cloumnNames) ":`ant表头横向、纵向合并 ;参数->所有必填 value, row, index, key, spanData, cloumnNames 实例：render:(value, row, index)=>{return renderContentAll(value, row, index,"inst_name",spanData,cloumnNames)}`,
        "renderContentRow(value, row, index, key, spanData, cloumnNames) ":`ant表头纵向合并 ;参数->所有必填 value, row, index, key, spanData, cloumnNames 实例：render:(value, row, index)=>{return renderContentRow(value, row, index,"inst_name",spanData,cloumnNames)}`,
      }
		},
		publicComponent: {
			React,
			Modal,
			message,
			notification,
			Tooltip,
			Spin,
			Popover,
			Popconfirm,
			moment,
		},
	};
	return true;
}