diff --git a/.eslintignore b/.eslintignore
index 576c8151a65e40b3d1c53e0f117e295e0d347561..c1fcbb8a79c1eb2990b138469a6d86f8e02eefda 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -1,3 +1,3 @@
-/functions/mock/**
+/lambda/mock/**
/scripts
/config
diff --git a/.eslintrc.js b/.eslintrc.js
index 6e1deec0b3ad4efca56bbd73686775f8d30c190c..65707f5768b85b3da8e58c303c299d74fadee166 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -34,8 +34,8 @@ module.exports = {
'linebreak-style': 0,
},
settings: {
- polyfills: ['fetch', 'promises', 'url'],
// support import modules from TypeScript files in JavaScript files
'import/resolver': { node: { extensions: ['.js', '.ts', '.tsx'] } },
+ polyfills: ['fetch', 'promises', 'url', 'object-assign'],
},
};
diff --git a/.firebaserc b/.firebaserc
deleted file mode 100644
index e3a9a50c8a53831595f67ab41862f94d8f050bd0..0000000000000000000000000000000000000000
--- a/.firebaserc
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "projects": {
- "default": "antd-pro"
- }
-}
diff --git a/.gitignore b/.gitignore
index 2859215803d95b14b51d6618bf9cc99587b99aa1..253591b5200c5227e85ef7fa1ea33a5279a4deaa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,8 +25,8 @@ package-lock.json
# visual studio code
.history
*.log
-
-functions/mock
+functions/*
+lambda/mock/index.js
.temp/**
# umi
diff --git a/README.md b/README.md
index ce0725dfd5b671fde4dcc894108b4f8a997fe027..c6da6474c5ce12b04bd107d4eb5b3c74dd804b6d 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-English | [简体中文](./README.zh-CN.md) | [Русский](./README.ru-RU.md)
+English | [简体中文](./README.zh-CN.md) | [Русский](./README.ru-RU.md) | [Türkçe](./README.tr-TR.md)
Ant Design Pro
@@ -12,7 +12,7 @@ An out-of-box UI solution for enterprise applications as a React boilerplate.
[](https://david-dm.org/ant-design/ant-design-pro?type=dev)
[](https://gitter.im/ant-design/pro-english?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
[](https://gitter.im/ant-design/ant-design-pro?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
-
+[](https://app.netlify.com/sites/ant-design-pro/deploys)

diff --git a/README.ru-RU.md b/README.ru-RU.md
index 22d16c9ac83c9b8f56dbc9f409753ff589b7c00c..f820dfba2343571ac0803274109b2d989845e727 100644
--- a/README.ru-RU.md
+++ b/README.ru-RU.md
@@ -1,4 +1,4 @@
-[English](./README.md) | [简体中文](./README.zh-CN.md) | Русский
+[English](./README.md) | [简体中文](./README.zh-CN.md) | Русский | [Türkçe](./README.tr-TR.md)
Ant Design Pro
@@ -12,7 +12,7 @@ UI-решение "из коробки" для корпоративных при
[](https://david-dm.org/ant-design/ant-design-pro?type=dev)
[](https://gitter.im/ant-design/pro-english?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
[](https://gitter.im/ant-design/ant-design-pro?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
-
+[](https://app.netlify.com/sites/ant-design-pro/deploys)

diff --git a/README.tr-TR.md b/README.tr-TR.md
new file mode 100644
index 0000000000000000000000000000000000000000..8470cb79a41153736603c6bb92c63ebbbfdc2187
--- /dev/null
+++ b/README.tr-TR.md
@@ -0,0 +1,130 @@
+[English](./README.md) | [简体中文](./README.zh-CN.md) | [Русский](./README.ru-RU.md) | Türkçe
+
+Ant Design Pro
+
+
+
+React ile kurumsal uygulamalar için taslak olarak geliştirilmiş kullanıma hazır bir UI çözümü.
+
+[](https://circleci.com/gh/ant-design/ant-design-pro/)
+[](https://ci.appveyor.com/project/afc163/ant-design-pro/branch/master)
+[](https://david-dm.org/ant-design/ant-design-pro)
+[](https://david-dm.org/ant-design/ant-design-pro?type=dev)
+[](https://gitter.im/ant-design/pro-english?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)(🇺🇸)
+[](https://gitter.im/ant-design/ant-design-pro?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)(🇨🇳)
+[](https://app.netlify.com/sites/ant-design-pro/deploys)
+
+
+
+
+- Önizleme: http://preview.pro.ant.design
+- Anasayfa: http://pro.ant.design
+- Dokümantasyon: http://pro.ant.design/docs/getting-started
+- ChangeLog: http://pro.ant.design/docs/changelog
+- SSS: http://pro.ant.design/docs/faq
+- Çinde barındırılan site: http://ant-design-pro.gitee.io
+
+## 2.0 Versiyonu Şimdi Yayında! 🎉🎉🎉
+[Announcing Ant Design Pro 2.0.0](https://medium.com/ant-design/beautiful-and-powerful-ant-design-pro-2-0-release-51358da5af95)
+
+## Çeviri Desteği :loudspeaker:
+
+Çeviriler için yardımınıza ihtiyacımız var: https://github.com/ant-design/ant-design-pro/issues/120
+
+## Özellikler
+
+- :gem: **Zarif Tasarım**: Buradan [Ant Design özellikleri](http://ant.design/)
+- :triangular_ruler: **Ortak Şablonlar**: Kurumsal uygulamalar için şablonlar
+- :rocket: **Sanatsal gelişim durumu**: Newest development stack of React/umi/dva/antd
+- :iphone: **Responsive**: Değişken ekran boyutları için tasarlanmıştır
+- :art: **Tema Kullanımı**: Basit ayarlar ile özelleştirilebilir tema
+- :globe_with_meridians: **Uluslararası**: Built-in i18n solution
+- :gear: **Best Practices**: İyi kod için sağlam iş akışı
+- :1234: **Mock Geliştirme**: Model(Mock) geliştirmeler için kolay çözüm
+- :white_check_mark: **UI Testi**: Unit ve e2e testleri ile güvenli sürdürülebilirlik
+
+## Şablonlar
+
+```
+- Dashboard
+ - Analitik
+ - Monitör
+ - Çalışma alanı
+- Form
+ - Basit Form
+ - Step Form
+ - Gelişmiş Form
+- List
+ - Standard Tablo
+ - Standard Liste
+ - Kart Liste
+ - Arama Listesi (Project/Applications/Article)
+- Profil
+ - Basit Profil
+ - Gelişmiş Profil
+- Hesap
+ - Hesap Yönetimi
+ - Hesap Ayarları
+- Sonuç
+ - Başarılı
+ - Hatalı
+- Hatalar
+ - 403
+ - 404
+ - 500
+- Kullanıcı
+ - Giriş
+ - Kayıt
+ - Kayıt Sonucu
+```
+
+## Kullanım
+
+### bash ile kullanım
+
+```bash
+$ git clone https://github.com/ant-design/ant-design-pro.git --depth=1
+$ cd ant-design-pro
+$ npm install
+$ npm start # visit http://localhost:8000
+```
+
+### Docker ile kullanım
+
+```bash
+# preview
+$ docker pull chenshuai2144/ant-design-pro
+$ docker run -p 80:80 chenshuai2144/ant-design-pro
+# open http://localhost
+
+# dev
+$ npm run docker:dev
+
+# build
+$ npm run docker:build
+
+
+# production dev
+$ npm run docker-prod:dev
+
+# production build
+$ npm run docker-prod:build
+```
+
+Daha fazla talimat için [dokümantasyon](http://pro.ant.design/docs/getting-started) sayfasına göz atın.
+
+## Tarayıcı desteği
+
+Modern internet tarayıcıları ve IE11.
+
+| [
](http://godban.github.io/browsers-support-badges/)IE / Edge | [
](http://godban.github.io/browsers-support-badges/)Firefox | [
](http://godban.github.io/browsers-support-badges/)Chrome | [
](http://godban.github.io/browsers-support-badges/)Safari | [
](http://godban.github.io/browsers-support-badges/)Opera |
+| --------- | --------- | --------- | --------- | --------- |
+| IE11, Edge| son 2 versiyon | son 2 versiyon | son 2 versiyon | son 2 versiyon
+
+## Destek
+
+Her türlü desteğinize açığız, bu projeye nasıl katkıda bulunabileceğinize dair bazı örnekler:
+
+- Günlük işinizde Ant Design Pro kullanın.
+- Hataları bildirmek veya soru sormak için [issues](http://github.com/ant-design/ant-design-pro/issues) gönderin.
+- kodumuzu geliştirmek için [pull requests](http://github.com/ant-design/ant-design-pro/pulls) gönderin.
diff --git a/README.zh-CN.md b/README.zh-CN.md
index 6b150506179b433d3dbf5c4ad5ced0c00c86dcb9..b4b3b722c650b12905a652c59076252129a8d897 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -1,4 +1,4 @@
-[English](./README.md) | 简体中文 | [Русский](./README.ru-RU.md)
+[English](./README.md) | 简体中文 | [Русский](./README.ru-RU.md) | [Türkçe](./README.tr-TR.md)
Ant Design Pro
@@ -11,7 +11,7 @@
[](https://david-dm.org/ant-design/ant-design-pro)
[](https://david-dm.org/ant-design/ant-design-pro?type=dev)
[](https://gitter.im/ant-design/ant-design-pro?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
-
+[](https://app.netlify.com/sites/ant-design-pro/deploys)

diff --git a/config/config.ts b/config/config.ts
index 36b531e3a3c5d1e03e69632da2878549d82b1be2..47f5971044abbbc2644bda5716014cf329de07cf 100644
--- a/config/config.ts
+++ b/config/config.ts
@@ -1,5 +1,5 @@
// https://umijs.org/config/
-// import os from 'os';
+import os from 'os';
import slash from 'slash2';
import { IPlugin, IConfig } from 'umi-types';
import defaultSettings from './defaultSettings';
@@ -26,12 +26,23 @@ const plugins: IPlugin[] = [
webpackChunkName: true,
level: 3,
},
- pwa: {
- workboxPluginMode: 'InjectManifest',
- workboxOptions: {
- importWorkboxFrom: 'local',
- },
- },
+ pwa: pwa
+ ? {
+ workboxPluginMode: 'InjectManifest',
+ workboxOptions: {
+ importWorkboxFrom: 'local',
+ },
+ }
+ : false,
+ ...(!TEST && os.platform() === 'darwin'
+ ? {
+ dll: {
+ include: ['dva', 'dva/router', 'dva/saga', 'dva/fetch'],
+ exclude: ['@babel/runtime'],
+ },
+ hardSource: false,
+ }
+ : {}),
},
],
[
@@ -103,10 +114,6 @@ export default {
theme: {
'primary-color': primaryColor,
},
- externals: {
- '@antv/data-set': 'DataSet',
- bizcharts: 'BizCharts',
- },
// proxy: {
// '/server/api/': {
// target: 'https://preview.pro.ant.design/',
diff --git a/config/defaultSettings.ts b/config/defaultSettings.ts
index d489b711f77fff812c6586815b545335f438decc..25335aea93c65a8e61f3a6dd8cb205c706ba416d 100644
--- a/config/defaultSettings.ts
+++ b/config/defaultSettings.ts
@@ -34,11 +34,10 @@ export interface DefaultSettings {
menu: { disableLocal: boolean };
title: string;
pwa: boolean;
- /**
- * your iconfont Symbol Scrip Url
- * eg:`//at.alicdn.com/t/font_1039637_btcrd5co4w.js`
- * 注意:如果需要图标多色,Iconfont图标项目里要进行批量去色处理
- */
+ // Your custom iconfont Symbol script Url
+ // eg://at.alicdn.com/t/font_1039637_btcrd5co4w.js
+ // 注意:如果需要图标多色,Iconfont 图标项目里要进行批量去色处理
+ // Usage: https://github.com/ant-design/ant-design-pro/pull/3517
iconfontUrl: string;
colorWeak: boolean;
}
diff --git a/config/plugin.config.ts b/config/plugin.config.ts
index b9e842d26a900cceb0880b75c3e5c7489cb0c81f..2273586e6753a24ea561f7ff8764926e3985688a 100644
--- a/config/plugin.config.ts
+++ b/config/plugin.config.ts
@@ -4,6 +4,25 @@ import MergeLessPlugin from 'antd-pro-merge-less';
import AntDesignThemePlugin from 'antd-theme-webpack-plugin';
import path from 'path';
+function getModulePackageName(module) {
+ if (!module.context) return null;
+
+ const nodeModulesPath = path.join(__dirname, '../node_modules/');
+ if (module.context.substring(0, nodeModulesPath.length) !== nodeModulesPath) {
+ return null;
+ }
+
+ const moduleRelativePath = module.context.substring(nodeModulesPath.length);
+ const [moduleDirName] = moduleRelativePath.split(path.sep);
+ let packageName = moduleDirName;
+ // handle tree shaking
+ if (packageName.match('^_')) {
+ // eslint-disable-next-line prefer-destructuring
+ packageName = packageName.match(/^_(@?[^@]+)/)[1];
+ }
+ return packageName;
+}
+
export default config => {
// pro 和 开发环境再添加这个插件
if (process.env.APP_TYPE === 'site' || process.env.NODE_ENV !== 'production') {
@@ -30,4 +49,32 @@ export default config => {
},
]);
}
+ // optimize chunks
+ config.optimization
+ .runtimeChunk(false) // share the same chunks across different modules
+ .splitChunks({
+ chunks: 'async',
+ name: 'vendors',
+ maxInitialRequests: Infinity,
+ minSize: 0,
+ cacheGroups: {
+ vendors: {
+ test: module => {
+ const packageName = getModulePackageName(module);
+ if (packageName) {
+ return ['bizcharts', '@antv_data-set'].indexOf(packageName) >= 0;
+ }
+ return false;
+ },
+ name(module) {
+ const packageName = getModulePackageName(module);
+
+ if (['bizcharts', '@antv_data-set'].indexOf(packageName) >= 0) {
+ return 'viz'; // visualization package
+ }
+ return 'misc';
+ },
+ },
+ },
+ });
};
diff --git a/firebase.json b/firebase.json
deleted file mode 100644
index a00223d4ddce6ed47ef14af8e3b78f86294c0706..0000000000000000000000000000000000000000
--- a/firebase.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "hosting": {
- "public": "dist",
- "rewrites": [
- { "source": "/api/**", "function": "api" },
- {
- "source": "**",
- "destination": "/index.html"
- }
- ],
- "ignore": ["firebase.json", "**/.*", "**/node_modules/**"]
- }
-}
diff --git a/functions/index.js b/functions/index.js
deleted file mode 100644
index 609b51ca4df69bf827cac9ba7e600bd6685eec89..0000000000000000000000000000000000000000
--- a/functions/index.js
+++ /dev/null
@@ -1,10 +0,0 @@
-// [START functionsimport]
-const functions = require('firebase-functions');
-const express = require('express');
-
-const matchMock = require('./matchMock');
-
-const app = express();
-
-app.use(matchMock);
-exports.api = functions.https.onRequest(app);
diff --git a/lambda/api.js b/lambda/api.js
new file mode 100644
index 0000000000000000000000000000000000000000..e0c147a6a3baa8ee307b69df1a4a2d11ba1072c5
--- /dev/null
+++ b/lambda/api.js
@@ -0,0 +1,11 @@
+// [START functions import]
+const express = require('express');
+const serverLess = require('serverless-http');
+
+const matchMock = require('./mock/matchMock');
+
+const app = express();
+
+app.use(matchMock);
+
+exports.handler = serverLess(app);
diff --git a/functions/matchMock.js b/lambda/mock/matchMock.js
similarity index 90%
rename from functions/matchMock.js
rename to lambda/mock/matchMock.js
index 924573a53a6c1cf5b58a45f43487b06b96516929..94027802a6174e0bc0322a402c51d1ec51a53bd7 100644
--- a/functions/matchMock.js
+++ b/lambda/mock/matchMock.js
@@ -1,7 +1,7 @@
const pathToRegexp = require('path-to-regexp');
const bodyParser = require('body-parser');
-const mockFile = require('./mock/index');
+const mockFile = require('./index');
const BODY_PARSED_METHODS = ['post', 'put', 'patch'];
@@ -10,13 +10,14 @@ function parseKey(key) {
let method = 'get';
let path = key;
if (key.indexOf(' ') > -1) {
- const splited = key.split(' ');
- method = splited[0].toLowerCase();
- path = splited[1]; // eslint-disable-line
+ const spliced = key.split(' ');
+ method = spliced[0].toLowerCase();
+ path = spliced[1]; // eslint-disable-line
}
+ const routerBasePath = process.env.NODE_ENV === 'dev' ? `${path}` : `/.netlify/functions${path}`;
return {
method,
- path,
+ path: routerBasePath,
};
}
diff --git a/netlify.toml b/netlify.toml
index 18b22e9d58b17ae991caaa6f96317b1aeac87f93..9d3438c4aff06f5a644d10167b5c7133f5175e45 100644
--- a/netlify.toml
+++ b/netlify.toml
@@ -1,12 +1,15 @@
+[build]
+ functions = "./functions"
+
[[redirects]]
from = "/api/*"
- to = "https://us-central1-antd-pro.cloudfunctions.net/api/api/:splat"
+ to = "/.netlify/functions/api/:splat"
status = 200
force = true
[redirects.headers]
X-From = "Netlify"
X-Api-Key = "some-api-key-string"
-
+
[[redirects]]
from = "/*"
to = "/index.html"
diff --git a/package.json b/package.json
index 9be65a898c2a22ee4381cc0f4b4a122688855282..a95c87e657bf93bf3067e1c94d2cd5964d1370ff 100644
--- a/package.json
+++ b/package.json
@@ -1,48 +1,77 @@
{
"name": "ant-design-pro",
- "version": "2.2.1",
- "description": "An out-of-box UI solution for enterprise applications",
+ "version": "2.3.1",
"private": true,
+ "description": "An out-of-box UI solution for enterprise applications",
"scripts": {
- "presite": "cd functions && npm install",
- "start": "cross-env APP_TYPE=site umi dev",
- "start:no-mock": "cross-env MOCK=none umi dev",
+ "analyze": "cross-env ANALYZE=1 umi build",
+ "build": "umi build",
"dev": "cross-env APP_TYPE=site umi dev",
"dev:no-mock": "cross-env MOCK=none umi dev",
- "build": "umi build",
- "analyze": "cross-env ANALYZE=1 umi build",
- "lint:js": "eslint --ext .js src tests",
- "lint:ts": "tslint -p . -c tslint.yml",
- "lint:style": "stylelint 'src/**/*.less' --syntax less",
- "lint:prettier": "check-prettier lint",
- "lint": "npm run lint:js && npm run lint:ts && npm run lint:style && npm run lint:prettier",
- "lint:fix": "eslint --fix --ext .js src tests && tslint --fix -p . -c tslint.yml && stylelint --fix 'src/**/*.less' --syntax less",
+ "docker-hub:build": "docker build -f Dockerfile.hub -t ant-design-pro ./",
+ "docker-prod:build": "docker-compose -f ./docker/docker-compose.yml build",
+ "docker-prod:dev": "docker-compose -f ./docker/docker-compose.yml up",
+ "docker:build": "docker-compose -f ./docker/docker-compose.dev.yml build",
+ "docker:dev": "docker-compose -f ./docker/docker-compose.dev.yml up",
+ "docker:push": "npm run docker-hub:build && npm run docker:tag && docker push antdesign/ant-design-pro",
+ "docker:tag": "docker tag ant-design-pro antdesign/ant-design-pro",
+ "functions:build": "npm run generateMock && netlify-lambda build ./lambda",
+ "functions:run": "npm run generateMock && cross-env NODE_ENV=dev netlify-lambda serve ./lambda",
+ "generateMock": "node ./scripts/generateMock",
+ "lint": "eslint --ext .js src mock tests && npm run lint:style && npm run lint:prettier",
"lint-staged": "lint-staged",
"lint-staged:js": "eslint --ext .js",
"lint-staged:ts": "tslint",
+ "lint:fix": "eslint --fix --ext .js src mock tests && stylelint --fix 'src/**/*.less' --syntax less",
+ "lint:js": "eslint --ext .js src tests",
+ "lint:prettier": "check-prettier lint",
+ "lint:style": "stylelint 'src/**/*.less' --syntax less",
+ "lint:ts": "tslint -p . -c tslint.yml",
+ "presite": "cd functions && npm install",
+ "prettier": "node ./scripts/prettier.js",
+ "start": "cross-env APP_TYPE=site umi dev",
+ "start:no-mock": "cross-env MOCK=none umi dev",
"test": "umi test",
- "test:component": "umi test ./src/components",
"test:all": "node ./tests/run-tests.js",
- "prettier": "node ./scripts/prettier.js",
- "docker:dev": "docker-compose -f ./docker/docker-compose.dev.yml up",
- "docker:build": "docker-compose -f ./docker/docker-compose.dev.yml build",
- "docker-prod:dev": "docker-compose -f ./docker/docker-compose.yml up",
- "docker-prod:build": "docker-compose -f ./docker/docker-compose.yml build",
- "docker-hub:build": "docker build -f Dockerfile.hub -t ant-design-pro ./",
- "docker:tag": "docker tag ant-design-pro antdesign/ant-design-pro",
- "docker:push": "npm run docker-hub:build && npm run docker:tag && docker push antdesign/ant-design-pro"
+ "test:component": "umi test ./src/components",
+ "tslint": "npm run tslint:fix",
+ "tslint:fix": "tslint --fix 'src/**/*.ts*'"
+ },
+ "husky": {
+ "hooks": {
+ "pre-commit": "npm run lint-staged"
+ }
},
+ "lint-staged": {
+ "**/*.less": "stylelint --syntax less",
+ "**/*.{js,jsx}": "npm run lint-staged:js",
+ "**/*.{js,ts,tsx,json,jsx,less}": [
+ "node ./scripts/lint-prettier.js",
+ "git add"
+ ],
+ "**/*.{ts,tsx}": "npm run lint-staged:ts"
+ },
+ "browserslist": [
+ "> 1%",
+ "last 2 versions",
+ "not ie <= 10"
+ ],
"dependencies": {
+ "@types/classnames": "^2.2.7",
+ "@types/react-document-title": "^2.0.3",
"ant-design-pro": "^2.3.0",
"antd": "^3.15.0",
"classnames": "^2.2.6",
"dva": "^2.4.0",
+ "express": "^4.16.4",
"lodash": "^4.17.10",
"lodash-decorators": "^6.0.0",
+ "lodash.isequal": "^4.5.0",
"memoize-one": "^5.0.0",
"moment": "^2.22.2",
"omit.js": "^1.0.0",
"path-to-regexp": "^2.4.0",
+ "qs": "^6.7.0",
"rc-animate": "^2.4.4",
"react": "^16.8.5",
"react-container-query": "^0.11.0",
@@ -53,13 +82,9 @@
"umi-request": "^1.0.0"
},
"devDependencies": {
- "@types/classnames": "^2.2.7",
- "@types/enzyme": "^3.9.0",
- "@types/jest": "^24.0.11",
- "@types/lodash": "^4.14.122",
- "@types/memoize-one": "^4.1.0",
+ "@types/history": "^4.7.2",
"@types/react": "^16.8.1",
- "@types/react-document-title": "^2.0.3",
+ "@types/react-dom": "^16.0.11",
"antd-pro-merge-less": "^1.0.0",
"antd-theme-webpack-plugin": "^1.2.0",
"babel-eslint": "^10.0.1",
@@ -70,16 +95,16 @@
"enzyme": "^3.9.0",
"eslint": "^5.13.0",
"eslint-config-airbnb": "^17.1.0",
- "eslint-config-prettier": "^4.0.0",
+ "eslint-config-prettier": "^4.1.0",
"eslint-plugin-babel": "^5.3.0",
"eslint-plugin-compat": "^2.6.3",
"eslint-plugin-import": "^2.16.0",
- "eslint-plugin-jsx-a11y": "^6.2.0",
+ "eslint-plugin-jsx-a11y": "^6.2.1",
"eslint-plugin-markdown": "^1.0.0",
"eslint-plugin-react": "^7.12.4",
"gh-pages": "^2.0.1",
"husky": "^1.3.1",
- "jest-puppeteer": "^4.0.0",
+ "jest-puppeteer": "^4.1.0",
"less": "^3.9.0",
"lint-staged": "^8.1.1",
"merge-umi-mock-data": "^1.0.4",
@@ -98,40 +123,21 @@
"tslint-eslint-rules": "^5.4.0",
"tslint-react": "^3.6.0",
"umi-plugin-ga": "^1.1.3",
- "umi-plugin-pro-block": "^1.2.0",
- "umi-plugin-react": "^1.3.4",
+ "umi-plugin-pro-block": "^1.3.0",
+ "umi-plugin-react": "^1.7.2",
"umi-types": "^0.2.0"
},
"optionalDependencies": {
"puppeteer": "^1.12.1"
},
- "lint-staged": {
- "**/*.{js,ts,tsx,json,jsx,less}": [
- "node ./scripts/lint-prettier.js",
- "git add"
- ],
- "**/*.{js,jsx}": "npm run lint-staged:js",
- "**/*.{ts,tsx}": "npm run lint-staged:ts",
- "**/*.less": "stylelint --syntax less"
- },
"engines": {
"node": ">=8.0.0"
},
- "browserslist": [
- "> 1%",
- "last 2 versions",
- "not ie <= 10"
- ],
"checkFiles": [
"src/**/*.js*",
"src/**/*.ts*",
"src/**/*.less",
"config/**/*.js*",
"scripts/**/*.js"
- ],
- "husky": {
- "hooks": {
- "pre-commit": "npm run lint-staged"
- }
- }
+ ]
}
diff --git a/scripts/generateMock.js b/scripts/generateMock.js
index 54c7d6d624fcefd98cec3600538284a5056910a7..e8600caf24a4bcb509b1bd8f691bed89febc5c49 100644
--- a/scripts/generateMock.js
+++ b/scripts/generateMock.js
@@ -1,3 +1,3 @@
const generateMock = require('merge-umi-mock-data');
const path = require('path');
-generateMock(path.join(__dirname, '../mock'), path.join(__dirname, '../functions/mock/index.js'));
+generateMock(path.join(__dirname, '../mock'), path.join(__dirname, '../lambda/mock/index.js'));
diff --git a/scripts/prettier.js b/scripts/prettier.js
index 17ded6c500f4233ae5e998d0535992617f82e666..22a6b2d42cabb223e5a4c75384d08bedc54c459d 100644
--- a/scripts/prettier.js
+++ b/scripts/prettier.js
@@ -36,6 +36,7 @@ files.forEach(file => {
console.log(chalk.green(`${file} is prettier`));
}
} catch (e) {
+ console.log(e);
didError = true;
}
});
diff --git a/src/components/GlobalHeader/RightContent.tsx b/src/components/GlobalHeader/RightContent.tsx
index 919e8428914230ba6cc9391c055e2dbd427d7f1d..d8770468b8fb03df376bead65d43b727d26be94e 100644
--- a/src/components/GlobalHeader/RightContent.tsx
+++ b/src/components/GlobalHeader/RightContent.tsx
@@ -2,9 +2,9 @@ import { ConnectProps } from '@/models/connect';
import { NoticeItem } from '@/models/global';
import { CurrentUser } from '@/models/user';
import React, { Component } from 'react';
-import { FormattedMessage, formatMessage } from 'umi-plugin-locale';
import { Spin, Tag, Menu, Icon, Avatar, Tooltip, message } from 'antd';
import { ClickParam } from 'antd/es/menu';
+import { FormattedMessage, formatMessage } from 'umi-plugin-react/locale';
import moment from 'moment';
import groupBy from 'lodash/groupBy';
import { NoticeIcon } from 'ant-design-pro';
diff --git a/src/components/HeaderDropdown/index.d.ts b/src/components/HeaderDropdown/index.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..a1fd50aa0f0deb8db3effed9e65e5e9c6a066286
--- /dev/null
+++ b/src/components/HeaderDropdown/index.d.ts
@@ -0,0 +1,12 @@
+import React from 'react';
+import { DropDownProps } from 'antd/lib/dropdown';
+
+declare type OverlayFunc = () => React.ReactNode;
+
+export interface HeaderDropdownProps extends DropDownProps {
+ overlayClassName?: string;
+ overlay: React.ReactNode | OverlayFunc;
+ placement?: 'bottomLeft' | 'bottomRight' | 'topLeft' | 'topCenter' | 'topRight' | 'bottomCenter';
+}
+
+export default class HeaderDropdown extends React.Component {}
diff --git a/src/components/HeaderSearch/index.d.ts b/src/components/HeaderSearch/index.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..fcf7c11d2205b5a75ca6c797c8e936be00ddb2b7
--- /dev/null
+++ b/src/components/HeaderSearch/index.d.ts
@@ -0,0 +1,15 @@
+import React from 'react';
+export interface HeaderSearchProps {
+ placeholder?: string;
+ dataSource?: string[];
+ defaultOpen?: boolean;
+ open?: boolean;
+ onSearch?: (value: string) => void;
+ onChange?: (value: string) => void;
+ onVisibleChange?: (visible: boolean) => void;
+ onPressEnter?: (value: string) => void;
+ style?: React.CSSProperties;
+ className?: string;
+}
+
+export default class HeaderSearch extends React.Component {}
diff --git a/src/components/SelectLang/index.tsx b/src/components/SelectLang/index.tsx
index e3ae9975f254f873d35601c130d09ae140284534..0434bd2ced90f9c3ae10b9dce1e26b716b133673 100644
--- a/src/components/SelectLang/index.tsx
+++ b/src/components/SelectLang/index.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import { formatMessage, setLocale, getLocale } from 'umi-plugin-locale';
+import { formatMessage, setLocale, getLocale } from 'umi-plugin-react/locale';
import { Menu, Icon } from 'antd';
import { ClickParam } from 'antd/es/menu';
import classNames from 'classnames';
diff --git a/src/components/SettingDrawer/BlockCheckbox.d.ts b/src/components/SettingDrawer/BlockCheckbox.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..1012294ec0d129e79c936ed8c9cdce681eaad980
--- /dev/null
+++ b/src/components/SettingDrawer/BlockCheckbox.d.ts
@@ -0,0 +1,9 @@
+import React from 'react';
+
+export interface BlockChecboxProps {
+ value: string;
+ onChange: (key: string) => void;
+ list: any[];
+}
+
+export default class BlockChecbox extends React.Component {}
diff --git a/src/components/SettingDrawer/index.d.ts b/src/components/SettingDrawer/index.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..22273089eb54c481a581cd0e53635b05fbae8234
--- /dev/null
+++ b/src/components/SettingDrawer/index.d.ts
@@ -0,0 +1,24 @@
+import React from 'react';
+import { SiderTheme } from 'antd/es/Layout/Sider';
+
+export interface SettingModelState {
+ navTheme: string | SiderTheme;
+ primaryColor: string;
+ layout: string;
+ contentWidth: string;
+ fixedHeader: boolean;
+ autoHideHeader: boolean;
+ fixSiderbar: boolean;
+ menu: { disableLocal: boolean };
+ title: string;
+ pwa: boolean;
+ iconfontUrl: string;
+ colorWeak: boolean;
+}
+
+export interface SettingDrawerProps {
+ setting?: SettingModelState;
+ dispatch?: (args: any) => void;
+}
+
+export default class SettingDrawer extends React.Component {}
diff --git a/src/components/SettingDrawer/index.less b/src/components/SettingDrawer/index.less
index 4ee941c0e6caf5ce03f59852341041a44c5fc2be..bb64b0795b559b830349a30dec19b8cfdceed825 100644
--- a/src/components/SettingDrawer/index.less
+++ b/src/components/SettingDrawer/index.less
@@ -4,6 +4,13 @@
position: relative;
min-height: 100%;
background: #fff;
+ :global {
+ .ant-list-item {
+ span {
+ flex: 1;
+ }
+ }
+ }
}
.blockChecbox {
diff --git a/src/components/SettingDrawer/index.tsx b/src/components/SettingDrawer/index.tsx
index fb501ddd6cfd8abbb89fcc08a00304eb8998fe5c..2201acb79649fa4e487e8ca9b4102cc6f68f667a 100644
--- a/src/components/SettingDrawer/index.tsx
+++ b/src/components/SettingDrawer/index.tsx
@@ -1,7 +1,7 @@
import { ConnectProps, ConnectState, SettingModelState } from '@/models/connect';
import React, { Component } from 'react';
import { Select, message, Drawer, List, Switch, Divider, Icon, Button, Alert, Tooltip } from 'antd';
-import { formatMessage } from 'umi-plugin-locale';
+import { formatMessage } from 'umi-plugin-react/locale';
import { CopyToClipboard } from 'react-copy-to-clipboard';
import { connect } from 'dva';
import omit from 'omit.js';
@@ -152,10 +152,18 @@ class SettingDrawer extends Component {
placement="right"
handler={
-
+
}
- style={{ zIndex: 999 }}
+ style={{
+ zIndex: 999,
+ }}
>
@@ -213,18 +221,22 @@ class SettingDrawer extends Component
{
- this.changeSetting('colorWeak', checked)}
- />,
+ this.changeSetting('colorWeak', checked)}
+ />
+ ),
+ },
]}
- >
- {formatMessage({ id: 'app.setting.weakmode' })}
-
+ />
{
static getDerivedStateFromProps(props: TopNavHeaderProps) {
return {
- maxWidth: (props.contentWidth === 'Fixed' ? 1200 : window.innerWidth) - 280 - 165 - 40,
+ maxWidth:
+ (props.contentWidth === 'Fixed' && window.innerWidth > 1200 ? 1200 : window.innerWidth) -
+ 280 -
+ 120 -
+ 40,
};
}
diff --git a/src/global.tsx b/src/global.tsx
index fc2a7359bbba7e5fa84507cc52062902e0fb83ef..d2e1a05cca82bc372e3e04857f27b2a0c40574e5 100644
--- a/src/global.tsx
+++ b/src/global.tsx
@@ -1,6 +1,6 @@
import React from 'react';
import { notification, Button, message } from 'antd';
-import { formatMessage } from 'umi-plugin-locale';
+import { formatMessage } from 'umi-plugin-react/locale';
import defaultSettings from '../config/defaultSettings';
(window as any).React = React;
diff --git a/src/layouts/Header.tsx b/src/layouts/Header.tsx
index 9c064cace646ac9e0b55d8ec30e21226fd61f847..c00145114f495d48102f66325ac6c6cb99b8a0bd 100644
--- a/src/layouts/Header.tsx
+++ b/src/layouts/Header.tsx
@@ -1,12 +1,12 @@
import GlobalHeader, { GlobalHeaderProps } from '@/components/GlobalHeader';
import TopNavHeader, { TopNavHeaderProps } from '@/components/TopNavHeader';
import { ConnectProps, ConnectState, SettingModelState } from '@/models/connect';
+import React, { Component } from 'react';
+import { formatMessage } from 'umi-plugin-react/locale';
import { Layout, message } from 'antd';
import { ClickParam } from 'antd/es/menu';
import { connect } from 'dva';
import Animate from 'rc-animate';
-import React, { Component } from 'react';
-import { formatMessage } from 'umi-plugin-locale';
import router from 'umi/router';
import styles from './Header.less';
@@ -25,10 +25,6 @@ interface HeaderViewState {
}
class HeaderView extends Component {
- static defaultProps: Partial = {
- handleMenuCollapse: () => void 0,
- };
-
static getDerivedStateFromProps(props: HeaderViewProps, state: HeaderViewState) {
if (!props.autoHideHeader && !state.visible) {
return {
@@ -37,12 +33,12 @@ class HeaderView extends Component {
}
return null;
}
+ state = {
+ visible: true,
+ };
ticking: boolean = false;
oldScrollTop: number = 0;
- state: HeaderViewState = {
- visible: true,
- };
componentDidMount() {
document.addEventListener('scroll', this.handScroll, { passive: true });
diff --git a/src/models/menu.ts b/src/models/menu.ts
index 2c09ce4120b1ac6a70ef472d802a30eb833fae30..3f94e964637cbbdd08228059da2abc36820555ee 100644
--- a/src/models/menu.ts
+++ b/src/models/menu.ts
@@ -4,7 +4,7 @@ import { Effect } from 'dva';
import isEqual from 'lodash/isEqual';
import memoizeOne from 'memoize-one';
import { Reducer } from 'redux';
-import { formatMessage } from 'umi-plugin-locale';
+import { formatMessage } from 'umi-plugin-react/locale';
import { IRoute } from 'umi-types';
import defaultSettings from '../../config/defaultSettings';
diff --git a/src/services/api.js b/src/services/api.js
new file mode 100644
index 0000000000000000000000000000000000000000..5358a8e186a0adae677c5db8b7d8e815a2cd53ed
--- /dev/null
+++ b/src/services/api.js
@@ -0,0 +1,126 @@
+import { stringify } from 'qs';
+import request from '@/utils/request';
+
+export async function queryProjectNotice() {
+ return request('/api/project/notice');
+}
+
+export async function queryActivities() {
+ return request('/api/activities');
+}
+
+export async function queryRule(params) {
+ return request(`/api/rule?${stringify(params)}`);
+}
+
+export async function removeRule(params) {
+ return request('/api/rule', {
+ method: 'POST',
+ data: {
+ ...params,
+ method: 'delete',
+ },
+ });
+}
+
+export async function addRule(params) {
+ return request('/api/rule', {
+ method: 'POST',
+ data: {
+ ...params,
+ method: 'post',
+ },
+ });
+}
+
+export async function updateRule(params = {}) {
+ return request(`/api/rule?${stringify(params.query)}`, {
+ method: 'POST',
+ data: {
+ ...params.body,
+ method: 'update',
+ },
+ });
+}
+
+export async function fakeSubmitForm(params) {
+ return request('/api/forms', {
+ method: 'POST',
+ data: params,
+ });
+}
+
+export async function fakeChartData() {
+ return request('/api/fake_chart_data');
+}
+
+export async function queryTags() {
+ return request('/api/tags');
+}
+
+export async function queryBasicProfile(id) {
+ return request(`/api/profile/basic?id=${id}`);
+}
+
+export async function queryAdvancedProfile() {
+ return request('/api/profile/advanced');
+}
+
+export async function queryFakeList(params) {
+ return request(`/api/fake_list?${stringify(params)}`);
+}
+
+export async function removeFakeList(params) {
+ const { count = 5, ...restParams } = params;
+ return request(`/api/fake_list?count=${count}`, {
+ method: 'POST',
+ data: {
+ ...restParams,
+ method: 'delete',
+ },
+ });
+}
+
+export async function addFakeList(params) {
+ const { count = 5, ...restParams } = params;
+ return request(`/api/fake_list?count=${count}`, {
+ method: 'POST',
+ data: {
+ ...restParams,
+ method: 'post',
+ },
+ });
+}
+
+export async function updateFakeList(params) {
+ const { count = 5, ...restParams } = params;
+ return request(`/api/fake_list?count=${count}`, {
+ method: 'POST',
+ data: {
+ ...restParams,
+ method: 'update',
+ },
+ });
+}
+
+export async function fakeAccountLogin(params) {
+ return request('/api/login/account', {
+ method: 'POST',
+ data: params,
+ });
+}
+
+export async function fakeRegister(params) {
+ return request('/api/register', {
+ method: 'POST',
+ data: params,
+ });
+}
+
+export async function queryNotices(params = {}) {
+ return request(`/api/notices?${stringify(params)}`);
+}
+
+export async function getFakeCaptcha(mobile) {
+ return request(`/api/captcha?mobile=${mobile}`);
+}
diff --git a/src/utils/authority.ts b/src/utils/authority.ts
index 49ee0abf32119cd5757af615c457857e9b101ecc..a5bb250888dc12a3ce3c85a9da3397c6fa35435f 100644
--- a/src/utils/authority.ts
+++ b/src/utils/authority.ts
@@ -13,7 +13,7 @@ export function getAuthority(str?: string): any {
if (typeof authority === 'string') {
return [authority];
}
- return authority || ['admin'];
+ return authority;
}
export function setAuthority(authority: string | string[]): void {
diff --git a/src/utils/getPageTitle.ts b/src/utils/getPageTitle.ts
index d131ea85b366cbbd1ec34b304582ccbad9938d35..6622771dc644045b5f57a03ce8f7d29b2d88e078 100644
--- a/src/utils/getPageTitle.ts
+++ b/src/utils/getPageTitle.ts
@@ -1,7 +1,7 @@
import isEqual from 'lodash/isEqual';
import memoizeOne from 'memoize-one';
import pathToRegexp from 'path-to-regexp';
-import { formatMessage } from 'umi-plugin-locale';
+import { formatMessage } from 'umi-plugin-react/locale';
import defaultSettings from '../../config/defaultSettings';
import { MenuDataItem } from '@/components/SiderMenu/BaseMenu';