dcdb21d398
* api/ui 改名为 server/client * 微调 * 继续完善 pages * Fix env file and file mode. (#1) * Fix: ignore .env file and environment variable names. * Fix: correct file mode. * fix: put environment variables together * fix: separate data and ui resourcer * feat: collection loader * feat: redirectTo * feat: fields & actions & views * feat: fields & actions * feat: app & pages & collections... * feat: collections & pages & permissions... * Doc: add readme (#2) * Doc: add README.md. * Util: add .editorconfig. * Fix: use glob ignore option instead of additional checking. (#3) * Fix: typo. (#4) * feat: permissions * feat: getCollection & getView actions * refactor: code cleanup Co-authored-by: Junyi <mytharcher@users.noreply.github.com>
52 lines
1.3 KiB
TypeScript
52 lines
1.3 KiB
TypeScript
import React, { useRef } from 'react';
|
|
import { Table as AntdTable, Card } from 'antd';
|
|
import { redirectTo } from '@/components/pages/CollectionLoader/utils';
|
|
import { Actions } from '@/components/actions';
|
|
import ViewFactory from '@/components/views';
|
|
|
|
const dataSource = [];
|
|
for (let i = 0; i < 46; i++) {
|
|
dataSource.push({
|
|
id: i,
|
|
name: `Edward King ${i}`,
|
|
age: 32,
|
|
address: `London, Park Lane no. ${i}`,
|
|
});
|
|
}
|
|
|
|
const columns = [
|
|
{
|
|
title: '姓名',
|
|
dataIndex: 'name',
|
|
key: 'name',
|
|
},
|
|
{
|
|
title: '年龄',
|
|
dataIndex: 'age',
|
|
key: 'age',
|
|
},
|
|
{
|
|
title: '住址',
|
|
dataIndex: 'address',
|
|
key: 'address',
|
|
},
|
|
];
|
|
|
|
export function SimpleTable(props: any) {
|
|
console.log(props);
|
|
const { activeTab, schema } = props;
|
|
const { viewCollectionName, rowViewName, actions = [] } = schema;
|
|
const drawerRef = useRef<any>();
|
|
return (
|
|
<Card bordered={false}>
|
|
<Actions {...props} style={{ marginBottom: 14 }} actions={actions}/>
|
|
<ViewFactory reference={drawerRef} viewCollectionName={viewCollectionName} viewName={rowViewName}/>
|
|
<AntdTable dataSource={dataSource} onRow={(data) => ({
|
|
onClick: () => {
|
|
drawerRef.current.setVisible(true);
|
|
},
|
|
})} columns={columns} />
|
|
</Card>
|
|
);
|
|
}
|