Skip to content
项目

关于

🦹 蚂蚁金服技术团队为 antd4 和 antd3 提供的流程组件。

网站与应用开发

这些数字如何统计

可以做什么

  • Support antd4, antd3
  • The relationship between antd components is expressed using react-hooks, and process components are used to simplify development
  • Process Components are extracted from the actual business processes and used immediately

实测星标增长

24小时
0
7天
0
15天
0
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.zh-CN.md

原文

Sunflower

antd 流程组件

NPM version build status

English | 简体中文

特定

  • 支持 antd4, antd3
  • 将 antd 组件间关系使用 react-hooks 来表述,使用流程组件的方式来简化开发
  • 提炼于业务实际流程,拿来即用

为什么

通常,我们使用 antd 的多个组件来完成一个流程。比如想要完成一个 “使用 Form 搜索后 Table 来展示列表” 的功能,则需要去处理 “Form” 跟 “Table” 的关系,包括查询,分页等。

是否有个方式来简化组件间关系的维护?这就是 sunflower 的作用。能描述某个场景的 react-hooks,我们称之为 “流程组件”。sunflower 就是一系列基于 antd 的流程组件。

以下是一个 “Form & Table” 场景的示例,只需要以下的代码,就可完成包括查询,分页等功能。useFormTable 是一个 react-hooks,会返回 antd 组件的 props 等,将这些 props 给到 antd 组件即可完成组件间的联系。

import React from 'react';
import { useFormTable } from 'sunflower-antd';
import { Input, Button, Table, Form } from 'antd';

export default props => {
  const { formProps, tableProps } = useFormTable({
    async search(values) {
      const res = await request(values);
      return res;
    },
  });

  return (
    <div>
      <Form {...formProps}>
        <Form.Item label="用户名" name="username">
          <Input placeholder="用户名" />
        </Form.Item>

        <Form.Item>
          <Button type="primary" htmlType="submit">
            搜索
          </Button>
        </Form.Item>
      </Form>

      <Table
        columns={[
          {
            title: '用户名',
            dataIndex: 'username',
            key: 'username',
          },
        ]}
        {...tableProps}
      />
    </div>
  );
};

快速开始

使用

$ npm i sunflower-antd --save
// or
$ yarn add sunflower-antd

开发

$ yarn
$ yarn start

探索相关项目

加载中…