Skip to content

Commit

Permalink
Merge branch 'feature' of https://github.com/juicecube/mlz-admin into…
Browse files Browse the repository at this point in the history
… release
  • Loading branch information
milobluebell committed Nov 30, 2020
2 parents 0cd1761 + 5a6b51a commit 9eecfbb
Show file tree
Hide file tree
Showing 123 changed files with 1,781 additions and 29,534 deletions.
2 changes: 1 addition & 1 deletion .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"status": {
"project": {
"default": {
"threshold": 0.70
"threshold": 20%
}
}
}
Expand Down
16 changes: 7 additions & 9 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
},
settings: {
react: {
version: '16.12',
version: '16.9',
},
},
parser: '@typescript-eslint/parser',
Expand All @@ -17,9 +17,7 @@ module.exports = {
{
files: ['*.tsx'],
rules: {
'react/destructuring-assignment': 0,
'react/jsx-filename-extension': 0,
'react/destructuring-assignment': 1,
'react/prop-types': 0,
'react/jsx-props-no-spreading': 0,
'react/state-in-constructor': 0,
Expand Down Expand Up @@ -48,22 +46,22 @@ module.exports = {
'prefer-object-spread': 0,
'prefer-template': 0,
'import/no-named-default': 1,
'no-unused-expressions': 1,
'no-unused-expressions': 0,
'no-underscore-dangle': 0,
'import/order': 0,
'import/first': 1,
'import/newline-after-import': 0,
'no-use-before-define': 1,
'no-use-before-define': 2,
'react/display-name': 0,
'no-param-reassign': 0,
'no-unused-vars': 0,
'no-console': 0,
'jsx-a11y/anchor-is-valid': 0,
'no-console': 1,
'jsx-a11y/anchor-is-valid': 1,
'react/jsx-props-no-spreading': 0,
'consistent-return': 0,
'consistent-return': 1,
'no-throw-literal': 1,
'no-restricted-globals': 1,
'no-return-assign': 0,
'no-plusplus': 1,
'no-plusplus': 0,
},
};
4 changes: 2 additions & 2 deletions .fatherrc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ export default {
tsconfig: 'tsconfig.dist.json',
}),
],
extraBabelPlugins: [['import', { libraryName: 'antd', style: false }]],
extraBabelPlugins: [['import', { libraryName: 'antd', style: true }]],
target: 'browser',
inject: {
'window.__DEV__': 'false',
'window.__DEV__': false,
},
replace: {
VERSION: JSON.stringify(require('./package').version),
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/checkers.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
name: checker
name: checkers

on:
push:
branches:
- master
- hotfix
- 'sprint/*'
- 'hotfix/*'
- 'feat/*'
pull_request:
types: [opened, reopened, edited]
types: [opened,reopened,edited,synchronize]

jobs:
install:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/npm-pub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
types: [closed]
branches:
- release
- 'release/*'

jobs:
publish:
Expand Down
43 changes: 41 additions & 2 deletions .umirc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,41 @@ const getMds = ($relativedFromDoc) => {
return files;
};

const { SENTRY_DSN, VERCEL_ENV } = process.env;
const productionConf =
VERCEL_ENV === 'production'
? {
externals: {
'@sentry/browser': 'window.sentry',
'@sentry/tracing': 'window.sentryTracing',
},
scripts: ['https://unpkg.com/browse/[email protected]/umd/react.production.min.js'],
headScripts: [
{
content: `window.process.env = ${process.env}`,
charset: 'utf-8',
},
{
content: `sentry.init({
dsn: ${SENTRY_DSN},
integrations: [
new sentryTracing.BrowserTracing(),
],
tracesSampleRate: 1.0,
})`,
charset: 'utf-8',
},
],
}
: {};

export default defineConfig({
hash: true,
title: '@mlz/admin',
mode: 'site',
favicon: '/assets/logo.36.png',
logo: '/assets/logo.360.png',
locales: [['中文']],
locales: [['zh-CN', '中文']],
menus: {
'/components': [
{
Expand Down Expand Up @@ -49,7 +77,7 @@ export default defineConfig({
{ title: 'Libra投放系统', path: 'https://libra.codemao.cn/' },
{ title: '行政综合支撑平台', path: 'https://support-admin.codemao.cn/' },
{ title: 'LuckyCat营销管理系统', path: 'https://luckycat-admin.codemao.cn/' },
// { title: '供应链管理', path: 'coming' },
{ title: 'SCM供应链管理系统', path: 'https://supply-chain-manage-admin.codemao.cn/' },
],
},
{
Expand All @@ -66,4 +94,15 @@ export default defineConfig({
'@c-link': '#1890FF',
'@s-nav-height': '76px',
},
metas: [
{
name: 'keywords',
content: 'react, components, 编程猫, antd',
},
{
name: 'description',
content: '一套编程猫设计规范下的管理系统React组件库,基于Antd',
},
],
...productionConf,
});
15 changes: 9 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,23 @@

## 🤝 协作方式

@mlz/admin 采用开源项目的管理方式,请您将项目 fork 到**自身目录**下进行 coding。代码编写完成之后,提交到 remote origin 的对应 branch,**而非 upstream****在确定自身 forkded 项目的 checkers 钩子全部 run success 后**,从**自身目录 remote origin**的 master/spring/feat/hotfix 分支发起 pull request 到 juicecube/mlz-admin 的对应**sprint****feature** 分支,创建时的界面应如下图 👇:
@mlz/admin 采用开源项目的管理方式,请您将项目 fork 到**自身目录**下进行 coding。代码编写完成之后,提交到 remote origin 的对应 branch,**而非 upstream****在确定自身 forkded 项目的 checkers 钩子全部 run success 后**,从**自身目录 remote origin**的 master/spring/feat/hotfix 分支发起 pull request 到 juicecube/mlz-admin 的对应**sprint****feature** 分支。整个流程如下 👇:

![create PR](https://raw.githubusercontent.com/milobluebell/imgs-repo/master/WX20201105-1130223.png)

创建 PR 时你所看到的界面应如下图 👇:

![create PR](https://raw.githubusercontent.com/milobluebell/imgs-repo/master/WX20200709-182741.png)

> 除上述文档中契约之外,额外要求:
>
> 1. 所有代码必须通过部署在对应分支 push 触发的 Actions Checkers 后再发起向 upstream 的非 release 分支的 Pull Request。
> 2. feat 和 fix 功能,原则上应该配有覆盖率不低于 **85%** 的自测用例。
> 3. 需要得到至少 1 位管理员的 review 才能合并 PR。¸
> 4. 非编程猫官方的人员维护此库时只须遵循 antd 的贡献指南: [《ant-design 新特性提交规范》](https://github.com/ant-design/ant-design/wiki/PR-%E8%A7%84%E8%8C%83#ant-design-%E6%96%B0%E7%89%B9%E6%80%A7%E6%8F%90%E4%BA%A4%E8%A7%84%E8%8C%83)
> 1. 所有代码必须通过部署在对应分支 push 触发的 checkers 检测成功后,再发起向 Pull Request。以减少不必要的 PR 和 code review。
> 2. PR 表单请如实认真填写。
> 3. 非编程猫官方的人员维护此库时只须遵循 antd 的贡献指南: [《ant-design 新特性提交规范》](https://github.com/ant-design/ant-design/wiki/PR-%E8%A7%84%E8%8C%83#ant-design-%E6%96%B0%E7%89%B9%E6%80%A7%E6%8F%90%E4%BA%A4%E8%A7%84%E8%8C%83)
## 🏭 Git.flow 管理

@mlz/admin 要求采用编程猫现有的 git flow 管理规范对 GIT.Flow 进行管理:[《编程猫前端 Git Flow》](https://shimo.im/docs/aBAYV4XJdXfn8d3j)
@mlz/admin 要求采用编程猫现有的 git flow 管理规范对 GIT.Flow 进行管理:[《编程猫前端 Git Flow》](https://shimo.im/docs/aBAYV4XJdXfn8d3j)

## 🏅 需求分配和领取

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
@mlz/admin,遵循编程猫后台管理系统设计规范的 React 组件库。
</p>
<p align="center" style="font-size: 32px">
🌈 https://mlz-admin.now.sh
🌈 https://mlz-admin.com
</p>
<div align="center">

[![codecov](https://codecov.io/gh/juicecube/mlz-admin/branch/master/graph/badge.svg?token=ZNPL3AMQ7Z)](undefined) ![Codacy](https://app.codacy.com/project/badge/Grade/999d89d9099e41ef81b9af94c98a8726) ![Action Checkers](https://github.com/juicecube/mlz-admin/workflows/checker/badge.svg) ![Npm Version](https://img.shields.io/npm/v/@mlz/admin?color=42b983&label=%40mlz%2Fadmin&logo=42b983&logoColor=42b983)
![codecov](https://codecov.io/gh/juicecube/mlz-admin/branch/master/graph/badge.svg?token=ZNPL3AMQ7Z) ![codacy](https://app.codacy.com/project/badge/Grade/4fe6e8e25e00469d8973f63320fa77c0) ![action checkers](https://github.com/juicecube/mlz-admin/workflows/checker/badge.svg) ![npm version](https://img.shields.io/npm/v/@mlz/admin?color=42b983&label=%40mlz%2Fadmin&logo=42b983&logoColor=42b983)

</div>

Expand Down Expand Up @@ -44,7 +44,7 @@ $ npm start

也可以加入我们的钉钉群,与我们分享你的想法和建议:

<img src="https://raw.githubusercontent.com/milobluebell/imgs-repo/master/WechatIMG9.jpeg" width="346" alt="Dingtalk Qrcode"/>
<img src="https://raw.githubusercontent.com/milobluebell/imgs-repo/master/WechatIMG9.jpeg" width="316" alt="Dingtalk Qrcode"/>

---

Expand Down
File renamed without changes.
19 changes: 19 additions & 0 deletions docs/components/_site/committers/index.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.committers-wrapper {
border-top: 1px solid #ebedf1;
padding-top: 34px;
margin-top: 34px;
position: relative;
.joinus-btn {
position: absolute;
right: 0;
top: 24px;
z-index: 1001;
}
ul {
list-style: none;
padding: 0;
li {
margin-bottom: 12px;
}
}
}
87 changes: 87 additions & 0 deletions docs/components/_site/committers/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import React, { useState, useEffect, CSSProperties } from 'react';
import axios from 'axios';
import { Avatar, Tooltip, Typography, Spin, Button, Icon, Affix } from '@mlz/admin';
import { uniqBy } from 'lodash-es';
import { getPaths } from '../../../../src/shared/utils';
import './index.less';

const getDocCommits = ($path: string) => axios.get('https://api.github.com/repos/juicecube/mlz-admin/commits?per_page=100&path=' + $path + '&sha=master');
const getCompCommits = ($path: string) => axios.get('https://api.github.com/repos/juicecube/mlz-admin/commits?per_page=100&path=' + $path + '&sha=master');
const getAuthorFromData = ($oneCommit) => {
const author = $oneCommit.author || $oneCommit.commit.author;
return {
id: author.id || author.name,
name: author.login || author.name,
html_url: author.html_url,
avatar_url: author.avatar_url || author.name,
};
};
const TheAvatar = (props: { item: any; alternatives: string[]; rand: number; style?: CSSProperties }) => {
const { item, alternatives, rand, style } = props;
return (
<Avatar src={item.avatar_url} style={{ marginRight: 2, backgroundColor: alternatives[rand], ...style }}>
{item.avatar_url[0].toUpperCase()}
</Avatar>
);
};
export default () => {
const [commits, setCommits] = useState<any[]>([]);
const [loading, toggoleLoading] = useState(true);
const { docPath, componentPath, antdDocPath } = getPaths();
useEffect(() => {
Promise.all([getDocCommits(docPath), getCompCommits(componentPath)])
.then((res: any[]) => {
setCommits(res.map((res_i) => res_i.data.map((commit) => getAuthorFromData(commit))));
toggoleLoading(false);
})
.catch(() => toggoleLoading(false));
}, []);
return (
<div className="committers-wrapper">
<Affix offsetBottom={66}>
<Button className="joinus-btn" type="primary" onClick={() => window.open(antdDocPath)} icon={<Icon type="file_search_l" />}>
在 Ant Design 中查看
</Button>
</Affix>
<Spin spinning={loading}>
<ul>
{(() => {
const alternatives = ['#1890ff', '#00a2ae', '#ffbf00', '#a9d5fe', '#7265e6'];
const rand = parseInt(Math.random() * alternatives.length + '', 10);
return commits.map((commitType, index) => {
const commiters = uniqBy(commitType, 'id');
return (
<li key={index}>
<span className="commit-title">
<Typography.Text type="secondary">{index === 0 ? '文档贡献者' : '组件贡献者'}</Typography.Text>
</span>
<span className="committers">
<Avatar.Group>
{(commiters.length &&
commiters.map((item: any) => {
return item ? (
<Tooltip title={item.name} placement={index === 0 ? 'top' : 'bottom'} key={item.login}>
{item.html_url ? (
<a href={item.html_url} target="_blank">
<TheAvatar {...{ rand, alternatives, item }} />
</a>
) : (
<span>
<TheAvatar {...{ rand, alternatives, item }} />
</span>
)}
</Tooltip>
) : null;
})) ||
'--'}
</Avatar.Group>
</span>
</li>
);
});
})()}
</ul>
</Spin>
</div>
);
};
27 changes: 27 additions & 0 deletions docs/components/_site/communital-commits-calculator/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React, { useState, useEffect } from 'react';
import axios from 'axios';
import { Typography } from '@mlz/admin';

const getDocCommits = axios.get('https://api.github.com/repos/juicecube/mlz-admin/commits?per_page=100');
const collaborators = [19811291, 11535146];
export default () => {
const [ratio, setRatio] = useState<number>(0);
useEffect(() => {
getDocCommits.then((res: { data: any[] }) => {
const commitsCountsNotFromCommunity = res.data.filter((commit) => collaborators.includes(commit?.author?.id) && commit.html_url).length;
const commitsCountsFromCommunity = 100 - commitsCountsNotFromCommunity;
setRatio(commitsCountsFromCommunity / 100);
});
}, []);
const interactiveLevel = ratio < 0.2 ? '低' : ratio < 0.5 && ratio >= 0.2 ? '中' : '高';
return (
<>
<Typography.Text type="secondary" style={{ marginRight: 6 }}>
代码社区贡献率
</Typography.Text>
<Typography.Text style={{ background: interactiveLevel === '低' ? 'red' : interactiveLevel === '中' ? 'orange' : 'green', borderRadius: 4, padding: '2px 6px', color: 'white', fontSize: 12 }}>
{interactiveLevel} {(ratio * 100).toFixed(1)}%
</Typography.Text>
</>
);
};
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions docs/components/composit/decode-phone.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# DecodePhone 手机号解码

**📦 手机号解码**

## 1. 基本使用

<code src="./../../demo/decode-phone/normal-usage.demo.tsx" />
6 changes: 3 additions & 3 deletions docs/components/composit/detail-card.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

**`📦 详情描述`通常经拼装后用于分块展示,经列表或表格映射到的某些数据详情页。**

## 1. 基本使用
## 基本使用

<code src="./../../demo/detail-card/normal-usage.demo.tsx"/>

## 2. 展示 Table 表格数据
## 展示 Table 表格数据

<code src="./../../demo/detail-card/as-table.demo.tsx"/>

## 3. 带快速访问的锚点
## 带快速访问的锚点

<code src="./../../demo/detail-card/with-anchor.demo.tsx"/>
4 changes: 3 additions & 1 deletion docs/components/interactivity/config-provider.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# ConfigProvider 全局化配置

**为组件提供统一的全局化配置。项目中必须使用`ConfigProvider`组件包裹可视区域的组件,否则无法正确引入样式和编程猫设计规范下的色彩配方。**
**为组件提供统一的全局化配置。**

<Alert>**重要**:项目中必须使用`ConfigProvider`组件包裹可视区域的组件,否则无法正确引入样式和编程猫设计规范下的色彩配方。</Alert>

### 基本使用

Expand Down
Loading

0 comments on commit 9eecfbb

Please sign in to comment.