import TableWidgetIcon from "@/assets/widgetCover/table.svg"
import i18n from "@/i18n/config"
import { tansTableDataToColumns } from "@/widgetLibrary/TableWidget/utils"
import { WidgetConfig } from "@/widgetLibrary/interface"

const originData = [
  {
    month: "April",
    users: 3700,
    incomes: 4000,
  },
  {
    month: "May",
    users: 5400,
    incomes: 8700,
  },
  {
    month: "June",
    users: 6000,
    incomes: 12000,
  },
  {
    month: "July",
    users: 8000,
    incomes: 14000,
  },
]
// type: "CONTAINER_WIDGET",
// displayName: "container",
// widgetName: "Container",
export const TABLE_WIDGET_CONFIG: WidgetConfig = {
  displayName: "table",
  widgetName: i18n.t("widget.table.name"),
  type: "TABLE_WIDGET",
  icon: <TableWidgetIcon />,
  keywords: ["Table", "表格"],
  sessionType:"DATA",
  version: 0,
  defaults: initTableWidgetDefaultProps(),
}

export function initTableWidgetDefaultProps() {
  return {
    dataSourceMode: "dynamic",
    dataSourceJS: originData,
    columns: tansTableDataToColumns(originData),
    defaultSortKey: "default",
    defaultSortOrder: "ascend",
    emptyState: "No rows found",
    overFlow: "pagination",
    download: false,
    filter: false,
    pageSize: 10,
    pageIndex: 0,
    paginationOffset: 0,
  }
}
