17 |
18 | ## toolbar 搜索
19 |
20 |
21 |
22 | ## form 操作
23 |
24 |
25 |
26 | ## 使用 dataSource 和 loading
27 |
28 |
29 |
30 | ## 受控的列显示隐藏
31 |
32 | 可以默认隐藏某些栏,但是在操作栏中可以选择
33 |
34 |
35 |
36 | ## 轮询
37 |
38 |
39 |
40 | ## 嵌套表格
41 |
42 |
43 |
44 | ## 自定义表格的主体
45 |
46 |
47 |
--------------------------------------------------------------------------------
/.github/workflows/deploy.yml:
--------------------------------------------------------------------------------
1 | name: Deploy CI
2 |
3 | on:
4 | release:
5 | types: [published]
6 |
7 | jobs:
8 | build-and-deploy:
9 | runs-on: ubuntu-latest
10 | steps:
11 | - name: Checkout
12 | uses: actions/checkout@master
13 | - run: yarn
14 | - run: yarn run lint
15 | # - run: yarn run tsc
16 | - name: Build and Deploy
17 | uses: JamesIves/github-pages-deploy-action@master
18 | env:
19 | CI: true
20 | GIT_CONFIG_NAME: qixian.cs
21 | GIT_CONFIG_EMAIL: qixian.cs@outlook.com
22 | NODE_OPTIONS: --max_old_space_size=4096
23 | GITHUB_TOKEN: ${{ secrets.ACTION_TOKEN }}
24 | BRANCH: gh-pages
25 | FOLDER: 'dist/'
26 | BUILD_SCRIPT: yarn && npm uninstall husky && npm run site_build && git checkout . && git clean -df
27 |
--------------------------------------------------------------------------------
/src/component/indexColumn/index.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import classnames from 'classnames';
3 | import { ConfigConsumer, ConfigConsumerProps } from 'antd/lib/config-provider/context';
4 | import './index.less';
5 |
6 | /**
7 | * 默认的 index 列容器,提供一个好看的 index
8 | * @param param0
9 | */
10 | const IndexColumn: React.FC<{ border?: boolean }> = ({ border = false, children }) => (
11 |
65 |
--------------------------------------------------------------------------------
/src/component/toolBar/DensityIcon.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { ColumnHeightOutlined } from '@ant-design/icons';
3 | import { Menu, Dropdown, Tooltip } from 'antd';
4 | import Container from '../../container';
5 | import { useIntl } from '../intlContext';
6 |
7 | export type DensitySize = 'middle' | 'small' | 'large' | undefined;
8 |
9 | const DensityIcon: React.ForwardRefRenderFunction
45 |
--------------------------------------------------------------------------------
/src/form/FormOption.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { FormInstance } from 'antd/es/form';
3 | import { Button, Space } from 'antd';
4 | import { ProTableTypes } from '../Table';
5 | import { SearchConfig } from './index';
6 |
7 | export interface FormOptionProps {
8 | searchConfig: SearchConfig;
9 | type?: ProTableTypes;
10 | form: FormInstance;
11 | submit: () => void;
12 | collapse: boolean;
13 | setCollapse: (collapse: boolean) => void;
14 | showCollapseButton: boolean;
15 | onReset?: () => void;
16 | }
17 |
18 | /**
19 | * FormFooter 的组件,可以自动进行一些配置
20 | * @param props
21 | */
22 | const FormOption: React.FC
123 |
124 | ### 数字类
125 |
126 |
127 |
128 | ### 样式类
129 |
130 |
131 |
--------------------------------------------------------------------------------
/docs/example/form.tsx:
--------------------------------------------------------------------------------
1 | import React, { useRef, useState } from 'react';
2 | import { Button } from 'antd';
3 | import ProTable, { ProColumns } from '@ant-design/pro-table';
4 | import { FormInstance } from 'antd/lib/form';
5 |
6 | const valueEnum = {
7 | 0: 'close',
8 | 1: 'running',
9 | 2: 'online',
10 | 3: 'error',
11 | };
12 |
13 | export interface TableListItem {
14 | key: number;
15 | name: string;
16 | status: string;
17 | updatedAt: number;
18 | createdAt: number;
19 | progress: number;
20 | money: number;
21 | }
22 | const tableListDataSource: TableListItem[] = [];
23 |
24 | for (let i = 0; i < 100; i += 1) {
25 | tableListDataSource.push({
26 | key: i,
27 | name: `TradeCode ${i}`,
28 | status: valueEnum[Math.floor(Math.random() * 10) % 4],
29 | updatedAt: Date.now() - Math.floor(Math.random() * 1000),
30 | createdAt: Date.now() - Math.floor(Math.random() * 2000),
31 | money: Math.floor(Math.random() * 2000) * i,
32 | progress: Math.ceil(Math.random() * 100) + 1,
33 | });
34 | }
35 |
36 | const columns: ProColumns{JSON.stringify(columnsStateMap)}
89 |
115 |
116 | ## 基本使用
117 |
118 |
119 |
120 | ## 操作栏
121 |
122 |
123 |
--------------------------------------------------------------------------------
/docs/demo/search_option.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { PlusOutlined } from '@ant-design/icons';
3 | import { Button, Tag, Space } from 'antd';
4 | import ProTable, { ProColumns, TableDropdown } from '@ant-design/pro-table';
5 | import request from 'umi-request';
6 |
7 | interface GithubIssueItem {
8 | url: string;
9 | repository_url: string;
10 | labels_url: string;
11 | comments_url: string;
12 | events_url: string;
13 | html_url: string;
14 | id: number;
15 | node_id: string;
16 | number: number;
17 | title: string;
18 | user: User;
19 | labels: Label[];
20 | state: string;
21 | locked: boolean;
22 | assignee?: any;
23 | assignees: any[];
24 | milestone?: any;
25 | comments: number;
26 | created_at: string;
27 | updated_at: string;
28 | closed_at?: any;
29 | author_association: string;
30 | body: string;
31 | }
32 |
33 | interface Label {
34 | id: number;
35 | node_id: string;
36 | url: string;
37 | name: string;
38 | color: string;
39 | default: boolean;
40 | description: string;
41 | }
42 |
43 | interface User {
44 | login: string;
45 | id: number;
46 | node_id: string;
47 | avatar_url: string;
48 | gravatar_id: string;
49 | url: string;
50 | html_url: string;
51 | followers_url: string;
52 | following_url: string;
53 | gists_url: string;
54 | starred_url: string;
55 | subscriptions_url: string;
56 | organizations_url: string;
57 | repos_url: string;
58 | events_url: string;
59 | received_events_url: string;
60 | type: string;
61 | site_admin: boolean;
62 | }
63 |
64 | const columns: ProColumns