import * as React from 'react';
import {Button}  from '@alifd/next';

export default ({
  index,
  value, // 表格dataIndex指定的数据字段的值
  record,// list一行数据
  refresh,// 列表查询更新方法
  shuttle,
  shuttleProps,
}) => {
    // const [state, { toggle }] = useToggle(false);

    const state = (shuttleProps.openRowKeys||[]).findIndex((key) => {
      return key === record.id
    }) === -1;
  return (
    <div>
        <Button onClick={()=> {
          if(state) {
            shuttle({
              openRowKeys: [record.id]
            });
          } else {
             shuttle({
              openRowKeys: []
            });
          }
        }}>{state? '打开': '关闭'}</Button>
    </div>
  );
}
