Skip to content

Commit

Permalink
💥 feat: add pro-descriptions demos (#7200)
Browse files Browse the repository at this point in the history
* 💥 feat: add pro-descriptions demos

* add version

* better yaml
  • Loading branch information
chenshuai2144 authored Aug 14, 2020
1 parent 963d2af commit deb118a
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 13 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
name: Deploy CI

on: [push]
on:
push:
branches:
- master

jobs:
build-and-deploy:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- name: Checkout
uses: actions/checkout@master
Expand Down
16 changes: 9 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "ant-design-pro",
"version": "4.2.0",
"version": "4.2.1",
"private": true,
"description": "An out-of-box UI solution for enterprise applications",
"scripts": {
"postinstall": "umi g tmp",
"analyze": "cross-env ANALYZE=1 umi build",
"build": "umi build",
"deploy": "npm run site && npm run gh-pages",
"dev": "npm run start:dev",
"docker-hub:build": "docker build -f Dockerfile.hub -t ant-design-pro ./",
"docker-prod:build": "docker-compose -f ./docker/docker-compose.yml build",
"docker-prod:dev": "docker-compose -f ./docker/docker-compose.yml up",
Expand All @@ -18,17 +18,17 @@
"fetch:blocks": "pro fetch-blocks && npm run prettier",
"gh-pages": "gh-pages -d dist",
"i18n-remove": "pro i18n-remove --locale=zh-CN --write",
"postinstall": "umi g tmp",
"lint": "umi g tmp && npm run lint:js && npm run lint:style && npm run lint:prettier",
"lint:prettier": "prettier --check \"**/*\" --end-of-line auto",
"precommit": "lint-staged",
"lint-staged:js": "eslint --ext .js,.jsx,.ts,.tsx ",
"lint:fix": "eslint --fix --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src && npm run lint:style",
"lint:js": "eslint --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src",
"lint:prettier": "prettier --check \"**/*\" --end-of-line auto",
"lint:style": "stylelint --fix \"src/**/*.less\" --syntax less",
"precommit": "lint-staged",
"prettier": "prettier -c --write \"**/*\"",
"site": "npm run fetch:blocks && npm run build",
"start": "umi dev",
"dev": "npm run start:dev",
"start:dev": "cross-env REACT_APP_ENV=dev MOCK=none umi dev",
"start:no-mock": "cross-env MOCK=none umi dev",
"start:no-ui": "cross-env UMI_UI=none umi dev",
Expand All @@ -38,7 +38,7 @@
"test": "umi test",
"test:all": "node ./tests/run-tests.js",
"test:component": "umi test ./src/components",
"tsc": "tsc"
"tsc": "tsc --noEmit"
},
"lint-staged": {
"**/*.less": "stylelint --syntax less",
Expand All @@ -54,6 +54,7 @@
],
"dependencies": {
"@ant-design/icons": "^4.0.0",
"@ant-design/pro-descriptions": "^1.0.4",
"@ant-design/pro-layout": "^6.4.1",
"@ant-design/pro-table": "^2.5.3",
"antd": "^4.5.3",
Expand Down Expand Up @@ -102,7 +103,8 @@
"prettier": "^2.0.1",
"pro-download": "1.0.1",
"puppeteer-core": "^5.0.0",
"stylelint": "^13.0.0"
"stylelint": "^13.0.0",
"typescript": "^3.9.7"
},
"engines": {
"node": ">=10.0.0"
Expand Down
34 changes: 30 additions & 4 deletions src/pages/ListTableList/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { PlusOutlined } from '@ant-design/icons';
import { Button, Divider, message, Input } from 'antd';
import { Button, Divider, message, Input, Drawer } from 'antd';
import React, { useState, useRef } from 'react';
import { PageContainer, FooterToolbar } from '@ant-design/pro-layout';
import ProTable, { ProColumns, ActionType } from '@ant-design/pro-table';

import ProDescriptions from '@ant-design/pro-descriptions';
import CreateForm from './components/CreateForm';
import UpdateForm, { FormValueType } from './components/UpdateForm';
import { TableListItem } from './data.d';
Expand Down Expand Up @@ -76,6 +76,7 @@ const TableList: React.FC<{}> = () => {
const [updateModalVisible, handleUpdateModalVisible] = useState<boolean>(false);
const [stepFormValues, setStepFormValues] = useState({});
const actionRef = useRef<ActionType>();
const [row, setRow] = useState<TableListItem>();
const [selectedRowsState, setSelectedRows] = useState<TableListItem[]>([]);
const columns: ProColumns<TableListItem>[] = [
{
Expand All @@ -88,6 +89,9 @@ const TableList: React.FC<{}> = () => {
message: '规则名称为必填项',
},
],
render: (dom, entity) => {
return <a onClick={() => setRow(entity)}>{dom}</a>;
},
},
{
title: '描述',
Expand Down Expand Up @@ -182,7 +186,7 @@ const TableList: React.FC<{}> = () => {
onClick={async () => {
await handleRemove(selectedRowsState);
setSelectedRows([]);
actionRef.current?.reloadAndRest();
actionRef.current?.reloadAndRest?.();
}}
>
批量删除
Expand All @@ -204,7 +208,6 @@ const TableList: React.FC<{}> = () => {
rowKey="key"
type="form"
columns={columns}
rowSelection={{}}
/>
</CreateForm>
{stepFormValues && Object.keys(stepFormValues).length ? (
Expand All @@ -227,6 +230,29 @@ const TableList: React.FC<{}> = () => {
values={stepFormValues}
/>
) : null}

<Drawer
width={600}
visible={!!row}
onClose={() => {
setRow(undefined);
}}
closable={false}
>
{row?.name && (
<ProDescriptions<TableListItem>
column={2}
title={row?.name}
request={async () => ({
data: row || {},
})}
params={{
id: row?.name,
}}
columns={columns}
/>
)}
</Drawer>
</PageContainer>
);
};
Expand Down

0 comments on commit deb118a

Please sign in to comment.