Skip to content
This repository has been archived by the owner on Jun 13, 2023. It is now read-only.

Commit

Permalink
fix(#1): 增加测试用例,修复 bug (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
dream2023 authored Jun 8, 2021
1 parent 8d3207c commit 16e50d1
Show file tree
Hide file tree
Showing 111 changed files with 15,766 additions and 1,479 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ module.exports = {
rules: {
'import/no-extraneous-dependencies': 0,
'import/no-unresolved': 0,
'prefer-object-spread': 0,
},
};
22 changes: 22 additions & 0 deletions .github/workflows/gitee.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Sync to Gitee

on: [ push, delete, create ]

jobs:
deploy:
runs-on: ubuntu-18.04
steps:
- name: Sync to Gitee
uses: wearerequired/git-mirror-action@master
env:
SSH_PRIVATE_KEY: ${{ secrets.GITEE_RSA_PRIVATE_KEY }}
with:
source-repo: git@github.com:dream2023/super-antd.git
destination-repo: git@gitee.com:dream2023/super-antd.git
- name: Build Gitee Pages
uses: yanglbme/gitee-pages-action@main
with:
gitee-username: dream2023
gitee-password: ${{ secrets.GITEE_PASSWORD }}
gitee-repo: dream2023/super-antd
branch: main
28 changes: 5 additions & 23 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,14 @@ jobs:
steps:
- uses: actions/checkout@v2
- run: yarn
# - run: yarn test:coverage
# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v1
# with:
# files: ./coverage/clover.xml
# directory: ./coverage/lcov-report/
# name: codecov-umbrella
# fail_ci_if_error: true
# verbose: true
- run: yarn test:coverage
- name: Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
- run: yarn docs:build
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs-dist
- name: Sync to Gitee
uses: wearerequired/git-mirror-action@master
env:
SSH_PRIVATE_KEY: ${{ secrets.GITEE_RSA_PRIVATE_KEY }}
with:
source-repo: git@github.com:dream2023/super-antd.git
destination-repo: git@gitee.com:dream2023/super-antd.git
- name: Build Gitee Pages
uses: yanglbme/gitee-pages-action@main
with:
gitee-username: dream2023
gitee-password: ${{ secrets.GITEE_PASSWORD }}
gitee-repo: dream2023/super-antd
branch: main
20 changes: 20 additions & 0 deletions .umirc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,24 @@ export default defineConfig({
'antd',
],
],
navs: [
{
title: '生态',
children: [
{
title: 'react-schema-render 动态渲染',
path: 'https://gitee.com/dream2023/react-schema-render',
},
{
title: '@dream2023/data-mapping 数据映射',
path: 'https://gitee.com/dream2023/data-mapping',
},
],
},
null,
{
title: 'GitHub',
path: 'https://github.com/dream2023/super-antd',
},
],
});
73 changes: 54 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,84 @@
# super-antd
<h1 align="center">super-antd</h1>
<div align="center">

`super-antd` 是一个基于 [ant design](https://ant.design/)[pro-components](https://procomponents.ant.design/) 的数据驱动友好、易用且强大的 UI 库。
[![Codecov](https://img.shields.io/codecov/c/github/dream2023/super-antd?token=BKaeenZ4wi)](https://codecov.io/gh/dream2023/super-antd) [![GitHub Discussions](https://img.shields.io/github/discussions/dream2023/super-antd?label=吐槽/讨论)](https://github.com/dream2023/super-antd/discussions) [![文档](https://img.shields.io/static/v1?label=Docs&message=文档&color=blue)](https://dream2023.github.io/super-antd) [![GitHub Repo stars](https://img.shields.io/github/stars/dream2023/super-antd)](https://github.com/dream2023/super-antd) [![star](https://gitee.com/dream2023/super-antd/badge/star.svg?theme=dark)](https://gitee.com/dream2023/super-antd)

[![npm](https://img.shields.io/npm/v/super-antd)](https://www.npmjs.com/package/super-antd) [![npm](https://img.shields.io/npm/dt/super-antd)](https://www.npmjs.com/package/super-antd) [![David](https://img.shields.io/david/dream2023/super-antd)](https://github.com/dream2023/super-antd) [![GitHub top language](https://img.shields.io/github/languages/top/dream2023/super-antd)](https://github.com/dream2023/super-antd) [![github pages](https://github.com/dream2023/super-antd/actions/workflows/workflow.yml/badge.svg)](https://github.com/dream2023/super-antd/actions/workflows/workflow.yml)

</div>

`super-antd` 是一个简单且数据驱动友好的 React 组件库。

它基于 [ant design](https://ant.design/)[pro-components](https://procomponents.ant.design/)

## 📖 Document

[https://dream2023.github.io/super-antd](https://dream2023.github.io/super-antd)

## ✨ Feature

- 数据驱动友好:通过在组件层级解决动态渲染、通信、联动等难题,极大增加低代码场景的灵活度
- 简单、易用:通过对业务场景的提炼,进行了大量组件的组织易封装,做到了比已知的任何 ant design 封装库简单
- 简单:通过对大量业务场景的提炼和抽象,使得其十分简单;
- 数据驱动友好:在组件层级解决了动态渲染、通信、联动等难题;
- 稳定:Typescript 编写 + 高测试覆盖率;

## 🤔 Why?

业界尤其是一线程序员关于低代码有很多负面评价,例如**行业毒瘤****拖拽一时爽,重构火葬场**等。

这些负面评价当然不是空穴来风,而是由于很多低代码系统在开始做时经验不足,导致整体架构**灵活性、扩展性差**,随着业务发展,低代码平台已无法满足个性化需求,无奈之下,只能从头写一遍。

所以低代码平台的核心在于其**灵活性**,那如何尽可能增加其灵活性呢?

很多低代码系统走了弯路,在低代码编辑器上做各种骚操作,例如各种钩子的注入,让用户在界面上写恶心人的函数等,这样的最终后果就是上层编辑器越来越臃肿,并最终难以适应需求的变化而废弃。

`super-antd` 则给出了一条不一样的路,在组件层级解决灵活性的问题,例如 `联动``数据映射``schema 渲染``组件间通信`,这样上层的低代码编辑器只是一层简单的封装和组合,并无复杂的逻辑。

而且 `super-antd` 本身其实就是一个普通的 `antd` 组件库,当低代码编辑器真的无法满足需求而需要重构,导出的代码也和程序员真实开发时写的一样,这样就极大的降低重构的风险和成本,这就是为什么要写 `super-antd`

## 🎯 Roadmap

- [x] 0.1 alpha 版:完成框架基础(schema 渲染、组件通信、数据请求、数据联动)和表单组件(表单组件、表单项组件、内置表单组件)
- [ ] 0.1 正式版:测试覆盖率 80% 以上、完成 100% 文档、0️⃣ bug
- [ ] 0.2 版:增加各种扩展的表单组件(富文本组件、地图组件、上传组件、代码编辑器组件...),覆盖 95% 表单组件场景
- [ ] 0.3 版:增加各种与表单关联的组件(Dialog 弹窗组件、Tabs 选项卡组件...)
- [ ] 0.4 版:Table 表格组件、Table + Form 组件
- [ ] 0.5 版:Page 组件
- [ ] 0.6 版:图标类组件
- [ ] ...
- [x] 0.1 alpha 版
- [x] [数据模板](https://dream2023.github.io/super-antd/guide/concept/template)
- [x] [数据联动](https://dream2023.github.io/super-antd/guide/concept/linkage)
- [x] [数据请求](https://dream2023.github.io/super-antd/guide/concept/api)
- [x] [schema 动态渲染](https://dream2023.github.io/super-antd/guide/concept/schema)
- [x] [表单组件](https://dream2023.github.io/super-antd/components/form)
- [x] [表单项组件](https://dream2023.github.io/super-antd/components/form/form-item)
- [x] [内置表单组件](https://dream2023.github.io/super-antd/components/form/form-components)
- [ ] 0.1 正式版
- [ ] 测试覆盖率 80% 以上
- [ ] 完成 100% 文档
- [ ] 0️⃣ issue
- [ ] 1.0 版
- [ ] 模板组件
- [ ] 富文本组件
- [ ] 上传图片组件
- [ ] 上传视频组件
- [ ] 代码编辑器组件
- [ ] ...

更详细规划请见 [https://github.com/dream2023/super-antd/projects](https://github.com/dream2023/super-antd/projects)

## 👬 Ecosystem

其实 `super-antd` 仅是一个大系统中的一部分,我个人是希望做一个支 **\*持海量组件的高扩展通用型** 的低代码平台,此平台包括以下组件部分:
其实 `super-antd` 仅是一个大系统中的一部分,我个人是希望做一个支 **持海量组件的高扩展通用型** 的低代码平台,此平台包括以下组件部分:

| Project | Status | Description |
| --- | --- | --- |
| react-schema-render | ![react-schema-render](https://img.shields.io/npm/v/react-schema-render?style=flat-square) | 通用型 schema 转 React 组件的工具组件 |
| @dream2023/data-mapping | ![@dream2023/data-mapping](https://img.shields.io/npm/v/@dream2023/data-mapping?style=flat-square) | 数据模板映射方案 |
| super-antd | ![super-antd](https://img.shields.io/npm/v/super-antd?style=flat-square) | 数据驱动友好、易用且强大的 UI 库 |
| super-antd | ![super-antd](https://img.shields.io/npm/v/super-antd?style=flat-square) | 简单且数据驱动友好的 React 组件库 |

此外至少还有以下系统待开发:

- 基于 `super-antd` 属性面板系统
- 组件库无关的低代码编辑器
- 一个开放性的组件市场
- 基于 `super-antd` 属性面板系统(时间点:组件库发布 0.3 版后)
- 组件库无关的低代码编辑器(时间点:属性面板完成后)
- 一个开放性的组件市场(时间点:低代码编辑器完成后)

虽然要做的东西很多,但整体思路还是很清晰的,期待都实现的一天。

## Support
## support

如果你觉得项目对自己和公司有用,请跳转到 [gitee](https://gitee.com/dream2023/super-antd#Support) 底部进行打赏,并且可以多留言鼓励作者一下,你的支持就是我更新的动力!
开源不易,如果你觉得项目对自己和公司有用,请跳转到 [gitee](https://gitee.com/dream2023/super-antd#Support) 底部进行打赏,并且可以多留言鼓励作者一下,你的支持就是我更新的动力!

[![reward](./reward.png)](https://gitee.com/dream2023/super-antd#support)
28 changes: 13 additions & 15 deletions docs/components/__demos__/form-components/all.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { message } from 'antd';
import axios from 'axios';
import Mock from 'mockjs';
import React, { useState } from 'react';

import {
Expand Down Expand Up @@ -51,9 +50,8 @@ const App = () => {
const [hideLabel, toggleHideLabel] = useState(false);
const [autoPlaceholder, toggleAutoPlaceholder] = useState(true);
return (
<SuperProvider axios={axios} mockjs={Mock}>
<SuperProvider axios={axios}>
<SuperForm
mock
layout="vertical"
readonly={readonly}
disabled={disabled}
Expand Down Expand Up @@ -157,18 +155,18 @@ const App = () => {
label="支持搜索查询的 Select"
request={async ({ keyWords = '' }) => {
await waitTime(1000);
const list = Mock.mock({
'data|1-10': [
{
value: '@id',
label: '@name',
},
],
}).data.concat({
value: keyWords,
label: '目标_target',
});
return list;
const list = Array.from({ length: 10 })
.map((item, index) => {
return {
value: index,
label: '模板-' + index,
};
})
.concat({
value: keyWords,
label: '目标_target',
});
return { data: list };
}}
/>
</SuperGroup>
Expand Down
2 changes: 0 additions & 2 deletions docs/components/__demos__/form-item/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ export interface FormItemProps {
clearValueAfterDisabled?: boolean;
/** 当表单项只读以后,是否清除其值。 */
clearValueAfterReadonly?: boolean;
/** Mock 数据 */
mock?: any;
/** 是否隐藏 label。当我们想要保留 label 作为校检的名称,又不想显示 label 时,可以将其设置为 true。 */
hideLabel?: boolean;
}
Expand Down
17 changes: 0 additions & 17 deletions docs/components/__demos__/form/mock_basic.tsx

This file was deleted.

17 changes: 0 additions & 17 deletions docs/components/__demos__/form/mock_builtin.tsx

This file was deleted.

17 changes: 0 additions & 17 deletions docs/components/__demos__/form/mock_formitem.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions docs/components/__demos__/form/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ export interface IFormDemoProps {
wrapperCol?: ColProps | number | string;
/** 是否根据表单父元素宽度动态设置 labelCol 和 wrapperCol */
isResponsive?: boolean;
/** 模拟数据 当为 true 时表单项应用自身内置规则 当为 Record<string, any> 表示 mock 规范 */
mock?: true | Record<string, any>;
/**
* 防抖时间(毫秒) 对值变化后的相应处理
*
Expand Down
2 changes: 1 addition & 1 deletion docs/components/__demos__/options/clear_value.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import axiosInstance from './axios-instance';
const App = () => {
return (
<SuperProvider axios={axiosInstance}>
<SuperForm>
<SuperForm debug>
<SuperSelect
name="province"
label="省份"
Expand Down
11 changes: 1 addition & 10 deletions docs/components/__demos__/select/basic.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
import mockjs from 'mockjs';
import React from 'react';

import { SuperCheckboxGroup, SuperForm, SuperProvider, SuperSearchSelect } from 'super-antd';

import axiosInstance from './axios-instance';

// const getUsers: ApiFunction = async (data, params, { keywords }) => {
// const res = await axiosInstance('http://jsonplaceholder.typicode.com/users?type=' + keywords);
// const list = Object.values(res);
// return list.filter((item) => item.name.includes(keywords));
// };

const App = () => {
return (
<SuperProvider mockjs={mockjs} axios={axiosInstance}>
<SuperProvider axios={axiosInstance}>
<SuperForm initialValues={{ type: 1 }} debug>
<SuperCheckboxGroup
mock
label="混合类型"
name="mixed"
options={['123', 345, { label: 'jack', value: 1 }]}
Expand All @@ -35,7 +27,6 @@ const App = () => {
<SuperRadioGroup
label="类型"
name="type"
mock
options={[
{ label: '类型1', value: 1 },
{ label: '类型2', value: 2 },
Expand Down
Loading

0 comments on commit 16e50d1

Please sign in to comment.