Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table column filter #68

Merged
merged 5 commits into from
Jan 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DEVELOP.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ English | [简体中文](./DEVELOP.zh-CN.md)
| | ├── preview // drip-table-generator demos
| | ├── faq.md // drip-table-generator faq
| | └── index.md // drip-table-generator document entry
│ ├── global-configs.ts // global configs for demos
│ ├── global-schema.ts // global schema for demos
│ ├── index.css // official website CSS
│ ├── index.md // official website markdown
│ ├── index.tsx // official website entry
Expand Down
2 changes: 1 addition & 1 deletion DEVELOP.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
│ | ├── preview // drip-table-generator 案例展示子页面
│ | ├── faq.md // drip-table-generator 常见问题页 markdown
│ | └── index.md // drip-table-generator 文档介绍页 markdown
│ ├── global-configs.ts // 案例展示页面所用全局配置项
│ ├── global-schema.ts // 案例展示页面所用全局配置项
│ ├── index.css // 文档官网首页 CSS
│ ├── index.md // 文档官网首页入口 markdown
│ ├── index.tsx // 文档官网首页
Expand Down
26 changes: 12 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,20 +113,18 @@ The introduction of each sub-project are as follows:

```js
const schema = {
$schema: "http://json-schema.org/draft/2019-09/schema#",
configs: {
size: "middle",
},
columns: [
{
$id: "id",
title: "My Title",
"ui:type": "text",
"ui:props": { mode: "single" },
type: "string",
dataIndex: "dataIndexName",
},
],
$schema: "http://json-schema.org/draft/2019-09/schema#",
size: "middle",
columns: [
{
key: "columnKey",
title: "Column Title",
"ui:type": "text",
"ui:props": { mode: "single" },
type: "string",
dataIndex: "dataIndexName",
},
],
};
return (
<DripTable
Expand Down
28 changes: 13 additions & 15 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,20 +113,18 @@

```js
const schema = {
$schema: "http://json-schema.org/draft/2019-09/schema#",
configs: {
size: "middle",
},
columns: [
{
$id: "id",
title: "名称",
"ui:type": "text",
"ui:props": { mode: "single" },
type: "string",
dataIndex: "dataIndexName",
},
],
$schema: "http://json-schema.org/draft/2019-09/schema#",
size: "middle",
columns: [
{
key: "columnKey",
title: "列标题",
"ui:type": "text",
"ui:props": { mode: "single" },
type: "string",
dataIndex: "dataIndexName",
},
],
};
return (
<DripTable
Expand Down Expand Up @@ -179,7 +177,7 @@
yarn start
```

- 访问 http://localhost:8000
- 访问 <http://localhost:8000>
- `drip-table` 示例路由:/drip-table/guide/basic-demo
- `drip-table-generator` 示例路由:/drip-table-generator/preview

Expand Down
83 changes: 44 additions & 39 deletions docs/global-configs.ts → docs/demo-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,57 +2,56 @@ import { ColumnConfig, DripTableSchema } from 'drip-table';

export const initSchema: DripTableSchema = {
$schema: 'http://json-schema.org/draft/2019-09/schema#',
configs: {
size: 'middle',
bordered: true,
innerBordered: false,
ellipsis: false,
sticky: true,
rowSelection: true,
isVirtualList: false,
scrollY: 400,
header: {
style: { margin: '0', padding: '12px 0' },
title: {
size: 'middle',
bordered: true,
innerBordered: false,
ellipsis: false,
sticky: true,
rowSelection: true,
virtual: false,
scrollY: 400,
header: {
style: { margin: '0', padding: '12px 0' },
elements: [
{
type: 'title',
title: '商品列表',
span: 8,
span: 'auto',
html: false,
position: 'topLeft',
align: 'flex-start',
},
search: {
{
type: 'search',
placeholder: '请输入关键字',
allowClear: true,
searchBtnText: '搜索',
searchStyle: { width: 360 },
searchButtonText: '搜索',
style: { width: 360 },
searchKeys: [{ label: '商品', value: 'goods' }, { label: '广告', value: 'advert' }],
searchKeyDefaultValue: 'goods',
span: 13,
position: 'topCenter',
align: 'flex-end',
},
addButton: {
type: 'addButton',
position: 'topRight',
span: 3,
addBtnText: '添加商品',
{
type: 'insert-button',
text: '添加商品',
align: 'flex-end',
showIcon: true,
},
},
pagination: {
pageSize: 10,
size: 'small',
position: 'bottomRight',
showQuickJumper: true,
showSizeChanger: true,
},
{
type: 'display-column-selector',
buttonType: 'primary',
},
],
},
pagination: {
pageSize: 10,
size: 'small',
position: 'bottomRight',
showQuickJumper: true,
showSizeChanger: true,
},
columns: [
{
$id: 'mock_1',
key: 'mock_1',
title: '商品名称',
width: 80,
align: 'center',
Expand All @@ -65,7 +64,7 @@ export const initSchema: DripTableSchema = {
dataIndex: 'name',
},
{
$id: 'mock_2',
key: 'mock_2',
title: '商品详情',
align: 'center',
'ui:type': 'text',
Expand All @@ -77,9 +76,10 @@ export const initSchema: DripTableSchema = {
},
type: 'string',
dataIndex: 'description',
hidable: true,
},
{
$id: 'mock_3',
key: 'mock_3',
title: '库存状态',
width: 150,
align: 'center',
Expand All @@ -92,9 +92,10 @@ export const initSchema: DripTableSchema = {
enumLabel: ['售卖中', '已售罄'],
description: '这是一条提示信息',
dataIndex: 'status',
hidable: true,
},
{
$id: 'mock_4',
key: 'mock_4',
title: '商品价格',
width: 150,
align: 'center',
Expand All @@ -105,27 +106,30 @@ export const initSchema: DripTableSchema = {
},
type: 'number',
dataIndex: 'price',
hidable: true,
},
{
$id: 'mock_5',
key: 'mock_5',
title: '渲染组件',
width: 150,
align: 'center',
'ui:type': 'render-html',
render: "if (rec.id == 1) {\n return '<button onclick=\"alert(\\'123\\');\" style=\\\"padding: 2px 4px;color:#52c41a; border: 1px solid #b7eb8f; border-radius: 3px; background: #f6ffed\\\">进行中</button>';\n}\nif (rec.id == 2) {\n return '<span style=\\\"padding: 2px 4px;color:#999; border: 1px solid #999; border-radius: 3px; background: #f2f2f2\\\">已完成</span>';\n}\nreturn '';",
type: 'number',
dataIndex: 'render',
hidable: true,
},
{
$id: 'mock_6',
key: 'mock_6',
title: '自定义组件',
'ui:type': 'custom::CustomComponentSample',
'ui:props': {},
type: 'string',
dataIndex: 'custom',
hidable: true,
},
{
$id: 'mock_7',
key: 'mock_7',
title: '操作',
align: 'center',
'ui:type': 'links',
Expand All @@ -140,6 +144,7 @@ export const initSchema: DripTableSchema = {
},
type: 'string',
dataIndex: 'operate',
hidable: true,
},
] as unknown as ColumnConfig[],
};
Expand Down
27 changes: 12 additions & 15 deletions docs/drip-table-generator/functions/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,20 @@ import 'drip-table-generator/index.css';

const initialSchema = {
"$schema": "http://json-schema.org/draft/2019-09/schema#",
"configs": {
"pagination": false
},
"pagination": false,
"columns": [
{
"$id": "mock_1",
"dataIndex": "",
"title": "自定义111",
"description": "",
"ui:type": "render-html",
"width": '200px',
"ui:props": {
"render": "if (rec.id == 1) {\r\n return '<span style=\\\"padding: 2px 4px; border: 1px solid #2baa55; border-radius: 2px; background: #99ffad99\\\">壹</span>';\r\n}\r\nreturn '';"
},
"type": "string"
{
"$id": "mock_1",
"dataIndex": "",
"title": "自定义111",
"description": "",
"ui:type": "render-html",
"width": '200px',
"ui:props": {
"render": "if (rec.id == 1) {\r\n return '<span style=\\\"padding: 2px 4px; border: 1px solid #2baa55; border-radius: 2px; background: #99ffad99\\\">壹</span>';\r\n}\r\nreturn '';"
},
"type": "string"
},
]
}

Expand All @@ -70,7 +68,6 @@ export default Demo;
}
```


### 代码演示

```jsx
Expand Down
17 changes: 7 additions & 10 deletions docs/drip-table-generator/preview/custom-component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,19 @@
* hideActions: ["CSB"]
*/

import React from 'react';
import { Button, Row } from 'antd';
import { DripTableSchema } from 'drip-table';
import DripTableGenerator from 'drip-table-generator';
import React from 'react';

import { mockData } from '../../global-configs';
import { mockData } from '../../demo-data';

const initialSchema: DripTableSchema = {
"$schema": "http://json-schema.org/draft/2019-09/schema#",
"configs": {
"pagination": false
},
"columns": [
]
}

$schema: 'http://json-schema.org/draft/2019-09/schema#',
pagination: false,
columns: [
],
};

const Demo = () => {
const generator = React.useRef(null);
Expand Down
22 changes: 10 additions & 12 deletions docs/drip-table-generator/preview/sample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,26 @@
* hideActions: ["CSB"]
*/

import React from 'react';
import { DripTableSchema } from 'drip-table';
import DripTableDriverAntDesign from 'drip-table-driver-antd';
import DripTableGenerator from 'drip-table-generator';
import 'antd/dist/antd.css';
import 'drip-table-generator/index.css';
import './sample.module.less';

import { message } from 'antd';
import { mockData } from '../../global-configs';
import { DripTableSchema } from 'drip-table';
import DripTableDriverAntDesign from 'drip-table-driver-antd';
import DripTableGenerator from 'drip-table-generator';
import React from 'react';

import { mockData } from '../../demo-data';
import components from './component-settings';
import TextComponent from './TextComponent';

import './sample.module.less';

const initialSchema: DripTableSchema = {
$schema: 'http://json-schema.org/draft/2019-09/schema#',
configs: {
pagination: false,
},
pagination: false,
columns: [
{
$id: 'mock_2',
key: 'mock_2',
title: '商品名称',
width: '96px',
'ui:type': 'text',
Expand All @@ -37,7 +35,7 @@ const initialSchema: DripTableSchema = {
dataIndex: 'name',
},
{
$id: 'mock_1',
key: 'mock_1',
dataIndex: '',
title: '自定义',
description: '',
Expand Down
4 changes: 2 additions & 2 deletions docs/drip-table/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ order: 3
title: 常见问题
---

# 常见问题
## 常见问题

### 1、能否不渲染表头表单?

可以,在 `JSON Schema` 标准配置数据的 `configs` 字段中设置 `title: false` 即可。
可以,在 `JSON Schema` 标准配置数据中设置 `title: false` 即可。
Loading