-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6b452d1
Showing
37 changed files
with
11,793 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
import { defineConfig } from 'dumi'; | ||
const isDev = process.env.NODE_ENV === 'development'; | ||
|
||
export default defineConfig({ | ||
themeConfig: { | ||
name: 'lighting-design', | ||
logo: isDev | ||
? '/lighting-design.png' | ||
: '/lighting-design/lighting-design-192x192.png', | ||
footer: | ||
'Open-source MIT Licensed | Copyright © 2023<br />Powered by [llq0802](https://github.com/llq0802)', | ||
socialLinks: { | ||
github: 'https://github.com/llq0802', | ||
}, | ||
nav: [ | ||
{ title: '指南', link: '/guide' }, | ||
{ title: '组件', link: '/components' }, | ||
], | ||
sidebar: { | ||
'/components': [ | ||
{ | ||
title: '架构设计', | ||
children: [ | ||
{ | ||
title: 'Components - 组件设计', | ||
link: 'components', | ||
}, | ||
{ | ||
title: 'Schema - 通用配置', | ||
link: '/components/schema', | ||
}, | ||
], | ||
}, | ||
{ | ||
title: '布局', | ||
children: [ | ||
{ | ||
title: 'ProLayout - 高级布局', | ||
link: '/components/layout', | ||
}, | ||
{ | ||
title: 'PageContainer - 页容器', | ||
link: '/components/page-container', | ||
}, | ||
{ | ||
title: 'ProCard - 高级卡片', | ||
link: '/components/card', | ||
}, | ||
{ | ||
title: 'WaterMark - 水印组件', | ||
link: '/components/water-mark', | ||
}, | ||
{ | ||
title: 'StatisticCard - 指标卡', | ||
link: '/components/statistic-card', | ||
}, | ||
{ | ||
title: 'CheckCard - 多选卡片', | ||
link: '/components/check-card', | ||
}, | ||
], | ||
}, | ||
{ | ||
title: '数据录入', | ||
children: [ | ||
{ | ||
title: 'ProForm - 高级表单', | ||
link: '/components/form', | ||
}, | ||
{ | ||
title: 'ProFormFields - 表单项', | ||
link: '/components/field-set', | ||
}, | ||
{ | ||
title: 'ProFormList - 数据结构化', | ||
link: '/components/group', | ||
}, | ||
{ | ||
title: 'ProFormDependency - 数据联动', | ||
link: '/components/dependency', | ||
}, | ||
{ | ||
title: 'Schema Form - JSON 表单', | ||
link: '/components/schema-form', | ||
}, | ||
{ | ||
title: ' Query/LightFilter - 筛选表单', | ||
link: '/components/query-filter', | ||
}, | ||
{ | ||
title: 'StepsForm - 分步表单', | ||
link: '/components/steps-form', | ||
}, | ||
{ | ||
title: 'Modal/Drawer - 浮层表单', | ||
link: '/components/modal-form', | ||
}, | ||
{ | ||
title: 'LoginForm/Page - 登录表单', | ||
link: '/components/login-form', | ||
}, | ||
], | ||
}, | ||
{ | ||
title: '数据展示', | ||
children: [ | ||
{ | ||
title: 'ProTable - 高级表格', | ||
link: '/components/table', | ||
}, | ||
{ | ||
title: 'EditableProTable - 可编辑表格', | ||
link: '/components/editable-table', | ||
}, | ||
{ | ||
title: ' DragSortTable - 拖动排序表格', | ||
link: '/components/drag-sort-table', | ||
}, | ||
{ | ||
title: 'ProList - 高级列表', | ||
link: '/components/list', | ||
}, | ||
{ | ||
title: 'ProDescriptions - 定义列表', | ||
link: '/components/descriptions', | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
}, | ||
|
||
outputPath: 'docs-dist', | ||
hash: true, | ||
ignoreMomentLocale: true, | ||
favicons: isDev | ||
? ['/lighting-design.png'] | ||
: ['/lighting-design/lighting-design.png'], | ||
|
||
styles: [ | ||
` | ||
.dumi-default-sidebar { | ||
min-width: 260px; | ||
} | ||
.dumi-default-previewer-demo { | ||
min-height: 120px; | ||
display: flex; | ||
overflow: auto; | ||
flex-direction: column; | ||
} | ||
.dumi-default-content-tabs{ | ||
margin: -24px -48px 48px !important; | ||
} | ||
.dumi-default-header:not([data-static]){ | ||
border-bottom: 1px solid #ddd; | ||
} | ||
.dumi-default-header-left { | ||
min-width: 230px; | ||
margin-right: 32px; | ||
} | ||
.dumi-default-header-left .dumi-default-logo{ | ||
color: #5581a6 | ||
} | ||
`, | ||
], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# http://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
extends: require.resolve('@umijs/lint/dist/config/eslint'), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { defineConfig } from 'father'; | ||
|
||
export default defineConfig({ | ||
// more father config: https://github.com/umijs/father/blob/master/docs/config.md | ||
esm: { output: 'dist' }, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
node_modules | ||
/dist | ||
.dumi/tmp | ||
.dumi/tmp-test | ||
.dumi/tmp-production | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npx commitlint --edit "${1}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npx lint-staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/dist | ||
*.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module.exports = { | ||
pluginSearchDirs: false, | ||
plugins: [ | ||
require.resolve('prettier-plugin-organize-imports'), | ||
require.resolve('prettier-plugin-packagejson'), | ||
], | ||
printWidth: 80, | ||
proseWrap: 'never', | ||
singleQuote: true, | ||
trailingComma: 'all', | ||
overrides: [ | ||
{ | ||
files: '*.md', | ||
options: { | ||
proseWrap: 'preserve', | ||
}, | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "@umijs/lint/dist/config/stylelint" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# lighting-design | ||
|
||
[](https://npmjs.org/package/lighting-design) | ||
[](https://npmjs.org/package/lighting-design) | ||
|
||
A react library developed with dumi | ||
|
||
## Usage | ||
|
||
TODO | ||
|
||
## Options | ||
|
||
TODO | ||
|
||
## Development | ||
|
||
```bash | ||
# install dependencies | ||
$ yarn install | ||
|
||
# develop library by docs demo | ||
$ yarn start | ||
|
||
# build library source code | ||
$ yarn run build | ||
|
||
# build library source code in watch mode | ||
$ yarn run build:watch | ||
|
||
# build docs | ||
$ yarn run docs:build | ||
|
||
# check your project for potential problems | ||
$ yarn run doctor | ||
``` | ||
|
||
## LICENSE | ||
|
||
MIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
--- | ||
title: 组件总览 | ||
order: 0 | ||
--- | ||
|
||
# 架构设计 | ||
|
||
ProComponents 是基于 Ant Design 而开发的模板组件,提供了更高级别的抽象支持,开箱即用。可以显著的提升制作 CRUD 页面的效率,更加专注于页面。 | ||
|
||
- [ProLayout](/components/layout) 解决布局的问题,提供开箱即用的菜单和面包屑功能 | ||
- [ProTable](/components/table) 表格模板组件,抽象网络请求和表格格式化 | ||
- [ProForm](/components/form) 表单模板组件,预设常见布局和行为 | ||
- [ProCard](/components/card) 提供卡片切分以及栅格布局能力 | ||
- [ProDescriptions](/components/descriptions) 定义列表模板组件,ProTable 的配套组件 | ||
- [ProSkeleton](/components/skeleton) 页面级别的骨架屏 | ||
|
||
> 如果您是阿里内网用户,欢迎尝试使用 [TechUI](https://techui.alipay.com)。TechUI 在封装 ProComponents 的基础上还提供了丰富的 Ant Design 扩展组件。 | ||
## 与网络请求库配置使用 | ||
|
||
ProTable,ProList 使用了新的数据结构,如果你使用了我们约定的参数使用起来会非常简单。 | ||
|
||
```tsx | pure | ||
const msg: { | ||
data: T[]; | ||
page: number; | ||
success: boolean; | ||
total: number; | ||
} = { | ||
data: [], | ||
page: 1, | ||
success: true, | ||
total: 0, | ||
}; | ||
``` | ||
|
||
如果你的后端数据使用了自己熟悉的 url,虽然我们可以用 umi 的 request 来转化,但是每个 table 都需要配置就比较麻烦。如果你使用 umi 的 request,我们可以定义一个全局的转化器。我们需要在 app.tsx 中配置 | ||
|
||
```tsx | pure | ||
import { request, RequestConfig } from 'umi'; | ||
|
||
export const request: RequestConfig = { | ||
errorConfig: { | ||
adaptor: (resData) => { | ||
// resData 是我们自己的数据 | ||
return { | ||
...resData, | ||
total: resData.sum, | ||
success: resData.ok, | ||
errorMessage: resData.message, | ||
}; | ||
}, | ||
}, | ||
}; | ||
|
||
<ProTable request={request('/list')} />; | ||
``` | ||
|
||
如果使用了 fetch ,可以对 fetch 进行自定义。 | ||
|
||
```tsx | pure | ||
const request = (url, options) => { | ||
return fetch(url, options) | ||
.then((res) => res.json()) | ||
.then((resData) => { | ||
return Promise.resolve({ | ||
...resData, | ||
total: resData.sum, | ||
success: resData.ok, | ||
errorMessage: resData.message, | ||
}); | ||
}); | ||
}; | ||
|
||
// 使用时 | ||
<ProTable request={request('/list')} />; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This is a guide example. |
Oops, something went wrong.