import React, { useRef } from 'react'; import { PlusOutlined } from '@ant-design/icons'; import { Button, Tag, Space, ConfigProvider } from 'antd'; import type { ProColumns, ActionType } from '@ant-design/pro-table'; import ProTable, { TableDropdown } from '@ant-design/pro-table'; import request from 'umi-request'; import arEGIntl from 'antd/lib/locale/ar_EG'; type GithubIssueItem = { url: string; id: number; number: number; title: string; labels: { name: string; color: string; }[]; state: string; comments: number; created_at: string; updated_at: string; closed_at?: string; }; const columns: ProColumns[] = [ { dataIndex: 'index', valueType: 'indexBorder', width: 48, }, { title: 'العنوان', dataIndex: 'title', copyable: true, ellipsis: true, tip: 'سيتم تقليص العنوان في حال كان طويل جدًا', formItemProps: { rules: [ { required: true, message: 'هذا الحقل مطلوب', }, ], }, width: '30%', search: false, }, { title: 'الحالة', dataIndex: 'state', initialValue: 'open', filters: true, onFilter: true, valueEnum: { all: { text: 'الكل', status: 'Default' }, open: { text: 'غير محلولة', status: 'Error', }, closed: { text: 'تم حلها', status: 'Success', }, processing: { text: 'نعمل عليها', status: 'Processing', }, }, }, { title: 'التسمية', dataIndex: 'labels', render: (_, record) => ( {record.labels.map(({ name, color }) => ( {name} ))} ), }, { title: 'تاريخ الإنشاء', key: 'since', dataIndex: 'created_at', valueType: 'date', }, { title: 'التشغيل', valueType: 'option', render: (text, record, _, action) => [ رابط , 查看 , action?.reload()} menus={[ { key: 'copy', name: 'نسخ' }, { key: 'delete', name: 'حذف' }, ]} />, ], }, ]; export default () => { const actionRef = useRef(); return ( columns={columns} actionRef={actionRef} request={async (params = {}) => request<{ data: GithubIssueItem[]; }>('https://proapi.azurewebsites.net/github/issues', { params, }) } pagination={{ pageSize: 5, }} rowKey="id" search={{ labelWidth: 'auto', }} dateFormatter="string" headerTitle="نموذج احترافي" toolBarRender={() => [ , ]} /> ); };